/* ==========================================================================
   Nexus Shell — Official Site
   Light first · Dark optional · Fully responsive
   Color tokens mirror the SwiftUI app's adaptive palette.
   ========================================================================== */

:root,
[data-theme="light"] {
  /* Brand */
  --c-primary:        #387ae0;
  --c-primary-strong: #2563d1;
  --c-primary-soft:   #5a93e6;
  --c-accent:         #1ab38c;
  --c-accent-strong:  #16957a;

  /* Surfaces */
  --c-bg:           #f4f5f7;
  --c-bg-2:         #ffffff;
  --c-surface:      #ffffff;
  --c-surface-2:    #fbfbfd;
  --c-sidebar:      #f1f3f6;
  --c-elevated:     #ffffff;
  --c-overlay:      rgba(255,255,255,0.85);

  --c-border:       rgba(0, 0, 0, 0.10);
  --c-border-soft:  rgba(0, 0, 0, 0.06);
  --c-border-strong:rgba(0, 0, 0, 0.16);

  /* Text */
  --c-text:    #1a1d23;
  --c-text-2:  #555c69;
  --c-text-3:  #8b94a3;
  --c-muted:   #a4adbb;

  /* Status */
  --c-red:    #ff6058;
  --c-yellow: #ffbd2e;
  --c-green:  #1ab38c;
  --c-success-bg: rgba(26, 179, 140, 0.10);
  --c-success-fg: #16957a;

  /* Terminal palette (dark even in light mode, like macOS Terminal) */
  --term-bg:        #1f2126;
  --term-fg:        #e6e8ec;
  --term-prompt:    #5dd4a8;
  --term-out:       #b9bdc5;
  --term-accent:    #5eaaff;

  /* Typography */
  --ff-sans: 'Inter', -apple-system, 'SF Pro Display', BlinkMacSystemFont, system-ui, 'PingFang SC', 'Noto Sans CJK SC', 'Helvetica Neue', sans-serif;
  --ff-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, ui-monospace, monospace;

  /* Layout */
  --maxw: 1180px;
  --pad:  20px;
  --rad:  12px;
  --rad-sm: 8px;
  --rad-lg: 18px;

  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-2: 0 10px 30px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 0 1px rgba(56, 122, 224, 0.18), 0 14px 42px -10px rgba(56, 122, 224, 0.18);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 140ms;
  --t-med:  260ms;

  --grid-line: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
  --c-primary:        #4f8cd9;
  --c-primary-strong: #5eaaff;
  --c-primary-soft:   #6fa3e3;
  --c-accent:         #1ab38c;
  --c-accent-strong:  #2dd4a8;

  --c-bg:           #1f2126;
  --c-bg-2:         #181a1f;
  --c-surface:      #25272d;
  --c-surface-2:    #2a2c33;
  --c-sidebar:      #1d1f24;
  --c-elevated:     #2c2e35;
  --c-overlay:      rgba(31, 33, 38, 0.78);

  --c-border:       rgba(255, 255, 255, 0.10);
  --c-border-soft:  rgba(255, 255, 255, 0.06);
  --c-border-strong:rgba(255, 255, 255, 0.18);

  --c-text:    #e6e9ef;
  --c-text-2:  #a4adbb;
  --c-text-3:  #6b7585;
  --c-muted:   #545b69;

  --c-success-bg: rgba(26, 179, 140, 0.14);
  --c-success-fg: #2dd4a8;

  --term-bg:        #16181d;
  --term-fg:        #d8dde5;
  --term-prompt:    #5dd4a8;
  --term-out:       #a4adbb;
  --term-accent:    #5eaaff;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.4), 0 6px 18px rgba(0,0,0,0.35);
  --shadow-2: 0 16px 40px rgba(0,0,0,0.45), 0 4px 10px rgba(0,0,0,0.25);
  --shadow-glow: 0 0 0 1px rgba(94, 170, 255, 0.20), 0 16px 42px -8px rgba(94, 170, 255, 0.18);

  --grid-line: rgba(255, 255, 255, 0.035);
}

/* ==== Reset ==== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ff-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color var(--t-med) var(--ease), color var(--t-med) var(--ease);
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--c-primary); }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; color: var(--c-text); }
p { margin: 0; color: var(--c-text-2); }
input { font-family: inherit; }
::selection { background: rgba(56,122,224,0.20); color: var(--c-text); }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* Subtle bg grid */

