/* 英単語クイズ固有の見た目（共通は ../common/base.css） */
[hidden] { display: none !important; }

/* このゲームの色（カード・説明の枠）。ダークでは暗い地に明るい文字（base.css と同じ切り替え方） */
:root {
  --e-card: #FBFAF6; --e-ink: #1F2328; --e-sub: #5B616B; --e-dot: #C9C4B8; --e-white: #FFFFFF;
  --e-blue: #2F5D8A; --e-green: #2E7D4F; --e-red: #B23A3A; --e-brown: #8A5A1F; --e-plum: #9A3B6A;
  --e-slot: #FFF6E3; --e-okbg: #E4F2E9; --e-ngbg: #F8E1E1;
  --e-lab: #E3ECF5; --e-lab-lit: #EFEBE2; --e-lab-memo: #FBEBDD; --e-memo: #8A4A12; --e-hint: #B7791F;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --e-card: #2B2D31; --e-ink: #ECEAE4; --e-sub: #A9ADB4; --e-dot: #5A5E66; --e-white: #1C1D20;
    --e-blue: #7FA8D1; --e-green: #5BBF85; --e-red: #E88580; --e-brown: #D6A15E; --e-plum: #D987B2;
    --e-slot: #3A3226; --e-okbg: #203A2A; --e-ngbg: #43292A;
    --e-lab: #2A3642; --e-lab-lit: #3A3D43; --e-lab-memo: #45362A; --e-memo: #E0A870; --e-hint: #BD8828;
  }
}
:root[data-theme="dark"] {
  --e-card: #2B2D31; --e-ink: #ECEAE4; --e-sub: #A9ADB4; --e-dot: #5A5E66; --e-white: #1C1D20;
  --e-blue: #7FA8D1; --e-green: #5BBF85; --e-red: #E88580; --e-brown: #D6A15E; --e-plum: #D987B2;
  --e-slot: #3A3226; --e-okbg: #203A2A; --e-ngbg: #43292A;
  --e-lab: #2A3642; --e-lab-lit: #3A3D43; --e-lab-memo: #45362A; --e-memo: #E0A870; --e-hint: #BD8828;
}


.board-wrap { min-height: 200px; container-type: inline-size; }
.en { font-family: "Segoe UI", "Helvetica Neue", Arial, var(--font); letter-spacing: .01em; }

/* ---------- 問題のカード（紙の地は明るいまま。文字の色は固定） ---------- */
.card {
  background: var(--e-card); color: var(--e-ink); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px 14px; text-align: center; min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
}
.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(--e-dot); background: var(--e-card); font-style: normal;
  font-size: 14px; line-height: 1; font-weight: 700; color: var(--e-white); display: inline-flex; align-items: center; justify-content: center;
}
.prog i.now { border-color: var(--e-blue); box-shadow: 0 0 0 2px var(--e-white), 0 0 0 4px var(--e-blue); }
.prog i.ok { background: var(--e-green); border-color: var(--e-green); }
.prog i.ng { background: var(--e-red); border-color: var(--e-red); }
.prog i.ok::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--e-white); }
.prog i.ng::after { content: '×'; }

.ask { margin: 4px 0 0; font-size: 17px; font-weight: 700; color: var(--e-sub); min-height: 1.5em; line-height: 1.9; }
.ask .kind { display: inline-block; font-size: 14px; border-radius: 999px; padding: 0 10px; margin-right: 6px; line-height: 22px; vertical-align: 1px; color: var(--e-white); background: var(--e-blue); }
.ask .kind.t-je { background: var(--e-green); }
.ask .kind.t-spell { background: var(--e-brown); }
.ask .kind.t-listen { background: var(--e-plum); }
.ask .kind rt { color: var(--e-white); }
.ask rt { font-size: 10px; }

