/* 单词花园 · Quiet Garden
   Warm paper, one card at a time, a serif for the word, everything else stays out of the way. */

@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-opsz.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #f3f1ea;
  --paper-2: #ebe8de;
  --card: #fffdf8;
  --card-2: #f6f4ed;
  --ink: #1d221e;
  --ink-2: #4b544d;
  --muted: #868d87;
  --faint: #bcc0b8;
  --line: #e6e2d8;
  --line-2: #d9d5c9;
  --moss: #2c5b43;
  --moss-2: #3f7558;
  --sage: #93b8a0;
  --lime: #d4e97a;
  --lime-ink: #1e2810;
  --fast: #2f8a58;
  --known: #7cba6e;
  --hard: #c3bb4f;
  --illusion: #d6973a;
  --unknown: #d1624e;
  --gold: #cf9f35;
  --soil: #ddd1b8;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .29 0 0 0 0 .22 0 0 0 .055 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --shadow-card: 0 0 0 1px rgba(46, 50, 38, 0.05), 0 1px 2px rgba(46, 50, 38, 0.04), 0 10px 30px -10px rgba(46, 50, 38, 0.16), 0 30px 60px -30px rgba(46, 50, 38, 0.12);
  --shadow-soft: 0 0 0 1px rgba(46, 50, 38, 0.05), 0 2px 6px rgba(46, 50, 38, 0.05), 0 8px 20px -10px rgba(46, 50, 38, 0.14);
  --radius: 30px;
  --fs: 1;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", "Noto Sans CJK SC", sans-serif;
  --serif: "Newsreader", "Iowan Old Style", "Source Serif 4", Georgia, "Times New Roman", serif;
  --ipa: "Segoe UI", -apple-system, "Lucida Sans Unicode", "Noto Sans", "Arial Unicode MS", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0e1310;
  --paper-2: #131a16;
  --card: #171e1a;
  --card-2: #1d2621;
  --ink: #e7ebe4;
  --ink-2: #b4beb5;
  --muted: #7d8880;
  --faint: #47524b;
  --line: #242e28;
  --line-2: #2e3a33;
  --moss: #8ccaa3;
  --moss-2: #a6d9b8;
  --sage: #5f8d70;
  --lime: #cbe06a;
  --lime-ink: #172009;
  --fast: #4fb87d;
  --known: #86c56f;
  --hard: #b8b551;
  --illusion: #d9a04a;
  --unknown: #dd705c;
  --gold: #d9ad4a;
  --soil: #3a3427;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 .95 0 0 0 .03 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.045), 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -14px rgba(0, 0, 0, 0.6);
  --shadow-soft: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 8px 22px -10px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--grain), radial-gradient(120% 55% at 50% -8%, color-mix(in srgb, var(--card) 80%, transparent), transparent 62%), var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: calc(15px * var(--fs));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--moss) 60%, transparent); outline-offset: 3px; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; display: block; flex: none; }

/* ---------- main screen ---------- */
.app {
  position: relative;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; padding: 12px 18px 4px; z-index: 3; }
