/* ==========================================================
   개념루트 MATCH — Mobile First 스타일
   ========================================================== */
:root {
  --navy: #0b0d2b;
  --navy2: #151447;
  --purple: #2b1766;
  --cyan: #5ff0ff;
  --pink: #ff5fd2;
  --gold: #ffd34d;
  --gold2: #ffb21f;
  --text: #f4f6ff;
  --muted: #a9b0d8;
  --app-h: 100vh;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #05061a;
  color: var(--text);
  font-family: var(--font);
  overscroll-behavior: none;          /* 당겨 새로고침 방지 */
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  word-break: keep-all;               /* 한국어 단어 중간 줄바꿈 방지 */
  overflow-wrap: anywhere;
}
body { position: fixed; inset: 0; touch-action: none; }
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

#app {
  position: relative;
  width: 100%;
  height: var(--app-h);
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  background: radial-gradient(120% 70% at 50% 0%, #2e1a7a 0%, #17124f 40%, var(--navy) 100%);
  isolation: isolate;
}
/* PC: 스마트폰 세로 화면 크기로 제한 */
@media (min-width: 600px) and (min-height: 600px) {
  body { display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #1d1550, #05061a 70%); }
  #app { width: min(430px, calc(100vh * 0.47)); height: min(932px, calc(100vh - 32px)); border-radius: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08); }
}

/* ---------- 배경 ---------- */
.bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-glow { position: absolute; inset: -20%; background:
  radial-gradient(40% 30% at 15% 20%, rgba(95,240,255,.14), transparent 70%),
  radial-gradient(45% 35% at 90% 70%, rgba(255,95,210,.14), transparent 70%);
  animation: glowMove 12s ease-in-out infinite alternate; }
.bg-routes { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .35; }
.bg-routes path { fill: none; stroke: url(#none); stroke: rgba(140,170,255,.5); stroke-width: 1.4; stroke-dasharray: 6 10; animation: dash 18s linear infinite; }
.bg-routes path:nth-child(2) { stroke: rgba(255,120,220,.45); animation-duration: 24s; }
.bg-routes path:nth-child(3) { stroke: rgba(95,240,255,.4); animation-duration: 30s; }
@keyframes dash { to { stroke-dashoffset: -320; } }
@keyframes glowMove { to { transform: translate(4%, -3%) scale(1.05); } }
#app.fever .bg-glow { background:
  radial-gradient(50% 35% at 20% 25%, rgba(255,211,77,.35), transparent 70%),
  radial-gradient(50% 40% at 85% 75%, rgba(255,140,40,.3), transparent 70%);
  animation-duration: 2s; }
#app.fever::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  border-radius: inherit;
  box-shadow: inset 0 0 0 3px rgba(255,211,77,.9), inset 0 0 40px rgba(255,190,40,.55);
  animation: feverEdge .6s ease-in-out infinite alternate;
}
@keyframes feverEdge { from { opacity: .55; } to { opacity: 1; } }

/* ---------- 화면 전환 ---------- */
.screen { position: absolute; inset: 0; display: none; flex-direction: column;
  padding: calc(var(--sat) + 8px) calc(var(--sar) + 10px) calc(var(--sab) + 8px) calc(var(--sal) + 10px); }
.screen.active { display: flex; animation: screenIn .35s ease-out; }
@keyframes screenIn { from { opacity: 0; transform: scale(.985); } }

/* ---------- 로고 ---------- */
.logo { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: .95; letter-spacing: -0.02em; }
.logo-kr { font-weight: 900; font-size: clamp(40px, 13vw, 58px); color: #fff;
  text-shadow: 0 3px 0 #3b2aa8, 0 6px 0 #241679, 0 10px 24px rgba(0,0,0,.5); }
.logo-en { margin-top: 4px; font-weight: 900; font-size: clamp(30px, 10.5vw, 46px); letter-spacing: .14em; padding-left: .14em;
  background: linear-gradient(180deg, #fff 0%, #9ff8ff 35%, #34d6ff 60%, #ff6fd8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #2a1877) drop-shadow(0 0 14px rgba(95,240,255,.55)); }
.logo-sm .logo-kr { font-size: 34px; }
.logo-sm .logo-en { font-size: 26px; }

/* ---------- 로딩 ---------- */
#screen-loading { justify-content: center; align-items: center; }
.loading-box { width: 72%; text-align: center; }
.load-bar { margin: 26px auto 12px; height: 8px; border-radius: 8px; background: rgba(255,255,255,.12); overflow: hidden; }
.load-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--pink)); transition: width .2s; }
#load-msg { color: var(--muted); font-size: 13px; margin: 0; }

/* ---------- 버튼 ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 50px; padding: 0 18px; border-radius: 18px; font-size: 17px; font-weight: 800; letter-spacing: -.01em;
  transition: transform .08s, box-shadow .08s, filter .15s; position: relative; }
.btn:active { transform: translateY(4px); }
.btn-primary { color: #2a1400; background: linear-gradient(180deg, #ffe680 0%, #ffc727 55%, #ff9f1a 100%);
  box-shadow: 0 5px 0 #b45f00, 0 10px 24px rgba(255,170,30,.35), inset 0 2px 0 rgba(255,255,255,.7); }
.btn-primary:active { box-shadow: 0 1px 0 #b45f00, 0 4px 10px rgba(255,170,30,.3), inset 0 2px 0 rgba(255,255,255,.7); }
.btn-secondary { color: #fff; background: linear-gradient(180deg, #6b7dff 0%, #4a4fe0 100%);
  box-shadow: 0 5px 0 #262a9a, 0 8px 18px rgba(80,90,255,.3), inset 0 2px 0 rgba(255,255,255,.35); }
.btn-secondary:active { box-shadow: 0 1px 0 #262a9a, inset 0 2px 0 rgba(255,255,255,.35); }
.btn-ghost { color: #dfe4ff; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.22); }
.btn-xl { min-height: 60px; font-size: 22px; border-radius: 22px; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18), 0 3px 0 rgba(0,0,0,.35); }
.icon-btn svg { width: 20px; height: 20px; fill: #fff; }
.icon-btn:active { transform: translateY(2px); }
.promo-btn { display: block; text-align: center; margin-top: 10px; padding: 10px; border-radius: 14px; font-size: 14px; font-weight: 700;
  color: #9ff8ff; text-decoration: none; background: rgba(95,240,255,.08); box-shadow: inset 0 0 0 1px rgba(95,240,255,.35); }

/* ---------- 사운드 토글 ---------- */
.sound-toggles { display: flex; gap: 8px; }
.toggle { display: flex; align-items: center; gap: 5px; padding: 7px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.2); }
.toggle svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toggle svg path:first-child { fill: #fff; }
.toggle.off { opacity: .45; }
.toggle.off svg .wave { opacity: 0; }
.toggle.off::after { content: "OFF"; font-size: 10px; color: #ff9db8; }
.sound-toggles.stacked { justify-content: center; margin-bottom: 6px; }

/* ---------- 타이틀 ---------- */
#screen-title { align-items: stretch; }
.title-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.title-best { display: flex; flex-direction: column; line-height: 1.05; padding: 6px 12px; border-radius: 14px; background: rgba(0,0,0,.25); box-shadow: inset 0 0 0 1px rgba(255,211,77,.35); }
.title-best span { font-size: 10px; font-weight: 800; color: var(--gold); letter-spacing: .12em; }
.title-best strong { font-size: 18px; font-weight: 900; }
.title-visual { position: relative; flex: 1 1 auto; min-height: 150px; perspective: 700px; }
.float-book { position: absolute; width: var(--w); aspect-ratio: 0.7233; left: var(--x); top: var(--y);
  transform: translate(-50%, -50%) rotate(var(--r)); animation: floatBook var(--d) ease-in-out var(--delay) infinite alternate; filter: drop-shadow(0 14px 18px rgba(0,0,0,.45)); }
.float-book img { width: 100%; height: 100%; border-radius: 4px; display: block; box-shadow: 4px 4px 0 #e7e0cf, 5px 5px 0 #c9c0aa; }
@keyframes floatBook {
  from { transform: translate(-50%, -50%) rotate(var(--r)) translateY(-6px) rotateY(-8deg); }
  to   { transform: translate(-50%, -50%) rotate(calc(var(--r) * -0.4)) translateY(8px) rotateY(10deg); }
}
.title-main { text-align: center; margin-top: -4px; }
.slogan { margin: 14px 0 0; font-size: clamp(16px, 5vw, 20px); font-weight: 700; color: #d8dcff; }
.slogan b { color: #fff; font-weight: 900; background: linear-gradient(90deg, #9ff8ff, #ffb3ec); -webkit-background-clip: text; background-clip: text; color: transparent; }
.title-actions { display: flex; flex-direction: column; gap: 10px; margin-top: clamp(14px, 4vh, 30px); }
#btn-start { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { filter: brightness(1.1); transform: scale(1.02); } }

/* ---------- 게임 화면 ---------- */
#screen-game { padding: calc(var(--sat) + 4px) calc(var(--sar) + 6px) calc(var(--sab) + 6px) calc(var(--sal) + 6px); gap: 4px; }
.hud { flex: none; display: flex; flex-direction: column; gap: 4px; }
.hud-row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 38px; }
.hud-logo { display: flex; align-items: baseline; gap: 4px; }
.hud-logo .logo-kr { font-size: 17px; text-shadow: 0 2px 0 #3b2aa8; }
.hud-logo .logo-en { font-size: 14px; margin: 0; letter-spacing: .1em; filter: none; }
.hud-best { font-size: 11px; font-weight: 800; color: var(--gold); min-width: 38px; text-align: right; letter-spacing: .05em; }
.hud-best b { display: block; color: #fff; font-size: 13px; }
.hud-row2 { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.05)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.score-box { flex: 1 1 auto; min-width: 0; }
.score-box label { font-size: 10px; font-weight: 800; color: var(--muted); letter-spacing: .14em; }
#hud-score { font-size: clamp(24px, 8vw, 32px); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
#hud-score.bump { animation: bump .25s ease-out; }
@keyframes bump { 40% { transform: scale(1.12); color: var(--gold); } }
.combo-box { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.chip { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: rgba(0,0,0,.3); white-space: nowrap; }
.chip b { font-size: 13px; }
.chip.live { background: linear-gradient(90deg, #ff5fd2, #8f5bff); }
.chip-mult { color: #9ff8ff; }
.chip-mult.fever { color: #3a2200; background: linear-gradient(90deg, #ffe680, #ffb21f); }
.timer { position: relative; width: 50px; height: 50px; flex: none; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.t-bg { fill: rgba(0,0,0,.35); stroke: rgba(255,255,255,.12); stroke-width: 4; }
.t-fg { fill: none; stroke: var(--cyan); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 0; transition: stroke .3s; }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 19px; font-variant-numeric: tabular-nums; }
.timer.half .t-fg { stroke: #b6ff6f; }
.timer.half.pulse { animation: tpulse .6s ease-out 3; }
.timer.warn .t-fg { stroke: #ff4d6d; }
.timer.warn span { color: #ff7d94; }
.timer.warn.tick { animation: tpulse .35s ease-out; }
@keyframes tpulse { 40% { transform: scale(1.18); } }

.gauge { position: relative; padding: 0 2px; }
.gauge-head { display: flex; align-items: baseline; gap: 6px; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.gauge-title { color: #9ff8ff; }
.gauge-stage { color: #fff; font-size: 11px; letter-spacing: 0; }
.gauge-pct { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.gauge-bar { position: relative; height: 9px; margin-top: 3px; border-radius: 9px; background: rgba(0,0,0,.35); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); overflow: hidden; }
.gauge-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 9px;
  background: linear-gradient(90deg, #5ff0ff, #7d7bff 50%, #ff5fd2); transition: width .3s ease-out; box-shadow: 0 0 10px rgba(95,240,255,.6); }
.gauge-bar em { position: absolute; top: 1px; bottom: 1px; width: 1.5px; background: rgba(255,255,255,.3); }
.gauge-steps { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); margin-top: 2px; font-weight: 700; }
.gauge.full .gauge-bar i { background: linear-gradient(90deg, #ffe680, #ffb21f, #ffe680); background-size: 200% 100%; animation: shimmer 1s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skill-btn { position: absolute; right: 0; top: -2px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 900; color: #2a1400;
  background: linear-gradient(180deg, #ffe680, #ffb21f); box-shadow: 0 3px 0 #b45f00, 0 0 16px rgba(255,211,77,.7); animation: breathe 1s infinite; }

.board-wrap { position: relative; flex: 1 1 auto; min-height: 0; }
#board { position: absolute; inset: 0; display: block; touch-action: none; }
.combo-pop { position: absolute; left: 50%; top: 4%; transform: translateX(-50%); pointer-events: none; text-align: center; opacity: 0; z-index: 3; }
.combo-pop b { display: block; font-size: clamp(30px, 10vw, 42px); font-weight: 900; font-style: italic; letter-spacing: -.02em;
  background: linear-gradient(180deg, #fff, #9ff8ff 60%, #5f8bff); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #1d1060) drop-shadow(0 0 10px rgba(95,240,255,.6)); }
.combo-pop span { display: block; font-size: clamp(20px, 7vw, 28px); font-weight: 900; color: #fff; -webkit-text-stroke: 1px rgba(40,10,90,.6);
  text-shadow: 0 3px 0 #ff2fb0, 0 0 14px rgba(255,95,210,.7); }
.combo-pop.show { animation: comboIn .5s cubic-bezier(.2,1.6,.4,1) forwards; }
.combo-pop.hide { animation: comboOut .35s ease-in forwards; }
.combo-pop.lv-legend b { background: linear-gradient(180deg, #fff6c8, #ffd34d 55%, #ff9f1a); -webkit-background-clip: text; background-clip: text; }
.combo-pop.lv-legend span { text-shadow: 0 3px 0 #b45f00, 0 0 18px rgba(255,211,77,.9); }
@keyframes comboIn { from { opacity: 0; transform: translateX(-50%) scale(.4); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes comboOut { from { opacity: 1; } to { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(.9); } }
.fever-chip { position: absolute; right: 6px; bottom: 6px; z-index: 3; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 900; color: #3a2200;
  background: linear-gradient(180deg, #fff1a6, #ffc21f); box-shadow: 0 0 16px rgba(255,211,77,.9); opacity: 0; transform: scale(.6); transition: opacity .2s, transform .2s; pointer-events: none; }
.fever-chip.on { opacity: 1; transform: scale(1); animation: breathe .5s infinite; }
.item-guide { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 7px 8px 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; background: rgba(20,14,60,.92); box-shadow: 0 0 0 1.5px var(--gold), 0 6px 20px rgba(0,0,0,.4); }
.item-guide button { padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: rgba(255,255,255,.15); }

.items { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.item { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; height: clamp(50px, 7.4vh, 62px); border-radius: 16px; font-size: 13px; font-weight: 800;
  background: linear-gradient(180deg, #3b3496 0%, #2a226f 100%); box-shadow: 0 4px 0 #160f4a, inset 0 1.5px 0 rgba(255,255,255,.25), inset 0 0 0 1px rgba(255,255,255,.1); }
.item svg { width: clamp(24px, 7vw, 32px); height: clamp(24px, 7vw, 32px); flex: none; }
.item:active { transform: translateY(3px); box-shadow: 0 1px 0 #160f4a, inset 0 1.5px 0 rgba(255,255,255,.25); }
.item .count { position: absolute; top: -6px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px;
  font-size: 12px; font-weight: 900; color: #2a1400; background: linear-gradient(180deg, #ffe680, #ffb21f); box-shadow: 0 2px 0 #b45f00; }
.item.active { background: linear-gradient(180deg, #ffd34d, #ff9f1a); color: #2a1400; box-shadow: 0 4px 0 #b45f00, 0 0 18px rgba(255,211,77,.7); }
.item:disabled { filter: grayscale(1) brightness(.6); }
.item:disabled .count { background: #555; color: #ddd; box-shadow: none; }

/* ---------- 오버레이 ---------- */
.overlay { position: absolute; inset: 0; z-index: 20; pointer-events: none; display: grid; place-items: center; opacity: 0; visibility: hidden; }
.overlay.on { opacity: 1; visibility: visible; }
.countdown { background: rgba(6,6,30,.45); pointer-events: none; }  /* V1.1: 카운트다운 중에도 일시정지 버튼 사용 가능 */
.countdown b { font-size: 120px; font-weight: 900; color: #fff; text-shadow: 0 6px 0 #3b2aa8, 0 0 40px rgba(95,240,255,.8); }
.countdown b.go { font-size: 74px; background: linear-gradient(180deg, #fff6c8, #ffd34d 55%, #ff9f1a); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 5px 0 #b45f00) drop-shadow(0 0 20px rgba(255,211,77,.8)); }
.countdown b.pop { animation: cd .7s cubic-bezier(.2,1.5,.4,1); }
@keyframes cd { from { transform: scale(2.2); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }

/* 5 COMBO 브랜드 시그니처 */
.brand { overflow: hidden; }
.brand.on { transition: opacity .1s; }
.brand.out { opacity: 0; transition: opacity var(--fade, .35s) ease-out; }
.brand-rays { position: absolute; left: 50%; top: 46%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255,225,120,.22) 0deg 7deg, transparent 7deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 45%); mask: radial-gradient(circle, #000 0%, transparent 45%); }
.brand.s-fx .brand-rays { opacity: 1; animation: spin 6s linear infinite; transition: opacity .25s; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-books { position: absolute; inset: 0; }
.brand-books img { position: absolute; width: 17%; aspect-ratio: .7233; border-radius: 3px; opacity: 0; box-shadow: 3px 3px 0 #e7e0cf, 0 10px 20px rgba(0,0,0,.5); }
.brand.s-fx .brand-books img { animation: bookFly .55s cubic-bezier(.2,1.2,.4,1) forwards; }
.brand.out .brand-books img { animation: bookOut var(--fade, .3s) ease-in forwards; }
@keyframes bookOut { from { opacity: 1; transform: rotate(var(--rot)) scale(1); } to { opacity: 0; transform: translate(var(--fx), var(--fy)) rotate(calc(var(--rot) * 2)) scale(.6); } }
/* 슬로건 빛 반사 */
.b-main::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%); background-size: 250% 100%; background-position: 120% 0; }
.brand.s-main .b-main::after { animation: shine .6s ease-out .15s forwards; }
@keyframes shine { to { background-position: -60% 0; } }
@keyframes bookFly {
  from { opacity: 0; transform: translate(var(--fx), var(--fy)) rotate(calc(var(--rot) * 3)) scale(.3); }
  to   { opacity: 1; transform: translate(0, 0) rotate(var(--rot)) scale(1); }
}
.brand-stack { position: relative; text-align: center; padding: 18px 10px 22px; width: 100%;
  /* 슬로건 가독성: 문구 뒤에만 어두운 타원 배경 */
  background: radial-gradient(60% 55% at 50% 52%, rgba(8,4,34,.82), rgba(8,4,34,.55) 55%, transparent 80%); }
.brand-stack > div { opacity: 0; transform: scale(.5); }
.b-combo { font-size: 64px; white-space: nowrap; font-weight: 900; font-style: italic; letter-spacing: -.02em; line-height: 1;
  background: linear-gradient(180deg, #fffbe0 0%, #ffe14d 40%, #ffae00 70%, #ff7a00 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #8a3c00) drop-shadow(0 0 22px rgba(255,200,40,.9)); }
.b-q { margin-top: 10px; font-size: 36px; white-space: nowrap; font-weight: 900; color: #fff; text-shadow: 0 3px 0 #3b2aa8, 0 0 16px rgba(95,240,255,.8); }
.b-main { position: relative; margin: 6px auto 0; display: inline-block; padding: .2em .4em .25em; border-radius: .45em;
  font-size: 40px; font-weight: 900; letter-spacing: -.03em; color: #fff; white-space: nowrap; max-width: 100%;
  text-shadow: 0 2px 0 rgba(40,0,60,.55);
  background: linear-gradient(90deg, #6a3cff, #ff3fb4); box-shadow: 0 6px 0 #3a137a, 0 0 0 3px #fff, 0 0 34px rgba(255,95,210,.8); }
.b-fever { margin-top: 14px; font-size: 44px; white-space: nowrap; font-weight: 900; font-style: italic; letter-spacing: .02em;
  background: linear-gradient(90deg, #ffe14d, #fff, #ffe14d); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #b45f00) drop-shadow(0 0 14px rgba(255,211,77,.9)); animation: shimmer .8s linear infinite; }
.brand.s-combo .b-combo, .brand.s-q .b-q, .brand.s-main .b-main, .brand.s-fever .b-fever { animation: popIn .3s cubic-bezier(.2,1.7,.4,1) forwards; }
.brand.s-main .b-main { position: relative; animation: popMain .36s cubic-bezier(.2,1.7,.4,1) forwards; }
@keyframes popIn { from { opacity: 0; transform: scale(2); } to { opacity: 1; transform: scale(1); } }
@keyframes popMain { from { opacity: 0; transform: scale(.3) rotate(-6deg); } 70% { transform: scale(1.08) rotate(1deg); } to { opacity: 1; transform: scale(1) rotate(-2deg); } }
.brand::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(255,240,180,.55), transparent 60%); opacity: 0; }
.brand.s-fx::before { animation: flashBg .6s ease-out forwards; }
@keyframes flashBg { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: .35; } }
#app.paused .brand *, #app.paused .brand, #app.paused .brand::before { animation-play-state: paused !important; }

.banner .banner-inner { text-align: center; }
.banner b { display: block; font-size: clamp(38px, 13vw, 56px); font-weight: 900; font-style: italic; color: #fff; text-shadow: 0 5px 0 #3b2aa8, 0 0 26px rgba(95,240,255,.8); }
.banner span { display: block; margin-top: 6px; font-size: 18px; font-weight: 800; color: #dfe4ff; }
.banner.route b { background: linear-gradient(180deg, #fff, #c8ffd8 50%, #4fe39a); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 4px 0 #0b5a37) drop-shadow(0 0 18px rgba(80,230,150,.8)); }
.banner.over b { background: linear-gradient(180deg, #fff, #ffb3c4 50%, #ff4d6d); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 5px 0 #6a0f2a) drop-shadow(0 0 20px rgba(255,77,109,.8)); }
.banner.on .banner-inner { animation: popIn .45s cubic-bezier(.2,1.6,.4,1); }
.banner.on { background: rgba(6,6,30,.35); }

.toast { position: absolute; left: 50%; top: 32%; z-index: 21; transform: translate(-50%, -10px); padding: 10px 16px; border-radius: 14px; max-width: 86%;
  font-size: 14px; font-weight: 800; text-align: center; background: rgba(20,14,60,.94); box-shadow: 0 0 0 1.5px rgba(95,240,255,.6), 0 10px 30px rgba(0,0,0,.45);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { box-shadow: 0 0 0 1.5px #ff7d94, 0 10px 30px rgba(0,0,0,.45); }

/* ---------- 모달 ---------- */
.modal { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--sat) + 14px) 16px calc(var(--sab) + 14px); background: rgba(4,4,20,.7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 360px; max-height: 100%; overflow-y: auto; touch-action: pan-y; padding: 22px 18px 18px; border-radius: 24px; display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(180deg, #2b2283, #1a1458); box-shadow: 0 0 0 1.5px rgba(255,255,255,.15), 0 20px 50px rgba(0,0,0,.5); animation: popIn .3s cubic-bezier(.2,1.4,.4,1); }
.modal-card h2 { margin: 0 0 4px; text-align: center; font-size: 22px; font-weight: 900; }
.modal-sub { margin: -4px 0 4px; text-align: center; font-size: 13px; color: var(--muted); }
.pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 8px; margin-bottom: 4px; }
.pick-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border-radius: 12px; background: rgba(255,255,255,.06); }
.pick-grid button:active { background: rgba(255,211,77,.3); }
.pick-grid img { width: 100%; max-width: 62px; aspect-ratio: .7233; border-radius: 3px; box-shadow: 2px 2px 0 #e7e0cf, 0 6px 12px rgba(0,0,0,.4); }
.pick-grid span { font-size: 11px; font-weight: 800; }
.pick-grid small { font-size: 10px; color: var(--gold); font-weight: 800; }

.howto-card h2 { margin-bottom: 2px; }
.howto { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.45; color: #e3e6ff; }
.howto b { color: #fff; }
.hl { color: var(--gold); font-weight: 900; }
.howto-specials { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.howto-specials > div { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 8px; border-radius: 12px; background: rgba(255,255,255,.06); }
.howto-specials b { font-size: 12.5px; }
.howto-specials span { grid-column: 2; font-size: 11px; color: var(--muted); line-height: 1.3; }
.sp { grid-row: span 2; width: 26px; height: 34px; border-radius: 4px; display: grid; place-items: center; font-style: normal; font-weight: 900; font-size: 16px; background: #3878b8; }
.sp-missile { box-shadow: 0 0 0 2px #8ff6ff, 0 0 10px #5ff0ff; background: linear-gradient(90deg, transparent 40%, rgba(255,255,255,.7) 50%, transparent 60%), #00a0b0; }
.sp-bomb { box-shadow: 0 0 0 2px #ffa64d, 0 0 10px #ff7a2e; background: radial-gradient(circle at 50% 50%, #1b1b2e 30%, transparent 32%), #f06060; }
.sp-rainbow { color: #fff; background: linear-gradient(135deg, #ff5f5f, #ffd34d, #5fff9f, #5ff0ff, #a35fff); box-shadow: 0 0 10px rgba(255,255,255,.6); }
.sp-brick { color: #ff5a6e; background: repeating-linear-gradient(0deg, #8d93a4 0 6px, #4a4f60 6px 7px); }
.sp-lock { color: #3a2600; background: #ffc21f; box-shadow: inset 0 0 0 3px #8050a0; }
.sp-gauge { background: linear-gradient(0deg, #ff5fd2, #7d7bff, #5ff0ff); }

/* ---------- 결과 ---------- */
#screen-result { padding-left: calc(var(--sal) + 12px); padding-right: calc(var(--sar) + 12px); }
.result-scroll { flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; display: flex; flex-direction: column; }
/* 화면보다 길 때 위가 잘리지 않도록: 남는 공간이 있을 때만 가운데 정렬 */
.result-scroll::before, .result-scroll::after { content: ""; flex: 1 1 0; }
.result-card { margin: 0; display: flex; flex-direction: column; gap: 10px; padding: 18px 14px 16px; border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.05)); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.14); }
.result-head { text-align: center; font-size: 15px; font-weight: 900; letter-spacing: .3em; color: #9ff8ff; }
.new-record { align-self: center; padding: 6px 16px; border-radius: 999px; font-size: 18px; font-weight: 900; font-style: italic; color: #3a2200;
  background: linear-gradient(90deg, #ffe680, #ffb21f, #ffe680); background-size: 200% 100%; box-shadow: 0 4px 0 #b45f00, 0 0 24px rgba(255,211,77,.9); animation: shimmer 1s linear infinite, recordIn .6s cubic-bezier(.2,1.6,.4,1); }
@keyframes recordIn { from { transform: scale(0) rotate(-12deg); } }
.final-score { text-align: center; }
.final-score label { display: block; font-size: 12px; color: var(--muted); font-weight: 800; }
.final-score strong { display: block; font-size: clamp(44px, 15vw, 60px); line-height: 1.05; font-weight: 900; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, #ffe680 60%, #ffb21f); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #5a2a00); }
.best-line { text-align: center; font-size: 13px; color: var(--muted); margin-top: -4px; }
.best-line b { color: #fff; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stat-grid > div { padding: 8px 4px; border-radius: 12px; text-align: center; background: rgba(0,0,0,.25); }
.stat-grid label { display: block; font-size: 10.5px; color: var(--muted); font-weight: 700; }
.stat-grid b { font-size: 19px; font-weight: 900; }
.book-stats-title { font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: -4px; }
.book-stats { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.book-stats div { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.book-stats img { width: 100%; aspect-ratio: .7233; border-radius: 2px; box-shadow: 2px 2px 0 #e7e0cf, 0 4px 8px rgba(0,0,0,.4); }
.book-stats b { font-size: 13px; font-weight: 900; }
.book-stats small { font-size: 9px; color: var(--muted); white-space: nowrap; }
.result-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.result-actions .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------- 가로 화면 안내 ---------- */
.rotate-overlay { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; text-align: center;
  background: radial-gradient(circle at 50% 40%, #2e1a7a, #0b0d2b 70%); }
.rotate-overlay p { margin: 0; font-size: 19px; font-weight: 900; line-height: 1.4; }
.rotate-phone { width: 46px; height: 78px; border-radius: 10px; border: 4px solid #fff; position: relative; animation: rotPhone 1.8s ease-in-out infinite; }
.rotate-phone::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 10px; height: 3px; margin-left: -5px; border-radius: 2px; background: #fff; }
@keyframes rotPhone { 0%, 20% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0deg); } }

/* ---------- 작은 화면 (320×568 등) ---------- */
@media (max-height: 640px) {
  .hud-row1 { height: 32px; }
  .icon-btn { width: 32px; height: 32px; }
  .hud-row2 { padding: 4px 6px 4px 10px; }
  .timer { width: 42px; height: 42px; }
  .timer span { font-size: 16px; }
  .gauge-steps { display: none; }
  .items { gap: 6px; }
  .item { height: 46px; font-size: 12px; gap: 4px; }
  .title-visual { min-height: 110px; }
  .logo-kr { font-size: 38px; }
  .logo-en { font-size: 28px; }
  .btn-xl { min-height: 52px; font-size: 19px; }
  .btn { min-height: 44px; }
}
@media (max-width: 340px) {
  .item span { display: none; }
  .hud-logo .logo-kr { font-size: 15px; }
  .hud-logo .logo-en { font-size: 11px; letter-spacing: .06em; }
  .stat-grid b { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-routes path, .bg-glow, .float-book { animation: none !important; }
}

/* ==========================================================
   V1.1 — 튜토리얼
   ========================================================== */
.tutorial { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.tutorial > * { pointer-events: auto; }
.tut-skip { position: absolute; right: 4px; top: 4px; z-index: 2; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 800;
  background: rgba(10,8,40,.8); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.3); }
.tut-bubble { position: absolute; left: 8px; right: 8px; top: 8%; padding: 14px 14px 12px; border-radius: 18px; text-align: center;
  background: linear-gradient(180deg, rgba(43,34,131,.97), rgba(26,20,88,.97)); box-shadow: 0 0 0 2px var(--gold), 0 14px 34px rgba(0,0,0,.5); }
.tut-bubble.pop { animation: popIn .32s cubic-bezier(.2,1.5,.4,1); }
.tut-step { display: block; font-style: normal; font-size: 10px; font-weight: 900; letter-spacing: .2em; color: var(--gold); margin-bottom: 4px; }
.tut-bubble b { display: block; font-size: clamp(19px, 6vw, 24px); font-weight: 900; line-height: 1.25; }
.tut-bubble span { display: block; margin-top: 6px; font-size: 13.5px; line-height: 1.45; color: #dfe4ff; }
.tut-next { margin-top: 10px; min-height: 44px; }
.tut-finger { position: absolute; width: 46px; height: 46px; margin: -6px 0 0 -14px; pointer-events: none !important; z-index: 3;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); animation: fingerSwipe 1.3s ease-in-out infinite; }
.tut-finger svg { width: 100%; height: 100%; }
@keyframes fingerSwipe {
  0% { transform: translate(0, 0) scale(1); opacity: 0; }
  12% { opacity: 1; transform: translate(0, 0) scale(.88); }
  60% { transform: translate(var(--dx), var(--dy)) scale(.88); opacity: 1; }
  80%, 100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; }
}
.tut-finger.nudge { animation: fingerSwipe 1.3s ease-in-out infinite, nudge .3s; }
@keyframes nudge { 30% { margin-left: -20px; } 60% { margin-left: -8px; } }
.tut-card { position: absolute; left: 8px; right: 8px; top: 50%; transform: translateY(-50%); padding: 18px 14px 16px; border-radius: 22px; text-align: center;
  display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(180deg, #2b2283, #1a1458); box-shadow: 0 0 0 2px var(--gold), 0 20px 50px rgba(0,0,0,.55); animation: popIn .3s cubic-bezier(.2,1.4,.4,1); }
.tut-card h3 { margin: 0; font-size: 21px; font-weight: 900; }
.tut-specials { display: grid; gap: 6px; }
.tut-specials > div { display: grid; grid-template-columns: 30px auto 1fr; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: rgba(255,255,255,.07); text-align: left; }
.tut-specials .sp { grid-row: auto; }
.tut-specials b { font-size: 13.5px; }
.tut-specials span { font-size: 12px; color: var(--muted); text-align: right; }
.tut-fever { margin: 0; font-size: 14px; }
#app.tutorial .items { opacity: .35; pointer-events: none; }
#app.tutorial .timer span { font-size: 0; }
#app.tutorial .timer span::after { content: "연습"; font-size: 13px; }
#app.tutorial .gauge { opacity: .5; }

/* ==========================================================
   V1.1 — 개발자 테스트 모드
   ========================================================== */
.dev-panel { margin-top: 10px; padding: 10px; border-radius: 14px; font-size: 12px; background: rgba(0,0,0,.4); box-shadow: inset 0 0 0 1px rgba(95,240,255,.4); max-height: 40vh; overflow-y: auto; touch-action: pan-y; }
.dev-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.dev-head b { color: var(--cyan); }
.dev-head span { color: var(--muted); }
.dev-boards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dev-boards button, .dev-sim { padding: 9px; border-radius: 10px; font-weight: 800; background: rgba(255,255,255,.08); }
.dev-boards button.on { background: var(--cyan); color: #072030; }
.dev-sim { width: 100%; margin-top: 8px; background: rgba(95,240,255,.15); }
.dev-layout, .dev-sim-out { margin-top: 8px; }
.dev-panel table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.dev-panel th, .dev-panel td { padding: 4px; border-bottom: 1px solid rgba(255,255,255,.1); text-align: right; }
.dev-panel th:first-child, .dev-panel td:first-child { text-align: left; color: var(--muted); font-weight: 600; }
#app.tutorial .combo-pop { top: 42%; }

/* V1.1 — 주소창이 보이는 낮은 화면: 상단 정보·아이템·결과 화면을 촘촘하게 → 퍼즐판 확보 */
@media (max-height: 720px) {
  #screen-game { gap: 3px; }
  .hud { gap: 3px; }
  .hud-row1 { height: 30px; }
  .icon-btn { width: 30px; height: 30px; border-radius: 10px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .hud-row2 { padding: 3px 6px 3px 10px; border-radius: 13px; }
  .score-box label { display: none; }
  #hud-score { font-size: 24px; }
  .timer { width: 40px; height: 40px; }
  .timer span { font-size: 15px; }
  .gauge-steps { display: none; }
  .gauge-bar { height: 7px; margin-top: 2px; }
  .item { height: 44px; border-radius: 13px; }
  .item svg { width: 24px; height: 24px; }
  .result-card { gap: 7px; padding: 12px 12px; }
  .final-score strong { font-size: 40px; }
  .stat-grid > div { padding: 5px 4px; }
  .stat-grid b { font-size: 16px; }
  .result-actions { gap: 7px; }
  .result-actions .btn-xl { min-height: 50px; font-size: 19px; }
  .howto { font-size: 13px; gap: 5px; }
  .howto-specials > div { padding: 6px; }
  .modal-card { padding: 16px 14px 14px; gap: 8px; }
}
@media (max-height: 520px) {
  .book-stats small { display: none; }
  .new-record { font-size: 15px; padding: 4px 12px; }
  .final-score strong { font-size: 34px; }
}

/* ==========================================================
   V2 — 온라인 랭킹
   ========================================================== */
.title-row, .row.title-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.profile-chip { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 800; color: #e8ebff; background: rgba(0,0,0,.28); box-shadow: inset 0 0 0 1.5px rgba(95,240,255,.35); max-width: 100%; }
.profile-chip b { color: #fff; }
.profile-chip small { color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.profile-chip .edit { color: var(--cyan); font-size: 12px; flex: none; }
.profile-chip.cta { color: #2a1400; background: linear-gradient(90deg, #9ff8ff, #ffd34d); box-shadow: none; }

/* 결과 화면 — 서버 검증·순위 */
.online-box { padding: 10px 12px; border-radius: 16px; background: rgba(0,0,0,.28); box-shadow: inset 0 0 0 1.5px rgba(95,240,255,.35); font-size: 13px; line-height: 1.45; text-align: center; }
.online-box.warn { box-shadow: inset 0 0 0 1.5px rgba(255,125,148,.6); }
.online-box.muted { box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); color: var(--muted); }
.online-box .ob-title { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 900; color: #9ff8ff; font-size: 13px; }
.online-box.warn .ob-title { color: #ff9db8; }
.online-box .ob-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ob-ranks { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; margin-top: 8px; }
.ob-ranks > div { padding: 6px 2px; border-radius: 10px; background: rgba(255,255,255,.07); }
.ob-ranks label { display: block; font-size: 10.5px; color: var(--muted); font-weight: 700; }
.ob-ranks b { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.ob-ranks b small { font-size: 11px; font-weight: 800; margin-left: 1px; }
.online-box .btn { margin-top: 8px; min-height: 42px; font-size: 15px; }
.spinner, .net-busy i { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.25); border-top-color: var(--cyan); animation: spin .8s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.net-busy { position: absolute; left: 50%; bottom: calc(var(--sab) + 26px); transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 800; background: rgba(20,14,60,.95); box-shadow: 0 0 0 1.5px rgba(95,240,255,.5), 0 10px 30px rgba(0,0,0,.5); }
.net-badge { position: absolute; top: 0; left: 50%; transform: translate(-50%, -2px); z-index: 4; padding: 2px 9px; border-radius: 0 0 9px 9px; font-size: 10.5px; font-weight: 800;
  color: var(--muted); background: rgba(0,0,0,.45); pointer-events: none; }

/* 랭킹 화면 */
#screen-rank { gap: 8px; }
.rank-head { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; }
.rank-head h2 { margin: 0; text-align: center; font-size: 21px; font-weight: 900; }
.rank-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rank-tabs button { min-height: 38px; border-radius: 12px; font-size: 13.5px; font-weight: 800; color: #dfe4ff; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.rank-tabs button.on { color: #2a1400; background: linear-gradient(180deg, #ffe680, #ffc727); box-shadow: 0 3px 0 #b45f00; }
.rank-note { margin: 0; text-align: center; font-size: 12px; color: var(--muted); min-height: 1.4em; }
.rank-body { flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; border-radius: 16px; background: rgba(0,0,0,.22); }
.rank-list { list-style: none; margin: 0; padding: 4px 0; }
.rank-list li, .rank-me { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 8px; padding: 8px 12px; min-height: 48px; }
.rank-list li + li { border-top: 1px solid rgba(255,255,255,.06); }
.rank-list li.me, .rank-me { background: linear-gradient(90deg, rgba(95,240,255,.18), rgba(255,95,210,.12)); }
.rk { text-align: center; font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; color: #dfe4ff; }
.rk.top1, .rk.top2, .rk.top3 { width: 30px; height: 30px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 15px; color: #2a1400; }
.rk.top1 { background: linear-gradient(180deg, #fff2a8, #ffc727); box-shadow: 0 0 12px rgba(255,211,77,.6); }
.rk.top2 { background: linear-gradient(180deg, #fff, #c3cbe6); }
.rk.top3 { background: linear-gradient(180deg, #ffd2a8, #d78a4a); }
.who { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.who b { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pts { text-align: right; font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
.pts small { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.rank-me { border-radius: 14px; box-shadow: inset 0 0 0 1.5px rgba(95,240,255,.55); }
.rank-empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
.rank-empty b { display: block; color: #fff; font-size: 16px; margin-bottom: 4px; }
.rank-empty .btn { margin: 14px auto 0; max-width: 240px; min-height: 44px; font-size: 15px; }
.rank-foot { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.rank-foot .profile-chip { justify-content: flex-start; min-width: 0; }
.rank-foot .btn { width: auto; padding: 0 18px; min-height: 44px; font-size: 16px; }

/* 닉네임·학교 등록 */
.profile-card { max-width: 380px; }
.profile-card > * { flex: none; }   /* 작은 화면: 검색 결과 목록이 찌그러지지 않고 카드가 스크롤되도록 */
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 800; color: #dfe4ff; }
.field em { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 4px; }
.field input { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 0; outline: none; font: inherit; font-size: 16px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,.35); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.2); -webkit-user-select: text; user-select: text; touch-action: manipulation; }
.field input:focus { box-shadow: inset 0 0 0 2px var(--cyan); }
.field input::placeholder { color: rgba(220,224,255,.45); font-weight: 600; }
.school-results { list-style: none; margin: -4px 0 0; padding: 4px; border-radius: 12px; background: rgba(0,0,0,.35); max-height: 180px; overflow-y: auto; touch-action: pan-y; }
.school-results li button { width: 100%; display: flex; flex-direction: column; align-items: flex-start; padding: 8px 10px; border-radius: 9px; text-align: left; }
.school-results li button:active, .school-results li button:focus-visible { background: rgba(95,240,255,.18); }
.school-results li b { font-size: 14px; }
.school-results li small { font-size: 11.5px; color: var(--muted); }
.school-results .msg { padding: 10px; font-size: 12.5px; color: var(--muted); text-align: center; }
.school-picked { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: -4px; padding: 8px 10px 8px 12px; border-radius: 12px;
  background: rgba(95,240,255,.14); box-shadow: inset 0 0 0 1.5px rgba(95,240,255,.5); }
.school-picked div { display: flex; flex-direction: column; min-width: 0; }
.school-picked b { font-size: 14px; } .school-picked small { font-size: 11.5px; color: var(--muted); }
.school-picked button { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.1); font-weight: 900; flex: none; }
.privacy-note { margin: 2px 0 0; padding: 10px 12px 10px 26px; border-radius: 12px; font-size: 11.5px; line-height: 1.5; color: #c9cff5; background: rgba(255,255,255,.05); }
.privacy-note b { color: var(--gold); }
.pf-error { margin: 0; min-height: 1.2em; text-align: center; font-size: 13px; font-weight: 800; color: #ff9db8; }
.pf-error:empty { min-height: 0; }
.link-btn { align-self: center; padding: 6px 10px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-decoration: underline; }
.link-btn.danger { color: #ff9db8; }

@media (max-height: 720px) {
  .title-actions { gap: 8px; }
  .profile-chip { min-height: 32px; padding: 4px 10px; }
  .rank-tabs button { min-height: 34px; }
  .rank-list li, .rank-me { min-height: 42px; padding: 6px 10px; }
  .online-box { padding: 8px 10px; }
  .ob-ranks { margin-top: 6px; }
  .privacy-note { font-size: 11px; }
}
/* V2.1 — 지난 기록 재전송 알림 */
.app-notice { position: absolute; left: 50%; top: calc(var(--sat) + 58px); transform: translate(-50%, -12px); z-index: 45; max-width: 90%; padding: 10px 16px; border-radius: 14px;
  font-size: 13px; font-weight: 800; line-height: 1.4; text-align: center; background: rgba(20,14,60,.96); box-shadow: 0 0 0 1.5px rgba(95,240,255,.55), 0 10px 30px rgba(0,0,0,.5);
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; }
.app-notice.on { opacity: 1; transform: translate(-50%, 0); }
.app-notice.warn { box-shadow: 0 0 0 1.5px #ff7d94, 0 10px 30px rgba(0,0,0,.5); }
.policy { font-size: 11.5px; color: #c9cff5; border-radius: 12px; background: rgba(255,255,255,.05); padding: 8px 12px; }
.policy summary { font-weight: 800; cursor: pointer; color: #dfe4ff; }
.policy dl { margin: 8px 0 2px; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; line-height: 1.45; }
.policy dt { font-weight: 800; color: #fff; } .policy dd { margin: 0; }
.rank-list li[data-report] { cursor: pointer; }
.rank-list li.hidden-nick .who b { color: var(--muted); font-style: italic; }
.report-card { max-width: 360px; }
.report-card > * { flex: none; }
.report-reasons { display: grid; gap: 8px; }
.report-reasons .btn { min-height: 44px; font-size: 14.5px; }
.rp-msg { margin: 0; text-align: center; font-size: 13px; font-weight: 800; color: #9ff8ff; min-height: 1.2em; }
.rp-note { display: block; text-align: center; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
