/* クイズの画面（国旗・動物 共通）。色・縁・影は harry.css の変数（あそび場の服）を使う */
#quiz { max-width: 680px; margin: 0 auto; padding: 22px 16px 8px; }
.q-h { font-size: 19px; font-weight: 800; margin: 28px 0 12px; }

/* ホーム */
.q-hero { position: relative; display: grid; grid-template-columns: clamp(88px, 24vw, 120px) 1fr; gap: 16px; align-items: center; background: linear-gradient(var(--sky-1), var(--sky-2)); border: var(--edge); border-radius: var(--radius); box-shadow: var(--pop); padding: 16px 18px 22px 10px; overflow: hidden; }
.q-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22px; border-top: var(--edge);
  background: radial-gradient(12px 7px at 12px 0, #fff 96%, transparent 100%) 0 4px / 24px 14px repeat-x, linear-gradient(#2E86E6, #1F5FAE); }
.q-hero > * { position: relative; z-index: 1; }
.q-hero .eyebrow { color: var(--ink); }
.q-hero h1 { font-size: clamp(25px, 6.6vw, 40px); letter-spacing: .02em; word-break: keep-all; font-weight: 800; margin: 0 0 4px; line-height: 1.3; }
.q-hero p { margin: 0 0 16px; color: var(--ink); }
.q-hero .q-harry { width: 100%; align-self: end; margin-bottom: -22px; z-index: 2; }
.q-harry { width: 96px; height: auto; display: block; }

.q-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.q-group { font: inherit; text-align: left; padding: 10px 12px; border-radius: var(--radius-s); border: var(--edge); background: var(--paper); color: var(--ink); cursor: pointer; display: grid; grid-template-columns: 52px 1fr; gap: 2px 10px; align-items: center; box-shadow: var(--pop-s); transition: transform .08s, box-shadow .08s; }
.q-group:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.q-group.on { background: var(--accent-soft); outline: 3px solid var(--accent); outline-offset: 2px; }
.q-gicon { grid-row: span 3; width: 52px; height: 52px; object-fit: cover; border-radius: 10px; border: 2px solid var(--line); background: var(--paper); }
.q-gicon.flag { height: 39px; object-fit: fill; border-radius: 4px; }
.q-gname { font-weight: 800; font-size: 16px; line-height: 1.4; }
.q-gn { font-size: 13px; color: var(--muted); line-height: 1.4; }
.q-gbest { font-size: 12px; color: var(--accent); font-weight: 800; line-height: 1.4; }

.q-seg { display: flex; border: var(--edge); border-radius: 99px; overflow: hidden; margin-bottom: 12px; background: var(--paper); box-shadow: var(--pop-s); }
.q-seg button { flex: 1; font: inherit; font-size: 15px; font-weight: 700; padding: 10px 6px; border: 0; border-left: 2px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
.q-seg button:first-child { border-left: 0; }
.q-seg button.on { background: var(--btn); color: var(--btn-ink); font-weight: 800; }
.q-lock { font-size: 12px; }

.q-start { width: 100%; margin-top: 22px; font-size: 21px; padding: 16px; }
.q-free { text-align: center; margin: 12px 0 0; }
.q-review { width: 100%; margin-top: 16px; }
.q-buyline { text-align: center; margin: 16px 0 0; font-weight: 800; }

/* 出題 */
.q-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 15px; }
.q-quit { font: inherit; font-size: 14px; font-weight: 700; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px 0; }
.q-prog { font-weight: 800; }
.q-score { color: var(--ok); font-weight: 800; }
.q-meter { height: 14px; background: var(--paper); border: var(--edge); border-radius: 99px; overflow: hidden; margin: 6px 0 16px; }
.q-meter span { display: block; height: 100%; background: var(--btn); border-right: 2px solid var(--line); transition: width .3s; }
.q-meter span[style="width:0%"] { border-right: 0; }
.q-card { background: var(--paper); border: var(--edge); border-radius: var(--radius); box-shadow: var(--pop); padding: 18px 16px 20px; margin-bottom: 18px; }
.q-ask { font-size: 20px; font-weight: 800; text-align: center; margin: 0 0 14px; }
.q-name { font-size: clamp(30px, 8vw, 44px); font-weight: 800; text-align: center; margin: 0; line-height: 1.3; color: var(--accent); }
.q-pic { display: grid; place-items: center; }
.q-img { display: block; max-width: 100%; user-select: none; -webkit-user-select: none; }
.q-pic .q-img { width: min(340px, 86%); }
.q-pic .q-img.photo { width: min(340px, 86%); aspect-ratio: 1; object-fit: cover; }
.q-img.flag { border: 2px solid var(--line); border-radius: 6px; }
.q-img.photo { border: 2px solid var(--line); border-radius: 14px; }

.q-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.q-opt { position: relative; font: inherit; font-size: 17px; font-weight: 800; min-height: 66px; padding: 10px 10px 10px 32px; border-radius: var(--radius-s); border: var(--edge); background: var(--paper); color: var(--ink); cursor: pointer; line-height: 1.4; box-shadow: var(--pop-s); transition: transform .08s, box-shadow .08s; }
.q-opt:hover:not(:disabled) { background: var(--ground-2); }
.q-opt:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.q-opt:disabled { cursor: default; }
.q-key { position: absolute; left: 8px; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--ground-2); font-size: 12px; line-height: 20px; text-align: center; color: var(--ink); font-weight: 800; }
.q-opt.ok { background: var(--ok-soft); color: var(--ok); outline: 3px solid var(--ok); outline-offset: 1px; }
.q-opt.ng { background: var(--ng-soft); color: var(--ng); }
.q-opt:disabled:not(.ok):not(.ng) { opacity: .6; }
.q-opts-img .q-opt { padding: 12px; display: grid; place-items: center; }
.q-img-s { width: 100%; max-width: 160px; margin: 0 auto; }
.q-img-s.photo { max-width: 140px; aspect-ratio: 1; object-fit: cover; }

