/* CosmoSpark V4 Shell — shared layout, components and motion for the five V4 surfaces
 * (index.html / app-v4 / project-v4 / data-v4 / pricing-v4).
 *
 * Builds on the AWKN Design Intelligence tokens (design-intelligence.css, source of truth
 * AWKN-Lab/UI) and only *extends* them with --v4-* tokens. Presentation only: no element
 * ids, data-* attributes or behaviour depend on this file.
 *
 * References: Linear / Vercel Geist (dark surfaces, hairlines, quiet chrome), Stripe (pricing
 * hierarchy), Apple HIG (44pt targets, tab bars for top-level navigation, safe areas),
 * Material 3 motion (standard-decelerate enter, short durations), WCAG 2.2 (AA contrast,
 * visible focus, prefers-reduced-motion).
 */

:root {
  /* surfaces & lines (refined on top of --awkn-*) */
  --v4-canvas: var(--awkn-canvas, #070b12);
  --v4-surface-1: var(--awkn-surface-1, #0d1420);
  --v4-surface-2: var(--awkn-surface-2, #111b29);
  --v4-surface-3: #16233a;
  --v4-glass: rgba(10, 16, 26, .72);
  --v4-hairline: var(--awkn-hairline, #233044);
  --v4-hairline-strong: #31425a;
  --v4-ink: var(--awkn-ink, #eef4ff);
  --v4-ink-2: #c4d0e2;
  --v4-ink-muted: var(--awkn-ink-muted, #90a0b8);
  --v4-accent: var(--awkn-accent, #4ee1a0);
  --v4-accent-ink: var(--awkn-accent-foreground, #06110d);
  --v4-accent-soft: rgba(78, 225, 160, .10);
  --v4-accent-line: rgba(78, 225, 160, .38);
  --v4-info: var(--awkn-info, #61b8ff);
  --v4-warning: var(--awkn-warning, #f3c969);
  --v4-danger: var(--awkn-danger, #ff7f87);

  /* type scale (1.2 minor third, 16px base) */
  --v4-font: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", system-ui, sans-serif;
  --v4-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --v4-fs-11: 11px; --v4-fs-12: 12px; --v4-fs-13: 13px; --v4-fs-14: 14px; --v4-fs-16: 16px;
  --v4-fs-18: 18px; --v4-fs-20: 20px; --v4-fs-24: 24px; --v4-fs-30: 30px; --v4-fs-38: 38px;

  /* spacing (4pt grid) */
  --v4-s1: 4px; --v4-s2: 8px; --v4-s3: 12px; --v4-s4: 16px; --v4-s5: 20px; --v4-s6: 24px;
  --v4-s8: 32px; --v4-s10: 40px; --v4-s12: 48px; --v4-s16: 64px;

  /* radius / elevation / focus */
  --v4-r-sm: var(--awkn-radius-sm, 8px);
  --v4-r-md: var(--awkn-radius-md, 13px);
  --v4-r-lg: var(--awkn-radius-lg, 18px);
  --v4-r-xl: var(--awkn-radius-xl, 24px);
  --v4-e1: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 1px 2px rgba(0, 0, 0, .3);
  --v4-e2: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 32px -12px rgba(0, 0, 0, .55);
  --v4-e3: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 28px 70px -20px rgba(0, 0, 0, .7);
  --v4-glow: 0 0 0 1px var(--v4-accent-line), 0 18px 50px -18px rgba(78, 225, 160, .35);
  --v4-focus: 0 0 0 2px var(--v4-canvas), 0 0 0 4px rgba(78, 225, 160, .85);

  /* motion (Material 3 standard-decelerate family, 150–320ms) */
  --v4-ease: cubic-bezier(.2, .8, .2, 1);
  --v4-ease-in: cubic-bezier(.4, 0, 1, 1);
  --v4-d-fast: 150ms;
  --v4-d-base: 220ms;
  --v4-d-slow: 320ms;

  /* shell metrics */
  --v4-side-w: 248px;
  --v4-rail-w: 72px;
  --v4-top-h: 60px;
  --v4-tab-h: 64px;
  --v4-safe-b: env(safe-area-inset-bottom, 0px);
  --v4-safe-t: env(safe-area-inset-top, 0px);

  /* aliases consumed by shared runtimes (auth badge uses --color-*) */
  --color-accent: var(--v4-accent);
  --color-primary: var(--v4-accent);
  --color-primary-bg: var(--v4-accent-soft);
  --color-border: var(--v4-hairline-strong);
  --color-text-secondary: var(--v4-ink-2);
}

/* ── base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--v4-top-h) + 12px); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--v4-canvas); color: var(--v4-ink);
  font-family: var(--v4-font); font-size: var(--v4-fs-16); line-height: 1.6;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
::selection { background: rgba(78, 225, 160, .28); color: #fff; }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--v4-focus); border-radius: 10px; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

/* ambient background: soft aurora + film grain (pure CSS, offline) */
body::before {
  content: ""; position: fixed; top: -20vh; right: -10vw; bottom: auto; left: -10vw; height: 80vh; z-index: -2; pointer-events: none;
  background:
    radial-gradient(38% 50% at 30% 30%, rgba(78, 225, 160, .14), transparent 70%),
    radial-gradient(34% 44% at 72% 22%, rgba(97, 184, 255, .13), transparent 70%),
    radial-gradient(30% 40% at 50% 60%, rgba(120, 100, 255, .07), transparent 70%);
  filter: blur(10px);
  animation: v4-aurora 22s ease-in-out infinite alternate;
}
body::after {
  content: ""; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: -1; pointer-events: none; opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ── layout shell ─────────────────────────────────────── */
.shell { max-width: 1160px; margin: 0 auto; padding: 0 var(--v4-s6) var(--v4-s16); }

.topbar, .top {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: var(--v4-s3);
  min-height: var(--v4-top-h); padding: calc(var(--v4-s2) + var(--v4-safe-t)) 0 var(--v4-s2);
  margin: 0 0 var(--v4-s2);
  background: rgba(7, 11, 18, .78);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  box-shadow: 0 0 0 100vmax rgba(7, 11, 18, .78); clip-path: inset(0 -100vmax);
  transition: border-color var(--v4-d-base) var(--v4-ease), background var(--v4-d-base) var(--v4-ease);
}
.is-scrolled .topbar, .is-scrolled .top { border-bottom-color: var(--v4-hairline); }
.top-lead { display: flex; align-items: center; gap: var(--v4-s2); min-width: 0; }

.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; min-width: 0; font-size: var(--v4-fs-16); }
.brand span { color: var(--v4-accent); }
.brand-mark {
  position: relative; flex: none; width: 26px; height: 26px; border-radius: 8px;
  background: radial-gradient(circle at 30% 30%, #8ff5c8, var(--v4-accent) 45%, #1d8f63 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset, 0 6px 18px -6px rgba(78, 225, 160, .7);
}
.brand-mark::after { content: ""; position: absolute; top: 7px; right: 7px; bottom: 7px; left: 7px; border-radius: 50%; background: var(--v4-canvas); box-shadow: 6px -6px 0 -4px #eafff4; }
.brand-sub { color: var(--v4-ink-muted); font-weight: 500; }

.hamburger {
  display: inline-flex; flex: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--v4-hairline);
  background: rgba(255, 255, 255, .02); color: var(--v4-ink); cursor: pointer; font-size: 17px;
  transition: background var(--v4-d-fast) var(--v4-ease), border-color var(--v4-d-fast) var(--v4-ease), transform var(--v4-d-fast) var(--v4-ease);
}
.hamburger:hover { background: rgba(255, 255, 255, .05); border-color: var(--v4-hairline-strong); }
.hamburger:active { transform: scale(.96); }
.hamburger svg, .nav-item svg, .tab svg { width: 20px; height: 20px; flex: none; }

/* sidebar: full on desktop, icon rail when collapsed (remembered), drawer on mobile */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 90; width: var(--v4-side-w);
  display: flex; flex-direction: column; gap: 2px; padding: calc(16px + var(--v4-safe-t)) 12px 16px;
  background: linear-gradient(180deg, rgba(13, 20, 32, .96), rgba(9, 14, 23, .98));
  border-right: 1px solid var(--v4-hairline);
  transition: transform var(--v4-d-slow) var(--v4-ease), width var(--v4-d-slow) var(--v4-ease), box-shadow var(--v4-d-slow) var(--v4-ease);
  overflow: hidden;
}
.side-head { display: flex; align-items: center; gap: 4px; padding: 4px 6px 18px; min-height: 52px; }
.sidebar .brand { display: inline-flex; padding: 6px 4px; font-size: var(--v4-fs-16); }
.side-label { padding: 12px 12px 6px; font-size: var(--v4-fs-11); letter-spacing: .12em; text-transform: uppercase; color: #6f8099; white-space: nowrap; }
.sidebar .nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px;
  border-radius: 11px; color: var(--v4-ink-muted); font-size: var(--v4-fs-14); font-weight: 520; white-space: nowrap;
  transition: background var(--v4-d-fast) var(--v4-ease), color var(--v4-d-fast) var(--v4-ease), transform var(--v4-d-fast) var(--v4-ease);
}
.sidebar .nav-item:hover { background: rgba(255, 255, 255, .045); color: var(--v4-ink); }
.sidebar .nav-item:active { transform: scale(.98); }
.sidebar .nav-item.active { color: var(--v4-ink); background: linear-gradient(90deg, rgba(78, 225, 160, .14), rgba(78, 225, 160, .04)); }
.sidebar .nav-item.active svg { color: var(--v4-accent); }
.sidebar .nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--v4-accent); box-shadow: 0 0 12px rgba(78, 225, 160, .8);
  animation: v4-grow-y var(--v4-d-slow) var(--v4-ease) both;
}
.nav-text { transition: opacity var(--v4-d-base) var(--v4-ease); }
.side-upsell {
  display: block; margin: 14px 4px 0; padding: 14px; border-radius: 14px; border: 1px solid var(--v4-accent-line);
  background: radial-gradient(120% 90% at 0% 0%, rgba(78, 225, 160, .16), rgba(13, 20, 32, .4));
  font-size: var(--v4-fs-13); color: var(--v4-ink-2); line-height: 1.5; white-space: normal;
  transition: transform var(--v4-d-fast) var(--v4-ease), border-color var(--v4-d-fast) var(--v4-ease);
}
.side-upsell strong { display: block; color: var(--v4-ink); font-size: var(--v4-fs-14); margin-bottom: 2px; }
.side-upsell:hover { transform: translateY(-1px); border-color: rgba(78, 225, 160, .6); }
.sidebar .side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--v4-hairline); color: #6f8099; font-size: var(--v4-fs-11); line-height: 1.6; white-space: nowrap; }
.side-close { display: none; margin-left: auto; width: 44px; height: 44px; flex: none; border: 0; border-radius: 12px; background: transparent; color: var(--v4-ink-muted); font-size: 22px; cursor: pointer; }
.side-close:hover { background: rgba(255, 255, 255, .05); color: var(--v4-ink); }
.sidebar-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 85; background: rgba(3, 7, 12, .6);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity var(--v4-d-base) var(--v4-ease);
}

/* bottom tab bar (mobile only) */
.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  padding: 6px 8px calc(6px + var(--v4-safe-b));
  background: rgba(8, 13, 21, .86); -webkit-backdrop-filter: saturate(170%) blur(18px); backdrop-filter: saturate(170%) blur(18px);
  border-top: 1px solid var(--v4-hairline);
}
.tabbar-inner { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; max-width: 520px; margin: 0 auto; }
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 52px; border-radius: 14px; color: #7f90a8; font-size: var(--v4-fs-11); font-weight: 600; letter-spacing: .02em;
  transition: color var(--v4-d-fast) var(--v4-ease), transform var(--v4-d-fast) var(--v4-ease), background var(--v4-d-fast) var(--v4-ease);
}
.tab:active { transform: scale(.94); }
.tab.active { color: var(--v4-accent); }
.tab.active::before {
  content: ""; position: absolute; top: 4px; width: 46px; height: 30px; border-radius: 999px; background: var(--v4-accent-soft); z-index: -1;
  animation: v4-pop-in var(--v4-d-base) var(--v4-ease) both;
}

@media (min-width: 761px) {
  body { padding-left: var(--v4-side-w); transition: padding-left var(--v4-d-slow) var(--v4-ease); }
  body.sidebar-collapsed { padding-left: var(--v4-rail-w); }
  body.sidebar-collapsed .sidebar { width: var(--v4-rail-w); transform: none; }
  body.sidebar-collapsed .sidebar .nav-text,
  body.sidebar-collapsed .sidebar .brand-text,
  body.sidebar-collapsed .sidebar .side-label,
  body.sidebar-collapsed .sidebar .side-foot,
  body.sidebar-collapsed .sidebar .side-upsell { opacity: 0; pointer-events: none; }
  body.sidebar-collapsed .sidebar .nav-item { gap: 0; justify-content: flex-start; padding-left: 14px; }
  body.sidebar-collapsed .sidebar .side-head { padding-left: 4px; }
  .side-close { display: none; }
}

@media (max-width: 760px) {
  :root { --v4-top-h: 56px; }
  .shell { padding: 0 var(--v4-s4) calc(var(--v4-tab-h) + var(--v4-safe-b) + var(--v4-s10)); }
  .sidebar { width: min(84vw, 300px); transform: translateX(-102%); box-shadow: none; }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar { transform: none; box-shadow: 30px 0 80px rgba(0, 0, 0, .55); }
  body.sidebar-open .sidebar-mask { opacity: 1; pointer-events: auto; }
  .side-close { display: inline-flex; align-items: center; justify-content: center; }
  .hamburger { width: 42px; height: 42px; }
  .tabbar { display: block; }
  .brand-sub { display: none; }
}

/* ── components ───────────────────────────────────────── */
.primary, .ghost, .link-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--v4-hairline);
  background: rgba(255, 255, 255, .02); color: var(--v4-ink); font-size: var(--v4-fs-14); font-weight: 560;
  cursor: pointer; white-space: nowrap; text-align: center; user-select: none;
  transition: transform var(--v4-d-fast) var(--v4-ease), background var(--v4-d-fast) var(--v4-ease), border-color var(--v4-d-fast) var(--v4-ease), box-shadow var(--v4-d-base) var(--v4-ease), color var(--v4-d-fast) var(--v4-ease);
}
.ghost:hover, .link-btn:hover { background: rgba(255, 255, 255, .055); border-color: var(--v4-hairline-strong); }
.link-btn { border-color: transparent; background: transparent; color: var(--v4-ink-2); }
.primary {
  background: linear-gradient(180deg, #6befb5, var(--v4-accent)); border-color: transparent; color: var(--v4-accent-ink); font-weight: 750;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 8px 24px -10px rgba(78, 225, 160, .75);
}
.primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 12px 32px -10px rgba(78, 225, 160, .95); filter: brightness(1.04); }
.primary:active, .ghost:active, .link-btn:active, .chip:active { transform: scale(.98); }
.primary:disabled, .ghost:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.primary:disabled { position: relative; }

.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--v4-hairline); background: rgba(13, 20, 32, .7); color: var(--v4-ink-2);
  font-size: var(--v4-fs-13); cursor: pointer;
  transition: border-color var(--v4-d-fast) var(--v4-ease), color var(--v4-d-fast) var(--v4-ease), background var(--v4-d-fast) var(--v4-ease), transform var(--v4-d-fast) var(--v4-ease);
}
.chip:hover { border-color: var(--v4-accent-line); color: var(--v4-ink); background: var(--v4-accent-soft); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; color: var(--v4-accent);
  font-size: var(--v4-fs-12); font-weight: 650; letter-spacing: .14em; text-transform: uppercase;
}
.label { font-size: var(--v4-fs-11); font-weight: 650; color: var(--v4-ink-muted); letter-spacing: .12em; text-transform: uppercase; }
.subtle, .sub { color: var(--v4-ink-muted); line-height: 1.7; }

.card {
  position: relative; background: linear-gradient(180deg, rgba(17, 27, 41, .78), rgba(13, 20, 32, .92));
  border: 1px solid var(--v4-hairline); border-radius: var(--v4-r-lg); padding: var(--v4-s5);
  box-shadow: var(--v4-e1);
  transition: border-color var(--v4-d-base) var(--v4-ease), transform var(--v4-d-base) var(--v4-ease), box-shadow var(--v4-d-base) var(--v4-ease);
}
.card h2, .card h3 { margin: 6px 0 10px; letter-spacing: -.01em; }
.card h3 { font-size: var(--v4-fs-18); line-height: 1.35; }
.card.interactive:hover, .projects .card:hover, .grid > .card.op:hover, .plans .card:hover {
  border-color: var(--v4-hairline-strong); transform: translateY(-2px); box-shadow: var(--v4-e2);
}

.pill {
  display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 3px 9px; margin: 0 6px 6px 0;
  border: 1px solid var(--v4-hairline); border-radius: 999px; background: rgba(255, 255, 255, .02);
  color: var(--v4-ink-2); font-size: var(--v4-fs-11); font-weight: 600; letter-spacing: .02em; line-height: 1.3;
}
.unknown { color: var(--v4-warning); }
.pill.unknown { border-color: rgba(243, 201, 105, .35); background: rgba(243, 201, 105, .06); }

.loading { padding: var(--v4-s12) var(--v4-s5); text-align: center; color: var(--v4-ink-muted); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--v4-hairline); border-top-color: var(--v4-accent); animation: v4-spin .8s linear infinite; margin: 0 auto 14px; }