/* ==== Nav ==== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  background: var(--c-overlay);
  border-bottom: 1px solid var(--c-border);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--c-text);
  margin-right: auto;          /* push brand to the far left, everything else groups on the right */
}

/* Signed-in user menu — pill button that opens a dropdown */
.user-menu {
  position: relative;
  display: inline-flex;
}
.user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px 0 11px;
  height: 32px;
  border-radius: 999px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  font-size: 13px;
  font-weight: 500;
  max-width: 220px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.user-trigger:hover {
  background: var(--c-surface-2);
  border-color: var(--c-border-strong);
}
.user-menu.open .user-trigger {
  background: var(--c-surface-2);
  border-color: var(--c-border-strong);
}
.user-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 6px rgba(26, 179, 140, 0.55);
  flex-shrink: 0;
}
.user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.005em;
  max-width: 140px;
}
.user-chevron {
  color: var(--c-text-3);
  margin-left: 1px;
  transition: transform var(--t-fast) var(--ease);
  flex-shrink: 0;
}
.user-menu.open .user-chevron {
  transform: rotate(180deg);
}

/* Dropdown panel */
.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  padding: 6px;
  z-index: 60;
  animation: user-dropdown-in 140ms var(--ease);
}
@keyframes user-dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.user-dropdown-head {
  padding: 8px 10px 9px;
}
.user-dropdown-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-3);
  font-weight: 600;
  margin-bottom: 3px;
}
.user-dropdown-email {
  font-size: 13px;
  color: var(--c-text);
  font-weight: 500;
  word-break: break-all;
  line-height: 1.4;
}
.user-dropdown-divider {
  height: 1px;
  background: var(--c-border-soft);
  margin: 4px 2px;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--c-text);
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.user-dropdown-item:hover {
  background: var(--c-sidebar);
}
.user-dropdown-item svg {
  color: var(--c-text-3);
  flex-shrink: 0;
}
.user-dropdown-item:hover svg {
  color: var(--c-text);
}

[hidden] { display: none !important; }

/* Skip-to-main link: visually hidden until keyboard-focused, then
   anchored at top-left. Lets keyboard / screen-reader users bypass the
   nav, language picker, and (on the homepage) the terminal background. */
.skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 1000;
  padding: 8px 14px;
  background: #0a0a0d;
  color: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 120ms ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid #1ab38c;
  outline-offset: 2px;
}

/* Mobile drawer auth display */
.mobile-user {
  display: block;
  padding: 10px 4px;
  font-size: 14px;
  color: var(--c-text-2);
  border-bottom: 1px solid var(--c-border-soft);
  word-break: break-all;
}

.mobile-drawer {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 8px var(--pad) 18px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}
.mobile-drawer.open { display: flex; }
.mobile-drawer > a {
  display: block;
  padding: 13px 6px;
  border-bottom: 1px solid var(--c-border-soft);
  font-size: 15px;
  font-weight: 500;
  color: var(--c-text);
}
.mobile-drawer > a:hover { color: var(--c-primary); }

/* Drawer user info card (signed-in) */
.drawer-user-email {
  font-size: 13.5px;
  color: var(--c-text);
  font-weight: 500;
  word-break: break-all;
  line-height: 1.35;
}

/* Drawer row (theme / language switches) */

/* ==== Buttons ==== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: all var(--t-fast) var(--ease);
  border: 1px solid transparent;
  user-select: none;
  white-space: nowrap;
  line-height: 1.2;
}
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.62; cursor: not-allowed; transform: none; box-shadow: none; }

/* Loading state — applied while a button-driven async action is in flight.
   Pairs with aria-busy="true" in JS so screen readers announce the wait.
   The spinner is a CSS-only element so we don't introduce a new asset. */
.btn-loading {
  position: relative;
  pointer-events: none;       /* belt-and-braces; JS also sets disabled */
  opacity: 0.92;
}
.btn-loading > .btn-label { opacity: 0.85; }
.btn-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: btn-spin 0.7s linear infinite;
  flex: 0 0 auto;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  /* Honor a11y preference: replace the rotating ring with a calmer fade. */
  .btn-loading::before {
    animation: btn-pulse 1.4s ease-in-out infinite;
  }
  @keyframes btn-pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }
}

