/* MailCancer — dark 3D clay + glass. Design: Figma "v3 — 3D Dev". */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0c14;
  --glass: rgba(21, 20, 29, 0.55);
  --glass-strong: rgba(21, 20, 29, 0.72);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-2: rgba(255, 255, 255, 0.2);
  --hover: rgba(255, 255, 255, 0.06);
  --text: #f1eee7;
  --text-2: #c4bfb4;
  --muted: #8f8a80;
  --dim: #6a6670;
  --sage: #a9cf9f;
  --sage-ink: #1b2219;
  --lav: #b8a9f2;
  --lav-soft: #ddd4ff;
  --peach: #f2b78c;
  --butter: #e9d58a;
  --sky: #8cc4e8;
  --red: #f08a7e;
  --radius: 8px;
  --sans: 'Host Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

html { background: var(--bg); }
body {
  font-family: var(--sans);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); }
.dim { color: var(--dim); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; border-radius: 4px; }

kbd {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-2);
}

/* ---------- Scene (3D illustration) ---------- */
.scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #0d0c14; }
/* The art box keeps the illustration's 3:2 ratio and covers the viewport,
   so effects positioned in % stay glued to the monitors, lamp, rack, window. */
.scene-art {
  position: absolute; left: 50%; top: 50%;
  width: max(100vw, 150vh); aspect-ratio: 3 / 2;
  translate: calc(-50% + var(--px, 0px)) calc(-50% + var(--py, 0px));
  scale: 1.03;
  container-type: inline-size;
  background:
    var(--bg-img, url('/assets/mailcancer-bg.webp')) center / 100% 100% no-repeat,
    radial-gradient(60% 50% at 45% 30%, rgba(124, 92, 190, 0.35), transparent 70%),
    linear-gradient(180deg, #17142a 0%, #0d0c14 70%);
  transition: translate 0.9s var(--ease);
  animation: drift 28s ease-in-out infinite alternate;
}
@keyframes drift { from { scale: 1.03; } to { scale: 1.075; } }
.fx { position: absolute; pointer-events: none; }
.fx-screen { border-radius: 14%; mix-blend-mode: screen; overflow: hidden; }
.fx-screen::before {
  content: ''; position: absolute; inset: -20%;
  background: radial-gradient(closest-side, rgba(150, 255, 200, 0.35), rgba(140, 170, 255, 0.12) 60%, transparent);
  animation: screen-flicker 5s infinite steps(1, end);
}
.fx-screen i {
  position: absolute; left: 0; right: 0; height: 22%;
  background: linear-gradient(180deg, transparent, rgba(220, 255, 235, 0.22), transparent);
  animation: scan 3.6s linear infinite;
}
.fx-s1 { left: 42%; top: 24.5%; width: 10.5%; height: 13%; }
.fx-s2 { left: 56%; top: 28.5%; width: 8.5%; height: 9.5%; }
.fx-s2::before { animation-delay: -2.2s; }
.fx-s2 i { animation-duration: 4.4s; animation-delay: -1.3s; }
@keyframes scan { from { top: -25%; } to { top: 110%; } }
@keyframes screen-flicker { 0%, 100% { opacity: 0.9; } 31% { opacity: 0.6; } 32% { opacity: 1; } 67% { opacity: 0.75; } 68% { opacity: 0.95; } }
.fx-rack {
  left: 26.5%; top: 29%; width: 8%; height: 15%; border-radius: 30%; mix-blend-mode: screen;
  background: radial-gradient(closest-side, rgba(169, 207, 159, 0.4), rgba(184, 169, 242, 0.2) 55%, transparent);
  animation: leds 1.8s infinite steps(2, jump-none) alternate;
}
@keyframes leds { from { opacity: 0.35; } to { opacity: 1; } }
.fx-lamp {
  left: 66%; top: 25%; width: 14%; height: 18%; mix-blend-mode: screen;
  background: radial-gradient(closest-side, rgba(255, 196, 120, 0.45), rgba(255, 170, 90, 0.12) 55%, transparent);
  animation: lamp 6s ease-in-out infinite;
}
@keyframes lamp { 0%, 100% { opacity: 0.85; scale: 1; } 50% { opacity: 1; scale: 1.06; } }
.fx-stars { left: 88%; top: 0; width: 12%; height: 35%; }
.star { position: absolute; width: 0.18cqw; height: 0.18cqw; border-radius: 50%; background: #fff; box-shadow: 0 0 0.5cqw rgba(255, 255, 255, 0.8); animation: twinkle var(--t, 3s) ease-in-out infinite var(--dl, 0s); }
@keyframes twinkle { 0%, 100% { opacity: 0.15; scale: 0.6; } 50% { opacity: 1; scale: 1; } }
.fx-mail { left: 36%; top: -6%; width: 30%; height: 32%; }
.env {
  position: absolute; bottom: 0; width: 2.4cqw; aspect-ratio: 1.42; border-radius: 0.28cqw;
  background: linear-gradient(165deg, var(--c1, #efe6ff), var(--c2, #b8a9f2));
  box-shadow: inset 0 -0.25cqw 0.35cqw rgba(0, 0, 0, 0.18), 0 0.5cqw 0.9cqw rgba(0, 0, 0, 0.35);
  opacity: 0; will-change: transform, opacity;
}
.env::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.1)); clip-path: polygon(0 0, 100% 0, 50% 60%); }
.env::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: rgba(0, 0, 0, 0.08); clip-path: polygon(0 100%, 50% 45%, 100% 100%); }
.scene-wash {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(11, 10, 18, 0.75) 0%, rgba(11, 10, 18, 0.2) 50%, rgba(11, 10, 18, 0.35) 100%),
              linear-gradient(0deg, rgba(11, 10, 18, 0.55) 0%, transparent 45%);
}