.q-fb { min-height: 8px; }
.q-fbrow { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; margin-top: 18px; padding: 12px 16px; border-radius: var(--radius); border: var(--edge); }
.q-fbrow.is-ok { background: var(--ok-soft); }
.q-fbrow.is-ng { background: var(--ng-soft); }
.q-fbrow .q-harry { width: 84px; }
.q-fbrow p { margin: 0; }
.q-verdict { font-size: 26px; font-weight: 800; line-height: 1.3; }
.is-ok .q-verdict { color: var(--ok); }
.is-ng .q-verdict { color: var(--ng); }
.q-answer b { font-size: 19px; }
.q-en { margin-left: 8px; font-size: 13px; color: var(--muted); }
.q-where { font-size: 13px; }
.q-next { width: 100%; margin-top: 14px; font-size: 19px; padding: 14px; }
.q-pop { animation: qpop .35s ease-out; }
@keyframes qpop { 0% { transform: scale(.6) rotate(-6deg); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .q-pop { animation: none; } .q-meter span { transition: none; } }

/* けっか */
.q-result { text-align: center; }
.q-score-card { background: var(--ground); border: var(--edge); border-radius: var(--radius); box-shadow: var(--pop); padding: 18px 16px 22px; margin-bottom: 20px; }
.q-score-card .q-harry { width: 160px; margin: 0 auto; }
.q-total { font-size: 22px; font-weight: 800; margin: 10px 0 0; }
.q-total b { font-size: 52px; color: var(--accent); }
.q-msg { margin: 4px 0 0; font-weight: 700; }
.q-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.q-wrong { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; text-align: center; }
.q-wrong li { border: var(--edge); border-radius: var(--radius-s); padding: 10px; display: grid; gap: 6px; background: var(--paper); }
.q-wrong small { display: block; color: var(--muted); font-size: 12px; }
.q-wrong .q-img-s { max-width: 110px; }

/* ===== 出題中は1画面に収める（スクロールなし）=====
   ヘッダー・フッターを隠し、#quiz を画面の高さぴったりの縦の箱にする。
   問題の絵は残りの高さに合わせて縮み、答えたあとの結果と「つぎへ」は下から出る帯（その分だけ上が縮む） */
body.q-playing .top, body.q-playing .foot { display: none; }
body.q-playing { overflow: hidden; }
body.q-playing #quiz { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); transition: padding-bottom .2s; }
body.q-playing #quiz > .q-play { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.q-playing .q-meter { margin: 4px 0 10px; flex: none; }
body.q-playing .q-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin-bottom: 12px; padding: 12px; overflow: hidden; }
body.q-playing .q-ask { font-size: 18px; margin: 0 0 8px; flex: none; }
body.q-playing .q-pic { flex: 1; min-height: 0; position: relative; }
body.q-playing .q-pic .q-img { position: absolute; inset: 0; margin: auto; width: auto; height: auto; max-width: 100%; max-height: 100%; }
body.q-playing .q-pic .q-img.photo { aspect-ratio: 1; height: 100%; width: auto; max-width: 100%; }
body.q-playing .q-name { margin: auto 0; }
body.q-playing .q-opts { flex: none; }
body.q-playing .q-opt { min-height: 58px; }
/* 名前→絵（逆モード）：4つの絵は残りの高さで決める */
body.q-playing .q-card:has(.q-name) { flex: none; }
body.q-playing .q-opts-img { flex: 1 1 auto; min-height: 0; grid-template-rows: repeat(2, minmax(0, 1fr)); }
body.q-playing .q-opts-img .q-opt { min-height: 0; padding: 8px; overflow: hidden; position: relative; }
body.q-playing .q-opts-img .q-img-s { position: absolute; inset: 8px; margin: auto; max-width: calc(100% - 16px); max-height: calc(100% - 16px); width: auto; height: auto; }
body.q-playing .q-opts-img .q-img-s.photo { height: calc(100% - 16px); aspect-ratio: 1; }

