/* パッと暗算 固有の見た目（共通は ../common/base.css） */
[hidden] { display: none !important; }

.board-wrap { min-height: 240px; container-type: inline-size; }

/* ---------- 数を出す画面 ---------- */
.screen {
  background: var(--board); color: #1F2328; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px 12px; text-align: center; display: flex; flex-direction: column; align-items: center;
  min-height: clamp(220px, 52cqw, 330px); transition: border-color var(--dur);
}
.screen.flashing { border-color: #2F5D8A; }
.screen.small { min-height: 0; }
.screen.small .flash { min-height: 0; padding: 6px 0 2px; }
.prog { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; min-height: 14px; }
.prog i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #C9C4B8; background: #FFFFFF; }
.prog i.done { background: #8A8F97; border-color: #8A8F97; }
.prog i.now { background: #2F5D8A; border-color: #2F5D8A; }
.prog i.minus.done, .prog i.minus.now { background: #B7791F; border-color: #B7791F; }
.flash {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .04em; width: 100%;
  font-size: clamp(96px, 36cqw, 220px); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  letter-spacing: .02em; min-height: 1.15em;
}
.flash .sign { font-size: .8em; }
.flash.minus { color: #9A5B00; }
.flash.word { font-size: clamp(40px, 12cqw, 72px); color: #5B616B; }
.flash.ask { font-size: clamp(36px, 10cqw, 60px); color: #2F5D8A; }
.flash.ok { font-size: clamp(40px, 11cqw, 66px); color: #2E7D4F; }
.flash.ng { font-size: clamp(40px, 11cqw, 66px); color: #B23A3A; }
.flash.long { font-size: clamp(72px, 26cqw, 170px); }
.cap { margin: 0; min-height: 1.6em; font-size: 17px; font-weight: 700; color: #5B616B; }
.cap .minus-tag { color: #9A5B00; }

/* ---------- 答えの枠 ---------- */
.answer-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; }
.answer-label { font-size: 20px; font-weight: 700; color: var(--ink-sub); }
.ans {
  display: inline-flex; align-items: center; justify-content: center; min-width: 4.2em; height: 1.5em; padding: 0 .3em;
  font-size: 38px; font-weight: 700; font-variant-numeric: tabular-nums;
  border: 3px solid #C9C4B8; border-radius: 10px; background: #FFFFFF; color: #2F5D8A;
}
.ans.on { border-color: #2F5D8A; }
.ans.caret::after { content: ''; width: 3px; height: .8em; background: #2F5D8A; animation: blink 1s steps(1) infinite; margin-left: 2px; }
.ans.ok { background: #E6F3EA; border-color: #2E7D4F; color: #2E7D4F; }
.ans.ng { background: #FBE9E7; border-color: #B23A3A; color: #B23A3A; }
.ans.shake { animation: shake .35s ease-out; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes shake { 20% { transform: translateX(-8px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } 100% { transform: none; } }

/* ---------- 答えのあとの一覧と式 ---------- */
.fb {
  margin: 10px auto 0; max-width: 600px; width: 100%; border-radius: var(--radius); padding: 10px 12px; text-align: center;
  background: var(--surface); border: 2px solid var(--line); color: var(--ink);
}
.fb.ok { border-color: var(--ok); }
.fb.ng { border-color: var(--ng); }
.fb .head { margin: 0 0 6px; font-weight: 700; font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chips li {
  display: flex; flex-direction: column; align-items: center; min-width: 52px; padding: 4px 6px 3px;
  border: 2px solid var(--line); border-radius: 6px; background: #FFFFFF; color: #1F2328; font-variant-numeric: tabular-nums;
}
.chips li b { font-size: 22px; line-height: 1.2; }
.chips li small { font-size: 14px; color: #5B616B; white-space: nowrap; }
.chips li.minus { border-color: #B7791F; }
.chips li.minus b { color: #9A5B00; }
.chips li.off { border-color: #B23A3A; background: #FBE9E7; }
.formula { margin: 8px 0 0; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.formula .t { white-space: nowrap; }
.formula .m { color: #9A5B00; }
.fb .tip { margin: 6px 0 0; font-size: 15px; color: var(--ink-sub); }

/* ---------- 数字ボタン ---------- */
.pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 480px; margin: 12px auto 0; }
.key {
  appearance: none; font: inherit; font-size: 30px; font-weight: 700; min-height: 56px; padding: 0; font-variant-numeric: tabular-nums;
  border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer;
  touch-action: manipulation;
}
.key.erase { grid-column: span 2; font-size: 19px; color: var(--accent); }
.key.enter { grid-column: span 3; font-size: 21px; background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.key:active:not(:disabled) { transform: translateY(1px); }
.key:disabled { opacity: .4; cursor: not-allowed; }
.key:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.linkbtn { display: inline-flex; align-items: center; text-decoration: none; }
.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); }
.status .streak { margin-left: auto; font-size: 15px; color: var(--ink-sub); white-space: nowrap; }

/* ---------- 設定（きゅうのボタン） ---------- */
.kyus .choice span { min-width: 64px; justify-content: center; font-weight: 700; position: relative; }
.kyus .choice span .star { position: absolute; right: 3px; top: -1px; font-size: 14px; color: #B7791F; }
.kyus .choice input:disabled + span { opacity: .45; }

/* ---------- 結果 ---------- */
.result-box { position: static; margin: 10px auto 0; max-width: 600px; }
.result-box .big { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.result-box .rows { display: grid; gap: 4px; margin: 6px 0 10px; text-align: left; }
.result-box .rows p { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-box .rows .ok { color: var(--ok); font-weight: 700; }
.result-box .rows .ng { color: var(--ng); font-weight: 700; }
.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; }
.result-box .pass { color: var(--ok); }
.callout { z-index: 5; top: 30%; }

@media (max-width: 420px) {
  .stage { padding: 8px; }
  .screen { padding: 8px; min-height: 190px; }
  .key { min-height: 50px; font-size: 27px; }
  .pad { gap: 5px; margin-top: 8px; }
  .ans { font-size: 32px; }
  .answer-row { margin-top: 8px; }
  .controls .btn.icon { padding: 0 9px; }
  .chips li { min-width: 44px; }
  .chips li b { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .ans.caret::after, .ans.shake { animation: none; }
}
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 2; --tb-st-lines: 2.25; --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; } }
/* 上のバーの高さ ここまで */
