:root {
  --bg: #f3f6f4;
  --card: #ffffff;
  --text: #1b2421;
  --muted: #5f6b67;
  --line: #dde5e1;
  --accent: #0f7b6c;
  --accent-ink: #ffffff;
  --warm: #e8742f;
  --ok: #16884a;
  --ng: #c63d32;
  --bar: #bfe3da;
  --soft: #e8f3ef;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121816;
    --card: #1c2421;
    --text: #e7eeeb;
    --muted: #9aa8a3;
    --line: #33403c;
    --accent: #3fbfa8;
    --accent-ink: #0d1412;
    --warm: #f29a5e;
    --ok: #4cc57f;
    --ng: #ef6f66;
    --bar: #24524a;
    --soft: #1f2e2a;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  line-height: 1.65;
}
a { color: var(--accent); }
.site-header, .site-footer { max-width: 680px; margin: 0 auto; padding: 12px 16px; }
.site-header { display: flex; align-items: center; gap: 8px; }
.logo { font-weight: 800; text-decoration: none; color: var(--text); letter-spacing: .5px; }
.logo b { color: var(--warm); }
.site-footer { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); padding-bottom: 32px; }
.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px; }
.screen { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px 16px; }
h1 { font-size: 24px; margin: 0 0 8px; line-height: 1.35; }
.lead { margin: 0 0 16px; }
.small { font-size: 12px; color: var(--muted); }

.btn {
  display: block; width: 100%; padding: 12px; margin: 8px 0;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-family: inherit;
  font-size: 16px; text-align: center; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.ghost { font-size: 14px; color: var(--muted); }

/* スタート画面 */
.games { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.game { border: 2px solid var(--line); border-radius: 12px; padding: 12px 10px; background: var(--card); color: var(--text);
  text-align: left; cursor: pointer; font-family: inherit; }
.game strong { display: block; font-size: 17px; }
.game span { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.game.on { border-color: var(--accent); background: var(--soft); }
.step { margin: 16px 0 4px; font-weight: 700; }
.ranges { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.ranges .btn { margin: 4px 0; text-align: left; padding: 10px 12px; }
.ranges .btn.wide { grid-column: 1 / -1; }
.ranges .btn .count { display: block; font-size: 12px; font-weight: 400; opacity: .8; }
.best { font-size: 13px; color: var(--muted); }

/* 出題画面 */
.progress { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.progress .score { margin-left: auto; font-weight: 700; color: var(--text); }
.tag { font-size: 12px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; }
.question { font-size: 18px; font-weight: 700; margin: 4px 0 12px; text-align: center; }

.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; }
.vs::after { content: "VS"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--warm); color: #fff; font-weight: 800; font-size: 13px; border-radius: 999px; padding: 4px 7px; pointer-events: none; }
.city { border: 2px solid var(--line); border-radius: 14px; padding: 18px 8px 14px; min-height: 160px;
  background: var(--card); color: var(--text); font-family: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2px; }
.city:hover:not(:disabled) { border-color: var(--accent); }
.city:disabled { cursor: default; }
.city .pref { font-size: 13px; color: var(--muted); }
.city .name { font-size: 24px; font-weight: 800; line-height: 1.25; word-break: keep-all; overflow-wrap: anywhere; }
.city .kind { font-size: 11px; color: var(--muted); }
.city .pop { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 6px; min-height: 1.5em; }
.city .chg { font-size: 12px; color: var(--muted); min-height: 1.4em; }
.city.win { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--card)); }
.city.win .pop { color: var(--ok); }
.city.lose .pop { color: var(--muted); }
.city.picked-wrong { border-color: var(--ng); }

.target { text-align: center; padding: 14px 8px; border-radius: 14px; background: var(--soft); margin-bottom: 10px; }
.target .pref { font-size: 14px; color: var(--muted); }
.target .name { font-size: 28px; font-weight: 800; line-height: 1.3; }
.choices .btn { font-size: 18px; font-variant-numeric: tabular-nums; }
.choices .btn.correct { border-color: var(--ok); color: var(--ok); font-weight: 700; }
.choices .btn.wrong { border-color: var(--ng); color: var(--ng); }
.choices .btn:disabled { cursor: default; }
.hint { background: var(--bg); padding: 8px 12px; border-radius: 8px; font-size: 14px; }

.feedback { margin-top: 10px; text-align: center; }
.feedback p { margin: 4px 0; }
.feedback .verdict { font-size: 20px; font-weight: 800; }
.feedback .verdict.ok { color: var(--ok); }
.feedback .verdict.ng { color: var(--ng); }

/* 結果画面 */
.judge { text-align: center; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.judge-emoji { font-size: 48px; line-height: 1.1; }
.judge-label { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.judge-score { margin: 0; font-size: 48px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.judge-score small { font-size: 20px; margin-left: 2px; }
.judge-title { margin: 4px 0 0; font-size: 22px; font-weight: 800; }
.judge-text { margin: 6px 0 8px; font-size: 14px; }
.share-title { margin: 20px 0 6px; font-weight: 700; }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sns { display: block; padding: 10px 4px; border-radius: 10px; border: 1px solid transparent; font-size: 14px; font-weight: 700;
  text-align: center; text-decoration: none; color: #fff; cursor: pointer; font-family: inherit; }
.sns-x { background: #000; }
.sns-line { background: #06c755; }
.sns-threads { background: #101010; }
.sns-bluesky { background: #1185fe; }
.sns-facebook { background: #1877f2; }
.sns-copy { background: var(--card); color: var(--text); border-color: var(--line); }
@media (prefers-color-scheme: dark) { .sns-x, .sns-threads { border-color: #555; } }
.review { padding-left: 0; list-style: none; font-size: 14px; }
.review li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.review .ok { color: var(--ok); font-weight: 700; }
.review .ng { color: var(--ng); font-weight: 700; }

/* 広告枠：AdSense導入までは非表示 */
.ad-slot { margin: 16px 0; }
.ad-slot:empty { display: none; }

/* 都道府県・ランキングページ */
.doc h1 { font-size: 22px; }
.doc h2 { font-size: 18px; margin-top: 28px; padding-left: 8px; border-left: 4px solid var(--accent); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.stat { background: var(--soft); border-radius: 10px; padding: 10px 12px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat .v.up { color: var(--ok); }
.stat .v.down { color: var(--ng); }
.stat .s { font-size: 12px; color: var(--muted); }
.facts li { margin: 4px 0; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.rank { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rank th { font-size: 12px; color: var(--muted); font-weight: 400; text-align: right; padding: 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.rank th.l { text-align: left; }
table.rank td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.rank td.l { text-align: left; white-space: normal; }
table.rank td.no { color: var(--muted); width: 2.5em; }
table.rank .up { color: var(--ok); }
table.rank .down { color: var(--ng); }
table.rank .bar { display: block; height: 4px; border-radius: 2px; background: var(--bar); margin-top: 3px; }
.pager { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; font-size: 14px; }
.pref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; padding: 0; list-style: none; }
.pref-grid a { display: block; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-size: 14px; }
