/* 漢字の読みクイズ固有の見た目（共通は ../common/base.css） */
[hidden] { display: none !important; }

.board-wrap { min-height: 240px; container-type: inline-size; }

/* ---------- 問題のカード（盤の地は明るいまま。文字の色は固定） ---------- */
.card {
  background: var(--board); color: #1F2328; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px 14px; text-align: center; min-height: 250px; display: flex; flex-direction: column; align-items: center;
}
.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 #C9C4B8; background: #FFFFFF; font-style: normal;
  font-size: 14px; line-height: 1; font-weight: 700; color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center;
}
.prog i.now { border-color: #2F5D8A; box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #2F5D8A; }
.prog i.ok { background: #2E7D4F; border-color: #2E7D4F; }
.prog i.ng { background: #B23A3A; border-color: #B23A3A; }
.prog i.ok::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #FFFFFF; }
.prog i.ng::after { content: '×'; }

.ask { margin: 4px 0 0; font-size: 17px; font-weight: 700; color: #5B616B; min-height: 1.5em; }
.ask.ok { color: #2E7D4F; }
.ask.ng { color: #B23A3A; }

/* ことば: 字ごとの箱（字の下に読みと「音」「訓」） */
.word { display: flex; justify-content: center; align-items: flex-start; gap: 2px; margin: 6px 0 2px; max-width: 100%; flex-wrap: nowrap; }
.word.pop { animation: pop-in .22s ease-out; }
.seg { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.seg .ch, .seg .chs { font-size: clamp(52px, 16cqw, 92px); line-height: 1.15; font-weight: 700; font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "BIZ UDMincho", serif; }
.seg.kana .ch { font-size: clamp(40px, 12cqw, 70px); font-weight: 700; color: #3B4048; padding-top: .18em; }
.seg .chs { display: flex; }
.word.long .seg .ch, .word.long .seg .chs { font-size: clamp(40px, 12cqw, 76px); }
.word.long .seg.kana .ch { font-size: clamp(30px, 9cqw, 56px); }
/* その学年の字（下線） */
.seg .ch.new { text-decoration: underline; text-decoration-color: #D9A21B; text-decoration-thickness: .07em; text-underline-offset: .12em; }
.seg .rd { display: flex; flex-direction: column; align-items: center; min-height: 3.2em; padding: 0 2px; }
.seg .rd .y { font-size: clamp(18px, 5cqw, 26px); font-weight: 700; letter-spacing: .02em; white-space: nowrap; min-height: 1.3em; }
.seg .rd.on .y { color: #2F5D8A; }
.seg .rd.kun .y { color: #A4561B; }
.seg.sp .rd .y { color: #6A3F8A; }
.seg .kind { font-size: 14px; font-weight: 700; border-radius: 999px; padding: 0 8px; line-height: 20px; margin-top: 2px; min-height: 20px; }
.seg.show .kind.on { background: #E3ECF5; color: #2F5D8A; }
.seg.show .kind.kun { background: #FBEBDD; color: #A4561B; }
.seg.show .kind.sp { background: #EFE6F5; color: #6A3F8A; }
.seg .kind ruby rt { font-size: 10px; }
.seg.show .rd .y { animation: fade-up .25s ease-out; }
@keyframes fade-up { from { transform: translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop-in { from { transform: scale(.9); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes shake { 20% { transform: translateX(-8px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } 100% { transform: none; } }

/* ひらがなの入力欄 */
.kana-line { width: 100%; max-width: 480px; margin: 4px auto 0; }
.kana-in {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 30px; font-weight: 700; text-align: center; letter-spacing: .06em;
  padding: 6px 10px; border: 3px solid #2F5D8A; border-radius: 10px; background: #FFFFFF; color: #1F2328; min-height: 56px;
}
.kana-in::placeholder { color: #9AA0A8; font-size: 18px; font-weight: 400; letter-spacing: 0; }
.kana-in:focus { outline: 3px solid #D9A21B; outline-offset: 2px; }
.kana-in.ok { border-color: #2E7D4F; background: #E6F3EA; color: #2E7D4F; }
.kana-in.ng { border-color: #B23A3A; }
.kana-in.shake { animation: shake .35s ease-out; }

/* まちがえたとき・ヒント */
.fb, .kbox {
  margin: 10px auto 0; max-width: 560px; width: 100%; box-sizing: border-box; border-radius: var(--radius); padding: 8px 12px; text-align: left;
  background: #FFFFFF; border: 2px solid #B23A3A; color: #1F2328; font-size: 17px;
}
.kbox { max-width: 560px; margin-top: 10px; background: var(--board); border-color: #B23A3A; }
.kbox.hintbox { border: 2px dashed #B7791F; }
.fb { padding: 6px 12px; }
.fb p, .kbox p { margin: 0 0 4px; }
.fb p:last-child { margin-bottom: 0; }
.usedmark { background: #FFF1C2; outline: 2px solid #D9A21B; border-radius: 3px; padding: 0 3px; }
.fb b.big { font-size: 1.3em; color: #B23A3A; }
.kbox .mean { font-size: 17px; line-height: 1.6; margin: 4px 0 0; }
.fb .sub, .kbox .t { color: #5B616B; font-size: 15px; font-weight: 700; }
.klist { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.klist li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 4px 0; border-top: 1px solid #ECE8DF; }
.klist .kk { font-size: 28px; font-weight: 700; font-family: "Hiragino Mincho ProN", "Yu Mincho", "BIZ UDMincho", serif; line-height: 1.1; }
.klist .kg { font-size: 14px; color: #5B616B; border: 1px solid #C9C4B8; border-radius: 999px; padding: 0 6px; }
.klist .kl { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.klist .kl b { font-size: 14px; border-radius: 999px; padding: 0 7px; line-height: 20px; }
.klist .kl b.on { background: #E3ECF5; color: #2F5D8A; }
.klist .kl b.kun { background: #FBEBDD; color: #A4561B; }
.klist .kl b ruby rt { font-size: 10px; }
.klist .r { font-size: 16px; padding: 0 4px; border-radius: 4px; }
.klist .r.used { background: #FFF1C2; font-weight: 700; outline: 2px solid #D9A21B; }
.klist .r.spr { color: #6A3F8A; }
.klist .r.none { color: #9AA0A8; }

/* ---------- 4択 ---------- */
.choices4 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 560px; margin: 12px auto 0; }
.opt {
  appearance: none; font: inherit; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 6px 12px; text-align: left;
  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; }
.opt .t { font-size: clamp(20px, 5.4vw, 27px); font-weight: 700; letter-spacing: .03em; word-break: break-all; }
.opt.long .t { font-size: clamp(17px, 4.4vw, 24px); letter-spacing: 0; }
.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; 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; }
/* 正解の選択肢: 成功の色の地に、白ではなく背景の色の文字（ライト・ダークとも 4.5:1 以上。D12） */
.opt.ok { border-color: var(--ok); background: var(--ok); color: var(--bg); }
.opt.ok .n { border-color: var(--bg); 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); }

/* ---------- ひらがなのボタン ---------- */
.tiles-area { max-width: 560px; margin: 10px auto 0; }
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.key {
  appearance: none; font: inherit; font-size: 26px; font-weight: 700; min-height: 54px; padding: 0;
  border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; touch-action: manipulation;
}
.key.tile.small { font-size: 20px; }
.key:active:not(:disabled) { transform: translateY(1px); }
.key:disabled { opacity: .3; cursor: not-allowed; }
.key:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.tile-ctrl { display: grid; grid-template-columns: 1fr 2fr; gap: 6px; margin-top: 6px; }
.key.erase { font-size: 19px; color: var(--accent); }
.key.enter { font-size: 21px; background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
#kb-btn[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }

.linkbtn { display: inline-flex; align-items: center; text-decoration: none; }
.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); }

/* ---------- 設定（学年のボタン） ---------- */
.grades .choice span { min-width: 60px; justify-content: center; font-size: 19px; font-weight: 700; padding: 0 10px; position: relative; }
.grades .choice span .star { position: absolute; right: 3px; top: -1px; font-size: 14px; color: #B7791F; font-style: normal; }
.grades .choice span .done { position: absolute; left: 4px; top: -1px; font-size: 14px; color: var(--ok); font-style: normal; }

/* ---------- 結果 ---------- */
.result-box { position: static; margin: 0 auto; max-width: 560px; }
.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: 2px 8px; display: inline-flex; flex-direction: column; align-items: center; line-height: 1.25; }
.result-box .weak span b { font-size: 20px; color: var(--ng); }
.result-box .weak span { font-size: 14px; }
.result-box .best { display: inline-block; margin-left: 6px; font-size: 14px; color: var(--ok); border: 1.5px solid var(--ok); border-radius: 999px; padding: 0 8px; vertical-align: middle; }
.callout { z-index: 5; top: 30%; }

.credit { margin: 6px 0 0; font-size: 14px; }

@media (max-width: 420px) {
  .stage { padding: 8px; }
  .card { min-height: 220px; padding: 8px 6px 10px; }
  .opt { min-height: 56px; padding: 4px 8px; gap: 6px; }
  .opt .n { width: 24px; height: 24px; font-size: 14px; }
  .key { min-height: 48px; font-size: 23px; }
  .tiles { gap: 5px; }
  .seg .rd { min-height: 2.9em; }
  .kana-in { font-size: 26px; min-height: 50px; }
  .controls .btn.icon { padding: 0 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .word.pop, .seg.show .rd .y, .opt.ng.shake, .kana-in.shake { animation: none; }
}
.howto img.narrow { max-width: 560px; }

/* iPhone の「連絡先を自動入力」を出さないため入力欄は type=search（要望No.87）。検索欄の見た目は消す */
input[type=search]{-webkit-appearance:none;appearance:none}
input[type=search]::-webkit-search-cancel-button,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; } }
/* 上のバーの高さ ここまで */
