/* VanishBox — styles. No framework, no build step. */
:root {
  --radius: 18px; --radius-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --accent: #8b5cf6; --accent-2: #22d3ee; --danger: #f43f5e; --ok: #10b981; --warn: #f59e0b;
  --grad: linear-gradient(120deg, var(--accent), var(--accent-2));
}
[data-theme="dark"] {
  --bg: #070b18; --bg-2: #0b1020; --card: rgba(17, 24, 45, .72); --card-solid: #11182d; --line: rgba(148, 163, 184, .14);
  --text: #e6e9f5; --muted: #8e98b5; --hover: rgba(139, 92, 246, .10); --sel: rgba(139, 92, 246, .18); --input: rgba(8, 12, 26, .7);
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .6); color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f4f6fc; --bg-2: #eef1fa; --card: rgba(255, 255, 255, .82); --card-solid: #fff; --line: rgba(15, 23, 42, .09);
  --text: #0f172a; --muted: #5b6785; --hover: rgba(139, 92, 246, .07); --sel: rgba(139, 92, 246, .13); --input: #fff;
  --shadow: 0 20px 50px -24px rgba(30, 41, 99, .25); color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--text); background: var(--bg); min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); }
[data-theme="light"] a { color: #7c3aed; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card-solid); padding: 8px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
kbd { font: 12px var(--mono); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--input); }