.menu-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--moss);
  box-shadow: var(--shadow-soft);
  display: grid;
  place-items: center;
  transition: transform 0.15s var(--ease);
}
.menu-btn:active { transform: scale(0.94); }
.sync-dot { position: absolute; right: 2px; top: 2px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid transparent; background: transparent; transition: background 0.3s; }
.app[data-sync="offline"] .sync-dot { border-color: var(--paper); background: var(--illusion); }
.app[data-sync="error"] .sync-dot { border-color: var(--paper); background: var(--unknown); }
.trail-wrap { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.trail { display: flex; align-items: center; justify-content: center; gap: 6px; height: 8px; }
.trail i { --c: var(--line-2); width: 6px; height: 6px; border-radius: 3px; background: var(--c); transition: width 0.45s var(--ease-out), background 0.3s, box-shadow 0.3s; }
.trail i.cur { --c: var(--moss); width: 18px; }
.trail i.fast { --c: var(--fast); }
.trail i.known { --c: var(--known); }
.trail i.hard { --c: var(--hard); }
.trail i.illusion { --c: var(--illusion); }
.trail i.unknown { --c: var(--unknown); }
.trail i.retry { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.trail i.pop { animation: dotPop 0.45s var(--ease-out); }
.trail.done i { --c: var(--gold); background: var(--c); box-shadow: none; animation: wave 0.9s var(--ease-out) both; }
.trail.done i:nth-child(n) { animation-delay: calc(var(--n, 0) * 35ms); }
@keyframes dotPop { 0% { transform: scale(0.4); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes wave { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-4px); } }
.status { height: 16px; font-size: 12px; line-height: 16px; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.status b { font-family: var(--serif); font-weight: 600; font-size: 13.5px; color: var(--ink-2); letter-spacing: 0; }
.status .flash { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); animation: rise 0.35s var(--ease-out); }
.status .flash i { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--moss)); }
.combo { justify-self: end; min-width: 30px; text-align: right; font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 18px; color: var(--moss); font-variant-numeric: lining-nums tabular-nums; opacity: 0; transform: translateY(2px); transition: opacity 0.3s, transform 0.3s var(--ease-out); }
.combo.on { opacity: 1; transform: none; }
.combo.pop { animation: comboPop 0.5s var(--ease-out); }
.combo.glow { text-shadow: 0 0 14px color-mix(in srgb, var(--moss) 45%, transparent); }
@keyframes comboPop { 0% { transform: scale(1); } 35% { transform: scale(1.28); } 100% { transform: scale(1); } }

/* Messages from the backend take the place of the status line for a moment, never covering the card. */
.trail-wrap { position: relative; }
.status { transition: opacity 0.3s; }
body.bannering .status { opacity: 0; }
.banner {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: min(330px, calc(100vw - 40px));
  font-size: 12.5px;
  line-height: 18px;
  letter-spacing: 0.03em;
  color: var(--ink-2);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 4px);
  pointer-events: none;
  transition: opacity 0.35s, transform 0.5s var(--ease-out);
}
.banner span { overflow: hidden; text-overflow: ellipsis; }
.banner .ic { width: 14px; height: 14px; color: var(--moss); }
.banner.gold { color: color-mix(in srgb, var(--gold) 65%, var(--ink)); }
.banner.gold .ic { color: var(--gold); }
.banner.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- the deck ---------- */
.stage { position: relative; min-height: 0; padding: 8px 20px 26px; touch-action: none; }
.deck { position: relative; height: 100%; max-height: 660px; margin: 0 auto; }
/* Scoped to .deck: the soft button also has the class "ghost" and must stay clickable. */
.deck > .ghost { position: absolute; inset: 0; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-soft); transform-origin: 50% 100%; pointer-events: none; transition: transform 0.25s var(--ease); }
.deck > .ghost.g1 { transform: translateY(11px) scale(0.948); opacity: 0.72; }
.deck > .ghost.g2 { transform: translateY(21px) scale(0.896); opacity: 0.42; }
.card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 34px 26px 26px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-card);
  text-align: center;
  overflow: hidden auto;
  scrollbar-width: none;
  transform-origin: 50% 100%;
  will-change: transform, opacity;
  /* The card scrolls, so the stage's touch-action does not reach inside it: without this the
     browser takes a vertical swipe as a scroll and cancels the gesture. */
  touch-action: none;
}
.card::-webkit-scrollbar { display: none; }
/* When the answer is taller than the card (small phones), let the finger scroll it; buttons still work. */
.card.scrollable { touch-action: pan-y; }
.card-inner { margin: auto 0; width: 100%; display: flex; flex-direction: column; align-items: center; }
.card .hint-label { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); font-size: 12px; letter-spacing: 0.16em; color: var(--moss); opacity: 0; pointer-events: none; }
.card .hint-label.up::before { content: "↑  "; }
.card .hint-label.left { left: auto; right: 22px; top: 50%; bottom: auto; transform: translateY(-50%); color: var(--unknown); writing-mode: vertical-rl; letter-spacing: 0.3em; }
.card-tag { position: absolute; top: 22px; left: 26px; display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; letter-spacing: 0.14em; color: var(--muted); }
.card-tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--tag, var(--faint)); }
.card[data-kind="new"] { --tag: var(--moss); }
.card[data-kind="retry"], .card[data-kind="relearn"] { --tag: var(--illusion); }
.card[data-kind="extra"], .card[data-kind="easy"] { --tag: var(--sage); }
.card-tag .check { color: var(--illusion); }
.card-star { position: absolute; top: 18px; right: 22px; color: var(--gold); }
.card-star .ic { width: 18px; height: 18px; }

