:root {
  --ink: #23324a;
  --accent: #e8402f;
  --gold: #ffb300;
  --panel: rgba(255, 255, 255, 0.88);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #bfe3ff; color: var(--ink);
  font-family: -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none;
}
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ── 화면 공통 ── */
.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  text-align: center; background: linear-gradient(#bfe3ff 0%, #eaf6ff 55%, #ffffff 100%); z-index: 10;
}
h1 { font-size: clamp(38px, 11vw, 56px); line-height: 1.1; margin: 0; letter-spacing: -1px; color: #1d4f8c;
  text-shadow: 0 3px 0 #fff, 0 6px 14px rgba(29, 79, 140, 0.25); }
h2 { font-size: clamp(28px, 8vw, 40px); line-height: 1.25; margin: 0; color: #1d4f8c; }
#title-mole { width: min(58vw, 260px); filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.18)); }
.howto { background: var(--panel); border-radius: 18px; padding: 10px 18px; font-size: clamp(17px, 4.8vw, 20px); }
.howto p { margin: 6px 0; }
button.big {
  font: inherit; font-size: clamp(24px, 7vw, 30px); font-weight: 800; color: #fff; background: var(--accent);
  border: 0; border-radius: 999px; padding: 18px 56px; box-shadow: 0 6px 0 #a8251a, 0 10px 20px rgba(0, 0, 0, 0.2);
}
button.big:active { transform: translateY(4px); box-shadow: 0 2px 0 #a8251a; }
button.small { font: inherit; font-size: 17px; background: transparent; border: 2px solid #8fb3d9; color: #4a6a8f;
  border-radius: 999px; padding: 8px 22px; }
.settings { font-size: 17px; background: var(--panel); border-radius: 14px; padding: 8px 16px; }
.settings summary { cursor: pointer; font-weight: 700; }
.settings label { display: block; margin: 10px 0; text-align: left; }
.settings select { font: inherit; font-size: 16px; margin-left: 6px; }
.settings input[type=checkbox] { width: 22px; height: 22px; vertical-align: middle; }
.note { font-size: 15px; color: #b03a2e; max-width: 340px; margin: 0; }

/* ── 보정 ── */
#calib-desc { font-size: clamp(19px, 5.4vw, 23px); margin: 0; min-height: 2.6em; }
.ring { position: relative; width: 180px; height: 180px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .bg { stroke: rgba(29, 79, 140, 0.15); }
.ring .fg { stroke: #2f7de1; stroke-linecap: round; stroke-dasharray: 276.5; stroke-dashoffset: 276.5; transition: stroke-dashoffset 0.1s linear; }
#calib-icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; }
#calib-icon.shake { animation: shake 0.45s ease-in-out infinite; }
@keyframes shake { 0%, 100% { transform: translateY(-14px); } 50% { transform: translateY(14px); } }

/* ── HUD ── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5;
  padding: max(12px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; justify-content: space-between; }
.hud-top { display: flex; justify-content: space-between; gap: 10px; }
.pill { background: var(--panel); border-radius: 16px; padding: 6px 16px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1); min-width: 120px; }
.pill .label, .hud-bottom .label { display: block; font-size: 14px; color: #5a7290; font-weight: 600; }
.pill b { font-size: clamp(26px, 8vw, 34px); font-variant-numeric: tabular-nums; }
#hud-msg { align-self: center; font-size: clamp(22px, 6.4vw, 30px); font-weight: 800; color: #fff; text-align: center;
  text-shadow: 0 2px 0 #1d4f8c, 0 0 12px rgba(29, 79, 140, 0.6); padding: 0 10px; min-height: 1.4em; margin-top: 1vh;
  transition: opacity 0.25s; }
#hud-msg.gold { color: #fff3c4; text-shadow: 0 2px 0 #b06d00, 0 0 16px rgba(255, 179, 0, 0.9); }
.hud-bottom { display: flex; gap: 10px; background: var(--panel); border-radius: 18px; padding: 10px 14px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1); }
.meter, .tilt { flex: 1; }
.bar { height: 18px; border-radius: 9px; background: #dbe7f3; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6fc3ff, #2f7de1); border-radius: 9px; }
.bar i.full { background: linear-gradient(90deg, #ffd25c, #ff9c00); }
.tilt-track { position: relative; height: 18px; border-radius: 9px; background: #dbe7f3; margin-top: 4px; }
.tilt-track::after { content: ''; position: absolute; left: 50%; top: 2px; bottom: 2px; width: 2px; background: #9fb6cf; }
#tilt-dot { position: absolute; top: 1px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--accent); z-index: 1; }

/* ── 카운트다운 ── */
#countdown { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; pointer-events: none;
  font-size: 30vw; font-weight: 900; color: #fff; text-shadow: 0 6px 0 #1d4f8c, 0 0 30px rgba(29, 79, 140, 0.5); }
#countdown.pop { animation: pop 0.9s ease-out; }
@keyframes pop { 0% { transform: scale(1.6); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.85); opacity: 0.2; } }

/* ── 결과 ── */
.end-mole { width: min(46vw, 210px); }
.result { font-size: clamp(24px, 7vw, 30px); margin: 0; }
.result b { color: var(--accent); font-size: 1.4em; }
.sub { font-size: 18px; margin: 0; color: #4a6a8f; }

#debug { position: fixed; left: 6px; bottom: 120px; z-index: 30; font: 12px/1.35 ui-monospace, monospace; color: #0b2340;
  background: rgba(255, 255, 255, 0.8); padding: 6px 8px; border-radius: 8px; white-space: pre; pointer-events: none; }

/* ── PC 화면의 휴대폰 QR ── */
#qr-box { position: fixed; right: 20px; bottom: 20px; z-index: 15; background: #fff; border-radius: 18px; padding: 14px 16px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 16px; }
#qr-box span { font-size: 13px; color: #5a7290; }
#qr img, #qr canvas { display: block; width: 168px; height: 168px; }

/* ───────── 휴대폰 컨트롤러 ───────── */
body.ctrl { background: linear-gradient(#1d4f8c, #2f7de1 60%, #6fb6ff); color: #fff; touch-action: none; }
.ctrl-top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 16px 8px; font-size: 15px; z-index: 5; }
.status { padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,0.18); font-weight: 700; }
.status.on { background: #2ecc71; }
.cscreen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 60px 20px max(24px, env(safe-area-inset-bottom)); text-align: center; }
body.ctrl h2 { color: #fff; font-size: clamp(28px, 8.5vw, 38px); }
.big-p { font-size: clamp(19px, 5.4vw, 23px); margin: 0; line-height: 1.5; }
body.ctrl .settings { color: var(--ink); }
body.ctrl .note { color: #ffe1dc; }
body.ctrl button.small { color: #fff; border-color: rgba(255,255,255,0.6); }
body.ctrl .ring .bg { stroke: rgba(255,255,255,0.25); }
body.ctrl .ring .fg { stroke: #fff; }
body.ctrl .result { color: #fff; }
body.ctrl .result b { color: #ffe08a; }
.c-stats { display: flex; gap: 12px; width: 100%; max-width: 420px; }
.c-stats div { flex: 1; background: rgba(255,255,255,0.16); border-radius: 18px; padding: 10px; }
.c-stats span { display: block; font-size: 15px; opacity: 0.85; }
.c-stats b { font-size: clamp(30px, 9vw, 40px); font-variant-numeric: tabular-nums; }
.hint { font-size: clamp(18px, 5vw, 21px); line-height: 1.6; margin: 0; }
.c-meter { width: 100%; max-width: 420px; text-align: left; font-size: 17px; font-weight: 700; }
.c-meter small { font-weight: 600; opacity: 0.85; margin-left: 6px; }
.bar.tall, .tilt-track.tall { height: 34px; border-radius: 17px; background: rgba(255,255,255,0.25); margin-top: 6px; }
.bar.tall i { border-radius: 17px; background: linear-gradient(90deg, #bfe6ff, #ffffff); }
.bar.tall i.full { background: linear-gradient(90deg, #ffd25c, #ff9c00); }
.tilt-track.tall #c-tilt { position: absolute; top: 3px; left: 50%; width: 28px; height: 28px; margin-left: -14px; border-radius: 50%; background: #ffe08a; z-index: 1; }
.tilt-track.tall::after { background: rgba(255,255,255,0.7); }
#c-touchpad { font-size: 18px; background: rgba(255,255,255,0.16); border-radius: 16px; padding: 12px 16px; line-height: 1.6; }

/* ───────── 게임 화면(스탠바이미) 대기 화면 ───────── */
.link-box { display: flex; align-items: center; gap: 22px; background: var(--panel); border-radius: 24px; padding: 18px 24px; text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.link-box #qr img, .link-box #qr canvas { width: clamp(150px, 22vmin, 240px); height: auto; }
.link-box .room { font-size: clamp(16px, 2.4vmin, 22px); color: #4a6a8f; }
.link-box .room b { font-size: 1.5em; color: #1d4f8c; letter-spacing: 3px; }
.link-box .lead { font-size: clamp(20px, 3.2vmin, 30px); font-weight: 800; margin: 0 0 8px; color: #1d4f8c; }
.conn { display: inline-block; margin-top: 10px; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: clamp(15px, 2.2vmin, 20px);
  background: #e1e9f2; color: #5a7290; }
.conn.on { background: #2ecc71; color: #fff; }
#screen-title .waiting { font-size: clamp(20px, 3vmin, 28px); color: #1d4f8c; font-weight: 700; margin: 0; }
@media (orientation: landscape) {
  #screen-title { display: grid; grid-template-columns: auto auto; grid-template-areas: "h h" "m b" "w w" "n n";
    justify-content: center; align-content: center; justify-items: center; align-items: center; column-gap: 6vw; row-gap: 3vh; }
  #screen-title h1 { grid-area: h; font-size: clamp(40px, 7vh, 72px); }
  #screen-title #title-mole { grid-area: m; width: auto; height: min(46vh, 420px); }
  #screen-title .link-box { grid-area: b; }
  #screen-title .waiting { grid-area: w; }
  #screen-title .note { grid-area: n; }
  #screen-end .end-mole { width: auto; height: 34vh; }
}
.sound-btn { color: #1d4f8c; border-color: #8fb3d9; background: rgba(255,255,255,0.8); }
@media (orientation: landscape) { #screen-title .sound-btn { grid-column: 1 / -1; } }

/* 대기·결과 화면 배경: 운동회 + 올림픽 경기장 */
#screen-title, #screen-end, #screen-calib {
  background: linear-gradient(rgba(234,246,255,0.55), rgba(255,255,255,0.88) 70%), url('assets/game/stadium.jpg') center / cover no-repeat;
}
button.small.dark { color: var(--ink); border-color: #8fb3d9; background: #fff; margin-top: 4px; }
.vibres { font-size: 14px; color: #4a6a8f; margin: 6px 0 0; text-align: left; max-width: 300px; }

/* 컨트롤러: 충돌·보너스 때 화면 번쩍 (진동 안 되는 아이폰 대체 피드백) */
body.ctrl::after { content: ''; position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 50; }
body.flash-hit::after { background: #ff3b30; animation: cflash 0.45s ease-out; }
body.flash-soft::after { background: #ffffff; animation: cflash 0.3s ease-out; }
body.flash-gold::after { background: #ffc94a; animation: cflash 0.6s ease-out; }
@keyframes cflash { 0% { opacity: 0.75; } 100% { opacity: 0; } }

/* ───────── 2인 대결 ───────── */
:root { --p0: #2f7de1; --p1: #e8402f; }
.duo-badge { display: inline-block; vertical-align: middle; font-size: 0.42em; letter-spacing: 0; padding: 6px 14px; border-radius: 999px;
  background: linear-gradient(90deg, var(--p0), var(--p1)); color: #fff; text-shadow: none; }
.players { display: flex; gap: 18px; }
@media (orientation: landscape) {
  #screen-title { grid-template-areas: "h h" "m b" "p p" "w w" "n n"; }
  #screen-title .players { grid-area: p; }
}
.pcard { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: clamp(180px, 24vmin, 280px); padding: 12px 18px;
  border-radius: 20px; background: var(--panel); border: 4px solid #d5e1ee; box-shadow: 0 6px 18px rgba(0,0,0,0.1); }
.pcard .pnum { font-weight: 900; color: #fff; border-radius: 999px; padding: 2px 14px; font-size: clamp(16px, 2.2vmin, 20px); }
.pcard.p0 .pnum, .phud.p0 .pnum { background: var(--p0); }
.pcard.p1 .pnum, .phud.p1 .pnum { background: var(--p1); }
.pcard .pname { font-size: clamp(22px, 3.4vmin, 32px); color: #9aaabd; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .pstat { font-size: clamp(14px, 2vmin, 18px); color: #5a7290; font-weight: 700; }
.pcard.joined .pname { color: var(--ink); }
.pcard.p0.joined { border-color: var(--p0); }
.pcard.p1.joined { border-color: var(--p1); }
.pcard.ready .pstat { color: #1f9d55; }

/* 게임 중 HUD: 가운데 시간 + 좌우 플레이어 */
#hud { padding: 0; display: block; }
.hud-time { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); text-align: center; z-index: 2; min-width: 110px; }
.phuds { position: absolute; inset: 0; display: flex; }
.phud { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: max(12px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom)); min-width: 0; }
.phuds.two .phud.p0 { padding-right: 70px; }
.phuds.two .phud.p1 { padding-left: 70px; }
.phud-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.phuds.two .phud.p1 .phud-top { flex-direction: row-reverse; }
.ptag { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 16px; padding: 8px 14px; box-shadow: 0 3px 10px rgba(0,0,0,0.1); min-width: 0; }
.ptag .pnum { color: #fff; font-weight: 900; border-radius: 999px; padding: 2px 10px; font-size: 15px; }
.ptag .pname { font-size: clamp(20px, 3vmin, 28px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9em; }
.pmsg { align-self: center; font-size: clamp(20px, 3.4vmin, 30px); font-weight: 800; color: #fff; text-align: center; white-space: pre-line;
  text-shadow: 0 2px 0 #1d4f8c, 0 0 12px rgba(29, 79, 140, 0.6); padding: 0 10px; min-height: 1.4em; margin-top: 1vh; transition: opacity 0.25s; opacity: 0; }
.pmsg.gold { color: #fff3c4; text-shadow: 0 2px 0 #b06d00, 0 0 16px rgba(255, 179, 0, 0.9); }
.phud .pdot { position: absolute; top: 1px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; z-index: 1; }
.phud.p0 .pdot { background: var(--p0); }
.phud.p1 .pdot { background: var(--p1); }

/* 결과: 두 사람 나란히 */
.end-cols { display: flex; gap: 4vw; align-items: flex-end; }
.end-col { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--panel); border-radius: 24px; padding: 16px 28px;
  border: 5px solid #d5e1ee; min-width: clamp(200px, 28vmin, 340px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.end-col.p0 { border-color: var(--p0); }
.end-col.p1 { border-color: var(--p1); }
.end-col.win { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(255, 179, 0, 0.55), 0 10px 30px rgba(0,0,0,0.18); }
.end-col .crown { font-size: clamp(34px, 6vmin, 56px); height: 1.1em; }
.end-col .pname { font-size: clamp(24px, 3.8vmin, 36px); }
.end-col .end-mole { height: 20vh; width: auto; }
.end-col .big-cm { font-size: clamp(34px, 6vmin, 60px); font-weight: 900; color: var(--accent); }
.end-col .sub { font-size: clamp(14px, 2vmin, 18px); }

/* 컨트롤러: 이름 입력·나의 번호 */
.name-input { font: inherit; font-size: clamp(24px, 7vw, 30px); text-align: center; width: min(86vw, 360px); padding: 14px 16px; border-radius: 18px;
  border: 0; color: var(--ink); box-shadow: inset 0 2px 6px rgba(0,0,0,0.15); user-select: text; -webkit-user-select: text; }
.me-badge { display: inline-block; padding: 6px 18px; border-radius: 999px; font-weight: 900; font-size: clamp(18px, 5vw, 22px); background: rgba(255,255,255,0.2); }
.me-badge.p0 { background: var(--p0); box-shadow: 0 0 0 3px #fff; }
.me-badge.p1 { background: var(--p1); box-shadow: 0 0 0 3px #fff; }
.waitbox { background: rgba(255,255,255,0.18); border-radius: 18px; padding: 12px 16px; font-size: 18px; line-height: 1.5; max-width: 420px; }
.waitbox button { margin-top: 8px; }
.vs-line { font-size: clamp(18px, 5vw, 22px); margin: 0; opacity: 0.95; }

/* 가운데 위: 남은 시간 + 두 사람 크기 비교 */
.hud-center { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hud-center .hud-time { position: static; transform: none; }
.vsbar { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 18px; padding: 8px 14px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12); width: clamp(340px, 40vw, 620px); }
.vs-side { display: flex; flex-direction: column; align-items: center; min-width: 6.2em; line-height: 1.1; }
.vs-cm { font-size: clamp(24px, 3.6vmin, 38px); font-variant-numeric: tabular-nums; }
.vs-side.p0 .vs-cm { color: var(--p0); }
.vs-side.p1 .vs-cm { color: var(--p1); }
.vs-lead { font-size: clamp(14px, 2vmin, 19px); font-weight: 800; color: #d97a00; min-height: 1.2em; white-space: nowrap; }
.vs-side.leading .vs-cm { transform: scale(1.12); }
.vs-track { flex: 1; height: 22px; border-radius: 11px; background: var(--p1); overflow: hidden; position: relative; }
.vs-fill { display: block; height: 100%; width: 50%; background: var(--p0); transition: width 0.3s ease-out; }
.vs-track::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 3px; margin-left: -1.5px; background: #fff; }
.phuds.two .phud.p0 { padding-right: calc(clamp(340px, 40vw, 620px) / 2 + 16px); }
.phuds.two .phud.p1 { padding-left: calc(clamp(340px, 40vw, 620px) / 2 + 16px); }
/* 2인일 때는 크기를 가운데 비교 막대에서 크게 보여 주므로 양쪽 지름 칸은 숨긴다 */
.phuds.two .phud .phud-top .pill { display: none; }
.vs-name { font-size: clamp(15px, 2.2vmin, 20px); font-weight: 800; color: var(--ink); max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-cm { font-size: clamp(30px, 4.6vmin, 48px); }
.vs-lead { font-size: clamp(16px, 2.4vmin, 22px); }
.vsbar { width: clamp(400px, 46vw, 760px); padding: 10px 16px; }
.vs-track { height: 28px; border-radius: 14px; }
.phuds.two .phud.p0 { padding-right: calc(clamp(400px, 46vw, 760px) / 2 + 16px); }
.phuds.two .phud.p1 { padding-left: calc(clamp(400px, 46vw, 760px) / 2 + 16px); }

/* 결과: WIN / LOSE */
.end-col { transition: transform 0.6s cubic-bezier(.2,1.6,.4,1), filter 0.6s, opacity 0.6s; }
.end-col.win { transform: scale(1.12); animation: winPop 0.9s cubic-bezier(.2,1.5,.4,1); z-index: 1; }
@keyframes winPop { 0% { transform: scale(1); } 60% { transform: scale(1.18); } 100% { transform: scale(1.12); } }
.end-col.lose { transform: scale(0.94); filter: grayscale(0.7) brightness(0.62); }
.end-col .wl { font-size: clamp(40px, 7vmin, 72px); font-weight: 900; letter-spacing: 2px; line-height: 1; min-height: 1em; }
.end-col.win .wl { color: #ffb300; text-shadow: 0 3px 0 #b06d00, 0 0 22px rgba(255,179,0,0.75); animation: winGlow 1.2s ease-in-out infinite alternate; }
@keyframes winGlow { from { transform: scale(1); } to { transform: scale(1.08); } }
.end-col.lose .wl { color: #6b7a8c; }
.end-col .wl:empty { display: none; }

/* 전체 랭킹 */
#screen-rank { background: linear-gradient(rgba(234,246,255,0.6), rgba(255,255,255,0.9) 70%), url('assets/game/stadium.jpg') center / cover no-repeat; }
.rank-list { list-style: none; margin: 0; padding: 0; width: min(92vw, 760px); display: flex; flex-direction: column; gap: 6px; }
.rank-row { display: flex; align-items: center; gap: 14px; background: var(--panel); border-radius: 16px; padding: 8px 20px;
  font-size: clamp(18px, 2.8vmin, 28px); box-shadow: 0 3px 10px rgba(0,0,0,0.08); animation: rankIn 0.4s ease-out backwards; }
.rank-row:nth-child(1) { animation-delay: 0.05s; } .rank-row:nth-child(2) { animation-delay: 0.1s; } .rank-row:nth-child(3) { animation-delay: 0.15s; }
.rank-row:nth-child(4) { animation-delay: 0.2s; } .rank-row:nth-child(5) { animation-delay: 0.25s; } .rank-row:nth-child(6) { animation-delay: 0.3s; }
.rank-row:nth-child(7) { animation-delay: 0.35s; } .rank-row:nth-child(8) { animation-delay: 0.4s; } .rank-row:nth-child(9) { animation-delay: 0.45s; }
.rank-row:nth-child(10) { animation-delay: 0.5s; }
@keyframes rankIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.rank-row .rk { width: 3.2em; text-align: center; font-weight: 900; color: #5a7290; }
.rank-row.top1 .rk, .rank-row.top2 .rk, .rank-row.top3 .rk { font-size: 1.3em; }
.rank-row .nm { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .cm { font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.rank-row .new { font-size: 0.6em; font-weight: 800; color: #fff; background: #ffb300; border-radius: 999px; padding: 2px 10px; margin-right: auto; }
.rank-row.mine { border: 4px solid #ffb300; transform: scale(1.03); }
.rank-row.mine.p0 { border-color: var(--p0); } .rank-row.mine.p1 { border-color: var(--p1); }
.rank-row.mine.p0 .new { background: var(--p0); } .rank-row.mine.p1 .new { background: var(--p1); }
.rank-gap { text-align: center; font-size: 24px; color: #8aa0b8; line-height: 1; }
/* 랭킹: 화면 높이에 맞게 촘촘히 */
#screen-rank { gap: 1.2vh; padding-top: 2vh; padding-bottom: 2vh; }
#screen-rank h2 { font-size: clamp(26px, 5vh, 44px); }
#screen-rank .sub { font-size: clamp(14px, 2.2vh, 18px); }
#screen-rank .rank-list { gap: 0.7vh; }
#screen-rank .rank-row { padding: 0.6vh 20px; font-size: clamp(16px, 3.3vh, 28px); }
#screen-rank .rank-gap { font-size: 18px; }
#screen-rank .waiting { font-size: clamp(15px, 2.4vh, 22px); }
