/* 도깨비 서킷 — 밤하늘 남색 + 단청 오방색 포인트. 색은 토큰만 덮는다(kit gb-ui.css 위에) */
:root {
  --gb-bg: #141a33;
  --gb-panel: rgba(255, 255, 255, 0.07);
  --gb-panel-2: rgba(255, 255, 255, 0.12);
  --gb-line: rgba(255, 255, 255, 0.14);
  --gb-text: #f4f6ff;
  --gb-dim: rgba(244, 246, 255, 0.68);
  --gb-accent: #ffc83d;
  --gb-accent-ink: #2a1c00;
  --gb-gold: #ffd166;
  --gb-danger: #ff6b5d;
  --red: #e2483a; --jade: #3fbf8f; --blue: #4a8cff; --pink: #ff7ab0;
  --r-common: #c8ccd8; --r-rare1: #5fd18a; --r-rare2: #4aa3ff; --r-hero: #b77bff; --r-legend: #ffc83d;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--gb-bg); color: var(--gb-text); font-family: var(--gb-font);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
#app { position: fixed; inset: 0; overflow: hidden; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font-family: var(--gb-font); }
.big-text { font-size: 112%; }

.overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 35%, #2b3570, #0b0f22); z-index: 30; }
.overlay.on { display: flex; }
.load-box { width: min(86vw, 360px); text-align: center; display: flex; flex-direction: column; gap: 14px; }
.brand-big { font-size: 36px; font-weight: 900; letter-spacing: 2px; color: #fff; text-shadow: 0 3px 0 var(--red), 0 0 24px rgba(255, 200, 61, 0.45); }
.bar { height: 10px; border-radius: 10px; background: rgba(255,255,255,0.12); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--red), var(--gb-accent)); transition: width .2s; }
#loadMsg { margin: 0; color: var(--gb-dim); font-size: 14px; }

