/* 스페어 볼링장 — 3D 캔버스 위에 HUD를 얹는다 */
:root {
  --bg: #14110f; --panel: rgba(20, 17, 15, 0.82); --line: rgba(255, 255, 255, 0.16); --text: #f4efe6; --dim: #b8ad9c;
  --accent: #ffb24a; --good: #8fe36a; --bad: #ff6b5a;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#cv, #fx, #fx2 { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#cv { touch-action: none; user-select: none; -webkit-user-select: none; }
#fx, #fx2 { pointer-events: none; }
#fx2 { z-index: 42; }      /* 입자(별·색종이)는 결과 카드 위에도 날린다. 조준 덧그림(#fx)은 HUD 아래 */

/* ───── 상단 ───── */
.topbar { position: fixed; top: var(--safe-t); left: 0; right: 0; height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 8px; z-index: 30; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-size: 13px; white-space: nowrap; }
.back-btn:hover { border-color: var(--accent); }
.mode-label { flex: 1; min-width: 0; text-align: center; font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; text-shadow: 0 1px 3px #000; }
.tools { display: flex; gap: 6px; margin-left: auto; }
.mini { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 15px; display: inline-grid; place-items: center; padding: 0; }
.mini:hover { border-color: var(--accent); }

/* ───── 점수판 ───── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
#hud > * { pointer-events: auto; }
.board { position: absolute; top: calc(44px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(100%, 480px); padding: 0 4px; pointer-events: none !important; }
/* 마지막 프레임은 기호가 셋이라 1.5배 넓다 (--m = 프레임 수 - 1) */
.brow { display: grid; grid-template-columns: 42px repeat(var(--m), minmax(0, 1fr)) minmax(0, 1.5fr) 34px; height: 36px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 2px; }
.brow.small { height: 27px; opacity: 0.86; }
.brow.on { border-color: var(--accent); }
.bname, .btotal { display: grid; place-items: center; font-size: 11px; font-weight: 700; overflow: hidden; white-space: nowrap; }
.bname { display: block; align-self: center; text-align: center; padding: 0 2px; text-overflow: ellipsis; min-width: 0; }   /* 긴 이름은 말줄임 */
.btotal { font-size: 14px; color: var(--accent); border-left: 1px solid var(--line); }
.bcell { border-left: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; min-width: 0; overflow: hidden; }
.bcell.cur { background: rgba(255, 178, 74, 0.16); }
.bm { display: flex; justify-content: flex-end; gap: 1px; font-size: 12px; line-height: 15px; height: 15px; padding-right: 2px; }
.bm i { font-style: normal; min-width: 9px; text-align: center; }
.bm i.x { color: var(--accent); font-weight: 800; }
.bm i.s { color: var(--good); font-weight: 800; }
.bm i.split { outline: 1px solid var(--bad); border-radius: 50%; }
.bm i.stamp { animation: stamp 0.45s cubic-bezier(.2, 1.5, .4, 1); }      /* 방금 찍힌 기호: 도장처럼 */
@keyframes stamp { 0% { transform: scale(3.2) rotate(-18deg); opacity: 0; } 55% { transform: scale(0.85); opacity: 1; } 100% { transform: none; } }
.bcell b { font-size: 12px; line-height: 16px; text-align: center; font-weight: 700; }
.brow.small .bm { font-size: 11px; line-height: 12px; height: 12px; }
.brow.small .bcell b { font-size: 10px; line-height: 12px; }
.brow.small .btotal { font-size: 12px; }
.bstrip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 36px; padding: 5px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.st-title { font-weight: 700; }
.st-marks { letter-spacing: 2px; }
.st-sub { color: var(--dim); font-size: 11px; flex-basis: 100%; }
/* 대전: 다른 선수 합계 칩 (누르면 전체 점수판) */
.bchips { pointer-events: auto; display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; width: 100%; min-height: 28px; padding: 3px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-size: 11px; text-align: left; }
.bchips span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.bchips span i { width: 8px; height: 8px; border-radius: 50%; }
.bchips b { color: var(--accent); font-size: 12px; }
.bchips em { margin-left: auto; font-style: normal; color: var(--dim); }
.board.in-card { position: static; transform: none; width: 100%; padding: 0; }
.board.in-card .brow { grid-template-columns: 34px repeat(var(--m), minmax(0, 1fr)) minmax(0, 1.7fr) 30px; }
.board.in-card .bm { gap: 0; padding-right: 1px; }
.board.in-card .bm i { min-width: 8px; }

.lamp { position: absolute; right: 4px; top: calc(112px + var(--safe-t)); width: 88px; height: 96px; pointer-events: none !important; }
@media (min-width: 720px) { .lamp { right: auto; left: calc(50% + 250px); top: calc(48px + var(--safe-t)); } }
.banner { position: absolute; left: 50%; top: 41%; transform: translate(-50%, -50%) scale(0.6); opacity: 0; padding: 8px 22px; border-radius: 14px; background: rgba(12, 10, 9, 0.86); border: 2px solid var(--line);
  font-size: 30px; font-weight: 900; white-space: nowrap; text-align: center; transition: transform 0.18s cubic-bezier(.2, 1.6, .4, 1), opacity 0.18s; pointer-events: none !important; z-index: 5; }
.banner small { display: block; font-size: 13px; font-weight: 600; color: var(--dim); margin-top: 1px; }
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.banner.good { color: var(--accent); border-color: var(--accent); box-shadow: 0 0 24px rgba(255, 178, 74, 0.35); }
.banner.bad { color: var(--bad); border-color: var(--bad); }
/* 상대(AI)의 결과: 점수판 바로 아래에 한 줄로 작게 — 곧 시작되는 내 조준(▲ 눈금·헤드핀 줄)을 가리지 않는다 */
.banner.ai { top: calc(142px + var(--safe-t)); padding: 4px 14px; font-size: 16px; border-width: 1px; border-radius: 999px; box-shadow: none; display: flex; flex-direction: row-reverse; align-items: baseline; gap: 7px; }
.banner.ai small { margin: 0; font-size: 12px; }
.tip { position: absolute; left: 50%; bottom: calc(252px + var(--safe-b)); transform: translateX(-50%); margin: 0; max-width: min(92%, 420px); padding: 7px 14px; border-radius: 12px; background: rgba(255, 245, 225, 0.94); color: #2a2019;
  font-size: 13px; font-weight: 600; text-align: center; pointer-events: none !important; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
.readout { position: absolute; left: max(8px, calc(50% - 236px)); bottom: calc(128px + var(--safe-b)); margin: 0; font-size: 11px; color: var(--text); text-shadow: 0 1px 3px #000, 0 0 6px #000; pointer-events: none !important; white-space: pre-line; line-height: 1.35; }
.ctx-btn { position: absolute; right: max(8px, calc(50% - 236px)); bottom: calc(130px + var(--safe-b)); min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 700; }
.ctx-btn:hover { border-color: var(--accent); }
#hud.rp .dock, #hud.rp .lamp, #hud.rp .readout { visibility: hidden; }      /* 다시 보기: 화면을 비운다(자리는 그대로) */
#hud.rp .tip { bottom: calc(84px + var(--safe-b)); }
.hl { animation: hl 1.1s ease-in-out infinite; }
@keyframes hl { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 178, 74, 0); } 50% { box-shadow: 0 0 0 3px rgba(255, 178, 74, 0.9); } }

/* ───── 도크 ───── */
.dock { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 480px); padding: 8px 8px calc(8px + var(--safe-b)); background: linear-gradient(to bottom, rgba(12, 10, 9, 0.55), rgba(12, 10, 9, 0.9));
  border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; touch-action: none; user-select: none; -webkit-user-select: none; transition: opacity 0.2s; }
.dock.off { opacity: 0.45; pointer-events: none !important; }
.dock-row { display: flex; gap: 6px; align-items: stretch; height: 44px; }
.nudge { flex: 0 0 62px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 12px; font-weight: 700; padding: 0; touch-action: none; }
.nudge:active { border-color: var(--accent); background: rgba(255, 178, 74, 0.2); }
.spin-bar { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; min-width: 0; border-radius: 10px; }
.spin-cell { border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 700; padding: 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 1px; }
.spin-cell b { font-weight: 700; }
/* 휘는 방향 화살표(위로 가다 옆으로 꺾임). 왼쪽 회전은 화살표가 숫자 앞, 오른쪽 회전은 뒤(좌우 뒤집음) */
.spin-cell .hook { width: 10px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.spin-cell .hook.flip { transform: scaleX(-1); }
.spin-cell.on { background: var(--accent); color: #201608; border-color: var(--accent); }
.spin-cell:disabled { opacity: 0.3; cursor: default; }
.stance { position: relative; height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); touch-action: none; cursor: ew-resize; overflow: hidden; }
/* 띠 너비 336px = ±420mm (1px = 2.5mm). 그보다 좁은 화면에서는 띠가 줄고 ui.js가 1px당 mm를 다시 잰다 */
.stance-track { position: absolute; left: 50%; top: 0; width: min(336px, calc(100% - 24px)); height: 100%; transform: translateX(-50%); pointer-events: none; }
.stance-track i { position: absolute; top: 31px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--dim); }
.stance-track i:nth-child(1) { left: 1.07%; } .stance-track i:nth-child(2) { left: 17.38%; } .stance-track i:nth-child(3) { left: 33.69%; }      /* ±137·274·411mm */
.stance-track i:nth-child(4) { left: 50%; background: var(--accent); width: 7px; height: 7px; margin-left: -3.5px; top: 30px; }
.stance-track i:nth-child(5) { left: 66.31%; } .stance-track i:nth-child(6) { left: 82.62%; } .stance-track i:nth-child(7) { left: 98.93%; }
.stance-track b { position: absolute; top: 3px; left: 50%; transform: translateX(-50%); font-size: 20px; line-height: 24px; font-weight: 400; }
.stance-cap { position: absolute; left: 8px; top: 4px; font-size: 10px; color: var(--dim); pointer-events: none; }

/* ───── 메뉴 (4탭) ───── */
.menu { position: fixed; inset: 0; z-index: 25; overflow-y: auto; -webkit-overflow-scrolling: touch; background: rgba(14, 12, 10, 0.93); padding: calc(52px + var(--safe-t)) 12px calc(84px + var(--safe-b)); }
.menu-in { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 26; display: flex; justify-content: center; gap: 4px; padding: 6px 8px calc(6px + var(--safe-b)); background: #110e0c; border-top: 1px solid var(--line); }
.tab { flex: 1 1 0; max-width: 136px; min-height: 52px; border-radius: 12px; border: 1px solid transparent; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 12px; color: var(--dim); }
.tab i { font-style: normal; font-size: 19px; line-height: 1.1; filter: grayscale(0.7); }
.tab.on { color: var(--text); border-color: var(--accent); background: rgba(255, 178, 74, 0.14); font-weight: 700; }
.tab.on i { filter: none; }
.logo { margin: 4px 0 0; font-size: 30px; text-align: center; }
.tagline { margin: 0; text-align: center; color: var(--dim); font-size: 13px; }
.msec { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msec h2 { margin: 0; font-size: 16px; } .msec h3 { margin: 6px 0 0; font-size: 13px; color: var(--text); } .msec h3.locked { color: var(--dim); }
.msec small { font-weight: 400; color: var(--dim); font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips.center { justify-content: center; }
.chips .gap { width: 8px; }
.chip { min-height: 36px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.chip.on { background: var(--accent); color: #201608; border-color: var(--accent); font-weight: 700; }
.chip.on small { color: #5a3d10; }
.chip:disabled, .bowler:disabled, .pcard:disabled { opacity: 0.5; cursor: default; }
.btn { display: inline-block; min-height: 42px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); font-size: 14px; font-weight: 700; text-align: center; text-decoration: none; color: var(--text); }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #201608; border-color: var(--accent); }
.btn.primary small { color: #5a3d10; }
.btn.big { font-size: 20px; padding: 16px; }
.btn.small { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.btn.small.on { border-color: var(--accent); color: var(--accent); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: 0.5; cursor: default; }
.note { margin: 0; font-size: 12px; color: var(--dim); line-height: 1.5; }
.note b { color: var(--text); }
.note.keys { display: none; }
.note.warn { color: var(--bad); font-weight: 700; }
@media (hover: hover) and (pointer: fine) { .note.keys { display: block; } }
.balldot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--c1), var(--c2) 62%); box-shadow: inset -2px -2px 3px rgba(0, 0, 0, 0.35); }
.balldot.big { width: 44px; height: 44px; box-shadow: inset -6px -6px 9px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.4); }
.lanesw { flex: none; width: 44px; height: 44px; border-radius: 8px; border: 2px solid var(--ac); background: repeating-linear-gradient(90deg, var(--w1) 0 5px, var(--w2) 5px 10px); box-shadow: 0 0 0 3px var(--bg); }
/* 리그 상대 */
.bowlers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.bowler { min-height: 62px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); display: grid; grid-template-columns: minmax(0, 1fr) auto; text-align: left; gap: 0 6px; min-width: 0; }
.bowler b { font-size: 13px; } .bowler small { grid-column: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .bowler i { grid-row: 1 / span 3; grid-column: 2; align-self: center; font-style: normal; color: var(--accent); font-size: 12px; }
.bowler.beaten { border-color: rgba(143, 227, 106, 0.5); }
.bowler:not(:disabled):hover, .prob:hover, .pcard:not(:disabled):hover { border-color: var(--accent); }
/* 오늘의 스페어·문제집 */
.dset { display: flex; justify-content: space-between; gap: 4px; }
.dprob { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.dprob b { font-size: 14px; line-height: 1.2; font-weight: 400; }
.rack { display: block; }
.probs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.prob { padding: 6px 2px 5px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.prob b { font-size: 12px; } .prob i { font-style: normal; font-size: 10px; color: var(--accent); letter-spacing: -1px; }
.prob.full { border-color: rgba(255, 178, 74, 0.55); background: rgba(255, 178, 74, 0.1); }
/* 프로숍 */
.cards { display: flex; flex-direction: column; gap: 6px; }
.pcard { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); text-align: left; }
.pcard.on { border-color: var(--accent); background: rgba(255, 178, 74, 0.12); }
.pc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pc-main b { font-size: 14px; }
.pcard em { flex: none; font-style: normal; font-size: 12px; color: var(--accent); font-weight: 700; }
.sbars { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 2px; align-items: center; }
.sbar { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; color: var(--dim); }
.sbar em { font-style: normal; font-weight: 400; color: var(--dim); font-size: 10px; }
.sbar i { width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; display: block; }
.sbar u { display: block; height: 100%; background: var(--accent); }
.sbest { font-size: 11px; color: var(--accent); }
/* 기록 */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stat { padding: 8px 4px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); text-align: center; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat b { font-size: 17px; color: var(--accent); } .stat span { font-size: 10.5px; color: var(--dim); word-break: keep-all; }
.bests { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; font-size: 12px; }
.bests span { display: flex; justify-content: space-between; gap: 6px; } .bests b { color: var(--accent); } .bests .dim { opacity: 0.5; }
.hist { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.hist span { height: 40px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hist span b { font-size: 14px; line-height: 16px; min-height: 16px; color: var(--good); } .hist span i { font-style: normal; font-size: 9.5px; color: var(--dim); }
.hist span.done { background: rgba(143, 227, 106, 0.14); } .hist span.today { outline: 1px solid var(--accent); }
.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.badge { padding: 8px 4px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1px; opacity: 0.5; min-width: 0; }
.badge.got { opacity: 1; background: rgba(255, 178, 74, 0.12); }
.badge i { font-style: normal; font-size: 22px; line-height: 1.2; } .badge b { font-size: 11.5px; } .badge small { font-size: 9.5px; line-height: 1.3; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 6px 4px 6px 2px; border: none; border-bottom: 1px solid rgba(255, 255, 255, 0.07); background: none; text-align: left; width: 100%; }
.switch span { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; min-width: 0; }
.switch i { flex: none; position: relative; width: 44px; height: 26px; border-radius: 13px; background: rgba(255, 255, 255, 0.16); transition: background 0.15s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch.on i { background: var(--accent); } .switch.on i::after { transform: translateX(18px); }
.slider { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 6px 2px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); font-size: 13px; font-weight: 600; }
.slider b { color: var(--accent); margin-left: 4px; }
.slider input { flex: 0 1 190px; min-width: 0; height: 30px; accent-color: var(--accent); }
.help { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; font-size: 12px; line-height: 1.5; }
.help dt { font-weight: 700; color: var(--accent); white-space: nowrap; } .help dd { margin: 0; color: var(--text); }

/* ───── 모달·불러오기·오류 ───── */
/* 칸 너비를 화면에 묶는다(minmax(0, 1fr)): 안 그러면 입력 칸·선택 상자의 고유 너비가 카드를 화면 밖으로 밀어낸다 */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; background: rgba(0, 0, 0, 0.55); padding: 16px; overflow-y: auto; }
.card { width: min(100%, 360px); background: #1d1915; border: 1px solid var(--line); border-radius: 18px; padding: 20px; text-align: center; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); animation: cardin 0.2s ease-out; }
.card.wide { width: min(100%, 440px); }
@keyframes cardin { from { transform: translateY(10px) scale(0.97); opacity: 0; } }
.card h2 { margin: 0; font-size: 20px; } .card h2 small { font-size: 12px; font-weight: 400; color: var(--dim); } .card p { margin: 0; font-size: 14px; line-height: 1.5; }
.card .note { font-size: 12px; }
.card .big { font-size: 34px; font-weight: 900; color: var(--accent); }
.card .stars { color: var(--accent); letter-spacing: 3px; font-size: 22px; }
.card .marks { font-size: 26px; letter-spacing: 4px; }
.card .good, .good { color: var(--good); font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.row.left { justify-content: flex-start; }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.rank li { display: flex; gap: 10px; justify-content: center; } .rank i { font-style: normal; color: var(--accent); font-weight: 700; }
.rank li.top { font-size: 18px; }
.vsrows { display: flex; flex-direction: column; gap: 6px; }
.vsrow { display: flex; gap: 6px; align-items: center; }
.vscolor { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.7); padding: 0; }
.vsrow input, .vsrow select { min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #14110f; padding: 0 10px; font-size: 14px; }
.vsrow input { flex: 1 1 90px; width: 90px; } .vsrow select { flex: 1 1 130px; width: 130px; }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px); z-index: 45; max-width: 90%; padding: 9px 16px; border-radius: 999px; background: rgba(255, 245, 225, 0.96); color: #2a2019; font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--bg); font-size: 16px; color: var(--dim); }
.err { z-index: 60; background: rgba(0, 0, 0, 0.85); }
.err #errMsg { color: var(--bad); word-break: break-all; }

@media (max-width: 420px) {
  .back-btn { padding: 6px 9px; }
  .nudge { flex-basis: 54px; font-size: 11px; }
  .banner.ai { font-size: 15px; }
  .banner { font-size: 26px; }
  .bowler small { font-size: 10.5px; }
}
@media (max-width: 350px) { .probs { grid-template-columns: repeat(4, minmax(0, 1fr)); } .stats, .badges { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* 좁은 화면: 조준 미세 버튼은 화살표만 남겨(글자는 숨김) 회전 칸에 폭을 준다 */
@media (max-width: 372px) { .nudge { flex-basis: 34px; font-size: 14px; } .nudge span { display: none; } .dock-row { gap: 4px; } .spin-bar { gap: 2px; } }
/* 낮은 가로 화면(휴대폰 가로): 점수판은 왼쪽, 도크는 오른쪽에 두고 레인을 화면 높이 가득 쓴다 (main.js layout()도 같은 조건을 본다) */
@media (orientation: landscape) and (max-height: 520px) {
  .board { left: 4px; transform: none; width: min(40%, 320px); }
  .dock { left: auto; right: 0; transform: none; width: min(42%, 352px); border-left: 1px solid var(--line); border-radius: 12px 0 0 0; }
  .nudge { flex-basis: 34px; font-size: 14px; } .nudge span { display: none; } .dock-row { gap: 4px; } .spin-bar { gap: 2px; }
  .banner.ai { top: calc(60px + var(--safe-t)); }
  .lamp { left: 8px; right: auto; top: auto; bottom: calc(8px + var(--safe-b)); }
  .readout { left: 104px; bottom: calc(10px + var(--safe-b)); }
  .ctx-btn { right: auto; left: 104px; bottom: calc(48px + var(--safe-b)); }
  .tip { left: 8px; transform: none; bottom: calc(112px + var(--safe-b)); max-width: min(38%, 300px); text-align: left; }
  .banner { top: 50%; }
  .board.in-card { width: 100%; }
  .modal { place-items: start center; }
}
@media (prefers-reduced-motion: reduce) { .bm i.stamp, .hl, .card { animation: none; } }
