/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0d1017;
  --bg2:         #161b27;
  --bg3:         #1e2435;
  --border:      #272d42;
  --accent:      #6c63ff;
  --accent-glow: rgba(108,99,255,.18);
  --accent2:     #4ecca3;
  --danger:      #e05252;
  --danger-soft: rgba(224,82,82,.12);
  --text:        #dde2f0;
  --text-muted:  #7a7f9a;
  --radius:      12px;
  --shadow:      0 4px 32px rgba(0,0,0,.45);
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────── */
header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.logo {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.logo-icon { font-size: 22px; }
.logo-img  { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; border-radius: 4px; }
nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 12px;
  transition: all .15s;
}
nav a:hover { color: var(--text); border-color: var(--accent); }

/* ── Main ────────────────────────────────────────────────── */
main {
  max-width: 780px;
  width: 100%;
  margin: 32px auto;
  padding: 0 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* ── Hero / address card ─────────────────────────────────── */
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.address-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  transition: border-color .2s;
}
.address-row:focus-within { border-color: var(--accent); }

.address-text {
  flex: 1;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 18px;
  letter-spacing: .3px;
  color: var(--accent2);
  word-break: break-all;
  user-select: all;
}

/* ── Controls row ────────────────────────────────────────── */
.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

.domain-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.control-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Custom address form ─────────────────────────────────── */
.custom-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
}
.custom-form input {
  flex: 1;
  min-width: 110px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--text);
  font-family: monospace;
  font-size: 14px;
  transition: border-color .15s;
}
.custom-form input:focus { outline: none; border-color: var(--accent); }
.at { font-weight: 700; color: var(--text-muted); padding: 0 2px; }

/* ── Meta row ────────────────────────────────────────────── */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 10px;
}
.meta-pill.accent {
  color: var(--accent2);
  border-color: rgba(78,204,163,.3);
  background: rgba(78,204,163,.08);
}

/* ── Inbox ───────────────────────────────────────────────── */
.inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.inbox-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.inbox-title h2 { font-size: 16px; font-weight: 700; }

.inbox-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.countdown {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.countdown strong { color: var(--accent2); }

.badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  line-height: 1.6;
}

/* ── Skeleton loader ─────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton-row {
  height: 56px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--bg3) 25%, var(--border) 50%, var(--bg3) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
}
.skeleton-row.short { width: 60%; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 52px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 52px; margin-bottom: 14px; }
.empty-state p { margin-bottom: 4px; }
.empty-state strong { color: var(--accent2); }
.hint { font-size: 13px; color: var(--text-muted); }

/* ── Email list ──────────────────────────────────────────── */
.email-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.email-item:last-child { border-bottom: none; }
.email-item:hover { background: var(--bg3); }

.email-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 6px var(--accent);
}
.email-item.read .email-dot { background: transparent; box-shadow: none; }

.email-info { flex: 1; min-width: 0; }
.email-from    { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-subject { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }
.email-item.unread .email-subject { font-weight: 600; color: var(--text); }

.email-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.email-date  { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}
.page-info { font-size: 13px; color: var(--text-muted); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 740px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.modal-header h3 { font-size: 17px; flex: 1; line-height: 1.4; }
.modal-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.modal-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tab-bar { display: flex; gap: 4px; margin-bottom: 12px; }
.tab {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 14px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-content { flex: 1; }
#modal-iframe {
  width: 100%;
  height: 420px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}
#modal-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 16px;
  max-height: 420px;
  overflow-y: auto;
  color: var(--text);
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}
.modal-footer {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s;
}
.attach-btn:hover { border-color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s, transform .1s, background .15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn-primary     { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-secondary   { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(224,82,82,.25); }
.btn-danger-soft:hover { background: rgba(224,82,82,.22); }
.btn-ghost       { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-icon {
  background: transparent;
  color: var(--text-muted);
  padding: 7px;
  border-radius: 7px;
  border: 1px solid var(--border);
}
.btn-icon:hover { border-color: var(--accent); color: var(--text); }
.btn-sm  { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── Spinning refresh icon ───────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinning { animation: spin .6s linear infinite; }

/* ── Select ──────────────────────────────────────────────── */
.select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s;
}
.select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 22px;
  border-radius: 9px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  z-index: 500;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── SEO content section ─────────────────────────────────── */
.seo-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow);
  color: var(--text-muted);
  line-height: 1.75;
}
.seo-section h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.seo-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 8px;
}
.seo-section p { margin-bottom: 10px; font-size: 14px; }
.seo-section strong { color: var(--text); }
.seo-section ul,
.seo-section ol {
  padding-left: 20px;
  margin-bottom: 10px;
  font-size: 14px;
}
.seo-section li { margin-bottom: 5px; }

/* FAQ details/summary */
.seo-section details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: var(--bg3);
  font-size: 14px;
}
.seo-section details[open] { border-color: var(--accent); }
.seo-section summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.seo-section summary::after {
  content: '+';
  font-size: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.seo-section details[open] summary::after { content: '−'; }
.seo-section details p {
  margin-top: 10px;
  margin-bottom: 0;
  color: var(--text-muted);
}

/* ── Hero H1 / sub ───────────────────────────────────────── */
.hero-h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -.3px;
}
.hero-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* ── Footer ──────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 22px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 12px;
}
footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--text); }

/* ── Utilities ───────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 540px) {
  main { padding: 0 12px; margin: 16px auto; gap: 14px; }
  .card { padding: 16px; }
  .address-text { font-size: 15px; }
  .controls-row { gap: 6px; }
  .hero::before { display: none; }
  .countdown { display: none; }
  .address-row { padding: 10px 12px; }
}