/* skeletons */
.sk { position: relative; overflow: hidden; border-radius: 8px; background: rgba(255, 255, 255, .045); }
.sk::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
  animation: v4-shimmer 1.4s var(--v4-ease) infinite;
}
.sk-line { height: 12px; margin: 10px 0; }
.sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w80 { width: 80%; } .sk-line.w90 { width: 90%; }
.sk-title { height: 22px; width: 70%; margin: 12px 0 16px; border-radius: 10px; }
.sk-card { background: var(--v4-surface-1); border: 1px solid var(--v4-hairline); border-radius: var(--v4-r-lg); padding: var(--v4-s5); text-align: left; }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }

.footer {
  margin-top: var(--v4-s12); padding-top: var(--v4-s5); border-top: 1px solid var(--v4-hairline);
  color: #6f8099; font-size: var(--v4-fs-12); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

/* toast: slides in above the tab bar on mobile */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--v4-safe-b)); z-index: 140; transform: translateX(-50%);
  max-width: min(92vw, 560px); padding: 11px 18px; border-radius: 14px; text-align: center;
  background: rgba(21, 32, 47, .94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--v4-hairline-strong); color: #fff; font-size: var(--v4-fs-14);
  box-shadow: var(--v4-e3);
}
.toast:not(.hidden) { animation: v4-toast-in var(--v4-d-slow) var(--v4-ease) both; }
@media (max-width: 760px) { .toast { bottom: calc(var(--v4-tab-h) + var(--v4-safe-b) + 14px); } }

