/* Hakari site. Palette, type and shapes come from the app's design handoff (docs/design/ui-preview.html):
   indigo ai-iro accent, slightly indigo neutrals, Windows 11 radii. Light by default, dark from the system. */

:root {
  --ground: #f2f3f7;
  --surface: #ffffff;
  --surface-raised: #f8f9fc;
  --line: #e0e3eb;
  --line-strong: #c9cedb;
  --ink: #1a1e29;
  --ink-muted: #4a5164;
  --ink-faint: #656c80;
  --accent: #2f4c8c;
  --accent-strong: #233a6e;
  --accent-soft: #e5ebf7;
  --on-accent: #ffffff;
  --ok: #1d7a4c;
  --warn: #a96500;
  --warn-bright: #f0a43a;
  --critical: #c0322b;
  --chart-1: #2f4c8c;
  --chart-2: #6f8fd0;
  --chart-3: #b9c8ea;
  --chart-4: #8a6fb8;
  --chart-5: #3e9a8f;
  --shadow-flyout: 0 8px 32px rgba(20, 26, 44, .18), 0 2px 6px rgba(20, 26, 44, .08);
  --shadow-card: 0 1px 2px rgba(20, 26, 44, .06);
  --header-bg: rgba(242, 243, 247, .78);

  /* The mocks are always the dark app on a dark desktop, like the screenshots. */
  --mock-ground: #0f1116;
  --mock-surface: #171a22;
  --mock-raised: #1d212b;
  --mock-line: #2a2f3b;
  --mock-ink: #e8ebf2;
  --mock-muted: #a9b0c1;
  --mock-faint: #8a91a5;
  --mock-accent: #93acea;
  --mock-warn: #f0a43a;
  --mock-critical: #ff6d63;
  --mock-ok: #4cc38a;
  --taskbar-bg: rgba(29, 32, 39, .92);
  --wallpaper-a: #3b5592;
  --wallpaper-b: #121a2c;

  --font-ui: "Segoe UI Variable Text", "Segoe UI", "Leelawadee UI", "Noto Sans Thai", system-ui, -apple-system, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", "Leelawadee UI", "Noto Sans Thai", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;

  --radius-control: 4px;
  --radius-overlay: 8px;
  --radius-card: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 88px;
  --gutter: 16px;

  /* Motion tokens: one small scale for the whole page. */
  --duration-instant: 80ms;
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 320ms;
  --duration-emphasis: 480ms;
  --duration-draw: 900ms;
  --ease-decelerate: cubic-bezier(0, 0, 0, 1);
  --ease-accelerate: cubic-bezier(.3, 0, 1, 1);
  --ease-standard: cubic-bezier(.2, 0, 0, 1);
  --ease-out-quint: cubic-bezier(.22, 1, .36, 1);
  --stagger: 40ms;
  --bar-stagger: 14ms;
  --move: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0f1116;
    --surface: #171a22;
    --surface-raised: #1d212b;
    --line: #2a2f3b;
    --line-strong: #3a4050;
    --ink: #e8ebf2;
    --ink-muted: #a9b0c1;
    --ink-faint: #8a91a5;
    --accent: #93acea;
    --accent-strong: #b4c6f1;
    --accent-soft: #1f2a45;
    --on-accent: #0f1626;
    --ok: #4cc38a;
    --warn: #f0a43a;
    --critical: #ff6d63;
    --chart-1: #93acea;
    --chart-2: #5f7fc6;
    --chart-3: #39507f;
    --chart-4: #b49be0;
    --chart-5: #5cc0b3;
    --shadow-flyout: 0 8px 32px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .3);
    --header-bg: rgba(15, 17, 22, .78);
    color-scheme: dark;
  }
}

@media (min-width: 720px) {
  :root { --gutter: 32px; }
}