/* ---------- Glass + viewfinder corners ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
  backdrop-filter: blur(28px) saturate(1.2);
  border-radius: var(--radius);
}
.vf { position: relative; padding: 14px; }
.vf .c { position: absolute; width: 26px; height: 26px; border: 2.5px solid rgba(255, 255, 255, 0.55); pointer-events: none; }
.vf .tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.vf .tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.vf .bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.vf .br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }
.vf-sm { padding: 9px; }
.vf-sm .c { width: 14px; height: 14px; border-width: 2px; }

/* ---------- Nav ---------- */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px clamp(16px, 4vw, 62px) 0;
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-word { font-size: 17px; letter-spacing: 0.3em; }
.logo-mark {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1.2px solid var(--text); font-family: var(--mono); font-size: 14px;
}
.crumb { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-actions { display: flex; gap: 6px; padding: 6px; align-items: center; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 6px;
  background: rgba(255, 255, 255, 0.07); color: var(--text-2); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.13); color: var(--text); }
.icon-btn.on { color: var(--sage); }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-danger { color: var(--red); }
.btn-sage {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 14px;
  border-radius: 6px; background: var(--sage); color: var(--sage-ink); font-size: 15px; font-weight: 500;
  transition: filter 0.15s, transform 0.1s;
}
.btn-sage:hover { filter: brightness(1.06); }
.btn-sage:active, .chip:active, .cta:active { transform: scale(0.98); }
.btn-sage kbd { background: rgba(0, 0, 0, 0.12); border-color: rgba(0, 0, 0, 0.12); color: var(--sage-ink); }

/* ---------- Layout ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 600px) minmax(0, 640px);
  justify-content: space-between;
  align-items: end;
  gap: 32px;
  padding: 24px clamp(16px, 4vw, 58px) 16px;
}
.addr-col { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.addr-col .vf { width: 100%; }

/* ---------- Address card ---------- */
.card { overflow: hidden; }
.card-body { padding: 30px 32px 24px; display: flex; flex-direction: column; gap: 14px; }
.comment { font-size: 13px; }
.address {
  font-size: clamp(30px, 3.4vw, 46px); line-height: 1.12; font-weight: 400; letter-spacing: -0.03em;
  cursor: pointer; overflow-wrap: anywhere;
}
.address .at { color: var(--dim); }
.address .at::before { content: ''; display: block; }
.address .domain { color: var(--sage); }
.listening { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 0 rgba(169, 207, 159, 0.6); animation: pulse 2s infinite; }
.pulse.off { background: var(--red); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(169, 207, 159, 0); } 100% { box-shadow: 0 0 0 0 rgba(169, 207, 159, 0); } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px 0 14px;
  border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--stroke); font-size: 14px; color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.chip:hover { background: rgba(40, 38, 52, 0.85); border-color: var(--stroke-2); }
.chip svg { width: 15px; height: 15px; color: var(--text-2); }
.chip-danger, .chip-danger svg { color: var(--red); }
.chip-count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.chip-count:empty { display: none; }