/* 答えたあと：結果の帯を下に固定し、その分だけ上を縮める */
body.q-playing .q-fb { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; min-height: 0; }
body.q-playing .q-fb:empty { display: none; }
body.q-playing .q-fb > * { max-width: 680px; margin-left: auto; margin-right: auto; }
body.q-playing .q-fb { background: var(--paper); border-top: var(--edge); padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 0 rgba(0, 0, 0, .06); animation: qsheet .2s ease-out; }
body.q-playing .q-fbrow { margin-top: 0; padding: 6px 12px; grid-template-columns: 56px 1fr; gap: 10px; }
body.q-playing .q-fbrow .q-harry { width: 56px; height: 72px; object-fit: contain; }
body.q-playing .q-verdict { font-size: 21px; }
body.q-playing .q-answer b { font-size: 17px; }
body.q-playing .q-where { display: none; }
body.q-playing .q-next { margin-top: 8px; padding: 11px; font-size: 18px; }
@keyframes qsheet { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { body.q-playing .q-fb { animation: none; } }

/* 🔈 音のオン・オフ */
.q-sound { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper); font-size: 18px; line-height: 1; cursor: pointer; box-shadow: 0 2px 0 var(--line); padding: 0; }
.q-hero .q-sound { position: absolute; top: 10px; right: 10px; z-index: 3; }
.q-bar .q-sound { width: 36px; height: 36px; font-size: 16px; }

/* ===== 文字の問題（漢字クイズ：QUIZ_CONF.render = 'text'）=====
   問題のことばは教科書体ふうの Klee One で大きく。字数（--n）に合わせて字の大きさを決める（長い読みも1行に収める） */
.q-glabel { grid-row: span 3; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 10px; border: 2px solid var(--line);
  background: var(--accent); color: #fff; font-family: "Klee One", var(--display), sans-serif; font-weight: 600; line-height: 1;
  font-size: calc(46px / max(var(--n, 1), 1.8)); letter-spacing: -.02em; }
.q-word { margin: auto 0; text-align: center; font-family: "Klee One", var(--display), serif; font-weight: 600; line-height: 1.15; color: var(--ink);
  font-size: min(calc((min(100vw, 680px) - 96px) / var(--n, 2)), 128px); word-break: keep-all; overflow-wrap: anywhere; }