.word {
  margin: 0;
  max-width: 100%;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 560;
  font-size: calc(var(--wsize, 56px) * var(--fs));
  line-height: 1.02;
  letter-spacing: -0.018em;
  color: var(--ink);
  overflow-wrap: anywhere;
  cursor: pointer;
}
.phon-row { margin-top: 14px; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.phon { font-family: var(--ipa); font-size: calc(15.5px * var(--fs)); letter-spacing: 0.01em; cursor: pointer; }
.say { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--card-2); color: var(--muted); display: grid; place-items: center; transition: color 0.2s, background 0.2s, transform 0.12s; }
.say .ic { width: 17px; height: 17px; }
.say:active { transform: scale(0.92); }
.say.speaking { color: var(--moss); background: color-mix(in srgb, var(--moss) 11%, var(--card)); }
.say.speaking .w1 { animation: pulseWave 0.9s ease-in-out infinite; }
.say.speaking .w2 { animation: pulseWave 0.9s 0.18s ease-in-out infinite; }
@keyframes pulseWave { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.answer { width: 100%; margin-top: 26px; display: flex; flex-direction: column; align-items: center; }
.rule { width: 30px; height: 1.5px; border-radius: 1px; background: var(--line-2); margin-bottom: 20px; }
.meaning { max-width: 330px; font-size: calc(21px * var(--fs)); font-weight: 600; line-height: 1.5; color: var(--ink); letter-spacing: 0.01em; }
.meaning .pos { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 0.86em; color: var(--muted); margin-right: 7px; letter-spacing: 0; }
.extras { width: 100%; max-width: 330px; margin-top: 24px; display: grid; gap: 16px; text-align: left; }
.extra h4 { margin: 0 0 5px; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.16em; color: var(--muted); }
.extra h4 .ic { width: 13px; height: 13px; }
.extra p { margin: 0; font-size: calc(15px * var(--fs)); line-height: 1.62; color: var(--ink-2); }
.extra .en { font-family: var(--serif); font-style: italic; font-size: calc(17px * var(--fs)); line-height: 1.45; color: var(--ink); cursor: pointer; }
.extra .en b { font-style: normal; font-weight: 600; color: var(--moss); }
.extra .zh { margin-top: 3px; font-size: calc(13px * var(--fs)); color: var(--muted); }
.extra .pw { font-family: var(--serif); font-size: 1.12em; font-weight: 560; color: var(--ink); margin-right: 8px; }
.extra.tip h4 { color: var(--moss); }
.extra.pair h4 { color: var(--illusion); }
.extra.syn h4 { color: var(--moss-2); }
.extra .sw { font-family: var(--serif); font-style: italic; font-size: 1.06em; color: var(--ink); }
.verdict { margin: 18px 0 0; min-height: 18px; font-size: 13px; color: var(--muted); }
.verdict.bad { color: var(--unknown); }
.verdict.good { color: var(--fast); }

.options { width: 100%; max-width: 340px; margin-top: 26px; display: grid; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line-2);
  text-align: left;
  font-size: calc(15.5px * var(--fs));
  line-height: 1.4;
  color: var(--ink);
  transition: box-shadow 0.2s, background 0.25s, transform 0.12s var(--ease);
}
.option:active { transform: scale(0.985); }
.option .k { width: 12px; font-family: var(--serif); font-style: italic; color: var(--faint); }
.option .mark { margin-left: auto; color: transparent; }
.option .mark .ic { width: 18px; height: 18px; }
.option.right { background: color-mix(in srgb, var(--fast) 8%, var(--card)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--fast) 55%, transparent); }
.option.right .mark { color: var(--fast); }
.option.wrong { background: color-mix(in srgb, var(--unknown) 7%, var(--card)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--unknown) 50%, transparent); }
.option.wrong .mark { color: var(--unknown); }
.option:disabled { cursor: default; }
.option:disabled:not(.right):not(.wrong) { opacity: 0.55; }