/* modals: centred dialog on desktop, bottom sheet on mobile */
.modal-bg {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(2, 6, 12, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: v4-fade var(--v4-d-base) var(--v4-ease) both;
}
.modal {
  width: min(460px, 100%); max-height: 88vh; overflow: auto; padding: var(--v4-s6);
  background: linear-gradient(180deg, #111b2a, #0c131f); border: 1px solid var(--v4-hairline-strong); border-radius: var(--v4-r-xl);
  box-shadow: var(--v4-e3); animation: v4-pop var(--v4-d-slow) var(--v4-ease) both;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: var(--v4-fs-20); letter-spacing: -.01em; }
.modal-head .ghost { min-height: 36px; padding: 6px 12px; font-size: var(--v4-fs-13); }
.field { margin: 14px 0; }
.field label { display: block; margin-bottom: 6px; color: var(--v4-ink-muted); font-size: var(--v4-fs-12); font-weight: 600; }
.field input {
  width: 100%; min-height: 46px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--v4-hairline);
  background: #0a111b; color: var(--v4-ink); outline: none; font-size: 16px;
  transition: border-color var(--v4-d-fast) var(--v4-ease), box-shadow var(--v4-d-fast) var(--v4-ease);
}
.field input:focus { border-color: var(--v4-accent-line); box-shadow: 0 0 0 3px rgba(78, 225, 160, .16); }
.modal .primary, .modal .ghost[style*="width:100%"] { border-radius: 12px; min-height: 48px; }
.error { color: var(--v4-danger); font-size: var(--v4-fs-13); margin: 10px 0; }
.qr { width: 220px; height: 220px; display: block; margin: 18px auto; background: #fff; padding: 10px; border-radius: 16px; box-shadow: 0 0 0 6px rgba(78, 225, 160, .12); animation: v4-pop var(--v4-d-slow) var(--v4-ease) both; }
.status { text-align: center; color: var(--v4-ink-muted); font-size: var(--v4-fs-12); line-height: 1.6; }
@media (max-width: 760px) {
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; border-bottom: 0;
    padding: 12px var(--v4-s5) calc(var(--v4-s6) + var(--v4-safe-b));
    animation: v4-sheet var(--v4-d-slow) var(--v4-ease) both;
  }
  .modal::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 999px; background: #3a4a62; margin: 0 auto 14px; }
}

/* user badge rendered by auth-runtime.js (utility class names have no stylesheet on V4) */
#user-badge { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--v4-fs-12); }
#user-badge > span { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--v4-ink-2); }
#user-badge button {
  min-height: 36px; padding: 6px 12px !important; margin: 0 !important; border-radius: 999px !important; cursor: pointer;
  font-size: var(--v4-fs-12); font-weight: 600; white-space: nowrap; background: rgba(255, 255, 255, .02);
  transition: transform var(--v4-d-fast) var(--v4-ease), background var(--v4-d-fast) var(--v4-ease);
}
#user-badge button:hover { background: rgba(255, 255, 255, .06); }
#user-badge button:active { transform: scale(.97); }
@media (max-width: 420px) { #user-badge > span { max-width: 72px; } #user-badge button { padding: 6px 10px !important; } }

/* 顶栏在窄宽度下必须收得进容器。
 * 2026-10-20 浏览器验收（320 / 390 宽）实测：#user-badge 的两个 nowrap 按钮
 * （注册送10次 / 登录）加上顶栏次要入口，总宽超出 .shell 内容盒，
 * 页面出现 12–26px 横向溢出（登录按钮被顶到视口外）。
 * 让位顺序：次要入口（会员与额度 / 我的项目 等）先隐藏 → 极窄宽度再让注册 CTA 让位。
 * 登录与站内通知是功能入口，任何宽度都保留。 */
@media (max-width: 980px) {
  .topbar .actions > a.ghost, .top .actions > a.ghost,
  .topbar .nav > a.ghost, .top .nav > a.ghost { display: none; }
}
@media (max-width: 420px) {
  #user-badge .badge-cta { display: none; }
  #user-badge { gap: 4px; }
}

/* ── motion ───────────────────────────────────────────── */
.enter { animation: v4-rise var(--v4-d-slow) var(--v4-ease) both; animation-delay: calc(var(--i, 0) * 60ms + 40ms); }
.js-motion .reveal { opacity: 0; transform: translateY(12px); transition: opacity var(--v4-d-slow) var(--v4-ease), transform var(--v4-d-slow) var(--v4-ease); transition-delay: calc(var(--i, 0) * 60ms); }
.js-motion .reveal.in-view { opacity: 1; transform: none; }

@keyframes v4-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes v4-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes v4-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes v4-pop-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes v4-sheet { from { transform: translateY(100%); } to { transform: none; } }
@keyframes v4-toast-in { from { opacity: 0; transform: translate(-50%, 14px) scale(.97); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes v4-grow-y { from { transform: scaleY(0); } to { transform: none; } }
@keyframes v4-shimmer { to { transform: translateX(100%); } }
@keyframes v4-spin { to { transform: rotate(360deg); } }
@keyframes v4-aurora { from { transform: translate3d(-2%, 0, 0) scale(1); } to { transform: translate3d(3%, 4%, 0) scale(1.08); } }
@keyframes v4-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.6); opacity: .35; } }

