* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b1020; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  color: #fff;
}
#game-root { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }

#progress-wrap {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  width: min(70%, 460px); height: 14px; border-radius: 10px;
  background: rgba(0,0,0,.35); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
  overflow: visible;
}
#progress-bar {
  height: 100%; width: 0%; border-radius: 10px;
  background: linear-gradient(90deg, #4be1ff, #7b6bff);
  transition: width .15s linear;
}
#progress-flag { position: absolute; right: -10px; top: -8px; font-size: 22px; }

#count-badge {
  position: absolute; top: 46px; left: 50%; transform: translateX(-50%);
  background: rgba(8,14,34,.55); border: 2px solid rgba(120,200,255,.6);
  padding: 6px 20px; border-radius: 999px; backdrop-filter: blur(6px);
  font-weight: 800; font-size: 30px; letter-spacing: 1px;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
#count-value { color: #9be7ff; }

#combo-toast {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.6);
  font-size: 56px; font-weight: 900; opacity: 0; text-shadow: 0 4px 18px rgba(0,0,0,.5);
}
#combo-toast.show { animation: pop .7s ease-out; }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  25% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1); }
}

/* ---------- Screens ---------- */
.screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, rgba(40,60,140,.35), rgba(6,9,22,.85));
  backdrop-filter: blur(3px); z-index: 5;
}
.panel {
  text-align: center; padding: 34px 30px; border-radius: 24px; width: min(86%, 420px);
  background: linear-gradient(180deg, rgba(28,38,80,.92), rgba(14,20,46,.95));
  box-shadow: 0 24px 60px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,255,255,.08);
}
.panel h1 {
  font-size: 40px; line-height: .98; font-weight: 900; letter-spacing: 1px; margin-bottom: 14px;
  background: linear-gradient(90deg,#5ee7ff,#9d7bff,#ff8fd6);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.panel h1 span { display: block; font-size: 22px; -webkit-text-fill-color:#cfe3ff; color:#cfe3ff; }
.panel h2 { font-size: 34px; margin-bottom: 16px; }
.panel .tag { color: #b9c6ee; margin-bottom: 18px; font-size: 15px; }
.howto { text-align: left; font-size: 13.5px; color: #c6d2f3; line-height: 1.9; margin-bottom: 22px;
  background: rgba(0,0,0,.2); border-radius: 14px; padding: 12px 16px; }
.howto b { color: #8fd2ff; }
.result-line { font-size: 17px; color: #c6d2f3; margin-bottom: 6px; }
.result-line b { color: #fff; font-size: 22px; }
.win h2 { color: #7CFFB2; } .lose h2 { color: #ff8a8a; }

.big-btn {
  margin-top: 18px; pointer-events: auto; cursor: pointer; border: 0; color: #08122c;
  font-weight: 900; font-size: 19px; padding: 15px 34px; border-radius: 16px;
  background: linear-gradient(180deg,#6ff0ff,#4bb8ff); box-shadow: 0 10px 24px rgba(75,184,255,.4);
  transition: transform .08s ease;
}
.big-btn:active { transform: scale(.95); }

#hero {
  width: 100%; height: 168px; object-fit: cover; border-radius: 16px; display: block;
  margin-bottom: 16px; box-shadow: 0 10px 26px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.12);
}

.welcome { color: #9be7ff; font-weight: 700; font-size: 15px; margin-bottom: 10px; }

.lb { text-align: left; background: rgba(0,0,0,.22); border-radius: 14px; padding: 10px 14px; margin-bottom: 6px; }
.lb h3 { font-size: 13px; color: #ffd98a; margin-bottom: 6px; letter-spacing: .5px; }
.lb ol { list-style: none; max-height: 168px; overflow-y: auto; }
.lb li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #d6e1ff; padding: 3px 0; }
.lb li .rk { width: 22px; text-align: center; font-weight: 800; color: #8fb6ff; }
.lb li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb li .vl { font-weight: 800; color: #9be7ff; }
.lb li.me { background: rgba(110,240,255,.12); border-radius: 8px; padding: 3px 6px; }
.lb li.me .nm { color: #eaffff; }
.lb li.lb-empty { color: #8a98c0; justify-content: center; font-size: 12.5px; }
.lb li.rk-1 .rk { color: #ffd24a; } .lb li.rk-2 .rk { color: #d7e0ff; } .lb li.rk-3 .rk { color: #ff9d5c; }

.newbest { color: #ffd24a; font-weight: 900; font-size: 14px; animation: pop .7s ease-out; display: inline-block; }

#btn-mute {
  position: absolute; top: 14px; right: 14px; pointer-events: auto; cursor: pointer;
  width: 42px; height: 42px; border-radius: 50%; border: 0; font-size: 20px;
  background: rgba(8,14,34,.5); color: #fff; backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.2);
}
#btn-mute:active { transform: scale(.92); }

#btn-jump {
  position: absolute; right: 18px; bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  pointer-events: auto; cursor: pointer; border: 0; color: #08122c; font-weight: 900; font-size: 18px;
  padding: 16px 24px; border-radius: 18px; letter-spacing: .5px;
  background: linear-gradient(180deg,#ffe27a,#ffc23d); box-shadow: 0 8px 20px rgba(255,180,40,.45);
  touch-action: manipulation;
}
#btn-jump:active { transform: scale(.93); }

#loading { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:18px; color:#9fb3e6; z-index: 9; }