/* animated background */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-orbs span { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(90px); opacity: .28; animation: drift 26s ease-in-out infinite alternate; }
.bg-orbs span:nth-child(1) { background: #7c3aed; top: -18vmax; left: -12vmax; }
.bg-orbs span:nth-child(2) { background: #0891b2; bottom: -22vmax; right: -14vmax; animation-delay: -8s; }
.bg-orbs span:nth-child(3) { background: #db2777; top: 30%; left: 45%; width: 26vmax; height: 26vmax; opacity: .12; animation-delay: -14s; }
[data-theme="light"] .bg-orbs span { opacity: .16; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.1); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 14px clamp(16px, 4vw, 48px); backdrop-filter: blur(14px); background: color-mix(in srgb, var(--bg) 70%, transparent); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 20px; letter-spacing: -.02em; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topnav { display: flex; gap: 18px; margin-left: 12px; }
.topnav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.topnav a:hover { color: var(--text); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill { font-size: 12px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.pill.server::before { background: var(--ok); }
.pill.public::before { background: var(--accent-2); }
.pill.down::before { background: var(--danger); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--card); padding: 9px 14px; border-radius: 12px; cursor: pointer; font-weight: 550; font-size: 14px; transition: transform .12s, background .2s, border-color .2s; white-space: nowrap; }
.btn:hover { background: var(--hover); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 8px 24px -10px var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.btn.danger-solid { background: var(--danger); color: #fff; border: 0; }
.btn.full { width: 100%; }
.btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.small { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn.small svg { width: 15px; height: 15px; }
.link-btn { border: 0; background: none; color: var(--accent-2); cursor: pointer; display: inline-flex; gap: 5px; align-items: center; font-size: 13px; padding: 2px 4px; border-radius: 6px; }
[data-theme="light"] .link-btn { color: #7c3aed; }
.link-btn svg { width: 14px; height: 14px; }
.link-btn:hover { text-decoration: underline; }

/* layout */
main { width: min(1240px, 100%); margin: 0 auto; padding: 0 clamp(14px, 3vw, 32px); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.hero { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(20px, 4vw, 56px); align-items: center; padding: clamp(28px, 6vw, 72px) 0 32px; }
.hero h1 { font-size: clamp(32px, 4.6vw, 56px); line-height: 1.04; letter-spacing: -.035em; margin: 0 0 16px; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 17px; max-width: 34em; margin: 0 0 18px; }
.hero-badges { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-badges li { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.hero-badges svg { width: 15px; height: 15px; color: var(--accent-2); }

/* address card */
.address-card { padding: 22px; position: relative; overflow: hidden; }
.address-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--grad); }
.address-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 650; }
.mini-select { max-width: 55%; font-size: 12px; padding: 5px 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--input); }
.address-row { display: flex; gap: 10px; }
.address { flex: 1; min-width: 0; text-align: left; font: 600 clamp(16px, 2.1vw, 22px)/1.2 var(--mono); padding: 15px 16px; border-radius: 14px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--line)); background: var(--input); cursor: copy; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: border-color .2s, background .2s; }
.address:hover { background: var(--hover); }
.address.copied { border-style: solid; border-color: var(--ok); }
.address.expired { text-decoration: line-through; opacity: .55; }
.address .at { color: var(--muted); }
.skeleton { color: var(--muted); font-weight: 400; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.address-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.address-actions .btn { padding: 7px 11px; font-size: 13px; }
.address-actions .btn svg { width: 16px; height: 16px; }
.expiry { margin-top: 16px; }
.expiry-bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.expiry-bar span { display: block; height: 100%; width: 100%; background: var(--grad); border-radius: inherit; transition: width 1s linear; }
.expiry.low .expiry-bar span { background: linear-gradient(90deg, var(--warn), var(--danger)); }
.expiry.none .expiry-bar span { background: var(--line); }
.expiry-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 13px; color: var(--muted); }
.status-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.spacer { flex: 1; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); flex: none; }
.live-dot.ok { background: var(--ok); box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); animation: ping 2s infinite; }
.live-dot.err { background: var(--danger); }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

/* mail app */
.mail { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; height: min(78vh, 760px); min-height: 520px; overflow: hidden; margin-bottom: 40px; }
.list-pane { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.tabs { display: flex; gap: 4px; background: var(--input); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tab { flex: 1; border: 0; background: none; padding: 7px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.tab.active { background: var(--card-solid); color: var(--text); box-shadow: 0 2px 8px -4px rgba(0, 0, 0, .4); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; line-height: 18px; background: var(--grad); color: #fff; }
.count:empty { display: none; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--input); }
.search svg { width: 16px; height: 16px; color: var(--muted); }
.search input { flex: 1; border: 0; background: none; padding: 9px 0; outline: none; min-width: 0; }
.message-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.msg-item { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 12px; border-radius: 12px; cursor: pointer; position: relative; border: 1px solid transparent; animation: slidein .35s ease; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } }
.msg-item:hover { background: var(--hover); }
.msg-item.selected { background: var(--sel); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.msg-item.unread::after { content: ""; position: absolute; left: 4px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent-2); }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px; text-transform: uppercase; }
.msg-main { min-width: 0; }
.msg-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.msg-from { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-item.unread .msg-from, .msg-item.unread .msg-subject { font-weight: 750; }
.msg-time { font-size: 12px; color: var(--muted); flex: none; }
.msg-subject { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-preview { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-tags { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--input); color: var(--muted); cursor: default; }
.chip svg { width: 13px; height: 13px; }
.chip.code { font-family: var(--mono); font-weight: 700; color: var(--text); cursor: copy; border-color: color-mix(in srgb, var(--accent-2) 50%, transparent); }
.chip.code:hover { background: var(--hover); }
.empty { padding: 34px 22px; text-align: center; color: var(--muted); margin: auto 0; }
.empty .art { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 26px; display: grid; place-items: center; background: var(--hover); color: var(--accent-2); position: relative; }
.empty .art svg { width: 38px; height: 38px; }
.empty .art.wait::after { content: ""; position: absolute; inset: -6px; border-radius: 30px; border: 2px solid var(--accent); opacity: 0; animation: ripple 2.2s ease-out infinite; }
@keyframes ripple { 0% { transform: scale(.85); opacity: .7; } 100% { transform: scale(1.25); opacity: 0; } }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 16px; }
.empty p { margin: 0; font-size: 14px; }

/* reader */
.reader-pane { min-width: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; outline: none; }
.reader-empty { margin: auto; text-align: center; color: var(--muted); padding: 30px; }
.reader-empty-art svg { width: 56px; height: 56px; opacity: .35; }
.reader-empty small { display: block; margin-top: 8px; }
.reader-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card-solid); z-index: 2; }
.reader-toolbar { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.reader-toolbar .btn { padding: 6px 10px; font-size: 13px; }
.reader-toolbar .btn svg { width: 15px; height: 15px; }
.back-btn { display: none !important; }
.reader-subject { font-size: 21px; line-height: 1.25; margin: 0 0 12px; letter-spacing: -.01em; word-break: break-word; }
.reader-meta { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; }
.reader-meta .who { min-width: 0; }
.reader-meta .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-meta .who span { font-size: 13px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-meta time { font-size: 12px; color: var(--muted); text-align: right; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-left: auto; }
.seg button { border: 0; background: none; padding: 5px 10px; font-size: 12px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--sel); color: var(--text); }
.banner { margin: 14px 22px 0; padding: 10px 14px; border-radius: 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border: 1px solid var(--line); background: var(--input); }
.banner svg { color: var(--accent-2); }
.banner.code-banner { border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); background: color-mix(in srgb, var(--accent-2) 8%, var(--input)); }
.banner .code-value { font: 700 20px var(--mono); letter-spacing: .12em; }
.attachments { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 22px 0; }
.att { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--input); cursor: pointer; font-size: 13px; max-width: 280px; }
.att:hover { border-color: var(--accent); }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att small { color: var(--muted); flex: none; }
.reader-body { padding: 16px 22px 26px; flex: 1; }
.mail-frame { width: 100%; border: 0; border-radius: 12px; background: #fff; min-height: 200px; display: block; }
.text-body { white-space: pre-wrap; word-break: break-word; font: 14px/1.6 var(--font); margin: 0; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* sections */
.section { padding: 46px 0 10px; }
.section h2 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -.02em; margin: 0 0 22px; text-align: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.feature { padding: 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.feature > svg { width: 34px; height: 34px; padding: 7px; border-radius: 11px; background: var(--hover); color: var(--accent-2); }
.feature h3 { margin: 12px 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; counter-reset: s; }
.steps li { padding: 22px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.steps b { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--grad); color: #fff; }
.steps h3 { margin: 12px 0 4px; }
.steps p { margin: 0; color: var(--muted); }
.faq { max-width: 820px; margin: 0 auto; }
.faq details { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 650; }
.faq p { color: var(--muted); margin: 10px 0 0; }
.footer { text-align: center; padding: 40px 16px 50px; color: var(--muted); font-size: 13px; }
.footer p { margin: 4px 0; }
.muted { color: var(--muted); }

/* dialogs */
.dialog { border: 1px solid var(--line); border-radius: 20px; padding: 0; background: var(--card-solid); color: var(--text); width: min(460px, calc(100vw - 24px)); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); }
.dialog.wide { width: min(620px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(3, 6, 18, .6); backdrop-filter: blur(4px); }
.dialog[open] { animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.dialog form { padding: 22px; display: grid; gap: 12px; }
.dialog h2 { margin: 0; font-size: 20px; }
.dialog h3 { margin: 0; font-size: 15px; }
.dialog label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.dialog input, .dialog select, .dialog textarea { width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--input); color: var(--text); font-weight: 400; }
.dialog textarea { resize: vertical; min-height: 140px; }
.dialog input:focus, .dialog textarea:focus, .dialog select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 0; }
.combo { display: flex; align-items: center; gap: 6px; }
.combo input { flex: 1.2; font-family: var(--mono); }
.combo select { flex: 1; }
.combo span { color: var(--muted); font-weight: 700; }
.hint { color: var(--muted); font-size: 12px; }
.hint.err { color: var(--danger); }
.from-line { margin: 0; font-size: 13px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: var(--mono); font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.kbd-table td { padding: 5px 10px 5px 0; }

/* toasts */
.toasts { position: fixed; z-index: 100; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 24px)); }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--card-solid); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14px; animation: toastin .25s ease; }
.toast svg { flex: none; }
.toast.ok svg { color: var(--ok); } .toast.error svg { color: var(--danger); } .toast.info svg { color: var(--accent-2); }
.toast.out { opacity: 0; transform: translateY(8px); transition: .25s; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }

/* responsive */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding-top: 26px; }
  .topnav { display: none; }
}
@media (max-width: 760px) {
  .mail { grid-template-columns: 1fr; height: auto; min-height: 60vh; }
  .list-pane { border-right: 0; }
  .message-list { max-height: none; overflow: visible; }
  .reader-pane { display: none; }
  .mail.reading .list-pane { display: none; }
  .mail.reading .reader-pane { display: flex; min-height: 70vh; }
  .back-btn { display: inline-flex !important; }
  .reader-head { position: static; padding: 14px 16px; }
  .reader-body, .attachments { padding-left: 14px; padding-right: 14px; }
  .banner { margin: 12px 14px 0; }
  .address-actions .btn span { display: none; }
  .address-actions .btn { padding: 9px; flex: 1; }
  .address { font-size: 15px; padding: 13px; }
  .address-row .btn.primary span { display: none; }
  .pill { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .brand span { display: none; }
  .hero p { font-size: 15px; }
}