.screen { position: absolute; inset: 0; overflow-y: auto; padding: calc(12px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  background: linear-gradient(180deg, rgba(14,18,40,0.55), rgba(14,18,40,0.88)); z-index: 10; }
.gb-brand { font-size: 20px; font-weight: 900; display: flex; align-items: center; gap: 8px; color: #fff; }
.brand-ic { width: 30px; height: 30px; }
.home-foot { text-align: center; margin: 4px 0 0; font-size: 13px; color: var(--gb-dim); }
.link { background: none; border: 0; color: var(--gb-dim); text-decoration: underline; font-size: 13px; min-height: 44px; cursor: pointer; }
.gb-sub button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ic { width: 18px; height: 18px; flex: none; }
.buddy { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--gb-panel); border: 1px solid var(--gb-line); }
.buddy img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: rgba(127, 232, 255, 0.15); }
.buddy .b-name { font-weight: 800; font-size: 15px; }
.buddy .b-goal { font-size: 13px; color: var(--gb-dim); }
.buddy .b-bar { height: 6px; margin-top: 5px; border-radius: 6px; background: rgba(255,255,255,0.12); overflow: hidden; }
.buddy .b-bar span { display: block; height: 100%; background: linear-gradient(90deg, #66c8ff, #c08aff); }

/* HUD — 글자·단추는 DOM, 월드만 캔버스 */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; font-weight: 800; color: #fff; }
.hud-tl { position: absolute; left: calc(12px + var(--safe-l)); top: calc(10px + var(--safe-t)); text-shadow: 0 2px 6px rgba(0,0,0,0.6); }
.rank b { font-size: 46px; line-height: 1; }
.rank small { font-size: 18px; margin-left: 2px; }
.lap { font-size: 16px; margin-top: 2px; } .lap b { font-size: 20px; }
.htime { font-size: 14px; opacity: .85; font-variant-numeric: tabular-nums; }
.minimap { position: absolute; right: calc(10px + var(--safe-r)); top: calc(10px + var(--safe-t) + 52px); width: 128px; height: 128px; border-radius: 16px; background: rgba(10, 14, 32, 0.45); border: 1px solid rgba(255,255,255,0.18); }
.q-band { position: absolute; left: 50%; top: calc(10px + var(--safe-t)); transform: translateX(-50%); min-width: min(72vw, 640px); max-width: 88vw; padding: 12px 26px 14px;
  border-radius: 18px; background: linear-gradient(180deg, rgba(40, 30, 90, 0.92), rgba(20, 16, 54, 0.92)); border: 2px solid var(--gb-accent); text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4); animation: band-in .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes band-in { from { transform: translate(-50%, -140%); } to { transform: translate(-50%, 0); } }
.q-tag { font-size: 15px; color: var(--gb-accent); letter-spacing: 1px; }
.q-text { font-size: clamp(28px, 4.6vw, 46px); font-weight: 800; line-height: 1.25; margin-top: 2px; word-break: keep-all; }
.q-chips { position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); display: grid; grid-template-columns: repeat(3, minmax(96px, 1fr)); gap: 18px; width: min(66vw, 560px); }
.q-chips > span { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 62px; padding: 6px 8px 8px; border-radius: 10px 10px 20px 20px; font-size: clamp(22px, 3.2vw, 32px); font-weight: 900; word-break: keep-all; overflow-wrap: break-word; text-align: center; line-height: 1.2;
  background: rgba(14, 18, 44, 0.78); border: 3px solid; border-top-width: 7px; box-shadow: 0 4px 14px rgba(0,0,0,.45); text-shadow: 0 2px 4px rgba(0,0,0,.6); transition: transform .12s, box-shadow .12s; pointer-events: none; }   /* v0.9 «정답 위치도 아래에서 더 확실하게 눈에 띄게» — 크게·진하게·상자 색 테두리 */   /* 표지판 모양(단추처럼 보이지 않게 — 사용자 «터치로 푸는 건 어색») */
.q-chips > span[data-b="0"] { border-color: #7fd6ff; background: linear-gradient(rgba(127,214,255,.28), rgba(14,18,44,.82)); } .q-chips > span[data-b="1"] { border-color: #ffd36b; background: linear-gradient(rgba(255,211,107,.28), rgba(14,18,44,.82)); } .q-chips > span[data-b="2"] { border-color: #ff8fc4; background: linear-gradient(rgba(255,143,196,.28), rgba(14,18,44,.82)); }
.q-chips > span.me { transform: scale(1.1) translateY(-4px); box-shadow: 0 0 0 3px #fff, 0 0 24px 6px currentColor; z-index: 1; }
.q-chips > span.me::after { content: ''; position: absolute; left: 50%; bottom: -14px; margin-left: -10px; border: 10px solid transparent; border-top-color: #fff; border-bottom: 0; }   /* 지금 달려가는 상자 = 흰 테두리·빛·아래 화살표 */
.q-chips > span[data-b="0"].me { color: #e9f8ff; } .q-chips > span[data-b="1"].me { color: #fff6dc; } .q-chips > span[data-b="2"].me { color: #ffe6f2; }
.q-chips span i { font-style: normal; font-size: 13px; font-weight: 800; opacity: .95; letter-spacing: .5px; }
.answer-card { position: absolute; left: 50%; top: calc(96px + var(--safe-t)); transform: translateX(-50%); padding: 10px 22px; border-radius: 16px; background: rgba(255, 255, 255, 0.95); color: #1d2140; font-size: 24px; box-shadow: 0 8px 22px rgba(0,0,0,0.35); }
.answer-card.ok { background: #fff4c8; } .answer-card.bad { background: #ffe1dc; }
.banner { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font-size: clamp(30px, 6vw, 58px); font-weight: 900; text-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 0 30px rgba(255, 200, 61, 0.6); white-space: nowrap; animation: pop-in .4s cubic-bezier(.2,1.6,.4,1); }
.count { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: clamp(70px, 14vw, 140px); font-weight: 900; color: #fff; text-shadow: 0 6px 0 var(--red), 0 0 40px rgba(255,255,255,0.6); animation: pop-in .35s cubic-bezier(.2,1.8,.4,1); }
@keyframes pop-in { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.hud-br { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(14px + var(--safe-b)); display: flex; align-items: flex-end; gap: 10px; }
.speedo { position: relative; width: 132px; height: 132px; }
.speedo svg { width: 100%; height: 100%; transform: rotate(135deg); }
.sp-bg, .g-bg { fill: none; stroke: rgba(0,0,0,0.4); stroke-width: 9; stroke-dasharray: 245 400; }
.g-bg { stroke-width: 7; stroke-dasharray: 198 400; }
.sp-arc { fill: none; stroke: #fff; stroke-width: 9; stroke-linecap: round; stroke-dasharray: 0 400; }
.g-arc { fill: none; stroke: #66c8ff; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 0 400; }
.sp-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-shadow: 0 2px 4px rgba(0,0,0,0.6); }
.sp-num b { font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; } .sp-num small { font-size: 12px; opacity: .85; }
.charges { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: flex; gap: 4px; }
.charges i { width: 18px; height: 8px; border-radius: 4px; background: rgba(255,255,255,0.2); } .charges i.on { background: linear-gradient(90deg, #ff9a3c, #ffe14d); box-shadow: 0 0 10px #ffb03c; }
.item-box { position: absolute; left: calc(12px + var(--safe-l)); top: calc(118px + var(--safe-t)); display: flex; gap: 8px; }
.slot { width: 76px; height: 76px; border-radius: 18px; background: rgba(10, 14, 32, 0.55); border: 2px solid rgba(255,255,255,0.3); display: flex; align-items: center; justify-content: center; }
.slot img { width: 64px; height: 64px; object-fit: contain; } .slot.locked { opacity: 0.35; border-style: dashed; } .slot.spin img { animation: spin-item .12s steps(2) infinite; }
@keyframes spin-item { 50% { transform: scale(.85) rotate(10deg); } }
.speed-lines { position: absolute; inset: -10%; pointer-events: none; opacity: 0; background: repeating-conic-gradient(from 0deg at 50% 52%, rgba(255,255,255,0.0) 0deg 4deg, rgba(255,255,255,0.22) 4.5deg 5deg, rgba(255,255,255,0) 5.5deg 11deg);
  -webkit-mask: radial-gradient(circle at 50% 52%, transparent 0 32%, #000 62%); mask: radial-gradient(circle at 50% 52%, transparent 0 32%, #000 62%); transition: opacity .2s; }
/* 속도 상태 테두리 — 빨라짐(정답 금빛 · 순간가속 하늘 · 부스터 불꽃) / 느려짐(회색 안개). 화면 가운데는 비워 길이 보이게 */
.speed-fx { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .15s; }
.speed-fx.gold { opacity: 1; box-shadow: inset 0 0 90px 18px rgba(255, 210, 60, 0.75); animation: fx-pulse .35s ease-in-out infinite alternate; }
.speed-fx.cyan { opacity: 1; box-shadow: inset 0 0 80px 14px rgba(110, 210, 255, 0.65); }
.speed-fx.fire { opacity: 1; box-shadow: inset 0 0 110px 22px rgba(255, 140, 40, 0.75); animation: fx-pulse .25s ease-in-out infinite alternate; }
.speed-fx.slow { opacity: 1; background: radial-gradient(ellipse at 50% 55%, transparent 40%, rgba(70, 80, 105, 0.55) 100%); box-shadow: inset 0 0 70px 10px rgba(255, 70, 70, 0.45); }
@keyframes fx-pulse { to { filter: brightness(1.35); } }
.speedo.fast .sp-num b { color: #ffd84a; } .speedo.cyanv .sp-num b { color: #8fe3ff; } .speedo.slowv .sp-num b { color: #ff7b72; }
.ink { position: absolute; left: 0; right: 0; bottom: 0; height: 40%; background: radial-gradient(ellipse at 30% 100%, rgba(10,10,20,0.95), transparent 60%), radial-gradient(ellipse at 70% 100%, rgba(10,10,20,0.92), transparent 55%), radial-gradient(ellipse at 50% 90%, rgba(20,10,40,0.9), transparent 60%); animation: ink-in .3s; }
@keyframes ink-in { from { transform: translateY(40%); } }
.keys-hint { position: absolute; left: calc(12px + var(--safe-l)); bottom: calc(12px + var(--safe-b)); display: flex; flex-direction: column; gap: 5px; pointer-events: none; }   /* 조작 키 칸 — 늘 보인다(문제 보기 표지판은 가운데라 겹치지 않는다) */
.kb { display: flex; align-items: center; gap: 4px; padding: 3px 9px 3px 4px; border-radius: 10px; background: rgba(10, 14, 32, 0.5); width: max-content; font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.88); transition: background .12s, transform .12s; }
.kb kbd { min-width: 26px; padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,0.92); color: #1d2140; font: 800 12px var(--gb-font); text-align: center; box-shadow: 0 2px 0 rgba(0,0,0,0.45); }
.kb span { margin-left: 3px; }
.kb.ready { background: rgba(255, 154, 60, 0.55); box-shadow: 0 0 12px rgba(255, 170, 60, 0.8); animation: kb-ready 0.9s ease-in-out infinite alternate; }   /* 부스터 칸·아이템이 있으면 «지금 쓸 수 있다» */
.kb.on { background: rgba(127, 214, 255, 0.5); }
.kb.down { transform: scale(0.94); background: rgba(255, 224, 102, 0.6); } .kb.down kbd { transform: translateY(2px); box-shadow: none; }
@keyframes kb-ready { to { box-shadow: 0 0 20px rgba(255, 200, 80, 1); } }
@media (prefers-reduced-motion: reduce) { .kb.ready { animation: none; } }
.pad { position: absolute; inset: auto 0 0 0; height: 46%; pointer-events: none; }
.pad button { pointer-events: auto; touch-action: none; border-radius: 20px; border: 2px solid rgba(255,255,255,0.35); background: rgba(10, 14, 32, 0.38); color: #fff; font: 800 15px var(--gb-font); }
.pad button.on { background: rgba(255, 200, 61, 0.45); }
.pad-r { position: absolute; right: calc(160px + var(--safe-r)); bottom: calc(118px + var(--safe-b)); display: grid; grid-template-columns: 80px 96px; grid-template-rows: 64px 80px; gap: 10px; }
.p-use { grid-column: 1; grid-row: 1 / 3; } .p-tap { grid-column: 2; grid-row: 1; background: rgba(74, 140, 255, 0.4) !important; }
.p-drift { grid-column: 2; grid-row: 2; background: rgba(255, 122, 176, 0.42) !important; } .p-boost { position: absolute; left: 0; right: 0; top: -60px; height: 50px; background: rgba(255, 154, 60, 0.42) !important; } .p-boost.empty { opacity: 0.45; } .p-brake { position: absolute; left: -84px; bottom: 0; width: 60px; height: 52px; }
.hud-pause { position: absolute; right: calc(10px + var(--safe-r)); top: calc(10px + var(--safe-t)); z-index: 6; }
.hud-full { position: absolute; right: calc(60px + var(--safe-r)); top: calc(10px + var(--safe-t)); z-index: 6; }
.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 8; }

.modal { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(6, 8, 22, 0.62); padding: 12px; }
.sheet { width: min(96vw, 560px); max-height: calc(100% - 8px); overflow-y: auto; padding: 18px; border-radius: 22px; background: #1b2147; border: 1px solid var(--gb-line); box-shadow: 0 20px 60px rgba(0,0,0,0.45); }
.sheet h2 { margin: 0 0 10px; font-size: 22px; } .sheet p { color: var(--gb-dim); margin: 6px 0; font-size: 14px; }
.row { display: flex; gap: 10px; margin-top: 14px; } .row > * { flex: 1; }
.btn2 { min-height: 48px; border-radius: 14px; border: 1px solid var(--gb-line); background: var(--gb-panel-2); color: var(--gb-text); font: 700 15px var(--gb-font); cursor: pointer; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card { position: relative; border-radius: 16px; padding: 10px; background: var(--gb-panel); border: 2px solid var(--gb-line); cursor: pointer; text-align: left; color: var(--gb-text); min-height: 64px; font: 700 14px var(--gb-font); }
.card.sel { border-color: var(--gb-accent); background: rgba(255, 200, 61, 0.12); } .card.lock { opacity: .45; }
.card small { display: block; color: var(--gb-dim); font-weight: 600; font-size: 12px; margin-top: 3px; }
.card img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,0.05); }
.rar-common { border-color: var(--r-common); } .rar-rare1 { border-color: var(--r-rare1); } .rar-rare2 { border-color: var(--r-rare2); } .rar-hero { border-color: var(--r-hero); } .rar-legend { border-color: var(--r-legend); box-shadow: 0 0 16px rgba(255, 200, 61, 0.35); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 800; color: #111; }
.tag.common { background: var(--r-common); } .tag.rare1 { background: var(--r-rare1); } .tag.rare2 { background: var(--r-rare2); } .tag.hero { background: var(--r-hero); } .tag.legend { background: var(--r-legend); }
.spin-view { width: 100%; aspect-ratio: 16 / 10; border-radius: 16px; background: radial-gradient(circle at 50% 70%, #39407a, #12162f); display: block; touch-action: none; cursor: grab; }
.rates { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; } .rates td, .rates th { padding: 5px 6px; border-bottom: 1px solid var(--gb-line); text-align: left; }
.pity { display: flex; gap: 10px; margin-top: 8px; } .pity div { flex: 1; padding: 8px; border-radius: 12px; background: var(--gb-panel); font-size: 13px; }
.pity b { font-size: 18px; }
.beam { position: absolute; inset: 0; pointer-events: none; border-radius: 16px; opacity: 0; }
.beam.go { animation: beam 1.2s ease-out; }
@keyframes beam { 0% { opacity: 0; } 20% { opacity: .9; } 100% { opacity: 0; } }
.res-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 14px; } .res-table td { padding: 5px 6px; border-bottom: 1px solid var(--gb-line); }
.res-table tr.me { background: rgba(255, 200, 61, 0.16); font-weight: 800; }
.reward { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; } .reward span { padding: 6px 10px; border-radius: 12px; background: var(--gb-panel-2); font-size: 14px; font-weight: 700; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; border-bottom: 1px solid var(--gb-line); font-size: 15px; }
.set-row select, .set-row input { min-height: 40px; font: 600 14px var(--gb-font); border-radius: 10px; }
.toast { position: absolute; left: 50%; bottom: calc(22% + var(--safe-b)); transform: translateX(-50%); padding: 10px 18px; border-radius: 14px; background: rgba(10, 14, 32, 0.9); border: 1px solid var(--gb-line); font-weight: 700; z-index: 25; max-width: 90vw; text-align: center; }
.caption { position: absolute; left: 50%; bottom: 30%; transform: translateX(-50%); font-size: 14px; background: rgba(0,0,0,0.6); padding: 4px 10px; border-radius: 8px; }
@media (max-width: 760px) {
  .minimap { width: 96px; height: 96px; top: calc(60px + var(--safe-t)); }
  .speedo { width: 104px; height: 104px; } .sp-num b { font-size: 28px; }
  .item-box { top: calc(96px + var(--safe-t)); } .slot { width: 60px; height: 60px; } .slot img { width: 50px; height: 50px; }
  .pad-r { right: calc(120px + var(--safe-r)); bottom: calc(96px + var(--safe-b)); grid-template-columns: 70px 84px; grid-template-rows: 56px 70px; }
  .rank b { font-size: 36px; }
  .q-band { min-width: 0; width: 66vw; padding: 6px 12px 8px; } .q-text { font-size: 26px; }
  .q-chips { width: 52vw; bottom: calc(10px + var(--safe-b)); } .q-chips > span { min-height: 44px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { .q-band, .banner, .count { animation: none; } }
.b-body { flex: 1; min-width: 0; }
.spin-wrap { position: relative; }
.credits { white-space: pre-wrap; font-size: 12px; max-height: 50vh; overflow: auto; color: var(--gb-dim); }
/* 터치 배치(가로 폰·태블릿) — 엄지는 아래 두 모서리, 보기 칩은 문제 띠 바로 아래, 속도계는 가운데 아래 */
.touch .q-chips { top: calc(88px + var(--safe-t)); bottom: auto; width: min(58vw, 460px); }
.touch .answer-card { top: calc(88px + var(--safe-t)); }
.touch .hud-br { right: auto; left: 50%; transform: translateX(-50%); bottom: calc(6px + var(--safe-b)); }
.touch .speedo { width: 92px; height: 92px; } .touch .sp-num b { font-size: 26px; }
.touch .keys-hint { display: none; }
.touch .pad { height: auto; inset: auto 0 0 0; }
.touch .pad-r { right: calc(12px + var(--safe-r)); bottom: calc(12px + var(--safe-b)); grid-template-columns: 70px 92px; grid-template-rows: 58px 92px; gap: 10px; }
.touch .p-use { grid-column: 1; grid-row: 1; } .touch .p-tap { grid-column: 1; grid-row: 2; } .touch .p-drift { grid-column: 2; grid-row: 2; }
.touch .p-brake { position: static; grid-column: 2; grid-row: 1; width: auto; height: auto; }
.rotate-hint { display: none; position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); padding: 12px 18px; border-radius: 16px; background: rgba(10, 14, 32, 0.82); font-size: 15px; font-weight: 700; text-align: center; pointer-events: none; }
@media (orientation: portrait) and (pointer: coarse) { .rotate-hint { display: block; animation: hint-fade 4s forwards; } }
@keyframes hint-fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }
@media (max-height: 420px) { .touch .minimap { width: 88px; height: 88px; top: calc(56px + var(--safe-t)); } .touch .q-band { padding: 4px 12px 6px; } .touch .q-text { font-size: 20px; } .touch .q-chips { top: calc(70px + var(--safe-t)); } .touch .q-chips > span { min-height: 40px; } }
.room-full { position: fixed; inset: 0; width: 100vw; height: 100vh; aspect-ratio: auto; border-radius: 0; z-index: 40; }
/* 뽑기 결과 — 화면 전체(사용자 2026-10-23 «뭐가 나왔는지 앞에서 확 보여줘야지») */
.reveal { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, rgba(30, 24, 70, 0.92), rgba(6, 6, 20, 0.97)); }
.rv-rays { position: absolute; left: 50%; top: 42%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; opacity: 0; transition: opacity .4s;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 55%, transparent) 0deg 8deg, transparent 8deg 22deg); animation: rv-spin 14s linear infinite; }
.reveal.open .rv-rays { opacity: 0.7; }
.rv-orb { position: absolute; left: 50%; top: 42%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  background: radial-gradient(circle, #fff, var(--rc) 45%, transparent 70%); animation: rv-charge .9s ease-in infinite alternate; }
.r-hero .rv-orb, .r-legend .rv-orb { animation-duration: .45s; }
.reveal.open .rv-orb { animation: rv-burst .6s ease-out forwards; }
.rv-spin { position: relative; width: min(78vw, 560px); height: min(48vh, 400px); opacity: 0; transform: scale(.6); transition: opacity .35s, transform .5s cubic-bezier(.2,1.5,.4,1); }
.reveal.open .rv-spin { opacity: 1; transform: scale(1); }
.rv-text { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; opacity: 0; transform: translateY(20px); transition: opacity .35s .2s, transform .45s .2s; }
.reveal.open .rv-text { opacity: 1; transform: none; }
.rv-text b { font-size: clamp(30px, 6vw, 52px); font-weight: 900; color: #fff; text-shadow: 0 0 24px var(--rc), 0 4px 0 rgba(0,0,0,.4); }
.rv-text small { font-size: 16px; color: rgba(255,255,255,.88); }
.rv-text .tag { font-size: 18px; padding: 4px 14px; }
.rv-text .row { margin-top: 10px; gap: 12px; }
.rv-text .row button { min-width: 120px; min-height: 48px; }
@keyframes rv-spin { to { transform: rotate(360deg); } }
@keyframes rv-charge { from { transform: scale(.7); filter: brightness(.8); } to { transform: scale(1.25); filter: brightness(1.4); } }
@keyframes rv-burst { 0% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rv-rays, .rv-orb { animation: none; } }

/* 드리프트 부스터 게이지 — 속도계 옆 큰 칸 2개(사용자 2026-10-23 «드리프트 부스터 게이지는 어딨어.. 안 보임») */
.boost-panel { padding: 8px 10px 10px; border-radius: 14px; background: rgba(10, 14, 32, 0.55); border: 1px solid rgba(255,255,255,0.18); min-width: 150px; margin-bottom: 6px; }
.bp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 6px; }
.bp-key { font-size: 12px; padding: 1px 7px; border-radius: 6px; background: rgba(255,255,255,0.15); opacity: .7; }
.bp-cells { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bp-cells i { position: relative; height: 18px; border-radius: 6px; background: rgba(255,255,255,0.14); overflow: hidden; }
.bp-cells s { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 6px; background: linear-gradient(90deg, #7fd6ff, #c9f0ff); transition: width .1s linear; text-decoration: none; }
.bp-cells i.full s { width: 100% !important; background: linear-gradient(90deg, #ff9a3c, #ffe14d); box-shadow: 0 0 12px #ffb03c; }
.boost-panel.ready { border-color: #ffc23d; box-shadow: 0 0 18px rgba(255, 180, 60, 0.75); animation: bp-pulse .8s ease-in-out infinite alternate; }
.boost-panel.ready .bp-key { opacity: 1; background: #ffd23a; color: #1d2140; font-weight: 800; }
@keyframes bp-pulse { to { box-shadow: 0 0 28px rgba(255, 200, 80, 1); } }
@media (prefers-reduced-motion: reduce) { .boost-panel.ready { animation: none; } }
.touch .boost-panel { min-width: 120px; padding: 6px 8px 8px; } .touch .bp-cells i { height: 14px; }
/* 함께 달리기 — 기다리는 방 자리표 */
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
@media (max-width: 520px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mp-seat { min-height: 56px; opacity: 0.55; cursor: default; }
.mp-seat.on { opacity: 1; border-color: #ffd36b; }
.mp-seat.me { box-shadow: 0 0 0 2px #ffd36b inset; }
.mp-count { font-size: 18px; font-weight: 700; color: #ffe08a; }

/* 왼쪽 조이스틱 — 왼쪽 아래 넓은 영역 어디를 눌러도 그 자리가 가운데(다른 모바일 게임처럼) · 좌우로 민 만큼 핸들 */
.joy-zone { position: fixed; left: 0; bottom: 0; width: 42vw; height: 55vh; pointer-events: auto; touch-action: none; }   /* 패드 상자는 높이 0(단추들이 따로 떠 있다) — 화면 기준으로 */
.joy-base { position: absolute; left: calc(84px + var(--safe-l)); top: calc(100% - 84px - var(--safe-b)); width: 124px; height: 124px; margin: -62px 0 0 -62px; border-radius: 50%;
  background: rgba(10, 14, 32, 0.32); border: 2px solid rgba(255, 255, 255, 0.35); pointer-events: none; transition: opacity .15s; opacity: 0.7; }
.joy-base.on { opacity: 1; background: rgba(10, 14, 32, 0.45); }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.joy-base::before, .joy-base::after { content: ''; position: absolute; top: 50%; margin-top: -9px; border: 9px solid transparent; }
.joy-base::before { left: 6px; border-right: 12px solid rgba(255,255,255,.6); }
.joy-base::after { right: 6px; border-left: 12px solid rgba(255,255,255,.6); }
/* 함께 달리기 — 출발! 바로 아래 둘째 단추(주 단추는 출발! 하나라 테두리만) */
.mp-cta { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; margin-top: -2px; border-radius: var(--gb-radius); cursor: pointer;
  background: var(--gb-panel); color: var(--gb-text, #fff); border: 2px solid var(--gb-accent); font: 800 16px var(--gb-font); }
.mp-cta small { font-weight: 600; font-size: 12px; color: var(--gb-dim); }
.mp-cta .ic { width: 20px; height: 20px; color: var(--gb-accent); }
.mp-cta:active { transform: scale(0.98); }

/* v0.8 함께 달리기 창 — 빠른 입장 · 친구 방 · 코드 · 친구 기록(사람이 적어도 같이 달리는 길 넷) */
.mp-hub { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
@media (max-width: 520px) { .mp-hub { grid-template-columns: 1fr; } }
.mp-opt { min-height: 76px; padding: 12px 14px; }
.mp-opt b { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.mp-opt b .ic { width: 20px; height: 20px; color: var(--gb-accent); }
.mp-opt:active { transform: scale(0.98); }
.mp-opt.hot, .mp-cta.hot { border-color: #6ff0a0; box-shadow: 0 0 0 2px rgba(111, 240, 160, 0.35), 0 0 18px rgba(111, 240, 160, 0.45); animation: mp-hot 1.1s ease-in-out infinite alternate; }
.mp-cta.hot small { color: #9ff7c2; }
@keyframes mp-hot { to { box-shadow: 0 0 0 2px rgba(111, 240, 160, 0.6), 0 0 26px rgba(111, 240, 160, 0.75); } }
@media (prefers-reduced-motion: reduce) { .mp-opt.hot, .mp-cta.hot { animation: none; } }
.room-code { display: inline-block; margin-left: 8px; padding: 2px 14px; border-radius: 12px; background: #ffd23a; color: #1d2140; font-size: 1.35em; letter-spacing: 0.18em; font-variant-numeric: tabular-nums; }
.code-boxes { display: flex; justify-content: center; gap: 10px; margin: 8px 0 14px; }
.code-boxes span { width: 56px; height: 64px; border-radius: 14px; border: 2px solid var(--gb-line); background: var(--gb-panel); display: grid; place-items: center; font: 900 32px var(--gb-font); color: var(--gb-text); }
.code-boxes span.on { border-color: var(--gb-accent); }
.code-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 320px; margin: 0 auto; }
.code-pad .card { min-height: 56px; text-align: center; font-size: 22px; }
.code-pad .card[data-d="back"], .code-pad .card[data-d="x"] { font-size: 14px; }
.res-table tr.ghost td { color: #bfe6ff; }
.res-table tr.ghost td small { color: var(--gb-dim); font-weight: 600; }
.ghost-beat { font-weight: 800; color: #9ff7c2; }
.share-btn:not([disabled]) { border-color: #6ff0a0; color: #c9ffe0; }
/* 결과 시상대 — 가운데 1등이 가장 높다 · 단이 아래서 올라온다 */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin: 6px 0 10px; min-height: 150px; }
.pod { position: relative; width: 31%; max-width: 150px; display: flex; flex-direction: column; align-items: center; animation: pod-up .55s cubic-bezier(.2,1.4,.4,1) both; }
.pod img { width: 84%; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0,0,0,.35)); }
.pod b { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 4px; }
.pod span { width: 100%; display: grid; place-items: center; border-radius: 10px 10px 0 0; font: 900 26px var(--gb-font); color: #1d2140; }
.pod.p1 span { height: 64px; background: linear-gradient(#ffe27a, #f5b52e); } .pod.p1 { animation-delay: .25s; }
.pod.p2 span { height: 46px; background: linear-gradient(#eef2f7, #b9c3d0); } .pod.p2 { animation-delay: .1s; }
.pod.p3 span { height: 34px; background: linear-gradient(#f2c19a, #c98756); } .pod.p3 { animation-delay: .4s; }
.pod.me b { color: #ffe08a; } .pod.ghost b { color: #bfe6ff; } .pod.ghost img { opacity: .7; }
@keyframes pod-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pod { animation: none; } }
/* 좁은 PC 창(1240px 미만) — 정답 칩이 부스터 칸에 가렸다(960px 실측 2026-11-03) → 부스터 칸을 속도계 위로 세워 오른쪽 폭을 줄이고, 칩은 양옆 HUD 사이에만 */
@media (max-width: 1239px) {
  #app:not(.touch) .hud-br { flex-direction: column; align-items: flex-end; gap: 6px; }
  #app:not(.touch) .q-chips { width: min(560px, calc(100vw - 2 * 190px)); }
}

/* ── HUD 배치 v0.9.1(2026-11-03 «모바일 세로에서 엄청 겹치네? 가로도·pc 도») — 🔒 tools/hud-layout-check.mjs(12화면 × 긴/짧은 문제: 겹침·화면 밖·낱말 쪼갬·내 카트 가림 0) */
.q-chips.long > span { font-size: clamp(15px, 1.6vw, 20px); }
#app:not(.touch) .q-band.long .q-text { font-size: clamp(22px, 2.8vw, 34px); }   /* 긴 문제(29자+)는 PC 에서도 하늘을 덜 가리게 */
#app:not(.touch) .q-band { min-width: min(72vw, 640px, calc(100vw - 2 * 184px)); max-width: calc(100vw - 2 * 184px); }   /* PC: 왼쪽 기둥(순위·아이템 칸)·오른쪽 기둥(버튼·미니맵) 사이에만 */
.q-chips span > span { word-break: keep-all; overflow-wrap: break-word; }
/* 터치 공통: 칩 top 은 JS(placeChips)가 문제 띠 아래끝으로 — 폭은 아이템 칸·오른쪽 단추 사이에 든다 */
.touch .q-chips { width: min(50vw, 460px); gap: 12px; }
.touch .q-chips > span { min-height: 44px; font-size: 18px; padding: 4px 6px 6px; }
.touch .q-chips.long > span { font-size: 13px; }
/* 터치 가로: 부스터 판·속도계 = 조이스틱 오른쪽 아래(가운데 아래는 내 카트 자리) */
@media (orientation: landscape) {
  .touch .hud-br { left: calc(164px + var(--safe-l)); transform: none; bottom: calc(6px + var(--safe-b)); gap: 8px; }
}
@media (orientation: landscape) and (max-height: 420px) {
  .touch .minimap { width: 80px; height: 80px; top: calc(52px + var(--safe-t)); }
  .touch .pad-r { grid-template-rows: 52px 84px; gap: 8px; }
  .touch .p-boost { top: -54px; height: 46px; }
  .touch .speedo { width: 80px; height: 80px; } .touch .sp-num b { font-size: 22px; }
  .touch .q-tag { font-size: 12px; } .touch .q-text { font-size: 18px; line-height: 1.2; }
  .touch .q-chips > span { min-height: 38px; font-size: 16px; } .touch .q-chips.long > span { font-size: 12px; line-height: 1.1; } .touch .q-chips span i { font-size: 11px; }
}
/* 휴대폰·태블릿 세로: 맨 윗줄(순위·아이템 | 버튼·미니맵) 아래에 문제 띠를 화면 폭 가득 → 칩은 그 밑 · 부스터 판·속도계는 조이스틱 위 왼쪽 세로 줄 */
@media (orientation: portrait) {
  .touch .q-band { top: calc(172px + var(--safe-t)); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); width: auto; min-width: 0; max-width: none; transform: none; padding: 6px 12px 8px; animation: band-drop .3s ease-out; }
  .touch .q-tag { font-size: 13px; } .touch .q-text { font-size: clamp(19px, 5.2vw, 30px); }
  .touch .q-chips { left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); width: auto; transform: none; }
  .touch .q-chips > span { font-size: clamp(16px, 4.4vw, 24px); } .touch .q-chips.long > span { font-size: clamp(12px, 3.4vw, 16px); }
  .touch .answer-card { top: calc(172px + var(--safe-t)); }
  .touch .minimap { width: 96px; height: 96px; top: calc(60px + var(--safe-t)); }
  .touch .item-box { top: calc(106px + var(--safe-t)); } .touch .slot { width: 60px; height: 60px; } .touch .slot img { width: 50px; height: 50px; }
  .touch .hud-br { left: calc(12px + var(--safe-l)); right: auto; transform: none; bottom: calc(168px + var(--safe-b)); flex-direction: column; align-items: flex-start; gap: 6px; }
}
@keyframes band-drop { from { transform: translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .touch .q-band { animation: none; } }
