:root {
  --bg: #151826;
  --bg2: #1d2133;
  --card: #232842;
  --line: #343a5c;
  --text: #eef0fa;
  --muted: #9aa1c4;
  --accent: #ffcf3f;
  --accent-ink: #2a2100;
  --good: #2ee59d;
  --bad: #ff4d6a;
  --radius: 14px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.screen { display: none; position: fixed; inset: 0; }
.screen.active { display: flex; }
/* ---------- 메인 화면: 게임 속 세계 위에 HUD를 겹친 타이틀 ---------- */
#menu { flex-direction: column; }
.title-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#menuCv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* 키캡: 경기 화면의 키 블록·글자 버튼과 같은 모양 */
.logo-keys i, .kcs i {
  font-style: normal; display: inline-grid; place-items: center; background: var(--c); color: #111; font-weight: 900;
  box-shadow: inset 0 -0.12em 0 rgba(0, 0, 0, .22), 0 0.1em 0 rgba(0, 0, 0, .45);
}

.logo { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 2; }
.logo-keys { display: flex; gap: 8px; font-size: 44px; line-height: 1; }
.logo-keys i { width: 1.45em; height: 1.45em; border-radius: .26em; font-size: 1em; animation: keytype 4.8s infinite; }
.logo-keys i:nth-child(1) { transform: rotate(-5deg); animation-delay: 0s; }
.logo-keys i:nth-child(2) { transform: rotate(3deg); animation-delay: .12s; }
.logo-keys i:nth-child(3) { transform: rotate(-2deg); animation-delay: .24s; }
.logo-keys i:nth-child(4) { transform: rotate(5deg); animation-delay: .36s; }
@keyframes keytype {
  0%, 8%, 100% { translate: 0 0; box-shadow: inset 0 -0.12em 0 rgba(0, 0, 0, .22), 0 0.1em 0 rgba(0, 0, 0, .45); filter: none; }
  4% { translate: 0 0.08em; box-shadow: inset 0 -0.05em 0 rgba(0, 0, 0, .22), 0 0.02em 0 rgba(0, 0, 0, .45); filter: brightness(1.25); }
}
.logo-run {
  font-size: 50px; font-weight: 900; font-style: italic; letter-spacing: 3px; line-height: .95; color: #fff;
  -webkit-text-stroke: 7px #14162a; paint-order: stroke fill; text-shadow: 0 5px 0 rgba(10, 12, 24, .55);
  padding-left: 2px; position: relative;
}
.logo-run::after { /* 결승선 체크무늬 */
  content: ""; display: block; height: 8px; width: 100%; margin-top: 6px; border-radius: 2px;
  background: repeating-conic-gradient(#14162a 0 25%, #fff 0 50%) 0 0 / 8px 8px; box-shadow: 0 2px 0 rgba(10, 12, 24, .4);
}
.logo-sub { white-space: nowrap; font-size: 13px; font-weight: 700; color: #fff; background: rgba(15, 17, 30, .72); border-radius: 999px; padding: 4px 11px; margin-top: 4px; letter-spacing: -.2px; }

/* 계정 이름의 태그(#KR): 연하게 (어디서나) */
.tag { opacity: .5; font-weight: 700; font-size: .86em; margin-left: 1px; white-space: nowrap; }
@keyframes npglow { 50% { box-shadow: 0 0 0 5px rgba(255, 207, 63, .28); } }

.srow { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.slabel { width: 46px; flex: none; color: var(--muted); font-size: 12px; font-weight: 700; }
.seg { display: flex; gap: 5px; flex: 1; }
.seg button {
  flex: 1; min-width: 0; background: var(--bg2); border: 1.5px solid var(--line); border-radius: 9px; padding: 7px 4px; font-weight: 800; font-size: 13px;
  display: flex; align-items: baseline; justify-content: center; gap: 1px; color: var(--text); transition: background .1s, border-color .1s;
}
.seg button small { font-size: 10px; color: var(--muted); font-weight: 700; }
.seg button:hover { border-color: #4b5385; }
.seg button.on { background: rgba(255, 207, 63, .16); border-color: var(--accent); color: var(--accent); }
.seg button.on small { color: var(--accent); }
.seg.keys button { padding: 6px 3px; align-items: center; }
.seg.keys button[data-keys="2"] { flex: 2; } .seg.keys button[data-keys="4"] { flex: 3; } .seg.keys button[data-keys="6"] { flex: 4; }
.kcs { display: flex; gap: 2px; font-size: 9.5px; line-height: 1; }
.kcs i { width: 1.55em; height: 1.65em; border-radius: .3em; }
.seg.keys button:not(.on) .kcs { filter: saturate(.55) brightness(.8); }

.menu-foot { position: absolute; left: 12px; bottom: 10px; margin: 0; z-index: 2; font-size: 11px; color: rgba(255, 255, 255, .78); background: rgba(15, 17, 30, .6); border-radius: 999px; padding: 4px 10px; pointer-events: none; }

/* 하단 버튼 줄: 경기 화면의 글자 버튼(pad)과 같은 모양 */
.deck {
  display: grid; grid-template-columns: 1fr 1.25fr 1fr 1.15fr; gap: 10px; padding: 10px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--bg2); border-top: 1px solid var(--line);
}
.dk {
  height: 64px; border: 0; border-radius: 14px; color: #111; background: var(--c, #ccc); box-shadow: 0 5px 0 rgba(0, 0, 0, .42);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0 8px;
  transition: transform .05s, box-shadow .05s, filter .1s;
}
.dk b { font-size: 19px; font-weight: 900; letter-spacing: -.3px; }
.dk small { font-size: 11px; font-weight: 700; opacity: .62; white-space: nowrap; }
.dk:hover { filter: brightness(1.08); }
.dk:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .42); }
.dk:disabled { filter: grayscale(.7) brightness(.6); cursor: default; }
.dk.practice { --c: #29c78c; }
.dk.quick { --c: var(--accent); }
.dk.quick b { font-size: 22px; }
.dk.create { --c: #3e9bff; }
.dk.join { --c: #ff6262; flex: none; width: 76px; }
.dk-join { display: flex; gap: 8px; min-width: 0; }
.dk-join input {
  flex: 1; min-width: 0; height: 64px; border-radius: 14px; background: #10121e; border: 2px solid var(--line); padding: 0 12px;
  text-align: center; text-transform: uppercase; letter-spacing: 5px; font-weight: 900; font-size: 20px; color: var(--accent); outline: none;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, .35);
}
.dk-join input::placeholder { letter-spacing: 1px; font-size: 14px; color: #5b6390; font-weight: 800; }
.dk-join input:focus { border-color: var(--accent); }
button:focus-visible, .dk-join input:focus-visible, .modal input:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* 좁은 화면 (모바일 세로) */
@media (max-width: 720px) {
  .logo { top: 14px; }
  .logo-keys { font-size: 30px; gap: 6px; }
  .logo-run { font-size: 34px; -webkit-text-stroke-width: 5px; }
  .logo-run::after { height: 6px; background-size: 6px 6px; }
  .logo-sub { font-size: 11px; }
  .menu-foot { display: none; }
  .deck { grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .dk, .dk-join input { height: 54px; }
  .dk b { font-size: 17px; } .dk.quick b { font-size: 18px; }
  .dk small { font-size: 10px; }
  .dk-join input { font-size: 17px; letter-spacing: 3px; }
  .dk.join { width: 62px; }
}
@media (max-height: 560px) and (min-width: 721px) {
  .logo-keys { font-size: 30px; } .logo-run { font-size: 34px; } .logo-sub { display: none; }
  .dk, .dk-join input { height: 52px; }
}

.hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
input, select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }

.btn { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-weight: 800; transition: transform .08s, filter .12s; }
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.join { display: flex; gap: 6px; }
.join input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 3px; font-weight: 700; }
.mini { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 13px; }
.mini.ghost { background: transparent; }

.badge { display: inline-block; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 5px; vertical-align: middle; letter-spacing: .5px; }
.badge.ai { background: #6c5ce7; color: #fff; }
.badge.me { background: var(--accent); color: var(--accent-ink); }
.badge.host { background: #3a4370; color: #cfd6ff; }
.badge.off { background: #5b2633; color: #ffb3c0; }
.badge.user { background: #1f4d43; color: #a9f5d8; }

/* 대기실 */
/* 대기실 장면 (경기 화면 위 오버레이) */
#game.lobby-mode .race-only, #game.lobby-mode .stats, #game.lobby-mode .ranks { display: none !important; }
#game:not(.lobby-mode) .lobby-only { display: none !important; }
/* 완주 후 결승 구역: 글자 버튼·키 표시줄 대신 이동·점프·도발 버튼 */
#game.goal-mode .lobby-bar { display: flex !important; }
#game.goal-mode .pad, #game.goal-mode .race-taunts { display: none !important; }
.lobby-panel { position: absolute; left: 8px; top: 8px; width: min(250px, calc(100% - 16px)); background: rgba(15, 17, 30, .8); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; backdrop-filter: blur(3px); z-index: 2; }
.lp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.room-kind { font-weight: 900; font-size: 16px; white-space: nowrap; }
.room-bg { color: var(--muted); font-size: 11px; font-weight: 700; margin-top: 4px; }
.room-bg:empty { display: none; }
.room-set { background: var(--bg2); border-radius: 6px; padding: 3px 7px; font-weight: 700; font-size: 11px; white-space: nowrap; }
.room-code { color: var(--muted); margin-top: 6px; }
.room-code b { color: var(--accent); letter-spacing: 3px; font-size: 18px; }
.slots { list-style: none; margin: 4px 0 4px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.room-count { margin-top: 6px; font-size: 11px; color: var(--muted); font-weight: 700; }
.slots li { display: flex; align-items: center; gap: 6px; background: var(--bg2); border-radius: 8px; padding: 5px 8px; }
.slots li { min-width: 0; }
.slots li.me { box-shadow: 0 0 0 1.5px var(--accent) inset; }
.slots li.off { opacity: .45; }
.slots .crown { font-size: 11px; margin-right: -3px; }
.slots li b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.slots li.empty { color: var(--muted); border: 1px dashed var(--line); background: transparent; }
.slots .dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.room-status { font-weight: 700; margin: 8px 0 0; min-height: 1.4em; color: var(--accent); }
.lp-host { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.lp-host .check { margin-top: 0; font-size: 12px; }
#lobbyShareWrap { margin-top: 8px; font-size: 12px; line-height: 1.35; }
#lobbyShareWrap input { width: 16px; height: 16px; }
.lobby-panel .hint { font-size: 11px; margin-top: 6px; }
.touch-only { display: none; }
@media (pointer: coarse) { .kbd-only { display: none; } .touch-only { display: inline; } }
.lobby-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--bg2); border-top: 1px solid var(--line); touch-action: none; user-select: none; -webkit-user-select: none; }
.lobby-bar .move { width: clamp(64px, 22vw, 120px); height: clamp(52px, 9vh, 70px); border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-size: 24px; touch-action: none; }
.lobby-bar .move.down { background: var(--accent); color: var(--accent-ink); }
.lobby-bar .lb-right { display: flex; gap: 8px; }
.lobby-bar .move.jump { font-size: 15px; font-weight: 800; width: clamp(56px, 16vw, 90px); }
.lobby-bar .move.jump:active { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 520px) { .lobby-panel { font-size: 12px; width: min(210px, calc(100% - 16px)); padding: 8px 10px; } .room-code b { font-size: 15px; } }

/* 경기 화면 */
#game { flex-direction: column; background: var(--bg); }
.hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--bg2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hud-left, .hud-right { display: flex; align-items: center; gap: 8px; }
.match-tag { font-size: 13px; font-weight: 700; color: var(--muted); }
.stats { display: flex; gap: 16px; }
.stat { display: flex; flex-direction: column; align-items: center; min-width: 54px; }
.stat span { font-size: 11px; color: var(--muted); }
.stat b { font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat.time b.warn { color: var(--bad); }
.stat b.bump { animation: bump .18s; }
@keyframes bump { 50% { transform: scale(1.25); } }
@media (max-width: 720px) {
  .hud { padding: 6px 8px; gap: 6px; }
  .stats { order: 3; width: 100%; justify-content: space-around; gap: 4px; }
  .stat b { font-size: 17px; }
  .match-tag { display: none; }
}

.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ranks { position: absolute; left: 8px; top: 8px; margin: 0; padding: 6px; list-style: none; background: rgba(15, 17, 30, .72); border-radius: 10px; font-size: 13px; min-width: 170px; pointer-events: none; backdrop-filter: blur(3px); }
.ranks li { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 6px; }
.ranks li.me { background: rgba(255, 207, 63, .16); }
.ranks .rk { width: 22px; font-weight: 900; text-align: right; }
.ranks li.gap { justify-content: center; color: var(--muted); padding: 0; line-height: 1; }
.ranks .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ranks .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.ranks .vl { font-variant-numeric: tabular-nums; color: var(--muted); }
.ranks li.fin .vl { color: var(--good); font-weight: 700; }
@media (max-width: 520px) { .ranks { font-size: 11px; min-width: 130px; } .ranks .nm { max-width: 70px; } }

.banner { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: rgba(15, 17, 30, .85); border: 1px solid var(--accent); color: var(--accent); padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap; }
.banner.show { opacity: 1; }
@media (max-width: 520px) { .banner { top: auto; bottom: 10px; font-size: 12px; } }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(80px, 20vw, 180px); font-weight: 900; color: var(--accent); text-shadow: 0 6px 0 rgba(0,0,0,.35); pointer-events: none; }
.countdown.go { color: var(--good); }
.countdown .pop { animation: cd .9s ease-out both; }
@keyframes cd { 0% { transform: scale(1.6); opacity: 0; } 20% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9); opacity: .0; } }
.conn { position: absolute; right: 10px; top: 10px; background: var(--bad); color: #fff; padding: 4px 10px; border-radius: 8px; font-weight: 700; font-size: 13px; }

@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.taunts { display: flex; gap: 5px; flex: none; }
.taunts button { position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 19px; display: grid; place-items: center; padding: 0; touch-action: none; }
.taunts button small { position: absolute; left: 3px; top: 1px; font-size: 10px; font-weight: 800; color: var(--muted); }
.taunts button.used { animation: tpop .35s; border-color: var(--accent); }
@keyframes tpop { 40% { transform: scale(1.2); } }
@media (max-width: 520px) { .taunts button { width: 30px; height: 34px; font-size: 15px; } .taunts { gap: 2px; } }
@media (max-width: 520px) { .lobby-bar { gap: 6px; padding: 8px; } .lobby-bar .move { width: 52px; } .lobby-bar .move.jump { width: 48px; font-size: 13px; } .lobby-bar .lb-right { gap: 6px; } }

.pad { display: flex; gap: 8px; padding: 8px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--bg2); touch-action: none; user-select: none; -webkit-user-select: none; }
.pad .gap { width: 18px; flex: none; }
.pad button { flex: 1; height: clamp(56px, 11vh, 86px); border-radius: 14px; border: 0; font-size: 26px; font-weight: 900; color: #111; box-shadow: 0 5px 0 rgba(0,0,0,.4); transition: transform .05s, box-shadow .05s, filter .1s; touch-action: none; }
.pad button.down { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.4); }
.pad button.flash-ok { filter: brightness(1.35); }
.pad button.flash-miss { background: var(--bad) !important; color: #fff; }
.pad.locked button { filter: grayscale(.8) brightness(.6); }
@media (hover: hover) and (pointer: fine) { .pad button { height: 58px; } }

/* 결과 */
.overlay { position: absolute; inset: 0; background: rgba(8, 10, 20, .72); display: grid; place-items: center; padding: 16px; z-index: 5; backdrop-filter: blur(4px); }
.result-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; width: min(640px, 100%); max-height: 100%; overflow: auto; }
.result-card h2 { margin: 0; font-size: 26px; }
.res-sub { color: var(--muted); margin: 4px 0 12px; }
.table-wrap { overflow-x: auto; }
.res-table { width: 100%; border-collapse: collapse; font-size: 14px; white-space: nowrap; }
.res-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.res-table td { padding: 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.res-table tr.me td { background: rgba(255, 207, 63, .1); }
.res-table .rk { font-weight: 900; font-size: 18px; }
.res-table .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.res-table .fin { color: var(--good); font-weight: 800; }
.res-table .dnf { color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-weight: 700; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.res-note { color: var(--muted); font-size: 13px; margin: 8px 0 0; min-height: 1em; }
.res-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.res-actions .btn { flex: 1; min-width: 140px; }

.toast { position: fixed; left: 50%; bottom: 112px; transform: translateX(-50%) translateY(20px); background: #fff; color: #111; padding: 10px 16px; border-radius: 10px; font-weight: 700; opacity: 0; transition: .25s; pointer-events: none; z-index: 20; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- 팝업 (연습 · 빠른 매칭 · 알림) ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(8, 10, 20, .55); backdrop-filter: blur(2px); animation: mfade .15s; }
@keyframes mfade { from { opacity: 0; } }
.mcard {
  width: min(400px, 100%); background: rgba(18, 21, 36, .96); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45); animation: mpop .18s cubic-bezier(.2, 1.4, .4, 1);
}
.mcard.small { width: min(340px, 100%); text-align: center; }
@keyframes mpop { from { transform: translateY(10px) scale(.97); } }
.mcard h2 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -.4px; }
.msub { margin: 4px 0 6px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.mcard .srow { margin-top: 12px; }
.mcard .slabel { width: 50px; font-size: 13px; }
.mcard .seg button { padding: 10px 4px; font-size: 14px; }
.mcard .seg.keys button { padding: 9px 4px; }
.mcard .kcs { font-size: 12px; }
.mactions { display: flex; gap: 10px; margin-top: 18px; }
.mactions .dk { flex: 1; height: 54px; }
.mactions .dk.wide { flex: 1; }
.dk.ghost { --c: #2b3150; color: var(--text); box-shadow: 0 5px 0 rgba(0, 0, 0, .42); }
.dk.ghost b, .dk.ghost { font-size: 16px; font-weight: 800; }

/* 빠른 매칭 대기 */
.q-keys { display: flex; justify-content: center; gap: 7px; margin: 16px 0 6px; font-size: 22px; }
.q-keys i {
  font-style: normal; display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: .3em; background: var(--c); color: #111; font-weight: 900;
  box-shadow: inset 0 -0.12em 0 rgba(0, 0, 0, .22), 0 0.1em 0 rgba(0, 0, 0, .45); animation: qhop 1.2s ease-in-out infinite;
}
.q-keys i:nth-child(2) { animation-delay: .15s; } .q-keys i:nth-child(3) { animation-delay: .3s; }
.q-keys i:nth-child(4) { animation-delay: .45s; } .q-keys i:nth-child(5) { animation-delay: .6s; } .q-keys i:nth-child(6) { animation-delay: .75s; }
@keyframes qhop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-9px); } }
.q-status { text-align: center; font-weight: 900; font-size: 17px; margin: 10px 0 10px; }
.q-slots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.q-slots li { display: flex; align-items: center; gap: 7px; background: var(--bg2); border: 1.5px solid var(--line); border-radius: 9px; padding: 8px 10px; font-weight: 800; font-size: 13px; min-width: 0; }
.q-slots li b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-slots li.me { border-color: var(--accent); }
.q-slots li.empty { color: #5b6390; border-style: dashed; justify-content: center; font-weight: 700; }
.q-slots .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.q-time { text-align: center; margin-top: 10px; font-variant-numeric: tabular-nums; }

/* 대기실 패널 추가 요소 */
.copy-btns { display: inline-flex; gap: 4px; margin-left: 4px; vertical-align: middle; }
.copy-btns .mini { padding: 3px 7px; font-size: 11px; }
/* 대기실 HUD 왼쪽 위: 내 닉네임 칩 (누르면 닉네임 창) */
.name-chip { display: inline-flex; align-items: center; gap: 6px; max-width: min(240px, 34vw); }
.name-chip b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; font-size: 13px; }
.name-chip .nc-edit { flex: none; opacity: .6; font-size: 12px; }
.name-chip:hover .nc-edit, .name-chip:focus-visible .nc-edit { opacity: 1; }
@media (max-width: 520px) { .name-chip { max-width: 42vw; } .name-chip b { font-size: 12px; } }
.lp-set { margin: 4px 0 6px; padding-top: 2px; }
.lp-set .seg button { padding: 6px 2px; font-size: 12px; }
.lp-set .kcs { font-size: 8.5px; }
.lobby-panel { width: min(290px, calc(100% - 16px)); max-height: calc(100% - 16px); overflow-y: auto; }

/* 방장이 설정을 바꾸면 모두에게 한 번 띄우는 알림 */
.notice {
  position: absolute; left: 50%; top: 18%; transform: translate(-50%, -8px); z-index: 6; pointer-events: none; opacity: 0; transition: opacity .25s, transform .25s;
  background: rgba(15, 17, 30, .94); border: 2px solid var(--accent); border-radius: 14px; padding: 12px 18px; text-align: center; min-width: 220px; max-width: calc(100% - 24px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.notice.show { opacity: 1; transform: translate(-50%, 0); }
.notice b { display: block; color: var(--accent); font-size: 14px; font-weight: 900; margin-bottom: 6px; }
.notice div { font-size: 14px; font-weight: 800; margin-top: 2px; }
.notice s { text-decoration: none; color: var(--muted); }
@media (max-width: 520px) { .notice { top: 46%; } }

/* ---------- 리듬게임식 콤보 표시 ---------- */
.combo-fx {
  /* PC 가로 화면: 내 캐릭터(가운데)의 오른쪽 위, 시선이 머무는 곳 */
  position: absolute; left: calc(50% + clamp(150px, 16vw, 230px)); top: 22%; transform: translateX(-50%); z-index: 3; pointer-events: none; text-align: center; font-style: italic;
  opacity: 0; transition: opacity .2s; --cc: #ffffff; --glow: transparent;
}
.combo-fx.on { opacity: 1; }
.cfx-num, .cfx-label, .cfx-ms { -webkit-text-stroke: 7px #14162a; paint-order: stroke fill; }
.cfx-num {
  font-size: 72px; font-weight: 900; line-height: .9; letter-spacing: -2px; color: var(--cc); font-variant-numeric: tabular-nums;
  text-shadow: 0 5px 0 rgba(10, 12, 24, .5); filter: drop-shadow(0 0 12px var(--glow)); transform-origin: 50% 70%;
}
.cfx-label { font-size: 16px; font-weight: 900; letter-spacing: 7px; margin-right: -7px; color: var(--cc); -webkit-text-stroke-width: 5px; }
.cfx-bar { width: 86px; height: 6px; margin: 6px auto 0; border-radius: 3px; background: rgba(15, 17, 30, .7); box-shadow: 0 0 0 2px #14162a; overflow: hidden; }
.cfx-bar i { display: block; height: 100%; width: 0; background: var(--cc); transition: width .12s; }
.cfx-ms {
  position: absolute; left: 50%; bottom: 100%; margin-bottom: 6px; transform: translateX(-50%); white-space: nowrap;
  font-size: 24px; font-weight: 900; color: var(--cc); -webkit-text-stroke-width: 6px; opacity: 0;
}

/* 단계별 색: 0~9 흰색, 10+ 하늘, 20+ 금색, 30+ 주황, 40+ 분홍, 50+ 무지개 */
.combo-fx.t1 { --cc: #7ff3ff; --glow: rgba(127, 243, 255, .55); }
.combo-fx.t2 { --cc: #ffd84a; --glow: rgba(255, 216, 74, .65); }
.combo-fx.t3 { --cc: #ff9a3d; --glow: rgba(255, 120, 61, .7); }
.combo-fx.t4 { --cc: #ff6fc0; --glow: rgba(255, 95, 179, .75); }
.combo-fx.t5 { --glow: rgba(255, 255, 255, .8); animation: crainbow 1.2s linear infinite; }
@keyframes crainbow {
  0% { --cc: #ff5f5f; } 17% { --cc: #ffa53a; } 33% { --cc: #ffe14a; } 50% { --cc: #4ef08a; } 67% { --cc: #3ec9ff; } 83% { --cc: #b57bff; } 100% { --cc: #ff5f5f; }
}
@property --cc { syntax: '<color>'; inherits: true; initial-value: #ffffff; }

/* 한 칸 오를 때: 숫자가 튀어나옴 */
.combo-fx.pop .cfx-num { animation: cpop .24s cubic-bezier(.2, 1.7, .4, 1); }
.combo-fx.pop .cfx-label { animation: clab .24s ease-out; }
@keyframes cpop { 0% { transform: scale(1.45) translateY(-6px) rotate(-4deg); } 100% { transform: none; } }
@keyframes clab { 0% { letter-spacing: 11px; opacity: .6; } 100% { letter-spacing: 7px; opacity: 1; } }

/* 10콤보마다: 크게 터지고 문구 */
.combo-fx.ms .cfx-num { animation: cms .55s cubic-bezier(.2, 1.5, .35, 1); }
.combo-fx.ms .cfx-ms { animation: cmsw .95s ease-out; }
.combo-fx.ms .cfx-bar i { animation: cbar .5s ease-out; }
.combo-fx.ms::after {
  content: ""; position: absolute; left: 50%; top: 36%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  border: 5px solid var(--cc); animation: cring .55s ease-out forwards;
}
@keyframes cms { 0% { transform: scale(2.1) rotate(-8deg); filter: brightness(2) drop-shadow(0 0 22px var(--glow)); } 60% { transform: scale(.94); } 100% { transform: none; } }
@keyframes cmsw { 0% { opacity: 0; transform: translateX(-50%) scale(.4); } 18% { opacity: 1; transform: translateX(-50%) scale(1.2); } 30% { transform: translateX(-50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-14px); } }
@keyframes cring { 0% { transform: scale(.3); opacity: 1; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes cbar { 0%, 60% { filter: brightness(2); } 100% { filter: none; width: 0; } }

/* 콤보가 끊기면: 흔들리다 무너져 내림 */
.combo-fx.brk .cfx-num { animation: cbrk .7s ease-in forwards; color: #ff5f6d; }
.combo-fx.brk .cfx-label { color: #ff5f6d; animation: cbrkl .7s ease-in forwards; }
@keyframes cbrk {
  0% { transform: none; } 10% { transform: translateX(-6px) rotate(-3deg); } 20% { transform: translateX(6px) rotate(3deg); } 30% { transform: translateX(-4px); }
  45% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(46px) rotate(18deg); opacity: 0; }
}
@keyframes cbrkl { 0%, 45% { opacity: 1; } 100% { opacity: 0; transform: translateY(20px); } }

@media (max-width: 720px), (max-height: 520px) {
  .combo-fx { left: auto; right: 50px; top: 15%; transform: none; } /* 오른쪽 끝 미니맵을 피함 */
  .cfx-num { font-size: 48px; -webkit-text-stroke-width: 5px; }
  .cfx-label { font-size: 12px; letter-spacing: 5px; margin-right: -5px; -webkit-text-stroke-width: 4px; }
  .cfx-ms { font-size: 15px; -webkit-text-stroke-width: 4px; left: auto; right: -8px; transform: none; }
  .combo-fx.ms .cfx-ms { animation-name: cmswR; }
  .cfx-bar { width: 64px; height: 5px; }
}
#game.goal-mode .combo-fx { display: none; }
@keyframes cmswR { 0% { opacity: 0; transform: scale(.4); } 18% { opacity: 1; transform: scale(1.2); } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

/* ---------- 경기 종료 연출 (결과창 전): 어두워짐 → 띠가 쓸고 지나감 → 큰 문구 쾅 → 부제 → 위로 사라짐 (약 1.9초) ---------- */
.endfx { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; pointer-events: none; overflow: hidden; --c1: #ffe27a; --c2: #ff9f1c; }
.endfx.tone-gold { --c1: #ffe27a; --c2: #ff9f1c; }
.endfx.tone-clear { --c1: #9dffd6; --c2: #2ee59d; }
.endfx.tone-over { --c1: #ffb08a; --c2: #ff3d5a; }
.endfx.tone-set { --c1: #c9f0ff; --c2: #3e9bff; }
.endfx.tone-timeup { --c1: #e6d0ff; --c2: #ff5fb3; }
.endfx::before { content: ''; position: absolute; inset: 0; background: rgba(6, 8, 16, .6); opacity: 0; }
.endfx.show::before { animation: efDim .3s ease-out forwards; }
.endfx .ef-band {
  position: absolute; left: 0; right: 0; top: 50%; height: 156px; margin-top: -78px; transform: scaleX(0); transform-origin: left center;
  background: linear-gradient(90deg, var(--c2), var(--c1) 30%, var(--c1) 70%, var(--c2)); box-shadow: 0 0 40px rgba(0, 0, 0, .35);
}
.endfx .ef-band::before, .endfx .ef-band::after { content: ''; position: absolute; left: 0; right: 0; height: 3px; background: rgba(255, 255, 255, .75); }
.endfx .ef-band::before { top: 0; } .endfx .ef-band::after { bottom: 0; }
.endfx.show .ef-band { animation: efSweep .5s cubic-bezier(.7, 0, .2, 1) .05s forwards; }
.ef-main { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.ef-title { font-size: 76px; font-weight: 900; font-style: italic; letter-spacing: 3px; line-height: 1; white-space: nowrap; }
.ef-title span { display: inline-block; color: #fff; -webkit-text-stroke: 9px #14162a; paint-order: stroke fill; text-shadow: 0 7px 0 rgba(10, 12, 24, .55), 0 0 26px rgba(255, 255, 255, .35); }
.endfx.show .ef-title { animation: efDrop .6s cubic-bezier(.2, .9, .3, 1.15) .15s both; }
.endfx.show .ef-title span { animation: efShake .45s linear .75s; }
.ef-sub {
  margin: 0; font-size: 18px; font-weight: 900; color: #fff; white-space: nowrap; background: rgba(15, 17, 30, .86);
  border: 2px solid var(--c1); border-radius: 999px; padding: 6px 18px; opacity: 0; font-variant-numeric: tabular-nums;
}
.endfx.show .ef-sub { animation: efRise .45s ease-out .45s both; }
.endfx.out { animation: efOut .35s ease-in forwards; }
@keyframes efDim { from { opacity: 0; } to { opacity: 1; } }
@keyframes efSweep { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes efDrop {
  0% { opacity: 0; transform: translateY(-60vh) scale(1.5); }
  55% { opacity: 1; transform: translateY(0) scale(.9); }
  75% { transform: scale(1.07); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes efShake { 0%, 100% { transform: none; } 20% { transform: translate(-5px, 2px) rotate(-1.2deg); } 40% { transform: translate(4px, -2px) rotate(1deg); } 60% { transform: translate(-3px, 1px); } 80% { transform: translate(2px, 0); } }
@keyframes efRise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes efOut { to { opacity: 0; transform: translateY(-28px); } }
@keyframes efFade { to { opacity: 0; } }
@media (max-width: 520px) {
  .ef-title { font-size: 48px; letter-spacing: 2px; } .ef-title span { -webkit-text-stroke-width: 6px; }
  .endfx .ef-band { height: 112px; margin-top: -56px; }
  .ef-sub { font-size: 14px; padding: 5px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .endfx.show::before { animation: none; opacity: 1; }
  .endfx.show .ef-band { animation: none; transform: none; }
  .endfx.show .ef-title, .endfx.show .ef-title span, .endfx.show .ef-sub { animation: none; opacity: 1; }
  .endfx.out { animation: efFade .3s ease-in forwards; }
}

/* ---------- 올콤보 ---------- */
.allcombo {
  position: absolute; left: 50%; top: 36%; z-index: 7; pointer-events: none; text-align: center; white-space: nowrap;
  transform: translate(-50%, -50%); opacity: 0; visibility: hidden;
}
.allcombo.show { visibility: visible; animation: acshow 3.4s ease-out forwards; }
@keyframes acshow { 0% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%); } }
.ac-rays {
  position: absolute; left: 50%; top: 50%; width: 560px; height: 560px; margin: -280px 0 0 -280px; border-radius: 50%; z-index: -1;
  background: repeating-conic-gradient(rgba(255, 236, 140, .38) 0 9deg, rgba(255, 236, 140, 0) 9deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%); mask: radial-gradient(circle, #000 18%, transparent 68%);
}
.allcombo.show .ac-rays { animation: acrays 3.4s linear; }
@keyframes acrays { 0% { transform: scale(.2) rotate(0); opacity: 0; } 12% { transform: scale(1) rotate(20deg); opacity: 1; } 100% { transform: scale(1.1) rotate(90deg); opacity: .6; } }
.ac-text { font-size: 76px; font-weight: 900; font-style: italic; letter-spacing: 1px; line-height: 1; }
.ac-text span {
  display: inline-block; color: var(--c); -webkit-text-stroke: 9px #14162a; paint-order: stroke fill;
  text-shadow: 0 7px 0 rgba(10, 12, 24, .55); filter: drop-shadow(0 0 14px var(--c));
}
.ac-text .sp { width: .3em; }
.allcombo.show .ac-text span { animation: acletter .7s cubic-bezier(.2, 1.8, .4, 1) both, acwave 1.1s ease-in-out .9s infinite; animation-delay: var(--d), calc(var(--d) + .9s); }
@keyframes acletter { 0% { transform: translateY(-80px) scale(.3) rotate(-25deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes acwave { 0%, 100% { transform: none; } 50% { transform: translateY(-8px) scale(1.06); } }
.ac-sub {
  display: inline-block; margin-top: 12px; font-size: 16px; font-weight: 900; color: #fff; background: rgba(15, 17, 30, .82);
  border: 2px solid #ffd84a; border-radius: 999px; padding: 6px 16px; opacity: 0;
}
.allcombo.show .ac-sub { animation: acsub .4s ease-out .65s forwards; }
@keyframes acsub { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 720px) {
  .ac-text { font-size: 42px; } .ac-text span { -webkit-text-stroke-width: 6px; }
  .ac-rays { width: 380px; height: 380px; margin: -190px 0 0 -190px; }
  .ac-sub { font-size: 13px; }
}

/* 결과창 올콤보 인장 */
.result-card { position: relative; }
.seal {
  position: absolute; right: 18px; top: 12px; width: 118px; height: 118px; border-radius: 50%; z-index: 2; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #fff6c2, #ffd84a 38%, #f0a21a 78%, #c97a0a);
  box-shadow: 0 0 0 4px #14162a, 0 0 0 7px #ffd84a, 0 8px 20px rgba(0, 0, 0, .45), 0 0 28px rgba(255, 216, 74, .55);
  transform: rotate(-14deg);
}
.seal::before { /* 톱니 테두리 */
  content: ""; position: absolute; inset: -12px; border-radius: 50%; z-index: -1;
  background: repeating-conic-gradient(#ffd84a 0 6deg, transparent 6deg 12deg);
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%); mask: radial-gradient(circle, transparent 60%, #000 61%);
}
.seal-in {
  position: absolute; inset: 9px; border-radius: 50%; border: 2px dashed rgba(90, 40, 0, .55);
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: #5a2400; text-align: center;
}
.seal-in b { font-size: 25px; font-weight: 900; font-style: italic; line-height: .95; letter-spacing: .5px; color: #b3161f; text-shadow: 0 1px 0 #fff3b0; }
.seal-in small { font-size: 9px; font-weight: 900; letter-spacing: 1px; margin: 3px 0; }
.seal.stamp { animation: stamp .55s cubic-bezier(.3, 1.6, .5, 1) .25s both; }
@keyframes stamp { 0% { transform: rotate(-30deg) scale(2.6); opacity: 0; } 60% { opacity: 1; } 100% { transform: rotate(-14deg) scale(1); opacity: 1; } }
@media (max-width: 520px) { .seal { width: 88px; height: 88px; right: 10px; top: 8px; } .seal-in b { font-size: 18px; } .seal-in small { font-size: 7px; } }
.badge.allc { background: linear-gradient(90deg, #ff6262, #ffa53a, #ffe14a, #29c78c, #3e9bff, #a46bff); color: #14162a; font-weight: 900; }
.result-card:has(.seal:not([hidden])) h2, .result-card:has(.seal:not([hidden])) .res-sub { padding-right: 128px; }
@media (max-width: 520px) { .result-card:has(.seal:not([hidden])) h2, .result-card:has(.seal:not([hidden])) .res-sub { padding-right: 92px; } }

/* ---------- 조작법 버튼 · 가이드 ---------- */
.guide-btn {
  position: absolute; right: 16px; top: 16px; z-index: 3; display: flex; align-items: center; gap: 7px;
  background: rgba(15, 17, 30, .82); border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px 5px 5px; color: var(--text);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .35); backdrop-filter: blur(3px); transition: transform .06s, filter .1s;
}
.guide-btn:hover { filter: brightness(1.2); }
.guide-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.guide-btn b { font-size: 14px; font-weight: 900; }
.gq { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: 16px; }
@media (max-width: 720px) { .guide-btn { right: 10px; top: 12px; padding: 4px; } .guide-btn b { display: none; } .gq { width: 30px; height: 30px; } }

.mcard.guide { width: min(500px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
.gtabs { margin: 12px 0 4px; flex: none; }
.gtabs button { padding: 9px 4px !important; font-size: 14px !important; }
.gpane { overflow-y: auto; min-height: 0; padding: 4px 2px; }
.gl { display: grid; grid-template-columns: 128px 1fr; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(52, 58, 92, .6); }
.gl p { margin: 0; font-size: 13.5px; line-height: 1.55; color: #d6d9ec; }
.gl p b { color: #fff; }
.gv { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 44px; background: var(--bg2); border-radius: 10px; padding: 8px 6px; }
.gv .kcs { font-size: 11px; }
.gv-col { flex-direction: column; gap: 5px; }
.gv-dir { flex-direction: column; gap: 6px; font-size: 12px; font-weight: 900; color: var(--muted); }
.gv-dir > span { display: flex; align-items: center; gap: 5px; }
.kcap { font-style: normal; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: var(--c); color: #111; font-weight: 900; font-size: 12px; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .22); opacity: .75; }
.kcap.big { width: 32px; height: 32px; font-size: 18px; opacity: 1; box-shadow: 0 0 0 2px #fff inset, inset 0 -3px 0 rgba(0, 0, 0, .22); margin-right: 3px; }
.kk { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 6px; background: #d9dcea; color: #14162a; font-weight: 900; font-size: 13px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.kk.wide { min-width: 84px; }
.gv-keys small { color: var(--muted); font-weight: 800; font-size: 11px; margin: 0 2px; }
.gv-big { font-size: 22px; font-weight: 900; font-style: italic; color: #ffd84a; -webkit-text-stroke: 4px #14162a; paint-order: stroke fill; line-height: 1; text-align: center; }
.gv-big small { font-size: 11px; margin-left: 2px; -webkit-text-stroke-width: 3px; }
.gv-big.combo { color: #7ff3ff; flex-direction: column; } .gv-big.combo small { margin: 2px 0 0; letter-spacing: 3px; }
.gv-big.allc { font-size: 15px; background: radial-gradient(circle at 35% 30%, #fff6c2, #ffd84a 45%, #f0a21a); color: #b3161f; -webkit-text-stroke: 0; }
.gtaunts { list-style: none; margin: 10px 0 2px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gtaunts li { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 9px; padding: 7px 9px; font-size: 13px; }
.gtaunts li .kk { min-width: 22px; height: 22px; font-size: 12px; }
.gtaunts li em { font-style: normal; color: var(--muted); font-size: 11.5px; margin-left: auto; }
.gmodes { list-style: none; margin: 10px 0 2px; padding: 0; display: grid; gap: 5px; font-size: 13px; color: #d6d9ec; }
.gmodes li { background: var(--bg2); border-radius: 9px; padding: 8px 10px; }
.gmodes b { color: #fff; margin-right: 6px; }
@media (max-width: 520px) {
  .gl { grid-template-columns: 1fr; gap: 8px; }
  .gtaunts { grid-template-columns: 1fr; }
}
.krow { display: flex; align-items: center; gap: 6px; }

/* 경기 중 도발 버튼: 경기 화면 오른쪽 아래에 떠 있음 (키보드 1~5) */
.race-taunts { position: absolute; right: 10px; bottom: 10px; z-index: 4; padding: 5px; border-radius: 12px; background: rgba(15, 17, 30, .72); backdrop-filter: blur(3px); }
.race-taunts button { background: rgba(35, 40, 66, .9); }
@media (max-width: 720px) { .race-taunts { right: 6px; bottom: 6px; padding: 4px; } }

/* PC(마우스·트랙패드): 경기 화면 아래 버튼을 모두 숨김 — 글자 키, 1~5 도발, ←→/S D F·J K L 이동, Space 점프로 조작.
   터치 기기(휴대폰·태블릿)는 그대로 버튼을 보여 준다. */
@media (pointer: fine) {
  #game .pad, #game .race-taunts, #game .lobby-bar,
  #game.lobby-mode .lobby-bar, #game.goal-mode .lobby-bar { display: none !important; }
}

/* ---------- 다시보기 (기록 재생) ---------- */
/* 조작 막대는 다시보기 중에만 보이고, 글자 키·도발·터치 패드 자리를 대신한다 (PC·모바일 같이) */
.replay-bar { display: none; flex-direction: column; gap: 6px; padding: 8px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--bg2); border-top: 1px solid var(--line); touch-action: none; user-select: none; -webkit-user-select: none; }
#game.replay-mode .replay-bar { display: flex; }
#game.replay-mode .pad, #game.replay-mode .race-taunts { display: none !important; }
/* 최근 입력 키: 가장 오른쪽이 방금 누른 키 */
.rp-keys { display: flex; justify-content: center; align-items: center; gap: 5px; height: 40px; }
.rp-keys i { font-style: normal; flex: none; min-width: 30px; height: 28px; padding: 0 6px; border-radius: 8px; display: grid; place-items: center; background: var(--c, var(--card)); color: #111; font-size: 15px; font-weight: 900; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.rp-keys i.tt { background: rgba(35, 40, 66, .95); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.rp-keys i.miss { background: var(--bad); color: #fff; }
.rp-keys i.pop { animation: rpPop .42s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes rpPop { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }
.rp-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rp-btn { flex: none; min-width: 40px; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 15px; font-weight: 800; touch-action: manipulation; }
.rp-btn:hover { border-color: #4b5385; }
.rp-btn:active { transform: translateY(1px); }
.rp-play { min-width: 46px; color: var(--accent); }
.rp-exit { margin-left: auto; color: #ffb3bf; }
.rp-speed { display: flex; gap: 3px; flex: none; }
.rp-speed button { min-width: 40px; height: 38px; padding: 0 4px; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; touch-action: manipulation; }
.rp-speed button.on { background: rgba(255, 207, 63, .16); border-color: var(--accent); color: var(--accent); }
.rp-row input[type=range] { flex: 1; min-width: 0; height: 24px; accent-color: var(--accent); }
.rp-time { flex: none; font-size: 12px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-hint { margin: 0; text-align: center; font-size: 11px; color: var(--muted); }
@media (pointer: coarse) { .rp-btn, .rp-speed button { height: 44px; } .rp-speed button { min-width: 44px; } }
@media (max-width: 520px) { .replay-bar { gap: 5px; padding: 6px 8px; } .rp-speed button { min-width: 38px; padding: 0 2px; } .rp-time { font-size: 11px; } }
@media (prefers-reduced-motion: reduce) { .rp-keys i.pop { animation: none; } }
/* 순위표·내 기록 카드의 버튼 (▶ 다시보기 · 👻 같이 달리기 · 🔗 링크): 아이콘 + 글자, 터치 영역 34px 이상 */
.rp-go, .gtog, .lk-go {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 34px; padding: 0 7px;
  border-radius: 9px; font-size: 12.5px; font-weight: 900; line-height: 1; white-space: nowrap; touch-action: manipulation;
  transition: background .12s, border-color .12s, box-shadow .12s, transform .08s;
}
.rp-go:active, .gtog:active, .lk-go:active { transform: translateY(1px); }
.bic { font-size: 14px; line-height: 1; }
.rp-go { border: 1.5px solid rgba(62, 155, 255, .6); background: rgba(62, 155, 255, .16); color: #d7ecff; }
.rp-go:hover { background: rgba(62, 155, 255, .32); }
.rp-go:disabled { opacity: .5; }
.gtog { border: 1.5px solid rgba(164, 107, 255, .65); background: rgba(164, 107, 255, .08); color: #d9c8ff; }
.gtog:hover { background: rgba(164, 107, 255, .24); }
.gtog.on { border-color: #b98bff; background: #7d4fe6; color: #fff; box-shadow: 0 0 0 2px rgba(164, 107, 255, .3); }
.gtog { position: relative; }
.gtog .ck { position: absolute; top: -6px; right: -6px; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #6a3fd0; font-style: normal; font-size: 10px; font-weight: 900; line-height: 1; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.gtog.on:hover { background: #8d5ff2; }
.lk-go { border: 1.5px solid var(--line); background: var(--bg2); color: #d6d9ec; }
.lk-go:hover { background: #2b3151; }

/* ---------- 오늘의 도전 ---------- */
.dk.daily { --c: #a46bff; color: #fff; }
.dk.daily small { opacity: .8; }
.deck { grid-template-columns: 1.1fr 1fr 1.2fr 1fr 1.15fr; }
@media (max-width: 720px) {
  .deck { grid-template-columns: 1fr 1fr; }
  .deck .dk-join { grid-column: 1 / -1; }
}
.badge.ghost { background: #3d2a6b; color: #e2d4ff; }

.dd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dd-date { display: flex; align-items: center; gap: 8px; }
.dd-date b { font-size: 15px; font-variant-numeric: tabular-nums; }
.dd-date .mini:disabled { opacity: .35; cursor: default; }
.dd-invite { margin: 6px 0 4px; padding: 9px 12px; border-radius: 10px; background: rgba(164, 107, 255, .16); border: 1.5px solid #a46bff; font-size: 13px; line-height: 1.5; }
.dd-invite span { color: var(--muted); font-size: 12px; margin-left: 4px; }
.daily-panel > .seg { margin: 8px 0 2px; flex: none; }
.daily-panel > .seg button { padding: 8px 4px; }
.daily-panel .kcs { font-size: 10px; }
.dd-me, .ss-me { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 14px; flex: none; background: linear-gradient(135deg, rgba(255, 207, 63, .16), rgba(255, 207, 63, .04)); border: 1px solid rgba(255, 207, 63, .5); }
.muted { color: var(--muted) !important; font-style: normal; }
.dm-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-width: 0; }
.dm-top > div:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dm-top small { color: var(--muted); font-size: 11px; font-weight: 800; }
.dm-top > div:first-child > span { font-size: 13px; color: #e3e6f6; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-top .badge { vertical-align: 1px; margin-left: 4px; }
.dm-val { display: flex; align-items: baseline; gap: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; flex: none; }
.dm-val b { font-size: 32px; font-weight: 900; font-style: italic; line-height: 1; color: #ffd84a; }
.dm-val small { font-size: 13px; font-weight: 800; color: var(--muted); }
.dm-val.none b { font-size: 16px; font-style: normal; color: var(--muted); }
.dd-me-act { display: flex; gap: 6px; }
.dd-me-act > * { flex: 1 1 0; min-width: 0; }
.dd-board { margin-top: 12px; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dd-bhead { display: flex; align-items: baseline; gap: 8px; font-size: 13px; padding: 0 2px 6px; }
.dd-bhead span { color: var(--muted); font-size: 12px; }
.dd-pick { margin-left: auto; color: #c9b3ff !important; font-weight: 800; }
/* 순위표 목록 (오늘의 도전 · 시즌 도전 공통): 카드형 슬롯 */
.dd-list, .ss-board { list-style: none; margin: 0; padding: 6px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; border-radius: 12px; background: rgba(15, 17, 30, .55); overscroll-behavior: contain; }
.dd-list { flex: 1 1 auto; min-height: 120px; max-height: 420px; }
/* 한 줄 = 카드: 메달 배지 · 이름과 보조 정보 · 기록 값 · 버튼 묶음 */
.sl { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; align-items: center; gap: 8px 7px; min-height: 56px; padding: 8px 9px 8px 10px; border-radius: 11px; background: #1f2440; border: 1px solid rgba(52, 58, 92, .9); font-size: 13px; flex: none; }
.sl.me { background: linear-gradient(90deg, rgba(255, 207, 63, .2), rgba(255, 207, 63, .05) 70%, #1f2440); border-color: rgba(255, 207, 63, .6); box-shadow: inset 4px 0 0 #ffcf3f; }
.sl.on { box-shadow: inset 4px 0 0 #a46bff; }
.sl.me.on { box-shadow: inset 4px 0 0 #a46bff, inset 8px 0 0 #ffcf3f; }
.sl-rk { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--muted); background: #2c3352; border: 1px solid #3c4470; }
.sl-rk.m1 { color: #3b2a00; background: radial-gradient(circle at 35% 30%, #fff4b8, #ffd84a 48%, #c9901c); border-color: #f5d35a; box-shadow: 0 2px 0 #7a5a10, 0 0 12px rgba(255, 210, 60, .4); }
.sl-rk.m2 { color: #22273a; background: radial-gradient(circle at 35% 30%, #ffffff, #d7dcea 50%, #8f97b0); border-color: #cfd5e6; box-shadow: 0 2px 0 #5d6479; }
.sl-rk.m3 { color: #3a1f08; background: radial-gradient(circle at 35% 30%, #ffd6ae, #d9894a 50%, #9a5224); border-color: #e7a771; box-shadow: 0 2px 0 #6e3b17; }
.sl-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sl-nm { display: block; min-width: 0; font-size: 15px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-sub { color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-sub .badge { margin-left: 2px; vertical-align: 1px; }
.sl-sub .badge.allc { background: #ffd84a; color: #2a1d00; font-size: 9px; letter-spacing: .2px; padding: 1px 4px; }
.sl-val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sl-val b { font-size: 17px; font-weight: 900; color: #fff; letter-spacing: -.2px; }
.sl-val small { margin-left: 1px; font-size: 11px; font-weight: 800; color: var(--muted); }
.sl-act { display: flex; gap: 4px; flex: none; }
.lk-go { width: 34px; padding: 0; } /* 🔗 은 아이콘만 (PC) */
.lk-go .btxt { display: none; }
.dd-list .dd-empty, .ss-board .empty { list-style: none; text-align: center; color: var(--muted); padding: 22px 12px; line-height: 1.6; font-size: 13px; }
@media (max-width: 520px) { /* 휴대폰: 버튼 묶음을 슬롯 아래 줄로 내려 이름과 기록이 잘리지 않게 */
  .sl { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 6px 8px; padding: 8px 9px; }
  .sl-rk { grid-row: 1 / span 2; width: 30px; height: 30px; font-size: 13px; align-self: center; }
  .sl-nm { font-size: 14px; }
  .sl-val b { font-size: 17px; }
  .sl-act { grid-column: 2 / -1; gap: 6px; }
  .sl-act > * { flex: 1 1 0; min-width: 0; min-height: 36px; padding: 0 6px; gap: 4px; }
  .lk-go { width: auto; }
  .lk-go .btxt { display: inline; }
  .dm-val b { font-size: 28px; }
}

/* 오늘의 도전 로비: 코드 방 대기실 패널 자리에 오늘의 도전 패널 */
#game:not(.daily-lobby) #dailyPanel, #game.daily-lobby #lobbyPanel { display: none !important; }
.daily-panel { width: min(540px, calc(100% - 16px)); display: flex; flex-direction: column; } /* 순위표 줄: 이름 · 기록 · 👻 같이 · ▶ 다시보기 · 🔗 링크 */
.dd-head .room-kind { font-size: 17px; }
.dd-desc { margin: 4px 0 2px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.daily-panel > * { flex: none; }
.daily-panel > .dd-board { flex: 1 1 auto; min-height: 0; }
.daily-panel .dd-list { min-height: 150px; }
.dd-start { width: 100%; height: 54px; margin-top: 10px; flex: none; }
/* 나가기 (✕와 같음) + 도전 시작 한 줄 */
.dd-foot { display: flex; gap: 8px; margin-top: 10px; flex: none; }
.dd-foot > .dk { height: 54px; margin-top: 0; flex: none; }
.dd-foot .dd-start { flex: 1 1 auto; min-width: 0; width: auto; }
.dd-exit { width: 92px; }
.dd-exit b { font-size: 16px; }
/* 방 대기실 패널: 제목 줄 오른쪽 나가기 (패널 높이를 늘리지 않게) */
.lp-exit { margin-left: auto; flex: none; padding: 2px 11px; font-size: 13px; font-weight: 800; line-height: 1.4; }
.dd-start small { opacity: .85; }
@media (max-width: 520px) {
  .dd-desc { display: none; }
}

/* ---------- 맵 에디터 · 커스텀 맵 ---------- */
.dk.editor { --c: #ff8a3d; color: #1a1205; }
.dk.editor small { opacity: .75; }
.deck { grid-template-columns: 1.1fr 1fr 1.15fr 1fr 1fr 1.15fr; }
@media (max-width: 720px) {
  .deck { grid-template-columns: 1fr 1fr; }
  .deck .dk.editor { grid-column: 1 / -1; height: 44px; flex-direction: row; gap: 10px; }
}

/* 장면: 에디터에서는 경기·대기실 요소를 숨김 */
#game:not(.editor-mode) .editor-only { display: none !important; }
#game.editor-mode .race-only, #game.editor-mode .lobby-only, #game.editor-mode .stats, #game.editor-mode .ranks { display: none !important; }

.editor-panel { width: min(320px, calc(100% - 16px)); max-height: calc(100% - 16px); overflow-y: auto; display: flex; flex-direction: column; }
.ed-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ed-len { display: flex; align-items: baseline; gap: 5px; color: var(--muted); }
.ed-len b { font-size: 26px; font-weight: 900; color: #ffb36b; font-variant-numeric: tabular-nums; }
.ed-len.ok b { color: var(--good); }
.ed-len small { font-size: 11px; font-weight: 700; }
.ed-sec { margin: 12px 0 5px; font-size: 12px; font-weight: 900; color: #d6d9ec; display: flex; align-items: baseline; gap: 8px; }
.ed-quota { margin-left: auto; color: var(--muted); font-weight: 700; }
.ed-ok { color: var(--good); font-weight: 800; }
.editor-panel > .seg { flex: none; }
.editor-panel > .seg button { padding: 7px 4px; }
.editor-panel .kcs { font-size: 10px; }
.ed-keys { margin: 7px 0 0; font-size: 11px; color: var(--muted); line-height: 1.7; }
.ed-keys kbd { display: inline-block; min-width: 18px; padding: 0 4px; margin: 0 1px; border-radius: 4px; background: var(--bg2); border: 1px solid var(--line); font: 800 11px system-ui, sans-serif; color: #fff; text-align: center; }
.ed-row { display: flex; gap: 6px; margin-top: 6px; }
.ed-row .mini { flex: 1; }
.mini.danger { background: var(--bad); color: #fff; border-color: transparent; }
.ed-test { width: 100%; height: 50px; margin-top: 8px; flex: none; }
.ed-test small { opacity: .8; }
.ed-reg { display: flex; gap: 6px; }
.ed-reg input, .mp-code input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text); font-size: 15px; font-weight: 700; }
.ed-reg input:focus, .mp-code input:focus { border-color: var(--accent); outline: none; }
.ed-reg .dk, .mp-code .dk { flex: none; width: 78px; height: 44px; }
.ed-reg .dk b, .mp-code .dk b { font-size: 15px; }
.ed-note { margin: 7px 0 0; padding: 8px 10px; border-radius: 9px; background: rgba(46, 229, 157, .12); border: 1px solid rgba(46, 229, 157, .5); font-size: 12px; line-height: 1.5; }
.ed-note.bad { background: rgba(255, 98, 98, .12); border-color: rgba(255, 98, 98, .6); }
.map-list { list-style: none; margin: 0; padding: 0; border-radius: 10px; background: rgba(15, 17, 30, .5); max-height: 210px; overflow-y: auto; flex: none; }
.map-list li { display: flex; align-items: center; gap: 5px; padding: 7px 9px; border-bottom: 1px solid rgba(52, 58, 92, .5); }
.map-list .mi { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.map-list .mi b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.map-list .mi small { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .3px; }
.map-list .mini { padding: 4px 7px; flex: none; font-size: 11px; }

/* 에디터 터치 버튼 */
.editor-bar { display: flex; gap: 8px; padding: 10px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--bg2); border-top: 1px solid var(--line); touch-action: none; user-select: none; -webkit-user-select: none; }
.editor-bar .move { flex: 1; height: clamp(52px, 9vh, 70px); border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-size: 24px; touch-action: none; }
.editor-bar .move.up { background: #f4f1ff; color: #111; }
.editor-bar .move.del { flex: .7; font-size: 20px; }
.editor-bar .move.down { background: var(--accent); color: var(--accent-ink); }
@media (pointer: fine) { #game .editor-bar { display: none !important; } }
@media (max-width: 520px) {
  .editor-panel { max-height: 50%; }
  .ed-keys { display: none; }
  .map-list { max-height: 130px; }
}

/* 경기 글자 버튼: 바로 위 발판(↑) */
.pad button.up { flex: .8; font-size: 30px; }

/* 방 만들기: 맵 고르기 */
.map-pick { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 10px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text); text-align: left; }
.map-pick b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.map-pick small { font-size: 10px; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.map-pick:hover { border-color: var(--accent); }
.map-auto { width: 100%; margin-top: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text); text-align: left; }
.map-auto small { color: var(--muted); font-size: 11px; font-weight: 700; }
.map-auto.on { border-color: var(--accent); }
#mapDlg .mcard { width: min(420px, 100%); }
#mapDlg .map-list { max-height: 240px; }
.mp-code { display: flex; gap: 6px; margin-top: 10px; }
.mp-code input { text-transform: uppercase; letter-spacing: 2px; }

/* ---------- 조작 개편: F·J 1칸, D·K 2칸, ↑ 위 ---------- */
.pad button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1; }
.pad button b { font-size: 26px; font-weight: 900; }
.pad button small { font-size: 11px; font-weight: 800; opacity: .7; margin-top: 3px; }
.pad button.two { flex: .9; }
.pad button.up { flex: .9; }
.pad button.up b { font-size: 28px; }
@media (max-width: 420px) { .hud-right { gap: 4px; } .hud-right .mini { padding: 5px 7px; font-size: 11px; } }

/* 에디터: 고른 발판 · 맵 검사 */
.ed-cur { margin-top: 6px; font-size: 12px; color: var(--muted); font-weight: 700; }
.ed-cur b { color: #ffd84a; margin-left: 4px; }
.ed-check { margin: 6px 0 0; padding: 7px 10px; border-radius: 9px; font-size: 12px; line-height: 1.45; background: rgba(46, 229, 157, .12); border: 1px solid rgba(46, 229, 157, .5); }
.ed-check.bad { background: rgba(255, 98, 98, .12); border-color: rgba(255, 98, 98, .6); }
.editor-bar .move.two { font-size: 17px; letter-spacing: -3px; background: #ffe2e2; color: #6b1d1d; }
.editor-bar { gap: 6px; }

/* ---------- 화면 배치: 메뉴 버튼·대기실 패널을 화면 가운데로, 모바일 조작 버튼은 경기 화면 안에 크게 ---------- */
/* 전체 화면 버튼 (메인 화면 왼쪽 위, 조작법 버튼과 같은 모양) */
/* 타이틀 왼쪽 위: 내 닉네임(누르면 닉네임 창) → 전체 화면 → 채널 칩 순서로 세로로 (전체 화면 버튼이 없으면 채널 칩이 위로) */
.name-btn { right: auto; left: 16px; top: 16px; max-width: min(260px, calc(50vw - 120px)); cursor: pointer; }
.name-btn b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-btn b:empty::before { content: "닉네임 정하기"; color: rgba(255, 255, 255, .6); }
.name-btn .gq { font-size: 14px; flex: none; }
.name-btn.empty { animation: npglow 1.4s ease-in-out infinite; }
.full-btn { right: auto; left: 16px; top: 60px; }
/* 좁은 화면: 로고가 위쪽 가운데를 차지하므로 왼쪽 위는 전체 화면·채널 칩, 닉네임은 그 아래(로고 소개 문구 아래) 빈 자리에 */
@media (max-width: 720px) {
  .name-btn { left: 10px; top: 150px; padding: 4px 12px 4px 4px; max-width: calc(100vw - 80px); }
  .name-btn b { display: block; font-size: 13px; }
  .full-btn { left: 10px; right: auto; top: 12px; }
}

/* 메인 메뉴 판 묶음 (.menu-dock): 게임 속 세계 위 가운데에 떠 있는 판(싱글 · 멀티 .deck) + 바로 아래 꾸미기 · 주크박스 줄.
   묶음이 위치 · 폭을 갖고, 판은 묶음 폭을 채운다. top은 판 위쪽 기준 (탭을 바꿔 판 높이가 달라져도 위는 그대로) */
#menu .title-stage { position: absolute; inset: 0; }
#menu .menu-dock {
  position: absolute; left: 50%; top: calc(51% - var(--dock-half, 170px)); transform: translateX(-50%); z-index: 2; /* --dock-half: 묶음 높이의 절반 (#menu에서 화면별로 정함) */
  width: min(340px, calc(100% - 56px)); display: flex; flex-direction: column; gap: 10px;
}
#menu .deck {
  width: 100%; grid-template-columns: 1fr; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 22px;
  background: rgba(15, 17, 30, .74); backdrop-filter: blur(4px); box-shadow: 0 14px 40px rgba(0, 0, 0, .38);
}
#menu .deck .dk-join { grid-column: auto; }
@media (max-width: 720px) {
  #menu .menu-dock { width: min(320px, calc(100% - 48px)); gap: 8px; }
  #menu { --dock-half: 174px; }
  #menu .deck { gap: 7px; padding: 10px; border-radius: 18px; }
}

/* 대기실 패널(코드 방 · 오늘의 도전): 화면 가운데, 바닥의 캐릭터를 가리지 않게 조금 위로 */
#lobbyPanel, #dailyPanel {
  left: 50%; top: 40%; transform: translate(-50%, -50%);
  max-height: 66%; overflow-y: auto; /* 아래쪽 바닥의 캐릭터·이름표는 가리지 않음 */
}
#lobbyPanel { width: min(340px, calc(100% - 24px)); }
#dailyPanel { width: min(540px, calc(100% - 16px)); top: 47%; max-height: min(75%, calc(100% - 110px)); }
@media (max-width: 520px) {
  #lobbyPanel { top: 38%; max-height: 64%; width: calc(100% - 24px); }
  #dailyPanel { top: calc(50% - 52px); max-height: min(75%, calc(100% - 200px)); width: calc(100% - 16px); } /* 아래 조작 줄(이모지·키) 위까지 */
}

/* 모바일(터치): 아래 조작 버튼을 경기 화면 안(아래쪽)에 겹쳐서 크게 */
@media (pointer: coarse) {
  #game .pad, #game .lobby-bar, #game .editor-bar {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
    background: linear-gradient(to top, rgba(10, 12, 22, .6), rgba(10, 12, 22, 0)); border-top: 0;
    padding: 18px 10px max(14px, env(safe-area-inset-bottom)); gap: 8px; pointer-events: none;
  }
  #game .pad > *, #game .lobby-bar > *, #game .lobby-bar .lb-right > *, #game .editor-bar > * { pointer-events: auto; }
  .pad button { height: clamp(84px, 13vh, 124px); border-radius: 18px; box-shadow: 0 6px 0 rgba(0, 0, 0, .45); }
  .pad button b { font-size: 36px; }
  .pad button small { font-size: 13px; margin-top: 4px; }
  .pad button.up b { font-size: 38px; }
  /* 결과창이 뜨면 버튼을 숨김 (결과창 버튼을 가리지 않게) */
  #game:has(#results:not([hidden])) .pad { display: none !important; }
  /* 대기실·결승 구역: 위 줄 상호작용, 아래 줄 ◀ 점프 ▶ */
  .lobby-bar { flex-wrap: wrap; justify-content: center; }
  .lobby-bar .taunts { order: -1; width: 100%; justify-content: center; gap: 8px; }
  .lobby-bar .taunts { gap: 5px !important; }
  .lobby-bar .taunts button { width: 44px; height: 42px; font-size: 20px; background: rgba(35, 40, 66, .9); }
  .lobby-bar .lb-right { display: contents; }
  .lobby-bar .move, .lobby-bar .move.jump {
    flex: 1; width: auto; height: clamp(64px, 9.5vh, 96px); border-radius: 18px; font-size: 30px;
    background: rgba(35, 40, 66, .9); box-shadow: 0 6px 0 rgba(0, 0, 0, .45);
  }
  .lobby-bar .move.jump { font-size: 20px; font-weight: 900; }
  /* 맵 에디터 */
  .editor-bar .move { height: clamp(70px, 10.5vh, 104px); border-radius: 18px; font-size: 28px; background: rgba(35, 40, 66, .9); box-shadow: 0 6px 0 rgba(0, 0, 0, .45); }
  .editor-bar .move.up { background: #f4f1ff; }
  .editor-bar .move.two { background: #ffe2e2; font-size: 20px; }
  /* 버튼과 겹치지 않게: 경기 중 도발 버튼·알림 띠는 버튼 위로 */
  .race-taunts { bottom: calc(clamp(84px, 13vh, 124px) + 40px); }
  .banner { top: auto; bottom: calc(clamp(84px, 13vh, 124px) + 96px); }
}

/* 도발 버튼 글자 아이콘 (L) */
.taunts button { font-weight: 900; }

/* 메인 메뉴 버튼: 세로 한 줄로 (위에서부터 오늘의 도전 · 연습 · 빠른 매칭 · 방 만들기 · 맵 에디터 · 방 코드 입장)
   로고 아래와 바닥의 캐릭터·이름표 사이에 들어가도록 높이를 맞춤 */
#menu .deck { grid-template-columns: 1fr; gap: 8px; padding: 12px; }
#menu .deck .dk, #menu .deck .dk-join input { height: 46px; }
#menu .deck .dk-join { grid-column: auto; }
#menu .deck .dk.editor { grid-column: auto; flex-direction: column; gap: 1px; }
#menu .deck .dk b { font-size: 17px; } #menu .deck .dk.quick b { font-size: 19px; }
#menu .deck .dk small { font-size: 10px; }
@media (max-width: 720px) {
  #menu .deck .dk, #menu .deck .dk-join input { height: 48px; }
}
@media (max-height: 640px) and (min-width: 721px) {
  .logo-keys { font-size: 26px; } .logo-run { font-size: 30px; -webkit-text-stroke-width: 5px; } .logo-sub { display: none; }
  #menu .deck { gap: 6px; padding: 10px; }
  #menu .deck .dk, #menu .deck .dk-join input { height: 40px; }
  #menu .deck .dk small { display: none; }
}

/* ---------- 맵 에디터 편의: 접기, 코드로 불러오기, 위·아래 두 줄 버튼, 끌기·줌 ---------- */
.ed-head { align-items: center; }
.ed-head .ed-len { margin-left: auto; }
.ed-fold { flex: none; padding: 4px 8px; font-size: 11px; }
.editor-panel.fold > :not(.ed-head) { display: none !important; }
.editor-panel.fold { overflow: visible; }
.ed-load { margin-top: 6px; }
.ed-load input { height: 34px; font-size: 13px; letter-spacing: 1px; }
.ed-load input::placeholder { letter-spacing: 0; text-transform: none; }
.ed-load .mini { flex: none; min-width: 72px; }
.ed-load .mini.danger { background: var(--bad); color: #fff; border-color: transparent; }
#game.editor-mode #cv { touch-action: none; cursor: crosshair; }
#editorBar { display: grid; grid-template-columns: 1fr 1fr .8fr 1fr 1fr; }
.editor-bar .move { font-weight: 900; }
.editor-bar .move.dn { background: #d9ecff; color: #0f2a4a; }
.editor-bar .move.two.dn { background: #cfe0ff; color: #0f2a4a; }
.editor-bar .move.del { font-size: 20px; }
.editor-bar .move:disabled { opacity: .35; }
@media (pointer: coarse) {
  #game .editor-bar { gap: 6px; padding-top: 10px; }
  .editor-bar .move { height: clamp(48px, 7.4vh, 72px); border-radius: 14px; font-size: 24px; box-shadow: 0 4px 0 rgba(0, 0, 0, .45); }
  .editor-bar .move.two { font-size: 18px; letter-spacing: -2px; }
  .editor-bar .move.dn { background: rgba(207, 224, 255, .92); }
  .editor-bar .move.two.dn { background: rgba(190, 212, 255, .92); }
  .editor-bar .move.del { font-size: 20px; }
}
@media (max-width: 520px) {
  .ed-keys { display: block; font-size: 10.5px; line-height: 1.5; }
  .ed-keys .kbd-only { display: none; }
}
.ed-head .ed-len { min-width: 0; flex-wrap: wrap; justify-content: flex-end; row-gap: 0; }
@media (max-width: 520px) { .editor-panel { max-height: 44%; } }

/* ---------- 공지: 로고 아래 띠 (첫 줄만 크게, 누르면 팝업) ---------- */
.notice-band {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; margin-top: 2px;
  max-width: min(600px, calc(100vw - 40px)); padding: 6px 15px 6px 8px; border-radius: 999px;
  border: 2px solid rgba(255, 207, 63, .75); background: rgba(21, 24, 38, .86); color: #fff;
  font-size: 15.5px; font-weight: 800; letter-spacing: -.2px; text-transform: none; backdrop-filter: blur(4px);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .3), 0 0 18px rgba(255, 207, 63, .18); cursor: pointer;
}
.notice-band b { flex: none; padding: 2px 9px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 900; }
.notice-band span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-band .nb-more { flex: none; font-style: normal; font-size: 12px; font-weight: 800; color: var(--accent); opacity: .85; }
.notice-band:hover { border-color: var(--accent); filter: brightness(1.1); }
#msgBody { white-space: pre-line; }
@media (max-width: 720px) {
  .notice-band { font-size: 14px; padding: 6px 12px 6px 7px; gap: 8px; } .notice-band b { font-size: 12px; } .notice-band .nb-more { display: none; }
  #menu.has-notice .name-btn { top: 176px; } /* 공지 띠가 로고 아래를 차지하면 닉네임 칩은 그 아래로 */
}
#menu.has-notice .logo-sub { display: none; }
@media (max-height: 640px) and (min-width: 721px) {
  .notice-band { padding: 5px 12px 5px 8px; font-size: 14px; margin-top: 2px; }
}

/* 공지 팝업: 넓고 큰 글씨, 마크다운 (길면 안에서 스크롤) */
.mcard.notice-card { width: min(600px, 100%); display: flex; flex-direction: column; max-height: calc(100dvh - 40px); }
.notice-card h2 { font-size: 24px; }
.nt-body { margin: 12px 0 14px; padding: 4px 4px 4px 2px; overflow-y: auto; min-height: 0; font-size: 16.5px; line-height: 1.65; color: #e9ecfa; }
/* 마크다운 글 (공지 팝업 · 관리자 미리 보기 공용 모양) */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7em; }
.md h3, .md h4, .md h5 { margin: .9em 0 .4em; line-height: 1.3; color: #fff; font-weight: 900; letter-spacing: -.3px; }
.md h3 { font-size: 1.45em; }
.md h4 { font-size: 1.25em; }
.md h5 { font-size: 1.08em; color: var(--accent); }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.35em; }
.md li { margin: .2em 0; }
.md li::marker { color: var(--accent); }
.md strong { color: #fff; font-weight: 900; }
.md em { font-style: italic; }
.md del { opacity: .55; }
.md code { padding: .08em .4em; border-radius: 6px; background: rgba(255, 255, 255, .1); font-size: .9em; font-family: ui-monospace, Menlo, Consolas, monospace; }
.md a { color: #7cc4ff; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.md blockquote { margin: 0 0 .7em; padding: .45em .9em; border-left: 4px solid var(--accent); background: rgba(255, 207, 63, .08); border-radius: 0 8px 8px 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
@media (max-width: 520px) { .notice-card h2 { font-size: 21px; } .nt-body { font-size: 15.5px; } }

/* ---------- 옵션 버튼 (메인 화면: 조작법 버튼 아래) · 옵션 창 · 핑 표시 ---------- */
.opt-btn { top: 64px; }
.opt-btn .gq { font-size: 15px; }
@media (max-width: 720px) { .opt-btn { top: 58px; } }
.opt-card { width: min(400px, 100%); }
.opt-list { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 4px; border-bottom: 1px solid rgba(52, 58, 92, .6); cursor: pointer; }
.opt-row:last-child { border-bottom: 0; }
.opt-row span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt-row b { font-size: 15px; font-weight: 800; }
.opt-row small { font-size: 12px; color: var(--muted); font-weight: 600; }
.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 48px; height: 28px; margin: 0; border-radius: 999px; background: var(--line); cursor: pointer; transition: background .15s; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .15s; }
.switch:checked { background: var(--good); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ping-tag { font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ping-tag::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; }
.ping-tag.good { color: var(--good); }
.ping-tag.ok { color: #ffcf3f; }
.ping-tag.bad { color: var(--bad); }

/* ---------- 메인 메뉴: 싱글 · 멀티 탭 ---------- */
#menu .deck .deck-tabs { grid-column: 1 / -1; flex: none; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(10, 12, 22, .55); }
#menu .deck .deck-tabs button { flex: 1; height: 36px; border-radius: 9px; font-size: 14px; font-weight: 900; border: 1px solid transparent; background: transparent; color: var(--muted); }
#menu .deck .deck-tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
#menu .deck .deck-pane { display: grid; grid-template-columns: 1fr; gap: inherit; grid-column: 1 / -1; }
#menu .deck .deck-pane[hidden] { display: none; }
.dk.season { --c: #ff4fa0; color: #fff; }
.dk.season small { opacity: .85; }
@media (max-height: 640px) and (min-width: 721px) { #menu .deck .deck-tabs button { height: 30px; font-size: 13px; } }

/* ---------- 시즌 도전 창 ---------- */
.season-card { width: min(600px, calc(100% - 24px)); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.season-card > * { flex: none; }
.ss-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ss-head select { max-width: 55%; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); padding: 0 8px; font-weight: 700; }
.ss-rules { margin: 10px 0 0; padding: 10px 12px 10px 28px; border-radius: 12px; background: rgba(255, 79, 160, .1); border: 1px solid rgba(255, 79, 160, .35); font-size: 12.5px; line-height: 1.7; }
.ss-rules b { color: #ff9fca; }
.ss-bhead { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; font-size: 13px; padding: 0 2px; }
.ss-bhead span { color: var(--muted); font-size: 12px; font-weight: 700; }
.ss-bhead .ss-pick { margin-left: auto; color: #c9b3ff; font-weight: 800; }
.ss-hint { margin: 2px 2px 6px; font-size: 12px; color: var(--muted); font-weight: 700; }
.season-card .ss-board { flex: 1 1 auto; min-height: 150px; max-height: none; }
#ssStart small { opacity: .8; }

/* ---------- 시즌 도전 타이머 막대 (경기 화면 위쪽 가운데) ---------- */
.season-bar { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 4; width: min(460px, calc(100% - 120px)); height: 22px; border-radius: 999px; background: rgba(10, 12, 22, .72); border: 1px solid rgba(255, 255, 255, .18); overflow: hidden; pointer-events: none; }
.season-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #29c78c, #6ee9b8); transition: width .08s linear; }
.season-bar i.warn { background: linear-gradient(90deg, #ffb02e, #ffd84a); }
.season-bar i.bad { background: linear-gradient(90deg, #ff4d6a, #ff8a9a); animation: ssblink .5s infinite alternate; }
@keyframes ssblink { from { opacity: 1; } to { opacity: .55; } }
.season-bar b { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); font-variant-numeric: tabular-nums; }
.season-bar small { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); font-variant-numeric: tabular-nums; }
#game.lobby-mode .season-bar, #game.editor-mode .season-bar { display: none; }
#game.season-mode:not(.season-ghosts) .ranks { display: none; } /* 시즌 도전: 고스트와 같이 달릴 때만 순위 목록 */
@media (max-width: 760px) { #game.season-mode .ranks { top: 40px; } } /* 좁은 화면: 가운데 타이머 막대 아래로 */
.ranks li.out { opacity: .45; } .ranks li.out .nm { text-decoration: line-through; }
.badge.out { background: #ff3b5c; color: #fff; }
.gv-big.season { color: #ff7fbd; }
.gv-big.fever { color: #ffc93a; }

/* 판 묶음은 위쪽(탭) 기준으로 고정: 탭을 바꿔 버튼 수가 달라져도 탭 위치는 그대로, 아래로만 늘거나 줄어든다.
   top = 51% - --dock-half. 절반 높이 = 묶음 높이의 절반 (PC: 싱글 판 284 + 간격 10 + 아래 줄 46 → 170, 휴대폰: 판 292 + 간격 8 + 줄 48 → 174) */
@media (max-height: 640px) and (min-width: 721px) {
  #menu { --dock-half: 146px; }                    /* 판 242 + 간격 10 + 줄 40 */
  #menu .menu-dock { top: calc(48% - var(--dock-half)); }
}
/* 낮은 휴대폰 (예: 375×667): 판·아래 줄을 조금 줄이고 가운데 위로 (캐릭터 이름표와 겹치지 않게) */
@media (max-width: 720px) and (max-height: 700px) {
  #menu { --dock-half: 158px; }                    /* 판 264 + 간격 8 + 줄 44 */
  #menu .menu-dock { top: calc(48% - var(--dock-half)); }
  #menu .deck { gap: 6px; }
  #menu .deck .dk, #menu .deck .dk-join input { height: 44px; }
  #menu .mr-btn { height: 44px; }
}

/* 메뉴 탭 전환 연출: 버튼이 위에서부터 차례로 떨어져 착착착 자리 잡음 (main.js setDeckTab) */
@keyframes deckDrop {
  0% { opacity: 0; transform: translateY(-22px) scaleY(.6); }
  55% { opacity: 1; transform: translateY(4px) scaleY(1.06); }
  80% { transform: translateY(-1px) scaleY(.98); }
  100% { opacity: 1; transform: none; }
}
#menu .deck .deck-pane > .drop-in { animation: deckDrop .3s cubic-bezier(.2, .8, .3, 1.2) both; transform-origin: 50% 0; }
/* 아주 낮은 화면에서는 판 안을 스크롤할 수 있게 두되 스크롤바는 그리지 않음 (탭 전환 연출 중 높이가 바뀔 때 스크롤바가 깜빡이지 않게) */
#menu .deck { overflow: hidden auto; scrollbar-width: none; }
#menu .deck::-webkit-scrollbar { display: none; }
#menu .deck.tab-anim { overflow: hidden; }

/* ---------- 메인 메뉴 아래 줄: 주크박스 · 꾸미기 (아이콘 + 글자, 판과 같은 폭을 반씩) ----------
   판의 싱글·멀티 버튼(색 덩어리)과 달리 어두운 유리 단추에 아이콘 원만 색을 입힘 */
#menu .menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#menu .mr-btn {
  position: relative; height: 46px; min-width: 0; padding: 0 10px; display: flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid var(--c-line); border-radius: 14px; background: rgba(15, 17, 30, .86); color: var(--text);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .42); transition: transform .05s, box-shadow .05s, filter .1s, border-color .1s;
}
#menu .mr-btn.jb { --c: #ff6fc0; --c-ink: #fff; --c-line: rgba(255, 111, 192, .5); --c-hi: #ff6fc0; }
#menu .mr-btn.cos { --c: #ffcf3f; --c-ink: #2a2100; --c-line: rgba(255, 207, 63, .5); --c-hi: #ffcf3f; }
#menu .mr-btn:hover { filter: brightness(1.2); border-color: var(--c-hi); }
#menu .mr-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .42); }
#menu .mr-btn b { font-size: 16px; font-weight: 900; letter-spacing: -.3px; white-space: nowrap; }
#menu .mr-ic {
  position: relative; flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--c); color: var(--c-ink); font-size: 16px; font-weight: 900; line-height: 1;
}
/* 꾸미기: 새 업적(아이템)이 있으면 아이콘 원 오른쪽 위에 빨간 점 (closet.js가 #btnCos에 has-new를 붙임) */
#btnCos.has-new .mr-ic::after { content: ""; position: absolute; right: -3px; top: -3px; width: 12px; height: 12px; border-radius: 50%; background: #ff4d6a; box-shadow: 0 0 0 2px #151826; }
@media (max-width: 720px) { #menu .mr-btn { height: 48px; } }
@media (max-height: 640px) and (min-width: 721px) { #menu .mr-btn { height: 40px; } #menu .mr-ic { width: 26px; height: 26px; font-size: 14px; } }

/* ---------- 지금 나오는 곡 (경기 화면 오른쪽 위 구석) ---------- */
.now-playing {
  position: absolute; right: 34px; top: 10px; z-index: 4; max-width: min(260px, 45%);
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  padding: 6px 12px 6px 7px; border-radius: 12px; background: rgba(10, 12, 22, .62); border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(3px); pointer-events: none; color: #fff;
}
.now-playing .np-disc { grid-row: 1 / 3; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle, #ffcf3f 0 22%, #111 23% 30%, #2a2a2a 31% 48%, #161616 49% 62%, #2a2a2a 63% 100%); animation: npSpin 2.4s linear infinite; }
.now-playing small { font-size: 8.5px; font-weight: 900; letter-spacing: 1.2px; color: #ffcf3f; line-height: 1.1; }
.now-playing b { font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.now-playing.pop { animation: npIn .5s cubic-bezier(.2, .8, .3, 1.3); }
@keyframes npSpin { to { transform: rotate(360deg); } }
@keyframes npIn { from { opacity: 0; transform: translateX(30px) scale(.9); } to { opacity: 1; transform: none; } }
#game.season-mode .now-playing { top: 40px; }
@media (max-width: 520px) { .now-playing { right: 8px; top: 8px; max-width: 52%; } #game.season-mode .now-playing { top: 38px; } }

/* ---------- 시즌 도전: 고스트 탈락 "OUT!" (화면 가운데 위) ---------- */
.out-fx { position: absolute; left: 50%; top: clamp(96px, 21%, 170px); /* 화면 밖 참가자 표시(위쪽)와 겹치지 않게 조금 아래 */ z-index: 6; transform: translateX(-50%); pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.out-pop { position: relative; display: flex; align-items: baseline; gap: 10px; padding: 8px 20px 9px; border-radius: 14px; white-space: nowrap;
  background: linear-gradient(180deg, rgba(40, 10, 24, .92), rgba(20, 6, 14, .92)); border: 2px solid #ff3b5c;
  box-shadow: 0 0 0 3px rgba(255, 59, 92, .25), 0 0 28px rgba(255, 59, 92, .55), 0 10px 24px rgba(0, 0, 0, .5);
  animation: outIn .5s cubic-bezier(.2, 1.6, .4, 1) both, outShake .32s .42s both, outGone .45s 2.2s ease-in forwards; }
.out-pop .who { font-size: 18px; font-weight: 900; color: #fff; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; }
.out-pop .who::before { content: '👻 '; }
.out-pop b { font-size: 30px; font-weight: 1000; font-style: italic; letter-spacing: 1px; line-height: 1;
  background: linear-gradient(180deg, #fff 0%, #ffd23f 45%, #ff3b5c 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #5b0016) drop-shadow(0 0 10px rgba(255, 80, 100, .8)); }
.out-pop small { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); font-size: 11px; font-weight: 800; color: #ffe08a; text-shadow: 0 1px 3px #000; white-space: nowrap; animation: outSub .4s .5s both; }
.out-pop::after { content: ''; position: absolute; inset: -6px; border-radius: 18px; border: 2px solid #ffd23f; opacity: 0; animation: outRing .6s .05s ease-out; }
@keyframes outIn { 0% { opacity: 0; transform: scale(2.4) rotate(-6deg); } 60% { opacity: 1; transform: scale(.92) rotate(1deg); } 100% { opacity: 1; transform: none; } }
@keyframes outShake { 0%, 100% { translate: 0; } 20% { translate: -6px 0; } 40% { translate: 5px 0; } 60% { translate: -3px 0; } 80% { translate: 2px 0; } }
@keyframes outGone { to { opacity: 0; transform: translateY(-14px) scale(.9); } }
@keyframes outRing { 0% { opacity: .9; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.35); } }
@keyframes outSub { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (max-width: 520px) { .out-fx { top: 36%; } /* 순위 목록·화면 밖 표시 아래 */ .out-pop { padding: 6px 14px 7px; gap: 8px; } .out-pop .who { font-size: 15px; } .out-pop b { font-size: 24px; } }
@media (prefers-reduced-motion: reduce) { .out-pop { animation: outGone .45s 2.2s ease-in forwards; } .out-pop::after { animation: none; } }

/* 시즌 창: 고스트 고르기 */

/* ---------- 모드 규칙 안내 팝업 (시즌 도전 · 오늘의 도전) ---------- */
.help-card { width: min(460px, calc(100% - 24px)); }
.help-card .hp-top { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.help-card .hp-top h2 { margin: 0; }
.help-card .hp-top .msub { margin: 2px 0 0; }
.hp-icon { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: var(--hp-c, #ff4fa0); box-shadow: 0 4px 0 rgba(0, 0, 0, .35), inset 0 -3px 0 rgba(0, 0, 0, .18); }
.help-card.season { --hp-c: #ff4fa0; } .help-card.daily { --hp-c: #3e9bff; }
.hp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: min(52vh, 420px); overflow-y: auto; }
.hp-list li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border-radius: 12px; background: rgba(15, 17, 30, .55); border: 1px solid rgba(255, 255, 255, .06); animation: hpIn .32s cubic-bezier(.2, .9, .3, 1.2) both; }
.hp-list li > i { flex: none; width: 26px; text-align: center; font-style: normal; font-size: 18px; line-height: 1.3; }
.hp-list li b { display: block; font-size: 14px; margin-bottom: 1px; }
.hp-list li span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.hp-list li span em { font-style: normal; color: var(--text); font-weight: 800; }
@keyframes hpIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hp-skip { display: flex; align-items: center; gap: 7px; margin: 12px 2px 2px; font-size: 13px; font-weight: 700; cursor: pointer; flex-wrap: wrap; }
.hp-skip input { width: 18px; height: 18px; accent-color: var(--accent); }
.hp-skip small { color: var(--muted); font-weight: 600; font-size: 11px; }
.help-card .mactions .dk { background: var(--hp-c); color: #fff; }
.help-q { width: 26px; height: 26px; padding: 0; border-radius: 50%; font-weight: 900; flex: none; }
.room-kind .help-q { width: 22px; height: 22px; font-size: 12px; margin-left: 4px; vertical-align: 1px; }
@media (prefers-reduced-motion: reduce) { .hp-list li { animation: none; } }

/* ---------- 맵 고르기: 모든 맵 / 내 맵 ---------- */
.mp-tabs { display: flex; gap: 4px; padding: 3px; margin: 10px 0 6px; border-radius: 10px; background: rgba(10, 12, 22, .55); }
.mp-tabs button { flex: 1; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 900; font-size: 13px; cursor: pointer; }
.mp-tabs button small { font-weight: 700; opacity: .8; }
.mp-tabs button.on { background: var(--accent); color: var(--accent-ink); }
#mpQ { width: 100%; height: 36px; margin-bottom: 6px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text); padding: 0 10px; font-weight: 700; }
#mpQ:focus { outline: none; border-color: var(--accent); }
#mpAll { max-height: min(300px, 38vh); }
.map-list .mi small i { font-style: normal; color: var(--text); opacity: .85; }
.map-list li.more { justify-content: center; padding: 6px; }
.map-list li.more button { width: 100%; }
.ss-head h2 { flex: 1; min-width: 0; }
/* 좁은 화면: 시즌 고르기는 제목 아래 줄 전체, ? 버튼은 제목 옆에 */
@media (max-width: 520px) {
  .ss-head { flex-wrap: wrap; }
  .ss-head h2 { flex: 1 1 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ss-head #ssHelp { order: 2; }
  .ss-head select { order: 3; flex: 1 1 100%; max-width: none; height: 36px; }
}
/* 팝업 카드가 내용(긴 이름 등) 때문에 화면보다 넓어지지 않게: 격자 칸을 화면 폭 안으로 */
.modal { grid-template-columns: minmax(0, 1fr); }
.map-list .mi { min-width: 0; flex: 1; }
.map-list .mi small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-list { max-height: min(60vh, 470px); }
.hp-list li { padding: 8px 11px; }

/* 연습: 맵 고르기 버튼 (자동 생성 / 커스텀 맵) */
.pd-map { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text); text-align: left; cursor: pointer; }
.pd-map:hover, .pd-map:focus-visible { border-color: var(--accent); }
.pd-map b { font-size: 14px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-map small { color: var(--muted); font-size: 11px; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-map.custom { border-color: rgba(164, 107, 255, .8); background: rgba(164, 107, 255, .14); }

/* ---------- 타이틀 화면: 채널 칩 · 채널 창 (같은 채널에 있는 유저들) ---------- */
.chan-btn { right: auto; left: 16px; top: 104px; }
#btnFull[hidden] ~ .chan-btn { top: 60px; }
.chan-btn[aria-expanded="true"] { filter: brightness(1.25); }
.chan-pop {
  position: absolute; left: 16px; top: 150px; z-index: 4; width: min(300px, calc(100% - 32px)); max-height: calc(100% - 174px); overflow: auto;
  background: rgba(15, 17, 30, .96); border: 1px solid var(--line); border-radius: 16px; padding: 12px 12px 10px; box-shadow: 0 14px 40px rgba(0, 0, 0, .45); color: var(--text);
}
.chan-head { display: flex; align-items: center; justify-content: space-between; }
.chan-head b { font-size: 15px; font-weight: 900; }
.chan-x { all: unset; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; text-align: center; line-height: 28px; font-size: 14px; color: var(--muted); }
.chan-x:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.chan-note { margin: 2px 0 8px; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.chan-list, .chan-who { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.chan-list button {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--bg2); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 8px 10px; color: var(--text); font-weight: 800; font-size: 13px; transition: border-color .1s;
}
.chan-list button:hover:not(:disabled) { border-color: #4b5385; }
.chan-list button.on { border-color: var(--accent); color: var(--accent); }
.chan-list button:disabled { opacity: .45; cursor: default; }
.chan-list small { font-size: 11px; color: var(--muted); font-weight: 700; }
.chan-list .tag { font-size: 10px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 6px; font-weight: 900; }
.chan-sub { margin: 12px 0 6px; font-size: 12px; color: var(--muted); font-weight: 800; }
.chan-who li { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; padding: 3px 2px; min-width: 0; }
.chan-who .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.chan-who .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-who .st { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.chan-who .me { font-size: 10px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 6px; font-weight: 900; flex: none; }
/* 좁은 화면: 로고(RUNNER) 왼쪽 아래 빈 자리에 두 줄로 작게 (전체 화면 버튼 아래) */
@media (max-width: 720px) {
  .chan-btn { left: 10px; top: 66px; padding: 6px 10px; gap: 0; display: block; text-align: left; white-space: nowrap; }
  #btnFull[hidden] ~ .chan-btn { top: 12px; }
  .chan-btn .cl-w { display: none; }
  .chan-btn .cl-a::before { content: '#'; }
  .chan-btn .gq { display: none; }
  .chan-btn b { display: block; font-size: 12px; line-height: 1.25; }
  .chan-btn .cl-b { display: inline; font-size: 10.5px; color: var(--muted); }
  .chan-pop { left: 10px; top: 112px; width: min(300px, calc(100% - 20px)); max-height: calc(100% - 132px); }
}

/* ---------- 광고 자리 · 개인정보처리방침 링크 (ads.js가 넣고, 설정이 없으면 hidden으로 자리를 차지하지 않음) ---------- */
/* 배너 상자는 광고가 채워지기 전에도 같은 높이를 유지한다 (화면이 흔들리지 않게). 광고 단위가 없으면 hidden. */
.ad-slot { position: relative; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 90px; margin: 0 auto; width: min(728px, 100%); overflow: hidden; color: var(--muted); }
.ad-slot > ins { width: 100%; max-width: 728px; }
.ad-slot .ad-tag { position: absolute; left: 4px; top: 2px; z-index: 1; font-size: 10px; font-weight: 700; letter-spacing: .5px; color: var(--muted); opacity: .8; pointer-events: none; }
/* 메인 메뉴: 타이틀 화면(게임 속 세계)의 맨 아래 띠. 배너가 있을 때만 타이틀 화면이 그만큼 줄고 바닥·캐릭터도 위로 올라간다 */
#menu { --menu-ad-h: 0px; }
#menu:has(.ad-menu:not([hidden])) { --menu-ad-h: 96px; }
#menu .title-stage { inset: 0 0 var(--menu-ad-h) 0; }
#menu:has(.ad-menu:not([hidden])) .menu-dock { margin-top: calc(var(--menu-ad-h) * -0.5); } /* 메뉴 판은 줄어든 타이틀 화면의 가운데에 (캐릭터 이름표와 겹치지 않게) */
/* 배너가 켜진 메뉴: 판 묶음을 줄여 배너 위 빈 곳에 맞춤 (짧은 화면은 로고 글 숨김, 판·아래 줄 낮춤) */
@media (min-width: 721px) and (max-height: 800px) {
  #menu:has(.ad-menu:not([hidden])) { --dock-half: 145px; }
  #menu:has(.ad-menu:not([hidden])) .menu-dock { top: calc(51% - var(--dock-half)); }
  #menu:has(.ad-menu:not([hidden])) .logo-sub { display: none; }
  #menu:has(.ad-menu:not([hidden])) .menu-dock { gap: 8px; }
  #menu:has(.ad-menu:not([hidden])) .deck { gap: 6px; padding: 10px; }
  #menu:has(.ad-menu:not([hidden])) .deck .deck-tabs button { height: 30px; font-size: 13px; }
  #menu:has(.ad-menu:not([hidden])) .deck .dk, #menu:has(.ad-menu:not([hidden])) .deck .dk-join input { height: 40px; }
  #menu:has(.ad-menu:not([hidden])) .mr-btn { height: 40px; }
  #menu:has(.ad-menu:not([hidden])) .mr-ic { width: 26px; height: 26px; font-size: 14px; }
}
@media (max-width: 720px) {
  #menu:has(.ad-menu:not([hidden])) { --dock-half: 162px; }
  #menu:has(.ad-menu:not([hidden])) .menu-dock { top: calc(49% - var(--dock-half)); gap: 8px; }
  #menu:has(.ad-menu:not([hidden])) .deck { gap: 7px; }
  #menu:has(.ad-menu:not([hidden])) .deck .dk, #menu:has(.ad-menu:not([hidden])) .deck .dk-join input { height: 44px; }
  #menu:has(.ad-menu:not([hidden])) .mr-btn { height: 44px; }
}
@media (max-width: 720px) and (max-height: 700px) {
  #menu:has(.ad-menu:not([hidden])) { --dock-half: 148px; }
  #menu:has(.ad-menu:not([hidden])) .logo-sub { display: none; }
  #menu:has(.ad-menu:not([hidden])) .menu-dock { top: calc(47% - var(--dock-half)); }
  #menu:has(.ad-menu:not([hidden])) .deck .dk, #menu:has(.ad-menu:not([hidden])) .deck .dk-join input { height: 40px; }
  #menu:has(.ad-menu:not([hidden])) .mr-btn { height: 40px; }
}
#menu .ad-menu { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; width: auto; height: var(--menu-ad-h); min-height: 0; margin: 0; padding: 4px 8px; background: var(--bg2); border-top: 1px solid var(--line); }
/* 로비·시즌 창·결과창: 버튼과 12px 이상 띄우고 구분선 (오클릭 방지) */
.ad-lobby, .ad-season, .ad-results { flex: none; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); min-height: 100px; width: 100%; }
.ad-results { margin-top: 16px; min-height: 100px; }
@media (max-width: 720px) { #menu:has(.ad-menu:not([hidden])) { --menu-ad-h: 66px; } .ad-slot { min-height: 60px; } .ad-lobby, .ad-season, .ad-results { min-height: 90px; } }

/* 메인 메뉴의 개인정보처리방침 링크: 게임 속 세계 오른쪽 아래 (버전 표시는 왼쪽 아래) */
.privacy-link { position: absolute; right: 12px; bottom: 10px; z-index: 2; font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .8); background: rgba(15, 17, 30, .6); border-radius: 999px; padding: 4px 10px; text-decoration: none; }
.privacy-link:hover, .privacy-link:focus-visible { color: #fff; border-color: var(--accent); }
.opt-foot { margin: 12px 0 0; text-align: center; font-size: 12px; }
.opt-foot a { color: var(--muted); font-weight: 700; }

/* ---------- 꾸미기 (꾸미기 창 · 업적 달성 알림; 메인 메뉴 단추는 위 '메인 메뉴 아래 줄') ---------- */
.cos-card { width: min(580px, 100%); max-height: calc(100dvh - 24px); overflow-y: auto; }
.cos-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cos-worn { font-size: 12px; color: var(--muted); font-weight: 700; }
.cos-main { display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr); gap: 14px; margin-top: 12px; }
.cos-stage { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#cosCv { display: block; width: 100%; height: 280px; border-radius: 12px; background: radial-gradient(ellipse at 50% 85%, #2b3566 0%, #1b2040 60%, #14172b 100%); border: 1px solid var(--line); }
.cos-acts { display: flex; gap: 6px; }
.cos-acts .mini { flex: 1; padding: 7px 4px; }
.cos-side { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cos-tabs { flex: none; }                    /* .seg의 flex:1이 열 안에서 탭을 늘리지 않게 (아이템이 적은 탭에서 키가 커지던 것) */
.cos-tabs button { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.cos-tabs button small { font-size: 10px; color: var(--muted); font-weight: 800; min-height: 1em; }
.cos-tabs button.on small { color: var(--accent); }
.cos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; padding: 2px; }
.cos-cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; padding: 8px 6px 7px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-align: center; }
.cos-cell:hover { border-color: #4b5385; }
.cos-cell.on { border-color: var(--accent); background: rgba(255, 207, 63, .12); box-shadow: inset 0 0 0 1px var(--accent); }
.cos-cell b { font-size: 12px; font-weight: 800; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cos-cell small { font-size: 10px; color: var(--muted); font-weight: 700; line-height: 1.3; min-height: 2.6em; }
.cos-cell.on small { color: var(--accent); }
.cc-img { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 10px; background: repeating-conic-gradient(#2a3050 0 25%, #1f2440 0 50%) 50% / 12px 12px; }
.cc-img img { width: 100%; height: 100%; object-fit: contain; }
.cc-img .jm-thumb { width: 100%; height: 100%; display: block; }
.cos-grid.jump-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cos-grid.jump-grid .cc-img { width: 100%; height: 76px; }
.cos-cell.none .cc-none { font-style: normal; font-size: 24px; font-weight: 900; color: var(--muted); }
.cos-cell.locked b { opacity: .78; }                    /* 잠긴 아이템도 그림은 제 색으로 (보려고 고르는 것이라) */
.cos-cell.locked small { color: #7d85ad; }
.cos-cell.try { border-style: dashed; border-color: #6fb4ff; background: rgba(111, 180, 255, .1); box-shadow: none; }
.cos-cell.try:hover { border-color: #9ccbff; }
.cos-cell.try small { color: #8cc8ff; }
.cos-try { font-size: 12px; line-height: 1.4; color: var(--text); background: rgba(111, 180, 255, .1); border: 1px dashed #6fb4ff; border-radius: 10px; padding: 7px 9px; }
.cos-try p { margin: 0; font-weight: 700; }
.cos-try p + p { margin-top: 3px; }
.cos-try b { color: #8cc8ff; }
.cos-try small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); font-weight: 600; }
.cc-lock { position: absolute; top: 5px; right: 6px; font-size: 13px; }
.cc-new { position: absolute; top: 5px; left: 5px; background: #ff4d6a; color: #fff; font-size: 9px; font-weight: 900; border-radius: 6px; padding: 1px 4px; }
.cc-prog { font-size: 10px; font-weight: 800; color: var(--accent); }
.cc-bar, .ca-bar { display: block; width: 100%; height: 5px; background: rgba(255, 255, 255, .1); border-radius: 3px; overflow: hidden; }
.cc-bar i, .ca-bar i { display: block; height: 100%; background: var(--accent); }
.cos-hint { margin: 0; min-height: 1.4em; font-size: 12px; color: var(--muted); font-weight: 700; }
.cos-ach { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.cos-sec { font-size: 14px; font-weight: 900; margin-bottom: 6px; }
.cos-achlist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.cos-achlist li { min-width: 0; background: var(--bg2); border: 1px solid transparent; border-radius: 10px; padding: 7px 9px; }
.cos-achlist li.done { border-color: rgba(46, 229, 157, .5); }
.ca-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 13px; font-weight: 800; }
.ca-top b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-val { font-size: 12px; font-weight: 900; color: var(--accent); white-space: nowrap; }
.cos-achlist li.done .ca-val { color: var(--good); }
.cos-achlist li.done .ca-bar i { background: var(--good); }
.cos-achlist small { display: block; margin: 2px 0 5px; font-size: 11px; color: var(--muted); font-weight: 600; line-height: 1.35; }
@media (max-width: 720px) {
  .cos-card { padding: 14px 12px 12px; }
  .cos-main { grid-template-columns: 1fr; gap: 10px; }
  #cosCv { height: 260px; }
  .cos-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cos-cell { padding: 7px 4px 6px; }
  .cc-img { width: 56px; height: 56px; }
  .cos-achlist { grid-template-columns: 1fr; }
}
.ach-toast { position: fixed; left: 50%; top: 14px; transform: translate(-50%, -16px); z-index: 30; display: flex; align-items: center; gap: 10px; width: min(440px, calc(100% - 24px)); padding: 10px 12px; background: #fff6d6; color: #2a2100; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); opacity: 0; transition: opacity .25s, transform .25s; cursor: pointer; }
.ach-toast.show { opacity: 1; transform: translate(-50%, 0); }
.at-ic { font-size: 26px; line-height: 1; }
.at-tx { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.at-tx small { font-size: 11px; font-weight: 800; color: #8a6a00; }
.at-tx b { font-size: 16px; font-weight: 900; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-sub { font-size: 12px; font-weight: 700; color: #5a4a10; }
.at-img { width: 52px; height: 52px; flex: none; object-fit: contain; border-radius: 10px; background: #2a3050; }

/* ===== 단계 B: 메뉴 접기 · 모바일 조작키 · 바로 시작 존 · 일시정지 ===== */
/* 메뉴 접기: 좌우로 움직이면 판(카드 · 주크박스 · 꾸미기)이 아래로 내려가 접히고, 손잡이만 남는다 */
#menu .menu-dock { transition: transform .25s ease, visibility 0s; }
#menu.folded .menu-dock { transform: translate(-50%, 120vh); visibility: hidden; pointer-events: none; transition: transform .25s ease, visibility 0s linear .25s; }
.menu-handle {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 3;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .32);
  background: rgba(12, 14, 26, .82); color: #fff; font: 900 14px/1 system-ui, sans-serif; letter-spacing: .02em;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35); cursor: pointer; touch-action: manipulation;
  animation: handleIn .25s ease both;
}
.menu-handle:hover, .menu-handle:focus-visible { border-color: #ffd84a; outline: none; }
@keyframes handleIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* 터치 기기 조작키: 엄지로 누르기 좋은 크기(56px 이상), 반투명. 메뉴가 펼쳐져 있으면 흐리게 */
.mob-ctl { position: absolute; left: 0; right: 0; bottom: 0; height: 0; z-index: 4; pointer-events: none; }
.mc {
  pointer-events: auto; position: absolute; bottom: 40px; width: 60px; height: 56px; border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .3); background: rgba(12, 14, 26, .52); color: #fff;
  font: 900 20px/1 system-ui, sans-serif; display: grid; place-items: center;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3); transition: opacity .2s ease;
}
.mc:active, .mc.down { background: rgba(255, 255, 255, .22); }
.mc-l { left: 14px; }
.mc-r { left: 80px; }
.mc-j { right: 78px; width: 72px; font-size: 15px; background: rgba(41, 199, 140, .55); border-color: rgba(41, 199, 140, .9); }
.mc-e { right: 14px; width: 56px; font-size: 22px; }
#menu:not(.folded) .mc { opacity: .5; }
.mc-taunts {
  position: absolute; right: 12px; bottom: 106px; max-width: 280px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px;
  padding: 8px; border-radius: 14px; background: rgba(12, 14, 26, .88); border: 1px solid rgba(255, 255, 255, .2); pointer-events: auto;
}
.mc-taunts button {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08);
  color: #fff; font-size: 20px; display: grid; place-items: center; touch-action: manipulation;
}
.mc-taunts button:active { background: rgba(255, 255, 255, .25); }

/* 바로 시작 존 안내: 내 캐릭터 위 말풍선 (위치는 main.js가 맞춤) */
.zone-hint {
  position: absolute; left: 0; top: 0; z-index: 3; padding: 7px 13px; border-radius: 999px;
  background: #ffd84a; color: #2a2100; font: 900 13px/1 system-ui, sans-serif; white-space: nowrap;
  pointer-events: none; animation: zonePulse 1.2s ease-in-out infinite;
}
@keyframes zonePulse { 50% { box-shadow: 0 0 0 6px rgba(255, 216, 74, .25), 0 6px 16px rgba(0, 0, 0, .35); } }

/* 일시정지: 경기 화면을 흐리게 가린다 (시계는 main.js가 멈춘다) */
#game #stage { transition: filter .2s ease; }
#game.paused #stage { filter: blur(7px) brightness(.5); }
.pause-card h2, .pause-card .msub { text-align: center; }
.pause-acts { flex-direction: column; gap: 10px; }
.pause-acts .dk { flex: none; height: 50px; }
.dk.sec { --c: #3d4a86; color: #fff; box-shadow: 0 5px 0 rgba(0, 0, 0, .42); } /* 계속하기: 보조 버튼 (밝은 회색 아님) */
.dk.sec b { color: #fff; }
.pause-keys { margin: 14px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
/* 메뉴 접기: 광고 배너 자리도 판과 함께 아래로 내려간다 */
#menu .ad-menu { transition: transform .25s ease, visibility 0s; }
#menu.folded .ad-menu { transform: translateY(120%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }

/* ---------- 결과창: 내 최고 기록의 순위 + 주변 5명 (오늘의 도전 · 시즌) ---------- */
.rr { margin: 12px 0 0; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.rr-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rr-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rr-head small { color: var(--muted); font-size: 11px; font-weight: 800; }
.rr-head span { font-size: 14px; font-weight: 800; color: #e3e6f6; white-space: nowrap; }
.rr-head span b { font-size: 22px; font-weight: 900; font-style: italic; color: #ffd84a; margin-right: 2px; }
.rr-up { display: inline-block; padding: 3px 9px; border-radius: 999px; background: rgba(46, 229, 157, .14); border: 1px solid rgba(46, 229, 157, .4); color: #6ff0be; font-size: 12px; font-weight: 900; white-space: nowrap; }
/* 줄은 한 줄(26px): 배지 · 이름(+나) · 보조 글 · 기록. 상위 10줄 + 구분 + 내 줄(12줄)이 PC 720px · 휴대폰 844px 안에 들도록 낮춤 */
.rr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rr-list .sl { display: flex; align-items: center; gap: 8px; min-height: 0; height: 26px; padding: 0 10px 0 4px; border-radius: 8px; }
/* 등수 배지: 세 자리 이상(151위, 1,234위)도 들어가게 옆으로 늘어나는 알약 모양 */
.rr-list .sl-rk { width: auto; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 999px; font-size: 11px; flex: none; }
/* 상위 줄과 내 줄 사이 구분 (⋯): 줄 배경 없이 흐리게 */
.rr-gap { height: 10px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; line-height: 12px; }
.rr-nm { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-nm .badge { margin-left: 4px; vertical-align: 1px; }
.rr-sub { flex: none; color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rr-val { flex: none; font-size: 15px; font-weight: 900; color: #fff; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rr-val small { margin-left: 2px; font-size: 11px; font-weight: 800; color: var(--muted); }
@media (max-width: 520px) { .rr { padding: 8px; } .rr-head span b { font-size: 19px; } .rr-list { gap: 3px; } .rr-list .sl { height: 26px; padding: 0 8px 0 4px; gap: 6px; } .rr-list .sl-rk { min-width: 20px; height: 20px; font-size: 10.5px; } .rr-sub { font-size: 10.5px; } }

/* ---------- 지난 도전 최종 등수 팝업 (1·2·3위 특별 연출) ---------- */
.final-modal { z-index: 60; }
.fr-card {
  position: relative; overflow: hidden; width: min(340px, 100%); padding: 20px 20px 18px; text-align: center;
  border-radius: 22px; border: 1px solid var(--line);
  background: radial-gradient(120% 80% at 50% 0%, #2c3257, #1a1e36 70%);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .55);
  animation: frIn .5s cubic-bezier(.2, 1.25, .4, 1) both;
}
.fr-card > *:not(.fr-fx) { position: relative; z-index: 1; }
.fr-card h2 { margin: 6px 0 2px; font-size: 21px; font-weight: 900; letter-spacing: -.4px; }
.fr-card.r1 {
  background: radial-gradient(120% 90% at 50% 0%, #56431a, #1f1b2e 62%);
  border-color: #f5d35a;
  animation: frIn .5s cubic-bezier(.2, 1.25, .4, 1) both, frGlow 2.6s ease-in-out .5s infinite;
}
.fr-card.r2 { background: radial-gradient(120% 90% at 50% 0%, #3d4560, #1b1f33 65%); border-color: #cfd5e6; box-shadow: 0 0 34px rgba(200, 210, 235, .22), 0 22px 60px rgba(0, 0, 0, .55); }
.fr-card.r3 { background: radial-gradient(120% 90% at 50% 0%, #4d3320, #1c1a2a 65%); border-color: #e7a771; box-shadow: 0 0 34px rgba(231, 167, 113, .22), 0 22px 60px rgba(0, 0, 0, .55); }
.fr-badge { padding-top: 12px; }
.fr-crown { display: block; width: 66px; height: auto; margin: 0 auto -20px; position: relative; z-index: 2; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .45)); animation: frBob 2.4s ease-in-out infinite; }
.fr-medal { position: relative; width: 118px; height: 138px; margin: 0 auto; animation: frMedalIn .9s cubic-bezier(.2, 1.5, .4, 1) .08s both; }
.fr-medal svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .4)); }
.fr-medal.g svg { filter: drop-shadow(0 0 18px rgba(255, 210, 60, .6)) drop-shadow(0 6px 10px rgba(0, 0, 0, .4)); }
.fr-mt { font: 900 34px/1 "Pretendard", "Apple SD Gothic Neo", system-ui, sans-serif; fill: #3b2a00; }
.fr-medal.s .fr-mt { fill: #22273a; }
.fr-medal.b .fr-mt { fill: #3a1f08; }
/* 메달 위로 지나가는 빛 */
.fr-shine { position: absolute; left: 8%; top: 32%; width: 84%; height: 65%; border-radius: 50%; overflow: hidden; pointer-events: none; }
.fr-shine::after { content: ''; position: absolute; top: -30%; bottom: -30%; left: -60%; width: 38%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .85), transparent); transform: skewX(-18deg); animation: frShine 3.6s ease-in-out 1.2s infinite; }
.fr-num { width: 84px; height: 84px; margin: 8px auto 0; border-radius: 50%; display: grid; place-items: center; font-size: 38px; font-weight: 900; color: #e6e9ff; background: radial-gradient(circle at 35% 30%, #4a5278, #2c3352); border: 2px solid #3c4470; }
.fr-cheer { margin: 6px 0 0; min-height: 1em; font-size: 13px; font-weight: 900; letter-spacing: .3px; color: #ffe27a; }
.r2 .fr-cheer { color: #e4e9f7; }
.r3 .fr-cheer { color: #ffc08a; }
.fr-date { margin: 0; color: var(--muted); font-size: 12px; font-weight: 800; }
.fr-rank { display: flex; align-items: baseline; justify-content: center; gap: 6px; margin-top: 8px; }
.fr-rank b { font-size: 54px; font-weight: 900; font-style: italic; line-height: 1; letter-spacing: -2px; background: linear-gradient(180deg, #fff6c2, #ffd84a 55%, #d89a1a); -webkit-background-clip: text; background-clip: text; color: transparent; animation: frCount .6s cubic-bezier(.2, 1.4, .4, 1) .35s both; }
.r2 .fr-rank b { background: linear-gradient(180deg, #ffffff, #cfd5e6 55%, #8f97b0); -webkit-background-clip: text; background-clip: text; }
.r3 .fr-rank b { background: linear-gradient(180deg, #ffe0bd, #d9894a 55%, #9a5224); -webkit-background-clip: text; background-clip: text; }
.plain .fr-rank b { background: none; -webkit-text-fill-color: #eef0fa; color: #eef0fa; }
.fr-rank span { color: var(--muted); font-size: 15px; font-weight: 800; }
.fr-pct { display: inline-block; margin: 6px 0 0; padding: 3px 11px; border-radius: 999px; background: rgba(255, 255, 255, .08); font-size: 12px; font-weight: 900; color: #cfd6ff; }
.fr-pct:empty { display: none; }
.fr-mine { margin: 10px 0 0; font-size: 13px; font-weight: 800; color: #e3e6f6; }
.fr-acts { display: flex; gap: 8px; margin-top: 16px; }
.fr-acts .dk { flex: 1 1 0; min-width: 0; }
/* 효과 층 (카드 안, 글자 아래) */
.fr-fx { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.fr-rays { position: absolute; left: 50%; top: 124px; width: 560px; height: 560px; margin: -280px 0 0 -280px; background: repeating-conic-gradient(from 0deg, rgba(255, 226, 120, .22) 0deg 6deg, transparent 6deg 20deg); -webkit-mask: radial-gradient(circle, #000 6%, transparent 60%); mask: radial-gradient(circle, #000 6%, transparent 60%); animation: frSpin 16s linear infinite; }
.r2 .fr-rays { background: repeating-conic-gradient(from 0deg, rgba(220, 230, 255, .16) 0deg 6deg, transparent 6deg 20deg); }
.r3 .fr-rays { background: repeating-conic-gradient(from 0deg, rgba(240, 180, 120, .17) 0deg 6deg, transparent 6deg 20deg); }
.fr-sp { position: absolute; width: var(--sz); height: var(--sz); background: var(--c); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: 0; filter: drop-shadow(0 0 6px var(--c)); animation: frTwinkle 2.4s ease-in-out var(--d) infinite; }
.fr-cf { position: absolute; width: var(--w); height: calc(var(--w) * 1.6); background: var(--c); border-radius: 2px; opacity: 0; animation: frBurst var(--t) cubic-bezier(.2, .7, .3, 1) var(--d) both; }
.fr-cf.round { height: var(--w); border-radius: 50%; }
@keyframes frIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes frMedalIn { 0% { opacity: 0; transform: scale(.2) rotate(-200deg); } 70% { opacity: 1; transform: scale(1.08) rotate(8deg); } 100% { opacity: 1; transform: none; } }
@keyframes frCount { from { opacity: 0; transform: scale(.4); } }
@keyframes frGlow { 0%, 100% { box-shadow: 0 0 0 1px rgba(255, 216, 74, .5), 0 0 30px rgba(255, 200, 60, .28), 0 22px 60px rgba(0, 0, 0, .55); } 50% { box-shadow: 0 0 0 1px rgba(255, 236, 150, .9), 0 0 64px rgba(255, 220, 90, .55), 0 22px 60px rgba(0, 0, 0, .55); } }
@keyframes frSpin { to { transform: rotate(360deg); } }
@keyframes frBob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-4px) rotate(3deg); } }
@keyframes frShine { 0%, 40% { left: -60%; } 100% { left: 130%; } }
@keyframes frTwinkle { 0%, 100% { opacity: 0; transform: scale(.2) rotate(0deg); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
@keyframes frBurst {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  8% { opacity: 1; }
  34% { transform: translate(var(--ux), var(--uy)) rotate(calc(var(--rot) * .5)); opacity: 1; }
  100% { transform: translate(var(--fx), var(--fy)) rotate(var(--rot)); opacity: 0; }
}
@media (max-width: 520px) {
  .fr-card { padding: 16px 14px 14px; }
  .fr-medal { width: 98px; height: 116px; }
  .fr-crown { width: 56px; }
  .fr-rank b { font-size: 46px; }
  .fr-num { width: 72px; height: 72px; font-size: 32px; }
  .fr-rays { top: 112px; width: 460px; height: 460px; margin: -230px 0 0 -230px; }
}
@media (prefers-reduced-motion: reduce) {
  .fr-card, .fr-card.r1, .fr-medal, .fr-crown, .fr-rank b, .fr-rays, .fr-sp, .fr-shine::after { animation: none !important; }
  .fr-cf, .fr-sp { display: none; }
}

/* ---------- 닉네임 창 (처음 입장 · 이름 바꾸기) ---------- */
.nick-card { width: min(380px, 100%); position: relative; }
.nick-card h2 { padding-right: 34px; }
.nk-x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08); color: var(--muted); font-size: 14px; }
.nk-x:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.nk-x[hidden] { display: none; }
.nk-prev { display: flex; align-items: center; gap: 7px; width: max-content; max-width: 100%; margin: 14px auto 0; padding: 5px 16px 5px 5px; background: rgba(12, 14, 26, .88); border: 2px solid var(--accent); border-radius: 999px; }
.nk-prev .np-me { flex: none; }
.nk-prev .np-name { font-size: 17px; }
.nk-prev .np-name:empty::before { content: "이름을 입력해요"; }
.nk-form { display: grid; gap: 10px; margin-top: 14px; }
.nk-row { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 8px; }
.nk-lab { color: var(--muted); font-size: 13px; font-weight: 800; }
.nk-box { display: flex; align-items: center; gap: 6px; height: 50px; padding: 0 6px 0 12px; background: #10121e; border: 2px solid var(--line); border-radius: 12px; box-shadow: inset 0 3px 0 rgba(0, 0, 0, .35); min-width: 0; }
.nk-box:focus-within { border-color: var(--accent); }
.nk-box input { all: unset; flex: 1; min-width: 0; font-size: 17px; font-weight: 800; color: #fff; caret-color: var(--accent); background: transparent; }
.nk-box input:focus-visible { outline: none; }
.nk-box input::placeholder { color: #5b6390; font-weight: 700; font-size: 14px; }
.nk-box input:disabled { color: var(--muted); }
.nk-tagbox b { color: var(--muted); font-size: 17px; font-weight: 900; }
.nk-tagbox input { width: 5em; flex: none; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); }
.nk-box[data-lock] { opacity: .6; }
.nk-dice { flex: none; width: 38px; height: 38px; border-radius: 10px; border: 0; background: var(--bg2); font-size: 18px; }
.nk-dice:hover { background: #2b3150; }
.nk-dice:disabled { opacity: .4; cursor: default; }
.nk-msg { min-height: 20px; margin: 10px 0 0; font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.45; }
.nk-msg.ok { color: var(--good); }
.nk-msg.bad { color: var(--bad); }
.nk-sugg { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 4px; }
.nk-sugg[hidden] { display: none; }
.nk-chip { border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 13px; }
.nk-chip:hover, .nk-chip:focus-visible { border-color: var(--accent); color: var(--accent); }
.nk-acts { flex-wrap: wrap; }
.nk-acts .dk { height: 50px; }
.nk-note { margin: 12px 0 0; font-size: 11.5px; line-height: 1.55; color: #7d84a8; text-align: center; }

/* ---------- 하드코어 방 (방장이 켬) · 탈락 뒤 관전 ---------- */
/* 화면 테두리가 붉게 일렁임 + 위쪽 경고 문구. #game.hardcore = 하드코어 방의 대기실·경기 중 (main.js frame) */
.hc-vignette, .hc-banner { display: none; }
#game.hardcore .hc-vignette {
  display: block; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: 10px;
  box-shadow: inset 0 0 46px 10px rgba(255, 24, 48, .55), inset 0 0 110px 16px rgba(170, 0, 20, .2);
  animation: hcPulse 2.4s ease-in-out infinite;
}
#game.hardcore .hc-vignette::before { /* 가장자리를 따라 흐르는 붉은 물결 */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background:
    radial-gradient(110% 34% at 50% -8%, rgba(255, 40, 60, .26), transparent 70%),
    radial-gradient(110% 34% at 50% 108%, rgba(255, 40, 60, .22), transparent 70%),
    radial-gradient(26% 110% at -6% 50%, rgba(255, 30, 50, .26), transparent 70%),
    radial-gradient(26% 110% at 106% 50%, rgba(255, 30, 50, .26), transparent 70%);
  animation: hcWave 3.6s ease-in-out infinite alternate;
}
@keyframes hcPulse { 0%, 100% { opacity: .78; } 50% { opacity: 1; } }
@keyframes hcWave { 0% { transform: scale(1); filter: hue-rotate(0deg); opacity: .7; } 50% { opacity: 1; } 100% { transform: scale(1.03); filter: hue-rotate(-12deg); opacity: .8; } }
#game.hardcore.hc-text .hc-banner {
  display: block; position: absolute; left: 50%; top: 10px; z-index: 5; transform: translateX(-50%); pointer-events: none;
  padding: 5px 16px; border-radius: 999px; background: rgba(40, 0, 6, .72); border: 1px solid rgba(255, 70, 90, .7);
  color: #ffd6da; font-size: 15px; font-weight: 900; letter-spacing: .5px; white-space: nowrap;
  text-shadow: 0 0 10px rgba(255, 40, 60, .9), 0 0 2px #ff2a44; box-shadow: 0 0 18px rgba(255, 30, 50, .35);
  animation: hcText 2.4s ease-in-out infinite;
}
@keyframes hcText { 0%, 100% { opacity: .85; } 46% { opacity: 1; } 50% { opacity: .55; } 54% { opacity: 1; } }
#game.hardcore.hc-text .banner { top: 48px; } /* 경고 문구가 보이는 동안 알림은 그 아래로 */
@media (max-width: 520px) {
  #game.hardcore.hc-text .hc-banner { font-size: 12.5px; padding: 4px 12px; top: 6px; }
  #game.hardcore.hc-text .banner { top: 40px; }
  #game.hardcore.hc-text .ranks { top: 38px; } /* 좁은 화면: 경고 문구 아래로 */
}
.out-pop.hc .who::before { content: none; }
#hostSet .slabel { white-space: nowrap; width: 58px; }
@media (prefers-reduced-motion: reduce) { #game.hardcore .hc-vignette, #game.hardcore .hc-vignette::before, #game.hardcore .hc-banner { animation: none; } }
/* 대기실 방장 설정: 하드코어 켬 버튼은 붉게 */
.hc-seg button[data-hc="1"].on { background: #ff3b55; border-color: #ff3b55; color: #fff; }
.hc-note { margin: 2px 0 4px; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.gv-big.hc { color: #ff5a6e; flex-direction: column; font-style: normal; } .gv-big.hc small { margin: 2px 0 0; }
/* 결과창: 탈락 */
.dnf .elim { color: #ff5a6e; font-weight: 900; }
/* 관전: 아래쪽 가운데 막대 (◀ 이름 ▶), 글자 버튼은 숨김, 순위 목록을 눌러 고를 수 있음 */
.spec-bar {
  position: absolute; left: 50%; bottom: 16px; z-index: 6; transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  padding: 6px; border-radius: 999px; background: rgba(15, 17, 30, .88); border: 1px solid rgba(255, 90, 110, .6); box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}
.spec-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg2); color: #fff; font-size: 16px; font-weight: 900; }
.spec-btn:hover { border-color: #ff5a6e; }
.spec-who { display: flex; flex-direction: column; align-items: center; min-width: 140px; max-width: 50vw; }
.spec-who small { font-size: 11px; font-weight: 800; color: #ff8a9a; letter-spacing: .5px; }
.spec-who b { font-size: 15px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.spec-who b small { color: var(--muted); font-size: 12px; margin-left: 4px; letter-spacing: 0; }
#game.spectating .pad, #game.spectating .race-taunts { display: none !important; }
#game.spectating .ranks { pointer-events: auto; }
#game.spectating .ranks li:not(.me):not(.out) { cursor: pointer; }
#game.spectating .ranks li:not(.me):not(.out):hover { background: rgba(255, 255, 255, .08); }
.ranks li.spec { outline: 2px solid #ff5a6e; outline-offset: -2px; }
@media (pointer: coarse) { .spec-bar { bottom: max(18px, env(safe-area-inset-bottom)); } .spec-btn { width: 48px; height: 48px; } }

/* ---------- 피버 러쉬 · 피버타임 ---------- */
.dk.endless { --c: #ff8a1f; color: #fff; }
.dk.endless small { opacity: .85; }
.endless-card .en-rules { background: rgba(255, 138, 31, .1); border-color: rgba(255, 138, 31, .4); }
.endless-card .en-rules b { color: #ffc27a; }
.endless-card .en-board { flex: 1 1 auto; min-height: 150px; max-height: none; gap: 3px; }
.endless-card .en-board .sl { background: #1f2440; }
#enStart small { opacity: .75; }
.season-bar i.paused { background: linear-gradient(90deg, rgba(255, 216, 74, .55), rgba(255, 242, 168, .55)); transition: none; } /* 피버 중: 제한시간 멈춤 */
/* 피버 중: 화면 테두리가 금빛으로 빛남 */
.fever-edge { display: none; }
#game.fever .fever-edge {
  display: block; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: 10px;
  box-shadow: inset 0 0 50px 12px rgba(255, 196, 40, .55), inset 0 0 120px 20px rgba(255, 120, 20, .22);
  animation: feverEdge .35s ease-in-out infinite alternate;
}
@keyframes feverEdge { from { opacity: .7; } to { opacity: 1; } }
/* 피버 시작: 가운데 큰 글자 (1.6초) */
.fever-fx { position: absolute; left: 50%; top: 22%; z-index: 7; transform: translate(-50%, -50%); pointer-events: none; text-align: center; white-space: nowrap; opacity: 0; visibility: hidden; }
.fever-fx.show { visibility: visible; animation: ffShow 1.6s ease-out forwards; }
@keyframes ffShow { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-8deg); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); } 24% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%) scale(1.05); } }
.ff-rays { position: absolute; left: 50%; top: 50%; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%; z-index: -1;
  background: repeating-conic-gradient(rgba(255, 210, 80, .42) 0 8deg, rgba(255, 210, 80, 0) 8deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 16%, transparent 66%); mask: radial-gradient(circle, #000 16%, transparent 66%); }
.fever-fx.show .ff-rays { animation: acrays 1.6s linear; }
.ff-text { font-size: 72px; font-weight: 900; font-style: italic; letter-spacing: 2px; line-height: 1; color: #ffd84a; -webkit-text-stroke: 8px #3a1c00; paint-order: stroke fill; text-shadow: 0 6px 0 rgba(40, 16, 0, .6); filter: drop-shadow(0 0 16px #ffb02e); }
.ff-sub { display: inline-block; margin-top: 10px; font-size: 15px; font-weight: 900; color: #fff; background: rgba(40, 18, 0, .82); border: 2px solid #ffd84a; border-radius: 999px; padding: 5px 14px; }
@media (max-width: 720px) {
  .ff-text { font-size: 44px; -webkit-text-stroke-width: 6px; }
  .ff-rays { width: 360px; height: 360px; margin: -180px 0 0 -180px; }
  .ff-sub { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) { #game.fever .fever-edge { animation: none; } }

/* 낮은 휴대폰 (예: 360×640 · 375×667): 메뉴 판 버튼이 다섯 개(피버 러쉬 추가)라 닉네임 칩 · 공지 띠와 겹치지 않게
   로고 소개 문구를 숨겨 그 자리에 닉네임 칩, 판은 그 아래에서 시작 (버튼 설명 글은 숨기고 높이를 줄임) */
@media (max-width: 720px) and (max-height: 700px) {
  #menu .logo-sub { display: none; }
  .name-btn { top: 112px; }
  #menu.has-notice .name-btn { top: 158px; }
  #menu .deck { gap: 5px; padding: 9px; }
  #menu .deck .dk, #menu .deck .dk-join input { height: 40px; }
  #menu .deck .dk small { display: none; }
  #menu .deck .deck-tabs button { height: 32px; }
  #menu .menu-dock { top: 158px; }
  #menu.has-notice .menu-dock { top: 204px; }
}

/* ---------- 커스텀 맵 별점 (결과창 줄 · 묻기 팝업 · 맵 고르기 정렬) ---------- */
.rate-stars { display: inline-flex; gap: 2px; }
.rate-stars .rs { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #4a5178; font-size: 24px; line-height: 1; cursor: pointer; transition: color .1s, transform .1s; }
.rate-stars .rs.on { color: var(--accent); text-shadow: 0 0 8px rgba(255, 207, 63, .35); }
.rate-stars .rs:hover { transform: scale(1.12); }
.rate-stars .rs:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.res-rate { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 12px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 207, 63, .07); border: 1px solid rgba(255, 207, 63, .22); }
.res-rate .rr-l { font-weight: 900; font-size: 13px; }
.res-rate small { color: var(--muted); font-weight: 700; font-size: 12px; }
.res-rate.own .rr-l { color: var(--muted); }
.res-rate.busy .rate-stars { opacity: .5; pointer-events: none; }
.rate-card { text-align: center; }
.rate-card .msub { margin-bottom: 4px; }
.rate-stars.big { gap: 6px; margin: 10px 0 2px; }
.rate-stars.big .rs { width: 48px; height: 48px; font-size: 40px; }
.rt-info { margin: 4px 0 0; min-height: 1.3em; color: var(--muted); font-weight: 800; font-size: 14px; }
@media (max-width: 380px) { .rate-stars.big .rs { width: 40px; height: 40px; font-size: 34px; } }
@media (hover: none) { .rate-stars .rs:hover { transform: none; } }
.mp-find { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.mp-find #mpQ { flex: 1; min-width: 0; margin-bottom: 0; }
.mp-sort { display: flex; flex: none; gap: 2px; padding: 2px; border-radius: 9px; background: rgba(10, 12, 22, .55); }
.mp-sort button { height: 32px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 900; font-size: 12px; }
.mp-sort button.on { background: var(--bg2); color: var(--accent); }
.map-list .mi small .rt { color: var(--accent); font-style: normal; }
.map-list .mi small .rt.few { color: var(--muted); }

/* ---------- 코인 (v2026.10.27-1): 메인 화면 잔액 칩 · 결과창 줄 ---------- */
.coin-chip { position: absolute; left: 16px; top: 148px; z-index: 3; display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; border-radius: 999px; background: rgba(15, 17, 30, .82); border: 1px solid rgba(255, 207, 63, .35); color: #ffe08a; font-weight: 900; font-size: 14px; box-shadow: 0 4px 0 rgba(0, 0, 0, .35); backdrop-filter: blur(3px); pointer-events: none; }
.coin-chip .cc-i { font-size: 15px; }
.coin-chip.bump { animation: coinBump .5s ease-out; }
@keyframes coinBump { 0% { transform: scale(1); } 30% { transform: scale(1.18); } 100% { transform: scale(1); } }
#btnFull[hidden] ~ .coin-chip { top: 104px; } /* 전체 화면 버튼이 없으면 채널 칩이 올라오므로 그 아래로 */
@media (max-width: 720px) { .coin-chip { left: auto; right: 10px; top: 104px; padding: 4px 9px 4px 7px; font-size: 13px; } }
.res-coins { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 10px; padding: 7px 12px; border-radius: 10px; background: rgba(255, 207, 63, .09); border: 1px solid rgba(255, 207, 63, .25); }
.res-coins .rc-l { display: inline-flex; align-items: center; gap: 5px; font-weight: 900; font-size: 14px; color: #ffe08a; }
.res-coins small { color: var(--muted); font-weight: 700; font-size: 12px; }

/* ---------- 하트 · 계단 코인 (v2026.10.28-1) ---------- */
/* 동전 아이콘 (CSS로 그린 금화 — 이모지보다 어디서나 같은 모양) */
.coin-ico { display: inline-block; width: 1em; height: 1em; border-radius: 50%; vertical-align: -0.14em; background: radial-gradient(circle at 35% 30%, #fff6c4 0 14%, #ffd84a 15% 52%, #e9a80f 53% 70%, #b9790a 71%); box-shadow: inset 0 0 0 1.5px #9a6408; position: relative; flex: none; }
.coin-ico::after { content: ''; position: absolute; left: 50%; top: 22%; width: 18%; height: 56%; transform: translateX(-50%); border-radius: 2px; background: rgba(154, 100, 8, .55); }
/* 하트 아이콘 (SVG 배경) */
.ht-h i, .rc-hearts i, .heart-ico { display: inline-block; width: 1em; height: 1em; vertical-align: -0.12em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 14.6S1 10.1 1 5.6C1 3.1 2.9 1.3 5.1 1.3c1.4 0 2.4.8 2.9 1.8.5-1 1.5-1.8 2.9-1.8 2.2 0 4.1 1.8 4.1 4.3 0 4.5-7 9-7 9z' fill='%23ff4f86' stroke='%23b8124f' stroke-width='.8'/%3E%3Cpath d='M4.3 3.4c-1 .3-1.6 1.2-1.6 2.2' stroke='%23ffd0e0' stroke-width='1.1' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; flex: none; }
.rc-hearts i.used { filter: grayscale(1) brightness(1.6); opacity: .35; }

/* 하트 충전 창 */
.heart-card { text-align: center; }
.heart-card .ht-mode { margin: 0 0 2px; font-size: 12px; font-weight: 900; letter-spacing: .5px; color: #ff8fb2; }
.heart-card h2 { margin-top: 0; }
.heart-card .mactions #htGo { flex: 1.8; white-space: nowrap; }
.heart-card .msub { word-break: keep-all; }
.ht-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 14px 0 10px; }
.ht-pick button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 4px 9px; border-radius: 14px; border: 2px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .05); color: var(--text, #fff); cursor: pointer; font: inherit; transition: transform .12s, border-color .12s, background .12s; }
.ht-pick button:hover:not(:disabled) { border-color: rgba(255, 143, 178, .55); transform: translateY(-1px); }
.ht-pick button.on { border-color: #ff6f9f; background: linear-gradient(180deg, rgba(255, 79, 134, .26), rgba(255, 79, 134, .08)); box-shadow: 0 0 0 3px rgba(255, 79, 134, .18), 0 6px 18px rgba(255, 79, 134, .22); }
.ht-pick button:disabled { opacity: .35; cursor: not-allowed; }
.ht-pick .ht-h { font-size: 22px; height: 26px; display: flex; align-items: center; justify-content: center; gap: 1px; color: var(--muted); font-weight: 900; }
.ht-pick button[data-n="3"] .ht-h { font-size: 19px; }
.ht-pick button.on .ht-h i { animation: htBeat .9s ease-in-out infinite; }
.ht-pick em { font-style: normal; font-weight: 900; font-size: 14px; }
.ht-pick small { font-size: 11px; font-weight: 800; color: #ffe08a; }
@keyframes htBeat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.2); } 28% { transform: scale(1); } }
.ht-cost { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 2px 8px; font-size: 13px; }
.ht-cost > b { font-weight: 900; }
.ht-bal { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; color: #ffe08a; }
.ht-bal span { color: var(--muted); font-weight: 700; }
.ht-err { margin: 0 0 10px; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, .06); font-size: 12px; color: var(--muted); }
.ht-err.bad { background: rgba(255, 77, 106, .14); color: #ff9aa9; font-weight: 800; }
@media (max-width: 420px) { .ht-pick { gap: 5px; } .ht-pick .ht-h { font-size: 18px; } .ht-pick button[data-n="3"] .ht-h { font-size: 15px; } }

/* 경기 화면: 남은 하트 · 모은 코인 (가운데 위, 시즌·피버 러쉬는 타이머 막대 아래) */
.run-chips { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 4; display: flex; gap: 6px; pointer-events: none; }
#game.season-mode .run-chips { top: 40px; }
.run-chips > span { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: rgba(10, 12, 22, .75); border: 1px solid rgba(255, 255, 255, .16); font-weight: 900; font-size: 14px; color: #fff; font-variant-numeric: tabular-nums; backdrop-filter: blur(3px); }
.run-chips .rc-hearts { gap: 2px; border-color: rgba(255, 111, 159, .45); font-size: 15px; }
.run-chips .rc-coins { color: #ffe08a; border-color: rgba(255, 207, 63, .4); }
.run-chips .rc-coins.bump { animation: coinBump .45s ease-out; }
.run-chips .rc-hearts.hit { animation: heartHit .6s ease-out; }
@keyframes heartHit { 0% { transform: scale(1); } 25% { transform: scale(1.35); box-shadow: 0 0 0 6px rgba(255, 79, 134, .35); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 79, 134, 0); } }
#game.replay-mode .run-chips .rc-hearts { display: none; }

/* 일시정지 창: 지금 나가면 잃는 것 */

/* 순위표·결과창: 하트를 쓴 기록 */
.badge.heart, .hb-heart { display: inline-flex; align-items: center; gap: 1px; padding: 1px 6px; border-radius: 999px; background: rgba(255, 79, 134, .16); color: #ff8fb2; font-size: 10.5px; font-weight: 900; line-height: 1.5; white-space: nowrap; }

/* ---------- 유저 정보 창 (v2026.10.28-1, profile.js) ---------- */
.profile-card { width: min(460px, 100%); position: relative; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.profile-card h2 { padding-right: 34px; }
.pf-head { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--bg2); }
.pf-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pf-name { font-size: 18px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-id small { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.pf-id small:empty { display: none; }
.pf-rename { flex: none; white-space: nowrap; font-weight: 800; }
.pf-cool { margin: 6px 2px 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.pf-coins { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 207, 63, .09); border: 1px solid rgba(255, 207, 63, .25); font-size: 22px; }
.pf-coins b { font-weight: 900; color: #ffe08a; font-variant-numeric: tabular-nums; }
.pf-coins .pf-unit { font-size: 13px; font-weight: 800; color: #ffe08a; }
.pf-coins small { word-break: keep-all; flex-basis: 100%; color: var(--muted); font-size: 11.5px; font-weight: 700; line-height: 1.4; }
.pf-h { margin: 14px 0 6px; font-size: 14px; font-weight: 900; display: flex; align-items: baseline; gap: 6px; }
.pf-h small { color: var(--muted); font-size: 12px; font-weight: 800; }
.pf-plays { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pf-plays li { background: var(--bg2); border-radius: 10px; padding: 7px 6px; text-align: center; min-width: 0; }
.pf-plays small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-plays b { display: block; font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.pf-msg { margin: 6px 2px 0; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.45; }
@media (max-width: 420px) {
  .pf-plays { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pf-ach { grid-template-columns: 1fr; }
}

/* ---------- 그만두기 확인 · 하트 번쩍임 (v2026.10.28-2) ---------- */
.loss-card .ls-msg { margin: 10px 0 4px; font-size: 15px; font-weight: 800; line-height: 1.55; word-break: keep-all; }
.loss-card .ls-detail { margin: 6px auto 4px; display: inline-block; padding: 5px 12px; border-radius: 999px; background: rgba(255, 176, 46, .12); border: 1px solid rgba(255, 176, 46, .35); color: #ffd28a; font-size: 13px; font-weight: 800; }
.loss-card .ls-detail:empty { display: none; }
.heart-flash { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; border-radius: inherit;
  background: radial-gradient(ellipse at center, rgba(255, 79, 134, 0) 40%, rgba(255, 79, 134, .28) 72%, rgba(255, 111, 159, .6) 100%); }
.heart-flash.hit { animation: heartFlash .7s ease-out; }
@keyframes heartFlash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .heart-flash.hit { animation-duration: .35s; } }

/* ---------- 꾸미기 상점 (v2026.10.28-3) ---------- */
.cos-bal { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 207, 63, .1); border: 1px solid rgba(255, 207, 63, .35); color: #ffe08a; font-weight: 900; font-size: 14px; font-variant-numeric: tabular-nums; }
.cos-bal[hidden] { display: none; }
.cos-try .cos-buy { display: inline-flex; align-items: center; gap: 4px; margin: 5px 0 2px; padding: 5px 12px; font-weight: 900; font-size: 13px; color: #2a2100; background: #ffd23f; border-color: #ffd23f; }
.cos-try .cos-buy.armed { background: #ff9a3d; border-color: #ff9a3d; animation: buyPulse .9s ease-in-out infinite; }
.cos-try .cos-buy:disabled { background: rgba(255, 255, 255, .08); border-color: var(--line); color: var(--muted); }
.cos-try .cos-buy .coin-ico { font-size: 13px; }
@keyframes buyPulse { 50% { box-shadow: 0 0 0 4px rgba(255, 154, 61, .3); } }
.cos-cell .cc-price { font-style: normal; font-weight: 900; color: #ffe08a; display: inline-flex; align-items: center; gap: 3px; }
.cos-cell.on .cc-price { color: var(--good); }
.cos-cell small .coin-ico { font-size: 11px; }
.cos-try { word-break: keep-all; }
.cos-try .cos-buy { width: 100%; justify-content: center; flex-wrap: wrap; text-align: center; }

/* ===== 타이틀 미니게임 '넷 다 올리기' (title-play.js, v2026.11.06-1) =====
   로고 키캡 T Y P O = 인원 1 ~ 4명 (누르면 시작 · 놀이 중엔 인원 바꾸기). 놀이 중에는 메뉴 판이 내려가고 로고 글씨가 흐려지며,
   아래에 진행 줄 · ▲ 메뉴와 버튼 줄(캐릭터마다 하나 + 가운데 '모두')이 올라온다. 버튼 모양은 경기 화면 글자 버튼(.pad)과 같은 결 */
#menu .logo-keys i { pointer-events: auto; cursor: pointer; transition: opacity .2s ease, scale .2s ease, filter .15s ease; }
#menu .logo-keys i:hover { filter: brightness(1.12); }
#menu .logo-keys i:focus { outline: none; }
#menu .logo-keys i.pop { animation: keytype 4.8s infinite, tpCapPop .35s ease-out; }
@keyframes tpCapPop { 45% { scale: 1.28; } }
#menu.tplay .logo-keys i { opacity: .45; }
#menu.tplay .logo-keys i.on { opacity: 1; scale: 1.08; }
#menu.tplay .logo-keys i.on.pop { animation: keytype 4.8s infinite, tpCapPopOn .35s ease-out; }
@keyframes tpCapPopOn { 45% { scale: 1.3; } }
#menu .logo-run, #menu .logo-sub, #menu .notice-band { transition: opacity .25s ease, visibility 0s; }
#menu.tplay .logo-run, #menu.tplay .logo-sub, #menu.tplay .notice-band { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .25s ease, visibility 0s linear .25s; }
#menu.tplay .menu-dock { transform: translate(-50%, 120vh); visibility: hidden; pointer-events: none; transition: transform .3s ease, visibility 0s linear .3s; }
#menu.tplay .mob-ctl, #menu.tplay .zone-hint, #menu.tplay .menu-handle, #menu.tplay .menu-foot, #menu.tplay .privacy-link { display: none !important; }

.tp-hud {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 10px max(12px, env(safe-area-inset-bottom)); pointer-events: none; animation: tpUp .3s ease both;
}
@keyframes tpUp { from { transform: translateY(110%); } }
.tp-bar { width: min(640px, 100%); display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: auto; }
.tp-status {
  min-width: 0; padding: 9px 15px; border-radius: 999px; background: rgba(15, 17, 30, .84); border: 1px solid rgba(255, 255, 255, .14);
  color: #fff; font: 800 13px/1.1 system-ui, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .3); backdrop-filter: blur(3px);
}
.tp-close {
  flex: none; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .32);
  background: rgba(12, 14, 26, .84); color: #fff; font: 900 14px/1 system-ui, sans-serif; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); touch-action: manipulation;
}
.tp-close:hover, .tp-close:focus-visible { border-color: #ffd84a; outline: none; }
.tp-pad { width: min(640px, 100%); display: flex; gap: 8px; pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.tp-btn {
  position: relative; flex: 1; min-width: 0; height: clamp(66px, 12vh, 100px); border: 0; border-radius: 16px; background: var(--c, #ccc); color: #111;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; line-height: 1;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .14), 0 6px 0 rgba(0, 0, 0, .42); transition: transform .05s, box-shadow .05s, filter .1s;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
.tp-btn b { max-width: 94%; font-size: 17px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-btn small { font-size: 14px; font-weight: 800; opacity: .72; font-variant-numeric: tabular-nums; }
.tp-btn.down { transform: translateY(5px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14), 0 1px 0 rgba(0, 0, 0, .42); }
.tp-btn.flash-ok { filter: brightness(1.35); }
.tp-btn.flash-miss { background: var(--bad) !important; color: #fff; }
.tp-btn.goal small { opacity: 1; color: #fff; background: rgba(20, 12, 0, .55); padding: 3px 7px; border-radius: 999px; }
.tp-btn.me::after { content: ""; position: absolute; inset: 3px; border-radius: 13px; border: 2px solid rgba(255, 255, 255, .8); pointer-events: none; }
.tp-all { --c: #f4f1ff; }
.tp-key {
  position: absolute; left: 7px; top: 6px; font-style: normal; font-size: 10px; font-weight: 900; line-height: 1;
  padding: 3px 5px; border-radius: 6px; background: rgba(0, 0, 0, .16); color: rgba(0, 0, 0, .7);
}
@media (pointer: coarse) { .tp-key { display: none; } }
@media (max-width: 720px) {
  .tp-pad { gap: 6px; }
  .tp-btn { border-radius: 14px; gap: 6px; }
  .tp-btn b { font-size: 15px; }
  .tp-btn small { font-size: 13px; }
  .tp-status { font-size: 12px; padding: 8px 12px; }
}
