/* ============ Tokens ============ */
:root {
  --bg: #07080c;
  --surface: rgba(17, 19, 27, .72);
  --surface-solid: #10121a;
  --surface-2: #161924;
  --surface-3: #1c2030;
  --border: rgba(255, 255, 255, .075);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #eceef4;
  --muted: #8a90a2;
  --faint: #5b6172;
  --accent: #8b7bff;
  --accent-strong: #7461ff;
  --accent-2: #2dd4bf;
  --accent-ink: #fff;
  --accent-soft: rgba(139, 123, 255, .14);
  --danger: #f26b76;
  --danger-soft: rgba(242, 107, 118, .12);
  --success: #34d399;
  --warn: #fbbf24;
  --hover: rgba(255, 255, 255, .04);
  --grid: rgba(255, 255, 255, .035);
  --blob: .5;
  --shadow: 0 40px 100px -30px rgba(0, 0, 0, .7), 0 0 0 1px var(--border);
  --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, .6);
  --radius: 20px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f6fa;
  --surface: rgba(255, 255, 255, .78);
  --surface-solid: #ffffff;
  --surface-2: #f3f4f8;
  --surface-3: #e9ebf2;
  --border: rgba(15, 18, 32, .08);
  --border-strong: rgba(15, 18, 32, .15);
  --text: #0e1120;
  --muted: #5b6275;
  --faint: #99a0b1;
  --accent: #5b4bff;
  --accent-strong: #4b3aef;
  --accent-2: #0d9488;
  --accent-soft: rgba(91, 75, 255, .09);
  --danger: #dc3545;
  --danger-soft: rgba(220, 53, 69, .08);
  --success: #10b981;
  --hover: rgba(15, 18, 32, .035);
  --grid: rgba(15, 18, 32, .045);
  --blob: .28;
  --shadow: 0 40px 80px -40px rgba(40, 40, 90, .28), 0 0 0 1px var(--border);
  --shadow-sm: 0 8px 24px -14px rgba(40, 40, 90, .3);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6fa;
    --surface: rgba(255, 255, 255, .78);
    --surface-solid: #ffffff;
    --surface-2: #f3f4f8;
    --surface-3: #e9ebf2;
    --border: rgba(15, 18, 32, .08);
    --border-strong: rgba(15, 18, 32, .15);
    --text: #0e1120;
    --muted: #5b6275;
    --faint: #99a0b1;
    --accent: #5b4bff;
    --accent-strong: #4b3aef;
    --accent-2: #0d9488;
    --accent-soft: rgba(91, 75, 255, .09);
    --danger: #dc3545;
    --danger-soft: rgba(220, 53, 69, .08);
    --success: #10b981;
    --hover: rgba(15, 18, 32, .035);
    --grid: rgba(15, 18, 32, .045);
    --blob: .28;
    --shadow: 0 40px 80px -40px rgba(40, 40, 90, .28), 0 0 0 1px var(--border);
    --shadow-sm: 0 8px 24px -14px rgba(40, 40, 90, .3);
    color-scheme: light;
  }
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -.025em; line-height: 1.1; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: #fff; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ============ Background ============ */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-grid {
  position: absolute; inset: -1px;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: var(--blob); will-change: transform; }