/* staggered card reveal helpers (index set by nth-child, capped) */
.stagger > * { animation: v4-rise var(--v4-d-slow) var(--v4-ease) both; }
.stagger > *:nth-child(2) { animation-delay: 50ms; } .stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; } .stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(6) { animation-delay: 250ms; } .stagger > *:nth-child(n+7) { animation-delay: 300ms; }

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .enter, .stagger > *, .toast:not(.hidden), .modal, .modal-bg, .qr, .tab.active::before, .sidebar .nav-item.active::before { animation: none !important; }
  .js-motion .reveal { opacity: 1; transform: none; transition: none; }
  .sk::after { animation: none; }
  .sidebar, .sidebar-mask, body, .card, .primary, .ghost, .chip, .tab { transition: none !important; }
  .primary:active, .ghost:active, .chip:active, .tab:active { transform: none; }
}

@media (forced-colors: active) {
  .primary, .ghost, .card, .pill, .tab.active { border: 1px solid CanvasText; }
}

/* brand inside sidebar keeps two-tone wordmark */
.brand .brand-text { color: var(--v4-ink); transition: opacity var(--v4-d-base) var(--v4-ease); }
.brand .brand-text span { color: var(--v4-accent); }
.brand .brand-text .brand-sub { color: var(--v4-ink-muted); font-weight: 500; }
@media (max-width: 360px) { .topbar .brand-text, .top .brand-text { display: none; } }
@media (min-width: 761px) { body.sidebar-collapsed .topbar .brand-sub, body.sidebar-collapsed .top .brand-sub { display: none; } body.sidebar-collapsed .crumb { padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--v4-hairline); } }

/* ══════════════════════════════════════════════════════════════════════════
 * 第二轮：主题切换按钮 / 白天版 / 宇宙星空画布 / 我的模型 Key 面板
 * 主题由 <html data-theme="light|dark"> 驱动（theme-bootstrap.js 在首帧前写入，
 * 键名与 index.html 共用 'cosmo-theme'）。夜间版即第一轮基线，未改动。
 * ══════════════════════════════════════════════════════════════════════════ */

