/* 学习中心
   主题三态：跟随系统（无 data-theme）/ 强制浅色 / 强制深色。
   浅色是基准，深色只覆盖变量，所以颜色只在这一处定义。 */

:root {
  --bg: #F5F4EF;
  --panel: #FFFFFF;
  --panel-2: #F0EFEA;
  --sunk: #ECEAE4;
  --line: #E3E1DA;
  --line-2: #F0EFEA;
  --text: #1A1C20;
  --text-2: #3D4046;
  --muted: #5F6368;
  --accent: #1F6B55;
  --accent-ink: #164F3F;
  --accent-soft: #E3EFEA;
  --accent-line: #BCD8CC;
  --amber: #8A5A12;
  --amber-ink: #6E470C;
  --amber-soft: #F7EEDC;
  --amber-line: #D9C7A3;
  --bad: #A2352F;
  --bad-soft: #F6E3E1;
  --bad-ink: #7E2420;
  --blue-soft: #E7EEF6;
  --blue-ink: #244A6E;
  --lang: #8A4E9C;
  --lang-soft: #C59BD1;
  --ink: #1A1C20;
  --on-ink: #F5F4EF;
  --code-bg: #F6F6F3;
  --h0: #ECEAE4; --h1: #C9E2D7; --h2: #8CC3AC; --h3: #4A9A7B; --h4: #1F6B55;

  --t-com: #6F7C74; --t-str: #9A5B2C; --t-num: #7A4FA3; --t-kw: #1F6F8B;
  --t-typ: #1F6B55; --t-fn: #34506E; --t-pre: #8A5A9A;

  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
          "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --ja: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", var(--sans);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171B; --panel: #1C1F24; --panel-2: #23262C; --sunk: #2A2E35; --line: #30343B; --line-2: #262A30;
    --text: #E8E6E1; --text-2: #C9CBCF; --muted: #9AA0A6;
    --accent: #5FB394; --accent-ink: #9FD3BF; --accent-soft: #1F3A31; --accent-line: #2F5A4B;
    --amber: #E0B062; --amber-ink: #F0C987; --amber-soft: #3A2F1C; --amber-line: #5A4828;
    --bad: #D9675F; --bad-soft: #3D2321; --bad-ink: #F1A39C;
    --blue-soft: #1F2C3B; --blue-ink: #A9C6E6; --lang: #C59BD1; --lang-soft: #8A4E9C;
    --ink: #E8E6E1; --on-ink: #15171B; --code-bg: #20232A;
    --h0: #262A30; --h1: #1F3A31; --h2: #2B5E4C; --h3: #3F8B6E; --h4: #6CC4A1;
    --t-com: #7F8B85; --t-str: #E0A274; --t-num: #C3A1E8; --t-kw: #7CC2DA; --t-typ: #7FCBAA; --t-fn: #A9C6E6; --t-pre: #D3A6E0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171B; --panel: #1C1F24; --panel-2: #23262C; --sunk: #2A2E35; --line: #30343B; --line-2: #262A30;
  --text: #E8E6E1; --text-2: #C9CBCF; --muted: #9AA0A6;
  --accent: #5FB394; --accent-ink: #9FD3BF; --accent-soft: #1F3A31; --accent-line: #2F5A4B;
  --amber: #E0B062; --amber-ink: #F0C987; --amber-soft: #3A2F1C; --amber-line: #5A4828;
  --bad: #D9675F; --bad-soft: #3D2321; --bad-ink: #F1A39C;
  --blue-soft: #1F2C3B; --blue-ink: #A9C6E6; --lang: #C59BD1; --lang-soft: #8A4E9C;
  --ink: #E8E6E1; --on-ink: #15171B; --code-bg: #20232A;
  --h0: #262A30; --h1: #1F3A31; --h2: #2B5E4C; --h3: #3F8B6E; --h4: #6CC4A1;
  --t-com: #7F8B85; --t-str: #E0A274; --t-num: #C3A1E8; --t-kw: #7CC2DA; --t-typ: #7FCBAA; --t-fn: #A9C6E6; --t-pre: #D3A6E0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.35; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.soft { color: #B9BCC2; }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.error { color: var(--bad); min-height: 1.4em; }
.warn { color: var(--amber); }
kbd { font: 11px var(--mono); padding: 1px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: .6; margin-left: 6px; }

.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wrap { flex-wrap: wrap; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.grow { flex: 1 1 200px; }
.push-right { margin-left: auto; }

/* ---------------------------------------------------------------- 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 10px; font: inherit;
  cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; color: var(--text); border-color: var(--muted); }
.btn.ink { background: var(--ink); color: var(--on-ink); border-color: var(--ink); font-weight: 700; }
.btn.ink:hover { color: var(--on-ink); opacity: .92; }
.btn.light { background: var(--on-ink); color: var(--ink); border: 0; font-weight: 700; }
:root .panel.dark .btn.light { background: #F5F4EF; color: #1A1C20; }
.btn.good { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.wide { width: 100%; }
.btn.tall { min-height: 54px; font-size: 16px; border-radius: 12px; }
.btn.small-btn { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0;
  background: transparent; color: var(--text-2); border-radius: 10px; cursor: pointer; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.text-btn { border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; padding: 8px; min-height: 36px; }
.text-btn:hover { color: var(--text); }

input, textarea, select { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }
textarea { font: 13.5px/1.6 var(--mono); resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; }
label.check input { width: auto; min-height: 0; }
input.num { width: 96px; }

/* ---------------------------------------------------------------- 登录 */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; display: flex; flex-direction: column; gap: 12px; }

/* ---------------------------------------------------------------- 顶栏 */
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { max-width: 1360px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; }
.brand svg { color: var(--accent); }
.brand:hover { text-decoration: none; color: var(--text); }
.nav { display: flex; gap: 2px; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 9px 13px; border-radius: 8px; color: var(--text-2); white-space: nowrap; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }
.nav a:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.badge { background: var(--amber); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; line-height: 18px; }
:root[data-theme="dark"] .badge { color: #15171B; }
.top-actions { display: flex; align-items: center; gap: 2px; }

/* ---------------------------------------------------------------- 页面骨架 */
.page { max-width: 1360px; margin: 0 auto; padding: 24px 24px 64px; }
.view { display: none; }
.view.on { display: block; }
.narrow { max-width: 760px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; margin-bottom: 20px; }
.page-head h1, .h1 { font-size: 28px; font-weight: 700; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-main { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.col-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.panel-head h2 { font-size: 17px; }
.panel-foot { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.panel-foot a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.panel.dark { background: #1A1C20; color: #F5F4EF; border-color: #1A1C20; }
:root[data-theme="dark"] .panel.dark { background: #0F1114; border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .panel.dark { background: #0F1114; border-color: var(--line); } }

/* 今天：轨道卡片 */
.track-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.track { background: var(--panel); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.track:last-child:nth-child(odd) { grid-column: 1 / -1; }
.track:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.track .kicker { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.track .dot { width: 8px; height: 8px; border-radius: 4px; flex: none; }
.track strong { font-size: 16px; line-height: 1.45; }
.track .sub { font-size: 13px; color: var(--muted); }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.mini { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.mini:hover { text-decoration: none; color: var(--text); background: var(--sunk); }
.mini .k { font-size: 13px; color: var(--muted); }
.empty-note { color: var(--muted); font-size: 14px; padding: 6px 0; }

.bignums { display: flex; gap: 24px; }
.bignums div { display: flex; flex-direction: column; }
.bignums b { font-size: 36px; line-height: 1.1; }
.bignums span { font-size: 13px; color: #B9BCC2; }
.mint { color: #9FD3BF; } .gold { color: #F0C987; }
.deck-due { display: flex; flex-direction: column; font-size: 14px; }
.deck-due a { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-top: 1px solid #33363C; color: #F5F4EF; }
.deck-due a span:last-child { color: #B9BCC2; white-space: nowrap; }
.deck-due a:hover { text-decoration: none; color: #9FD3BF; }

.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, minmax(0, 1fr)); gap: 4px; }
.heat i { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--h0); }
.heat i.h1 { background: var(--h1); } .heat i.h2 { background: var(--h2); } .heat i.h3 { background: var(--h3); } .heat i.h4 { background: var(--h4); }
.heat i.pad { visibility: hidden; }
.heat-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.heat-legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; background: var(--h0); }
.heat-legend i.h1 { background: var(--h1); } .heat-legend i.h2 { background: var(--h2); } .heat-legend i.h3 { background: var(--h3); } .heat-legend i.h4 { background: var(--h4); }
.link-list { display: flex; flex-direction: column; font-size: 14px; }
.link-list a { padding: 8px 0; border-top: 1px solid var(--line-2); display: flex; justify-content: space-between; gap: 8px; }
.link-list a:first-child { border-top: 0; }
.link-list .muted { white-space: nowrap; }

/* ---------------------------------------------------------------- 复习 */
.review-view.on { display: flex; justify-content: center; }
.review-shell { width: 100%; min-width: 0; max-width: 680px; display: flex; flex-direction: column; gap: 12px; min-height: calc(100vh - 140px); }
.review-top { display: flex; align-items: center; gap: 10px; }
.review-meta { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress span { display: block; height: 4px; width: 0; background: var(--accent); transition: width .2s; }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: var(--sunk); border-radius: 10px; padding: 4px; }
.segmented button { min-height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.segmented button.on { background: var(--panel); color: var(--text); font-weight: 700; }

.flash { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px; min-height: 360px; }
.flash.empty { justify-content: center; align-items: center; text-align: center; }
.flash-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-s { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--panel-2); color: var(--text-2); }
.chip-s.leech { background: var(--amber-soft); color: var(--amber-ink); }
.chip-s.new { background: var(--accent-soft); color: var(--accent-ink); }
.flash-q { font-size: 20px; line-height: 1.55; font-weight: 700; white-space: pre-wrap; overflow-wrap: anywhere; }
.flash-q code { font-size: .85em; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.flash-a { overflow-wrap: anywhere; }
.think { margin: auto 0; }
.flash-a { border-top: 1px dashed var(--line); padding-top: 14px; font-size: 15.5px; line-height: 1.7; }
.flash-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: auto; }
.lang-front { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 12px 0; }
.play { width: 76px; height: 76px; border-radius: 38px; border: 0; background: var(--lang); color: #fff; display: flex;
  align-items: center; justify-content: center; cursor: pointer; }
.play:disabled { opacity: .4; }
.lang-text { font-family: var(--ja); font-size: 24px; line-height: 2; text-align: center; margin: 0; }
.lang-text rt { font-size: 11px; color: var(--muted); }

.review-actions { position: sticky; bottom: 0; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); background: var(--bg); }
.grades { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grades.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grades button { min-height: 58px; border-radius: 12px; font: inherit; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; cursor: pointer; border: 1px solid transparent; }
.grades button span { font-size: 12px; opacity: .85; }
.g1 { background: var(--bad); color: #fff; }
.g2 { background: var(--amber-soft); color: var(--amber-ink); border-color: var(--amber-line) !important; }
.g3 { background: var(--accent); color: #fff; }
.g4 { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line) !important; }
:root[data-theme="dark"] .g3, :root[data-theme="dark"] .g1 { color: #15171B; }

/* 答案里的 Markdown */
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 1.3em; }
.md li { margin: 2px 0; }
.md h3, .md h4, .md h5 { font-size: 15px; margin: 12px 0 6px; }
.md blockquote { margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--line); color: var(--text-2); }
.md code { font: 13px var(--mono); background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--code-bg); border-radius: 10px; padding: 12px 14px; overflow-x: auto; margin: 0 0 10px; }
.md pre code { padding: 0; background: none; font-size: 12.5px; line-height: 1.6; }
.table-wrap { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 14px; margin: 0 0 10px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.t-com { color: var(--t-com); font-style: italic; } .t-str { color: var(--t-str); } .t-num { color: var(--t-num); }
.t-kw { color: var(--t-kw); font-weight: 600; } .t-typ { color: var(--t-typ); } .t-fn { color: var(--t-fn); } .t-pre { color: var(--t-pre); }

/* ---------------------------------------------------------------- 牌组 */
.deck-tree { flex: 1 1 280px; padding: 12px; gap: 2px; position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow: auto; }
.deck-tree .panel-head { padding: 6px 8px 10px; }
.deck-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 42px; padding-right: 8px;
  border-radius: 8px; color: var(--text); }
.deck-row:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.deck-row.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.deck-row.top { font-weight: 700; }
.deck-row .cnt { font-size: 13px; color: var(--muted); white-space: nowrap; font-weight: 400; }
.deck-row .cnt b { color: var(--amber); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.chip input { width: auto; min-height: 0; }
.filters { justify-content: space-between; }
.filters input[type=search] { max-width: 280px; }
.cards-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.cards-table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 12px 10px; border-bottom: 1px solid var(--line); }
.cards-table td { padding: 12px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.cards-table th:first-child, .cards-table td:first-child { padding-left: 18px; }
.cards-table tr { cursor: pointer; }
.cards-table tbody tr:hover { background: var(--panel-2); }
.cards-table td.q { max-width: 420px; }
.cards-table td.nw { white-space: nowrap; color: var(--text-2); }
.st { font-size: 12px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.st-new { background: var(--panel-2); color: var(--text-2); }
.st-learn { background: var(--blue-soft); color: var(--blue-ink); }
.st-due { background: var(--amber-soft); color: var(--amber-ink); }
.st-ok { background: var(--accent-soft); color: var(--accent-ink); }
.st-leech { background: var(--bad-soft); color: var(--bad-ink); }
.st-off { background: var(--panel-2); color: var(--muted); text-decoration: line-through; }

/* ---------------------------------------------------------------- 统计 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.tile .k { font-size: 13px; color: var(--muted); }
.tile b { font-size: 30px; line-height: 1.2; }
.tile .n { font-size: 13px; color: var(--text-2); }
.forecast { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; align-items: end; height: 200px; }
.fc { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 3px; }
.fc .v { font-size: 11px; color: var(--muted); text-align: center; }
.fc i { display: block; border-radius: 3px; min-height: 0; }
.fc i.t { background: var(--accent); } .fc i.l { background: var(--lang-soft); }
.fc-days { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; font-size: 11px; color: var(--muted); text-align: center; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.ret { display: flex; flex-direction: column; gap: 6px; }
.ret .row-between { font-size: 14px; }
.ret .track-bar { height: 8px; background: var(--sunk); border-radius: 4px; overflow: hidden; }
.ret .track-bar span { display: block; height: 8px; border-radius: 4px; background: var(--accent); }
.ret .track-bar span.low { background: var(--amber); }
.weak-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--line-2); font-size: 14px; cursor: pointer; }
.weak-row:hover { color: var(--accent); }

/* ---------------------------------------------------------------- 列表（手撕、导入预览） */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.item:hover { border-color: var(--muted); }
.item.due { border-color: var(--amber-line); background: var(--amber-soft); }
.item-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.item-q { flex: 1 1 240px; font-weight: 600; }
.item-sub { font-size: 13px; color: var(--muted); }
.kstate { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); color: var(--text-2); }
.kstate.practicing { background: var(--blue-soft); color: var(--blue-ink); }
.kstate.once { background: var(--amber-soft); color: var(--amber-ink); }
.kstate.mastered { background: var(--accent-soft); color: var(--accent-ink); }
.attempt { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.attempt .ok { color: var(--accent); } .attempt .no { color: var(--bad); }
.attempt .del { margin-left: auto; width: 32px; height: 32px; }
.dots { display: flex; gap: 3px; margin-top: 6px; flex-wrap: wrap; }
.dots i { width: 10px; height: 10px; border-radius: 2px; background: var(--accent); }
.dots i.no { background: var(--bad); }
.import-result { display: flex; flex-direction: column; gap: 8px; max-height: 40vh; overflow: auto; }
.preview-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.preview-card.exists { opacity: .6; }
.pill { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--panel-2); }

/* ---------------------------------------------------------------- 弹窗、提示 */
.modal { position: fixed; inset: 0; background: rgba(15, 17, 20, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-box { width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border-radius: 16px;
  padding: 22px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); }
.modal-box.wide-box { max-width: 860px; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--on-ink);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 60; max-width: calc(100vw - 32px); }

/* ---------------------------------------------------------------- 手机 */
@media (max-width: 720px) {
  .topbar-in { padding: 8px 16px; gap: 4px 12px; }
  .brand { font-size: 16px; }
  .nav { order: 3; flex-basis: 100%; }
  .page { padding: 16px 16px 48px; }
  .page-head h1, .h1 { font-size: 22px; }
  .track-grid { grid-template-columns: minmax(0, 1fr); }
  .deck-tree { position: static; max-height: none; }
  body.reviewing .topbar { display: none; }
  body.reviewing .page { padding-top: 8px; }
  .review-shell { min-height: calc(100vh - 24px); }
  .flash { padding: 16px; }
  .flash-q { font-size: 18px; }
  .forecast { gap: 3px; } .fc-days { gap: 3px; }
}