.btn-primary {
  background: linear-gradient(180deg, var(--c-primary-soft) 0%, var(--c-primary) 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset,
              0 4px 12px -4px rgba(56, 122, 224, 0.4);
}
[data-theme="dark"] .btn-primary {
  background: linear-gradient(180deg, var(--c-primary-strong) 0%, var(--c-primary) 100%);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.22) inset,
              0 8px 20px -4px rgba(56, 122, 224, 0.45);
  color: #fff;
}
.btn-primary:active { transform: translateY(0); }

/* ==== Hero (compact, focused) ==== */

/* Small app-icon placements need a crisp rounded edge on both themes. */
.brand > img,
.modal-head > img {
  border-radius: 22%;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 1px 2px rgba(15, 23, 42, 0.18);
}
/* ==== Hero (legacy, kept for compat — unused in compact layout) ==== */
.hero {
  position: relative;
  padding: 76px 0 88px;
  z-index: 1;
}

/* ==== App window mock (shared between hero & showcase) ==== */

/* Terminal area inside app window */
@keyframes blink { 50% { opacity: 0; } }

/* Toolbar (connections / files / keys) */

/* ==== 3-pane connections layout ==== */

/* Sidebar additions */

/* Sidebar toolbar icon (top-right of titlebar) */

/* Middle: connection list */

/* Connection card */
/* OS-flavoured avatars: subtle gradients matching common Linux distro / Apple aesthetics */

/* ==== Detail panel ==== */

/* Header card */

/* Metric grid (used by monitor + hardware) */

/* Disk row (full width) */

/* History list */
.history { display: flex; flex-direction: column; gap: 8px; }
.pill {
  font-size: 10.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(0,0,0,0.05);
  color: var(--c-text-3);
  font-weight: 500;
}
[data-theme="dark"] .pill { background: rgba(255,255,255,0.06); }

/* Terminal session bar tweaks */

/* Files screen — wide table */
.mono { font-family: var(--ff-mono); }

/* Key grid (LazyVGrid adaptive 300–440) */

/* Key cards (showcase) */

/* OLD list styles kept for backward compat (not used after redesign) */

/* File list */

/* Key list */

/* ==== Sections ==== */
.section {
  position: relative;
  padding: 96px 0;
  z-index: 1;
}

/* ==== Features ==== */
.feature {
  position: relative;
  padding: 24px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--rad);
  transition: all var(--t-med) var(--ease);
}
.feature:hover {
  transform: translateY(-2px);
  border-color: var(--c-border-strong);
  box-shadow: var(--shadow-1);
}

.feature h3 {
  font-size: 16px;
  margin-bottom: 6px;
  letter-spacing: -0.012em;
}
.feature p {
  font-size: 13.5px;
  color: var(--c-text-2);
  line-height: 1.6;
}

/* ==== Showcase ==== */

/* ============================================================
   Feature showcase (Hero ↔ Pricing)
   ============================================================
   Tabbed gallery of the actual macOS UI. Visual goals:
     * Tabs read like crisp pill segments — calm at rest, deliberate
       on hover/active so the user feels the click landed.
     * The screenshot is the hero of the section. We frame it with a
       soft outer ring + drop-shadow + ambient glow so it visually
       "lifts" out of the page background.
     * Cross-fade between panes (240ms cubic-bezier) avoids the
       flickery jump-cut of plain display:none toggling.
     * prefers-reduced-motion is honored (instant swap, no fade,
       no glow pulse) so a11y users don't get motion sickness.
   Layout: tabs on top, screenshot below, copy below the screenshot
   centered. Stacks cleanly to single-column on mobile. */
.feature-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text-2);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}
.feature-tab:hover {
  color: var(--c-text);
  border-color: var(--c-border-strong);
  transform: translateY(-1px);
}
.feature-tab:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}
.feature-tab.is-active {
  background: linear-gradient(180deg, var(--c-primary-soft) 0%, var(--c-primary) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.18) inset,
    0 6px 18px -6px rgba(56, 122, 224, 0.55);
}
[data-theme="dark"] .feature-tab.is-active {
  background: linear-gradient(180deg, var(--c-primary-strong) 0%, var(--c-primary) 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.14) inset,
    0 6px 22px -6px rgba(94, 170, 255, 0.55);
}
.feature-tab svg { flex: none; }

/* Stage = positioning context for cross-fading panes. We use position:
   absolute children with opacity transitions so the section height stays
   stable across tab changes (avoids reflow flicker). */
