/* Tokens follow apps/macos/DESIGN.md: dark only, neutral layers, one lime accent. */
:root {
  color-scheme: dark;
  --canvas: #161616;
  --surface: #1d1d1d;
  --raised: #262626;
  --hover: #303030;
  --ink: #ffffff;
  --text-2: rgb(255 255 255 / 0.8);
  --text-3: rgb(255 255 255 / 0.55);
  --border: rgb(255 255 255 / 0.1);
  --border-strong: rgb(255 255 255 / 0.2);
  --accent: #bae859;
  --accent-hover: rgb(186 232 89 / 0.9);
  --on-accent: #000000;
  --r-tag: 4px;
  --r-control: 6px;
  --r-card: 10px;
  --r-window: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --quick: 120ms;
  --standard: 240ms;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --gutter: 32px;
  --max: 1200px;
}

* { box-sizing: border-box; }
html { background: var(--canvas); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-control); }
[hidden] { display: none !important; }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.meta { font-size: 12px; line-height: 16px; color: var(--text-3); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Brand: lime tile with the bolt, light mono wordmark */
.mark { display: inline-flex; align-items: center; gap: 10px; }
.mark-tile { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.mark-tile svg { width: 15px; height: 15px; }
.mark-word { font: 300 20px/1 var(--mono); }

/* Navigation */
.nav { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.nav-links { display: flex; align-items: center; gap: 32px; font-size: 14px; color: var(--text-2); }
.nav-links a:not(.btn) { transition: color var(--quick) ease-out; }
.nav-links a:not(.btn):hover { color: var(--text-3); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--r-control);
  font: 500 15px/1 var(--sans); white-space: nowrap; cursor: pointer;
  transition: background-color var(--quick) ease-out, color var(--quick) ease-out, transform var(--quick) ease-out;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--raised); color: var(--ink); }
.btn-secondary:hover { background: var(--hover); }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-text {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0; border: 0; background: none; cursor: pointer;
  font: 400 14px/1 var(--sans); color: var(--text-2);
  transition: color var(--quick) ease-out;
}
.btn-text:hover { color: var(--text-3); }
.btn-text svg { width: 14px; height: 14px; }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.download .btn-text { height: 44px; padding: 0 8px; }

/* Keycap: the app's tag style */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-radius: var(--r-tag);
  font: 400 12px/1 var(--mono); color: var(--text-2);
  vertical-align: 2px;
  transition: background-color var(--quick) ease-out, color var(--quick) ease-out, border-color var(--quick) ease-out;
}
h3 .kbd { vertical-align: 1px; }
.kbd.down { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* HUD: 76 × 22 capsule on canvas with accent glyphs; it floats, so it keeps a shadow */
.hud {
  --hud: 1;
  position: relative;
  width: calc(76px * var(--hud)); height: calc(22px * var(--hud));
  border-radius: 999px;
  background: var(--canvas);
  color: var(--accent);
  box-shadow: inset 0 0 0 calc(0.5px * var(--hud)) rgb(255 255 255 / 0.12), 0 calc(6px * var(--hud)) calc(16px * var(--hud)) rgb(0 0 0 / 0.4);
  transition: opacity var(--standard) var(--ease), transform var(--standard) var(--ease);
}
.hud svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud[data-phase="hidden"] { opacity: 0; transform: translateY(4px) scale(0.96); }

/* Window chrome */
.window { background: var(--surface); border-radius: var(--r-window); box-shadow: inset 0 0 0 1px var(--border), 0 24px 64px rgb(0 0 0 / 0.45); overflow: hidden; }
.window-bar { height: 40px; display: flex; align-items: center; padding: 0 16px; border-bottom: 1px solid var(--border); }
.lights { display: flex; gap: 8px; }
.lights i { width: 12px; height: 12px; border-radius: 50%; background: #3a3a3a; }
.window-title { flex: 1; margin-right: 52px; text-align: center; font-size: 13px; color: var(--text-3); }

/* Loader */
.loader {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center;
  background: var(--canvas);
  transition: opacity 360ms var(--ease);
  animation: release 1ms 5s forwards;
}
.loader .hud { --hud: 2; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12); }
.loader-caption { position: absolute; top: calc(50% + 40px); left: 0; right: 0; text-align: center; font-size: 12px; line-height: 16px; color: var(--text-3); }
.loader.done, .ready .loader { opacity: 0; pointer-events: none; }
@keyframes release { to { opacity: 0; visibility: hidden; } }

/* One entrance after the loader; a CSS fallback reveals the page if scripts never run */
.enter { opacity: 0; transform: translateY(8px); transition: opacity 480ms var(--ease), transform 480ms var(--ease); animation: release-in 1ms 5s forwards; }
.ready .enter { opacity: 1; transform: none; animation: none; }
.ready .enter:nth-child(2) { transition-delay: 50ms; }
.ready .enter:nth-child(3) { transition-delay: 100ms; }
.ready .stage.enter { transition-delay: 150ms; }
@keyframes release-in { to { opacity: 1; transform: none; } }

/* Hero */
.hero { min-height: calc(100svh - 64px); display: grid; grid-template-columns: 5fr 7fr; gap: 64px; align-items: center; padding: 32px 0 80px; }
.hero h1 { margin-bottom: 20px; font: 600 64px/1.08 var(--sans); letter-spacing: -0.02em; }
.lede { max-width: 30em; margin-bottom: 32px; color: var(--text-2); font-size: 18px; line-height: 30px; }

.stage { position: relative; }
.chat { display: grid; grid-template-rows: 40px 1fr auto auto; height: 400px; }
.thread { padding: 24px; display: flex; flex-direction: column; gap: 20px; overflow: hidden; }
.msg { display: grid; grid-template-columns: 32px 1fr; gap: 12px; }
.avatar { width: 32px; height: 32px; border-radius: var(--r-control); background: var(--raised); display: grid; place-items: center; font-size: 13px; color: var(--text-2); }
.who { font-size: 13px; line-height: 20px; font-weight: 500; }
.who time { margin-left: 8px; font: 400 12px var(--mono); color: var(--text-3); }
.msg p { margin-top: 2px; font-size: 14px; line-height: 22px; color: var(--text-2); }
.composer { min-height: 64px; margin: 0 16px 16px; padding: 12px 14px; border-radius: var(--r-card); background: var(--canvas); box-shadow: inset 0 0 0 1px var(--border-strong); font-size: 14px; line-height: 22px; }
.placeholder { color: var(--text-3); }
.caret { display: inline-block; width: 1.5px; height: 17px; margin-left: 1px; vertical-align: -3px; background: var(--ink); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.landed { animation: land 320ms var(--ease); }
@keyframes land { from { opacity: 0; } }
.stage-hud { --hud: 1.6; justify-self: center; margin-bottom: 12px; }
.status { display: flex; align-items: center; gap: 12px; min-height: 24px; margin-top: 20px; font-size: 13px; color: var(--text-3); }
.said { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text-2); }
.replay { margin-left: auto; font-size: 13px; }

/* Sections */
.section { padding: 112px 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head h2 { margin-bottom: 12px; font: 600 32px/1.25 var(--sans); letter-spacing: -0.01em; }
.section-head p { color: var(--text-2); font-size: 17px; line-height: 28px; }

/* Steps: the HUD in each of its states */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; counter-reset: step; }
.steps li { display: flex; flex-direction: column; }
.step-visual { height: 120px; margin-bottom: 24px; border-radius: var(--r-card); background: var(--surface); display: grid; place-items: center; }
.step-visual .hud { --hud: 2; }
.step-no { margin-bottom: 8px; font: 400 12px/16px var(--mono); color: var(--text-3); }
.steps h3 { margin-bottom: 8px; font: 600 18px/28px var(--sans); }
.steps p { color: var(--text-2); font-size: 15px; line-height: 24px; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 12px 32px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-2); }
.shortcuts .kbd { margin-right: 4px; }

