:root {
  --bg: #f7f8fb;
  --bg-hero: linear-gradient(180deg, #eef2ff 0%, #f7f8fb 100%);
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --hover: #f1f5f9;
  --brand: #4f46e5;
  --brand-2: #6d5dfc;
  --brand-hover: #4338ca;
  --brand-soft: #eef2ff;
  --brand-ring: rgba(79, 70, 229, 0.18);
  --on-brand: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #16a34a;
  --unread-mark: #4f46e5;
  --selected: #eef2ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 12px 40px -12px rgba(15, 23, 42, 0.25);
  --radius: 14px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
    --bg-hero: linear-gradient(180deg, #14162a 0%, #0b0d12 100%);
    --surface: #12151c;
    --surface-2: #181c25;
    --text: #e6e9f0;
    --text-2: #a3abbd;
    --text-3: #6b7385;
    --border: #232836;
    --border-strong: #2f3647;
    --hover: #1a1f2a;
    --brand: #8b85ff;
    --brand-2: #a59fff;
    --brand-hover: #a39eff;
    --brand-soft: #1d1f3a;
    --brand-ring: rgba(139, 133, 255, 0.25);
    --on-brand: #0b0d12;
    --danger: #f87171;
    --danger-soft: #2a1416;
    --ok: #4ade80;
    --unread-mark: #8b85ff;
    --selected: #1b1e33;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 12px 40px -12px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
svg {
  fill: currentColor;
}
a {
  color: var(--brand);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.muted {
  color: var(--text-2);
}
.small {
  font-size: 13px;
}
.grow {
  flex: 1;
}
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}
.container.narrow {
  max-width: 760px;
}

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-2);
  font-size: 17px;
  letter-spacing: -0.01em;
}
.brand strong {
  color: var(--text);
  font-weight: 650;
}
.nav-links {
  display: flex;
  gap: 4px;
}
.nav-links a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
}
.nav-links a:hover {
  background: var(--hover);
  color: var(--text);
}

/* ---------- hero ---------- */
.hero {
  background: var(--bg-hero);
  padding: 56px 0 40px;
  text-align: center;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  box-shadow: var(--shadow-sm);
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}
h1 {
  font-size: clamp(28px, 4.6vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 18px 0 10px;
}
.lede {
  color: var(--text-2);
  font-size: 16px;
  margin: 0 auto 28px;
  max-width: 560px;
}

.addr-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 6px 6px 6px 16px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: left;
}
.addr-bar:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring), var(--shadow);
}
.addr-bar.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent);
}
.addr-icon {
  width: 22px;
  height: 22px;
  color: var(--text-3);
  flex: none;
  margin-right: 10px;
}
.addr-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-family: var(--mono);
  font-size: clamp(16px, 2.6vw, 20px);
  font-weight: 500;
  height: 48px;
  text-align: right;
  padding: 0;
  letter-spacing: -0.01em;
}
.addr-input::placeholder {
  color: var(--text-3);
}
.addr-domain {
  font-family: var(--mono);
  font-size: clamp(16px, 2.6vw, 20px);
  font-weight: 500;
  color: var(--text-2);
  margin-right: 12px;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:active {
  transform: translateY(1px);
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--brand-hover);
}
.btn-primary.copied {
  background: var(--ok);
}
.addr-bar .btn {
  height: 48px;
  padding: 0 20px;
  border-radius: 12px;
}
.btn-ghost {
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface);
}
.btn-ghost:hover {
  background: var(--hover);
  color: var(--text);
}
.btn-danger {
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.addr-help {
  min-height: 22px;
  font-size: 13px;
  color: var(--text-2);
  margin: 10px 0 14px;
}
.addr-help.error {
  color: var(--danger);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  font-variant-numeric: tabular-nums;
}
.chip svg {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}
.chip.warn {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.menu-wrap {
  position: relative;
}
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 30;
  text-align: left;
}
.menu-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px 6px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  text-align: left;
}
.menu-item:hover {
  background: var(--hover);
}
.menu-item .mono {
  font-family: var(--mono);
  font-size: 13px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-item .tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 2px 6px;
}
.menu-empty {
  padding: 10px;
  font-size: 14px;
  color: var(--text-2);
}