.feature-pane {
  display: grid;
  grid-template-rows: auto auto;
  gap: 20px;
  margin: 0;
}
.feature-pane[hidden] { display: none; }

.feature-pane.is-fading-out {
  opacity: 0;
  transition: opacity 180ms var(--ease);
}
.feature-pane.is-fading-in {
  opacity: 0;
  animation: feat-fade-in 280ms var(--ease) forwards;
}
@keyframes feat-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .feature-pane.is-fading-out,
  .feature-pane.is-fading-in {
    animation: none;
    transition: none;
    opacity: 1;
    transform: none;
  }
  .feature-tab { transition: none; }
}

@media (max-width: 720px) {
  .feature-tab {
    padding: 7px 12px;
    font-size: 12.5px;
  }
  .feature-tab svg { display: none; }
}

/* ==== Pricing ==== */
.plan {
  position: relative;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--rad);
  padding: 30px;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-1);
}
.plan-pro {
  border-color: rgba(56,122,224,0.35);
  background:
    linear-gradient(180deg, rgba(56,122,224,0.04) 0%, transparent 50%),
    var(--c-surface);
  box-shadow: var(--shadow-glow);
}
[data-theme="dark"] .plan-pro {
  border-color: rgba(94,170,255,0.35);
  background:
    linear-gradient(180deg, rgba(94,170,255,0.05) 0%, transparent 50%),
    var(--c-surface);
}
.plan-badge {
  position: absolute;
  top: 14px; right: 14px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.14em;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--ff-mono);
}
/* Pricing-TBA placeholder. Used while pricing is unannounced — same vertical
   footprint as the price line so Pro and Free cards stay equal-height. */

/* Strikethrough original price next to the discounted .amt — shows the
   "was $18.99, now $12.88" framing. Color-muted to keep the discounted
   price as the visual anchor. */

/* Limited-time deal pill — overrides the gradient .plan-badge with an
   orange/amber treatment so it reads as a promo, not a tier label. */

/* Discounted price meta (original-price + limited-time badge) — now sits inline to the right of the main price */
@keyframes pulse-discount {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.7); opacity: 0.6; }
}

/* Free plan warn-note (personal use only) */
.plan-note-warn {
  background: rgba(218, 165, 32, 0.10);
  border: 1px solid rgba(218, 165, 32, 0.22);
  color: #8a6411;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 11.5px;
  text-align: center;
  margin-top: 12px;
  line-height: 1.5;
}
[data-theme="dark"] .plan-note-warn {
  background: rgba(255, 189, 46, 0.12);
  border-color: rgba(255, 189, 46, 0.28);
  color: #f1b94a;
}

/* Upgrade summary — strike-through + discount amount rows */

/* Free plan body text + Pro plan policy list */
/* Feature with subnote (e.g. "AI 助手 — 需自行配置 API") */
.plan-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--c-text-3);
  text-align: center;
}

/* ==== CTA ==== */

/* ==========================================================================
   Legal pages (Privacy / Terms / Contact)
   ========================================================================== */

/* Language visibility — driven by <html lang="..."> set by i18n.js.
   Default every article hidden, then explicitly show the matching one.
   This is safer than the prior "hide the others" pattern: adding a new
   language only requires one new rule, and an unknown lang attribute
   does not cause every article to render at once. */
.legal-page .lang-zh,
.legal-page .lang-en,
.legal-page .lang-ja,
.legal-page .lang-ko,
.legal-page .lang-es,
.legal-page .lang-fr { display: none; }
html[lang="zh-CN"] .legal-page .lang-zh,
html[lang="zh"]    .legal-page .lang-zh { display: block; }
html[lang="en"]    .legal-page .lang-en { display: block; }
html[lang="ja"]    .legal-page .lang-ja { display: block; }
html[lang="ko"]    .legal-page .lang-ko { display: block; }
html[lang="es"]    .legal-page .lang-es { display: block; }
html[lang="fr"]    .legal-page .lang-fr { display: block; }