.retry-label { position: absolute; left: 50%; bottom: -24px; z-index: 0; transform: translateX(-50%); font-size: 12px; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; animation: retryFloat 1.4s var(--ease-out) forwards; pointer-events: none; }
@keyframes retryFloat { 0% { opacity: 0; transform: translate(-50%, 6px); } 25% { opacity: 1; transform: translate(-50%, 0); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -2px); } }

/* ---------- bottom ---------- */
.coach { min-height: 22px; padding: 0 28px 2px; font-size: 12.5px; line-height: 20px; color: var(--muted); text-align: center; transition: opacity 0.3s; }
body.undoing .coach { opacity: 0; }
.actions { display: flex; gap: 12px; padding: 4px 20px 18px; }
.app[data-hand="left"] .actions { flex-direction: row-reverse; }
.btn {
  position: relative;
  min-height: 58px;
  border: 0;
  border-radius: 20px;
  font-size: calc(16.5px * var(--fs));
  font-weight: 600;
  letter-spacing: 0.04em;
  overflow: hidden;
  transition: transform 0.14s var(--ease), background 0.25s, color 0.25s, box-shadow 0.25s, opacity 0.25s;
}
.btn:active { transform: scale(0.965); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn .label { position: relative; z-index: 1; }
/* Keyboard hints, only where there is a keyboard: small key caps at the button edge. */
.btn .kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); padding: 0 6px; border-radius: 6px; box-shadow: inset 0 0 0 1px currentColor; font-size: 10.5px; line-height: 17px; font-weight: 500; letter-spacing: 0; opacity: 0.3; display: none; }
@media (hover: hover) and (pointer: fine) { .btn .kbd { display: inline; } }
.btn-soft { flex: 1; background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-soft.ghost { color: var(--muted); font-weight: 500; }
.btn-main {
  flex: 1.5;
  background: var(--lime);
  color: var(--lime-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(60, 80, 10, 0.08), 0 10px 22px -14px rgba(90, 120, 20, 0.7);
}
:root[data-theme="dark"] .btn-main { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 22px -14px rgba(0, 0, 0, 0.8); }
.btn-main .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(30, 50, 10, 0.1); }
.btn-main.thinking .fill { animation: think var(--think, 2s) linear forwards; }
.btn-main.auto .fill { animation: think var(--auto, 3s) linear forwards; }
@keyframes think { from { width: 0; } to { width: 100%; } }
.app[data-controls="gestures"] .actions { display: none; }
.gesture-hint { display: none; padding: 4px 0 20px; text-align: center; font-size: 12px; letter-spacing: 0.06em; color: var(--muted); }
.app[data-controls="gestures"] .gesture-hint { display: block; }
.app[data-mode="special"] .actions, .app[data-mode="special"] .gesture-hint, .app[data-mode="special"] .coach { visibility: hidden; }

.undo-chip {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 104px);
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px 8px 12px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink-2);
  font-size: 13px;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.35s var(--ease-out), visibility 0s 0.35s;
}
.undo-chip .ic { width: 15px; height: 15px; color: var(--moss); }
.undo-chip.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); pointer-events: auto; transition-delay: 0s; }
.app[data-controls="gestures"] .undo-chip { bottom: calc(env(safe-area-inset-bottom) + 58px); }