/* 問題の語 */
.word { margin: 10px 0 4px; max-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.word.pop { animation: pop-in .22s ease-out; }
.word .en { font-weight: 700; font-size: clamp(38px, 11cqw, 64px); line-height: 1.15; overflow-wrap: anywhere; }
.word .jp { font-weight: 700; font-size: clamp(26px, 7cqw, 38px); line-height: 1.9; overflow-wrap: anywhere; }
.word .jp.small { font-size: clamp(19px, 5cqw, 24px); color: var(--e-ink); }
.word rt { font-size: .42em; font-weight: 400; color: var(--e-sub); }
.word .jp.small rt { font-size: 10px; }

/* 発音のボタン（スピーカー） */
.speak {
  appearance: none; font: inherit; font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 12px; border-radius: 999px; border: 2px solid var(--e-blue); background: var(--e-card); color: var(--e-blue); cursor: pointer;
}
.speak rt { font-size: 10px; color: var(--e-blue); }
.speak:active { transform: translateY(1px); }
.speak:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.speak.big { min-height: 72px; padding: 0 24px; font-size: 18px; margin: 12px 0 8px; }
.speak.big svg { width: 36px; height: 36px; }
.kw .speak { margin-left: 10px; vertical-align: 4px; min-height: 36px; font-size: 14px; }

/* つづり: 文字と□ */
.spell { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; font-family: "Segoe UI", "Helvetica Neue", Arial, var(--font); margin: 4px 0; }
.spell .ch, .spell .slot {
  display: inline-flex; align-items: center; justify-content: center; min-width: .62em; height: 1.45em; font-size: clamp(30px, 8.6cqw, 46px); font-weight: 700; line-height: 1;
}
.spell .ch { min-width: 0; padding: 0 .02em; }
.spell.long .ch, .spell.long .slot { font-size: clamp(24px, 6.4cqw, 40px); }
.spell .sp { width: .5em; }
.spell .slot { border: 3px solid var(--e-brown); border-radius: 6px; background: var(--e-slot); color: var(--e-brown); min-width: 1.1em; cursor: default; }
.spell .slot.next { box-shadow: 0 0 0 3px var(--e-white), 0 0 0 5px var(--e-blue); }
.spell .slot.filled { background: var(--e-card); color: var(--e-ink); cursor: pointer; }
.spell .slot.right { background: var(--e-okbg); border-color: var(--e-green); color: var(--e-green); cursor: default; }
.spell .slot.wrong { background: var(--e-ngbg); border-color: var(--e-red); color: var(--e-red); cursor: default; }

.verdict { margin: 4px 0 0; font-size: 20px; font-weight: 700; }
.verdict.ok { color: var(--e-green); }
.verdict.ng { color: var(--e-red); }
.verdict .mark { display: inline-block; width: 1.4em; height: 1.4em; line-height: 1.4em; border-radius: 50%; color: var(--e-white); margin-right: 6px; font-size: .85em; vertical-align: 1px; }
.verdict.ok .mark { background: var(--e-green); }
.verdict.ng .mark { background: var(--e-red); }
@keyframes pop-in { from { transform: scale(.94); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes shake { 20% { transform: translateX(-8px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } 100% { transform: none; } }

/* ---------- 4択 ---------- */
.opts { display: grid; grid-template-columns: 1fr; gap: 8px; max-width: 600px; margin: 12px auto 0; }
.opts.grid2 { grid-template-columns: 1fr 1fr; }
.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: 19px; font-weight: 700; line-height: 1.75; min-width: 0; overflow-wrap: anywhere; }
.opt .t rt { font-size: 10px; color: var(--ink-sub); font-weight: 400; }
.opts.en.long .opt .t { font-size: clamp(18px, 4.6vw, 23px); }
.opts.en .opt .t { overflow-wrap: normal; word-break: keep-all; }
.opts.en .opt .t { font-family: "Segoe UI", "Helvetica Neue", Arial, var(--font); font-size: clamp(20px, 5.4vw, 26px); line-height: 1.3; }
.opt .pair { display: block; font-size: 14px; font-weight: 400; line-height: 1.6; color: var(--ink-sub); font-family: var(--font); }
.opt .pair rt { font-size: 10px; }
.opt:hover:not([aria-disabled="true"]) { border-color: var(--accent); }
.opt:active:not([aria-disabled="true"]) { transform: translateY(1px); }
.opt:focus-visible, .tile:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.opt[aria-disabled="true"] { cursor: default; }
.opt.dim { opacity: .6; }
.opt.ng { border-color: var(--ng); color: var(--ng); background: transparent; opacity: 1; }
/* 成功・失敗の色の地の文字は、白ではなく背景の色（ライト・ダークとも 4.5:1 以上） */
.opt.ng .n { border-color: var(--ng); background: var(--ng); color: var(--bg); }
.opt.ng .n::before { content: '×'; }
.opt.ng .n span { display: none; }
.opt.ng.shake { animation: shake .35s ease-out; }
.opt.ok { border-color: var(--ok); background: var(--ok); color: var(--bg); opacity: 1; }
.opt.ok .n { border-color: var(--bg); color: var(--bg); }
.opt.ok .t rt, .opt.ok .pair { color: var(--bg); }
.opt.show { border-color: var(--ok); border-width: 3px; opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }

/* つづりの文字のボタン */
.opts.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tile {
  appearance: none; font: inherit; width: 60px; height: 60px; border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", Arial, var(--font); font-size: 30px; font-weight: 700; cursor: pointer; touch-action: manipulation; filter: var(--shadow-piece);
}
.tile:hover:not([aria-disabled="true"]) { border-color: var(--accent); }
.tile:active:not([aria-disabled="true"]) { transform: translateY(1px); }
.tile.used { opacity: .3; filter: none; cursor: default; }
.tile.back { width: auto; padding: 0 14px; font-family: var(--font); font-size: 16px; filter: none; }
.tile.back rt { font-size: 10px; }
.tile[aria-disabled="true"] { cursor: default; }
.tile.back[aria-disabled="true"] { opacity: .45; }

.next-row { max-width: 600px; margin: 10px auto 0; }
.btn.next { width: 100%; min-height: 52px; font-size: 19px; }

/* ---------- 説明・ヒント ---------- */
.explain {
  margin: 10px auto 0; max-width: 600px; box-sizing: border-box; border-radius: var(--radius); padding: 10px 14px;
  background: var(--e-card); border: 2px solid var(--line); color: var(--e-ink); font-size: 16px; line-height: 1.9;
}
.explain p { margin: 0 0 6px; }
.explain p:last-child { margin-bottom: 0; }
.explain rt { font-size: 10px; color: var(--e-sub); }
.explain .row { display: flex; gap: 8px; align-items: baseline; }
.explain .row.sub { font-size: 14px; color: var(--e-sub); }
.explain .lab { flex: none; font-size: 14px; font-weight: 700; border-radius: 999px; padding: 0 8px; line-height: 22px; background: var(--e-lab); color: var(--e-blue); }
.explain .lab rt { color: inherit; }
.explain .lab.lit { background: var(--e-lab-lit); color: var(--e-sub); }
.explain .lab.memo { background: var(--e-lab-memo); color: var(--e-memo); }
.explain .kw { font-weight: 700; font-size: 26px; line-height: 1.4; }
.explain b.en { font-size: 17px; }
.explain.hintbox { border: 2px dashed var(--e-hint); }
.explain .t { color: var(--e-sub); font-size: 14px; font-weight: 700; margin-bottom: 2px; }

.linkbtn { display: inline-flex; align-items: center; text-decoration: none; }
#furi-btn[aria-pressed="false"] { text-decoration: line-through; text-decoration-thickness: 2px; }
.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); }

/* 設定のカテゴリ（選ぶ欄） */
.select {
  font: inherit; font-size: 17px; min-height: var(--tap); min-width: 14em; max-width: 100%; padding: 0 10px; border-radius: var(--radius);
  border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.select:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }

/* ---------- 結果 ---------- */
.result-box { position: static; margin: 0 auto; max-width: 600px; }
.result-box .big { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.result-box .weak { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin: 6px 0 10px; text-align: left; }
.result-box .weak span { border-left: 4px solid var(--ng); background: var(--surface); border-radius: 4px; padding: 4px 10px; line-height: 1.8; font-size: 14px; }
.result-box .weak span b { font-size: 18px; display: block; }
.result-box .weak rt { font-size: 10px; }
.callout { z-index: 5; top: 30%; }

/* ---------- 解説 ---------- */
.table-scroll { overflow-x: auto; }
.howto img.narrow { max-width: 560px; }

@media (max-width: 420px) {
  .opts.grid2.long { grid-template-columns: 1fr; }
  .opts.grid2.long .opt { min-height: 50px; }
  .stage { padding: 8px; }
  .card { min-height: 170px; padding: 8px 8px 10px; }
  .opt { min-height: 56px; padding: 4px 8px; gap: 8px; }
  .opt .n { width: 24px; height: 24px; font-size: 14px; }
  .opt .t { font-size: 17px; }
  .tile { width: 52px; height: 52px; font-size: 27px; }
  .controls .btn.icon { padding: 0 9px; }
  .explain { padding: 8px 10px; font-size: 15px; }
  .select { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .word.pop, .opt.ng.shake { animation: 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; } }
/* 上のバーの高さ ここまで */