.legal-page {
  position: relative;
  z-index: 1;
  padding: 56px 0 32px;
}
.legal-inner {
  max-width: 760px;
  margin: 0 auto;
}
.legal-page h1 {
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -0.025em;
  margin-bottom: 6px;
  font-weight: 700;
}
.legal-page .legal-meta {
  font-size: 13px;
  color: var(--c-text-3);
  font-family: var(--ff-mono);
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--c-border-soft);
}
.legal-page h2 {
  font-size: 18px;
  margin: 32px 0 12px;
  letter-spacing: -0.012em;
  font-weight: 600;
}
.legal-page h3 {
  font-size: 15px;
  margin: 20px 0 10px;
  font-weight: 600;
  color: var(--c-text);
}
.legal-page p {
  font-size: 14.5px;
  line-height: 1.75;
  margin: 0 0 14px;
  color: var(--c-text);
}
.legal-page ul {
  margin: 0 0 14px;
  padding-left: 22px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--c-text);
}
.legal-page li { margin-bottom: 6px; }
.legal-page li::marker { color: var(--c-text-3); }
.legal-page strong { font-weight: 600; }
.legal-page a:not(.email):not(.contact-email-card) {
  color: var(--c-primary);
  border-bottom: 1px solid rgba(56,122,224,0.30);
}
[data-theme="dark"] .legal-page a:not(.email):not(.contact-email-card) {
  color: var(--c-primary-strong);
  border-bottom-color: rgba(94,170,255,0.30);
}
.legal-page a:hover { color: var(--c-primary-strong); }
.legal-page a.email {
  font-family: var(--ff-mono);
  font-size: 13.5px;
  color: var(--c-primary);
  background: rgba(56,122,224,0.08);
  padding: 1px 7px;
  border-radius: 5px;
}
[data-theme="dark"] .legal-page a.email {
  color: var(--c-primary-strong);
  background: rgba(94,170,255,0.12);
}
.legal-page code {
  font-family: var(--ff-mono);
  font-size: 12.5px;
  background: var(--c-sidebar);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--c-text-2);
}

/* Contact page — focused single email card */
.contact-page .contact-lead {
  font-size: 15px;
  color: var(--c-text-2);
  line-height: 1.7;
  margin-bottom: 22px;
}
.contact-email-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  text-decoration: none;
  margin-bottom: 14px;
  transition: all var(--t-fast) var(--ease);
}
.contact-email-card:hover {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(56,122,224,0.10), 0 6px 18px -8px rgba(56,122,224,0.30);
  transform: translateY(-1px);
}
[data-theme="dark"] .contact-email-card:hover {
  box-shadow: 0 0 0 3px rgba(94,170,255,0.14), 0 6px 18px -8px rgba(94,170,255,0.35);
}
.contact-email-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-accent) 100%);
  color: #fff;
  flex-shrink: 0;
}
.contact-email-info {
  flex: 1;
  min-width: 0;
}
.contact-email-label {
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--c-text-3);
  font-weight: 600;
  margin-bottom: 3px;
}
.contact-email-addr {
  font-family: var(--ff-mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--c-text);
  letter-spacing: -0.01em;
}
.contact-email-arrow {
  font-size: 20px;
  color: var(--c-text-3);
  transition: transform var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.contact-email-card:hover .contact-email-arrow {
  color: var(--c-primary);
  transform: translateX(3px);
}
.contact-tip {
  font-size: 13px;
  color: var(--c-text-3);
  margin: 0 0 24px;
}

/* Mobile tweaks for legal pages */
@media (max-width: 640px) {
  .legal-page { padding: 36px 0 24px; }
  .legal-page h1 { font-size: 26px; }
  .legal-page h2 { font-size: 17px; margin: 24px 0 10px; }
  .legal-page p, .legal-page ul { font-size: 14px; }
  .contact-email-card { padding: 14px 16px; gap: 12px; }
  .contact-email-icon { width: 38px; height: 38px; }
  .contact-email-addr { font-size: 15px; }
}

/* ==== Footer (compact) ==== */
/* When footer follows pricing as the last section, trim pricing's bottom padding */
/* Telegram social-icon link (paper-plane SVG) sitting at the end of the
   footer link row. Same alignment as the text links thanks to flex; uses
   Telegram brand blue on hover. */

/* ==== Footer (legacy, kept for compat) ==== */
.footer {
  border-top: 1px solid var(--c-border);
  padding: 44px 0 22px;
  margin-top: 40px;
  background: var(--c-bg);
  position: relative;
  z-index: 1;
}

/* ==== Modals ==== */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal.open { display: flex; animation: fadeIn 200ms var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 20, 28, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.55); }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--rad-lg);
  padding: 32px 28px 24px;
  box-shadow: var(--shadow-2);
  animation: slideUp 280ms var(--ease);
  max-height: 92vh;
  overflow-y: auto;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  position: absolute;
  top: 10px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 7px;
  font-size: 20px;
  color: var(--c-text-3);
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
  line-height: 1;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.modal-close:hover { background: var(--c-sidebar); color: var(--c-text); }

