:root {
  --fg: #1f2937; --muted: #6b7280; --line: #e5e7eb; --bg: #f8fafc; --card: #fff;
  --blue: #1d4ed8; --blue-bg: #eff6ff; --ok: #047857; --ok-bg: #ecfdf5; --ng: #b91c1c; --ng-bg: #fef2f2;
  --warn: #92400e; --warn-bg: #fffbeb;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif; color: var(--fg); background: var(--bg); line-height: 1.7; }
a { color: var(--blue); }
button { font: inherit; cursor: pointer; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; background: var(--blue); color: #fff; }
.brand { color: #fff; font-weight: 700; text-decoration: none; }
.brand small { font-weight: 400; font-size: 12px; opacity: .85; margin-left: 4px; }
.exam-switch button { border: 1px solid #fff; background: transparent; color: #fff; padding: 2px 12px; }
.exam-switch button:first-child { border-radius: 6px 0 0 6px; }
.exam-switch button:last-child { border-radius: 0 6px 6px 0; }
.exam-switch button.on { background: #fff; color: var(--blue); font-weight: 700; }
main { max-width: 820px; margin: 0 auto; padding: 16px; }
.foot { max-width: 820px; margin: 24px auto; padding: 0 16px 32px; font-size: 12px; color: var(--muted); }
h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 17px; margin: 20px 0 8px; }
.muted { color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile { display: block; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); text-decoration: none; color: var(--fg); text-align: left; width: 100%; }
.tile b { display: block; font-size: 16px; }
.tile span { font-size: 13px; color: var(--muted); }
.tile.accent { border-color: var(--blue); background: var(--blue-bg); }
.list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list a, .list button.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; text-decoration: none; color: var(--fg); background: none; border: 0; width: 100%; text-align: left; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--blue); }
.btn { display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--blue); background: var(--blue); color: #fff; text-decoration: none; }
.btn.sub { background: #fff; color: var(--blue); }
.btn:disabled { opacity: .45; cursor: default; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.qhead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.chip { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 12px; background: #f3f4f6; color: #374151; }
.chip.blue { background: var(--blue-bg); color: var(--blue); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.star { margin-left: auto; border: 0; background: none; font-size: 22px; color: #9ca3af; line-height: 1; }
.star.on { color: #f59e0b; }
.qtext p { margin: 0 0 8px; }
.qimg { margin: 8px 0 12px; }
.qimg img { width: 100%; max-width: 620px; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.qimg figcaption { font-size: 12px; color: var(--muted); }
.choices { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.choices button { width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.choices button.sel { border-color: var(--blue); background: var(--blue-bg); }
.choices button.right { border-color: var(--ok); background: var(--ok-bg); }
.choices button.wrong { border-color: var(--ng); background: var(--ng-bg); }
.sess { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; }
.sess-info { display: flex; flex-direction: column; gap: 2px; }
.sess-btns { display: flex; gap: 8px; }
.sess-btns .btn, .list .sess-btns a.btn { display: inline-block; width: auto; padding: 7px 12px; font-size: 14px; white-space: nowrap; border: 1px solid var(--blue); }
.list .sess-btns a.btn.sub { color: var(--blue); background: #fff; }
.all-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 12px; }
.all-list .solo { margin-left: auto; font-size: 13px; }
.opts { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; }
.opts li { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.opts li.right { border-color: var(--ok); background: var(--ok-bg); }
.all-list details { margin-top: 8px; }
.all-list summary { cursor: pointer; color: var(--blue); padding: 6px 0; }
.result { padding: 10px 12px; border-radius: 8px; margin: 12px 0; font-weight: 700; }
.result.ok { background: var(--ok-bg); color: var(--ok); }
.result.ng { background: var(--ng-bg); color: var(--ng); }
.result.ex { background: #f3f4f6; color: #374151; }
.explain { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.explain p { margin: 8px 0; }
.explain ul { padding-left: 1.2em; margin: 6px 0; }
.explain table { border-collapse: collapse; font-size: 14px; margin: 8px 0; display: block; overflow-x: auto; }
.explain td, .explain th { border: 1px solid var(--line); padding: 4px 8px; }
.term { border: 0; padding: 0; background: none; color: inherit; border-bottom: 2px solid #facc15; }
.ref { text-decoration: underline; }
.notice { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); margin: 8px 0; }
.nav { display: flex; justify-content: space-between; gap: 8px; margin: 16px 0; position: sticky; bottom: 0; background: var(--bg); padding: 8px 0; }
.sheet { position: fixed; right: 0; top: 0; bottom: 0; width: min(420px, 100%); background: #fff; border-left: 1px solid var(--line); z-index: 10; overflow-y: auto; padding: 16px; box-shadow: -4px 0 16px rgba(0,0,0,.08); }
.sheet-close { float: right; border: 0; background: none; font-size: 24px; }
.sheet img { max-width: 100%; }
@media (max-width: 640px) {
  .sheet { top: auto; height: 70vh; width: 100%; border-left: 0; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; }
}
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.palette { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 8px 0; }
.palette a { text-align: center; font-size: 12px; padding: 4px 0; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; color: var(--fg); background: #fff; }
.palette a.done { background: var(--blue-bg); border-color: var(--blue); }
.palette a.cur { outline: 2px solid var(--blue); }
.score { font-size: 28px; font-weight: 700; }
.pass { color: var(--ok); } .fail { color: var(--ng); }
select { font: inherit; padding: 6px; border-radius: 6px; border: 1px solid var(--line); }
.cta { border: 1px dashed var(--blue); background: var(--blue-bg); border-radius: 10px; padding: 12px 14px; margin: 16px 0; font-size: 14px; }
