:root {
  color-scheme: light;
  --ink: #202d28;
  --muted: #596a60;
  --pine: #17483b;
  --pine-dark: #103b30;
  --leaf: #387558;
  --paper: #f6f5ee;
  --surface: #fffef8;
  --line: #d5dbce;
  --tint: #e8f0e4;
  --ochre: #edc376;
  --red: #9b3c2b;
  font-family: "DM Sans", "Source Sans 3", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button, .option { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #bd832d; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p, dl, dd, ol { margin: 0; }
h1, h2, h3 { font-weight: 680; line-height: 1.35; }
.wrap { width: min(100% - 48px, 1024px); margin-inline: auto; }
.skip { position: fixed; top: -5rem; left: 1rem; z-index: 3; padding: .6rem 1rem; background: white; color: var(--pine); }
.skip:focus { top: .5rem; }
.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 70px; gap: 12px; }
.brand, .device-button, .back, .text-button, .close-button { border: 0; background: transparent; }
.brand { display: inline-flex; align-items: center; gap: 11px; padding: 8px 0; font-weight: 750; font-size: 1.13rem; color: var(--pine); }
.book-mark { width: 34px; height: 34px; position: relative; flex: none; border-radius: 9px; background: var(--pine); }
.book-mark::before, .book-mark::after { content: ""; position: absolute; top: 10px; width: 9px; height: 14px; background: #fff9df; }
.book-mark::before { left: 7px; transform: skewY(10deg); border-radius: 2px 0 1px 2px; }
.book-mark::after { right: 7px; transform: skewY(-10deg); border-radius: 0 2px 2px 1px; }
.book-mark i { z-index: 1; position: absolute; top: 9px; right: 9px; width: 3px; height: 7px; background: var(--ochre); }
.device-button { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 5px; font-size: .87rem; font-weight: 590; color: var(--muted); }
.status-dot { width: 8px; height: 8px; background: #89968b; border-radius: 50%; }
.status-dot.connected { background: var(--leaf); box-shadow: 0 0 0 3px #e3eddf; }
.status-dot.pending { background: #b57c27; }
.chevron { width: 7px; height: 7px; margin: -3px 2px 0 2px; border-right: 1.6px solid; border-bottom: 1.6px solid; transform: rotate(45deg); }
main { padding-block: 32px max(36px, env(safe-area-inset-bottom)); }
.notice, .dialog-note { border-radius: 10px; background: #fff1d5; border: 1px solid #e3c582; color: #624719; padding: 10px 14px; font-size: .9rem; }
.notice { margin-bottom: 14px; }
.hero { position: relative; display: flex; align-items: center; overflow: hidden; isolation: isolate; min-height: 265px; background: var(--pine); border-radius: 19px; color: #fffef3; }
.hero-copy { z-index: 1; position: relative; width: 70%; padding: 30px 0 32px 39px; }
.date-line { color: #e4c88d; font-size: .85rem; font-weight: 650; letter-spacing: .06em; }
.hero h1 { margin: 7px 0 6px; font-size: clamp(1.9rem, 4.5vw, 3.15rem); letter-spacing: -.045em; }
#home-intro { color: #dce7dc; font-size: .98rem; max-width: 39em; }
.hero-action, .primary, .secondary, .quiet { min-height: 46px; border-radius: 9px; padding: 9px 19px; border: 1px solid transparent; font-weight: 640; transition: background .15s ease; }
.hero-action { display: inline-flex; align-items: center; gap: 22px; background: var(--ochre); color: #233c2d; margin-top: 24px; min-width: 142px; justify-content: space-between; }
.hero-action:hover:enabled { background: #f5ce88; }
.arrow { font-size: 1.25rem; line-height: 1; }
.paper-stack { --w: 180px; --h: 124px; position: absolute; z-index: 0; width: var(--w); height: var(--h); right: 9%; top: 50%; transform: translateY(-48%) rotate(-9deg); pointer-events: none; }
.paper-stack i, .paper-stack b, .paper-stack > span { position: absolute; inset: 0; border-radius: 9px; }
.paper-stack i { background: #668c70; transform: translate(28px, -19px) rotate(21deg); }
.paper-stack b { background: #d8b16e; transform: translate(14px, -9px) rotate(12deg); }
.paper-stack > span { overflow: hidden; background: #f4edcf; border: 1px solid #f5ecca; box-shadow: 0 8px 20px #0b2c2529; }
.paper-stack > span::before { content: ""; position: absolute; inset: 27% 11% 13%; background: repeating-linear-gradient(to bottom, #98a68f 0 1px, transparent 1px 21%); }
.paper-stack > span::after { content: ""; position: absolute; top: 0; right: 16%; width: 11%; height: 39%; background: #b96c42; clip-path: polygon(0 0,100% 0,100% 100%,50% 80%,0 100%); }
.dashboard-grid { display: grid; grid-template-columns: 1.46fr 1fr; gap: 18px; margin: 18px 0; }
.panel, .bank-bar, .word-card { border: 1px solid var(--line); background: var(--surface); border-radius: 15px; }
.panel { min-width: 0; padding: 23px 25px; }
.panel-heading, .mode-row, .bank-bar, .dialog-top, .study-nav, .card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h2 { font-size: 1.15rem; }
h3 { font-size: .94rem; }
.subtle, .mode-note, .bank-bar p, .install-block p, #pair-form p { font-size: .86rem; color: var(--muted); }
.progress-track { display: block; width: 100%; height: 5px; margin: 17px 0; appearance: none; border: 0; border-radius: 5px; overflow: hidden; background: #e5e9df; color: var(--leaf); }
.progress-track::-webkit-progress-bar { background: #e5e9df; border-radius: 5px; }
.progress-track::-webkit-progress-value { background: var(--leaf); border-radius: 5px; }
.progress-track::-moz-progress-bar { background: var(--leaf); border-radius: 5px; }
.metrics { display: grid; grid-template-columns: repeat(3,1fr); }
.metrics > div + div { border-left: 1px solid #e1e5da; padding-left: 16px; }
.metrics dt { font-size: .84rem; color: var(--muted); }
.metrics dd { font-size: 1.9rem; font-weight: 630; font-variant-numeric: tabular-nums; line-height: 1.3; }
.mode-row { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 2px; background: #f0f2e9; }
.segmented button { min-height: 40px; padding: 3px 13px; background: transparent; border: 1px solid transparent; border-radius: 6px; font-size: .88rem; font-weight: 570; color: var(--muted); }
.segmented button[aria-pressed="true"] { color: var(--pine); background: var(--surface); border-color: #d5dccf; box-shadow: 0 1px 2px #1c3c2414; }
.mode-note { margin-top: 10px; }
.activity { display: flex; flex-direction: column; }
.chart { display: grid; flex: 1; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 5px; padding: 0; margin-top: 22px; min-height: 118px; list-style: none; }
.chart li { display: grid; grid-template-rows: 1fr auto; justify-items: center; gap: 5px; min-width: 0; }
.chart .bar-area { position: relative; width: min(60%,25px); min-width: 11px; min-height: 68px; }
.chart .bar { position: absolute; bottom: 0; width: 100%; min-height: 3px; border-radius: 4px 4px 2px 2px; background: #a0b89a; }
.chart .bar-count { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); color: var(--muted); font: 550 .7rem/1.5 system-ui, sans-serif; }
.chart .zero { background: #dbe1d4; }
.chart .current .bar:not(.zero) { background: var(--leaf); }
.chart .day { font-size: .77rem; color: var(--muted); }
.chart .current .day { font-weight: 690; color: var(--pine); }
.bank-bar { padding: 15px 21px; justify-content: flex-start; }
.bank-bar h2 { font-size: .95rem; }
.bank-bar p { margin-top: 2px; overflow-wrap: anywhere; }
.bank-bar .text-button { margin-inline-start: auto; flex-shrink: 0; }
.file-icon { position: relative; width: 35px; height: 39px; flex: none; border-radius: 8px; background: #edf0e5; }
.file-icon::before { content: ""; position: absolute; inset: 8px 10px; border: 1.5px solid #61755c; border-radius: 2px; }
.file-icon::after { content: ""; position: absolute; left: 14px; top: 15px; width: 7px; height: 4px; border-block: 1px solid #61755c; }
.text-button, .back { min-height: 44px; padding: 4px 6px; color: var(--pine); font-size: .9rem; font-weight: 640; }
.text-button:hover, .back:hover { text-decoration: underline; }
.study { max-width: 760px; margin-inline: auto; }
.study-nav { margin: -6px 1px 14px; }
.word-card { padding: clamp(21px,5vw,42px); overflow-wrap: anywhere; }
.card-meta { align-items: flex-start; color: var(--muted); font-size: .83rem; font-weight: 580; }
.phase-tag { display: inline-flex; align-items: center; gap: 7px; }
.phase-tag::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--leaf); border-radius: 50%; }
.word { font-family: "Spectral", "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif; font-weight: 500; font-size: clamp(2.8rem, 8vw, 4.8rem); letter-spacing: -.05em; color: var(--pine-dark); line-height: 1.13; margin: 29px 0 18px; overflow-wrap: anywhere; }
.word:focus, .feedback-title:focus, .prompt-title:focus { outline: none; }
.prompt-title { font-weight: 610; font-size: 1.03rem; }
.recall-prompt { padding-block: 1px 15px; color: var(--muted); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.primary { color: #fffdf1; background: var(--pine); }
.primary:hover:enabled { background: #215b48; }
.secondary { border-color: #b9c8b7; color: var(--pine); background: var(--surface); }
.secondary:hover:enabled, .option:hover { background: #f0f3e9; }
.quiet { background: transparent; color: var(--muted); border-color: transparent; }
.quiet:hover:enabled { background: #f3f1e8; }
.choices { padding: 0; margin: 0; border: 0; min-width: 0; }
.choices legend { padding: 0; margin: 4px 0 12px; }
.option { display: flex; position: relative; align-items: center; gap: 12px; width: 100%; border: 1px solid var(--line); padding: 11px 14px; border-radius: 9px; margin: 7px 0; min-height: 48px; cursor: pointer; background: #fcfcf4; }
.option:has(input:checked) { background: var(--tint); border-color: #4f7e5d; color: var(--pine-dark); }
.option input { margin: 0; flex: none; width: 18px; height: 18px; accent-color: var(--pine); }
.option .key { margin-inline-start: auto; color: var(--muted); font-family: "IBM Plex Mono", Consolas, monospace; font-size: .78rem; }
.feedback { border-top: 1px solid var(--line); padding-top: 21px; }
.feedback-title { color: var(--pine); font-size: 1.3rem; }
.feedback-title.error { color: var(--red); }
.feedback-sub { color: var(--muted); font-size: .92rem; margin: 4px 0 0; }
.result-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 5px; }
.result-list li { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px 12px; font-size: .97rem; }
.result-label { color: var(--muted); min-width: 3.8em; font-weight: 650; }
.result-label.bad { color: var(--red); }
.result-list li > span:last-child { flex: 1; min-width: min(200px, 100%); }
.key-hint { color: var(--muted); font-size: .79rem; margin-top: 12px; }
.reference { margin-top: 23px; padding-top: 16px; border-top: 1px solid var(--line); }
.reference h3 { margin-bottom: 5px; font-size: .86rem; color: var(--muted); }
.example { white-space: pre-line; font-size: .96rem; }
.reference details { font-size: .86rem; color: var(--muted); margin-top: 7px; }
.reference summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 600; color: var(--pine); }
.reference ul { margin: 0; padding-inline-start: 1.4rem; }
.reference li + li { margin-top: 4px; }
.original-cell { padding: 7px 0 11px; }
.original-cell .example { color: var(--ink); margin-bottom: 3px; }
.complete { text-align: center; padding-block: 20px; }
.complete h1 { font-size: 1.7rem; color: var(--pine); }
.complete p { margin: 12px auto; color: var(--muted); max-width: 35ch; }
.complete .actions { justify-content: center; }
dialog { color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 23px; width: min(100% - 32px, 420px); max-height: 88dvh; background: var(--surface); box-shadow: 0 18px 58px #17382c30; }
dialog::backdrop { background: #10271f72; }
.close-button { min-width: 44px; min-height: 44px; font-size: 1.5rem; line-height: 1; color: var(--muted); margin: -8px -9px -8px 0; }
.device-state { margin: 16px 0; padding: 10px 13px; color: var(--pine); background: var(--tint); border-radius: 8px; font-size: .91rem; }
#pair-form label { font-weight: 620; }
#pair-form p { margin: 4px 0 8px; }
#pair-code { width: 100%; border: 1px solid #a8b8a6; border-radius: 8px; padding: 10px 12px; color: var(--ink); background: #fff; }
#pair-submit { width: 100%; margin-top: 10px; }
.dialog-note { margin-top: 10px; }
.install-block { margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); }
.install-block p { margin-top: 4px; }
@media (max-width: 700px) {
  .wrap { width: min(100% - 32px, 600px); }
  .nav { min-height: 60px; }
  main { padding-top: 21px; }
  .hero { min-height: 226px; }
  .hero-copy { padding: 25px 0 27px 24px; width: 70%; }
  .paper-stack { --w: 114px; --h: 85px; right: 8%; transform: translateY(-43%) rotate(-9deg); }
  .dashboard-grid { grid-template-columns: 1fr; gap: 13px; margin: 13px 0; }
  .panel { padding: 18px 20px; }
  .chart { height: 88px; min-height: 88px; margin-top: 10px; }
  .chart .bar-area { min-height: 50px; }
  .bank-bar { padding: 13px 15px; }
}
@media (max-width: 455px) {
  .wrap { width: calc(100% - 24px); }
  main { padding-top: 14px; }
  .brand { font-size: 1.02rem; }
  .hero { min-height: 210px; }
  .hero-copy { width: 100%; padding: 20px; }
  .hero h1 { font-size: 1.9rem; margin: 9px 0 8px; }
  #home-intro { font-size: .9rem; width: 79%; }
  .hero-action { margin-top: 19px; min-height: 44px; }
  .paper-stack { --w: 53px; --h: 40px; top: auto; right: 22px; bottom: 22px; transform: rotate(-9deg); }
  .paper-stack i { transform: translate(9px,-7px) rotate(15deg); }
  .paper-stack b { transform: translate(4px,-4px) rotate(8deg); }
  .paper-stack i, .paper-stack b, .paper-stack > span { border-radius: 3px; }
  .panel { padding: 17px; }
  .segmented button { min-height: 42px; padding-inline: 11px; }
  .metrics > div + div { padding-left: 11px; }
  .word-card { padding: 21px 17px; }
  .word { margin-top: 24px; }
  .result-list li > span:last-child { min-width: min(125px, 100%); }
}
@media (hover: none), (pointer: coarse) { .key-hint, .option .key { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