.modal-head {
  text-align: center;
  margin-bottom: 22px;
}
.modal-head img { margin: 0 auto 12px; }
.modal-head h3 {
  font-size: 20px;
  margin-bottom: 5px;
  letter-spacing: -0.015em;
}
.modal-head p {
  color: var(--c-text-2);
  font-size: 13px;
}

.modal-form {
  display: flex; flex-direction: column;
  gap: 13px;
}
.oauth-stack { display: grid; gap: 9px; margin-bottom: 14px; }
.oauth-btn {
  width: 100%; min-height: 42px; display: flex; align-items: center;
  justify-content: center; gap: 10px; padding: 9px 14px;
  color: var(--c-text); background: transparent; border: 1px solid transparent;
  border-radius: 7px; font-size: 13px; font-weight: 600;
}
.oauth-btn:hover { color: var(--c-text); background: var(--c-sidebar); border-color: var(--c-border); }
.oauth-btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.oauth-btn:disabled { opacity: .6; cursor: wait; }
.oauth-btn img { width: 18px; height: 18px; flex: 0 0 18px; }
[data-theme="dark"] .oauth-btn img[src$="github.svg"],
[data-theme="dark"] .oauth-btn-apple img { filter: invert(1); }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; color: var(--c-text-3); font-size: 11px; }
.auth-divider::before, .auth-divider::after { content: ''; height: 1px; flex: 1; background: var(--c-border); }
.oauth-legal { margin: -3px 0 12px; color: var(--c-text-3); font-size: 11px; line-height: 1.5; text-align: center; }
.field {
  display: flex; flex-direction: column;
  gap: 5px;
}
.field > span {
  font-size: 12px;
  color: var(--c-text-2);
  font-weight: 500;
}
.field input {
  width: 100%;
  padding: 10px 13px;
  background: var(--c-bg-2);
  border: 1px solid var(--c-border);
  border-radius: 9px;
  color: var(--c-text);
  font-size: 14px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  outline: none;
}
[data-theme="dark"] .field input { background: var(--c-bg); }
.field input::placeholder { color: var(--c-muted); }
.field input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(56,122,224,0.15);
}
[data-theme="dark"] .field input:focus {
  box-shadow: 0 0 0 3px rgba(94,170,255,0.20);
}

.form-row {
  display: flex; justify-content: space-between; align-items: center;
}
.check {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px;
  color: var(--c-text-2);
  cursor: pointer;
}
.check input[type=checkbox] {
  width: 15px; height: 15px;
  accent-color: var(--c-primary);
  cursor: pointer;
}
.check-row { margin-top: 4px; }
/* Cloudflare Turnstile widget mount inside the signup modal. The widget
   itself is ~300×65 px and self-styles; we just give it breathing room. */
.turnstile-mount { margin: 4px 0 2px; min-height: 0; display: flex; justify-content: center; }
.turnstile-mount[hidden] { display: none; }
.link-sm {
  font-size: 13px;
  color: var(--c-primary);
  font-weight: 500;
}
.link-sm:hover { color: var(--c-primary-strong); }

.form-foot {
  text-align: center;
  font-size: 13px;
  color: var(--c-text-2);
  margin-top: 4px;
}

/* Upgrade modal */

/* ==== Toast ==== */
.toast {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--c-elevated);
  color: var(--c-text);
  padding: 11px 16px;
  border-radius: 9px;
  border: 1px solid var(--c-border);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-2);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 260ms var(--ease);
  display: flex; align-items: center; gap: 9px;
  max-width: 90vw;
}
.toast::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 6px rgba(26,179,140,0.6);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.error::before { background: var(--c-red); box-shadow: 0 0 6px rgba(255,96,88,0.6); }

/* ==========================================================================
   Responsive — Tablet (≤960px)
   ========================================================================== */
@media (max-width: 960px) {

  .hero { padding: 56px 0 72px; }

  .section { padding: 72px 0; }

  /* 3-pane connections: drop the middle list, keep sidebar + detail */

  /* Header card — stack title + status, then actions */
}

/* ==========================================================================
   Responsive — Mobile (≤640px)
   ========================================================================== */
