/* Rung Coder — core stylesheet: tokens, base, shell (header/footer), buttons,
   form controls, modals. Page-specific layout lives in home.css / pages.css.

   One committed look: a dark control-room surface. Background and every colour
   are painted explicitly so the page holds on any host ground. */

:root {
  /* Ground */
  --bg-0: #090b0e;
  --bg-1: #0f1318;
  --bg-2: #151a21;
  --bg-3: #1c222b;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --line-accent: rgba(58, 232, 170, 0.35);

  /* Ink */
  --fg: #eef2f5;
  --fg-2: #b4bfc9;
  --fg-3: #7d8894;
  --fg-4: #55606b;

  /* Signal — the RUN LED. Brand teal kept as the calmer secondary. */
  --accent: #3ae8aa;
  --accent-deep: #22c38a;
  --accent-ink: #062a1e;
  --accent-glow: rgba(58, 232, 170, 0.18);
  --accent-soft: rgba(58, 232, 170, 0.1);
  --teal: #2d7d6f;

  /* Semantic */
  --warn: #f2b84b;
  --warn-soft: rgba(242, 184, 75, 0.14);
  --danger: #ff6d6d;
  --danger-soft: rgba(255, 109, 109, 0.14);
  --ok: var(--accent);

  /* Type */
  --font-display: "Sora", "Instrument Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-body: "Instrument Sans", "Sora", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Rhythm */
  --container: 1280px;
  --gutter: 32px;
  --nav-h: 72px;
  --section: 128px;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-panel: 0 30px 80px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --shadow-glow: 0 0 0 1px var(--line-accent), 0 20px 60px var(--accent-glow);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--fg-2);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body.menu-open,
body.auth-modal-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); color: var(--fg); font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
strong { color: var(--fg); font-weight: 600; }
code, pre, .mono { font-family: var(--font-mono); }

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

.container {
  width: min(var(--container), calc(100% - var(--gutter) * 2));
  margin: 0 auto;
}

.section { position: relative; padding: var(--section) 0; }
section[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* Ladder rail: a thin rule with rung ticks. Used under eyebrows and as dividers. */
.rail {
  position: relative;
  height: 1px;
  background: var(--line);
}
.rail::before,
.rail::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 1px;
  height: 9px;
  background: var(--line-strong);
}
.rail::before { left: 0; }
.rail::after { right: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 -4px 0 var(--accent-soft), 0 4px 0 var(--accent-soft);
}
[data-locale="zh"] .eyebrow { letter-spacing: 0.08em; }

.section-head { max-width: 760px; }
.section-head.is-center { margin: 0 auto; text-align: center; }
.section-head.is-center .eyebrow { justify-content: center; }
.section-head h2 {
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.section-head p { margin-top: 18px; font-size: 18px; color: var(--fg-3); max-width: 62ch; }
.section-head.is-center p { margin-left: auto; margin-right: auto; }
.accent { color: var(--accent); }
.nowrap { white-space: nowrap; }

/* Reveal on scroll — from a visible resting state, only the lift animates. */
.reveal { opacity: 0.001; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.9s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 26px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform 0.25s var(--ease), background 0.25s, border-color 0.25s, box-shadow 0.25s, color 0.25s;
}
.btn .icon { width: 18px; height: 18px; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 30px var(--accent-glow);
}
.btn-primary:hover { background: #5cf0bb; transform: translateY(-1px); box-shadow: 0 14px 36px rgba(58, 232, 170, 0.28); }
.btn-primary:disabled { background: var(--bg-3); color: var(--fg-4); box-shadow: none; transform: none; cursor: default; }
.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line-strong);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { color: var(--fg-2); padding: 0 14px; min-height: 44px; }
.btn-ghost:hover { color: var(--fg); }
.btn-block { width: 100%; }
.btn-sm { min-height: 42px; padding: 0 18px; font-size: 14px; }
.btn.is-busy { position: relative; color: transparent; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-color: var(--accent-ink) transparent var(--accent-ink) transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Icons: stroke-based, inherit currentColor */
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.icon-lg { width: 24px; height: 24px; }

/* Tinted icon chip */
.chip-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--line-accent);
}

/* Panel surfaces */
.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.panel-raised { background: var(--bg-2); border-color: var(--line-strong); box-shadow: var(--shadow-panel); }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  height: var(--nav-h);
  background: rgba(9, 11, 14, 0.55);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}
.site-header.is-scrolled { background: rgba(9, 11, 14, 0.82); border-bottom-color: var(--line); }
.nav-bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: var(--nav-h); }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 34px; width: auto; }
.desktop-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  position: relative;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--fg-2);
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover { color: var(--fg); background: rgba(255, 255, 255, 0.05); }
.nav-link.is-active { color: var(--fg); }
.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-actions .btn { min-height: 42px; padding: 0 20px; font-size: 14px; }