/* Reduced motion: movement becomes a short fade; feedback stays. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --move: 0px;
    --stagger: 0ms;
    --bar-stagger: 0ms;
    --duration-slow: 150ms;
    --duration-emphasis: 150ms;
    --duration-draw: 150ms;
  }
  html { scroll-behavior: auto !important; }
}

/* Bilingual: show only the language chosen on <html data-lang>. */
:root[data-lang="en"] body [lang="th"],
:root[data-lang="th"] body [lang="en"] { display: none !important; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.6 var(--font-ui);
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
:root[data-lang="th"] body { line-height: 1.75; }
.nw { white-space: nowrap; }
em { font-style: normal; font-weight: 600; color: var(--ink); }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; line-height: 1.2; }
p { margin: 0; text-wrap: pretty; }
code { font-family: var(--font-mono); font-size: .9em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.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;
}
.skip {
  position: absolute; left: var(--space-3); top: var(--space-3); z-index: 50;
  background: var(--accent); color: var(--on-accent); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-control); transform: translateY(-80px);
  transition: transform var(--duration-fast) var(--ease-decelerate);
}
.skip:focus { transform: none; }

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 var(--gutter); }
.center { text-align: center; }
.fine { font-size: 14px; color: var(--ink-faint); }
.fine.center { margin-top: var(--space-4); }
.i { width: 16px; height: 16px; fill: currentColor; flex: none; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: center; gap: var(--space-4); height: 60px; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--ink); text-decoration: none; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.brand-kanji { color: var(--ink-faint); font-size: 15px; }
.top-nav { display: flex; gap: var(--space-1); margin-left: auto; }
.top-nav a {
  color: var(--ink-muted); text-decoration: none; padding: 6px 10px; border-radius: var(--radius-control);
  font-size: 15px; transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.top-nav a:hover { background: var(--accent-soft); color: var(--ink); }
.lang-switch {
  position: relative; isolation: isolate;
  display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--surface);
}
/* The pressed pill slides between the choices; lang.js sets where it sits. */
.lang-switch::before {
  content: ""; position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 0;
  width: var(--pill-w, 0); transform: translateX(var(--pill-x, 0));
  border-radius: 999px; background: var(--accent); opacity: 0;
}
.lang-switch.pill-on::before { opacity: 1; }
.lang-switch.pill-ready::before {
  transition: transform var(--duration-slow, 360ms) cubic-bezier(.3, 1.3, .5, 1),
    width var(--duration-slow, 360ms) cubic-bezier(.3, 1.3, .5, 1);
}
.lang-switch.pill-on button[aria-pressed="true"] { background: transparent; }
.top .lang-switch { view-transition-name: lang-switch-top; }
.foot .lang-switch { view-transition-name: lang-switch-foot; }

/* Switching language: the old words fade and blur away, the new ones rise in. */
::view-transition-old(root) { animation: lang-out 180ms cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: lang-in 380ms cubic-bezier(.2, .8, .2, 1) 60ms both; }
::view-transition-old(lang-switch-top), ::view-transition-old(lang-switch-foot) { display: none; }
::view-transition-new(lang-switch-top), ::view-transition-new(lang-switch-foot) { animation: none; }
::view-transition-group(lang-switch-top), ::view-transition-group(lang-switch-foot) { animation: none; }
@keyframes lang-out { to { opacity: 0; filter: blur(4px); transform: translateY(-4px); } }
@keyframes lang-in { from { opacity: 0; filter: blur(4px); transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .lang-switch.pill-ready::before { transition: none; }
}
.lang-switch button {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-muted); background: transparent;
  border: 0; border-radius: 999px; padding: 4px 11px; min-height: 30px; cursor: pointer;
  transition: background-color var(--duration-normal) var(--ease-standard), color var(--duration-normal) var(--ease-standard), transform var(--duration-instant) var(--ease-standard);
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button:active { transform: scale(.95); }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
@media (max-width: 640px) {
  .top-nav { display: none; }
  .top .lang-switch { margin-left: auto; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 10px 18px; border-radius: 6px;
  font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-card);
  transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-instant) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-quiet { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-muted); }
.btn-quiet:hover { color: var(--ink); border-color: var(--line-strong); }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.store-icon { width: 22px; height: 22px; flex: none; margin-left: -4px; }
@media (prefers-reduced-motion: reduce) {
  .btn:hover, .btn:active, .lang-switch button:active { transform: none; }
}