.b1 { width: 560px; height: 560px; background: #6d5bff; top: -220px; left: 8%; animation: drift1 22s ease-in-out infinite alternate; }
.b2 { width: 480px; height: 480px; background: #14b8a6; top: -120px; right: 4%; animation: drift2 26s ease-in-out infinite alternate; opacity: calc(var(--blob) * .7); }
.b3 { width: 420px; height: 420px; background: #c026d3; top: 380px; left: 45%; animation: drift3 30s ease-in-out infinite alternate; opacity: calc(var(--blob) * .35); }
@keyframes drift1 { to { transform: translate(120px, 80px) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-140px, 120px) scale(.9); } }
@keyframes drift3 { to { transform: translate(-200px, -100px) scale(1.15); } }

/* ============ Nav ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  transition: background-color .3s var(--ease), border-color .3s var(--ease), backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom-color: var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -.02em; text-decoration: none; }
.logo { width: 28px; height: 28px; transition: transform .5s var(--spring); }
.brand:hover .logo { transform: rotate(-8deg) scale(1.06); }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500;
  padding: 7px 12px; border-radius: 999px; transition: color .2s, background-color .2s;
}
.nav-links a:hover { color: var(--text); background: var(--hover); }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); transition: color .2s, background-color .2s, border-color .2s, transform .2s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.danger:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-soft); }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
#themeToggle .i { transition: transform .5s var(--spring), opacity .3s; }
#themeToggle .moon { position: absolute; }
#themeToggle { position: relative; }
:root .sun { opacity: 0; transform: rotate(-90deg) scale(.5); }
:root .moon { opacity: 1; }
:root[data-theme="light"] #themeToggle .sun { opacity: 1; transform: none; }
:root[data-theme="light"] #themeToggle .moon { opacity: 0; transform: rotate(90deg) scale(.5); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) #themeToggle .sun { opacity: 1; transform: none; }
  :root:not([data-theme="dark"]) #themeToggle .moon { opacity: 0; transform: rotate(90deg) scale(.5); }
}

/* ============ Hero ============ */
.hero { text-align: center; padding-top: 72px; padding-bottom: 44px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 13px; color: var(--muted); font-weight: 500;
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); animation: ping 2s ease-out infinite; }
@keyframes ping { 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
.hero h1 { font-size: clamp(40px, 7vw, 76px); font-weight: 700; letter-spacing: -.045em; margin-top: 22px; }
.grad {
  background: linear-gradient(100deg, var(--accent) 0%, #b07bff 35%, var(--accent-2) 70%, var(--accent) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 8s linear infinite;
}
@keyframes sheen { to { background-position: -200% center; } }
.lead { max-width: 580px; margin: 20px auto 0; color: var(--muted); font-size: clamp(16px, 2vw, 18px); line-height: 1.65; }

/* ============ App ============ */
.app-wrap { margin-bottom: 40px; }
.app {
  position: relative;
  border-radius: 24px;
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--shadow);
  isolation: isolate;
}
.app::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; z-index: -1;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 55%, transparent), transparent 30%, transparent 70%, color-mix(in srgb, var(--accent-2) 45%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.app-glow {
  position: absolute; inset: 0; z-index: -2; border-radius: inherit; pointer-events: none;
  background: radial-gradient(600px circle at 50% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%);
}

.addr-panel { padding: 26px 28px 20px; border-bottom: 1px solid var(--border); }
.addr-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); position: relative; transition: background-color .3s; }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: pulse 2s ease-out infinite; }
.status[data-state="live"] .live-dot { background: var(--success); }
.status[data-state="error"] .live-dot { background: var(--danger); }
.status[data-state="error"] .live-dot::after { animation: none; }
@keyframes pulse { from { transform: scale(1); opacity: .7; } to { transform: scale(3); opacity: 0; } }

.addr-row { display: flex; gap: 12px; align-items: stretch; }
.addr {
  position: relative; overflow: hidden;
  flex: 1; min-width: 0; text-align: left;
  display: flex; align-items: center;
  padding: 0 20px; height: 56px;
  border-radius: 14px; border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  font-family: var(--mono); font-size: clamp(15px, 2.2vw, 20px); font-weight: 500; letter-spacing: -.01em;
  transition: border-color .25s, box-shadow .25s, transform .2s var(--ease);
}
.addr:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); box-shadow: 0 0 0 4px var(--accent-soft); }
.addr:active { transform: scale(.995); }
.addr-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addr.loading .addr-text { color: var(--faint); }
.addr-shine {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--accent) 22%, transparent) 50%, transparent 80%);
  transform: translateX(-100%);
}
.addr.loading .addr-shine { opacity: 1; animation: shine 1.3s ease-in-out infinite; }
.addr.flash .addr-shine { opacity: 1; animation: shine .8s var(--ease) 1; }
@keyframes shine { to { transform: translateX(100%); } }