.api-toggle summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; padding: 4px 2px; border-radius: 6px; user-select: none;
}
.api-toggle summary::-webkit-details-marker { display: none; }
.api-tag { color: var(--lav); background: rgba(184, 169, 242, 0.12); border: 1px solid rgba(184, 169, 242, 0.25); padding: 3px 8px; border-radius: 5px; }
.api-toggle summary:hover .api-tag { background: rgba(184, 169, 242, 0.2); }
.api-chev { width: 14px; height: 14px; color: var(--dim); transition: rotate 0.2s var(--ease); }
.api-toggle[open] .api-chev { rotate: 180deg; }
.api-toggle[open] .snippet { margin-top: 8px; animation: rise 0.3s var(--ease) both; }
.snippet { position: relative; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 6px; }
.snippet pre { font-size: 12px; line-height: 1.6; padding: 10px 44px 10px 12px; color: var(--text-2); white-space: pre-wrap; word-break: break-all; }
.snippet .icon-btn { position: absolute; top: 6px; right: 6px; background: transparent; }
.tok-cmd { color: var(--sage); }
.tok-str { color: var(--butter); }
.tok-flag { color: var(--lav); }
.tok-var { color: var(--peach); }

.privacy { font-size: 12px; line-height: 1.5; color: var(--dim); }

.cta {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 22px 0 24px; background: var(--sage); color: var(--sage-ink); font-size: 18px;
  transition: filter 0.15s;
}
.cta:hover { filter: brightness(1.06); }
.cta-end { display: flex; align-items: center; gap: 12px; }
.cta svg { width: 22px; height: 22px; }
.cta kbd { background: rgba(0, 0, 0, 0.12); border-color: rgba(0, 0, 0, 0.14); color: var(--sage-ink); }
.cta.done { filter: none; background: #c3e2ba; }

.switcher { display: flex; gap: 6px; padding: 10px 12px; border-radius: 6px; }
.switcher button { width: 22px; height: 18px; display: grid; place-items: center; }
.switcher button::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--text); opacity: 0.25; transition: opacity 0.15s, transform 0.15s; }
.switcher button[aria-selected='true']::before { opacity: 0.9; transform: scale(1.2); }
.switcher:has(button:only-child) { display: none; }

/* ---------- Inbox panel ---------- */
.vf-panel { width: 100%; }
.panel { display: flex; flex-direction: column; max-height: calc(100dvh - 220px); min-height: 420px; overflow: hidden; }
.view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 26px 34px 14px; }
.panel-head h2 { font-size: 36px; font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; }
.count { font-size: 12px; color: var(--text-2); background: rgba(255, 255, 255, 0.07); padding: 6px 12px; border-radius: 999px; }

.otp {
  margin: 0 14px 10px; padding: 18px 20px; border-radius: var(--radius);
  background: rgba(184, 169, 242, 0.1); border: 1px solid rgba(184, 169, 242, 0.35);
  display: flex; flex-direction: column; gap: 10px;
}
.otp-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.otp-head .re { color: var(--peach); }
.otp-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.otp-code { white-space: nowrap; font-family: var(--mono); font-size: clamp(34px, 4vw, 56px); letter-spacing: 0.08em; color: var(--lav-soft); line-height: 1; font-weight: 400; }
.btn-light {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 6px;
  background: var(--text); color: #24231f; font-size: 15px; white-space: nowrap;
}
.btn-light:hover { background: #fff; }

.message-list { overflow-y: auto; padding: 0 14px 14px; flex: 1; min-height: 0; }
.message-row {
  width: 100%; display: flex; gap: 16px; align-items: center; text-align: left;
  padding: 16px 20px; border-radius: var(--radius); transition: background 0.12s;
}
.message-row:hover, .message-row.focus { background: var(--hover); }
.message-row.unread { background: rgba(255, 255, 255, 0.08); }
.message-row.unread .from::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--sage); margin-left: 8px; vertical-align: middle; }
.avatar { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: var(--radius); font-weight: 500; font-size: 18px; color: #24231f; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.from { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-family: var(--mono); font-size: 12px; color: var(--muted); flex: none; }
.subject { font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-row.unread .subject { color: var(--text-2); }
.row-tags { display: flex; gap: 6px; }
.tag { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); color: var(--muted); }
.tag-otp { background: rgba(184, 169, 242, 0.14); color: var(--lav); }
.tag-att { background: rgba(242, 183, 140, 0.14); color: var(--peach); }

.empty { padding: 48px 24px 56px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.empty .cursor { width: 9px; height: 18px; background: var(--sage); animation: blink 1s steps(1) infinite; }
.empty-title { font-family: var(--mono); color: var(--text-2); font-size: 14px; }
.empty-sub { font-size: 13px; max-width: 340px; line-height: 1.6; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Reader ---------- */
.reader-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 6px; }
.back { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); padding: 6px 8px; border-radius: 6px; }
.back:hover { background: var(--hover); color: var(--text); }
.reader-scroll { overflow-y: auto; padding: 8px 28px 26px; display: flex; flex-direction: column; gap: 16px; flex: 1; min-height: 0; }
.reader-scroll > * { flex-shrink: 0; }
.reader-subject { font-size: 26px; font-weight: 400; line-height: 1.2; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.meta { font-family: var(--mono); font-size: 12px; display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; color: var(--text-2); }
.meta dt { color: var(--dim); }
.meta dd { overflow-wrap: anywhere; }
.action-link {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 6px;
  background: var(--sage); color: var(--sage-ink); text-decoration: none; font-size: 15px;
}
.action-link:hover { filter: brightness(1.06); }
.reader-scroll .otp { margin: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--stroke); }
.tabs button { padding: 10px 12px; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected='true'] { color: var(--text); border-bottom-color: var(--sage); }
.tab-panel { min-height: 120px; }
.mail-frame { display: block; width: 100%; height: 360px; border: 0; border-radius: 6px; background: #fff; }
.mail-text { font-size: 14px; line-height: 1.65; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.mail-text a, .links a { color: var(--sage); }
.code-block { font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--text-2); background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 6px; padding: 12px; white-space: pre-wrap; word-break: break-all; max-height: 520px; overflow: auto; }
.headers-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
.headers-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: top; color: var(--text-2); word-break: break-all; }
.headers-table td:first-child { color: var(--lav); white-space: nowrap; width: 1%; }
.attachments { display: flex; flex-direction: column; gap: 6px; }
.attachment { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--stroke); text-decoration: none; }
a.attachment:hover { background: rgba(255, 255, 255, 0.09); }
.attachment .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.attachment .size { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.section-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase; }
.links summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.links ul { margin: 8px 0 0 18px; display: grid; gap: 6px; font-size: 13px; word-break: break-all; }

