:root {
  --bg: #f5f7fb; --card: #fff; --text: #1b2333; --muted: #667085; --line: #e4e8f0;
  --accent: #2f6fed; --accent-soft: #e8f0ff; --good: #1a9e5c; --warn: #e0a100; --bad: #d9432f;
  --heat-none: #dfe3ea; --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1420; --card: #171d2b; --text: #e6eaf2; --muted: #98a2b3; --line: #2a3242; --accent: #6b9cff; --accent-soft: #1d2a48; --heat-none: #2a3242; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif; font-size: 15px; line-height: 1.55; }
a { color: var(--accent); text-decoration: none; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: .3px; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.nav a.active, .nav a:hover { background: var(--accent-soft); color: var(--accent); }
.container { max-width: 1180px; margin: 0 auto; padding: 20px; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 6px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font-size: 34px; font-weight: 800; line-height: 1.1; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .s { font-size: 13px; color: var(--muted); }
.big { font-size: 46px; }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); } .muted { color: var(--muted); }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .c { fill: none; stroke: var(--line); stroke-width: 12; }
.ring .p { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; transition: stroke-dasharray .5s; }
.ring .t { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 26px; }
.ring .t small { font-size: 11px; color: var(--muted); font-weight: 600; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar-bg { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; position: relative; }
.bar-fg { height: 100%; background: var(--accent); border-radius: 4px; }
.bar-target { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--bad); left: 80%; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.pill.good { background: #e3f6ec; color: var(--good); } .pill.warn { background: #fff5d6; color: #8a6400; } .pill.bad { background: #fde7e4; color: var(--bad); } .pill.gray { background: var(--line); color: var(--muted); }
@media (prefers-color-scheme: dark) { .pill.good { background: #163b2a; } .pill.warn { background: #3b3113; color: #ffd76a; } .pill.bad { background: #43201b; } }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: none; }
.task .idx { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.task .body { flex: 1; min-width: 0; }
.task .title { font-weight: 700; }
.task .why { font-size: 13px; color: var(--muted); }
.task.done .title { text-decoration: line-through; color: var(--muted); }
button, .btn { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; font-weight: 600; font-size: 14px; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); }
button.sm, .btn.sm { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); width: 100%; }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 140px; }
.row.tight > * { flex: none; min-width: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { font-size: 10px; fill: var(--muted); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart .dot { fill: var(--accent); }
.chart .target { stroke: var(--bad); stroke-dasharray: 4 4; stroke-width: 1.5; }
.chart .bar { fill: var(--accent); opacity: .85; }
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.heat .cell { padding: 8px 10px; border-radius: 8px; color: #fff; font-size: 12px; font-weight: 600; min-height: 54px; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; }
.heat .cell .r { font-size: 18px; font-weight: 800; }
.heat .cell.none { color: var(--muted); }
.timer { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; margin: 10px 0; }
.miss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.miss-grid label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; margin: 0; color: var(--text); }
.miss-grid input { width: 60px; }
.miss-grid input[type=checkbox] { width: auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); z-index: 100; }
.empty { color: var(--muted); padding: 20px; text-align: center; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.list-actions { display: flex; gap: 6px; }
.stat-row { display: flex; gap: 20px; flex-wrap: wrap; }
.stat-row .kpi .v { font-size: 24px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; cursor: pointer; background: var(--card); color: var(--text); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.steps { display: flex; flex-direction: column; gap: 6px; }
.step { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.step.done { opacity: .6; }
.step .n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; flex: none; font-size: 13px; }
.step.done .n { background: var(--good); color: #fff; }
.step .b { flex: 1; }
.step .b small { color: var(--muted); }
.mastery { display: flex; flex-direction: column; gap: 6px; }
.mastery .m { display: grid; grid-template-columns: 130px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.mastery .m .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.yeargrid { display: flex; gap: 6px; flex-wrap: wrap; }
.yeargrid .y { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); text-align: center; min-width: 64px; }
.yeargrid .y b { display: block; font-size: 18px; }
.yeargrid .y.untried { color: var(--muted); } .yeargrid .y.correct b, .yeargrid .y.mastered b { color: var(--good); } .yeargrid .y.wrong b { color: var(--bad); } .yeargrid .y.review b { color: var(--warn); } .yeargrid .y.partial b { color: var(--accent); }
.qtext { white-space: pre-wrap; font-size: 16px; line-height: 1.7; padding: 14px; background: var(--bg); border-radius: 8px; }
.improve { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.improve .box { padding: 12px; border-radius: 8px; background: var(--bg); }
.improve .box h4 { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.improve .box .v { font-weight: 800; font-size: 18px; }
.explist .item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.explist .item:last-child { border-bottom: none; }
.explist .plat { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--line); color: var(--muted); flex: none; }
.rate button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.scroll { overflow-x: auto; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--accent-soft); }
.notice { font-size: 12px; color: var(--muted); padding: 8px 10px; background: var(--bg); border-radius: 8px; }
@media (max-width: 640px) { .kpi .v { font-size: 26px; } .big { font-size: 34px; } .card.hero { gap: 14px; } }
.auth { margin-left: auto; display: flex; align-items: center; gap: 8px; }