/* Language switcher */
.lang { position: relative; }
.lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 14px;
  color: var(--fg-2);
}
.lang-trigger .icon { width: 17px; height: 17px; }
.lang-trigger .icon:last-child { width: 14px; height: 14px; transition: transform 0.2s; }
.lang-trigger:hover, .lang.open .lang-trigger { color: var(--fg); border-color: var(--line); background: var(--bg-2); }
.lang.open .lang-trigger .icon:last-child { transform: rotate(180deg); }
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  padding: 6px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-panel);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.lang.open .lang-menu { opacity: 1; transform: none; pointer-events: auto; }
.lang-option {
  display: flex;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--fg-2);
  text-align: left;
}
.lang-option:hover { background: rgba(255, 255, 255, 0.06); color: var(--fg); }
.lang-option.is-active { color: var(--accent); }

/* Auth slot */
.auth-slot { display: flex; align-items: center; }
.auth-loading { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-3); }
.auth-signin {
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.auth-signin:hover { border-color: var(--accent); color: var(--accent); }
.auth-menu { position: relative; }
.auth-avatar-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--fg);
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
}
.auth-avatar-button img { width: 100%; height: 100%; object-fit: cover; }
.auth-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-panel);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.auth-menu.open .auth-dropdown { opacity: 1; transform: none; pointer-events: auto; }
.auth-dropdown [role="menuitem"] {
  display: flex;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--fg-2);
  text-align: left;
}
.auth-dropdown [role="menuitem"]:hover { background: rgba(255, 255, 255, 0.06); color: var(--fg); }

.menu-toggle { display: none; width: 44px; height: 44px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); place-items: center; color: var(--fg); }