@media (max-width: 640px) {
  :root { --pad: 16px; }
  .brand { gap: 8px; }
  /* 把次要操作收进抽屉，nav 只保留 logo + ☰ */

  /* Compact hero on mobile */

  .hero { padding: 32px 0 56px; }

  .section { padding: 56px 0; }
  .feature { padding: 20px; }
  .plan { padding: 24px 22px; }

  .footer { padding: 32px 0 16px; }

  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
    padding: 26px 20px 20px;
    animation: slideUpMobile 300ms var(--ease);
  }
  @keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* Mobile: 3-pane → single pane (detail only) */

  /* Compact detail card */

  /* Files: drop the permissions column on phones */

  /* Keys grid → single column */

  /* Terminal shortcut hints — hide on phones */

  /* lang/user-menu in the top nav are hidden by home.css's ≤720px block
     (.nx-lang-menu / .nx-nav-right .user-menu) — they live in the drawer
     on mobile. No further rules here. */
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   Account page (account.html)
   Reuses .modal-form / .field / .btn for the change-email form,
   and the legal-page typography for general layout.
   ============================================================ */
.account-page {
  padding: clamp(28px, 5vw, 56px) 0;
  min-height: calc(100vh - 220px);
}
.account-inner {
  max-width: 640px;
}
.account-h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 18px;
}
.account-card {
  background: var(--c-elevated);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-1);
  margin-bottom: 16px;
}
.account-card h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
}
.account-desc {
  font-size: 13px;
  color: var(--c-text-2);
  margin: -6px 0 14px;
}
.auth-method-list { display: grid; gap: 0; border-top: 1px solid var(--c-border); }
.auth-method-row { min-height: 54px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid var(--c-border); }
.auth-method-row img { width: 19px; height: 19px; flex: 0 0 19px; }
[data-theme="dark"] .auth-method-row img:is([src$="github.svg"], [src$="apple.svg"]) { filter: invert(1); }
.auth-method-copy { min-width: 0; flex: 1; }
.auth-method-name { display: block; font-size: 13px; font-weight: 600; }
.auth-method-meta { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--c-text-3); font-size: 11px; white-space: nowrap; }
.auth-method-meta.is-private::before { content: ''; display: inline-block; width: 6px; height: 6px; margin: 0 6px 1px 0; border-radius: 50%; background: var(--c-accent); }
.auth-method-action { min-width: 70px; min-height: 32px; padding: 6px 10px; font-size: 12px; }
.reauth-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--c-border); }
.reauth-actions { display: flex; gap: 8px; margin-top: 10px; }
.sensitive-action-gate {
  border-top: 1px solid var(--c-border);
  padding-top: 14px;
}
.sensitive-action-gate p {
  color: var(--c-text-2);
  font-size: 13px;
  margin: 0 0 12px;
}
.sensitive-action-gate .btn { width: 100%; }
.account-dl {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}
.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
}
.account-row:last-child { border-bottom: 0; padding-bottom: 0; }
.account-row dt {
  color: var(--c-text-2);
  font-weight: 500;
}
.account-row dd {
  margin: 0;
  color: var(--c-text);
  font-weight: 500;
  text-align: right;
}

/* Account page tier badge — scoped under .account-page to avoid colliding
   with the home-page pricing card's .plan-badge (which is position: absolute). */
.account-page .plan-badge {
  display: inline-flex;
  align-items: center;
  position: static;          /* override absolute from home pricing styles */
  top: auto; right: auto;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  line-height: 1;
  background: rgba(120, 124, 132, 0.18);
  color: var(--c-text);
}
[data-theme="dark"] .account-page .plan-badge {
  background: rgba(255, 255, 255, 0.10);
}
.account-page .plan-badge.plan-pro {
  background: rgba(74, 140, 255, 0.16);
  color: #2c6ee5;
  /* clear any inherited gradient from home pricing's .plan-pro */
  border: none;
  box-shadow: none;
}
[data-theme="dark"] .account-page .plan-badge.plan-pro {
  background: rgba(74, 140, 255, 0.22);
  color: #8ab8ff;
}
.account-page .plan-badge.plan-trial {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}
[data-theme="dark"] .account-page .plan-badge.plan-trial {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
}
.account-page .plan-badge.plan-lifetime {
  background: rgba(139, 92, 246, 0.16);
  color: #6d28d9;
}
[data-theme="dark"] .account-page .plan-badge.plan-lifetime {
  background: rgba(167, 139, 250, 0.22);
  color: #c4b5fd;
}