/* ---------- special cards ---------- */
.card.special .card-inner { gap: 12px; }
.art { width: 84px; height: 84px; color: var(--moss); margin-bottom: 4px; }
.draw path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s var(--ease-out) forwards; }
.draw path:nth-child(2) { animation-delay: 0.18s; }
.draw path:nth-child(3) { animation-delay: 0.42s; }
.draw path:nth-child(4) { animation-delay: 0.6s; }
.draw path:nth-child(5) { animation-delay: 0.75s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.special h2 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: 0.02em; line-height: 1.4; text-wrap: balance; }
.special p { margin: 0; max-width: 300px; font-size: 14.5px; line-height: 1.75; color: var(--ink-2); text-wrap: pretty; }
.note, .headline, .meaning, .extra p, .choice-btn span { text-wrap: pretty; }
.special .choices { width: 100%; max-width: 340px; margin-top: 14px; display: grid; gap: 10px; }
.choice-btn {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3px 12px;
  width: 100%;
  min-height: 62px;
  padding: 13px 16px 13px 18px;
  border: 0;
  border-radius: 18px;
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: left;
  transition: transform 0.14s var(--ease), background 0.2s;
}
.choice-btn:active { transform: scale(0.98); }
.choice-btn strong { font-size: 15.5px; font-weight: 600; letter-spacing: 0.02em; }
.choice-btn span { grid-column: 1; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.choice-btn .ic { grid-column: 2; grid-row: 1 / span 2; width: 18px; height: 18px; color: var(--faint); }
.choice-btn.primary { background: var(--lime); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4); color: var(--lime-ink); }
.choice-btn.primary span, .choice-btn.primary .ic { color: color-mix(in srgb, var(--lime-ink) 60%, transparent); }
.choice-btn:disabled { opacity: 0.6; }
.special .welcome-links { display: flex; justify-content: center; gap: 4px 18px; flex-wrap: wrap; margin-top: 4px; }
.special .welcome-links .link-btn { padding: 6px 4px; font-size: 13.5px; }
.sheet .sheet-title { margin: 4px 4px 10px; font-family: var(--sans); font-size: 19px; font-weight: 650; letter-spacing: 0.02em; }
.account-form .field input { width: 100%; }
.form-error { min-height: 18px; margin: 10px 4px 0; font-size: 13px; color: var(--unknown); }
.check-row { display: flex; align-items: flex-start; gap: 10px; margin: 14px 4px 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.check-row input { margin-top: 4px; width: 17px; height: 17px; accent-color: var(--moss); flex: none; }
.learners { display: grid; gap: 1px; overflow: hidden; border-radius: 14px; background: var(--line); }
.learner { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; background: var(--card-2); }
.learner .who { font-weight: 600; font-size: 14px; }
@media (max-height: 700px) {
  .card.special .card-inner { gap: 9px; }
  .special .art { width: 60px; height: 60px; }
  .special .choices { margin-top: 8px; gap: 8px; }
  .choice-btn { min-height: 56px; padding: 10px 14px 10px 16px; }
}
.mood-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 330px; margin-top: 14px; }
.mood-row button { display: grid; justify-items: center; gap: 8px; padding: 16px 6px 14px; border: 0; border-radius: 18px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; color: var(--ink-2); transition: transform 0.14s var(--ease); }
.mood-row button:active { transform: scale(0.96); }
.mood-row .ic { width: 30px; height: 30px; color: var(--moss); stroke-width: 1.3; }
.summary { display: flex; justify-content: center; gap: 28px; margin: 6px 0 2px; }
.summary div { display: grid; gap: 2px; }
.summary strong { font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1; font-variant-numeric: lining-nums; color: var(--ink); }
.summary span { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }

.loading { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 13px; letter-spacing: 0.1em; gap: 14px; align-content: center; }
.loading .art { width: 64px; height: 64px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 104px);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 9px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 95%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink-2);
  font-size: 13px;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.35s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.toast button { flex: none; white-space: nowrap; border: 0; padding: 0; background: none; color: var(--moss); font-weight: 600; font-size: 13px; }