.addr-actions { display: flex; gap: 8px; }
.addr-sub { margin-top: 10px; font-size: 13px; color: var(--faint); min-height: 20px; }

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 56px; padding: 0 18px; border-radius: 14px;
  border: 1px solid var(--border-strong); background: var(--surface-solid);
  font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background-color .2s, border-color .2s, color .2s, transform .2s var(--ease), box-shadow .2s, opacity .2s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary {
  border-color: transparent; color: var(--accent-ink);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 100%, #fff 12%), var(--accent-strong));
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 8px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  min-width: 112px;
}
.btn.primary:hover { box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 12px 32px -8px color-mix(in srgb, var(--accent) 85%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 100%, #fff 20%), var(--accent)); }
.btn.icon-only { width: 56px; padding: 0; }
.btn.danger:hover { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.danger-solid { background: var(--danger); border-color: transparent; color: #fff; }
.btn.danger-solid:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn .ic-check { display: none; }
.btn.copied .ic-copy { display: none; }
.btn.copied .ic-check { display: block; animation: pop .4s var(--spring); }
.btn.copied { background: linear-gradient(180deg, #3ee0a6, #10b981); box-shadow: 0 8px 24px -8px rgba(16, 185, 129, .7); }
@keyframes pop { from { transform: scale(.3); } to { transform: scale(1); } }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }
#newBtn.spin .i { animation: spin .7s var(--ease); }

/* ============ Mailbox ============ */
.mailbox { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: 600px; position: relative; overflow: hidden; border-radius: 0 0 24px 24px; }
.list-pane { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; position: relative; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border); }
.list-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.count {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--muted); transition: background-color .3s, color .3s;
}
.count.has { background: var(--accent); color: #fff; }
.count.bump { animation: bump .5s var(--spring); }
@keyframes bump { 40% { transform: scale(1.35); } }

.refresh { position: relative; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: var(--muted); transition: color .2s, background-color .2s; }
.refresh:hover { color: var(--text); background: var(--hover); }
.refresh .i { width: 15px; height: 15px; }
.refresh.spinning .i { animation: spin .8s linear infinite; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 2; }
.ring .track { stroke: var(--border); }
.ring .progress { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 100.53; stroke-dashoffset: 100.53; }
.ring .progress.run { animation: ring var(--poll, 8s) linear forwards; }
@keyframes ring { from { stroke-dashoffset: 100.53; } to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.msg-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.msg-list:empty { display: none; }
.msg {
  width: 100%; text-align: left; display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border-radius: 12px; border: 1px solid transparent; background: transparent;
  position: relative; transition: background-color .2s, border-color .2s, transform .25s var(--ease);
}
.msg:hover { background: var(--hover); }
.msg.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.msg.enter { animation: slideIn .6s var(--ease) both; animation-delay: var(--stagger, 0ms); }
.msg.fresh::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 2px var(--accent); animation: freshGlow 2.4s var(--ease) forwards;
}
@keyframes freshGlow { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
.msg.leaving { animation: slideOut .35s var(--ease) forwards; }
@keyframes slideOut { to { opacity: 0; transform: translateX(-24px); height: 0; padding-block: 0; margin: 0; } }

.avatar {
  --h: 250;
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-weight: 600; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 75% 62%), hsl(calc(var(--h) + 40) 70% 48%));
  box-shadow: 0 4px 12px -4px hsl(var(--h) 70% 40% / .6);
  text-transform: uppercase;
}
.avatar.lg { width: 44px; height: 44px; font-size: 17px; border-radius: 13px; }
.msg-body { min-width: 0; flex: 1; }
.msg-top { display: flex; align-items: baseline; gap: 8px; }
.msg-from { font-size: 14px; font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-top time { font-size: 12px; color: var(--faint); flex: none; font-variant-numeric: tabular-nums; }
.msg-subject { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.msg-intro { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; margin-top: 2px; }
.msg.unread .msg-from, .msg.unread .msg-subject { font-weight: 650; }
.msg.unread::before { content: ""; position: absolute; left: 3px; top: 50%; width: 4px; height: 4px; margin-top: -2px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.msg .clip { width: 14px; height: 14px; color: var(--faint); margin-top: 3px; }

/* Empty inbox */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; gap: 6px; }
.radar { position: relative; width: 96px; height: 96px; display: grid; place-items: center; margin-bottom: 16px; }
.radar span { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--accent); opacity: 0; animation: radar 3s var(--ease) infinite; }
.radar span:nth-child(2) { animation-delay: 1s; }
.radar span:nth-child(3) { animation-delay: 2s; }
@keyframes radar { 0% { transform: scale(.35); opacity: .8; } 100% { transform: scale(1.15); opacity: 0; } }
.radar .i { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); stroke-width: 1.8; position: relative; animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-4px); } }
.empty-title { font-weight: 600; }
.empty-sub { font-size: 13.5px; color: var(--muted); }

/* Skeleton */
.skel { display: flex; gap: 12px; padding: 12px; }
.skel .sa { width: 38px; height: 38px; border-radius: 12px; }
.skel .sl { flex: 1; display: grid; gap: 8px; padding-top: 4px; }
.skel .sb { height: 10px; border-radius: 6px; }
.sa, .sb { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; }
@keyframes skel { to { background-position: -200% 0; } }

/* Reader */
.reader-pane { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: color-mix(in srgb, var(--surface-solid) 40%, transparent); }
.reader-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: var(--muted); font-size: 14px; }
.env svg { width: 120px; height: 90px; }
.env-body { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1.5; }
.env-flap { fill: none; stroke: var(--border-strong); stroke-width: 1.5; stroke-linejoin: round; }
.env-letter { fill: var(--surface-solid); stroke: var(--border-strong); stroke-width: 1.5; animation: letter 3.2s var(--ease) infinite; }
.env-lines { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; opacity: .6; animation: letter 3.2s var(--ease) infinite; }
@keyframes letter { 0%, 100% { transform: translateY(18px); } 45%, 60% { transform: translateY(0); } }

