/* 곱셈·나눗셈 코너 (허브, 단 고르기, 문제, 판 종료). 공용 토큰은 style.css */

body[data-level="mul"] { --bg: #f3ecdf; --accent: #2e7d4f; --room-1: #efe5d2; --room-2: #e3d3b4; --room-3: #c9b089; }

/* 홈 좌측 하단 "곱셈·나눗셈" 칸 (REQ-MHUB-001). 뺄셈 칸(우측 하단)은 그대로 */
.mul-entry {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  padding: 0 24px;
  border-radius: 99px;
  background: #f6d9a8;
  box-shadow: 0 5px 0 rgba(45, 49, 66, 0.14);
  font-size: clamp(18px, 3vmin, 28px);
  font-weight: 800;
}
.mul-entry:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(45, 49, 66, 0.14); }

/* ---------- 허브 ---------- */
.mul-top { display: flex; align-items: center; gap: var(--gap); flex: none; }
.mul-top h2 { margin: 0; font-size: clamp(24px, 4.5vmin, 44px); font-weight: 800; }
.mul-coins { font-size: clamp(18px, 3.2vmin, 30px); font-weight: 800; font-variant-numeric: tabular-nums; position: relative; }
.mul-coins b { color: #a8730a; }
.mul-open { font-size: clamp(16px, 2.8vmin, 26px); font-weight: 700; color: var(--accent); }

.mul-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1.35fr 1fr;
  gap: var(--gap);
}
.mul-panel {
  --pc: #e0c27a; --pbg: #fffaf0;
  min-height: 0; overflow: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: clamp(12px, 2vmin, 20px);
  border: 3px solid var(--pc); border-radius: 22px; background: var(--pbg);
  box-shadow: 0 5px 0 rgba(45, 49, 66, 0.08);
}
.mul-panel h3 { margin: 0; font-size: clamp(18px, 3vmin, 28px); font-weight: 800; }
.p-stage { --pc: #e0b44f; --pbg: #fff8e8; }
.p-race { --pc: #7ea7d8; --pbg: #eef5fd; }
.p-vehicle { --pc: #79b98a; --pbg: #eef8f0; }
.p-shop { --pc: #a68ad6; --pbg: #f6f0fd; }

.mul-rows { display: flex; flex-direction: column; gap: 8px; }
.mul-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 56px; padding: 6px 16px; /* 허브 행: 44px 이상 (REQ-MPLT-002) */
  border: 2px solid var(--pc); border-radius: 14px; background: #fff;
  text-align: left; font-size: clamp(16px, 2.6vmin, 24px); font-weight: 700;
  min-width: 0;
}
.mul-row:active { background: var(--press); }
.mul-row-state { flex: none; font-size: 0.8em; color: var(--accent); }
.mul-row.locked { background: rgba(45, 49, 66, 0.06); border-color: rgba(45, 49, 66, 0.12); color: var(--ink-soft); }
.mul-row.locked .mul-row-state { color: var(--ink-soft); }
.mul-row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mul-row:disabled { cursor: default; }

.mul-vname { margin: auto 0 0; font-size: clamp(18px, 3vmin, 28px); font-weight: 800; }
.mul-items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: auto; }
.mul-item { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 14px; background: rgba(45, 49, 66, 0.06); font-weight: 700; color: var(--ink-soft); }
.mul-version { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(4px, env(safe-area-inset-bottom)); margin: 0; font-size: 12px; color: var(--ink-soft); opacity: 0.7; }

/* 세로 화면: 4구역을 위아래로 쌓고 허브 전체를 스크롤 (REQ-MHUB-002) */
@media (orientation: portrait) {
  .mul-grid { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-rows: auto; overflow: auto; }
  .mul-panel { overflow: visible; min-height: auto; } /* 내용만큼 높이, 허브 전체가 스크롤 */
}

/* ---------- 단 고르기 ---------- */
.dan-list { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: var(--gap); }
.dan-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 0 rgba(45, 49, 66, 0.12);
}
.dan-card:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(45, 49, 66, 0.12); }
.dan-num { font-size: clamp(32px, 8vmin, 80px); font-weight: 800; }
.dan-card small { font-size: clamp(14px, 2.4vmin, 22px); color: #a8730a; font-weight: 700; }
/* v1.3: 인정받은 단은 회색 + 완료 ✔, 누를 수 없음 (REQ-MSTG-103, GDD 16.5 20번) */
.dan-card.done { background: #e4e6eb; box-shadow: none; color: #8a8f9c; }
.dan-card.done small { color: #3f8f4f; }
.dan-rule { margin: 0; line-height: 1.5; }
.mr-pass { font-size: clamp(18px, 3.4vmin, 30px); font-weight: 800; margin: 0; }
.mr-pass.ok { color: #3f8f4f; }
.mr-pass.no { color: #c0492f; }

/* ---------- 문제 화면 ---------- */
#mp-timefill { height: 100%; background: var(--accent); opacity: 0.7; transform-origin: left; transition: transform 0.2s linear; }
#mp-left { font-size: clamp(18px, 3.2vmin, 30px); font-weight: 800; font-variant-numeric: tabular-nums; }
.mp-info { margin: 0; font-size: clamp(15px, 2.6vmin, 24px); color: var(--ink-soft); flex: none; }
.mp-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.mp-left { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; }
.mp-problem {
  flex: 1; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); background: var(--surface);
  font-size: clamp(40px, 11vmin, 120px); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap;
  transition: background-color 0.15s;
}
.mp-problem.right { background: #d4f0d9; }
.mp-problem.wrong { background: #f8d6d6; }
.mp-slots { flex: none; display: flex; gap: var(--gap); }
.mp-slot {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: clamp(80px, 16vmin, 150px);
  border: 3px solid rgba(45, 49, 66, 0.15); border-radius: var(--radius); background: #fff;
  font-size: clamp(36px, 9vmin, 96px); font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums;
}
.mp-slot.on { border-color: var(--ink); }
.bq-msg { min-height: 1.4em; font-weight: 700; color: #b3261e; } /* 배틀 퀴즈 오답 안내 */
.mp-slot small { font-size: clamp(14px, 2.4vmin, 22px); color: var(--ink-soft); font-weight: 700; }
.mp-slot span { min-height: 1em; line-height: 1; }

@media (orientation: portrait) {
  .mp-body { grid-template-columns: 1fr; grid-template-rows: 1fr 1.1fr; }
}

/* 손계산 노트 (REQ-MNOTE-001~003): 가로는 오른쪽, 세로는 아래 */
.mp-body.with-note { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1.25fr; grid-template-areas: 'left note' 'pad note'; }
.mp-body.with-note .mp-left { grid-area: left; }
.mp-body.with-note .keypad { grid-area: pad; }
.mp-body.with-note .mp-problem { font-size: clamp(36px, 8vmin, 96px); }
.mp-body.with-note .mp-slot { min-height: clamp(64px, 11vmin, 120px); }
@media (orientation: portrait) {
  .mp-body.with-note { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr 1fr; grid-template-areas: 'left' 'pad' 'note'; }
}
.mp-note { grid-area: note; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.mp-note[hidden] { display: none; }
#mp-canvas {
  flex: 1; min-height: 0; width: 100%; display: block;
  border: 2px dashed rgba(45, 49, 66, 0.25); border-radius: var(--radius); background: #fff;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; /* 스크롤·확대·길게 누르기 막기 */
}
.mp-note-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-soft); font-size: clamp(13px, 2vmin, 18px); }
#mp-clear { min-height: 48px; color: #c0392b; border: 2px solid #c0392b; background: #fff; }

/* 코인 +N/−N (REQ-MCOIN-004) */
.coin-delta { position: absolute; left: 100%; top: -0.2em; margin-left: 0.3em; opacity: 0; pointer-events: none; }
.coin-delta.plus { color: #2e7d4f; }
.coin-delta.minus { color: #c0392b; }
.coin-delta.show { animation: coin-pop 0.9s ease-out; }
@keyframes coin-pop { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-14px); } }

/* 판 종료 */
#mul-result { align-items: center; justify-content: center; }

/* ★ 비밀 코드: 작고 흐리게, 터치 영역 44px 이상 (REQ-MHUB-007) */
.mul-star { margin-left: auto; min-width: 48px; min-height: 48px; background: none; font-size: 22px; color: var(--ink); opacity: 0.18; }
.mul-dialog { width: min(92vw, 460px); }
/* 보유 탈것 고르기 (REQ-MVEH-103·104) */
.rg-car { flex: none; align-self: center; display: flex; align-items: center; gap: 12px; padding: 6px 18px; font-size: clamp(15px, 2.6vmin, 22px); }
.rg-car .veh { width: clamp(64px, 10vmin, 96px); }
.mul-pick { width: min(92vw, 560px); }
.pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 2px solid transparent; text-align: left; font-size: clamp(15px, 2.6vmin, 22px); }
.pick-item .veh { width: clamp(64px, 10vmin, 96px); flex: none; }
.pick-item.on { border-color: var(--accent); }
.pick-item small { display: block; color: var(--ink-soft); }
.shop-run { margin: 6px 0 10px; }
.shop-using { display: inline-block; margin: 6px 0 10px; font-weight: 800; color: var(--accent); }
.mul-dialog .keypad { height: min(52vh, 360px); margin-top: 12px; }
.mul-dialog .keypad button { font-size: clamp(24px, 4.5vmin, 40px); }
.code-dots { margin: 0; text-align: center; font-size: 36px; letter-spacing: 0.3em; }
.coin-amount { margin: 8px 0; text-align: center; font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; }
.btn.sign { flex: 1; }
.btn.sign.on { background: var(--accent); color: #fff; }
#coin-minus.on { background: #c0392b; }
#coin-close { display: block; margin: 12px auto 0; }
/* 관리자: 단계별 열기·잠그기 */
.mul-admin { width: min(94vw, 640px); }
.admin-list { display: flex; flex-direction: column; gap: 6px; max-height: 44vh; overflow-y: auto; margin: 8px 0 12px; }
.admin-skip { max-height: none; overflow: visible; }
.mul-admin h3 { margin: 4px 0 0; }
.admin-row { display: flex; align-items: center; gap: 6px; }
.admin-name { flex: 1; font-weight: 700; font-size: clamp(15px, 2.6vmin, 20px); }
.admin-now { min-width: 7.5em; color: var(--ink-soft); font-size: 0.9em; }
.admin-now.on { color: var(--accent); }
.admin-btn { min-height: 44px; padding: 0 12px; }
.admin-btn.on { background: var(--accent); color: #fff; }
/* 배틀 아레나 설정 4158 */
#mul-badmin { width: min(96vw, 900px); }
#mul-badmin .badm-fields { max-height: 50vh; }
.badm-level { display: flex; gap: 6px; margin: 6px 0; }
.badm-level .admin-btn { flex: 1; }
.badm-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.badm-field { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: clamp(14px, 2.3vmin, 18px); }
.badm-field span { flex: 1; }
.badm-field input { width: 6.5em; min-height: 40px; font: inherit; text-align: right; padding: 0 6px; border: 2px solid var(--line, #ccc); border-radius: 8px; }
.badm-field.wide { grid-column: 1 / -1; }
.badm-field.wide input { width: 14em; }
.badm-field.bad input { border-color: #b3261e; background: #fdecea; }
@media (max-aspect-ratio: 1/1) { .badm-fields { grid-template-columns: 1fr; } }

/* ---------- 탈것 임시 도형 (REQ-MVEH-006·007). 8단계에서 이미지로 바꿈 ---------- */
.veh { position: relative; flex: none; width: 72px; height: 40px; }
.veh.big { width: min(60%, 220px); height: auto; aspect-ratio: 2 / 1; margin: 4px auto 0; }
.veh-body {
  position: absolute; left: 0; right: 0; top: 0; bottom: 22%;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--ink); border-radius: 30% 40% 12px 12px; background: var(--vc, #fff);
  font-weight: 800; font-size: 0.9em; color: var(--ink);
}
.veh.big .veh-body { font-size: clamp(20px, 4vmin, 36px); }
.veh-wheel { position: absolute; bottom: 0; left: 14%; width: 26%; aspect-ratio: 1; border-radius: 50%; background: var(--ink); border: 3px solid #fff; box-sizing: border-box; }
.veh-wheel.r { left: auto; right: 14%; }
/* 은·금: 금속 반짝임 (REQ-MVEH-007) */
.shine .veh-body, .swatch.shine {
  background: linear-gradient(110deg, var(--vc) 30%, #fff 45%, var(--vc) 60%) var(--vc);
  background-size: 300% 100%; animation: veh-shine 2.4s linear infinite;
}
@keyframes veh-shine { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { .shine .veh-body, .swatch.shine { animation: none; } }
/* 그림 (REQ-MART-013·014): 잘라 둔 그림을 같은 상자 안에 바닥 맞춤으로 → 기차·비행기도 자전거와 비슷한 폭 */
.veh.img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.veh.img.shine::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.8) 48%, transparent 60%); background-size: 300% 100%;
  -webkit-mask: var(--m) center bottom / contain no-repeat; mask: var(--m) center bottom / contain no-repeat;
  animation: veh-shine 2.4s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .veh.img.shine::after { animation: none; } }
/* 허브 좌하단 무대: 흐르는 배경 + 가운데 고정 탈것 (REQ-MART-017·019) */
.veh-stage { position: relative; overflow: hidden; flex: 1 1 auto; min-height: 120px; border-radius: 14px; background: #bfe6fb; }
.veh-bg { position: absolute; inset: 0; background-repeat: repeat-x; background-size: auto 100%; background-position: 0 100%; }
.veh-stage .veh.big { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); width: auto; height: 52%; aspect-ratio: 2 / 1; margin: 0; }
/* 코인 그림: 가로 폭을 줄였다 늘려 도는 것처럼 (REQ-MART-016) */
.coin-ico { height: 1.2em; width: auto; vertical-align: -0.25em; margin-right: 0.25em; animation: coin-spin 1.6s ease-in-out infinite; }
@keyframes coin-spin { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(0.12); } }
@media (prefers-reduced-motion: reduce) { .coin-ico { animation: none; } }
.mul-item-ico { height: 2.2em; width: auto; opacity: 0.7; }
.mul-vname { margin: 0; }
.mul-vstat { margin: 0; font-size: clamp(14px, 2.3vmin, 20px); color: #a8730a; letter-spacing: 0.02em; }

/* ---------- 상점 칸 (REQ-MSHOP-001·003) ---------- */
.shop-up { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 2px solid var(--pc); border-radius: 14px; background: #fff; }
.shop-up-text { flex: 1; min-width: 0; display: flex; flex-direction: column; margin: 0; font-size: clamp(15px, 2.4vmin, 22px); }
.shop-up-text small { color: var(--ink-soft); font-size: 0.8em; }
.buy-btn { flex: none; min-height: 48px; min-width: 88px; padding: 0 16px; }
.btn.primary.buy-btn { background: #7b5cc4; }
.buy-btn:disabled { background: rgba(45, 49, 66, 0.12) !important; color: var(--ink-soft); }

/* ---------- 탈것 단계 목록 (REQ-MSHOP-011~013·016) ---------- */
#mul-shop { --pc: #a68ad6; }
.shop-list { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.shop-item { flex: none; border: 2px solid rgba(45, 49, 66, 0.12); border-radius: 16px; background: #fff; }
.shop-item.current { border-color: var(--pc); box-shadow: 0 0 0 3px rgba(166, 138, 214, 0.3); }
.shop-head { width: 100%; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 14px; background: none; text-align: left; }
.shop-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: clamp(16px, 2.6vmin, 24px); }
.shop-name small, .shop-cost { color: var(--ink-soft); font-size: clamp(13px, 2vmin, 18px); }
.shop-cost { flex: none; font-weight: 700; color: #a8730a; }
.shop-steps { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.shop-remain { margin: 0 0 4px; font-weight: 800; color: #7b5cc4; }
.shop-step { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 4px 10px; border-radius: 12px; background: rgba(45, 49, 66, 0.04); }
.shop-step.got { opacity: 0.6; }
.shop-step.here { opacity: 1; background: #efe7fb; outline: 3px solid var(--pc); }
.swatch { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--ink); background: var(--vc); }
.shop-step-info { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: clamp(15px, 2.3vmin, 20px); }
.shop-step-info small { color: var(--ink-soft); font-size: 0.82em; }
.shop-step-cost { flex: none; font-weight: 700; color: #a8730a; }
#hub-shop { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
#hub-vehicle { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; }
@media (orientation: portrait) { .veh-stage { flex: none; aspect-ratio: 2.4 / 1; } }

/* ---------- 레이스 전 관문 (REQ-MRGT-004) ---------- */
.rg-title { flex: 1; font-size: clamp(18px, 3.2vmin, 30px); }
.rg-left, .rc-stat { font-size: clamp(18px, 3.2vmin, 30px); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- 레이싱 1 (REQ-MRACE-001·002) ---------- */
#mul-race .bar { gap: clamp(10px, 2.4vmin, 28px); }
.rc-car { margin-left: auto; font-size: clamp(13px, 2.2vmin, 20px); color: var(--ink-soft); text-align: right; }
.rc-canvas { flex: 1; min-height: 0; width: 100%; display: block; border-radius: var(--radius); background: #f8f6ef; touch-action: none; -webkit-user-select: none; user-select: none; }
/* 피버 타임 배너 (REQ-MRACE-115): 트랙 위 가운데, 터치는 트랙으로 통과 */
.rc-fever {
  position: absolute; z-index: 2; left: 50%; top: clamp(64px, 11vmin, 104px); transform: translateX(-50%); margin: 0;
  padding: 6px 22px; border-radius: 12px; background: #f07a1a; color: #fff; border: 3px solid #c2410c;
  font-size: clamp(20px, 3.8vmin, 34px); font-weight: 900; white-space: nowrap; pointer-events: none;
  font-variant-numeric: tabular-nums; animation: rc-fever-pulse 0.6s ease-in-out infinite alternate;
}
@keyframes rc-fever-pulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .rc-fever { animation: none; } }
.rc-controls { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.rc-btn { min-height: 72px; font-size: clamp(18px, 3.4vmin, 30px); }

/* 서킷 레이스 입장 퀴즈 안내 (REQ-CQUIZ-002) */
.cq-msg { position: fixed; inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / 0.35); z-index: 5; }
.cq-msg[hidden] { display: none; }
.cq-msg-text { font-size: clamp(20px, 3.6vmin, 34px); font-weight: 800; text-align: center; white-space: pre-line; }
/* ---------- 서킷 레이스: 상점 아이템 (REQ-CITM-001) ---------- */
.mul-item { color: var(--ink); background: #fff; border: 2px solid var(--pc); }
.mul-item.short { color: var(--ink-soft); background: rgba(45, 49, 66, 0.06); border-color: transparent; }
.mul-item small { font-size: 0.75em; font-weight: 600; color: var(--ink-soft); }

/* ---------- 서킷 레이스: 출발 준비 (REQ-CCAR-001, REQ-CITM-002) ---------- */
.cp-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: var(--gap); overflow: auto; }
.cp-block { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 12px; border-radius: var(--radius); background: var(--surface); }
.cp-block h3 { margin: 0; font-size: clamp(17px, 2.8vmin, 26px); }
.cp-block h3 small { font-size: 0.7em; color: var(--ink-soft); }
.cp-vehicles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; overflow: auto; }
.cp-veh { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border: 3px solid transparent; border-radius: 14px; background: #fff; font-size: clamp(12px, 1.9vmin, 16px); font-weight: 700; }
.cp-veh .veh { width: 100%; height: 48px; }
.cp-veh.on, .cp-color.on { border-color: var(--accent); }
.cp-colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cp-color { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border: 3px solid transparent; border-radius: 14px; background: #fff; font-size: clamp(12px, 1.9vmin, 16px); font-weight: 700; }
.cp-color i { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ink); background: var(--sw); }
.cp-items { display: flex; flex-direction: column; gap: 8px; }
.cp-item { display: grid; grid-template-columns: 1fr 52px auto 52px; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 14px; background: #fff; font-weight: 700; }
.cp-item small { display: block; color: var(--ink-soft); font-weight: 600; }
.cp-item button { min-height: 52px; font-size: 26px; padding: 0; }
.cp-item b { min-width: 2ch; text-align: center; font-size: 1.3em; font-variant-numeric: tabular-nums; }
.cp-note { margin: 0; color: var(--ink-soft); font-size: clamp(13px, 2vmin, 18px); }
.cp-go { flex: none; min-height: 72px; font-size: clamp(22px, 4vmin, 36px); }
@media (orientation: portrait) { .cp-body { grid-template-columns: 1fr; } }

/* ---------- 서킷 레이스: 주행 화면 (REQ-CUI-001~004·006). 버튼은 동시에 누를 수 있게 따로따로 ---------- */
.cr-screen { padding: 0; gap: 0; background: #7cb26b; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.cr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cr-mini { position: absolute; left: max(10px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top)); border-radius: 14px; background: rgb(255 255 255 / 0.78); box-shadow: 0 2px 8px rgb(0 0 0 / 0.2); }
.cr-hud { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 220px); }
.cr-stat.warn { background: #d9453d; color: #fff; }
.cr-stat { padding: 6px 12px; border-radius: 12px; background: rgb(255 255 255 / 0.85); font-size: clamp(16px, 3vmin, 28px); font-weight: 800; font-variant-numeric: tabular-nums; }
.cr-effect { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); margin: 0; padding: 8px 18px; border-radius: 16px; background: rgb(0 0 0 / 0.55); color: #fff; font-size: clamp(20px, 4vmin, 36px); font-weight: 800; pointer-events: none; white-space: nowrap; }
.cr-effect[hidden] { display: none; }
.cr-items { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 10px; }
.cr-item { min-width: 84px; min-height: 64px; padding: 4px 10px; border-radius: 16px; border: 3px solid #fff; background: #ffb54a; color: var(--ink); font-size: clamp(14px, 2.4vmin, 20px); font-weight: 800; box-shadow: 0 3px 0 rgb(0 0 0 / 0.25); }
.cr-item.shield { background: #8cc8ff; } .cr-item.tack { background: #c9c9d1; }
.cr-item:disabled { opacity: 0.35; }
.cr-pad { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 14px; }
.cr-left { left: max(14px, env(safe-area-inset-left)); align-items: flex-end; }
.cr-right { right: max(14px, env(safe-area-inset-right)); }
.cr-btn { width: clamp(84px, 14vmin, 130px); height: clamp(84px, 14vmin, 130px); border-radius: 50%; border: 4px solid #fff; background: rgb(255 255 255 / 0.75); color: var(--ink); font-size: clamp(18px, 3.4vmin, 30px); font-weight: 800; touch-action: none; box-shadow: 0 4px 0 rgb(0 0 0 / 0.25); }
.cr-btn.acc { background: rgb(92 184 92 / 0.9); color: #fff; width: clamp(100px, 17vmin, 160px); height: clamp(100px, 17vmin, 160px); }
.cr-btn.brake { background: rgb(217 69 61 / 0.85); color: #fff; font-size: clamp(14px, 2.6vmin, 22px); }
.cr-btn.on { transform: translateY(3px) scale(0.96); box-shadow: 0 1px 0 rgb(0 0 0 / 0.25); filter: brightness(0.9); }
.ba-screen { background: #5f8f52; } /* 배틀 아레나: 맵 밖은 어두운 풀 */
/* 배틀 준비: 강화 (REQ-BUPG-001~003) — 한 줄 전체 */
.bp-upg { grid-column: 1 / -1; }
.bp-upgrades { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bp-upg-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: #fff; font-weight: 800; }
.bp-upg-row span { flex: 1; }
.bp-upg-row small { color: var(--ink-soft); font-weight: 700; }
.bp-upg-row .btn { min-height: 48px; }
.bp-warn { color: #c0392b; }
@media (max-aspect-ratio: 1/1) { .bp-upgrades { grid-template-columns: 1fr; } }
/* 배틀: 브레이크·가속 같은 크기(서킷은 가속이 더 큼), 글자도 같게 (REQ-BPLR-002) */
.cr-btn.ba-btn { width: clamp(100px, 17vmin, 160px); height: clamp(100px, 17vmin, 160px); font-size: clamp(16px, 3vmin, 26px); }
.ba-screen .cr-left { align-items: center; }
@media (orientation: portrait) { .cr-items { bottom: calc(max(14px, env(safe-area-inset-bottom)) + clamp(110px, 19vmin, 170px)); } }