/* ---------- panel ---------- */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(22, 28, 22, 0.28); opacity: 0; pointer-events: none; transition: opacity 0.3s; }
:root[data-theme="dark"] .backdrop { background: rgba(0, 0, 0, 0.5); }
.backdrop.show { opacity: 1; pointer-events: auto; }
.panel {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  width: min(94vw, 460px);
  display: grid;
  grid-template-rows: auto 1fr;
  padding-top: env(safe-area-inset-top);
  background: var(--grain), var(--paper);
  box-shadow: 18px 0 50px -20px rgba(0, 0, 0, 0.35);
  transform: translateX(-104%);
  transition: transform 0.42s var(--ease-out);
}
.panel.open { transform: none; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 8px 16px; }
.tabs { flex: 1; display: flex; gap: 2px; padding: 4px; border-radius: 15px; background: var(--paper-2); }
.tabs button { flex: 1; padding: 8px 0; border: 0; border-radius: 11px; background: transparent; font-size: 14px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); transition: background 0.2s, color 0.2s; }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
.icon-close { width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; }
.panel-body { overflow-y: auto; padding: 4px 16px calc(36px + env(safe-area-inset-bottom)); user-select: text; -webkit-user-select: text; overscroll-behavior: contain; }
.panel-body > * { animation: rise 0.4s var(--ease-out) both; }
.panel-body > *:nth-child(2) { animation-delay: 0.03s; }
.panel-body > *:nth-child(3) { animation-delay: 0.06s; }
.panel-body > *:nth-child(4) { animation-delay: 0.09s; }
.panel-body > *:nth-child(n + 5) { animation-delay: 0.12s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 24px 4px 10px; }
.section-title h3 { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: 0.04em; }
.section-title small { font-size: 12px; color: var(--muted); text-align: right; }
.box { padding: 16px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow-soft); }
.box + .box { margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.note { margin: 10px 4px 0; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.box .note { margin: 10px 0 0; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 14px 14px 12px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow-soft); }
.stat strong { display: block; font-family: var(--serif); font-weight: 500; font-size: 32px; line-height: 1.05; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); }
.stat span { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.stat.warn strong { color: var(--illusion); }
.stat.good strong { color: var(--fast); }
.box .stat { box-shadow: inset 0 0 0 1px var(--line); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: var(--paper-2); font-size: 11.5px; letter-spacing: 0.04em; color: var(--ink-2); white-space: nowrap; }
.pill.brand { background: color-mix(in srgb, var(--moss) 12%, transparent); color: var(--moss); }
.pill.warn { background: color-mix(in srgb, var(--illusion) 16%, transparent); color: color-mix(in srgb, var(--illusion) 80%, var(--ink)); }
.pill.ai { background: color-mix(in srgb, var(--moss) 10%, transparent); color: var(--moss); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip-btn { padding: 9px 15px; border: 0; border-radius: 12px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 13.5px; font-weight: 600; letter-spacing: 0.03em; color: var(--ink); transition: transform 0.12s var(--ease); }
.chip-btn:active { transform: scale(0.97); }
.chip-btn.primary { background: var(--lime); box-shadow: none; color: var(--lime-ink); }
.chip-btn.danger { color: var(--unknown); }
.chip-btn:disabled { opacity: 0.5; }
.link-btn { padding: 0; border: 0; background: none; font-size: 13px; font-weight: 600; color: var(--moss); }
.headline { margin: 2px 0 0; font-size: 17px; font-weight: 650; line-height: 1.55; letter-spacing: 0.01em; }
.bullets { margin: 10px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.75; color: var(--ink-2); }
.bullets li::marker { color: var(--sage); }

/* garden */
.knowledge { margin: 6px 4px 16px; }
.knowledge .big { display: flex; align-items: baseline; gap: 10px; }
.knowledge .big strong { font-family: var(--serif); font-weight: 500; font-size: 52px; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); }
.knowledge .big span { font-size: 14px; color: var(--ink-2); letter-spacing: 0.02em; }
.knowledge .note { margin: 8px 0 0; }
.garden-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 14px 4px 0; font-size: 12px; color: var(--muted); }
.garden-legend span { display: inline-flex; align-items: center; gap: 2px; }
.garden-legend svg { width: 18px; height: 22px; }
.bed { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 4px 2px; padding: 14px 8px 8px; border-radius: 22px; background: linear-gradient(to bottom, var(--card) 0%, var(--card) 62%, color-mix(in srgb, var(--soil) 38%, var(--card)) 100%); box-shadow: var(--shadow-soft); }
.plant { display: grid; justify-items: center; min-width: 0; padding: 0; border: 0; background: none; transition: transform 0.15s var(--ease); }
.plant:active { transform: scale(0.94); }
.plant svg { width: 40px; height: 48px; overflow: visible; }
.plant .sway { transform-origin: 20px 44px; animation: sway 5s ease-in-out infinite; animation-delay: var(--d, 0s); }
.plant span { max-width: 100%; font-size: 10px; line-height: 1.3; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--serif); letter-spacing: 0.01em; }
@keyframes sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
.seed-line { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 14px 14px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow-soft); }
.seed-line i { display: inline-block; width: 8px; height: 6px; border-radius: 50%; background: #a3845c; opacity: 0.75; }

/* charts & lists */
.chart { display: block; width: 100%; height: auto; }
.chart text { font-family: var(--sans); font-size: 9px; fill: var(--muted); }
.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 10px; width: 100%; padding: 12px 15px; border: 0; border-radius: 18px; background: var(--card); box-shadow: var(--shadow-soft); text-align: left; transition: transform 0.12s var(--ease); }
.item:active { transform: scale(0.99); }
.item .w { font-family: var(--serif); font-size: 17px; font-weight: 560; letter-spacing: -0.005em; }
.item .m { grid-column: 1 / -1; font-size: 13px; line-height: 1.5; color: var(--muted); }
.item .r { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scheme-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.scheme-row:first-child { padding-top: 2px; }
.scheme-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.scheme-row .name { font-weight: 600; letter-spacing: 0.02em; }
.scheme-row .bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.scheme-row .bar i { display: block; height: 100%; border-radius: 3px; background: var(--sage); }
.scheme-row.best .bar i { background: var(--moss); }
.scheme-row .desc { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.sub-title { margin: 18px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; color: var(--muted); }
.vs { display: flex; align-items: center; gap: 14px; margin: 14px 0 0; }
.vs > div { display: grid; gap: 2px; }
.vs span { font-size: 12px; color: var(--muted); }
.vs strong { font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1; font-variant-numeric: lining-nums tabular-nums; color: var(--ink-2); }
.vs .good strong { color: var(--fast); }
.vs i { font-style: normal; color: var(--faint); font-size: 18px; }
.box .kv { margin: 0; }
.kv.first { grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kv.first div { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 8px; padding: 11px 13px; box-shadow: inset 0 0 0 1px var(--line); }
.kv.first span { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.kv.first strong { font-size: 18px; text-align: right; white-space: nowrap; }
.kv.first em { grid-column: 1 / -1; font-style: normal; font-size: 11.5px; color: var(--muted); }
.wl-head, .wl-row { display: grid; grid-template-columns: 40px 1fr 62px 60px; align-items: center; gap: 8px; }
.wl-head { margin-bottom: 4px; font-size: 11px; letter-spacing: 0.06em; color: var(--muted); }
.wl-head span:nth-child(2) { grid-column: 2 / 4; }
.wl-head span:last-child, .wl-row .rec { text-align: right; }
.wl-row { padding: 5px 0; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wl-row .dr { font-family: var(--serif); font-size: 14px; color: var(--ink); }
.wl-row .bar { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.wl-row .bar i { display: block; height: 100%; border-radius: 3px; background: var(--sage); }
.wl-row .min { text-align: right; }
.wl-row.cur { color: var(--ink); font-weight: 600; }
.wl-row.cur .bar i { background: var(--moss); }
.wl-row.cur .dr::after { content: " ·"; color: var(--moss); }
.weeks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-items: end; }
.weeks .wk { display: grid; justify-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.weeks .col { position: relative; width: 26px; height: 64px; border-radius: 7px; background: var(--paper-2); overflow: hidden; }
.weeks .col i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 7px; background: var(--moss-2); }
.weeks b { font-family: var(--serif); font-weight: 500; font-size: 15px; color: var(--ink); font-variant-numeric: lining-nums; }
.history-item { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.history-item:first-child { padding-top: 2px; }
.history-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.history-item .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.history-item ul { margin: 2px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.65; color: var(--ink-2); }
.chat { display: grid; gap: 10px; }
.chat textarea, .field input, .field select, .text-input {
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-radius: 14px;
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
}
.chat textarea:focus, .field input:focus, .text-input:focus { outline: 0; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--moss) 55%, transparent); }
.chat textarea { min-height: 70px; }
.reply { padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--moss) 8%, var(--card)); font-size: 14px; line-height: 1.65; }
.reply small { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }

/* settings */
.setting { display: grid; gap: 9px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.setting:first-child { padding-top: 2px; }
.setting:last-child { border-bottom: 0; padding-bottom: 2px; }
.setting > label, .setting .label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; letter-spacing: 0.02em; }
.setting .label > .chip-btn, .setting .label > .switch { flex: none; white-space: nowrap; }
.setting .help { font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0; line-height: 1.55; }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--paper-2); }
.seg button { flex: 1; padding: 7px 4px; border: 0; border-radius: 9px; background: transparent; font-size: 13px; font-weight: 600; color: var(--muted); transition: background 0.2s, color 0.2s; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07); }
.switch { position: relative; flex: none; width: 46px; height: 28px; border: 0; border-radius: 999px; background: var(--line-2); transition: background 0.25s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.3s var(--ease-out); }
.switch[aria-checked="true"] { background: var(--moss-2); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
input[type="range"] { width: 100%; accent-color: var(--moss); }
.field { display: grid; gap: 6px; margin-top: 10px; }
.field label { font-size: 12.5px; color: var(--muted); }
.code-box { padding: 12px; border-radius: 16px; background: var(--card-2); text-align: center; font-family: var(--serif); font-size: 34px; font-weight: 500; letter-spacing: 0.22em; font-variant-numeric: lining-nums; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.presets button { padding: 6px 11px; border: 0; border-radius: 10px; background: var(--paper-2); font-size: 12.5px; }

/* sheet */
.sheet-backdrop { z-index: 70; }
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 80;
  width: min(100vw, 480px);
  max-height: 86vh;
  overflow-y: auto;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--grain), var(--paper);
  box-shadow: 0 -16px 50px -20px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, 104%);
  transition: transform 0.4s var(--ease-out);
  user-select: text;
  -webkit-user-select: text;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet .grabber { width: 38px; height: 4px; margin: 0 auto 14px; border-radius: 2px; background: var(--line-2); }