.reader-view { display: flex; flex-direction: column; min-height: 0; flex: 1; animation: fadeUp .45s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reader-head { padding: 16px 24px 18px; border-bottom: 1px solid var(--border); }
.reader-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.reader-bar .back { visibility: hidden; }
.reader-tools { display: flex; gap: 8px; }
.r-subject { font-size: 21px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; word-break: break-word; }
.r-from { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.r-from-text { min-width: 0; flex: 1; }
.r-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-addr { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-date { font-size: 12.5px; color: var(--faint); flex: none; text-align: right; }

.img-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 14px 24px 0; padding: 10px 14px; border-radius: 12px;
  background: var(--accent-soft); color: var(--text); font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  animation: fadeUp .4s var(--ease);
}
.img-banner .i { width: 16px; height: 16px; color: var(--accent); }
.img-banner span { flex: 1; min-width: 160px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 24px; }
.attachments:not(:empty) { padding-top: 14px; }
.att {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 8px 12px 8px 10px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface-solid); font-size: 13px; transition: border-color .2s, transform .2s var(--ease), background-color .2s;
}
.att:hover { border-color: var(--accent); background: var(--accent-soft); }
.att:active { transform: scale(.97); }
.att-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; font-weight: 500; }
.att-size { color: var(--faint); font-size: 12px; }
.att .i { width: 16px; height: 16px; color: var(--accent); }

.frame-wrap { position: relative; flex: 1; min-height: 0; margin: 14px 24px 24px; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--border); }
.frame-wrap iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.frame-loading { position: absolute; inset: 0; display: grid; place-items: center; background: #fff; transition: opacity .3s; }
.frame-loading.done { opacity: 0; pointer-events: none; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid rgba(91, 75, 255, .2); border-top-color: #5b4bff; animation: spin .7s linear infinite; display: inline-block; }

/* ============ Sections ============ */
.section { padding: 100px 24px 20px; }
.section.narrow { max-width: 780px; }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 48px; }
.eyebrow { display: inline-block; font-size: 12.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.section-head h2 { font-size: clamp(30px, 4.5vw, 44px); font-weight: 700; letter-spacing: -.035em; }
.section-head p { margin-top: 14px; color: var(--muted); font-size: 17px; }

.grid.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  position: relative; padding: 26px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform .4s var(--ease), border-color .3s, box-shadow .4s var(--ease);
  overflow: hidden;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.spot::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 13%, transparent), transparent 60%);
}
.spot:hover::before { opacity: 1; }
.card-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-2) 12%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent);
  transition: transform .5s var(--spring);
}
.card:hover .card-icon { transform: scale(1.08) rotate(-4deg); }
.card h3 { font-size: 17px; font-weight: 600; margin-bottom: 8px; letter-spacing: -.015em; }
.card p { color: var(--muted); font-size: 14.5px; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: s; position: relative; }
.step { padding: 28px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); position: relative; }
.step-num { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--accent); display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); margin-bottom: 18px; }
.step h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 14.5px; }

