/* とけいのよみかた固有の見た目（共通は ../common/base.css） */
[hidden] { display: none !important; }
ruby rt { font-size: .5em; font-weight: 400; }

.board-wrap { position: relative; min-height: 300px; }
.qgrid { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
.qgrid:has(> .side:not([hidden])) { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
@media (max-width: 640px) { .qgrid:has(> .side:not([hidden])) { grid-template-columns: 1fr; } }

/* ---------- 問題と時計 ---------- */
.qcard {
  background: var(--board); color: #1F2328; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 10px 10px 8px; text-align: center; display: flex; flex-direction: column; align-items: center;
}
.qcard.pop .clock-box { animation: pop-in .22s ease-out; }
.prog { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 18px; }
.prog:empty { display: none; }
.prog i {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid #C9C4B8; background: #FFFFFF; font-style: normal;
  font-size: 14px; line-height: 1; font-weight: 700; color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center;
}
.prog i.now { border-color: #2F5D8A; box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #2F5D8A; }
.prog i.ok { background: #2E7D4F; border-color: #2E7D4F; }
.prog i.ng { background: #B23A3A; border-color: #B23A3A; }
.prog i.ok::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #FFFFFF; }
.prog i.ng::after { content: '×'; }
.scene { display: flex; align-items: center; gap: 10px; margin: 6px 0 0; font-size: 18px; font-weight: 700; }
.scene .sky { width: 84px; height: auto; flex: none; }
.ask { margin: 6px 0 2px; font-size: 20px; font-weight: 700; line-height: 1.9; min-height: 1.9em; }
.ask .tgt { color: #2F5D8A; font-size: 1.2em; }
.clock-box { width: min(100%, 340px); }
.clock-box svg.clock { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.clock-box svg.dragging-ok { touch-action: none; cursor: grab; }
.clock-box svg.grab { cursor: grabbing; }
.clock-box svg.shake { animation: shake .35s ease-out; }
.clock .hand-h, .clock .hand-m { transition: none; }
.clock.grab-m .hand-m path, .clock.grab-h .hand-h path { filter: var(--shadow-lift); }
.legend { display: flex; gap: 16px; justify-content: center; margin: 2px 0 0; font-size: 14px; color: #5B616B; flex-wrap: wrap; }
.legend span, .setlbl { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .setlbl i { display: inline-block; border-radius: 3px; }
.lg-h i { width: 22px; height: 9px; background: #C8453B; }
.lg-m i { width: 34px; height: 5px; background: #2F6DB5; }
@keyframes pop-in { from { transform: scale(.92); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes shake { 20% { transform: translateX(-8px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } 100% { transform: none; } }

/* ---------- 答えるところ ---------- */
.side { display: flex; flex-direction: column; gap: 10px; }
.fb {
  border-radius: var(--radius); padding: 8px 14px; text-align: left; background: var(--surface); color: var(--ink);
  border: 2px solid var(--ng); font-size: 17px; line-height: 1.9;
}
.fb p { margin: 0; }
.fb .big { font-size: 1.3em; font-weight: 700; color: var(--ng); }
.fb .sub { color: var(--ink-sub); font-size: 16px; }
.fb .wrongv { text-decoration: line-through; color: var(--ink-sub); }
.fb.ok { border-color: var(--ok); }
.fb.ok .big { color: var(--ok); }
.fb.hint { border-color: var(--warn); border-style: dashed; }
.fb.shake { animation: shake .35s ease-out; }

.ans-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt {
  appearance: none; font: inherit; position: relative; min-height: 64px; padding: 4px 8px 4px 28px; cursor: pointer; touch-action: manipulation;
  border: 2px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  font-size: 23px; font-weight: 700; line-height: 1.7; font-variant-numeric: tabular-nums;
}
.ans-choice.ap .opt { font-size: 19px; }
.opt .k { position: absolute; left: 7px; top: 5px; font-size: 14px; color: var(--ink-sub); font-weight: 700; line-height: 1; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:active:not(:disabled) { transform: translateY(1px); }
.opt:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.opt.ng { border-color: var(--ng); color: var(--ng); background: #FBE9E7; opacity: .75; text-decoration: line-through; }
.opt.right { border: 3px solid var(--ok); box-shadow: 0 0 0 3px rgba(46,125,79,.25); }
.opt.ok { background: #E6F3EA; color: #2E7D4F; }
:root[data-theme="dark"] .opt.ng, :root[data-theme="dark"] .opt.ok { color: #1F2328; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .opt.ng, :root:not([data-theme="light"]) .opt.ok { color: #1F2328; } }

.apsel { display: flex; gap: 8px; justify-content: center; }
.apbtn {
  appearance: none; font: inherit; min-height: 50px; min-width: 96px; font-size: 20px; font-weight: 700; cursor: pointer; line-height: 1.8;
  border: 2px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
.apbtn.on { border-color: var(--btn); background: var(--btn); color: var(--btn-ink); }
.boxes { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 6px; font-size: 24px; font-weight: 700; }
.box {
  appearance: none; font: inherit; font-size: 36px; font-weight: 700; width: 2.3em; height: 1.45em; padding: 0; cursor: pointer;
  border: 3px solid var(--line); border-radius: 10px; background: #FFFFFF; color: #2F5D8A; font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.box.focus { border-color: #2F5D8A; box-shadow: 0 0 0 3px rgba(47,93,138,.25); }
.box.focus:empty::after, .box.focus::after { content: ''; display: inline-block; width: 3px; height: .8em; background: #2F5D8A; vertical-align: -0.08em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.unit { font-size: 22px; }
.pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; }
.key {
  appearance: none; font: inherit; font-size: 28px; font-weight: 700; min-height: 54px; 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 { font-size: 18px; color: var(--accent); }
.key.half { font-size: 22px; color: var(--accent); line-height: 1.6; }
.key.enter { grid-column: span 3; font-size: 20px; background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.key.half[hidden] + .key.enter { grid-column: span 4; }
.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; }

.ans-set { display: flex; flex-direction: column; gap: 8px; }
.setrow { display: grid; grid-template-columns: 7.2em 1fr 1fr; gap: 8px; align-items: center; }
.setlbl { font-weight: 700; font-size: 15px; white-space: nowrap; }
.btn.arrow { display: inline-flex; align-items: center; justify-content: center; gap: 2px; padding: 0 6px; min-height: 50px; font-size: 16px; white-space: nowrap; }
.now { margin: 0; text-align: center; color: var(--ink-sub); font-size: 16px; line-height: 1.9; }
.btn.check { min-height: 54px; font-size: 19px; }

.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); line-height: 1.9; }
.tag.retry { color: var(--ng); }
.status { line-height: 1.9; }

/* ---------- 設定 ---------- */
.levels .choice span { position: relative; line-height: 1.9; }
.levels .choice span .star { position: absolute; right: 2px; top: -4px; font-size: 14px; color: #B7791F; font-style: normal; }

/* ---------- 結果 ---------- */
.result-box { position: static; margin: 0 auto; max-width: 560px; }
.result-box .big { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.result-box .weak { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0 10px; }
.result-box .weak span { display: inline-flex; align-items: center; gap: 4px; border: 2px solid var(--ng); color: var(--ink); border-radius: 6px; padding: 2px 8px 2px 4px; font-weight: 700; line-height: 1.8; }
.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; }
svg.clock.mini { width: 40px; height: 40px; flex: none; }
.callout { z-index: 5; top: 38%; }

@media (max-width: 420px) {
  .stage { padding: 8px; }
  .clock-box { width: min(100%, 272px); }
  .ask { font-size: 18px; margin-top: 2px; }
  .opt { min-height: 56px; font-size: 21px; }
  .ans-choice.ap .opt { font-size: 17px; }
  .key { min-height: 48px; font-size: 25px; }
  .box { font-size: 30px; }
  .controls .btn.icon { padding: 0 9px; }
  .btn.arrow { padding: 0 4px; font-size: 14px; }
  .setrow { grid-template-columns: 6.4em 1fr 1fr; gap: 6px; }
  .setlbl { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .qcard.pop .clock-box, .clock-box svg.shake, .fb.shake, .box.focus::after { animation: none; }
}
.howto img.narrow { max-width: 560px; }
.btn.arrow svg { display: inline-block; width: 22px; height: 22px; flex: none; }
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 2; --tb-st-lines: 1.25; --tb-rt: 11px; --tb-st-rt: 11px; }
@media (min-width: 375px) { .turnbar { --tb-msg-lines: 1; --tb-st-lines: 1.25; } }
@media (min-width: 641px) { .turnbar { --tb-msg-lines: 1; --tb-st-lines: 1.25; } }
/* 上のバーの高さ ここまで */