.sheet h3 { margin: 4px 4px 14px; font-family: var(--serif); font-size: 26px; font-weight: 560; letter-spacing: -0.01em; }
.menu-list { display: grid; gap: 1px; overflow: hidden; border-radius: 20px; background: var(--line); box-shadow: var(--shadow-soft); }
.menu-list button { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border: 0; background: var(--card); text-align: left; font-size: 15px; transition: background 0.15s; }
.menu-list button:active { background: var(--card-2); }
.menu-list button .ic { color: var(--moss); width: 19px; height: 19px; }
.menu-list button small { margin-left: auto; font-size: 12px; color: var(--muted); }
.detail-word { margin: 2px 4px 0; font-family: var(--serif); font-size: 40px; font-weight: 560; line-height: 1.05; letter-spacing: -0.015em; }
.sheet .phon-row { margin: 8px 4px 0; }
.sheet .meaning { margin: 12px 4px 0; font-size: 18px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 12px; }
.kv div { padding: 11px 12px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-soft); }
.kv strong { display: block; font-family: var(--serif); font-size: 21px; font-weight: 500; line-height: 1.15; font-variant-numeric: lining-nums; }
.kv span { font-size: 11.5px; color: var(--muted); }
.sheet .extra { margin: 14px 4px 0; text-align: left; }
.sheet .edit-form { margin-top: 6px; }

@media (min-width: 700px) {
  .app { height: min(100dvh, 920px); margin-top: max(0px, calc((100dvh - 920px) / 2)); }
}
@media (max-height: 680px) {
  .btn { min-height: 52px; }
  .card { padding: 28px 22px 20px; }
  .answer { margin-top: 20px; }
  .extras { margin-top: 18px; gap: 12px; }
  .options { margin-top: 18px; gap: 8px; }
  .option { min-height: 46px; padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ICP 备案号：规定首页底部要显示并链接到工信部。放在按钮下方的留白里，不占布局 */
.icp {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 2px);
  font-size: 10px; line-height: 14px; color: var(--muted); opacity: .8;
  text-decoration: none; white-space: nowrap; z-index: 1;
}