/* Mobile drawer */
.drawer {
  position: fixed;
  inset: var(--nav-h) 0 0 0;
  z-index: 900;
  background: var(--bg-0);
  padding: 28px var(--gutter) 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  overflow-y: auto;
}
.drawer.open { opacity: 1; transform: none; pointer-events: auto; }
.drawer-links { display: grid; gap: 4px; }
.drawer-link { padding: 14px 8px; border-bottom: 1px solid var(--line); font-family: var(--font-display); font-size: 22px; color: var(--fg); }
.drawer-link.is-active { color: var(--accent); }
.drawer-foot { display: grid; gap: 18px; }
.drawer-langs { display: flex; gap: 8px; flex-wrap: wrap; }
.drawer-lang { min-height: 42px; padding: 0 16px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); color: var(--fg-2); font-size: 14px; }
.drawer-lang.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- Footer ---------- */
.footer { position: relative; padding: 88px 0 40px; border-top: 1px solid var(--line); background: var(--bg-0); }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 48px; }
.footer-brand img { height: 32px; width: auto; }
.footer-brand p { margin-top: 18px; color: var(--fg-3); font-size: 15px; max-width: 30ch; }
.footer-heading { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 18px; }
.footer-links { display: grid; gap: 10px; }
.footer-link { font-size: 15px; color: var(--fg-2); }
.footer-link:hover { color: var(--accent); }
.footer-contact { margin-top: 26px; display: grid; gap: 4px; }
.footer-contact span { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-4); }
.footer-bottom { margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--fg-4); }
.footer-status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; }
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* ---------- Mainland build (data-region="cn") ---------- */
.footer-filings { margin: 16px 0 0; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--fg-4); }
.footer-filing-link { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-3); text-decoration: none; }
.footer-filing-link:hover { color: var(--fg); text-decoration: underline; }
body[data-region="cn"] [data-account-checkout],
body[data-region="cn"] [data-manage-subscription],
body[data-region="cn"] [data-auth-billing],
body[data-region="cn"] .account-note,
body[data-region="cn"] .account-rows > div:nth-child(n+3) { display: none !important; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 1200;
  transform: translate(-50%, 16px);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  color: var(--fg);
  font-size: 14px;
  box-shadow: var(--shadow-panel);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Modals (auth / account / consent / confirm / busy / result) ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.is-open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 9, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.modal-panel {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 30px 30px 28px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, #171c24, #11151b);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-panel);
  animation: modal-in 0.35s var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
@media (prefers-reduced-motion: reduce) { .modal-panel { animation: none; } }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--fg-3);
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.modal-close:hover { color: var(--fg); border-color: var(--line-strong); }
.modal-panel h2 { font-size: 24px; line-height: 1.2; letter-spacing: -0.01em; margin-bottom: 8px; }
.modal-panel .eyebrow { margin-bottom: 10px; }
.modal-sub { color: var(--fg-3); font-size: 14.5px; margin-bottom: 22px; }
.modal-panel .btn + .btn { margin-top: 10px; }
.modal-panel .btn-block { margin-top: 6px; }

/* Provider buttons */
.auth-methods { display: grid; gap: 10px; }
.auth-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--fg);
  font-weight: 600;
  font-size: 14.5px;
}
.auth-provider:hover { border-color: var(--accent); }
.auth-provider-icon { display: grid; place-items: center; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--fg-4); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-card { padding: 20px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.auth-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-weight: 600; color: var(--fg); font-size: 15px; }
.auth-card-head .chip-icon { width: 36px; height: 36px; border-radius: 10px; }
.auth-form { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field > span, .field-label { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.field input, .field select, .field textarea, .input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--bg-1);
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { padding: 12px 14px; min-height: 150px; resize: vertical; line-height: 1.6; }
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(135deg, var(--fg-3) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
.field input::placeholder, .field textarea::placeholder { color: var(--fg-4); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-hint { font-size: 12.5px; color: var(--fg-4); }
.auth-password { position: relative; }
.auth-password input { padding-right: 46px; }
.auth-password-toggle { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; color: var(--fg-3); border-radius: var(--radius-sm); }
.auth-password-toggle:hover { color: var(--fg); }
.auth-inline { display: flex; justify-content: flex-end; margin-top: -4px; }
.auth-link { font-size: 13.5px; font-weight: 600; color: var(--accent); padding: 2px 0; }
.auth-link:hover { text-decoration: underline; }
.auth-switch { margin-top: 18px; display: flex; justify-content: center; gap: 6px; font-size: 14px; color: var(--fg-3); }
.auth-switch.is-split { justify-content: space-between; }
.auth-error, .auth-success, .note {
  margin: 0;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.55;
}
.auth-error { background: var(--danger-soft); color: #ffb4b4; border: 1px solid rgba(255, 109, 109, 0.25); }
.auth-success { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line-accent); }
.auth-error-actions { display: flex; gap: 16px; }
.auth-verify { display: grid; gap: 14px; }

/* Account modal rows */
.account-rows { display: grid; margin: 18px 0; border-top: 1px solid var(--line); }
.account-rows > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.account-rows span { color: var(--fg-3); }
.account-rows strong { color: var(--fg); text-align: right; font-weight: 600; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--fg-2);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.is-active, .status.is-trial { background: var(--accent-soft); color: var(--accent); }
.status.is-cancelled, .status.is-trialCancelled { background: var(--warn-soft); color: var(--warn); }
.status.is-expired, .status.is-trialExpired { background: var(--danger-soft); color: var(--danger); }
.status.is-none, .status.is-pending { background: var(--bg-3); color: var(--fg-3); }
.note { background: var(--accent-soft); color: var(--fg); border: 1px solid var(--line-accent); margin-bottom: 18px; }
.note.is-active { background: var(--warn-soft); border-color: rgba(242, 184, 75, 0.3); font-weight: 600; }
.note.is-expired, .note.is-trialExpired { background: var(--warn-soft); border-color: rgba(242, 184, 75, 0.3); }
.note.is-none { background: var(--bg-2); border-color: var(--line); color: var(--fg-2); }

/* Consent */
.consent-docs-label { margin: 18px 0 8px; font-size: 13px; color: var(--fg-3); }
.consent-docs { display: grid; gap: 8px; }
.consent-doc { display: flex; justify-content: space-between; align-items: center; min-height: 46px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--bg-1); color: var(--accent); font-weight: 600; font-size: 14px; }
.consent-doc:hover { border-color: var(--accent); }
.consent-doc-open { color: var(--fg-3); }
.consent-agree { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0 14px; font-size: 14px; color: var(--fg-2); cursor: pointer; }
.consent-agree input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--accent); flex: 0 0 auto; }

