/* 旧国名クイズ固有の見た目（共通は ../common/base.css。作りは都道府県クイズと同じ）。地図の地はダーク表示でも明るいまま（盤と同じ扱い）
   落ち着いた和の見た目: 国の塗りは和紙に近いくすんだ色（生成り・若草・薄紅・藤・刈安）、海は薄い藍鼠、線は墨色 */
[hidden] { display: none !important; }
:root {
  --sea: #D3DEE2; --edge: #4A4A48; --pedge: #8C6A4A; --ctx: #E3E0D8;
  --c0: #EFE3C8; --c1: #D9E4C3; --c2: #F0D5CC; --c3: #DDD7E8; --c4: #F1E7B8;
  --hl: #F0A23B; --hl-edge: #7A4A0C; --okf: #7CC795; --okf-edge: #1F6B3E; --ngf: #F0A29A; --ngf-edge: #9E2F2F;
}
.stage { -webkit-user-select: none; user-select: none; }
.board-wrap { max-width: 640px; margin: 0 auto; }
ruby rt { font-size: .5em; font-weight: 400; }

/* ---------- 問題の行 ---------- */
.qhead { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; margin-bottom: 6px; }
.prog { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 18px; margin-bottom: 2px; }
.prog i {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); font-style: normal;
  font-size: 14px; line-height: 1; font-weight: 700; color: var(--bg); display: inline-flex; align-items: center; justify-content: center;
}
.prog i.now { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.prog i.ok { background: var(--ok); border-color: var(--ok); }
.prog i.ng { background: var(--ng); border-color: var(--ng); }
.prog i.ok::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--bg); }
.prog i.ng::after { content: '×'; }
.ask { margin: 2px 0 0; font-size: 18px; font-weight: 700; text-align: center; min-height: 1.7em; line-height: 1.5; }
.ask b.big { font-size: clamp(22px, 6vw, 28px); color: var(--accent); }
.ask .ok { color: var(--ok); }
.ask.ng { color: var(--ng); }
.ask .alias { font-size: .7em; color: var(--ink-sub); margin-left: 2px; font-weight: 700; }

