@font-face { font-family: 'Lilita'; src: url('/assets/fonts/LilitaOne-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Bungee'; src: url('/assets/fonts/Bungee-Regular.ttf') format('truetype'); font-display: swap; }

:root {
  --red: #ff3b3b; --red2: #b5121b; --blue: #2f8bff; --blue2: #1043b8;
  --yellow: #ffd23a; --orange: #ff8a1f; --navy: #0b1230; --navy2: #16224f; --ink: #071029;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050816; color: #fff; font-family: 'Lilita', 'Arial Rounded MT Bold', system-ui, sans-serif; letter-spacing: 0.02em; user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
#app { position: fixed; inset: 0; overflow: hidden; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0,0,10,0.45) 100%); }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: 0; color: inherit; }
input { font-family: inherit; }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); z-index: 10; }
#menu, #ladder, #create, #join, #lobby, #settings { background: linear-gradient(180deg, rgba(5,8,22,0.15) 0%, rgba(5,8,22,0.0) 35%, rgba(5,8,22,0.55) 100%); }
#loading { background: radial-gradient(ellipse at 50% 40%, #1b2a6b 0%, #070b20 70%); z-index: 50; }
.logo { width: min(78vw, 460px); filter: drop-shadow(0 10px 24px rgba(0,0,0,0.55)); animation: logoIn 0.9s cubic-bezier(.2,1.6,.4,1) both, logoFloat 4s ease-in-out 1s infinite; }
#menu .logo { width: min(74vw, 400px); margin-bottom: -6px; }
@keyframes logoIn { from { transform: scale(0.4) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes logoFloat { 50% { transform: translateY(-6px) rotate(-1deg); } }
.tagline { font-family: 'Bungee'; font-size: 13px; letter-spacing: 0.25em; color: #ffe9a8; text-shadow: 0 2px 0 #0008; }
.loadbar { width: min(70vw, 320px); height: 14px; border-radius: 10px; background: #0008; border: 2px solid #ffffff30; overflow: hidden; }
.loadbar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--orange), var(--yellow)); border-radius: 10px; transition: width 0.2s; }
.loadtxt { font-size: 14px; opacity: 0.8; }

.live { display: inline-flex; align-items: center; gap: 2px; font-family: 'Bungee'; font-size: 12px; letter-spacing: 0.12em; color: #d9ffe4; background: rgba(7,16,41,0.72); border: 2px solid #3cff8a55; border-radius: 999px; padding: 4px 12px 4px 10px; backdrop-filter: blur(6px); text-shadow: 0 1px 0 #0008; }
.live.hidden { display: none; }
.live b { font-weight: normal; color: #fff; font-size: 14px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #3cff8a; box-shadow: 0 0 0 0 #3cff8a99; animation: livePulse 1.8s ease-out infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 #3cff8a99; } 80%, 100% { box-shadow: 0 0 0 9px #3cff8a00; } }
.namebox { display: flex; align-items: center; gap: 8px; background: rgba(7,16,41,0.75); border: 2px solid #ffffff22; border-radius: 14px; padding: 6px 10px 6px 14px; backdrop-filter: blur(6px); }
.namebox label { font-family: 'Bungee'; font-size: 11px; color: var(--yellow); letter-spacing: 0.15em; }
.namebox input { background: transparent; border: 0; outline: 0; color: #fff; font-size: 20px; width: 170px; padding: 4px; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; width: min(88vw, 360px); }
.menu-buttons .row { display: flex; gap: 10px; }
.menu-buttons .row .btn { flex: 1; }
.foot { font-size: 12px; opacity: 0.7; text-shadow: 0 1px 2px #000; text-align: center; }

/* ---------- buttons ---------- */
.btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 16px; border-radius: 16px; font-size: 18px; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.35); transition: transform 0.08s, filter 0.15s; box-shadow: 0 5px 0 rgba(0,0,0,0.35), 0 10px 22px rgba(0,0,0,0.35), inset 0 2px 0 rgba(255,255,255,0.35); }
.btn:active { transform: translateY(3px) scale(0.98); box-shadow: 0 2px 0 rgba(0,0,0,0.35), inset 0 2px 0 rgba(255,255,255,0.3); }
.btn:hover { filter: brightness(1.08); }
.btn-big { padding: 14px 18px 12px; font-size: 26px; }
.btn-big small { font-size: 13px; opacity: 0.85; letter-spacing: 0.06em; }
.btn-yellow { background: linear-gradient(180deg, #ffe46b 0%, #ffc21a 55%, #f39c0f 100%); color: #3a1d00; text-shadow: 0 1px 0 #fff6; }
.btn-orange { background: linear-gradient(180deg, #ffab4a 0%, #ff7a18 55%, #e1500b 100%); }
.btn-blue { background: linear-gradient(180deg, #4ea2ff 0%, #2a6bff 55%, #1a45c9 100%); }
.btn-red { background: linear-gradient(180deg, #ff6b6b 0%, #e5262e 60%, #b5121b 100%); }
.btn-ghost { background: rgba(10,18,48,0.72); border: 2px solid #ffffff2a; backdrop-filter: blur(6px); box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.btn-small { padding: 7px 12px; font-size: 14px; border-radius: 12px; }
.btn-back { position: absolute; left: 12px; top: calc(10px + var(--safe-t)); width: 46px; height: 46px; padding: 0; font-size: 30px; line-height: 1; background: rgba(10,18,48,0.75); border: 2px solid #ffffff2a; }
.btn:disabled { filter: grayscale(0.8) brightness(0.7); }

.screen-head { position: absolute; top: 0; left: 0; right: 0; height: calc(64px + var(--safe-t)); display: flex; align-items: center; justify-content: center; padding-top: var(--safe-t); }
.screen-head h2 { margin: 0; font-family: 'Bungee'; font-size: 24px; letter-spacing: 0.06em; text-shadow: 0 3px 0 #0009, 0 0 18px #ff9d2f66; }
.panel { width: min(92vw, 420px); background: linear-gradient(180deg, rgba(22,34,79,0.92), rgba(9,15,40,0.94)); border: 2px solid #ffffff22; border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 1px 0 #ffffff22; backdrop-filter: blur(8px); }
.panel h2 { margin: 0; text-align: center; font-family: 'Bungee'; }
.field label { display: block; font-family: 'Bungee'; font-size: 11px; color: var(--yellow); letter-spacing: 0.18em; margin-bottom: 6px; }
.seg { display: flex; gap: 6px; background: #0007; padding: 5px; border-radius: 14px; }
.seg-wrap { flex-wrap: wrap; }
.seg button { flex: 1; padding: 10px 8px; border-radius: 10px; background: transparent; font-size: 16px; color: #c9d4ff; }
.seg-wrap button { flex: 1 1 45%; }
.seg button.on { background: linear-gradient(180deg, #ffe46b, #f5a915); color: #3a1d00; box-shadow: 0 3px 0 #0006; }
.code-input { width: 100%; font-family: 'Bungee'; font-size: 40px; text-align: center; letter-spacing: 0.35em; padding: 10px; border-radius: 14px; background: #0009; border: 2px solid #ffffff33; color: var(--yellow); outline: none; text-transform: uppercase; }
.codebig { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.codebig small { font-family: 'Bungee'; font-size: 11px; letter-spacing: 0.2em; color: #9fb2ff; }
.codebig b { font-family: 'Bungee'; font-size: 52px; letter-spacing: 0.25em; color: var(--yellow); text-shadow: 0 4px 0 #000a, 0 0 24px #ffb20055; }
.lobby-meta { text-align: center; color: #c9d4ff; font-size: 15px; }
.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seat { padding: 12px 10px; border-radius: 14px; text-align: center; font-size: 17px; border: 2px solid #ffffff22; }
.seat.t0 { background: linear-gradient(180deg, #ff4b4b55, #8a0d1555); }
.seat.t1 { background: linear-gradient(180deg, #3b8bff55, #0d2f8a55); }
.seat.you { border-color: var(--yellow); box-shadow: 0 0 0 2px #ffd23a55; }
.seat small { display: block; font-size: 11px; opacity: 0.7; font-family: 'Bungee'; letter-spacing: 0.1em; }
.hint { font-size: 13px; color: #9fb2ff; text-align: center; }
.credits { font-size: 11px; opacity: 0.6; text-align: center; }

/* ---------- ladder ---------- */
.screen-head { z-index: 4; pointer-events: none; }
.screen-head .btn { pointer-events: auto; }
#ladder { justify-content: flex-start; padding-top: calc(76px + var(--safe-t)); }
#ladder .stage-cards { margin-top: 0; }
#ladder #ladder-play { margin-top: auto; flex-shrink: 0; }
.stage-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(94vw, 560px); margin-top: 40px; flex: 0 1 auto; min-height: 0; }
.scard { position: relative; aspect-ratio: 0.82; border-radius: 18px; overflow: hidden; border: 3px solid #ffffff25; background-size: cover; background-position: center; box-shadow: 0 10px 24px rgba(0,0,0,0.5); text-align: left; padding: 0; transition: transform 0.12s; }
.scard::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0.0) 30%, rgba(4,6,20,0.92) 100%); }
.scard.sel { border-color: var(--yellow); transform: scale(1.03); box-shadow: 0 0 0 3px #ffd23a66, 0 14px 30px rgba(0,0,0,0.6); }
.scard .num { position: absolute; top: 8px; left: 10px; z-index: 2; font-family: 'Bungee'; font-size: 22px; text-shadow: 0 2px 0 #000; }
.scard .info { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; }
.scard .nm { font-family: 'Bungee'; font-size: 17px; line-height: 1.05; text-shadow: 0 2px 0 #000; }
.scard .sb { font-size: 13px; opacity: 0.85; }
.scard .diff { display: inline-block; margin-top: 4px; font-family: 'Bungee'; font-size: 10px; padding: 3px 7px; border-radius: 8px; background: #0009; letter-spacing: 0.1em; }
.diff.easy { color: #7dff8a; } .diff.medium { color: #ffd23a; } .diff.hard { color: #ff8a3a; } .diff.pro { color: #ff4dff; }
.scard .best { font-size: 12px; color: #ffe08a; margin-top: 2px; }
.scard.locked { filter: grayscale(0.85) brightness(0.55); }
.scard .lock { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; font-size: 46px; filter: drop-shadow(0 4px 6px #000); }
.scard .lock span { display: flex; align-items: center; justify-content: center; width: 70px; height: 70px; border-radius: 50%; background: #000a; border: 3px solid #ffffff40; }
.scard .lock svg { width: 34px; height: 34px; }
.scard .star { position: absolute; top: 8px; right: 10px; z-index: 2; color: var(--yellow); font-size: 20px; text-shadow: 0 2px 0 #000; }

@media (min-width: 900px) {
  #ladder .stage-cards { grid-template-columns: repeat(4, 1fr); width: min(94vw, 1040px); gap: 16px; margin-top: 4vh; }
}
@media (min-width: 481px) and (max-width: 899px) {
  #ladder .stage-cards { width: min(94vw, calc((100vh - 230px) * 0.82 + 12px)); }
}

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#hud button { pointer-events: auto; }
.scorebar { position: absolute; top: calc(8px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; align-items: stretch; filter: drop-shadow(0 6px 14px rgba(0,0,0,0.5)); }
.scorebar .team { display: grid; grid-template-columns: auto auto; align-items: center; gap: 0 10px; padding: 6px 14px 6px; min-width: 132px; }
.scorebar .t0 { background: linear-gradient(180deg, #ff5a4f, #c4121c); border-radius: 16px 0 0 16px; justify-content: end; }
.scorebar .t1 { background: linear-gradient(180deg, #4b9bff, #1546c4); border-radius: 0 16px 16px 0; justify-content: start; }
.scorebar .tname { font-size: 14px; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 0 #0008; }
.scorebar .tscore { font-family: 'Bungee'; font-size: 34px; line-height: 1; text-shadow: 0 3px 0 #0007; }
.scorebar .pips { grid-column: 1 / span 2; display: flex; gap: 4px; margin-top: 3px; }
.scorebar .t0 .pips { justify-content: flex-end; }
.pips i { width: 14px; height: 10px; border-radius: 4px; background: #fff; box-shadow: inset 0 -2px 0 #0003; }
.pips i.used { opacity: 0.22; }
.scorebar .mid { background: linear-gradient(180deg, #1c2a63, #0a1236); padding: 5px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 96px; border-top: 2px solid #ffffff22; border-bottom: 2px solid #00000055; }
.scorebar .round { font-family: 'Bungee'; font-size: 13px; color: var(--yellow); }
.scorebar .target { font-size: 11px; opacity: 0.75; }
.twistchip { margin-top: 3px; font-size: 11px; padding: 2px 8px; border-radius: 8px; background: #ff8a1f; color: #2a0f00; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.rtally { grid-column: 1 / span 2; justify-self: center; margin: 4px 0 -1px; padding: 3px 8px; border-radius: 9px; font-family: 'Bungee'; font-size: 12px; line-height: 1; white-space: nowrap; background: #0007; color: #ffe9a8; box-shadow: inset 0 0 0 1px #ffffff22; text-shadow: 0 1px 0 #000; }
.rtally:empty { display: none; }
.rtally.lead { background: linear-gradient(180deg, #ffe46b, #f5a915); color: #3a1d00; text-shadow: none; box-shadow: 0 0 12px #ffd23a88; }
.rtally.zero { opacity: 0.75; }
.scorebar .team.active { box-shadow: inset 0 0 0 3px #ffe46b, 0 0 18px #ffd23a88; }

.wind { position: absolute; top: calc(92px + var(--safe-t)); right: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 10px; border-radius: 14px; background: rgba(8,14,40,0.75); border: 2px solid #ffffff22; }
.warrow { font-size: 26px; color: #7fe3ff; transition: transform 0.3s; text-shadow: 0 0 10px #47c8ff; }
.wtxt { font-family: 'Bungee'; font-size: 11px; }
.turn { position: absolute; left: 50%; bottom: calc(118px + var(--safe-b)); transform: translateX(-50%); font-family: 'Bungee'; font-size: 20px; padding: 8px 18px; border-radius: 14px; background: rgba(8,14,40,0.7); white-space: nowrap; text-shadow: 0 2px 0 #000; transition: opacity 0.2s; }
.turn.t0 { box-shadow: inset 0 0 0 2px #ff5a4f; } .turn.t1 { box-shadow: inset 0 0 0 2px #4b9bff; }
.turn:empty { opacity: 0; }
.timer { position: absolute; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); width: 120px; height: 5px; border-radius: 4px; background: #0008; overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--yellow); }
.powerslot { position: absolute; right: 14px; bottom: calc(18px + var(--safe-b)); width: 86px; height: 86px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 35%, #3a4a8f, #0d1540); border: 3px solid #ffffff33; box-shadow: 0 6px 16px #0008; }
.powerslot i { font-style: normal; font-size: 32px; line-height: 1; }
.powerslot span { font-family: 'Bungee'; font-size: 9px; margin-top: 3px; letter-spacing: 0.04em; }
.powerslot.empty { opacity: 0.55; }
.powerslot.ready { border-color: var(--yellow); animation: pulse 1.2s infinite; }
.powerslot.armed { background: radial-gradient(circle at 50% 35%, #ffe46b, #f08a00); color: #2a1200; border-color: #fff; box-shadow: 0 0 26px #ffcc33, 0 6px 16px #0008; }
@keyframes pulse { 50% { box-shadow: 0 0 22px #ffd23acc, 0 6px 16px #0008; } }
.arcsel { position: absolute; left: 14px; bottom: calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 5px; pointer-events: auto; }
.arcsel button { width: 64px; padding: 8px 0; border-radius: 12px; font-family: 'Bungee'; font-size: 11px; background: rgba(8,14,40,0.72); border: 2px solid #ffffff22; color: #c9d4ff; }
.arcsel button.on { background: linear-gradient(180deg, #ffe46b, #f5a915); color: #3a1d00; border-color: #fff8; }
.menu-btn { position: absolute; right: 12px; top: calc(12px + var(--safe-t)); width: 40px; height: 40px; padding: 0; font-family: 'Bungee'; }
.aimhint { position: absolute; left: 50%; bottom: calc(160px + var(--safe-b)); transform: translateX(-50%); font-size: 14px; opacity: 0.85; white-space: nowrap; text-shadow: 0 2px 3px #000; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

#powerring { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; pointer-events: none; z-index: 6; }
#powerring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
#powerring circle { fill: none; stroke-width: 10; }
#powerring .bg { stroke: #0007; }
#powerring .fg { stroke: #ffd23a; stroke-linecap: round; stroke-dasharray: 314; stroke-dashoffset: 314; filter: drop-shadow(0 0 6px #ffae00); }
#powerring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: 'Bungee'; font-size: 24px; text-shadow: 0 2px 0 #000; }

/* ---------- menu extras ---------- */
.btn-lb { flex-direction: row; gap: 8px; font-family: 'Bungee'; font-size: 15px; letter-spacing: 0.04em; background: linear-gradient(180deg, #b36bff 0%, #7a2cf0 55%, #5414c4 100%); }
.btn-lb .lb-ic { font-size: 20px; filter: drop-shadow(0 2px 0 #0006); }
.menu-buttons .row .btn-gear { flex: 0 0 58px; font-size: 24px; padding: 8px 0; }
.row2 { display: flex; gap: 10px; }
.row2 .btn { flex: 1; }
.share-row .btn-share { flex: 1; flex-direction: row; gap: 8px; font-family: 'Bungee'; font-size: 17px; letter-spacing: 0.04em; background: linear-gradient(180deg, #5ef0a8 0%, #19c27a 55%, #0b9459 100%); color: #032a18; text-shadow: 0 1px 0 #fff5; }
.share-row .btn-share .sh-ic { font-size: 20px; filter: drop-shadow(0 2px 0 #0005); }
.share-row .btn-share.busy { filter: saturate(0.6) brightness(0.92); cursor: progress; }
.share-row .btn-share.busy .sh-ic { animation: shPulse 0.8s ease-in-out infinite alternate; }
.share-row .btn-share-match { flex: 0 0 78px; font-size: 11px; line-height: 1.1; letter-spacing: 0.05em; }
@keyframes shPulse { from { transform: scale(0.85); opacity: 0.6; } to { transform: scale(1.1); opacity: 1; } }
.credits a { color: #ffe08a; }

/* ---------- leaderboard ---------- */
#leaders { z-index: 30; padding: calc(10px + var(--safe-t)) 10px calc(10px + var(--safe-b)); }
.lb-panel { width: min(96vw, 520px); height: min(100%, 760px); display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 12px; border-radius: 24px; background: linear-gradient(180deg, rgba(32,22,86,0.97), rgba(9,12,38,0.97)); border: 2px solid #ffffff26; box-shadow: 0 24px 60px rgba(0,0,0,0.6), inset 0 1px 0 #ffffff2a, 0 0 0 4px #7a2cf033; animation: lbIn 0.35s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes lbIn { from { transform: translateY(30px) scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }
.lb-head { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; }
.lb-title { display: flex; align-items: center; gap: 8px; }
.lb-title h2 { margin: 0; font-family: 'Bungee'; font-size: clamp(20px, 6vw, 28px); letter-spacing: 0.04em; color: var(--yellow); text-shadow: 0 3px 0 #000a, 0 0 22px #ffb20066; }
.lb-trophy { font-size: 28px; animation: logoFloat 3s ease-in-out infinite; }
.lb-x { position: absolute; left: auto; right: 0; top: 0; width: 42px; height: 42px; font-size: 18px; }
.lb-tabs button { font-family: 'Bungee'; font-size: 13px; letter-spacing: 0.05em; }
.lb-meta { text-align: center; font-size: 13px; color: #c9b8ff; min-height: 16px; }
.lb-cols { display: grid; grid-template-columns: 44px 1fr 62px; padding: 0 10px; font-family: 'Bungee'; font-size: 10px; letter-spacing: 0.15em; color: #9fa8e8; }
.lb-cols span:last-child { text-align: center; }
.lb-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px 2px 6px; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain; }
.lb-row { display: grid; grid-template-columns: 44px 1fr 62px; align-items: center; gap: 0; padding: 8px 10px; border-radius: 14px; background: linear-gradient(180deg, #ffffff12, #ffffff06); border: 1px solid #ffffff14; }
.lb-row:nth-child(-n+3) { background: linear-gradient(180deg, #ffffff1c, #ffffff08); }
.lb-row.you { background: linear-gradient(180deg, #ffe46b, #f5a915); color: #2a1400; border-color: #fff; box-shadow: 0 0 0 2px #ffd23a88, 0 6px 18px #ffb20044; }
.lb-row.you small { color: #4a2a00; opacity: 0.9; }
.lb-row.ghost { opacity: 0.9; }
.lb-rank { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: 'Bungee'; font-size: 14px; background: #0006; box-shadow: inset 0 -2px 0 #0005; }
.lb-rank.gold { background: radial-gradient(circle at 40% 30%, #fff3a0, #f5b400 60%, #b77800); color: #3a1d00; }
.lb-rank.silver { background: radial-gradient(circle at 40% 30%, #ffffff, #c6cfdc 60%, #7d8899); color: #1c2433; }
.lb-rank.bronze { background: radial-gradient(circle at 40% 30%, #ffd2a6, #d9822f 60%, #8a4a12); color: #2a1200; }
.lb-row.you .lb-rank:not(.gold):not(.silver):not(.bronze) { background: #2a1400; color: #ffe46b; }
.lb-name { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-name b { font-size: 17px; font-weight: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name b i { font-style: normal; font-family: 'Bungee'; font-size: 9px; padding: 2px 5px; border-radius: 6px; background: #2a1400; color: #ffe46b; vertical-align: 3px; margin-left: 4px; }
.lb-name small { font-size: 11px; color: #b9c0f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-ladder { color: #ffd23a; letter-spacing: -1px; }
.lb-row.you .lb-ladder { color: #7a2cf0; }
.lb-wins { display: flex; flex-direction: column; align-items: center; }
.lb-wins b { font-family: 'Bungee'; font-size: 22px; line-height: 1; font-weight: normal; }
.lb-wins small { font-family: 'Bungee'; font-size: 8px; letter-spacing: 0.12em; opacity: 0.7; }
.lb-you:empty { display: none; }
.lb-you { border-top: 2px dashed #ffffff22; padding-top: 8px; }
.lb-empty { margin: auto; padding: 30px 10px; text-align: center; color: #c9b8ff; font-size: 16px; line-height: 1.5; }

/* ---------- popups & banners ---------- */
#popups { position: absolute; inset: 0; pointer-events: none; z-index: 7; overflow: hidden; }
.pop { position: absolute; transform: translate(-50%, -50%); font-family: 'Bungee'; font-size: 30px; white-space: nowrap; color: #fff; text-shadow: 0 3px 0 #0009, 0 0 18px currentColor; animation: popUp 1.6s cubic-bezier(.2,1.4,.4,1) forwards; }
.pop.big { font-size: 44px; color: var(--yellow); }
.pop.trick { font-size: 34px; color: #ff6bf2; }
.pop.small { font-size: 20px; }
.pop.red { color: #ff7a6b; } .pop.blue { color: #7ab8ff; } .pop.green { color: #7dff8a; }
@keyframes popUp { 0% { transform: translate(-50%, -30%) scale(0.3); opacity: 0; } 15% { transform: translate(-50%, -60%) scale(1.15); opacity: 1; } 30% { transform: translate(-50%, -70%) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%, -150%) scale(0.95); opacity: 0; } }

#banner { position: absolute; left: 0; right: 0; top: 34%; z-index: 8; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
#banner .b1 { font-family: 'Bungee'; font-size: 22px; color: #fff; padding: 4px 20px; background: #0b1230; border-radius: 10px; transform: skewX(-10deg); animation: slideL 0.5s cubic-bezier(.2,1.3,.4,1) both; }
#banner .b2 { margin-top: 6px; font-family: 'Bungee'; font-size: clamp(30px, 9vw, 60px); line-height: 1.05; padding: 8px 28px; color: #3a1d00; background: linear-gradient(180deg, #ffe46b, #ff9a1a); transform: skewX(-10deg); box-shadow: 0 8px 0 #0006, 0 0 40px #ffa20088; text-align: center; animation: slideR 0.55s 0.08s cubic-bezier(.2,1.3,.4,1) both; }
#banner .b3 { margin-top: 10px; font-size: 18px; text-shadow: 0 2px 3px #000; animation: fadeIn 0.4s 0.35s both; text-align: center; padding: 0 16px; }
#banner.out .b1, #banner.out .b2, #banner.out .b3 { animation: bannerOut 0.35s ease-in forwards; }
@keyframes slideL { from { transform: translateX(-120vw) skewX(-10deg); } to { transform: skewX(-10deg); } }
@keyframes slideR { from { transform: translateX(120vw) skewX(-10deg); } to { transform: skewX(-10deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes bannerOut { to { opacity: 0; transform: scale(1.3) skewX(-10deg); } }

.modal { background: rgba(3,6,20,0.6); backdrop-filter: blur(4px); z-index: 20; }
.results { align-items: stretch; text-align: center; }
.r-title { font-family: 'Bungee'; font-size: 40px; color: var(--yellow); text-shadow: 0 4px 0 #000a, 0 0 30px #ffb200aa; animation: logoIn 0.7s cubic-bezier(.2,1.6,.4,1) both; }
.r-score { font-family: 'Bungee'; font-size: 54px; display: flex; justify-content: center; gap: 14px; align-items: center; }
.r-score .t0 { color: #ff6b5f; } .r-score .t1 { color: #6aaeff; } .r-score i { font-style: normal; opacity: 0.5; }
.r-sub { color: #c9d4ff; font-size: 15px; }
.r-table { font-size: 13px; color: #c9d4ff; max-height: 120px; overflow: auto; }
#toast { position: absolute; left: 50%; top: calc(80px + var(--safe-t)); transform: translateX(-50%); z-index: 60; background: #0b1230ee; border: 2px solid var(--yellow); padding: 10px 18px; border-radius: 14px; font-size: 16px; box-shadow: 0 8px 24px #000a; max-width: 90vw; text-align: center; }
#fps { position: absolute; left: 6px; bottom: 6px; font: 11px monospace; opacity: 0.6; z-index: 70; }

@media (max-width: 480px) {
  .menu-btn { top: calc(84px + var(--safe-t)); right: 8px; }
  .wind { top: calc(132px + var(--safe-t)); right: 8px; }
  .scorebar { left: 8px; right: 8px; transform: none; justify-content: center; }
  .scorebar .team { min-width: 0; flex: 1; padding: 5px 8px; }
  .scorebar .tscore { font-size: 28px; }
  .scorebar .tname { font-size: 12px; max-width: 70px; }
  .scorebar .mid { min-width: 82px; padding: 4px 6px; }
  .pips i { width: 11px; height: 8px; }
  .turn { font-size: 16px; }
  .powerslot { width: 74px; height: 74px; }
  .stage-cards { gap: 10px; }
  .btn-big { font-size: 23px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #menu .logo { width: 220px; }
  .menu-buttons { width: 330px; gap: 6px; }
  .btn-big { padding: 8px 14px; font-size: 20px; }
  .stage-cards { grid-template-columns: repeat(4, 1fr); margin-top: 50px; }
  .turn { bottom: 70px; }
}