/* Modes: the Flash window, 听写 page */
.app { display: grid; grid-template-columns: 200px 1fr; background: var(--canvas); }
.side { padding: 16px 12px; border-right: 1px solid var(--border); }
.side ul { display: grid; gap: 2px; }
.side li { height: 34px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: var(--r-control); font-size: 13px; color: var(--text-2); }
.side svg { width: 16px; height: 16px; color: var(--text-3); }
.side li.on { background: var(--hover); color: var(--ink); }
.page { min-width: 0; padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.page-top { display: flex; align-items: center; gap: 16px; }
.page-top h3 { flex: 1; font: 600 22px/1.2 var(--sans); }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: var(--r-control); background: var(--surface); font-size: 12px; color: var(--text-2); }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.picker-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.picker-label { font-size: 13px; color: var(--text-2); }
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface); }
.seg button {
  height: 32px; padding: 0 16px; border: 0; border-radius: var(--r-control);
  background: transparent; color: var(--ink); cursor: pointer;
  font: 400 13px/1 var(--sans);
  transition: background-color var(--standard) var(--ease), color var(--standard) var(--ease);
}
.seg button:hover:not([aria-pressed="true"]) { background: var(--raised); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 500; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { min-height: 200px; padding: 20px; border-radius: var(--r-card); background: var(--surface); display: flex; flex-direction: column; }
.card h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font: 500 13px/20px var(--sans); color: var(--text-3); }
.card h4 svg { width: 16px; height: 16px; }
.said-text { color: var(--text-2); font-size: 15px; line-height: 26px; }
.out-text { color: var(--ink); font-size: 15px; line-height: 26px; }
.card-note { margin-top: auto; padding-top: 16px; font-size: 12px; line-height: 16px; color: var(--text-3); }

