/* 戦国クイズ クローズド版 — docs/design-tokens-v1.md（案C-K改12）のトークン */
:root {
  --ink: #1A1A1A; --canvas: #F7EDC4; --paper: #FFF5CC; --hud: #FAF5E8; --white: #FFFFFF;
  --sub: #6B6657; --navy: #051F4A; --sky: #57BAED; --line: #E3DCC7; --dim-key: #9A9484; --dim-row: #EFEAD9;
  --key-a: #E21B3C; --key-b: #1368CE; --key-c: #D89E00; --key-d: #26890C;
  --correct: #E21B3C; --correct-bg: #BFE0FF; --wrong: #2F96D8; --wrong-row: #C9E2F7; --wrong-bg: #FADADA; --wrong-banner: #4A4A4A;
  --radius: 12px; --radius-lg: 16px; --border: 2px; --wall: #E6DCBF;
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--canvas); color: var(--ink); }
body { -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* 端末フレーム（幅768px以上で有効） */
.stage { min-height: 100dvh; }
.stage__side { display: none; }
.device { position: relative; }
.device__notch { display: none; }
.screen { position: relative; min-height: 100dvh; background: var(--canvas); display: flex; flex-direction: column; transition: background-color .2s ease; }
.screen.is-correct { background: var(--correct-bg); }
.screen.is-wrong { background: var(--wrong-bg); }
@media (prefers-reduced-motion: reduce) { .screen { transition: none; } }

@media (min-width: 768px) {
  body { background: var(--wall); }
  .stage { display: flex; align-items: center; justify-content: center; gap: 64px; padding: 24px; }
  .stage__side { display: block; max-width: 400px; color: var(--ink); }
  .stage__side h2 { font-size: 40px; color: var(--navy); margin: 4px 0 12px; }
  .stage__side p { line-height: 1.6; margin-bottom: 10px; }
  .device { width: 421px; height: min(880px, calc(100dvh - 48px)); background: var(--ink); border-radius: 56px; padding: 14px; flex: none; }
  .device__notch { display: block; position: absolute; top: 24px; left: 50%; width: 120px; height: 30px; margin-left: -60px; background: var(--ink); border-radius: 15px; z-index: 2; }
  .screen { width: 393px; height: 100%; min-height: 0; border-radius: 42px; overflow: hidden; padding-top: 44px; }
}

.eyebrow { font-size: 12px; font-weight: 700; color: var(--sub); letter-spacing: .04em; }
.muted { color: var(--sub); }
.small { font-size: 12px; }
.center { text-align: center; }
.big { font-size: 26px; font-weight: 700; color: var(--navy); }

.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.scroll { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* ゲート */
.gate__hero { height: 230px; background: url("/assets/images/castle-hero-day.png") right top / cover no-repeat; margin: 16px 16px 0; border-radius: var(--radius); }
.gate__body { padding: 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.gate__body h1 { font-size: 32px; color: var(--navy); }
.gate__lead { line-height: 1.6; }
.gate__message { font-weight: 700; color: var(--navy); }

/* ヘッダー */
.bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(250, 245, 232, .9); }
.bar__user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar__avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--sky); overflow: hidden; flex: none; }
.bar__avatar img { width: 100%; height: 100%; object-fit: cover; }
.bar__name { font-weight: 700; font-size: 13px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__stats { margin-left: auto; display: flex; gap: 10px; }
.bar__stats span { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.bar__stats small { font-size: 9px; color: var(--sub); font-weight: 700; }
.bar__stats b { font-size: 12px; color: var(--navy); }
.bar__close { margin-left: auto; width: 40px; height: 40px; border-radius: 20px; border: var(--border) solid var(--ink); background: var(--white); color: var(--navy); font-size: 20px; font-weight: 900; flex: none; }
.bar__stats:not([hidden]) + .bar__close { margin-left: 0; }

.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.qnum { font-size: 24px; color: var(--navy); }
.chip { background: var(--hud); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; font-weight: 700; color: var(--navy); }

/* パネル・バナー */
.panel { background: var(--paper); border-radius: var(--radius); padding: 16px; }
.panel--white { background: var(--white); }
.panel h3 { font-size: 14px; color: var(--navy); margin-bottom: 8px; }
.prompt { font-size: 18px; font-weight: 600; line-height: 1.6; color: var(--ink); }
.qimage { margin: 0 0 10px; }
.qimage img { width: 100%; max-height: 240px; object-fit: contain; border-radius: 10px; border: var(--border) solid var(--ink); background: var(--hud); }
.image-credit { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line, #E3DCC7); }
.image-credit img { width: 64px; height: 64px; flex: 0 0 64px; object-fit: cover; border-radius: 8px; background: var(--hud, #FAF5E8); }
.image-credit p { margin: 0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.image-credit small { display: block; font-size: 10px; color: var(--sub); font-weight: 700; }
.banner { border-radius: var(--radius); min-height: 60px; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; }
.banner.is-correct { background: var(--white); color: var(--correct); border: 3px solid var(--correct); }
.banner.is-wrong { background: var(--wrong-banner); color: var(--white); }

/* 選択肢（色＋形） */
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 56px; padding: 6px 8px; background: var(--white); border: var(--border) solid var(--ink); border-radius: var(--radius); color: var(--ink); font-size: 16px; font-weight: 600; }
.choice:disabled { cursor: default; }
.choice__key { width: 40px; height: 40px; border-radius: 8px; flex: none; display: grid; place-items: center; }
.choice__key svg { width: 18px; height: 18px; fill: var(--white); }
.choice[data-key="a"] .choice__key { background: var(--key-a); }
.choice[data-key="b"] .choice__key { background: var(--key-b); }
.choice[data-key="c"] .choice__key { background: var(--key-c); }
.choice[data-key="d"] .choice__key { background: var(--key-d); }
.choice__text { flex: 1; }
.choice__label { font-size: 13px; font-weight: 700; }
.choice.is-correct { border: 3px solid var(--correct); }
.choice.is-correct .choice__label { color: var(--correct); }
.choice.is-wrong { background: var(--wrong-row); border: 3px solid var(--wrong); }
.choice.is-wrong .choice__label { color: var(--wrong); }
.choice.is-dim { background: var(--dim-row); color: var(--sub); }
.choice.is-dim .choice__key { background: var(--dim-key); }

.metrics { display: flex; gap: 12px; }
.tile { flex: 1; background: var(--hud); border-radius: var(--radius); padding: 10px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.tile small { font-size: 11px; font-weight: 700; color: var(--navy); }
.tile b { font-size: 20px; color: var(--navy); }
.link { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--navy); }

/* ボタン（押せるものは枠線） */
.actions { display: flex; flex-direction: column; gap: 10px; }
.actions--row { flex-direction: row; }
.actions--spaced { margin-top: 52px; }
.btn--link { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.actions--row .btn { flex: 1; }
.btn { min-height: 52px; padding: 12px 16px; border-radius: var(--radius-lg); font-size: 17px; font-weight: 700; border: var(--border) solid var(--ink); }
.btn--primary { background: var(--navy); color: var(--white); }
.btn--outline { background: var(--white); color: var(--navy); border-color: var(--navy); }
.btn:disabled { opacity: .6; cursor: default; }
.status { min-height: 1.2em; font-size: 13px; color: var(--sub); }

/* 報告シート */
.sheet { border: var(--border) solid var(--ink); border-radius: var(--radius-lg); padding: 0; width: calc(100% - 24px); max-width: 369px; max-height: calc(100dvh - 48px); margin: auto; overflow: auto; background: var(--canvas); }
.sheet::backdrop { background: rgba(26, 26, 26, .45); }
.sheet form { padding: 20px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.sheet h2 { font-size: 18px; color: var(--navy); }
.label { font-size: 13px; font-weight: 700; color: var(--navy); }
.reasons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.reason { padding: 8px 10px; border-radius: 16px; border: var(--border) solid var(--navy); background: var(--white); color: var(--navy); font-size: 12px; font-weight: 700; }
.reason[aria-pressed="true"] { background: var(--navy); color: var(--white); border-color: var(--ink); }
textarea { width: 100%; font: inherit; font-size: 15px; padding: 10px; border-radius: var(--radius); border: var(--border) solid var(--ink); background: var(--white); resize: vertical; }
