/* 日本史の年号クイズ固有の見た目（共通は ../common/base.css）。落ち着いた和の紙（生成り）に、墨・朱・藍 */
[hidden] { display: none !important; }

:root {
  --r-paper: #FBF8F0; --r-ink: #22201C; --r-sub: #5E5A52; --r-dot: #CFC8B8; --r-white: #FFFFFF;
  --r-ai: #2F5D8A; --r-matcha: #3F6E3A; --r-shu: #A8412E; --r-kincha: #8A5A1F; --r-murasaki: #6B4A86; --r-sumi: #55514A;
  --r-slot: #F6EEDC; --r-okbg: #E4F0E1; --r-ngbg: #F7E2DC; --r-rule: #D8CDB6;
  --r-lab: #E4ECF4; --r-lab-lit: #EEE9DE; --r-lab-memo: #F7E7DA; --r-memo: #8A4A12; --r-lab-goro: #EAE4F1; --r-goro: #5E4380; --r-hint: #B7791F;
  --mincho: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "BIZ UDPMincho", "MS PMincho", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --r-paper: #2B2A27; --r-ink: #EDE9E0; --r-sub: #AEA89C; --r-dot: #5C5850; --r-white: #1C1B19;
    --r-ai: #7FA8D1; --r-matcha: #7FB878; --r-shu: #E48B76; --r-kincha: #D6A15E; --r-murasaki: #B99AD6; --r-sumi: #B5AFA3;
    --r-slot: #3A3326; --r-okbg: #22382A; --r-ngbg: #472B25; --r-rule: #4C473D;
    --r-lab: #2A3642; --r-lab-lit: #3A3833; --r-lab-memo: #45362A; --r-memo: #E0A870; --r-lab-goro: #3A3145; --r-goro: #C8B0E6; --r-hint: #BD8828;
  }
}
:root[data-theme="dark"] {
  --r-paper: #2B2A27; --r-ink: #EDE9E0; --r-sub: #AEA89C; --r-dot: #5C5850; --r-white: #1C1B19;
  --r-ai: #7FA8D1; --r-matcha: #7FB878; --r-shu: #E48B76; --r-kincha: #D6A15E; --r-murasaki: #B99AD6; --r-sumi: #B5AFA3;
  --r-slot: #3A3326; --r-okbg: #22382A; --r-ngbg: #472B25; --r-rule: #4C473D;
  --r-lab: #2A3642; --r-lab-lit: #3A3833; --r-lab-memo: #45362A; --r-memo: #E0A870; --r-lab-goro: #3A3145; --r-goro: #C8B0E6; --r-hint: #BD8828;
}

.board-wrap { min-height: 200px; container-type: inline-size; }

/* ---------- 問題のカード（和紙のような生成りに、左の朱の線） ---------- */
.card {
  background: var(--r-paper); color: var(--r-ink); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px 14px 20px; text-align: center; min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  position: relative; box-shadow: inset 5px 0 0 var(--r-shu);
}
.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(--r-dot); background: var(--r-paper); font-style: normal;
  font-size: 14px; line-height: 1; font-weight: 700; color: var(--r-white); display: inline-flex; align-items: center; justify-content: center;
}
.prog i.now { border-color: var(--r-ai); box-shadow: 0 0 0 2px var(--r-white), 0 0 0 4px var(--r-ai); }
.prog i.ok { background: var(--r-matcha); border-color: var(--r-matcha); }
.prog i.ng { background: var(--r-shu); border-color: var(--r-shu); }
.prog i.ok::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--r-white); }
.prog i.ng::after { content: '×'; }

.ask { margin: 4px 0 0; font-size: 17px; font-weight: 700; color: var(--r-sub); min-height: 1.5em; line-height: 1.9; }
.ask .kind { display: inline-block; font-size: 14px; border-radius: 3px; padding: 0 10px; margin-right: 6px; line-height: 22px; vertical-align: 1px; color: var(--r-white); background: var(--r-ai); }
.ask .kind.t-ye { background: var(--r-matcha); }
.ask .kind.t-era { background: var(--r-kincha); }
.ask .kind.t-pe { background: var(--r-murasaki); }
.ask .kind.t-order { background: var(--r-sumi); }
.ask .kind rt { color: var(--r-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 .ev, .word .person { font-family: var(--mincho); font-weight: 700; line-height: 1.95; overflow-wrap: anywhere; }
.word .ev { font-size: clamp(22px, 5.6cqw, 30px); }
.word .person { font-size: clamp(30px, 8cqw, 42px); letter-spacing: .04em; }
.word rt { font-size: .42em; font-weight: 400; color: var(--r-sub); font-family: var(--font); }
.word .yrline { display: inline-flex; align-items: baseline; gap: 4px; }
.word .yr { font-family: var(--mincho); font-weight: 700; font-size: clamp(64px, 18cqw, 96px); line-height: 1.05; letter-spacing: .02em; }
.word .nen { font-family: var(--mincho); font-weight: 700; font-size: clamp(26px, 7cqw, 36px); }
.word .nen rt { font-size: 12px; }

.verdict { margin: 4px 0 0; font-size: 20px; font-weight: 700; }
.verdict.ok { color: var(--r-matcha); }
.verdict.ng { color: var(--r-shu); }
.verdict .mark { display: inline-block; width: 1.4em; height: 1.4em; line-height: 1.4em; border-radius: 50%; color: var(--r-white); margin-right: 6px; font-size: .85em; vertical-align: 1px; }
.verdict.ok .mark { background: var(--r-matcha); }
.verdict.ng .mark { background: var(--r-shu); }
@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: 60px; 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: 18px; font-weight: 700; line-height: 1.8; min-width: 0; overflow-wrap: anywhere; }
.opt .t rt { font-size: 10px; color: var(--ink-sub); font-weight: 400; }
.opt .pair { display: block; font-size: 14px; font-weight: 400; line-height: 1.6; color: var(--ink-sub); }
.opt .pair rt { font-size: 10px; }
.opts.years .opt .t { font-size: 17px; }
.opts.years .opt .yr-c { font-family: var(--mincho); font-size: 30px; margin-right: 2px; letter-spacing: .02em; }
.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[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); }