.q-word.q-yomi { font-family: var(--display); font-weight: 800; color: var(--accent); font-size: min(calc((min(100vw, 680px) - 96px) / var(--n, 2)), 64px); }
.q-card-t { min-height: 180px; display: flex; flex-direction: column; }
.q-opts-t .q-opt { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; padding-left: 30px; padding-right: 8px;
  font-size: clamp(12px, calc((min(100vw, 680px) / 2 - 64px) / var(--n, 4)), 24px); }
.q-opts-t .q-opt-k { font-family: "Klee One", var(--display), serif; font-weight: 600; font-size: clamp(14px, calc((min(100vw, 680px) / 2 - 64px) / var(--n, 2)), 36px); }
.q-ja { font-family: "Klee One", var(--display), serif; font-weight: 600; }
.q-yomi-s { font-weight: 700; margin-left: 2px; }
.q-lv { font-size: 13px; color: var(--muted); }
.q-wrong-t li { padding: 12px 8px; }
.q-wrong-t b { font-size: 26px; display: block; line-height: 1.3; }
.q-wrong-t small { font-size: 14px; }
.q-credit { max-width: 680px; margin: 18px auto 0; padding: 0 16px; font-size: 12px; color: var(--muted); text-align: center; }
body.q-playing .q-credit { display: none; }
body.q-playing .q-card-t { flex: 1 1 auto; min-height: 0; }
body.q-playing .q-word { font-size: min(calc((min(100vw, 680px) - 96px) / var(--n, 2)), 128px, 20dvh); }
body.q-playing .q-word.q-yomi { font-size: min(calc((min(100vw, 680px) - 96px) / var(--n, 2)), 64px, 12dvh); }
body.q-playing .q-opts-t .q-opt { min-height: 62px; }
body.q-playing .q-lv { display: block; font-size: 12px; }
/* レベルのタイルは小さいので、スマホでも2列に */
.q-groups-t { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.q-groups-t .q-group { grid-template-columns: 46px 1fr; padding: 8px 10px; }
.q-groups-t .q-glabel { width: 46px; height: 46px; }
.q-groups-t .q-gname { font-size: 15px; }
/* 広い画面で「つぎへ」が左に寄っていたのを帯のまん中に（.btn が inline のため auto の余白が効かなかった） */
body.q-playing .q-fb .q-next { display: block; max-width: 680px; margin-left: auto; margin-right: auto; }

/* ===== 地図（都道府県クイズ：pref/map.js）=====
   海はうすい水色・陸はうすい灰色・答えの県は赤。小さい県は赤い丸でかこむ。沖縄は左上の囲み */
.pm .pm-sea { fill: #EAF4FB; }
.pm .pm-land use { fill: #DDE3EA; stroke: #8E99A8; stroke-linejoin: round; }
.pm .pm-land use.pm-hi { fill: #E5383B; stroke: #7A1418; }
.pm .pm-inset { fill: none; stroke: #8E99A8; }
.pm .pm-mark { fill: none; stroke: #E5383B; }
.q-pic svg.map { display: block; width: min(440px, 100%); height: auto; margin: 0 auto; }
.q-opts-img svg.map, .q-wrong svg.map { display: block; width: 100%; height: auto; border: 2px solid var(--line); border-radius: 8px; }
.q-wrong svg.map { max-width: 130px; margin: 0 auto; }
.q-gmap { grid-row: span 3; width: 52px; height: 52px; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: #EAF4FB; }
.q-gmap svg { display: block; width: 100%; height: 100%; }
.q-gmap .pm-inset { display: none; }
body.q-playing .q-pic svg.map { position: absolute; inset: 0; margin: auto; width: 100%; height: 100%; max-width: 100%; max-height: 100%; }
body.q-playing .q-opts-img svg.map { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); max-width: none; max-height: none; border-radius: 6px; }
.q-opts-img svg.map { background: #EAF4FB; }
.q-opts-img .q-key { z-index: 2; }   /* 絵・地図の上にも番号を出す */
