* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #3f6663; font-family: 'Jua', system-ui, sans-serif; color: #24343c; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
/* Only the play surface swallows touches (drag to steer); menus scroll like normal pages. */
canvas, #hud { touch-action: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.screen { position: fixed; inset: 0; pointer-events: none; }
.screen > * { pointer-events: auto; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: 0; }

/* Home */
#homeScreen { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: radial-gradient(ellipse at center, rgba(255,255,255,0.15), rgba(30,60,70,0.35)); padding: 16px; }
.topbar { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; }
.coin { display: flex; align-items: center; gap: 6px; background: rgba(20,40,50,0.55); color: #fff; padding: 6px 14px 6px 8px; border-radius: 99px; font-size: 20px; }
.coin-ic { display: inline-block; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0, #ffc929 55%, #e09a12); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15); }
.icon-btn { background: rgba(20,40,50,0.55); color: #fff; width: 42px; height: 42px; border-radius: 50%; font-size: 20px; }
.logo { margin: 0; font-size: clamp(54px, 13vw, 96px); font-weight: 400; letter-spacing: 2px; display: flex; align-items: baseline; filter: drop-shadow(0 6px 0 rgba(20,40,50,0.35)); }
.logo span { display: inline-block; color: #fff; -webkit-text-stroke: 0; padding: 0 2px; animation: bob 2.4s ease-in-out infinite; }
.logo span:nth-child(1) { color: #5ccf86; } .logo span:nth-child(2) { color: #ffd24a; animation-delay: .15s; } .logo span:nth-child(3) { color: #ff7a6b; animation-delay: .3s; } .logo span:nth-child(4) { color: #4fb4ff; animation-delay: .45s; }
.logo small { color: #fff; font-size: .45em; margin-left: 4px; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.tag { margin: 0 0 8px; color: #fff; font-size: 18px; text-shadow: 0 2px 0 rgba(0,0,0,0.2); }
.card { background: #fff; border-radius: 26px; padding: 20px; width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 0 rgba(20,40,50,0.25), 0 20px 40px rgba(0,0,0,0.2); }
#name { font: inherit; font-size: 20px; padding: 12px 16px; border-radius: 14px; border: 3px solid #e1e8ec; outline: none; text-align: center; color: #24343c; }
#name:focus { border-color: #4fb4ff; }
.swatches { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.swatch { width: 32px; height: 32px; border-radius: 9px; background: var(--c); box-shadow: inset 0 -5px 0 var(--d); transition: transform .12s; }
.swatch.on { transform: scale(1.18); outline: 3px solid #24343c; outline-offset: 2px; }
.bigger { display: flex; justify-content: space-between; align-items: center; font-size: 17px; padding: 10px 14px; border-radius: 14px; background: #eef3f6; color: #24343c; border: 3px solid transparent; }
.bigger em { font-style: normal; display: flex; align-items: center; gap: 4px; }
.bigger.on { border-color: #ffc929; background: #fff7d6; }
.bigger:disabled { opacity: .45; cursor: default; }
.play { font-size: 28px; padding: 14px; border-radius: 18px; background: #ffc929; color: #5a3b00; box-shadow: 0 6px 0 #d99a00; transition: transform .08s, box-shadow .08s; }
.play:active { transform: translateY(4px); box-shadow: 0 2px 0 #d99a00; }
.ghost { font-size: 18px; padding: 10px; border-radius: 14px; background: #eef3f6; color: #4a5d66; }
.best { text-align: center; color: #6b7f88; }

/* HUD */
.mine { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.pctbar { position: relative; width: 170px; height: 34px; border-radius: 0 17px 17px 0; background: rgba(30,50,60,0.35); overflow: hidden; margin-left: -12px; }
#pctFill { position: absolute; inset: 0 auto 0 0; width: 0; transition: width .4s; }
.pctbar b { position: relative; line-height: 34px; padding-left: 14px; color: #fff; font-size: 20px; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.mine .sub { color: rgba(40,60,70,0.65); font-size: 15px; }
.killbox { color: #fff; background: #ff5a66; border-radius: 99px; padding: 3px 12px 3px 8px; width: max-content; font-size: 18px; box-shadow: 0 3px 0 #c93a45; }
.board { position: absolute; top: 12px; right: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; pointer-events: none; }
.board .row { display: flex; align-items: center; gap: 8px; min-width: 150px; width: calc(120px + var(--w) * 0.8); height: 30px; padding: 0 12px 0 8px; border-radius: 15px 0 0 15px; background: var(--c); color: #fff; font-size: 16px; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.board .row b { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,0.3); display: grid; place-items: center; font-size: 13px; }
.board .row i { font-style: normal; margin-left: auto; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .row.me { outline: 3px solid #fff; outline-offset: -3px; margin-top: 8px; }
.board .row.me:nth-child(-n+3) { margin-top: 0; }
.bonus { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; color: #fff; pointer-events: none; }
.bonus b { font-size: 22px; text-shadow: 0 2px 0 rgba(0,0,0,0.25); }
.bonus .bar { width: 160px; height: 8px; border-radius: 4px; background: rgba(30,50,60,0.35); overflow: hidden; margin: 4px auto 0; }
#bonusFill { height: 100%; background: #ffd24a; }
.banner { position: absolute; top: 54px; left: 0; right: 0; text-align: center; font-size: clamp(17px, 3.2vw, 24px); opacity: 0; pointer-events: none; -webkit-text-stroke: 4px #fff; paint-order: stroke fill; }
.banner.pop { animation: pop 1.3s ease-out; }
@keyframes pop { 0% { opacity: 0; transform: scale(.4); } 15% { opacity: 1; transform: scale(1.15); } 25% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px); } }
.hint { position: absolute; bottom: 18%; left: 0; right: 0; text-align: center; font-size: 24px; color: #2b3e47; pointer-events: none; transition: opacity .8s; text-shadow: 0 2px 0 #fff; }
.hint small { font-size: 16px; color: #4a5d66; }
.hint.gone { opacity: 0; }
.joy { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(30,50,60,0.12); border: 3px solid rgba(255,255,255,0.5); opacity: 0; pointer-events: none; transition: opacity .15s; }
.joy.on { opacity: 1; }
.boostbtn { position: absolute; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 76px; height: 76px; border-radius: 50%; border: 0; padding: 0; background: rgba(255,255,255,0.9); box-shadow: 0 5px 0 rgba(20,40,50,0.25); touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.boostbtn i { position: absolute; inset: -5px; border-radius: 50%; background: conic-gradient(#ff8a3d calc(var(--p, 1) * 360deg), rgba(30,50,60,0.15) 0); -webkit-mask: radial-gradient(circle, transparent 37px, #000 38px); mask: radial-gradient(circle, transparent 37px, #000 38px); }
.boostbtn span { font-size: 32px; line-height: 76px; display: block; }
.boostbtn small { position: absolute; left: 0; right: 0; bottom: -18px; font-size: 11px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.boostbtn.on { transform: scale(0.92); background: #fff1e4; }
.boostbtn.lock span { opacity: 0.35; }
@media (pointer: coarse) { .boostbtn small { display: none; } .boostbtn { width: 84px; height: 84px; } .boostbtn span { line-height: 84px; } .boostbtn i { -webkit-mask: radial-gradient(circle, transparent 41px, #000 42px); mask: radial-gradient(circle, transparent 41px, #000 42px); } }
#knob { position: absolute; left: 35px; top: 35px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.85); box-shadow: 0 3px 0 rgba(0,0,0,0.15); }

/* Game over */
#overScreen { display: grid; place-items: center; background: rgba(30,50,60,0.45); padding: 16px; }
.over { text-align: center; animation: rise .35s ease-out; }
@keyframes rise { from { transform: translateY(30px) scale(.95); opacity: 0; } }
.over h2 { margin: 0; font-size: 36px; font-weight: 400; color: #ff5a66; }
#overScreen.win .over h2 { color: #3fa866; }
.over .sub { margin: -6px 0 0; color: #6b7f88; }
.over .big { font-size: 64px; color: #24343c; line-height: 1; }
.newbest { align-self: center; background: #ffd24a; color: #5a3b00; padding: 4px 14px; border-radius: 99px; animation: pop2 .9s ease-in-out infinite alternate; }
@keyframes pop2 { to { transform: scale(1.08); } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: #eef3f6; border-radius: 14px; padding: 8px 4px; display: flex; flex-direction: column; }
.stats small { color: #6b7f88; font-size: 14px; }
.stats b { font-size: 24px; font-weight: 400; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--r)); } }

body[data-view="hud"] #game { cursor: crosshair; }

@media (max-width: 640px) {
  .bonus { top: auto; bottom: calc(22px + env(safe-area-inset-bottom)); }
  .board .row { min-width: 0; width: calc(96px + var(--w) * 0.5); height: 26px; font-size: 14px; padding-right: 8px; }
  .board .row i { max-width: 56px; }
  .pctbar { width: 130px; height: 30px; }
  .pctbar b { line-height: 30px; font-size: 17px; }
  .killbox { font-size: 15px; }
  .hint { font-size: 19px; }
}

/* Lives, minimap, hit flash */
.lives { display: flex; gap: 3px; margin-top: 2px; }
.lives span { width: 24px; height: 22px; display: block; }
.lives svg { width: 100%; height: 100%; fill: #cfd9df; stroke: #fff; stroke-width: 2; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.15)); }
.lives span.on svg { fill: #ff5a78; }
.lives span.gain { animation: heartGain .6s ease-out; }
@keyframes heartGain { 0% { transform: scale(0.2); } 50% { transform: scale(1.5); } 100% { transform: scale(1); } }
.lives.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.minimap { position: absolute; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); width: 160px; height: 160px; pointer-events: none; animation: mmIn .35s ease-out; }
.minimap canvas { width: 100%; height: 100%; border-radius: 50%; box-shadow: 0 6px 0 rgba(20,40,50,0.25), 0 10px 24px rgba(0,0,0,0.2); }
.mmtime { position: absolute; inset: -5px; border-radius: 50%; background: conic-gradient(#3aa6ff calc(var(--p, 1) * 360deg), transparent 0); -webkit-mask: radial-gradient(circle, transparent 79px, #000 80px); mask: radial-gradient(circle, transparent 79px, #000 80px); }
@keyframes mmIn { from { transform: scale(0.3); opacity: 0; } }
.fxscreen { position: absolute; inset: 0; pointer-events: none; transition: box-shadow .3s; }
.fxscreen.rev { box-shadow: inset 0 0 90px 24px rgba(142,91,255,0.55); animation: revpulse .8s ease-in-out infinite alternate; }
.fxscreen.frz { box-shadow: inset 0 0 110px 40px rgba(150,220,255,0.8); }
.fxscreen.slow { box-shadow: inset 0 -60px 80px -20px rgba(92,200,74,0.6); }
@keyframes revpulse { to { box-shadow: inset 0 0 60px 14px rgba(142,91,255,0.35); } }
.fxscreen i { position: absolute; width: 46vmin; height: 46vmin; border-radius: 50%; opacity: 0; transform: scale(.4); transition: opacity .5s, transform .35s cubic-bezier(.3,1.6,.5,1);
  background: radial-gradient(circle at 45% 40%, #23264a 0 52%, rgba(35,38,74,0.85) 60%, rgba(35,38,74,0) 71%); }
.fxscreen.ink i { opacity: .93; transform: scale(1); }
.fxscreen i:nth-child(1) { left: -6vmin; top: 4vh; }
.fxscreen i:nth-child(2) { right: -8vmin; top: 12vh; width: 58vmin; height: 58vmin; }
.fxscreen i:nth-child(3) { left: 18vw; bottom: -10vmin; width: 52vmin; height: 52vmin; }
.fxscreen i:nth-child(4) { right: 10vw; bottom: 6vh; width: 36vmin; height: 36vmin; }
.fxscreen i:nth-child(5) { left: 30vw; top: -12vmin; width: 40vmin; height: 40vmin; }
.fxscreen i:nth-child(6) { left: calc(50% + 6vmin); top: calc(50% - 30vmin); width: 24vmin; height: 24vmin; }
.fxscreen i:nth-child(7) { left: calc(50% - 32vmin); top: calc(50% + 4vmin); width: 26vmin; height: 26vmin; }
.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 120px 40px rgba(255,60,80,0.75); }
.flash.on { animation: flash .6s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@media (max-width: 640px) {
  .minimap { width: 120px; height: 120px; }
  .mmtime { -webkit-mask: radial-gradient(circle, transparent 59px, #000 60px); mask: radial-gradient(circle, transparent 59px, #000 60px); }
  .lives span { width: 20px; height: 18px; }
}

/* Modes */
.modes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mode { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: 12px; background: #eef3f6; color: #4a5d66; font-size: 13px; border: 3px solid transparent; }
.mode span { font-size: 20px; }
.mode.on { border-color: #4fb4ff; background: #e6f4ff; color: #24343c; }
.modedesc { text-align: center; color: #6b7f88; font-size: 14px; margin-top: -4px; }

/* Round progress */
.goalbar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; pointer-events: none; }
.gtrack { position: relative; width: 170px; height: 26px; border-radius: 13px; background: rgba(30,50,60,0.35); overflow: hidden; }
#goalFill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #ff7a6b, #ff4d5a); transition: width .3s; }
.gtrack b { position: relative; display: block; text-align: center; line-height: 26px; color: #fff; font-size: 15px; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
#timer { color: #fff; background: rgba(30,50,60,0.45); padding: 2px 10px; border-radius: 13px; font-size: 16px; line-height: 22px; }
#timer.hurry { background: #ff4d5a; animation: pop2 .5s ease-in-out infinite alternate; }
.bonus { top: 46px; }
.mine .sub { font-size: 16px; color: #2b3e47; }

/* Toast for land changes */
.toast { position: absolute; top: 92px; left: 50%; transform: translate(-50%, -12px); padding: 8px 16px; border-radius: 16px; background: #fff; color: #24343c; font-size: 16px; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; white-space: nowrap; box-shadow: 0 4px 0 rgba(20,40,50,0.2); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.lost { background: #ffe3e6; color: #b3202f; }
.toast.gain { background: #e7f8ee; color: #23784a; }
.toast em { font-style: normal; font-weight: 800; margin-left: 4px; }

/* Goal card */
.goalcard { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); background: #fff; border-radius: 22px; padding: 16px 26px; text-align: center; box-shadow: 0 8px 0 rgba(20,40,50,0.25); animation: rise .35s ease-out; pointer-events: none; }
.goalcard.out { opacity: 0; transform: translate(-50%, -70%); transition: all .45s ease-in; }
.goalcard small { color: #6b7f88; }
.goalcard h3 { margin: 2px 0; font-size: 34px; font-weight: 400; }
.goalcard p { margin: 2px 0; color: #4a5d66; }
.goalcard .rule { color: #ff4d5a; }

/* Spectating after elimination */
.spectate { position: absolute; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(255,255,255,0.95); border-radius: 18px; padding: 10px 18px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 6px 0 rgba(20,40,50,0.25); }
.spectate b { font-size: 22px; font-weight: 400; color: #ff4d5a; }
.spectate small { color: #6b7f88; }
.spectate button { margin-top: 6px; font-size: 17px; padding: 8px 16px; border-radius: 12px; background: #4fb4ff; color: #fff; box-shadow: 0 4px 0 #2f8bd6; }

/* Always-on minimap */
.minimap { animation: none; }
.minimap canvas { opacity: 0.92; }
.minimap:not(.full) { width: 130px; height: 130px; }
.minimap:not(.full) .mmtime { display: none; }
.board .row.out { opacity: .55; }

/* Results */
.over { gap: 10px; max-height: calc(100dvh - 32px); overflow: auto; touch-action: pan-y; }
.rrows { display: flex; flex-direction: column; gap: 4px; }
.rrow { display: grid; grid-template-columns: 24px 14px 1fr auto auto; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: #f3f6f8; text-align: left; }
.rrow b { color: #6b7f88; font-weight: 400; }
.rrow i { width: 14px; height: 14px; border-radius: 4px; }
.rrow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .sc { font-size: 18px; }
.rrow.me { background: #fff7d6; outline: 2px solid #ffc929; }
.rrow:first-child b { color: #e0ac1f; }
.kings { color: #e09a12; min-height: 1em; }
.parts { display: grid; gap: 4px; }
.part { display: grid; grid-template-columns: 62px 1fr 52px; align-items: center; gap: 6px; text-align: left; }
.part small { color: #4a5d66; font-size: 13px; }
.part .bar { height: 10px; border-radius: 5px; background: #eef3f6; overflow: hidden; }
.part .bar div { height: 100%; border-radius: 5px; }
.part.area .bar div { background: #5ccf86; } .part.kill .bar div { background: #ff5a66; } .part.raid .bar div { background: #ff9845; } .part.sneak .bar div { background: #4fb4ff; }
.part b { text-align: right; font-weight: 400; }
.coinline { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 22px; }
.coinline .newbest { font-size: 14px; margin-left: 6px; }
@media (max-width: 640px) {
  .goalbar { top: auto; bottom: calc(14px + env(safe-area-inset-bottom)); left: 12px; transform: none; }
  .gtrack { width: 120px; }
  .toast { top: 82px; font-size: 14px; }
  .banner { top: 48px; }
  .bonus { top: auto; bottom: calc(52px + env(safe-area-inset-bottom)); }
  .minimap:not(.full) { width: 100px; height: 100px; }
  .modes { grid-template-columns: repeat(5, 1fr); }
  .mode { font-size: 11px; }
  .spectate { bottom: calc(130px + env(safe-area-inset-bottom)); }
}
#myScore { text-shadow: 0 0 3px #fff, 0 0 6px #fff; }

/* Home: equipped skin + buttons */
.tb-right { display: flex; gap: 8px; }
.who { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; }
#homeSkin { width: 64px; height: 64px; }
.who #name { min-width: 0; }

/* Skin collection */
#skinScreen { background: linear-gradient(#eef6fb, #dfeaf1); overflow: auto; padding: 14px 14px 30px; pointer-events: auto; touch-action: pan-y; }
.skinhead { display: flex; align-items: center; gap: 10px; }
.skinhead h2 { flex: 1; margin: 0; font-weight: 400; font-size: 28px; }
.skinhead .icon-btn { background: #fff; color: #24343c; box-shadow: 0 3px 0 rgba(0,0,0,0.1); }
.skinhead .coin { background: #24343c; }
.skintabs { display: flex; gap: 6px; margin: 12px 0; overflow-x: auto; }
.skintabs button { padding: 8px 14px; border-radius: 99px; background: #fff; color: #4a5d66; font-size: 15px; white-space: nowrap; }
.skintabs button.on { background: #4fb4ff; color: #fff; }
.gachabox { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 18px; padding: 10px 12px; margin-bottom: 12px; box-shadow: 0 4px 0 rgba(20,40,50,0.1); }
.gachabox .gm { flex: 1; display: flex; flex-direction: column; font-size: 18px; }
.gachabox .gm small { color: #6b7f88; font-size: 12px; }
.play.small, .ghost.small { font-size: 16px; padding: 8px 12px; border-radius: 12px; }
.play.small { box-shadow: 0 4px 0 #d99a00; }
button:disabled { opacity: .45; }
.skingrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.skin { background: #fff; border-radius: 18px; padding: 8px; display: flex; flex-direction: column; align-items: center; text-align: center; border: 3px solid #e1e8ec; position: relative; }
.skin.rare { border-color: #8fc8ff; } .skin.legend { border-color: #ffc929; background: linear-gradient(#fffbea, #fff); }
.skin.eq { box-shadow: 0 0 0 3px #3fa866; }
.skin canvas { width: 96px; height: 96px; }
.skin b { font-weight: 400; font-size: 16px; }
.skin small { font-size: 12px; color: #8a98a0; }
.skin.rare small { color: #2f8bd6; } .skin.legend small { color: #d99a00; }
.skin .how { font-size: 12px; color: #4a5d66; margin-top: 4px; min-height: 30px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; }
.skin .how em { font-style: normal; color: #ff7a1a; }
.skin .how button { font-size: 14px; padding: 5px 12px; border-radius: 10px; background: #4fb4ff; color: #fff; }
.skin .how .buy { background: #ffc929; color: #5a3b00; }
.skintoast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: #24343c; color: #fff; padding: 8px 16px; border-radius: 12px; opacity: 0; pointer-events: none; }
.skintoast.on { animation: toastfade 1.8s; }
@keyframes toastfade { 10%, 80% { opacity: 1; } }
.capsule { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20,30,40,0.6); z-index: 5; }
.capsule .cap { background: #fff; border-radius: 26px; padding: 20px 30px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.capsule.open .cap { animation: capPop .7s cubic-bezier(.2,1.6,.4,1); }
@keyframes capPop { 0% { transform: scale(.2) rotate(-20deg); } 60% { transform: scale(1.1) rotate(4deg); } 100% { transform: scale(1); } }
.capsule.rare .cap { box-shadow: 0 0 0 6px #8fc8ff, 0 0 40px #8fc8ff; }
.capsule.legend .cap { box-shadow: 0 0 0 6px #ffc929, 0 0 60px #ffd24a; }
.capsule canvas { width: 160px; height: 160px; }
.capsule b { font-size: 26px; font-weight: 400; }
.capsule small { color: #6b7f88; }
.capsule em { font-style: normal; font-size: 12px; color: #aab6bd; margin-top: 6px; }

/* Lab */
.lab { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20,30,40,0.55); z-index: 6; padding: 16px; }
.labcard h3 { margin: 0; font-weight: 400; font-size: 24px; }
.labcard h3 small { font-size: 14px; color: #6b7f88; }
.lablist { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow: auto; }
.sw { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 12px; background: #f3f6f8; cursor: pointer; }
.sw input { display: none; }
.sw i { width: 44px; height: 26px; border-radius: 13px; background: #cfd9df; position: relative; transition: background .15s; flex: none; }
.sw i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.sw input:checked + i { background: #5ccf86; }
.sw input:checked + i::after { transform: translateX(18px); }
.labbtns { display: flex; gap: 8px; justify-content: flex-end; }

/* Missions HUD */
.missions { position: absolute; left: 12px; top: 168px; display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
.missions div { background: rgba(255,255,255,0.85); border-radius: 10px; padding: 3px 9px; font-size: 13px; color: #24343c; width: max-content; }
.missions div.done { background: rgba(92,207,134,0.9); color: #fff; text-decoration: line-through; }
.missions span { margin-right: 4px; }
.missions em { font-style: normal; color: #ff7a1a; }

/* Results extras */
.extras { display: flex; flex-direction: column; gap: 6px; }
.mres { background: #e7f8ee; color: #23784a; border-radius: 12px; padding: 6px 10px; }
.unlock { display: flex; align-items: center; gap: 10px; background: linear-gradient(90deg, #fff4c2, #fff); border: 2px solid #ffc929; border-radius: 16px; padding: 6px 10px; text-align: left; animation: capPop .7s cubic-bezier(.2,1.6,.4,1); }
.unlock canvas { width: 64px; height: 64px; }
.unlock small { display: block; color: #8a6a00; }
.unlock b { font-weight: 400; font-size: 18px; }
@media (max-width: 640px) {
  .missions { top: 150px; }
  .missions div { font-size: 11px; }
  .skingrid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Performance (docs/PERFORMANCE.md) */
/* Static spotlight in screen space: composited by the GPU once, instead of a canvas gradient fill every frame. */
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.42) 0, rgba(255,255,255,0.12) 38%, rgba(40,70,90,0.08) 75%); }
/* Bars animate transform (compositor-only) instead of width (layout). */
#pctFill, #goalFill, #bonusFill { width: 100% !important; transform-origin: 0 50%; transform: scaleX(0); transition: transform .3s; will-change: transform; }
#bonusFill { transition: none; }
/* Keep HUD layout work local to each widget. */
.mine, .board, .goalbar, .missions, .bonus, .toast, .spectate { contain: layout style; }
.minimap { contain: strict; }

/* Home v5: two columns on wide screens, scrollable on phones */
#homeScreen { overflow-y: auto; justify-content: flex-start; padding-top: 64px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); pointer-events: auto; touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

#homeScreen .logo { font-size: clamp(44px, 9vw, 76px); }
.label { font-size: 13px; color: #6b7f88; margin-bottom: -6px; }
.modes.rules { grid-template-columns: repeat(5, 1fr); }
.exp { display: grid; grid-template-columns: 28px 1fr auto 44px; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 14px; background: linear-gradient(90deg, #f1ecff, #fff); border: 2px solid #d8ccff; cursor: pointer; }
.exp span { font-size: 22px; }
.exp b { font-weight: 400; font-size: 14px; display: block; }
.exp b i { font-style: normal; color: #7f54d9; }
.exp small { font-size: 12px; color: #6b7f88; }
.exp em { font-style: normal; font-size: 12px; color: #7f54d9; }
.exp input { display: none; }
.exp .tg { width: 44px; height: 26px; border-radius: 13px; background: #cfd9df; position: relative; transition: background .15s; }
.exp .tg::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.exp input:checked + .tg { background: #a77bff; }
.exp input:checked + .tg::after { transform: translateX(18px); }
.fest { gap: 8px; }
.festhead { display: flex; justify-content: space-between; align-items: center; }
.festhead b { font-weight: 400; font-size: 17px; }
.festhead em { font-style: normal; font-size: 12px; color: #ff7a1a; }
.festq { font-size: 22px; text-align: center; }
.fsides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fside { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border-radius: 16px; background: #f3f6f8; border: 3px solid transparent; color: #24343c; }
.fside span { font-size: 30px; }
.fside b { font-weight: 400; font-size: 16px; }
.fside small { font-size: 12px; color: #6b7f88; }
.fside.on { border-color: var(--c); background: #fff; box-shadow: 0 4px 0 var(--c); }
.festnote, .festprev { color: #6b7f88; font-size: 12px; text-align: center; }
.festprev { color: #e0ac1f; }
.room { gap: 8px; }
.room b { font-weight: 400; font-size: 17px; }
.room small { color: #6b7f88; font-size: 12px; }
.roombtns { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; }
#roomCode { font: inherit; font-size: 18px; text-transform: uppercase; text-align: center; letter-spacing: 4px; border-radius: 12px; border: 3px solid #e1e8ec; padding: 6px; min-width: 0; outline: none; }
#roomCode:focus { border-color: #4fb4ff; }
@media (max-width: 640px) { .modes.rules .mode { font-size: 11px; } #homeScreen { padding-top: 60px; } }
.rrow.cut { opacity: .5; }
.rrow.team { background: #eef6ff; }
.rsep { font-size: 12px; color: #8a98a0; text-align: left; margin: 2px 4px; }

/* Friend room lobby */
#lobbyScreen { display: grid; place-items: center; padding: 16px; overflow-y: auto; pointer-events: auto; touch-action: pan-y; background: rgba(30,50,60,0.35); }
.lobby { width: min(440px, 100%); }
.lobhead { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.lobhead small { color: #6b7f88; display: block; }
.lobhead b { font-size: 40px; font-weight: 400; letter-spacing: 8px; color: #24343c; }
.icon-btn.dark { background: #eef3f6; color: #24343c; }
.lobnotice { background: #fff4c2; border-radius: 12px; padding: 8px 10px; color: #7a5200; font-size: 14px; text-align: center; }
.lobplayers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.lobplayers div { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 12px; background: #f3f6f8; font-size: 15px; }
.lobplayers i { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.lobplayers .host::after { content: '👑'; margin-left: auto; }
.lobplayers .me { outline: 2px solid #ffc929; background: #fff7d6; }
.lobteams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lobteams button { padding: 8px; border-radius: 12px; background: #f3f6f8; border: 3px solid transparent; font-size: 14px; color: #24343c; }
.lobteams button.on { border-color: var(--c); background: #fff; }
.lobhost { display: flex; flex-direction: column; gap: 8px; }
.lobwait { text-align: center; color: #6b7f88; padding: 12px; }
.exp.small { grid-template-columns: 28px 1fr auto 44px; }

/* Until main.js has its data and handlers, show a loader instead of dead buttons. */
.loader { position: fixed; inset: 0; z-index: 20; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: #3f6663; color: #fff; }
body.loading .loader { display: flex; }
.loader b { font-size: 40px; font-weight: 400; }
.loader i { width: 36px; height: 36px; border-radius: 50%; border: 5px solid rgba(255,255,255,0.3); border-top-color: #ffd24a; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.part.bank .bar div { background: #a77bff; }

/* Home v6: one main card (who · mode · start) + three menu tiles; everything else lives in sheets or 꾸미기. */
#homeScreen { justify-content: center; }
@media (max-height: 720px) { #homeScreen { justify-content: flex-start; } }
.card.main { width: min(380px, 100%); gap: 12px; }
.look { position: relative; width: 76px; height: 76px; padding: 0; border-radius: 20px; background: #f3f7f9; box-shadow: inset 0 -4px 0 #e1e8ec; }
.look canvas { width: 76px; height: 76px; display: block; }
.look em { position: absolute; right: -6px; bottom: -6px; font-style: normal; font-size: 15px; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; background: #fff3d1; box-shadow: 0 2px 0 #e8c66b; }
.modepick { display: grid; grid-template-columns: 40px 1fr 16px; align-items: center; gap: 10px; text-align: left; padding: 10px 14px; border-radius: 16px; background: #eef6fd; border: 2px solid #cfe6fb; color: #24343c; }
.modepick > span { font-size: 28px; text-align: center; }
.modepick b { display: block; font-weight: 400; font-size: 19px; }
.modepick small { display: block; color: #6b7f88; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modepick i { font-style: normal; font-size: 26px; color: #8aa4b2; }
.playopts { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: -2px; }
.playopts .bigger { flex: 1; font-size: 14px; padding: 7px 10px; border-width: 2px; }
.playopts .best { font-size: 14px; white-space: nowrap; }
.homenav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(380px, 100%); margin-top: 6px; }
.homenav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px 10px; border-radius: 18px; background: rgba(255,255,255,0.92); color: #24343c; font-size: 16px; box-shadow: 0 5px 0 rgba(20,40,50,0.22); }
.homenav button span { font-size: 26px; }
.homenav button small { font-size: 11px; color: #6b7f88; }
.homenav button:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(20,40,50,0.22); }
.sheet { position: fixed; inset: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: center; background: rgba(20,30,40,0.45); pointer-events: auto; animation: fadeIn .15s ease-out; }
.sheet .panel { width: min(440px, 100%); max-height: 86dvh; overflow-y: auto; touch-action: pan-y; background: #fff; border-radius: 24px 24px 0 0; padding: 16px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; animation: sheetUp .22s cubic-bezier(.2,.9,.3,1); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet .panel { border-radius: 24px; } }
.sheethead { display: flex; align-items: center; gap: 8px; }
.sheethead b { flex: 1; font-weight: 400; font-size: 20px; }
.sheethead em { font-style: normal; font-size: 12px; color: #ff7a1a; }
.sheetclose { width: 34px; height: 34px; border-radius: 50%; background: #eef3f6; color: #4a5d66; font-size: 16px; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
.lookcolor { margin: 12px 0 4px; padding: 14px; border-radius: 18px; background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,0.06); display: grid; gap: 4px; }
.lookcolor b { font-weight: 400; font-size: 18px; }
.lookcolor small { color: #6b7f88; font-size: 12px; margin-bottom: 6px; }
.lookcolor .swatches { justify-content: flex-start; }
.looksub { margin: 14px 0 0; font-weight: 400; font-size: 18px; }