.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(--r-paper); border: 2px solid var(--line); color: var(--r-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(--r-sub); }
.explain .row { display: flex; gap: 8px; align-items: baseline; }
.explain .lab { flex: none; font-size: 14px; font-weight: 700; border-radius: 3px; padding: 0 8px; line-height: 22px; background: var(--r-lab); color: var(--r-ai); white-space: nowrap; }
.explain .lab rt { color: inherit; }
.explain .lab.lit { background: var(--r-lab-lit); color: var(--r-sub); }
.explain .lab.memo { background: var(--r-lab-memo); color: var(--r-memo); }
.explain .lab.goro { background: var(--r-lab-goro); color: var(--r-goro); }
.explain .kw { font-family: var(--mincho); font-weight: 700; font-size: 22px; line-height: 1.8; }
.explain .kw rt { font-family: var(--font); }
.explain .yr-s.big { font-size: 26px; margin-right: .4em; color: var(--r-shu); }
.yr-s { font-family: var(--mincho); font-weight: 700; margin-right: .4em; white-space: nowrap; }
.explain.hintbox { border: 2px dashed var(--r-hint); }
.explain .t { color: var(--r-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); }

/* ---------- 結果 ---------- */
.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(220px, 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: 15px; }
.result-box .weak span b { font-family: var(--mincho); font-size: 17px; display: block; }
.result-box .weak rt { font-size: 10px; }
.callout { z-index: 5; top: 30%; }

/* ---------- 並べかえ ---------- */
.oslots { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; margin: 6px 0 0; }
.oslots .lt { font-size: 18px; font-weight: 700; color: var(--r-sub); }
.oslot {
  min-width: 56px; height: 56px; padding: 0 4px; box-sizing: border-box; border: 3px dashed var(--r-kincha); border-radius: 6px; background: var(--r-slot);
  display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;
}
.oslot i { position: absolute; top: 1px; left: 5px; font-style: normal; font-size: 12px; font-weight: 700; color: var(--r-sub); }
.oslot b { font-family: var(--mincho); font-size: 24px; line-height: 1; padding-top: 6px; }
.oslot.filled { border-style: solid; background: var(--r-paper); }
.oslot.right { border-color: var(--r-matcha); background: var(--r-okbg); }
.oslot.wrong { border-color: var(--r-shu); background: var(--r-ngbg); }
.oslot.right b, .oslot.wrong b { font-size: 19px; }
.olab { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--r-sub); width: min(100%, 360px); }
.olab rt { font-size: 10px; }
.olab-line { flex: 1; height: 0; border-top: 2px solid var(--r-rule); position: relative; }
.olab-line::after { content: ''; position: absolute; right: -2px; top: -6px; border: 5px solid transparent; border-left: 8px solid var(--r-rule); }
.opts.order .opt.picked { border-color: var(--accent); border-width: 3px; }
.opts.order .opt .ordb { margin-left: auto; flex: none; font-size: 15px; font-weight: 700; color: var(--bg); background: var(--accent); border-radius: 999px; padding: 0 10px; line-height: 26px; white-space: nowrap; }
.opts.order .opt .ordb rt { font-size: 10px; color: var(--bg); }

/* ---------- 解説 ---------- */
.table-scroll { overflow-x: auto; }
.howto img.narrow { max-width: 560px; }

@media (max-width: 420px) {
  .stage { padding: 8px; }
  .card { min-height: 160px; padding: 8px 8px 10px 14px; }
  .opt { min-height: 52px; padding: 4px 8px; gap: 8px; }
  .opt .n { width: 24px; height: 24px; font-size: 14px; }
  .opt .t { font-size: 16px; line-height: 1.7; }
  .opts.years .opt .yr-c { font-size: 26px; }
  .controls .btn.icon { padding: 0 9px; }
  .explain { padding: 8px 10px; font-size: 15px; }
  .oslot { min-width: 48px; height: 50px; }
  .oslot b { font-size: 21px; }
  .oslots .lt { font-size: 15px; }
}
@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; } }
/* 上のバーの高さ ここまで */