/* Checkout success / busy / result */
.mark { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line-accent); }
.mark .icon { width: 26px; height: 26px; }
.spinner { width: 24px; height: 24px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin 0.9s linear infinite; }
.is-centered { text-align: center; }
.busy-panel { text-align: center; padding: 34px 30px; }
.busy-panel .spinner { margin: 0 auto 16px; }
.busy-message { color: var(--fg); font-weight: 600; }
.result-panel { text-align: center; }
.result-message { margin-bottom: 18px; color: var(--fg); font-size: 15px; line-height: 1.6; }
.result-panel.is-error .result-message { color: #ffb4b4; }

/* ---------- Responsive shell ---------- */
@media (max-width: 1100px) {
  :root { --gutter: 24px; --section: 96px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 920px) {
  .desktop-nav, .nav-actions .btn-primary { display: none; }
  .menu-toggle { display: grid; }
  .lang-trigger > span { display: none; }
  .lang-trigger { padding: 0 8px; }
  .nav-actions { gap: 8px; }
}
@media (max-width: 640px) {
  :root { --gutter: 18px; --section: 72px; --nav-h: 64px; }
  body { font-size: 16px; }
  .footer-grid { grid-template-columns: 1fr; gap: 36px; }
  .modal { padding: 12px; align-items: flex-end; }
  .modal-panel { padding: 24px 20px; border-radius: var(--radius-lg); }
}

/* ---------- Legacy class aliases ----------
   auth.js and the ported subscription/ticket logic are carried over with their
   DOM hooks and class names untouched, so the Supabase flows stay byte-for-byte
   the code that was tested. These aliases give those names the new look. */
.auth-modal-shell, .account-modal { position: fixed; inset: 0; z-index: 1100; display: none; align-items: center; justify-content: center; padding: 24px; }
.auth-modal-shell.is-open, .account-modal.is-open { display: flex; }
.auth-modal-backdrop, .account-modal-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 9, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.auth-panel, .account-panel {
  position: relative; width: min(460px, 100%); max-height: calc(100vh - 48px); overflow-y: auto;
  padding: 30px 30px 28px; border-radius: var(--radius-xl);
  background: linear-gradient(180deg, #171c24, #11151b); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-panel); animation: modal-in 0.35s var(--ease);
}
.auth-panel h2, .account-panel h2 { font-size: 24px; line-height: 1.2; margin-bottom: 8px; }
.auth-modal-close, .account-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); color: var(--fg-3); font-size: 20px; line-height: 1; display: grid; place-items: center; }
.auth-modal-close:hover, .account-close:hover { color: var(--fg); border-color: var(--line-strong); }
.auth-subtitle { color: var(--fg-3); font-size: 14.5px; margin-bottom: 22px; }
.auth-email-card { padding: 20px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.auth-email-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-weight: 600; color: var(--fg); font-size: 15px; }
.auth-email-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line-accent); }
.auth-field { display: grid; gap: 7px; }
.auth-field > span { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.auth-field input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--bg-1); color: var(--fg); font: inherit; font-size: 15px; transition: border-color 0.2s, box-shadow 0.2s; }
.auth-field input::placeholder { color: var(--fg-4); }
.auth-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-hint { font-size: 12.5px; color: var(--fg-4); }
.auth-inline-actions { display: flex; justify-content: flex-end; margin-top: -4px; }
.auth-form-row { display: flex; justify-content: center; }
.auth-switch-split { justify-content: space-between; }
.button-primary, .button-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 26px;
  border-radius: var(--radius-pill); font-family: var(--font-body); font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: transform 0.25s var(--ease), background 0.25s, border-color 0.25s, box-shadow 0.25s, color 0.25s;
}
.button-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px var(--accent-glow); }
.button-primary:hover { background: #5cf0bb; transform: translateY(-1px); }
.button-primary:disabled { background: var(--bg-3); color: var(--fg-4); box-shadow: none; transform: none; cursor: default; }
.button-secondary { background: transparent; color: var(--fg); border: 1px solid var(--line-strong); }
.button-secondary:hover { border-color: var(--accent); color: var(--accent); }
.button-block { width: 100%; }
.button-primary .icon, .button-secondary .icon { width: 18px; height: 18px; }
.account-note { margin: 0 0 18px; padding: 11px 13px; border-radius: var(--radius-md); font-size: 13.5px; line-height: 1.55; background: var(--accent-soft); color: var(--fg); border: 1px solid var(--line-accent); }
.account-note.is-active, .account-note.is-expired, .account-note.is-trialExpired { background: var(--warn-soft); border-color: rgba(242, 184, 75, 0.3); }
.account-note.is-active { font-weight: 600; }
.account-note.is-none { background: var(--bg-2); border-color: var(--line); color: var(--fg-2); }
.account-status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 600; background: var(--bg-3); color: var(--fg-2); }
.account-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.account-status.is-active, .account-status.is-trial { background: var(--accent-soft); color: var(--accent); }
.account-status.is-cancelled, .account-status.is-trialCancelled { background: var(--warn-soft); color: var(--warn); }
.account-status.is-expired, .account-status.is-trialExpired { background: var(--danger-soft); color: var(--danger); }
.account-status.is-none, .account-status.is-pending { background: var(--bg-3); color: var(--fg-3); }
.checkout-success-panel { text-align: center; }
.checkout-success-mark { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line-accent); }
.checkout-success-mark svg { width: 26px; height: 26px; }
.checkout-success-spinner, .busy-spinner { display: block; width: 24px; height: 24px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin 0.9s linear infinite; }
.busy-panel .busy-spinner { margin: 0 auto 16px; }
.account-panel .button-primary + .button-secondary, .account-panel .button-secondary + .button-primary, .auth-panel .button-secondary + .auth-form-row { margin-top: 10px; }
.auth-modal-open .site-header { z-index: 900; }