/* icon buttons in the top bar (theme toggle, model key) */
.top-tools { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 38px; height: 38px; padding: 0; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--v4-hairline); background: var(--v4-tint, rgba(255, 255, 255, .02)); color: var(--v4-ink-2);
  font-size: 17px; line-height: 1;
  transition: background var(--v4-d-fast) var(--v4-ease), border-color var(--v4-d-fast) var(--v4-ease), transform var(--v4-d-fast) var(--v4-ease), color var(--v4-d-fast) var(--v4-ease);
}
.icon-btn:hover { background: var(--v4-tint-hover, rgba(255, 255, 255, .06)); border-color: var(--v4-hairline-strong); color: var(--v4-ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .ti { display: inline-block; transition: transform var(--v4-d-slow) var(--v4-ease), opacity var(--v4-d-base) var(--v4-ease); }
.theme-toggle:hover .ti { transform: rotate(-18deg) scale(1.08); }
.theme-toggle .ti-light { display: none; }
html[data-theme="light"] .theme-toggle .ti-dark { display: none; }
html[data-theme="light"] .theme-toggle .ti-light { display: inline-block; }
.byok-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--v4-accent); box-shadow: 0 0 0 2px var(--v4-canvas); opacity: 0; transform: scale(.4); transition: opacity var(--v4-d-base) var(--v4-ease), transform var(--v4-d-base) var(--v4-ease); }
html.byok-on .byok-dot { opacity: 1; transform: none; }
@media (max-width: 520px) { .top-tools .byok-btn { display: none; } .icon-btn { width: 36px; height: 36px; } }

/* sidebar entry is a <button>, reset it to look like the nav links */
.sidebar button.nav-item { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; font: inherit; }
.sidebar .nav-item .nav-badge { margin-left: auto; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 650; color: var(--v4-accent); background: var(--v4-accent-soft); opacity: 0; transition: opacity var(--v4-d-base) var(--v4-ease); }
html.byok-on .sidebar .nav-item .nav-badge { opacity: 1; }
body.sidebar-collapsed .sidebar .nav-item .nav-badge { display: none; }

/* theme switch: circular reveal (View Transitions) or a short colour cross-fade */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }
html.theme-anim body, html.theme-anim .card, html.theme-anim .topbar, html.theme-anim .top, html.theme-anim .sidebar,
html.theme-anim .tabbar, html.theme-anim .modal, html.theme-anim .chip, html.theme-anim .pill, html.theme-anim .primary,
html.theme-anim .ghost, html.theme-anim .composer, html.theme-anim .metric, html.theme-anim .filters, html.theme-anim .item,
html.theme-anim .step, html.theme-anim .note, html.theme-anim .fact, html.theme-anim .risk, html.theme-anim .evidence {
  transition: background-color .42s var(--v4-ease), background .42s var(--v4-ease), color .42s var(--v4-ease), border-color .42s var(--v4-ease), box-shadow .42s var(--v4-ease) !important;
}

/* cosmos canvas (v4-cosmos.js) — behind everything, never interactive, fades in after first paint */
.v4-cosmos { position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100vw; height: 100vh; height: 100lvh; z-index: -3; pointer-events: none; opacity: 0; transition: opacity .9s var(--v4-ease); contain: strict; }
.v4-cosmos.is-ready { opacity: 1; }
.v4-cosmos.is-swapping { opacity: 0; transition-duration: .28s; }
/* the CSS aurora doubles as the nebula behind the stars: compositor-animated (transform only),
 * so the canvas never repaints large gradients per frame */
html.has-cosmos body::before {
  top: -18vh; right: -12vw; bottom: auto; left: -12vw; height: 135vh;
  background:
    radial-gradient(34% 40% at 24% 22%, rgba(78, 225, 160, .2), transparent 70%),
    radial-gradient(30% 38% at 76% 16%, rgba(97, 184, 255, .18), transparent 70%),
    radial-gradient(28% 34% at 54% 52%, rgba(138, 116, 255, .12), transparent 70%),
    radial-gradient(30% 30% at 14% 78%, rgba(97, 184, 255, .06), transparent 70%);
}
.v4-constellation { position: absolute; pointer-events: none; z-index: 0; }
.score-ring .score-num { z-index: 1; }

