/* 色の見分けテスト 固有の見た目（共通は ../common/base.css）。マスの色は問題の色そのもの（ダーク表示でも変えない）。
   カードの地は --board（ダークでも明るい生成り）なので、カードの中の文字は決まった色 */
[hidden] { display: none !important; }

.board-wrap { position: relative; }
.card {
  background: var(--board); color: #1F2328; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px 8px; display: flex; flex-direction: column; align-items: center;
}
.hud { width: 100%; max-width: 560px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; font-size: 15px; color: #5B616B; min-height: 30px; }
.hud #hud-l { text-align: left; font-weight: 700; color: #1F2328; font-size: 17px; white-space: nowrap; }
.hud #hud-r { text-align: right; }
.hud .clock { font-size: 20px; font-weight: 700; color: #1F2328; display: inline-flex; gap: 6px; align-items: center; }
.hud .clock.low { color: #9A6415; }
.life { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #5B616B; background: transparent; }
.life.on { background: #2F5D8A; border-color: #2F5D8A; }
.meter { width: 100%; max-width: 560px; height: 8px; margin-top: 4px; border-radius: 999px; background: #E6E2D8; overflow: hidden; }
.meter i { display: block; height: 100%; width: 100%; background: #2F5D8A; border-radius: 999px; transform-origin: left center; }
.meter.low i { background: #9A6415; }

/* マス: 1辺の長さは「幅」と「画面の高さ」の小さい方（スマホでも1画面に収まる） */
.grid {
  --n: 3; --gap: 6px;
  display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: var(--gap);
  width: min(100%, 520px, calc(100svh - 330px)); min-width: min(100%, 300px); aspect-ratio: 1; margin: 10px auto 0;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.grid[data-n="6"], .grid[data-n="7"] { --gap: 4px; }
.tile {
  appearance: none; border: 0; padding: 0; margin: 0; border-radius: 6px; cursor: pointer; min-width: 0; min-height: 0;
  -webkit-tap-highlight-color: transparent; position: relative;
}
.grid[data-n="6"] .tile, .grid[data-n="7"] .tile { border-radius: 4px; }
.tile:focus { outline: none; }
.tile.cursor { outline: 3px dashed #1F2328; outline-offset: 2px; z-index: 1; }
.tile.ng::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 4px #B23A3A; }
.tile.answer { outline: 4px solid #2F5D8A; outline-offset: 2px; z-index: 2; }
.tile.answer::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 2px #FFFFFF; }
.tile.shake { animation: shake .35s ease-out; }
@keyframes shake { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } 100% { transform: none; } }
.grid.pop { animation: pop-in .2s ease-out; }
@keyframes pop-in { from { transform: scale(.97); opacity: .5; } to { transform: none; opacity: 1; } }
.grid.veil .tile { background: #D9D6CE !important; cursor: default; }
.locked .tile { cursor: default; }

.fb { min-height: 1.6em; margin: 6px 0 0; font-size: 17px; font-weight: 700; color: #1F2328; text-align: center; line-height: 1.6; }
.fb.ok { color: #2E7D4F; }
.fb.ng { color: #B23A3A; }
.disclaimer { margin: 8px 0 0; font-size: 14px; color: var(--ink-sub); text-align: center; }

/* 一時停止 */
.pause-box { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(251, 250, 246, .94); border-radius: var(--radius); color: #1F2328; z-index: 4; text-align: center; padding: 16px; }
.pause-box p { margin: 0; font-size: 18px; font-weight: 700; }
.callout { z-index: 3; }
.linkbtn { display: inline-flex; align-items: center; text-decoration: none; }
#play .controls { justify-content: center; margin-top: 8px; }

/* 結果（盤の下に。最後の問題の答えを盤で見せたまま） */
.result-box { position: static; margin: 10px auto 0; max-width: 600px; }
.result-box h2 { margin-top: 0; font-size: 1.3rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 12px; }
.stats div { border: 2px solid var(--line); border-radius: var(--radius); padding: 8px 4px; background: var(--surface); text-align: center; }
.stats b { display: block; font-size: 28px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stats span { font-size: 14px; color: var(--ink-sub); line-height: 1.4; display: block; }
.stats .main b { color: var(--ok); }
.result-box .best { display: inline-block; font-size: 14px; color: var(--ok); border: 1.5px solid var(--ok); border-radius: 999px; padding: 0 8px; font-weight: 700; }
.result-box .best-line { margin: 0 0 6px; }
.result-box .small { margin: 6px 0 2px; font-size: 15px; color: var(--ink-sub); text-align: left; }
.kinds { border-collapse: collapse; margin: 4px auto 6px; font-variant-numeric: tabular-nums; }
.kinds th, .kinds td { border: 1px solid var(--line); padding: 2px 12px; text-align: center; }
.kinds th { font-size: 14px; color: var(--ink-sub); font-weight: 700; }
.kinds td:first-child { text-align: left; }
.result-box .note { color: var(--ink-sub); font-size: 15px; }

/* 解説の小さな見本の色 */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.sw { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.sw i { display: inline-block; width: 36px; height: 36px; border-radius: 6px; }

@media (max-width: 480px) {
  .stage { padding: 8px; }
  .card { padding: 8px 4px 6px; }
  .grid { width: min(100%, calc(100svh - 300px)); }
  .controls .btn.icon { padding: 0 10px; }
  .stats b { font-size: 24px; }
  .grid[data-n="6"], .grid[data-n="7"] { --gap: 3px; }
  #controls-btn { display: none; } /* 操作のしかたはゲームのすぐ下にあるので、スマホ幅ではボタンを1行に収める */
}
@media (prefers-reduced-motion: reduce) { .tile.shake, .grid.pop { 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; } }
:root:lang(en) .turnbar { --tb-msg-lines: 3; --tb-st-lines: 1; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { :root:lang(en) .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
@media (min-width: 641px) { :root:lang(en) .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