/* ---------- mail client ---------- */
.client {
  margin-top: -8px;
  display: grid;
  grid-template-columns: 380px 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  height: min(640px, calc(100vh - 140px));
  min-height: 460px;
}
.pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.list-pane {
  border-right: 1px solid var(--border);
}
.pane-head {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--border);
}
.pane-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pane-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}
.count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 1px 8px;
  min-width: 24px;
  text-align: center;
}
.pane-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}
.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-right: 4px;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  animation: ping 2s infinite;
}
.live.off .pulse-dot {
  background: var(--text-3);
  animation: none;
}
@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 7px transparent;
  }
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  color: var(--text-2);
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}
.icon-btn.spin svg {
  animation: spin 0.7s linear;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.list {
  flex: 1;
  overflow-y: auto;
}
.row {
  display: flex;
  gap: 12px;
  width: 100%;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  position: relative;
  transition: background 0.1s;
}
.row:hover {
  background: var(--hover);
}
.row.active {
  background: var(--selected);
}
.row.unread::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 22px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--unread-mark);
}
.row.new {
  animation: flash 1.8s ease-out;
}
@keyframes flash {
  from {
    background: var(--brand-soft);
  }
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  flex: none;
  text-transform: uppercase;
}
.row-main {
  flex: 1;
  min-width: 0;
}
.row-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.row-from {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
}
.row-time {
  font-size: 12px;
  color: var(--text-3);
  flex: none;
}
.row-subject {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.row-subject svg {
  width: 14px;
  height: 14px;
  color: var(--text-3);
  flex: none;
}
.row-snippet {
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row.unread .row-from,
.row.unread .row-subject {
  font-weight: 650;
}

.list-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
}
.radar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  background: var(--brand-soft);
  color: var(--brand);
}
.radar::before,
.radar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--brand);
  opacity: 0;
  animation: radar 2.6s ease-out infinite;
}
.radar::after {
  animation-delay: 1.3s;
}
@keyframes radar {
  0% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
.radar svg {
  width: 40px;
  height: 40px;
}
.list-empty h3 {
  font-size: 16px;
  margin: 0 0 4px;
  font-weight: 600;
}
.list-empty p {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
  max-width: 260px;
}

.read-pane {
  overflow-y: auto;
}
.read-empty {
  margin: auto;
  text-align: center;
  padding: 32px;
}
.read-empty-art {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-3);
}
.read-empty-art svg {
  width: 34px;
  height: 34px;
}
.read-empty-title {
  font-weight: 600;
  margin: 0 0 4px;
}
.read-empty .muted {
  margin: 0;
  font-size: 14px;
}

.reader {
  padding: 10px 28px 28px;
}
.reader-bar {
  display: flex;
  align-items: center;
  margin: 0 -10px 6px;
}
.back-btn {
  visibility: hidden;
}
.r-subject {
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 650;
  margin: 0 0 18px;
  overflow-wrap: anywhere;
}
.r-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.r-from {
  min-width: 0;
}
.r-line {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: baseline;
  overflow-wrap: anywhere;
}
.r-line .muted {
  font-size: 13px;
}
.notice {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
}
.link-btn {
  color: var(--brand);
  font-weight: 600;
}
.r-body iframe {
  width: 100%;
  border: 0;
  display: block;
  background: #fff;
  border-radius: 10px;
  min-height: 80px;
}
.r-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}
.r-atts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.att {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  max-width: 100%;
  background: var(--surface);
}
.att:hover {
  border-color: var(--border-strong);
  background: var(--hover);
}
.att svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
  flex: none;
}
.att span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.att small {
  color: var(--text-3);
}

.otp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 3px 8px 3px 10px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.otp-pill:hover {
  background: var(--brand);
  color: var(--on-brand);
}
.otp-pill svg {
  width: 14px;
  height: 14px;
}
.otp-pill.copied {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.otp-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 18px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
}
.otp-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand);
}
.otp-code {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--text);
  user-select: all;
}
.otp-banner .btn.copied {
  background: var(--ok);
}

/* ---------- sections ---------- */
.section-title {
  font-size: 24px;
  letter-spacing: -0.02em;
  font-weight: 700;
  text-align: center;
  margin: 0 0 24px;
}
.how {
  padding-top: 72px;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.step-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 14px;
}
.step h3 {
  font-size: 16px;
  margin: 14px 0 6px;
  font-weight: 650;
}
.step p {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}
.faq {
  padding-top: 72px;
  padding-bottom: 72px;
}
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 20px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '+';
  font-size: 20px;
  font-weight: 400;
  color: var(--text-3);
  transition: transform 0.2s;
}
.faq details[open] summary::after {
  transform: rotate(45deg);
}
.faq p {
  margin: 0;
  padding: 0 20px 18px;
  color: var(--text-2);
  font-size: 14px;
}
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  font-size: 13px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #0f172a;
  color: #f8fafc;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  z-index: 50;
  max-width: calc(100vw - 32px);
  animation: rise 0.2s ease-out;
}
.toast.error {
  background: var(--danger);
  color: #fff;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

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

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .client {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 420px;
  }
  .list-pane {
    border-right: 0;
  }
  .list {
    max-height: none;
    min-height: 360px;
  }
  .read-pane {
    display: none;
  }
  .client.reading .list-pane {
    display: none;
  }
  .client.reading .read-pane {
    display: flex;
  }
  .client.reading .read-empty {
    display: none;
  }
  .back-btn {
    visibility: visible;
  }
  .steps {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .nav-links {
    display: none;
  }
  .hero {
    padding: 36px 0 28px;
  }
  .container {
    padding: 0 16px;
  }
  .addr-bar {
    flex-wrap: wrap;
    padding: 8px;
  }
  .addr-icon {
    display: none;
  }
  .addr-input {
    text-align: right;
    height: 44px;
    flex: 1 1 40%;
  }
  .addr-domain {
    margin-right: 4px;
    flex: 0 1 auto;
  }
  .addr-bar .btn {
    flex: 1 1 100%;
    margin-top: 8px;
    height: 46px;
  }
  .toolbar {
    justify-content: center;
  }
  .toolbar-actions {
    justify-content: center;
  }
  .reader {
    padding: 8px 16px 24px;
  }
  .menu {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    min-width: 280px;
  }
}
