/* ヒットアンドブロー固有の見た目（共通は ../common/base.css） */
:root { --you: var(--p-red); --cpu: var(--p-blue); --tile: 48px; --tile-h: 56px; --tile-sm: 30px; }

[hidden] { display: none !important; }

/* ---------- 盤（数字の札・履歴） ---------- */
.board-wrap { min-height: 260px; }
.secrets { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: center; margin-bottom: 12px; }
.secret { display: flex; align-items: center; gap: 8px; }
.secret .who { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.secret .tiles { display: flex; gap: 4px; }
.mark { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--ink); flex: none; }
.mark.you { background: var(--you); border-radius: 50%; }
.mark.cpu { background: var(--cpu); border-radius: 2px; }

.tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tile); height: var(--tile-h); border-radius: var(--radius);
  background: #FFFFFF; color: #1F2328; border: 2px solid #B9B4A8;
  font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
  filter: var(--shadow-piece); user-select: none;
}
.tile.back { background: #2F5D8A; color: #FFFFFF; border-color: #2F5D8A; }
.tile.mine { border-color: var(--you); }
.tile.sm { width: var(--tile-sm); height: calc(var(--tile-sm) * 1.18); font-size: 19px; border-width: 1.5px; }
.tile.win { border-color: var(--ok); background: #EAF6EE; }
.tile.flip { animation: flip .36s ease-out both; animation-delay: calc(var(--i, 0) * 90ms); }
.tile.drop { animation: drop .22s ease-out both; }
.tile.jump { animation: jump .5s ease-out both; animation-delay: calc(var(--i, 0) * 80ms); }
@keyframes flip { 0% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
@keyframes drop { 0% { transform: translateY(-10px) scale(.9); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes jump { 0%, 100% { transform: none; } 40% { transform: translateY(-12px); } 70% { transform: translateY(2px); } }

/* 履歴 */
.hist { display: grid; grid-template-columns: 1fr; gap: 12px; }
.hist.two { grid-template-columns: 1fr 1fr; gap: 8px; }
.col { border: 1px solid var(--line); border-radius: var(--radius); background: var(--board); color: #1F2328; min-width: 0; }
.col h3 { margin: 0; padding: 6px 10px; font-size: 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; background: var(--surface); color: var(--ink); border-radius: var(--radius) var(--radius) 0 0; }
.col h3 .count { margin-left: auto; font-weight: 400; color: var(--ink-sub); font-size: 14px; }
.col.on h3 { box-shadow: inset 0 -3px 0 var(--accent); }
.col.you.on h3 { box-shadow: inset 0 -3px 0 var(--you); }
.col.cpu.on h3 { box-shadow: inset 0 -3px 0 var(--cpu); }
.rows { list-style: none; margin: 0; padding: 6px 8px; max-height: min(34vh, 300px); min-height: 96px; overflow-y: auto; overscroll-behavior: contain; }
.rows:empty::before { content: attr(data-empty); display: block; color: #5B616B; font-size: 14px; padding: 8px 2px; }
.row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px dashed #E2DED4; }
.row:last-child { border-bottom: 0; }
.row .no { width: 22px; text-align: right; color: #5B616B; font-size: 14px; font-variant-numeric: tabular-nums; flex: none; }
.row .tiles { display: flex; gap: 3px; flex: none; }
.row.miss .tiles .tile { background: #F3F1EB; }
.fb { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pins { display: flex; gap: 3px; flex: none; }
.pin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid transparent; }
.pin.hit { background: var(--p-red); border-color: #1F2328; }
.pin.blow { background: #FFFFFF; border-color: #1F2328; }
.pin.none { width: 6px; height: 6px; margin: 4px; background: #CFCAC0; }
.pin.pop { animation: pinpop .22s ease-out both; }
@keyframes pinpop { 0% { transform: scale(0); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
.fb .txt { font-size: 15px; font-weight: 700; white-space: nowrap; }
.fb .txt .h { color: #A3342B; } .fb .txt .b { color: #1F2328; }
.hist.two .row .no { display: none; }
.hist.two .rows { padding: 4px 6px; }
.hist.two .row { gap: 6px; }
.hist.two .tile.sm { --tile-sm: 23px; font-size: 16px; }
.hist.two .row .tiles { gap: 2px; }
.hist.two .fb { flex-direction: column; align-items: flex-start; gap: 1px; }
.hist.two .pin { width: 11px; height: 11px; border-width: 1.5px; }
.hist.two .pin.none { width: 5px; height: 5px; margin: 3px; }
.hist.two .fb .txt { font-size: 14px; line-height: 1.2; }
.hist.two .col h3 { font-size: 14px; padding: 6px 8px; }
.legend { color: var(--ink-sub); font-size: 14px; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* CPUの推理・ヒント */
.think { margin-top: 12px; 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 4px; }
.think .big { font-size: 1.15rem; font-weight: 700; }
.think .facts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 15px; }
.think .facts b { font-variant-numeric: tabular-nums; }
.think .list { font-variant-numeric: tabular-nums; letter-spacing: .04em; color: var(--ink-sub); font-size: 15px; word-break: break-all; }
.think .reason { color: var(--ink); }

/* ---------- 入力 ---------- */
.entry { display: flex; justify-content: center; gap: 8px; margin: 12px 0 8px; }
.slot { width: 52px; height: 60px; border-radius: var(--radius); border: 2px dashed var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; background: var(--surface); color: var(--ink); }
.slot.filled { border-style: solid; border-color: #B9B4A8; background: #FFFFFF; color: #1F2328; filter: var(--shadow-piece); }
.slot.cur { border: 3px solid var(--accent); }
.entry.shake { animation: shake .3s linear; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

.keypad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 420px; margin: 0 auto; }
.key {
  position: relative; appearance: none; font: inherit; font-size: 26px; font-weight: 700; min-height: 54px;
  border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.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; }
.key.wide { grid-column: span 2; font-size: 18px; }
.key.del { grid-column: span 2; font-size: 18px; }
.key.go { grid-column: span 3; background: var(--btn); border-color: var(--btn); color: var(--btn-ink); font-size: 19px; }
.key .memo { position: absolute; top: 2px; right: 4px; font-size: 15px; line-height: 1; font-weight: 700; }
.key.m-no { color: var(--ink-sub); background: var(--bg); }
.key.m-no .digit { text-decoration: line-through; text-decoration-thickness: 2px; }
.key.m-no .memo { color: var(--ng); }
.key.m-yes { border-color: var(--ok); }
.key.m-yes .memo { color: var(--ok); }
.keypad.memo-mode .key.num { border-style: dashed; border-color: var(--accent); }
.memo-help { text-align: center; color: var(--ink-sub); font-size: 14px; margin: 6px 0 0; }

.watchbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: center; margin-top: 12px; }
.btn[aria-pressed="true"] { background: var(--accent-soft); }

/* 結果（盤の上に重ねる） */
.result-box { inset: 8% 6% auto; z-index: 2; }
.result-box .answer { display: flex; justify-content: center; gap: 4px; margin: 0 0 12px; }
.callout { z-index: 3; top: 32px; }

@media (max-width: 400px) {
  :root { --tile: 40px; --tile-h: 48px; }
  .slot { width: 48px; height: 56px; }
  .key { min-height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  .tile.flip, .tile.drop, .tile.jump, .pin.pop, .entry.shake { animation: none; }
}
.howto img[src*="zero"], .howto img[src*="dup"] { max-width: 600px; }

/* 操作のしかた: 数字キー10個の行が長いので、2行に折り返して説明の幅を残す */
.controls-inline dt { white-space: normal; max-width: 270px; }

/* 英語のページ（index.en.html）だけ: 結果の文（0 bulls 2 cows）が長いので、狭い幅では印の下に置く */
@media (max-width: 400px) { :root:lang(en) .fb { flex-direction: column; align-items: flex-start; gap: 1px; } }
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 3; --tb-st-lines: 1; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { .turnbar { --tb-msg-lines: 3; --tb-st-lines: 1; } }
@media (min-width: 641px) { .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
:root:lang(en) .turnbar { --tb-msg-lines: 4; --tb-st-lines: 2; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { :root:lang(en) .turnbar { --tb-msg-lines: 4; --tb-st-lines: 2; } }
@media (min-width: 641px) { :root:lang(en) .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
