:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel2: #1e2740;
  --line: #2b3550;
  --fg: #e7ecf5;
  --muted: #97a3bd;
  --accent: #4f8cff;
  --green: #2fbf71;
  --green-bg: #12331f;
  --red: #ef5350;
  --red-bg: #351416;
  --gold: #e0a92b;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.65;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 24px 18px 80px; }
header h1 { font-size: 1.25rem; margin: 0 0 2px; }
header .sub { color: var(--muted); font-size: .82rem; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
h2 { font-size: 1rem; margin: 0 0 14px; }
label.field { display: block; font-size: .85rem; color: var(--muted); margin: 14px 0 6px; }
select, button, input { font: inherit; }
select {
  width: 100%; padding: 9px 10px; background: var(--panel2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 130px; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 9px; padding: 9px 11px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: .9rem; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.check .n { margin-left: auto; color: var(--muted); font-size: .8rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; background: var(--accent); color: #fff; border: none;
  border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .95rem;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--fg); font-weight: 500; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.hint { color: var(--muted); font-size: .8rem; }

/* badges */
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.badge { font-size: .72rem; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--panel2); }
.badge.official { color: #0c1a10; background: var(--green); border-color: var(--green); font-weight: 700; }
.badge.unofficial { color: var(--gold); border-color: #5a4a1e; }
.badge.dom { color: var(--accent); border-color: #2c3d63; }

/* quiz */
.progress { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: .85rem; color: var(--muted); }
.bar { height: 6px; background: var(--panel2); border-radius: 4px; overflow: hidden; margin-bottom: 18px; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.qtext { font-size: 1.02rem; white-space: pre-wrap; margin-bottom: 18px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; gap: 11px; padding: 13px 14px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; text-align: left; color: var(--fg);
  transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--accent); }
.opt .key { flex: 0 0 22px; height: 22px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: .8rem; color: var(--muted); font-weight: 700; }
.opt.sel { border-color: var(--accent); background: #16233f; }
.opt.sel .key { background: var(--accent); color: #fff; border-color: var(--accent); }
.opt.correct { border-color: var(--green); background: var(--green-bg); }
.opt.correct .key { background: var(--green); color: #072; border-color: var(--green); }
.opt.wrong { border-color: var(--red); background: var(--red-bg); }
.opt.wrong .key { background: var(--red); color: #400; border-color: var(--red); }
.opt .body { flex: 1; }
.opt .expl { margin-top: 7px; font-size: .84rem; color: var(--muted); display: none; }
.opt.revealed .expl { display: block; }
.verdict { margin: 16px 0 4px; font-weight: 700; }
.verdict.ok { color: var(--green); }
.verdict.ng { color: var(--red); }

/* result */
.score { font-size: 2.4rem; font-weight: 800; }
.score small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.dombreak { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.dombreak .drow { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.dombreak .dn { flex: 1; }
.dombreak .db { flex: 0 0 120px; height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.dombreak .db > i { display: block; height: 100%; background: var(--green); }
.review-item { border-top: 1px solid var(--line); padding: 14px 0; }
.review-item .q { font-size: .92rem; white-space: pre-wrap; margin-bottom: 8px; }
.review-item .a { font-size: .85rem; }
.review-item .a.good { color: var(--green); }
.review-item .a.bad { color: var(--red); }
.hidden { display: none !important; }
kbd { background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-size: .78rem; }