.faq { display: grid; gap: 10px; }
.faq details { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); transition: border-color .3s, background-color .3s; overflow: hidden; }
.faq details[open] { border-color: var(--border-strong); }
.faq summary { list-style: none; cursor: pointer; padding: 18px 22px; font-weight: 500; font-size: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { background: var(--hover); }
.chev { color: var(--muted); transition: transform .4s var(--ease); }
.faq details[open] .chev { transform: rotate(180deg); }
.faq-a { padding: 0 22px 20px; color: var(--muted); }
.faq details[open] .faq-a { animation: fadeUp .4s var(--ease); }

.footer { margin-top: 110px; border-top: 1px solid var(--border); padding: 40px 0 48px; }
.footer-inner { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: space-between; }
.footer p { font-size: 14px; max-width: 520px; }
.footer a:not(.brand) { color: var(--text); text-underline-offset: 3px; }

/* ============ Toasts ============ */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 11px 16px 11px 12px; border-radius: 14px;
  background: var(--surface-solid); border: 1px solid var(--border-strong);
  box-shadow: 0 20px 50px -12px rgba(0,0,0,.5);
  font-size: 14px; font-weight: 500; max-width: 100%;
  animation: toastIn .5s var(--spring);
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .t-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.toast.success .t-ic { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.toast.error .t-ic { background: var(--danger-soft); color: var(--danger); }
.toast .t-ic .i { width: 15px; height: 15px; }
.toast .t-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.96); } }

/* ============ Modals ============ */
.modal {
  border: 0; padding: 0; border-radius: 22px; width: min(460px, calc(100vw - 32px));
  background: var(--surface-solid); color: var(--text);
  box-shadow: 0 50px 120px -20px rgba(0,0,0,.6), 0 0 0 1px var(--border-strong);
}
.modal[open] { animation: modalIn .45s var(--spring); }
.modal.closing { animation: modalOut .2s var(--ease) forwards; }
.modal::backdrop { background: rgba(5, 6, 12, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .3s var(--ease); }
.modal.closing::backdrop { animation: fade .2s var(--ease) reverse forwards; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes modalOut { to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-body { padding: 28px; display: grid; gap: 6px; }
.modal h3 { font-size: 20px; font-weight: 600; }
.modal .muted { font-size: 14.5px; margin-bottom: 14px; }
.field { display: grid; gap: 8px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.combo {
  display: flex; align-items: center; height: 50px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface-2); overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.combo:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.combo input, .combo select { height: 100%; border: 0; background: transparent; color: var(--text); font-family: var(--mono); font-size: 15px; outline: none; }
.combo input { flex: 1; min-width: 0; padding: 0 4px 0 14px; }
.combo-domain { padding: 0 14px 0 2px; color: var(--muted); font-family: var(--mono); font-size: 15px; white-space: nowrap; flex: none; }
@media (max-width: 420px) { .combo-domain { font-size: 13px; } }
.combo.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.field-error { min-height: 20px; font-size: 13px; color: var(--danger); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-actions .btn { height: 44px; border-radius: 12px; }

/* ============ Reveal ============ */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }

/* ============ Responsive ============ */
@media (max-width: 960px) {
  .grid.features { grid-template-columns: repeat(2, 1fr); }
  .mailbox { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .container { padding: 0 16px; }
  .section { padding: 80px 16px 10px; }
  .nav-links { display: none; }
  .nav-inner { justify-content: space-between; }
  .hero { padding-top: 44px; padding-bottom: 32px; }
  .addr-panel { padding: 20px 16px 16px; }
  .addr-row { flex-direction: column; }
  .addr { flex: none; height: 52px; padding: 0 16px; }
  .label, .status { white-space: nowrap; }
  .addr-actions { display: grid; grid-template-columns: 1fr 1fr 1fr 48px; }
  .btn { height: 46px; padding: 0 12px; }
  .btn.icon-only { width: 48px; }
  .btn.primary { min-width: 0; }
  .mailbox { grid-template-columns: minmax(0, 1fr); height: 560px; }
  .list-pane { border-right: 0; }
  .reader-pane {
    position: absolute; inset: 0; z-index: 2;
    background: var(--surface-solid);
    transform: translateX(100%); transition: transform .45s var(--ease), visibility 0s .45s; visibility: hidden;
  }
  .mailbox.reading .reader-pane { transform: none; visibility: visible; transition: transform .45s var(--ease); }
  .reader-bar .back { visibility: visible; }
  .reader-head { padding: 14px 16px 16px; }
  .r-subject { font-size: 18px; }
  .img-banner { margin: 12px 16px 0; }
  .attachments { padding: 0 16px; }
  .frame-wrap { margin: 12px 16px 16px; }
  .grid.features, .steps { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .ring .progress.run { animation: none; stroke-dashoffset: 0; }
  .reveal { opacity: 1; transform: none; }
}