.pro-thanks-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(74, 140, 255, 0.12), rgba(74, 140, 255, 0.04));
  border: 1px solid rgba(74, 140, 255, 0.25);
  border-radius: 12px;
  font-size: 13px;
  color: var(--c-text);
}
[data-theme="dark"] .pro-thanks-banner {
  background: linear-gradient(135deg, rgba(74, 140, 255, 0.18), rgba(74, 140, 255, 0.06));
}
/* Trial users get the warmer amber treatment that matches the PRO TRIAL badge,
   so the visual language stays consistent: blue = paid Pro, amber = trial. */
.pro-thanks-banner.is-trial {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.04));
  border-color: rgba(245, 158, 11, 0.30);
}
[data-theme="dark"] .pro-thanks-banner.is-trial {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.20), rgba(245, 158, 11, 0.06));
  border-color: rgba(245, 158, 11, 0.32);
}
/* Lifetime — premium violet treatment to mirror the PRO LIFETIME badge. */
.pro-thanks-banner.is-lifetime {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(139, 92, 246, 0.04));
  border-color: rgba(139, 92, 246, 0.30);
}
[data-theme="dark"] .pro-thanks-banner.is-lifetime {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.20), rgba(167, 139, 250, 0.06));
  border-color: rgba(167, 139, 250, 0.32);
}
.pro-thanks-emoji { font-size: 18px; line-height: 1; }

.account-need-signin {
  text-align: center;
  padding: 60px 20px;
}
.account-need-signin h1 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}
.account-need-signin p {
  font-size: 13px;
  color: var(--c-text-2);
  margin-bottom: 18px;
}

/* Reusable busy state for form submit buttons */
.btn.is-busy {
  opacity: 0.7;
  pointer-events: none;
}
.auth-action-page { min-height: 100vh; background: var(--c-bg); }
.auth-action-shell {
  width: min(472px, calc(100% - 32px));
  min-height: 100svh;
  margin: 0 auto;
  padding: 32px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-action-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--c-text);
  font-size: 15px;
  font-weight: 700;
}
.auth-action-brand img {
  border-radius: 7px;
  box-shadow: 0 0 0 1px var(--c-border), 0 2px 8px rgba(0, 0, 0, 0.22);
}
.auth-action-panel {
  position: relative;
  overflow: hidden;
  padding: 32px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-elevated);
  text-align: center;
  box-shadow: var(--shadow-2);
}
.auth-action-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--c-primary);
  opacity: 0.82;
}
.auth-action-panel h1 { margin: 0 0 10px; font-size: 22px; letter-spacing: 0; }
.auth-action-panel p { margin: 0; color: var(--c-text-2); font-size: 14px; line-height: 1.65; }
.auth-action-panel #actionMessage { max-width: 360px; margin-inline: auto; overflow-wrap: anywhere; }
.auth-action-panel .auth-action-detail {
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--c-border-soft);
  color: var(--c-text-3);
  font-size: 12.5px;
}
.auth-action-actions { display: grid; gap: 14px; margin-top: 24px; }
.auth-action-actions[hidden] { display: none; }
.auth-action-actions .btn { min-height: 44px; margin: 0; }
.auth-action-actions #resendVerification:disabled {
  opacity: 1;
  color: var(--c-text-3);
  background: var(--c-surface-2);
  border-color: var(--c-border);
  box-shadow: none;
}
.auth-action-links {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.auth-action-link {
  padding: 4px 2px;
  color: var(--c-text-2);
  font-size: 13px;
  font-weight: 500;
}
.auth-action-link:hover { color: var(--c-primary-strong); }
.auth-action-link-divider { width: 1px; height: 14px; background: var(--c-border-strong); }
.auth-action-panel .modal-form { text-align: left; }
.auth-action-spinner { width: 26px; height: 26px; margin: 0 auto 18px; border: 2px solid var(--c-border); border-top-color: var(--c-primary); border-radius: 50%; animation: auth-spin .8s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (max-width: 520px) {
  .auth-action-shell { width: min(100% - 24px, 472px); padding: 20px 0; }
  .auth-action-brand { margin-bottom: 14px; }
  .auth-action-panel { padding: 26px 22px; }
  .auth-action-panel h1 { font-size: 20px; }
}
