/* テンパズル固有の見た目（共通は ../common/base.css） */
[hidden] { display: none !important; }

.board-wrap { min-height: 220px; }

/* ---------- 問題の札（切符の数字） ---------- */
.ticket { border: 2px solid var(--line); border-radius: var(--radius); background: var(--board); color: #1F2328; padding: 8px 12px 14px; }
.ticket-head { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #5B616B; font-weight: 700; margin-bottom: 8px; min-height: 24px; }
.rule-tag { margin-left: auto; font-weight: 400; }
.cards { display: flex; justify-content: center; align-items: center; gap: 12px; }
.card {
  position: relative; appearance: none; font: inherit; cursor: pointer;
  width: 68px; height: 84px; border-radius: 8px; background: #FFFFFF; color: #1F2328;
  border: 2px solid #B9B4A8; font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
  filter: var(--shadow-piece); transition: transform var(--dur), opacity var(--dur), filter var(--dur);
}
.card:hover:not(:disabled) { border-color: var(--accent); }
.card:active:not(:disabled) { transform: translateY(1px); }
.card:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.card.used { opacity: .3; filter: none; transform: translateY(3px); cursor: default; }
.card:disabled:not(.used) { cursor: not-allowed; }
.card.next { border-color: var(--accent); border-width: 3px; }
.card .no { position: absolute; left: 5px; top: 3px; font-size: 14px; font-weight: 700; color: #5B616B; }
.card.win { border-color: var(--ok); background: #EAF6EE; opacity: 1; transform: none; filter: var(--shadow-piece); }
.card.deal { animation: deal .3s ease-out backwards; animation-delay: calc(var(--i, 0) * 70ms); }
.card.jump { animation: jump .5s ease-out; animation-delay: calc(var(--i, 0) * 80ms); }
@keyframes deal { 0% { transform: translateY(-14px) rotateX(70deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes jump { 0%, 100% { transform: none; } 40% { transform: translateY(-12px); } 70% { transform: translateY(2px); } }
.stage .cards svg.arrow { width: 14px; height: 14px; flex: none; color: #8A8F97; margin: 0 -8px; }
.cards.slots .card { cursor: default; display: inline-flex; align-items: center; justify-content: center; }
.cards.slots .card.empty { background: transparent; border-style: dashed; filter: none; }
.cards.slots .card.cur { border: 3px solid var(--accent); }

/* ---------- 式 ---------- */
.expr-box { margin-top: 10px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 6px 12px 4px; }
.expr-box.ok { border-color: var(--ok); }
.expr-box.shake { animation: shake .3s linear; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.expr { min-height: 64px; display: flex; flex-wrap: wrap; align-items: flex-start; align-content: flex-start; gap: 0 2px; font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; padding-bottom: 4px; }
.expr:empty::before { content: attr(data-empty); font-size: 16px; font-weight: 400; color: var(--ink-sub); align-self: center; line-height: 1.5; }
.expr .tk { display: inline-block; padding: 0 1px; }
.expr .tk.op { color: var(--accent); padding: 0 3px; }
.expr .tk.par { color: var(--ink-sub); }
.expr .grp { display: inline-flex; align-items: flex-start; position: relative; padding-bottom: 22px; }
.expr .grp::after {
  content: '＝' attr(data-v); position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  font-size: 14px; line-height: 20px; font-weight: 700; color: var(--ok); white-space: nowrap;
  border-top: 2px solid var(--ok); padding: 0 4px; min-width: 70%; text-align: center;
}
:root:lang(en) .expr .grp::after { content: '=' attr(data-v); }
.expr .grp.open::after { content: none; }
.expr .cursor { display: inline-block; width: 3px; height: 36px; margin: 4px 2px 0; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.now { min-height: 30px; text-align: right; font-size: 16px; color: var(--ink-sub); display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.now b { font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.now.ten b { color: var(--ok); }
.fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; font-size: .8em; margin: 0 2px; }
.fr > span:first-child { border-bottom: 2px solid currentColor; padding: 0 2px; }

/* ---------- ボタン ---------- */
.keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; max-width: 520px; margin: 12px auto 0; }
.keys.edit { grid-template-columns: 1fr 1fr 1.4fr; }
.keys.digits { grid-template-columns: repeat(5, 1fr); }
.key {
  appearance: none; font: inherit; font-size: 28px; font-weight: 700; min-height: 54px; padding: 0 4px;
  border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer;
}
.key.op { color: var(--accent); }
.key.wide { font-size: 17px; }
.key.go { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); font-size: 18px; }
.key:active:not(:disabled) { transform: translateY(1px); }
.key:disabled { opacity: .35; cursor: not-allowed; }
.key:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.after { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.timer { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 18px; min-width: 64px; text-align: center; }
.timer.low { color: var(--ng); }
.btn[aria-pressed="true"] { background: var(--accent-soft); }

/* ---------- ヒント・解き方 ---------- */
.think { margin-top: 10px; border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 14px; background: var(--surface); }
.think h3 { margin: 0 0 4px; font-size: 16px; }
.think p { margin: 0 0 6px; }
.think .big { font-size: 1.15rem; font-weight: 700; }
.steps { list-style: none; padding: 0; margin: 4px 0 6px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.steps li { display: inline-flex; align-items: center; gap: 6px; }
.steps li + li::before { content: ''; width: 18px; height: 12px; background: currentColor; color: var(--ink-sub); clip-path: polygon(0 35%, 60% 35%, 60% 0, 100% 50%, 60% 100%, 60% 65%, 0 65%); }
.sols { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; font-size: 18px; font-variant-numeric: tabular-nums; max-height: 220px; overflow-y: auto; }
.sols li.mine { font-weight: 700; color: var(--ok); }
.lv { 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; }
.lv.easy { color: var(--ok); } .lv.normal { color: var(--accent); } .lv.hard { color: var(--ng); }
.rulecheck { margin: 6px 0 0; padding: 0; list-style: none; font-size: 15px; }
.rulecheck li { display: flex; gap: 8px; }

/* 結果（盤の上に重ねる） */
.result-box { inset: 4% 4% auto; z-index: 2; }
.result-box .big { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.result-box ul { list-style: none; padding: 0; margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.callout { z-index: 3; top: 50%; }

@media (max-width: 420px) {
  .card { width: 60px; height: 74px; font-size: 38px; }
  .cards { gap: 10px; }
  .expr { font-size: 28px; min-height: 56px; }
  .key { min-height: 50px; font-size: 26px; }
  .keys { gap: 6px; }
  .key.wide, .key.go { font-size: 16px; }
  .ticket { padding: 6px 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .card.deal, .card.jump, .expr-box.shake, .expr .cursor { animation: none; }
}
.howto img.narrow { max-width: 560px; }

/* 操作のしかた: 数字キー10個の行を折り返して説明の幅を残す。行が長いので広い画面でも1列で並べる */
#controls-inline dt { white-space: normal; max-width: 270px; }
#controls-inline dl.cc-two { grid-template-columns: fit-content(60%) 1fr; }
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; --tb-rt: 0px; --tb-st-rt: 0px; }
@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: 2; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { :root:lang(en) .turnbar { --tb-msg-lines: 3; --tb-st-lines: 2; } }
@media (min-width: 641px) { :root:lang(en) .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