/* ---------- 地図 ---------- */
.map-box { position: relative; background: var(--sea); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.jmap { display: block; width: 100%; height: auto; max-height: 62vh; margin: 0 auto; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.jmap.zoomed { touch-action: none; cursor: grab; }
.jmap.panning { cursor: grabbing; }
.jmap .sea { fill: var(--sea); }
.jmap .ctx-land { fill: var(--ctx); stroke: #A8A69F; stroke-width: .8px; vector-effect: non-scaling-stroke; }
.jmap .kuni { stroke-width: .6px; vector-effect: non-scaling-stroke; stroke-linejoin: round; fill-rule: evenodd; }
.jmap .kuni[data-col="0"] { fill: var(--c0); stroke: var(--c0); }
.jmap .kuni[data-col="1"] { fill: var(--c1); stroke: var(--c1); }
.jmap .kuni[data-col="2"] { fill: var(--c2); stroke: var(--c2); }
.jmap .kuni[data-col="3"] { fill: var(--c3); stroke: var(--c3); }
.jmap .kuni[data-col="4"] { fill: var(--c4); stroke: var(--c4); }
.jmap .kuni.ctx { fill: var(--ctx); stroke: var(--ctx); }
.jmap .kuni.hl, .jmap .kuni.show { fill: var(--hl); stroke: var(--hl); }
.jmap .kuni.show { animation: blink .7s ease-in-out infinite alternate; }
.jmap .kuni.ok { fill: var(--okf); stroke: var(--okf); }
.jmap .kuni.ng { fill: var(--ngf); stroke: var(--ngf); }
/* 海岸線: 区画を下にもう一度、墨色の太めの線で描く（上の塗りが内側を隠すので、海との境だけが線に見える） */
.jmap .coast use { fill: none; stroke: var(--edge); stroke-width: 1.8px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.jmap .kuni-line { fill: none; stroke: var(--edge); stroke-width: 1.1px; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.jmap .pref-line { fill: none; stroke: var(--pedge); stroke-width: 1px; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.jmap.no-pref .pref-line { display: none; }
.jmap .pref-hl { fill: var(--hl); fill-opacity: .45; stroke: #B5520F; stroke-dasharray: none; vector-effect: non-scaling-stroke; pointer-events: none; fill-rule: evenodd; }
.jmap .ring { fill: none; stroke: #D9480F; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.jmap .ring.show { animation: blink .7s ease-in-out infinite alternate; }
.jmap .hint-ring { fill: rgba(240, 162, 59, .12); stroke: #D9480F; stroke-dasharray: 8 6; vector-effect: non-scaling-stroke; pointer-events: none; }
.jmap .cap-o { fill: #FFFFFF; stroke: #1F2328; pointer-events: none; }
.jmap .cap-i { fill: #1F2328; pointer-events: none; }
.jmap .cap-t, .jmap .label { fill: #1F2328; font-weight: 700; dominant-baseline: central; paint-order: stroke; stroke: #FFFFFF; stroke-linejoin: round; pointer-events: none; }
.jmap .label { text-anchor: middle; }
.jmap .label.ng { fill: #8E2626; }
.jmap .label.ok { fill: #17522F; }
.jmap text { font-family: var(--font); }
@keyframes blink { from { opacity: 1; } to { opacity: .45; } }


/* 地図のすぐ下: ヒントと、拡大・縮小のボタン */
.map-tools { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; flex-wrap: wrap; }
.map-tools .spacer { flex: 1; }
.zoom { display: flex; gap: 6px; }
.zbtn {
  appearance: none; font: inherit; width: 44px; height: 44px; border-radius: var(--radius); border: 2px solid var(--line-strong);
  background: var(--surface); color: var(--accent); font-size: 24px; font-weight: 700; line-height: 1; cursor: pointer; padding: 0; touch-action: manipulation;
}
.zbtn.wide { width: auto; padding: 0 12px; font-size: 15px; }
.zbtn:disabled { opacity: .4; cursor: default; border-style: dashed; }
.zbtn:focus-visible { outline: 3px solid var(--warn); outline-offset: 1px; }

/* ---------- 4択 ---------- */
.choices4 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 640px; margin: 10px auto 0; }
.opt {
  appearance: none; font: inherit; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 6px 12px; text-align: left; position: relative;
  border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; touch-action: manipulation;
}
.opt .n { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); }
.opt .t { font-size: clamp(17px, 4.6vw, 22px); font-weight: 700; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
.opt .t.long { font-size: clamp(15px, 3.9vw, 19px); }
.opt .t .alias { font-size: .7em; color: var(--ink-sub); margin-left: 2px; }
.opt:hover:not([aria-disabled="true"]) { border-color: var(--accent); }
.opt:active:not([aria-disabled="true"]) { transform: translateY(1px); }
.opt:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.opt.ng { border-color: var(--ng); color: var(--ng); background: transparent; cursor: default; }
.opt.ng .t { text-decoration: line-through; text-decoration-thickness: 2px; }
.opt.ng .n { border-color: var(--ng); color: var(--ng); }
.opt.ng.shake { animation: shake .35s ease-out; }
.opt.ok { border-color: var(--ok); background: var(--ok); color: var(--bg); }
.opt.ok .n { border-color: var(--bg); color: var(--bg); background: transparent; }
.opt.ok .t .alias { color: var(--bg); }
.opt.show { border-color: var(--ok); border-width: 3px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
@keyframes shake { 20% { transform: translateX(-8px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } 100% { transform: none; } }

/* ---------- 国の説明（まちがえたとき）・ヒント ---------- */
.info, .hintbox {
  margin: 10px auto 0; max-width: 640px; box-sizing: border-box; border-radius: var(--radius); padding: 10px 12px; text-align: left;
  background: var(--surface); border: 2px solid var(--ng); color: var(--ink); font-size: 16px;
}
.hintbox { border: 2px dashed var(--warn); }
.hintbox p { margin: 0; }
.info-name { margin: 0; font-size: 21px; font-weight: 700; color: var(--ng); line-height: 1.5; }
.info-name .alias { font-size: .65em; color: var(--ink-sub); margin-left: 4px; }
.info-formal { margin: 0 0 4px; font-size: 14px; color: var(--ink-sub); }
.info-dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 4px 0 0; }
.info-dl dt { font-weight: 700; color: var(--ink-sub); font-size: 14px; padding-top: 2px; white-space: nowrap; }
.info-dl dd { margin: 0; line-height: 1.6; }
.info-dl dd small { color: var(--ink-sub); font-size: 14px; }
.info-picked { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 15px; }

.linkbtn { display: inline-flex; align-items: center; text-decoration: none; }
#next { min-width: 120px; }
.timer { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 18px; min-width: 64px; text-align: right; margin-left: auto; }
.turnbar .status { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-block; white-space: nowrap; font-size: 14px; font-weight: 700; padding: 0 8px; border-radius: 999px; border: 1.5px solid currentColor; margin-left: 6px; vertical-align: middle; color: var(--accent); }
.tag.retry { color: var(--ng); }
.callout { z-index: 5; top: 38%; }

/* ---------- 設定 ---------- */
.scopes .choice span .cnt { font-style: normal; font-size: 14px; color: var(--ink-sub); margin-left: 4px; font-weight: 400; }
.hint.found { margin: -4px 0 8px; }

/* ---------- 結果 ---------- */
.result-box { position: static; margin: 10px auto 0; max-width: 640px; }
.result-box .big { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.result-box .weak { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 6px 0 10px; }
.result-box .weak span { border: 2px solid var(--ng); border-radius: 6px; padding: 4px 8px; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.35; font-size: 14px; }
.result-box .weak span b { color: var(--ng); }
.credit { margin: 6px 0 0; font-size: 14px; }

/* ---------- 解説 ---------- */
.pref-table { font-size: 15px; }
.pref-table td small { color: var(--ink-sub); }

@media (max-width: 480px) {
  .stage { padding: 8px; }
  .qhead { min-height: 48px; }
  .ask { font-size: 16px; }
  .opt { min-height: 52px; padding: 4px 8px; gap: 6px; }
  .opt .n { width: 24px; height: 24px; }
  .info-name { font-size: 19px; }
  .controls .btn.icon { padding: 0 9px; }
  .map-tools { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .jmap .kuni.show, .jmap .ring.show, .opt.ng.shake { animation: none; }
}

/* ---------- 旧国名クイズ ---------- */
.result-box .best { color: var(--ok); }
.kinds .choice span { white-space: nowrap; }
.ask .sub { display: block; font-size: 15px; font-weight: 400; color: var(--ink-sub); }
.ask .shu { font-size: clamp(26px, 7vw, 34px); letter-spacing: .08em; }
.ask .kanji { font-size: clamp(30px, 8vw, 40px); letter-spacing: .12em; color: var(--accent); }
/* 読みの入力 */
.kana-form { display: flex; gap: 8px; max-width: 640px; margin: 10px auto 0; align-items: stretch; }
.kana-form input { flex: 1; min-width: 0; font: inherit; font-size: 22px; padding: 6px 12px; border: 2px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); min-height: 48px; box-sizing: border-box; }
.kana-form input:focus-visible { outline: 3px solid var(--warn); outline-offset: 1px; }
.kana-form input.ng { border-color: var(--ng); }
.kana-form .btn { min-width: 96px; }
.kana-note { max-width: 640px; margin: 4px auto 0; font-size: 14px; color: var(--ink-sub); }
.kana-tried { max-width: 640px; margin: 4px auto 0; font-size: 15px; color: var(--ng); }

/* iPhone の「連絡先を自動入力」を出さないため答えの欄は type=search（要望No.87）。検索欄の見た目は消す（一覧ページの検索欄はそのまま） */
.kana-form input[type=search]{-webkit-appearance:none;appearance:none}
.kana-form input[type=search]::-webkit-search-cancel-button,.kana-form input[type=search]::-webkit-search-decoration{display:none;-webkit-appearance:none}
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; --tb-rt: 11px; --tb-st-rt: 11px; }
@media (min-width: 375px) { .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
@media (min-width: 641px) { .turnbar { --tb-msg-lines: 1; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