/* Safety rules */
.split { display: grid; grid-template-columns: 5fr 7fr; gap: 64px; align-items: start; }
.split .section-head { margin-bottom: 0; position: sticky; top: 32px; }
.rules { display: grid; }
.rules li { display: grid; grid-template-columns: 18px 1fr; gap: 16px; padding: 20px 0; border-top: 1px solid var(--border); }
.rules li:last-child { border-bottom: 1px solid var(--border); }
.rules svg { width: 18px; height: 18px; margin-top: 3px; color: var(--text-3); }
.rules h3 { margin-bottom: 4px; font: 500 16px/24px var(--sans); }
.rules p { color: var(--text-2); font-size: 14px; line-height: 22px; }

/* History and dictionary */
.memory { display: grid; grid-template-columns: 7fr 5fr; gap: 16px; }
.panel { padding: 24px; border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.panel-head h3 { font: 600 14px/20px var(--sans); }
.versions { display: grid; gap: 4px; }
.versions div { display: grid; grid-template-columns: 72px 1fr; gap: 16px; padding: 12px 16px; border-radius: var(--r-control); }
.versions .corrected { background: var(--raised); }
.versions dt { font-size: 12px; line-height: 24px; color: var(--text-3); }
.versions dd { font-size: 15px; line-height: 24px; color: var(--text-2); }
.versions .corrected dd { color: var(--ink); }
mark { padding: 0 2px; border-radius: 2px; background: none; color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.panel-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: auto; }
.search { height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: var(--r-control); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.35); font-size: 13px; color: var(--text-3); }
.search svg { width: 16px; height: 16px; }
.words { display: flex; flex-wrap: wrap; gap: 8px; }
.words li { height: 28px; display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r-tag); font-size: 13px; color: var(--text-2); }
.words li.new { border-color: var(--accent); color: var(--ink); }
.dictionary > .meta { margin-top: auto; }

/* Privacy ledger */
.ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ledger-col { padding: 24px; border-radius: 14px; background: var(--surface); }
.ledger-col h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font: 600 16px/24px var(--sans); }
.ledger-col h3 svg { width: 18px; height: 18px; color: var(--text-3); }
.ledger-col li { padding: 14px 0; border-top: 1px solid var(--border); color: var(--text-2); font-size: 15px; line-height: 24px; }
.ledger-col li:first-child { border-top: 0; }

/* Download */
.download-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.download-hud { --hud: 2.5; margin-bottom: 40px; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12); }
.download h2 { margin-bottom: 12px; font: 600 40px/1.2 var(--sans); letter-spacing: -0.02em; }
.download p { max-width: 34em; margin-bottom: 32px; color: var(--text-2); font-size: 17px; line-height: 28px; }

/* Footer */
.footer { display: flex; align-items: center; gap: 16px; padding: 32px 0 48px; border-top: 1px solid var(--border); }
.footer .mark-tile { width: 22px; height: 22px; border-radius: 5px; }
.footer .mark-tile svg { width: 12px; height: 12px; }
.footer .mark-word { font-size: 16px; }
.footer .btn-text { margin-left: auto; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 48px; min-height: 0; padding: 48px 0 80px; }
  .hero h1 { font-size: 44px; }
  .split, .memory, .ledger { grid-template-columns: 1fr; }
  .split { gap: 32px; }
  .split .section-head { position: static; }
  .steps { grid-template-columns: 1fr; gap: 40px; }
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .nav-links a:not(.btn) { display: none; }
  .hero { padding-top: 32px; }
  .hero h1 { font-size: 40px; }
  .lede { font-size: 17px; line-height: 28px; }
  .chat { height: 320px; }
  .msg:first-child { display: none; }
  .stage-hud { --hud: 1.4; }
  .section { padding: 80px 0; }
  .section-head h2 { font-size: 26px; }
  .section-head p { font-size: 16px; line-height: 26px; }
  .page { padding: 20px 16px; }
  .cards { grid-template-columns: 1fr; }
  .card { min-height: 0; }
  .seg button { padding: 0 12px; }
  .versions div { grid-template-columns: 1fr; gap: 2px; }
  .panel, .ledger-col { padding: 20px; }
  .download h2 { font-size: 32px; }
  .footer { flex-wrap: wrap; }
}