/* Scroll reveal: only hidden once JS is known to be running. */
.js .reveal {
  opacity: 0; transform: translateY(var(--move));
  transition: opacity var(--duration-emphasis) var(--ease-decelerate), transform var(--duration-emphasis) var(--ease-out-quint);
  transition-delay: calc(var(--i, 0) * var(--stagger));
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* Hero */
.hero {
  position: relative; padding: var(--space-7) 0 var(--space-8);
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--ground);
}
.hero-copy { text-align: center; max-width: 860px; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 14px; letter-spacing: .02em; }
.hero h1 { font-size: clamp(34px, 6vw, 60px); font-weight: 700; letter-spacing: -.02em; margin: var(--space-3) 0 var(--space-4); }
:root[data-lang="th"] .hero h1 { letter-spacing: 0; line-height: 1.3; }
.lede { font-size: clamp(17px, 2.2vw, 20px); color: var(--ink-muted); max-width: 680px; margin: 0 auto; }
.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin: var(--space-5) 0 var(--space-3); }
.hero .fine { margin-bottom: var(--space-7); }

/* Desktop and taskbar mock */
.desk { margin: 0; }
.desk-screen {
  position: relative; overflow: hidden; border-radius: 14px; height: clamp(200px, 24vw, 280px);
  background:
    radial-gradient(70% 90% at 25% 15%, var(--wallpaper-a), transparent 70%),
    radial-gradient(60% 80% at 85% 30%, #2b3d6e, transparent 70%),
    linear-gradient(180deg, #1f2b4a, var(--wallpaper-b));
  box-shadow: 0 24px 60px rgba(20, 26, 44, .28), 0 0 0 1px rgba(255, 255, 255, .06) inset;
}
.desk-glow {
  position: absolute; inset: auto 6% 40px auto; width: 360px; height: 200px;
  background: radial-gradient(closest-side, rgba(147, 172, 234, .35), transparent);
  pointer-events: none;
}
.taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: var(--taskbar-bg); border-top: 1px solid rgba(255, 255, 255, .06);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  color: #f1f2f5;
  zoom: 1.5;
}
@media (max-width: 760px) { .taskbar { zoom: 1.25; } }
@media (max-width: 400px) { .taskbar { zoom: 1.15; } }
.tb-apps { display: flex; gap: 10px; flex: 1; justify-content: center; min-width: 0; }
.tb-apps i { width: 26px; height: 26px; border-radius: 6px; background: var(--c); opacity: .92; }
.tb-right { display: flex; align-items: center; gap: 14px; padding-right: 12px; flex: none; margin-left: auto; }
.widget { display: flex; align-items: center; gap: 9px; padding: 4px 8px; border-radius: 6px; }
.ring { width: 26px; height: 26px; transform: rotate(-90deg); flex: none; }
.ring circle { fill: none; stroke-width: 3; }
.ring-track { stroke: rgba(255, 255, 255, .16); }
.ring-fill {
  stroke: var(--ring-color, var(--mock-accent)); stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p, 0));
  transition: stroke-dashoffset 700ms var(--ease-out-quint), stroke var(--duration-slow) var(--ease-standard);
}
.w-text { display: grid; line-height: 1.2; min-width: 118px; }
.w-text b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.w-text small { font-size: 11.5px; color: #c3c7d2; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.w-reset { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; display: inline-block; }
.tray { display: flex; align-items: center; gap: 12px; }
.tray svg { width: 16px; height: 16px; fill: none; stroke: #e8eaf0; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.tray-lang { font-size: 11px; }
.clock { display: grid; text-align: right; font-size: 11.5px; line-height: 1.35; }
.turns {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-4);
  font-size: 14px; color: var(--ink-faint);
}
.turn {
  padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-muted);
  transition: background-color var(--duration-slow) var(--ease-standard), color var(--duration-slow) var(--ease-standard), border-color var(--duration-slow) var(--ease-standard);
}
.turn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
@media (max-width: 760px) {
  .tb-apps { display: none; }
  .tray svg:nth-of-type(n+2), .tray-lang { display: none; }
  .tb-right { gap: 10px; padding-right: 8px; }
}
@media (max-width: 400px) {
  .tray { display: none; }
}

