:root {
  --bg: #f5f6fa; --card: #ffffff; --ink: #1f2330; --sub: #5f6678; --line: #e3e6ee;
  --pri: #3b5bdb; --pri-soft: #e7ecff; --ok: #2b8a3e; --ok-soft: #e3f6e8; --ng: #c92a2a; --ng-soft: #fdecec;
  --warn: #e67700; --a: #3b5bdb; --b: #0c8599; --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 2px 8px rgba(20, 30, 60, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161c; --card: #1d2029; --ink: #e8eaf0; --sub: #a2a8b8; --line: #2c3040;
    --pri: #7b93ff; --pri-soft: #242c4a; --ok: #69db7c; --ok-soft: #1c3324; --ng: #ff8787; --ng-soft: #3a1f22;
    --a: #7b93ff; --b: #3bc9db; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #14161c; --card: #1d2029; --ink: #e8eaf0; --sub: #a2a8b8; --line: #2c3040;
  --pri: #7b93ff; --pri-soft: #242c4a; --ok: #69db7c; --ok-soft: #1c3324; --ng: #ff8787; --ng-soft: #3a1f22;
  --a: #7b93ff; --b: #3bc9db; --shadow: none;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 16px; line-height: 1.7; padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; }
.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: var(--card); border-bottom: 1px solid var(--line);
}
.bar h1 { flex: 1; margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back, .icon-btn { border: 0; background: none; font-size: 26px; line-height: 1; padding: 4px 8px; cursor: pointer; color: var(--pri); }
.icon-btn { font-size: 20px; color: var(--sub); }
main { max-width: 720px; margin: 0 auto; padding: 16px; outline: none; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px 0 4px; font-size: 11px;
  color: var(--sub); text-decoration: none; position: relative;
}
.tabs a span { font-size: 20px; line-height: 1.2; }
.tabs a.on { color: var(--pri); font-weight: 700; }
.tabs b {
  position: absolute; top: 2px; left: 55%; background: var(--ng); color: #fff; font-size: 10px; border-radius: 9px;
  padding: 0 5px; min-width: 18px; text-align: center;
}
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); }
.hero { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; text-align: center; }
.hero .n { font-size: 26px; font-weight: 800; line-height: 1.2; }
.hero .l { font-size: 12px; color: var(--sub); }
h2 { font-size: 15px; margin: 20px 4px 8px; color: var(--sub); font-weight: 700; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.subj { display: block; text-decoration: none; color: inherit; padding: 12px; }
.subj .tag { display: inline-block; font-size: 11px; font-weight: 800; color: #fff; border-radius: 6px; padding: 0 6px; margin-right: 6px; }
.subj .tag.A { background: var(--a); } .subj .tag.B { background: var(--b); }
.subj .nm { font-weight: 700; font-size: 14px; line-height: 1.4; margin-top: 4px; }
.subj .meta { font-size: 12px; color: var(--sub); margin-top: 6px; }
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--pri); border-radius: 3px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 12px;
  padding: 14px; font-weight: 700; background: var(--pri); color: #fff; cursor: pointer; margin-bottom: 10px; text-decoration: none;
  font-size: 16px;
}
.btn.ghost { background: var(--pri-soft); color: var(--pri); }
.btn.line { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .45; cursor: default; }
.btn small { font-weight: 400; opacity: .85; }
.menu-list a { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.menu-list a:last-child { border-bottom: 0; }
.menu-list a em { font-style: normal; color: var(--sub); font-size: 13px; }
.progress-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--sub); margin-bottom: 8px; }
.stem { font-size: 17px; font-weight: 600; margin: 4px 0 14px; white-space: pre-wrap; }
.topic-chip { display: inline-block; font-size: 12px; background: var(--pri-soft); color: var(--pri); border-radius: 20px; padding: 1px 10px; }
.choice {
  display: flex; gap: 10px; width: 100%; text-align: left; border: 2px solid var(--line); background: var(--card);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; font-size: 15.5px; line-height: 1.6;
}
.choice .no { flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--line); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.choice.sel { border-color: var(--pri); }
.choice.ok { border-color: var(--ok); background: var(--ok-soft); }
.choice.ok .no { background: var(--ok); color: #fff; }
.choice.ng { border-color: var(--ng); background: var(--ng-soft); }
.choice.ng .no { background: var(--ng); color: #fff; }
.choice[disabled] { cursor: default; }
.choice .note { display: block; font-size: 13px; color: var(--sub); margin-top: 6px; }
.verdict { font-size: 20px; font-weight: 800; margin: 6px 0; }
.verdict.ok { color: var(--ok); } .verdict.ng { color: var(--ng); }
.expl { background: var(--pri-soft); border-radius: 12px; padding: 12px 14px; margin: 10px 0 14px; font-size: 15px; }
.expl b { display: block; font-size: 13px; color: var(--pri); margin-bottom: 4px; }
.kw { display: inline-block; font-size: 12px; border: 1px solid var(--line); border-radius: 20px; padding: 0 8px; margin: 2px 4px 2px 0; color: var(--sub); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.flash { min-height: 260px; display: flex; flex-direction: column; justify-content: center; text-align: center; cursor: pointer; }
.flash .term { font-size: 24px; font-weight: 800; line-height: 1.4; }
.flash .yomi { color: var(--sub); font-size: 13px; }
.flash .def { text-align: left; margin-top: 14px; font-size: 15px; }
.flash .point { text-align: left; font-size: 14px; background: var(--pri-soft); border-radius: 10px; padding: 8px 12px; margin-top: 10px; }
.hint { color: var(--sub); font-size: 13px; text-align: center; margin: 8px 0; }
.note-topic summary { font-weight: 700; cursor: pointer; padding: 6px 0; }
.note-topic dl { margin: 6px 0 0; }
.note-topic dt { font-weight: 700; margin-top: 10px; }
.note-topic dd { margin: 2px 0 0; font-size: 14.5px; }
.note-topic dd .p { color: var(--sub); font-size: 13.5px; }
.result-big { text-align: center; }
.result-big .pct { font-size: 44px; font-weight: 800; line-height: 1.1; }
.pass { color: var(--ok); font-weight: 800; } .fail { color: var(--ng); font-weight: 800; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t td, table.t th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: left; }
table.t td.n, table.t th.n { text-align: right; white-space: nowrap; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.check-list label { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.check-list input { width: 20px; height: 20px; }
.empty { text-align: center; color: var(--sub); padding: 30px 10px; }
input[type="date"], input[type="search"] {
  font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); width: 100%;
}
.star { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--sub); padding: 0 4px; }
.star.on { color: #f59f00; }
.small { font-size: 13px; color: var(--sub); }
.cal { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; }
.cal i { aspect-ratio: 1; border-radius: 3px; background: var(--line); }
.cal i.l1 { background: #a5b4fc; } .cal i.l2 { background: #6d83f2; } .cal i.l3 { background: var(--pri); }