/* ---------- Status bar ---------- */
.statusbar {
  align-self: flex-start; max-width: calc(100% - 2 * clamp(16px, 4vw, 72px));
  margin: 0 clamp(16px, 4vw, 72px) 22px; padding: 9px 16px; display: flex; justify-content: space-between; gap: 16px;
  font-size: 12px; color: var(--muted); border-radius: 6px; flex-wrap: wrap;
}
.status-left, .status-keys { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.status-keys span { display: inline-flex; gap: 6px; align-items: center; }
.ok { color: var(--sage); }
.bad { color: var(--red); }

/* ---------- Menu, dialog, toast ---------- */
.menu { margin: auto; padding: 12px; min-width: 300px; max-width: min(420px, 92vw); color: var(--text); background: var(--glass-strong); }
.menu::backdrop, .dialog::backdrop { background: rgba(5, 4, 10, 0.55); backdrop-filter: blur(2px); }
.menu-title { font-size: 12px; padding: 4px 8px 8px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px; font-family: var(--mono); font-size: 13px; text-align: left; }
.menu-item:hover, .menu-item.active { background: var(--hover); }
.menu-item .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.menu-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dialog { margin: auto; width: min(520px, 92vw); padding: 28px; color: var(--text); background: var(--glass-strong); }
.dialog h2 { font-size: 28px; font-weight: 400; margin: 6px 0 18px; }
.field { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 14px; height: 48px; border-radius: 6px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--stroke); }
.field:focus-within { border-color: var(--sage); }
.field input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 15px; }
.field .at { color: var(--dim); }
.field select { background: rgba(255, 255, 255, 0.06); border: 0; border-radius: 4px; padding: 6px 8px; color: var(--sage); outline: none; }
.field select option { background: #15141d; color: var(--text); }
.hint { font-size: 12px; color: var(--dim); margin-top: 8px; }
.form-error { font-size: 13px; color: var(--red); margin-top: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.dialog-actions .btn-sage { padding: 0 16px; }

.toasts { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 999px; background: rgba(21, 20, 29, 0.92); border: 1px solid var(--stroke-2); font-size: 13px; color: var(--text); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); animation: toastIn 0.25s var(--ease); white-space: nowrap; }
.toast.out { animation: toastOut 0.2s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); justify-content: stretch; align-items: start; gap: 8px; padding-top: max(26vh, 150px); }
  .addr-col, .inbox-col { width: 100%; max-width: 680px; margin: 0 auto; }
  .panel { max-height: none; min-height: 0; }
  .message-list, .reader-scroll { overflow: visible; }
  .scene { position: fixed; }
  .scene-art { width: max(93vh, 100vw); left: calc((100vw - max(93vh, 100vw)) * 0.58); top: 0; translate: 0 0; transform-origin: 55% 30%; }
  .scene-wash { background: linear-gradient(180deg, rgba(11, 10, 18, 0) 0%, rgba(11, 10, 18, 0.2) 30%, rgba(11, 10, 18, 0.92) 58%, #0d0c14 75%); }
}
@media (max-width: 640px) {
  .nav { padding-top: 16px; }
  .crumb, .btn-sage span, .btn-sage kbd, .hide-sm, .cta kbd, .back kbd { display: none; }
  .btn-sage { padding: 0 11px; }
  .logo { gap: 10px; }
  .logo-word { font-size: 14px; letter-spacing: 0.24em; }
  .logo-mark { width: 24px; height: 24px; font-size: 12px; }
  .otp-code { font-size: 34px; letter-spacing: 0.05em; }
  .btn-light { height: 38px; padding: 0 12px; font-size: 14px; }
  .vf { padding: 10px; }
  .vf .c { width: 22px; height: 22px; }
  .card-body { padding: 22px 20px 18px; gap: 12px; }
  .chip { height: 34px; padding: 0 12px 0 11px; font-size: 13px; }
  .cta { height: 56px; font-size: 17px; }
  .panel-head { padding: 20px 20px 10px; }
  .panel-head h2 { font-size: 30px; }
  .message-list { padding: 0 8px 8px; }
  .message-row { padding: 14px 12px; gap: 12px; }
  .avatar { width: 38px; height: 38px; font-size: 16px; }
  .otp { margin: 0 8px 8px; padding: 14px 16px; }
  .reader-scroll { padding: 6px 18px 20px; }
  .reader-scroll > * { flex-shrink: 0; }
.reader-subject { font-size: 22px; }
  .statusbar { margin: 0 10px 12px; }
  .toasts { bottom: 64px; }
}
/* ---------- Motion ---------- */
.motion-lite .fx-screen i, .motion-lite .fx-screen::before { animation: none; }
.motion-lite .scene-art { animation: none; }
.enter { animation: rise 0.8s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes rise { from { opacity: 0; translate: 0 18px; filter: blur(6px); } }
.vf .c { transition: translate 0.35s var(--ease), border-color 0.35s; }
.vf.enter .c { animation: corner-in 0.7s var(--ease) both; animation-delay: calc(var(--d, 0s) + 0.25s); }
.vf .tl { --cx: -12px; --cy: -12px; } .vf .tr { --cx: 12px; --cy: -12px; }
.vf .bl { --cx: -12px; --cy: 12px; } .vf .br { --cx: 12px; --cy: 12px; }
@keyframes corner-in { from { opacity: 0; translate: var(--cx) var(--cy); } 60% { opacity: 1; translate: calc(var(--cx) * -0.15) calc(var(--cy) * -0.15); } }
@media (hover: hover) {
  .vf:hover .tl { translate: -3px -3px; } .vf:hover .tr { translate: 3px -3px; }
  .vf:hover .bl { translate: -3px 3px; } .vf:hover .br { translate: 3px 3px; }
  .vf:hover .c { border-color: rgba(255, 255, 255, 0.8); }
}
.message-row.is-new { animation: row-in 0.6s var(--ease) both, row-flash 2.4s ease-out; }
@keyframes row-in { from { opacity: 0; translate: 0 -10px; } }
@keyframes row-flash { 0%, 30% { background: rgba(169, 207, 159, 0.16); } }
.message-list.stagger .message-row { animation: row-in 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.view.swap-in { animation: view-in 0.35s var(--ease) both; }
@keyframes view-in { from { opacity: 0; translate: 14px 0; } }
.otp.pop { animation: otp-pop 0.5s var(--ease) both; }
@keyframes otp-pop { from { opacity: 0; scale: 0.97; } }
.address.typing .domain::after, .address.typing .local::after { content: ''; display: inline-block; width: 0.08em; height: 0.9em; margin-left: 0.04em; background: var(--sage); vertical-align: -0.08em; animation: blink 0.8s steps(1) infinite; }
.cta { position: relative; overflow: hidden; }
.cta::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%); translate: -110% 0; }
.cta:hover::after { transition: translate 0.8s var(--ease); translate: 110% 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fx-mail { display: none; }
}

/* Remote-image guard in the reader */
.img-guard { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 8px; border-radius: 6px; background: rgba(242, 183, 140, 0.1); border: 1px solid rgba(242, 183, 140, 0.3); font-size: 13px; color: var(--text-2); }
.img-guard .chip { height: 32px; font-size: 13px; }