/* Bands */
.band { padding: var(--space-8) 0; }
.band-alt { background: var(--surface-raised); border-block: 1px solid var(--line); }
.band h2 { font-size: clamp(28px, 4vw, 40px); font-weight: 700; letter-spacing: -.01em; margin-bottom: var(--space-4); }
:root[data-lang="th"] .band h2 { letter-spacing: 0; line-height: 1.35; }
.band p { color: var(--ink-muted); }
.section-head { max-width: 720px; margin: 0 auto var(--space-6); text-align: center; }
.split { display: grid; gap: var(--space-7); align-items: center; }
@media (min-width: 920px) {
  .split { grid-template-columns: 1fr 1fr; }
  .split-rev .split-copy { order: 2; }
}
.split-copy p { font-size: 17px; }
.ticks { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: grid; gap: var(--space-3); }
.ticks li { position: relative; padding-left: 28px; color: var(--ink-muted); }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: .45em; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 5px var(--accent-soft), inset 0 0 0 16px var(--accent);
}
.ticks code, .privacy code, .faq code, .install code { background: var(--accent-soft); color: var(--ink); padding: 1px 5px; border-radius: 4px; }

/* Flyout mock */
.flyout-stage {
  margin: 0; display: grid; justify-items: center; gap: var(--space-3);
  padding: var(--space-6) var(--space-4) 0; border-radius: 16px; overflow: hidden;
  background:
    radial-gradient(80% 70% at 70% 20%, var(--wallpaper-a), transparent 70%),
    linear-gradient(180deg, #1f2b4a, var(--wallpaper-b));
}
.flyout {
  width: min(360px, 100%); background: rgba(23, 26, 34, .96); color: var(--mock-ink);
  border: 1px solid rgba(255, 255, 255, .08); border-radius: var(--radius-overlay); padding: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
  font-size: 13px; line-height: 1.4; display: grid; gap: 10px;
  transform-origin: 85% 100%;
}
.js .flyout { opacity: 0; transform: translateY(14px) scale(.96); }
.js .flyout-stage.is-open .flyout {
  opacity: 1; transform: none;
  transition: opacity var(--duration-normal) var(--ease-decelerate), transform var(--duration-slow) var(--ease-out-quint);
}
.js .fo-item { opacity: 0; transform: translateY(calc(var(--move) / 2)); }
.js .flyout-stage.is-open .fo-item {
  opacity: 1; transform: none;
  transition: opacity var(--duration-slow) var(--ease-decelerate), transform var(--duration-slow) var(--ease-out-quint);
  transition-delay: calc(120ms + var(--i, 0) * var(--stagger));
}
.fo-head { display: flex; align-items: center; gap: 10px; }
.fo-head div { display: grid; }
.fo-head b { font-size: 15px; }
.flyout small { color: var(--mock-muted); font-size: 12px; }
.fo-card { background: var(--mock-raised); border: 1px solid var(--mock-line); border-radius: 6px; padding: 10px 12px; display: grid; gap: 8px; }
.fo-collapsed { gap: 2px; }
.fo-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fo-row b { font-weight: 600; }
.fo-warn { color: var(--mock-warn); font-weight: 600; font-size: 12px; }
.limit { display: grid; gap: 4px; }
.limit .fo-row b { font-size: 15px; }
.bar { position: relative; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .1); }
.bar i {
  position: absolute; inset: 0 auto 0 0; width: 100%; border-radius: 3px; background: var(--mock-accent);
  transform-origin: left; transform: scaleX(var(--v));
}
.bar-warn i { background: var(--mock-warn); }
.bar em { position: absolute; top: -3px; bottom: -3px; width: 2px; left: calc(var(--at) * 100%); background: #c8ccd6; border-radius: 1px; }
.js .bar i { transform: scaleX(0); }
.js .flyout-stage.is-open .bar i {
  transform: scaleX(var(--v));
  transition: transform var(--duration-draw) var(--ease-out-quint) 380ms;
}
.fo-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fo-tile { background: var(--mock-raised); border: 1px solid var(--mock-line); border-radius: 6px; padding: 8px 10px; display: grid; }
.fo-tile b { font-size: 16px; font-weight: 600; }
.fo-burn { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fo-burn b { font-size: 15px; }
.spark { width: 90px; height: 26px; fill: none; stroke: var(--mock-accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; overflow: visible; }
.spark path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.js .spark path { stroke-dashoffset: 1; }
.js .flyout-stage.is-open .spark path { stroke-dashoffset: 0; transition: stroke-dashoffset var(--duration-draw) var(--ease-standard) 520ms; }
.fo-sources { display: grid; gap: 4px; }
.fo-sources span { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mock-ok); display: inline-block; }
.mini-taskbar {
  width: calc(100% + 2 * var(--space-4)); height: 44px; margin-top: var(--space-2);
  background: var(--taskbar-bg); display: flex; justify-content: flex-end; align-items: center; padding: 0 24px;
  color: #f1f2f5;
}
.mini-widget {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px;
  background: rgba(255, 255, 255, .08); font-size: 13px;
}
.mini-widget .ring { width: 22px; height: 22px; }

/* Dashboard mock */
.dash { margin: 0; }
.win {
  background: var(--mock-ground); color: var(--mock-ink); border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .06); box-shadow: 0 24px 60px rgba(20, 26, 44, .25);
  font-size: 13px;
}
.win-bar { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--mock-surface); border-bottom: 1px solid var(--mock-line); }
.win-dots { margin-left: auto; display: flex; gap: 14px; }
.win-dots i { width: 10px; height: 1.5px; background: var(--mock-muted); }
.win-body { display: grid; grid-template-columns: 170px 1fr; }
.win-nav { background: var(--mock-surface); padding: 12px 8px; display: grid; align-content: start; gap: 2px; border-right: 1px solid var(--mock-line); }
.win-nav > span { padding: 7px 10px; border-radius: 4px; color: var(--mock-muted); }
.win-nav > span.on { background: rgba(255, 255, 255, .06); color: var(--mock-ink); box-shadow: inset 3px 0 0 var(--mock-accent); }
.win-main { padding: 16px; display: grid; gap: 12px; min-width: 0; }
.stats { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 10px; }
.stat { background: var(--mock-surface); border: 1px solid var(--mock-line); border-radius: 6px; padding: 10px 12px; display: grid; gap: 4px; align-content: start; }
.stat small, .panel small { color: var(--mock-muted); font-size: 12px; }
.stat b { font-size: 20px; font-weight: 600; }
.stack { display: flex; gap: 2px; height: 8px; margin-top: 8px; }
.stack i { flex: var(--w) 1 0; background: var(--c); border-radius: 2px; transform-origin: left; }
.js .stack i { transform: scaleX(0); }
.js .dash.is-in .stack i { transform: none; transition: transform var(--duration-emphasis) var(--ease-out-quint); transition-delay: calc(200ms + var(--n, 0) * 60ms); }
.panels { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; }
.panel { background: var(--mock-surface); border: 1px solid var(--mock-line); border-radius: 6px; padding: 12px 14px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel-head b { font-weight: 600; }
.chart { position: relative; height: 170px; display: flex; align-items: flex-end; gap: 3px; padding: 0 2px; border-bottom: 1px solid var(--mock-line);
  background: repeating-linear-gradient(to top, transparent 0 41px, var(--mock-line) 41px 42px); }
.chart i { flex: 1; height: calc(var(--h) * 1%); background: #6f8fd0; border-radius: 2px 2px 0 0; transform-origin: bottom; }
.chart i:last-child { background: var(--mock-accent); }
.js .chart i { transform: scaleY(0); }
.js .dash.is-in .chart i {
  transform: none; transition: transform var(--duration-emphasis) var(--ease-out-quint);
  transition-delay: calc(250ms + var(--n) * var(--bar-stagger));
}
.rank { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; }
.rank li { display: grid; grid-template-columns: 88px 1fr auto; align-items: center; gap: 8px; }
.rank code { font-size: 12px; color: var(--mock-ink); overflow: hidden; text-overflow: ellipsis; }
.rank i { height: 4px; border-radius: 2px; background: #6f8fd0; transform-origin: left; transform: scaleX(var(--v)); }
.js .rank i { transform: scaleX(0); }
.js .dash.is-in .rank i { transform: scaleX(var(--v)); transition: transform var(--duration-emphasis) var(--ease-out-quint) 600ms; }
.rank span { color: var(--mock-muted); font-size: 12px; }
@media (max-width: 860px) {
  .win-nav { display: none; }
  .win-body { grid-template-columns: 1fr; }
  .panels { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-wide { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .win-main { padding: 10px; }
  .chart { height: 130px; gap: 2px; background: repeating-linear-gradient(to top, transparent 0 31px, var(--mock-line) 31px 32px); }
  .stat b { font-size: 17px; }
}

.chips { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.chips li { padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--ink-muted); }

.shot { margin: var(--space-5) auto 0; max-width: 980px; text-align: center; }
.shot summary { display: inline-flex; cursor: pointer; color: var(--accent); font-weight: 600; padding: 6px 10px; border-radius: 6px; list-style: none; }
.shot summary::-webkit-details-marker { display: none; }
.shot summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); margin: 6px 0 0 10px; transition: transform var(--duration-normal) var(--ease-standard); }
.shot[open] summary::after { transform: rotate(225deg); margin-top: 10px; }
.shot img { width: 100%; height: auto; margin-top: var(--space-3); border-radius: 10px; border: 1px solid var(--line); animation: fade-rise var(--duration-slow) var(--ease-decelerate); }

/* Terminal mock */
.term-stage { margin: 0; display: grid; gap: var(--space-3); justify-items: end; }
.term {
  width: 100%; background: #0c0e13; color: #d8dce6; border-radius: 10px; overflow: hidden;
  border: 1px solid #262b36; box-shadow: 0 24px 60px rgba(20, 26, 44, .25);
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6;
}
.term-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: #161922; color: #9aa1b2; font-family: var(--font-ui); font-size: 12.5px; }
.term-dots { display: flex; gap: 6px; }
.term-dots i { width: 10px; height: 10px; border-radius: 50%; background: #3a4050; }
.term-body { padding: 14px 16px 18px; display: grid; gap: 6px; min-height: 300px; align-content: start; }
.term-body p { color: inherit; overflow-wrap: anywhere; }
.t-dim { color: #8a91a5; }
.t-user { color: #ffffff; }
.t-hook { margin-top: 6px; }
.t-tag { display: inline-block; padding: 0 6px; border-radius: 3px; background: #1f2a45; color: #b4c6f1; font-size: 12px; }
.t-note { color: #e8ebf2; border-left: 2px solid #93acea; padding-left: 10px; }
.caret { display: inline-block; width: .55em; height: 1.1em; vertical-align: -.2em; background: #93acea; margin-left: 2px; animation: blink 1s steps(1) infinite; }
.term-stage:not(.is-typing) .caret { animation-play-state: paused; }
@keyframes blink { 50% { opacity: 0; } }
.term-replay[hidden] { display: none; }

/* Sounds */
.sounds { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); max-width: 900px; margin: 0 auto; }
.sound { flex: 0 1 160px; }
@media (max-width: 420px) { .sound { flex-basis: calc(50% - var(--space-3) / 2); } }
.sound {
  position: relative; overflow: hidden; display: grid; gap: 2px; justify-items: start; text-align: left;
  min-height: 96px; padding: 12px 14px; border-radius: var(--radius-card); cursor: pointer;
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  transition: border-color var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard);
}
.sound:hover { border-color: var(--accent); transform: translateY(-2px); }
.sound:active { transform: scale(.97); }
.sound b { font-size: 15px; font-weight: 600; }
.sound small { color: var(--ink-faint); font-size: 13px; }
:root[data-lang="en"] .sound small { display: none; }
.s-notes { width: 100%; height: 28px; margin-bottom: 4px; }
.s-notes svg { width: 100%; height: 100%; overflow: visible; }
.s-notes .n { fill: var(--accent); }
.s-notes .tail { stroke: var(--accent); stroke-opacity: .35; stroke-width: 2; stroke-linecap: round; }
.sound.is-playing { border-color: var(--accent); background: var(--accent-soft); }
.sound .play-line {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--accent);
  transform-origin: left; transform: scaleX(0); pointer-events: none;
}
.sound.is-playing .n { animation: note-pop var(--duration-slow) var(--ease-out-quint) both; animation-delay: var(--d, 0ms); transform-box: fill-box; transform-origin: center; }
@keyframes note-pop { 0% { transform: scale(1); } 40% { transform: scale(1.6); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .sound:hover, .sound:active { transform: none; }
  .sound.is-playing .n { animation: none; }
}
.volume { display: flex; align-items: center; justify-content: center; gap: var(--space-3); margin-top: var(--space-5); color: var(--ink-muted); font-size: 15px; }
.volume input { width: min(260px, 50vw); accent-color: var(--accent); min-height: 32px; }
.volume output { min-width: 3ch; font-weight: 600; color: var(--ink); }

/* Feature cards */
.cards { display: grid; grid-template-columns: 1fr; gap: var(--space-4); max-width: 980px; margin: 0 auto; }
@media (min-width: 760px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr; column-gap: var(--space-4); align-items: start; }
.card .card-i { grid-row: span 2; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition: border-color var(--duration-normal) var(--ease-standard), box-shadow var(--duration-normal) var(--ease-standard);
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-flyout); }
.card h3 { font-size: 18px; font-weight: 600; margin: 4px 0 var(--space-2); }
.card p { font-size: 15px; }
.card-i { width: 36px; height: 36px; padding: 7px; border-radius: 9px; background: var(--accent-soft); fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.card-i .fill { fill: var(--accent); stroke: none; }

/* Privacy */
.privacy { list-style: none; padding: 0; margin: 0 auto var(--space-5); max-width: 900px; display: grid; gap: var(--space-3); }
@media (min-width: 760px) { .privacy { grid-template-columns: 1fr 1fr; } }
.privacy li { display: flex; gap: var(--space-3); align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: var(--space-4); }
.privacy p { font-size: 15px; }
.link-arrow { font-weight: 600; }
.link-arrow::after { content: ""; display: inline-block; margin-left: 8px; vertical-align: .1em; width: 7px; height: 7px; border: solid currentColor; border-width: 2px 2px 0 0; transform: rotate(45deg); transition: transform var(--duration-fast) var(--ease-standard); }
.link-arrow:hover::after { transform: translateX(3px) rotate(45deg); }

/* Install */
.installs { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.install { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: var(--space-5); display: grid; gap: var(--space-3); align-content: start; }
.install h3 { font-size: 20px; font-weight: 600; }
.install p { font-size: 15px; }
.install .btn { justify-self: start; }
.cmd { display: flex; align-items: center; gap: var(--space-2); background: var(--ground); border: 1px solid var(--line); border-radius: 6px; padding: 6px 6px 6px 12px; min-width: 0; }
.cmd { flex-wrap: wrap; }
@media (min-width: 1000px) { .installs { grid-template-columns: 1fr 1.25fr 1fr; } }
.cmd code { flex: 1 1 236px; min-width: 0; overflow-x: auto; white-space: nowrap; background: none; padding: 0; font-size: 14px; }
.cmd .btn { flex: none; }
[data-copy-done]:not([hidden]) { animation: fade-rise var(--duration-normal) var(--ease-decelerate); }

.faq { max-width: 760px; margin: var(--space-7) auto 0; display: grid; gap: var(--space-2); }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.faq summary {
  cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: var(--space-3); align-items: center;
  border-radius: 10px; transition: background-color var(--duration-fast) var(--ease-standard);
}
.faq summary:hover { background: var(--surface-raised); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 8px; height: 8px; border: solid var(--ink-faint); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform var(--duration-normal) var(--ease-standard); }
.faq details[open] summary::after { transform: rotate(225deg); }
.faq-body { padding: 0 18px 16px; }
.faq details[open] .faq-body { animation: fade-rise var(--duration-slow) var(--ease-decelerate); }
.faq-body p { font-size: 15px; }
@keyframes fade-rise { from { opacity: 0; transform: translateY(calc(var(--move) / -2)); } to { opacity: 1; transform: none; } }

/* Footer */
.foot { padding: var(--space-7) 0 var(--space-6); border-top: 1px solid var(--line); background: var(--surface); }
.foot-grid { display: grid; gap: var(--space-5); align-items: start; }
@media (min-width: 820px) { .foot-grid { grid-template-columns: 1.4fr 1fr auto; } }
.foot .fine { margin-top: var(--space-2); max-width: 420px; }
.foot .lang-switch { justify-self: start; }
.foot-links { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.foot-links a { color: var(--ink-muted); text-decoration: none; }
.foot-links a:hover { color: var(--accent); text-decoration: underline; }
.trademark { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-faint); }

/* 404 */
.doc { padding: var(--space-8) var(--gutter); text-align: center; display: grid; gap: var(--space-4); justify-items: center; }
.doc h1 { font-size: clamp(30px, 5vw, 44px); }
.doc p { color: var(--ink-muted); }

/* Under reduced motion, raw keyframe movement becomes a fade. */
@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ring-fill { transition-duration: var(--duration-slow); }
}