/* ── 白天版（light theme） ───────────────────────────── */
html[data-theme="light"] {
  color-scheme: light;
  --awkn-canvas: #f3f6fa;
  --awkn-surface-1: #ffffff;
  --awkn-surface-2: #f5f7fa;
  --awkn-hairline: #dfe5ed;
  --awkn-ink: #13202e;
  --awkn-ink-muted: #5b6b7e;
  --awkn-accent: #0a7d55;
  --awkn-accent-foreground: #ffffff;
  --awkn-info: #2563eb;
  --awkn-warning: #a15c00;
  --awkn-danger: #b42318;
  --v4-canvas: #f3f6fa;
  --v4-surface-1: #ffffff;
  --v4-surface-2: #f5f7fa;
  --v4-surface-3: #edf1f6;
  --v4-glass: rgba(255, 255, 255, .78);
  --v4-hairline: #dfe5ed;
  --v4-hairline-strong: #cbd4df;
  --v4-ink: #13202e;
  --v4-ink-2: #364556;
  --v4-ink-muted: #5b6b7e;
  --v4-accent: #0a7d55;
  --v4-accent-ink: #ffffff;
  --v4-accent-soft: rgba(10, 125, 85, .08);
  --v4-accent-line: rgba(10, 125, 85, .30);
  --v4-info: #2563eb;
  --v4-warning: #a15c00;
  --v4-danger: #b42318;
  --v4-tint: rgba(19, 32, 46, .025);
  --v4-tint-hover: rgba(19, 32, 46, .06);
  --v4-e1: 0 1px 2px rgba(22, 34, 47, .05), 0 2px 8px rgba(22, 34, 47, .035);
  --v4-e2: 0 2px 6px rgba(22, 34, 47, .05), 0 14px 32px rgba(22, 34, 47, .07);
  --v4-e3: 0 6px 14px rgba(22, 34, 47, .07), 0 34px 76px rgba(22, 34, 47, .12);
  --v4-glow: 0 0 0 1px var(--v4-accent-line), 0 18px 46px -20px rgba(10, 125, 85, .35);
  --v4-focus: 0 0 0 2px #ffffff, 0 0 0 4px rgba(10, 125, 85, .75);
  --color-accent: #07724d;
  --color-primary: #07724d;
  --color-primary-bg: var(--v4-accent-soft);
  --color-border: var(--v4-hairline-strong);
  --color-text-secondary: var(--v4-ink-2);
}
html[data-theme="light"] .eyebrow { color: #07724d; }
html[data-theme="light"] ::selection { background: rgba(10, 125, 85, .18); color: var(--v4-ink); }
html[data-theme="light"] body::before {
  background:
    radial-gradient(42% 52% at 18% 8%, rgba(255, 206, 160, .38), transparent 70%),
    radial-gradient(40% 50% at 78% 4%, rgba(160, 200, 255, .42), transparent 70%),
    radial-gradient(34% 40% at 52% 40%, rgba(150, 230, 200, .22), transparent 70%);
}
html[data-theme="light"] body::after { opacity: .03; mix-blend-mode: multiply; }
html[data-theme="light"] .topbar, html[data-theme="light"] .top { background: rgba(243, 246, 250, .82); box-shadow: 0 0 0 100vmax rgba(243, 246, 250, .82); }
html[data-theme="light"] .brand-mark { background: radial-gradient(circle at 30% 30%, #5fe0a9, #12a272 45%, #077650 100%); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06) inset, 0 6px 16px -6px rgba(10, 125, 85, .55); }
html[data-theme="light"] .brand-mark::after { background: #ffffff; box-shadow: 6px -6px 0 -4px #0a7d55; }
html[data-theme="light"] .hamburger, html[data-theme="light"] .primary, html[data-theme="light"] .ghost,
html[data-theme="light"] .pill, html[data-theme="light"] #user-badge button { background: rgba(255, 255, 255, .7); }
html[data-theme="light"] .hamburger:hover, html[data-theme="light"] .ghost:hover, html[data-theme="light"] .link-btn:hover,
html[data-theme="light"] #user-badge button:hover { background: #ffffff; border-color: var(--v4-hairline-strong); }
html[data-theme="light"] .link-btn { background: transparent; }
html[data-theme="light"] .primary {
  background: linear-gradient(180deg, #098459, #07724d); color: #ffffff; border-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .28) inset, 0 8px 20px -10px rgba(7, 114, 77, .7);
}
html[data-theme="light"] .primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset, 0 12px 26px -10px rgba(7, 114, 77, .85); }
html[data-theme="light"] .sidebar { background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(248, 250, 252, .98)); }
html[data-theme="light"] .side-label, html[data-theme="light"] .sidebar .side-foot, html[data-theme="light"] .footer,
html[data-theme="light"] .tab, html[data-theme="light"] .projects .eyebrow, html[data-theme="light"] .trust,
html[data-theme="light"] .fact small { color: #5b6b7e; }
html[data-theme="light"] .sidebar .nav-item:hover, html[data-theme="light"] .side-close:hover { background: rgba(19, 32, 46, .05); }
html[data-theme="light"] .sidebar .nav-item.active { background: linear-gradient(90deg, rgba(10, 125, 85, .12), rgba(10, 125, 85, .03)); }
html[data-theme="light"] .sidebar .nav-item.active::before { box-shadow: 0 0 10px rgba(10, 125, 85, .45); }
html[data-theme="light"] .side-upsell { background: radial-gradient(120% 90% at 0% 0%, rgba(10, 125, 85, .12), rgba(255, 255, 255, .7)); }
html[data-theme="light"] .sidebar-mask { background: rgba(19, 32, 46, .32); }
html[data-theme="light"] body.sidebar-open .sidebar { box-shadow: 30px 0 80px rgba(19, 32, 46, .18); }
html[data-theme="light"] .tabbar { background: rgba(255, 255, 255, .9); }
html[data-theme="light"] .chip { background: rgba(255, 255, 255, .85); }
html[data-theme="light"] .card { background: linear-gradient(180deg, #ffffff, #fbfcfe); }
html[data-theme="light"] .sk { background: rgba(19, 32, 46, .06); }
html[data-theme="light"] .sk::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent); }
html[data-theme="light"] .sk-card { background: #ffffff; }
html[data-theme="light"] .modal-bg { background: rgba(19, 32, 46, .36); }
html[data-theme="light"] .modal { background: #ffffff; }
html[data-theme="light"] .modal::before { background: #cbd4df; }
html[data-theme="light"] .field input, html[data-theme="light"] .field select { background: #f5f7fa; }
html[data-theme="light"] .qr { box-shadow: 0 0 0 1px var(--v4-hairline), 0 0 0 6px rgba(10, 125, 85, .08); }
html[data-theme="light"] .unknown { color: #a15c00; }
html[data-theme="light"] .pill.unknown { color: #8a4f00; border-color: rgba(161, 92, 0, .3); background: rgba(161, 92, 0, .06); }
html[data-theme="light"] .toast { background: rgba(19, 32, 46, .94); border-color: transparent; color: #ffffff; }
/* page-level surfaces that the five pages hard-code for the night baseline */
html[data-theme="light"] body:has(#idea-input) .hero h1, html[data-theme="light"] body:has(#plans) .hero h1 { background: linear-gradient(180deg, #0d1724 30%, #3e5068); -webkit-background-clip: text; background-clip: text; }
html[data-theme="light"] .composer { background: rgba(255, 255, 255, .92); box-shadow: 0 2px 6px rgba(22, 34, 47, .05), 0 30px 70px -28px rgba(22, 34, 47, .22); }
html[data-theme="light"] .composer-footer { border-top-color: var(--v4-hairline); }
html[data-theme="light"] textarea::placeholder, html[data-theme="light"] .filters input::placeholder { color: #6b7a8c; }
html[data-theme="light"] .hero-badge { background: rgba(10, 125, 85, .06); }
html[data-theme="light"] .loading-card { background: linear-gradient(120deg, rgba(10, 125, 85, .07), #ffffff); }
html[data-theme="light"] .engine, html[data-theme="light"] .card-ico, html[data-theme="light"] .plans .item { background: rgba(19, 32, 46, .03); }
html[data-theme="light"] .verdict-card { background: radial-gradient(120% 120% at 0% 0%, rgba(37, 99, 235, .07), transparent 55%), linear-gradient(180deg, #ffffff, #fbfcfe); }
html[data-theme="light"] .score-ring { background: conic-gradient(var(--v4-accent) calc(var(--p) * 1turn), rgba(19, 32, 46, .08) 0); box-shadow: 0 0 34px -14px rgba(10, 125, 85, .45); }
html[data-theme="light"] .score-ring::before { background: #ffffff; box-shadow: inset 0 0 0 1px var(--v4-hairline); }
html[data-theme="light"] .next { background: radial-gradient(90% 140% at 0% 0%, rgba(10, 125, 85, .10), transparent 60%), linear-gradient(180deg, #ffffff, #fbfcfe); }
html[data-theme="light"] .risk.high { background: linear-gradient(90deg, rgba(180, 35, 24, .06), var(--v4-surface-2) 60%); }
html[data-theme="light"] .metric { background: linear-gradient(180deg, #ffffff, #fbfcfe); }
html[data-theme="light"] .metric::after { background: radial-gradient(circle, rgba(10, 125, 85, .10), transparent 70%); }
html[data-theme="light"] .filters { background: rgba(255, 255, 255, .88); }
html[data-theme="light"] .card.featured { background: radial-gradient(120% 80% at 0% 0%, rgba(10, 125, 85, .10), transparent 55%), linear-gradient(180deg, #ffffff, #fbfcfe); }
html[data-theme="light"] .step, html[data-theme="light"] .note { background: rgba(255, 255, 255, .78); }
html[data-theme="light"] .error { background: radial-gradient(100% 120% at 0% 0%, rgba(180, 35, 24, .06), transparent 60%), #ffffff; border-color: rgba(180, 35, 24, .35); }

/* ── 我的模型 Key（BYOK）面板 ───────────────────────── */
.byok .modal { width: min(520px, 100%); }
.byok-lead { margin: -4px 0 14px; color: var(--v4-ink-muted); font-size: var(--v4-fs-14); line-height: 1.65; }
.byok-state { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--v4-hairline); background: var(--v4-tint, rgba(255, 255, 255, .02)); font-size: var(--v4-fs-13); color: var(--v4-ink-2); }
.byok-state::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--v4-ink-muted); }
.byok-state.on::before { background: var(--v4-accent); box-shadow: 0 0 0 4px var(--v4-accent-soft); }
.byok-state b { color: var(--v4-ink); font-weight: 650; }
.byok-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 2px; }
.byok-presets .chip { min-height: 34px; padding: 6px 12px; font-size: var(--v4-fs-13); }
.byok-presets .chip[aria-pressed="true"] { border-color: var(--v4-accent-line); color: var(--v4-ink); background: var(--v4-accent-soft); }
.field select {
  width: 100%; min-height: 46px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--v4-hairline);
  background: #0a111b; color: var(--v4-ink); font-size: 16px; appearance: none; -webkit-appearance: none;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { margin: 8px 0; }
.key-wrap { position: relative; }
.key-wrap input { padding-right: 64px; font-family: var(--v4-mono); letter-spacing: .02em; }
.key-wrap .link-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 6px 10px; font-size: var(--v4-fs-12); }
.field-hint { margin: -2px 0 4px; font-size: var(--v4-fs-12); color: var(--v4-ink-muted); line-height: 1.55; }
.byok-result { min-height: 22px; margin: 10px 0 2px; font-size: var(--v4-fs-13); line-height: 1.55; color: var(--v4-ink-muted); }
.byok-result.ok { color: var(--v4-accent); }
.byok-result.bad { color: var(--v4-danger); }
.byok-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.byok-actions .primary, .byok-actions .ghost { border-radius: 12px; min-height: 48px; }
.byok-clear { display: block; margin: 10px auto 0; color: var(--v4-danger); }
.byok-privacy { margin: 0 0 12px; padding: 10px 13px; border-radius: 12px; background: var(--v4-accent-soft); border: 1px solid var(--v4-accent-line); font-size: var(--v4-fs-12); line-height: 1.7; color: var(--v4-ink-2); }
.byok-privacy strong { color: var(--v4-ink); }
@media (max-width: 760px) { .field-row { grid-template-columns: 1fr; gap: 0; } }

@media (prefers-reduced-motion: reduce) {
  .v4-cosmos, .byok-dot, .theme-toggle .ti { transition: none !important; }
  .icon-btn:active { transform: none; }
}

/* compliance: legal links, AIGC explicit label, consent checkbox (presentation only; ids/markup owned by the pages) */
.legal-links { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0 2px; }
.legal-links a {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 4px; margin: 0 -4px; border-radius: 8px;
  color: var(--v4-ink-muted); text-decoration: underline; text-decoration-color: var(--v4-hairline-strong);
  text-underline-offset: 4px; transition: color var(--v4-d-fast) var(--v4-ease), text-decoration-color var(--v4-d-fast) var(--v4-ease);
}
.legal-links a:hover { color: var(--v4-accent); text-decoration-color: var(--v4-accent-line); }
.legal-links a:focus-visible { outline: none; box-shadow: var(--v4-focus); }

/* AI 显式标识：a quiet glass chip with a gradient "AI" mark */
.aigc-label {
  display: inline-flex; align-items: center; gap: 7px; min-height: 26px; padding: 3px 11px 3px 4px; border-radius: 999px;
  border: 1px solid var(--v4-hairline-strong); background: color-mix(in srgb, var(--v4-surface-2) 78%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--v4-ink-2); font-size: var(--v4-fs-12); font-weight: 600; letter-spacing: .02em; line-height: 1; white-space: nowrap;
  vertical-align: middle;
}
.aigc-label::before {
  content: "AI"; display: inline-grid; place-items: center; height: 18px; min-width: 22px; padding: 0 5px; border-radius: 999px;
  font-family: var(--v4-mono); font-size: 10px; font-weight: 700; letter-spacing: .04em;
  color: var(--v4-accent-ink); background: linear-gradient(135deg, var(--v4-accent), var(--v4-info));
}
.status-row .aigc-label { margin: 0 8px 8px 0; }
.rv > .aigc-label + .subtle { display: inline; line-height: 1.7; }

/* 同意勾选：block flow so the text and links wrap as one paragraph; the native checkbox is restyled in place */
.consent {
  display: block; position: relative; margin: 12px 0 14px; color: var(--v4-ink-muted);
  font-size: var(--v4-fs-13); line-height: 1.7; text-align: left; overflow-wrap: anywhere;
}
.consent:has(input[type="checkbox"]) { padding: 9px 12px 9px 42px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; transition: border-color var(--v4-d-fast) var(--v4-ease), background var(--v4-d-fast) var(--v4-ease); }
.consent:has(input[type="checkbox"]):hover { background: var(--v4-tint-hover, rgba(255, 255, 255, .04)); }
.consent a { color: var(--v4-ink-2); text-decoration: underline; text-decoration-color: var(--v4-hairline-strong); text-underline-offset: 3px; padding: 2px 0; }
.consent a:hover { color: var(--v4-accent); text-decoration-color: var(--v4-accent-line); }
.consent a:focus-visible { outline: none; border-radius: 4px; box-shadow: var(--v4-focus); }
.consent input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; position: absolute; left: 12px; top: 10px; width: 20px; height: 20px; margin: 0;
  border: 1.5px solid var(--v4-hairline-strong); border-radius: 6px; background: var(--v4-surface-1); cursor: pointer;
  display: grid; place-content: center;
  transition: background var(--v4-d-fast) var(--v4-ease), border-color var(--v4-d-fast) var(--v4-ease), box-shadow var(--v4-d-fast) var(--v4-ease);
}
.consent input[type="checkbox"]::after {
  content: ""; width: 11px; height: 6px; margin-top: -2px; border: 2px solid var(--v4-accent-ink); border-top: 0; border-right: 0;
  transform: rotate(-45deg) scale(0); transition: transform var(--v4-d-fast) var(--v4-ease);
}
.consent input[type="checkbox"]:hover { border-color: var(--v4-accent-line); }
.consent input[type="checkbox"]:checked { background: var(--v4-accent); border-color: var(--v4-accent); }
.consent input[type="checkbox"]:checked::after { transform: rotate(-45deg) scale(1); }
.consent input[type="checkbox"]:focus-visible { outline: none; box-shadow: var(--v4-focus); }
/* error: the page shows #auth-error (register without consent) or focuses #pay-agree (buy without consent) */
.modal:has(#auth-error:not(.hidden)) .consent:has(#auth-agree:not(:checked)),
.consent:has(#pay-agree:focus:not(:checked)) {
  border-color: color-mix(in srgb, var(--v4-danger) 55%, transparent); background: color-mix(in srgb, var(--v4-danger) 8%, transparent);
  color: var(--v4-ink-2); animation: v4-consent-nudge 360ms var(--v4-ease) 1;
}
.modal:has(#auth-error:not(.hidden)) .consent #auth-agree:not(:checked),
.consent #pay-agree:focus:not(:checked) { border-color: var(--v4-danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--v4-danger) 22%, transparent); }
.modal .error:not(.hidden) { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--v4-danger); background: rgba(255, 92, 92, .08); border: 1px solid color-mix(in srgb, var(--v4-danger) 40%, transparent); background: color-mix(in srgb, var(--v4-danger) 8%, transparent); line-height: 1.6; }
.modal .error:not(.hidden)::before { content: "!"; flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--v4-danger); color: var(--v4-canvas); font-size: 12px; font-weight: 800; }
@keyframes v4-consent-nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 60% { transform: translateX(3px); } }
/* pricing: the standing purchase consent sits under the plans as a quiet panel */
label.consent:has(#pay-agree) { padding: 14px 16px 14px 46px; border-color: var(--v4-hairline); background: color-mix(in srgb, var(--v4-surface-1) 70%, transparent); }
label.consent:has(#pay-agree) input { left: 15px; top: 15px; }
label.consent:has(#pay-agree:checked) { border-color: var(--v4-accent-line); }
#pay-modal .consent { text-align: center; margin-top: 14px; font-size: var(--v4-fs-12); }
/* :has() fallback — Safari < 15.4 and older WeChat / Android WebViews drop every rule above that uses :has().
   v4-consent.js mirrors the same states as classes; kept as separate rules because one unsupported selector
   invalidates a whole selector list. In modern browsers both sets apply with identical values. */
.consent.consent--box { padding: 9px 12px 9px 42px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; transition: border-color var(--v4-d-fast) var(--v4-ease), background var(--v4-d-fast) var(--v4-ease); }
.consent.consent--box:hover { background: var(--v4-tint-hover, rgba(255, 255, 255, .04)); }
label.consent.consent--pay { padding: 14px 16px 14px 46px; border-color: var(--v4-hairline); background: rgba(127, 127, 127, .06); background: color-mix(in srgb, var(--v4-surface-1) 70%, transparent); }
label.consent.consent--pay input { left: 15px; top: 15px; }
label.consent.consent--pay.consent--checked { border-color: var(--v4-accent-line); }
.consent.consent--box.consent--invalid {
  border-color: var(--v4-danger); border-color: color-mix(in srgb, var(--v4-danger) 55%, transparent);
  background: rgba(255, 92, 92, .08); background: color-mix(in srgb, var(--v4-danger) 8%, transparent);
  color: var(--v4-ink-2); animation: v4-consent-nudge 360ms var(--v4-ease) 1;
}
.consent.consent--invalid input[type="checkbox"]:not(:checked) { border-color: var(--v4-danger); box-shadow: 0 0 0 3px rgba(255, 92, 92, .22); box-shadow: 0 0 0 3px color-mix(in srgb, var(--v4-danger) 22%, transparent); }
@media (prefers-reduced-motion: reduce) {
  .consent, .consent input[type="checkbox"], .consent input[type="checkbox"]::after, .legal-links a { transition: none !important; animation: none !important; }
}

/* ── 2026-11-05 UI 升级：动效层次 / 降噪 / 无障碍（presentation only） ── */
.label:lang(zh), html[lang^="zh"] .label { letter-spacing: .06em; }
.input-more { padding: 0 12px 10px; }
.input-more > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; font-size: 13px; color: var(--v4-ink-muted); padding: 6px 10px; border-radius: 999px; border: 1px solid transparent; transition: background var(--v4-d-base) var(--v4-ease), color var(--v4-d-base) var(--v4-ease); }
.input-more > summary::-webkit-details-marker { display: none; }
.input-more > summary::before { content: "+"; font-weight: 700; transition: transform var(--v4-d-base) var(--v4-ease); }
.input-more[open] > summary::before { transform: rotate(45deg); }
.input-more > summary:hover, .input-more > summary:focus-visible { background: var(--awkn-surface-2, rgba(255,255,255,.04)); color: var(--v4-ink, inherit); }
.input-more > .input-tools { padding: 8px 0 2px !important; }
.score-ring { animation: v4-pulse-glow 4s ease-in-out infinite; }
@keyframes v4-pulse-glow { 0%,100% { box-shadow: 0 0 40px -12px rgba(78,225,160,.45); } 50% { box-shadow: 0 0 56px -6px rgba(78,225,160,.75); } }
.card, .metric, .plans > *, .grid > article { transition: box-shadow var(--v4-d-base) var(--v4-ease), border-color var(--v4-d-base) var(--v4-ease), transform var(--v4-d-base) var(--v4-ease); }
.card:hover, .metric:hover, .grid > article:hover { box-shadow: 0 0 0 1px rgba(78,225,160,.12) inset, var(--v4-e1, 0 0 0 transparent); }
.consent.consent-inline { display: block; padding: 0; border: 0; background: none; box-shadow: none; font-size: 12px; line-height: 1.5; color: var(--v4-ink-muted); margin: 14px 0 10px; text-align: left; }
.consent.consent-inline input { display: inline-block; vertical-align: -3px; margin: 0 6px 0 0; width: 15px; height: 15px; }
.consent.consent-inline a { display: inline; }
.consent-inline[data-invalid] { color: var(--awkn-danger, #f87171); }
body.pay-consent-inline .pay-agree-global { display: none; }
.kg-galaxy { position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100vw; height: 100vh; z-index: -2; pointer-events: none; opacity: .42; transition: opacity .8s ease; }
.kg-galaxy[hidden] { display: none; }
html[data-theme="light"] .kg-galaxy { opacity: .28; }
html[data-theme="light"] .filters { border-bottom-color: rgba(19,32,46,.08); box-shadow: 0 4px 16px -6px rgba(19,32,46,.18); }
html.gsap-motion #result:not(.hidden) .rv { animation: none; }
.spiral::before { transform-origin: left center; transform: scaleX(var(--draw, 1)); }
@media (prefers-reduced-motion: reduce) { .score-ring { animation: none; } .kg-galaxy { display: none; } }
