* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #10141f; color: #fff; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; position: fixed; inset: 0; }
canvas { display: block; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 14px; padding: 10px 18px; margin: 5px; min-height: 44px; background: #ffffff1f; color: #fff; font-weight: 700;
  transition: transform .08s, background .12s, filter .12s; }
button:hover { background: #ffffff33; }
button:active { transform: scale(.96); }
button.big { background: linear-gradient(#ffd34d, #ff9f1a); color: #3a2200; font-size: 1.25em; padding: 12px 34px; min-height: 56px; box-shadow: 0 4px 0 #b86a00, 0 8px 18px #0005; }
button.big:active { transform: translateY(3px); box-shadow: 0 1px 0 #b86a00; }
button.big.go { background: linear-gradient(#7dff8f, #26c24a); color: #06320f; box-shadow: 0 4px 0 #168a32, 0 8px 18px #0005; }
button.big.alt { background: #ffffff26; color: #fff; box-shadow: 0 4px 0 #0006; font-size: 1.05em; min-height: 48px; }
button.big small { font-size: .62em; opacity: .75; margin-left: 4px; }
button.small { padding: 6px 12px; font-size: .9em; margin: 0; }
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 5;
  padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
#pause, #result { background: #0008; }
.panel { background: #141a2bdd; border: 1.5px solid #ffffff2a; border-radius: 22px; padding: 18px 24px; text-align: center; max-width: 94vw; max-height: 94vh; overflow: auto;
  display: flex; flex-direction: column; align-items: center; box-shadow: 0 14px 40px #0006; }
.panel > button { min-width: 230px; }
.row { display: flex; flex-wrap: wrap; justify-content: center; }
h1 { margin: 0; font-size: clamp(36px, 8vw, 74px); letter-spacing: 3px; text-shadow: 0 5px 0 #0006; line-height: 1; }
h1 span { color: #ffd34d; }
h2 { margin: 4px 0 12px; }
.sub { margin: 6px 0 12px; opacity: .85; }
.coins { color: #ffd34d; font-weight: 800; }
a.home { color: #9ec5ff; margin-top: 10px; text-decoration: none; font-weight: 700; }

/* coin icon and pills */
.ci { display: inline-block; width: 1em; height: 1em; border-radius: 50%; vertical-align: -0.14em; background: radial-gradient(circle at 35% 30%, #fff6b8, #ffd34d 40%, #e09a00 75%);
  box-shadow: inset 0 0 0 .12em #c47f00, 0 1px 2px #0006; }
.coinpill, .pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: #0b0f1ab0; border: 1px solid #ffffff2a; font-weight: 800; white-space: nowrap; }
.coinpill { color: #ffd34d; font-size: 1.05em; }
.pill.site { font-size: .82em; opacity: .85; }

/* lobby */
.lobby { flex-direction: column; justify-content: flex-start; gap: 6px; background: linear-gradient(#0000, #10141f55); padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.lobby-top { width: 100%; max-width: 980px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lobby-top a.home { margin: 0; min-height: 44px; }
.lobby-top .wallet { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.lobby-main { flex: 1; width: 100%; max-width: 980px; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 0; }
.lobby-figbox { position: relative; flex: 0 1 300px; height: 100%; max-height: 340px; min-height: 160px; display: flex; align-items: flex-end; justify-content: center; }
.lobby-figbox::before { content: ''; position: absolute; left: 10%; right: 10%; bottom: 0; height: 70%; border-radius: 50% 50% 18px 18px; background: radial-gradient(ellipse at 50% 100%, #ffd34d44, #ffd34d00 70%); }
#lobby-fig { position: relative; width: 100%; height: 100%; }
.earned { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); background: #0b0f1acc; border: 1px solid #ffd34d88; color: #ffd34d; font-weight: 800; padding: 6px 14px; border-radius: 99px; white-space: nowrap; animation: glowin .5s ease-out both; }
@keyframes glowin { from { transform: translate(-50%, 8px) scale(.8); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.lobby-menu { flex: 0 1 430px; display: flex; flex-direction: column; align-items: center; background: #141a2be6; border: 1.5px solid #ffffff2a; border-radius: 22px; padding: 14px 18px;
  box-shadow: 0 14px 40px #0006; max-height: 100%; overflow: auto; }
.lobby-menu > button, #continue-box button.big { width: 100%; margin: 5px 0; }
#continue-box { width: 100%; }
.cont-line { font-size: .82em; opacity: .9; display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.linkbtn { background: none; padding: 4px 8px; min-height: 32px; margin: 0; color: #ff9e9e; text-decoration: underline; font-weight: 600; }
.lobby-menu .row { width: 100%; gap: 8px; margin-top: 4px; }
.lobby-menu .row button { flex: 1; margin: 0; }
button.mid { min-height: 52px; font-size: 1.05em; background: #ffffff24; border: 1px solid #ffffff22; }
.row.sm button { font-size: .82em; padding: 8px 8px; }
.how { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 9; padding: 16px; }
.how .panel { max-width: 520px; }
.how p { margin: 6px 0; line-height: 1.4; }
/* controller mode (stick.js sets <html data-mode>): pad buttons in place of keys */
html[data-mode="controller"] .kbOnly { display: none !important; }
html:not([data-mode="controller"]) .padOnly { display: none !important; }

/* stage map */
.map-panel { width: min(960px, 96vw); padding: 12px 16px; }
.map-top { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; }
.map-top h2 { margin: 0; font-size: 1.2em; }
#worlds { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; width: 100%; margin-top: 10px; }
.world { border-radius: 14px; padding: 8px; text-align: left; }
.world h3 { margin: 2px 4px 6px; font-size: 1em; display: flex; justify-content: space-between; }
.world.locked { filter: grayscale(.8) brightness(.6); }
.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.stages button { min-width: 0; margin: 0; padding: 6px 2px; font-size: .95em; line-height: 1.1; background: #0005; min-height: 44px; }
.stages button small { display: block; font-size: .62em; font-weight: 600; opacity: .85; }
.stages button.done { background: #2a9d4a99; }
.stages button:disabled { opacity: .4; cursor: default; }

/* shop */
.shop-panel { width: min(980px, 96vw); height: min(620px, 94vh); padding: 10px 14px; align-items: stretch; }
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shop-head h2 { margin: 0; }
.shop-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 6px; scrollbar-width: none; flex: 0 0 auto; }
.shop-tabs .tab { margin: 0; flex: 0 0 auto; border-radius: 99px; padding: 8px 16px; background: #ffffff14; border: 1px solid #ffffff22; }
.shop-tabs .tab.on { background: #ffd34d; color: #3a2200; }
.shop-body { flex: 1; display: flex; gap: 10px; min-height: 0; }
.shop-side { flex: 0 0 200px; display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% 90%, #ffd34d33, #0b0f1a88 70%); border-radius: 16px; border: 1px solid #ffffff1a; padding: 6px; min-height: 0; }
.shop-fig { flex: 1; width: 100%; min-height: 0; }
.shop-info { font-size: .8em; opacity: .85; min-height: 2.4em; padding: 4px; }
.shop-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; align-content: start; padding: 2px; touch-action: pan-y; }
.card { background: #ffffff10; border: 1.5px solid #ffffff1f; border-radius: 14px; padding: 8px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; cursor: pointer; }
.card.sel { border-color: #ffd34d; background: #ffd34d1a; }
.card.equipped { border-color: #5dff8a; }
.card .ic { height: 56px; display: flex; align-items: center; justify-content: center; }
.card .mini { width: 56px; height: 56px; }
.card .swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff8; box-shadow: 0 2px 6px #0006; }
.card .glyph { font-size: 34px; }
.card .nm { font-weight: 800; font-size: .92em; }
.card .ds { font-size: .7em; opacity: .75; }
.card .bd { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.badge { font-size: .66em; font-weight: 800; padding: 2px 7px; border-radius: 99px; background: #ffffff22; }
.badge.eqd { background: #2fdc63; color: #052b10; }
.pips { display: flex; gap: 3px; }
.pips i { width: 14px; height: 6px; border-radius: 3px; background: #ffffff22; }
.pips i.on { background: #ffd34d; }
.card .act { margin: 4px 0 0; width: 100%; min-height: 44px; padding: 6px 8px; background: linear-gradient(#ffd34d, #ff9f1a); color: #3a2200; box-shadow: 0 3px 0 #b86a00; }
.card .act.eq { background: #3fa9ff; color: #fff; box-shadow: 0 3px 0 #1d6fb8; }
.card .act.on { background: #ffffff22; color: #fff; box-shadow: none; }
.card .act.max { background: #2fdc63; color: #052b10; box-shadow: none; }
.card.poor .act { filter: grayscale(1) brightness(.7); }
.card.poor .ic, .card.poor .nm { opacity: .6; }

/* result */
#res-body p { margin: 6px 0; }
.earn { color: #ffd34d; font-weight: 800; font-size: 1.15em; }
.earn small { display: block; font-size: .62em; color: #fff; opacity: .8; font-weight: 600; margin-top: 2px; }

/* HUD */
#hud { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); pointer-events: none; z-index: 3; text-shadow: 0 2px 0 #0008; font-weight: 700; font-size: 15px; }
#hud .hud-r { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
#hud-time { font-variant-numeric: tabular-nums; }
.hud-power { --cd: 0; position: relative; overflow: hidden; padding: 6px 10px; border-radius: 99px; background: #0b0f1ab0; border: 1px solid #ffffff2a; font-size: .85em; }
.hud-power::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: calc((1 - var(--cd)) * 100%); background: #ffd34d; }
.hud-power kbd { font: inherit; background: #ffffff22; border-radius: 5px; padding: 0 5px; }
@media (pointer: coarse) { .hud-power { display: none; } }

/* glass touch controls */
.glass { background: rgba(16, 20, 31, .5); border: 1.5px solid rgba(255, 255, 255, .3); color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .18); display: flex; align-items: center; justify-content: center; }
.glass svg { width: 52%; height: 52%; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 1px #0008); pointer-events: none; }
.glass svg .fill, #btn-pause svg { fill: #fff; stroke: none; }
#btn-pause { width: 44px; height: 44px; min-height: 44px; border-radius: 50%; margin: 0; padding: 0; }
#btn-pause svg { width: 46%; height: 46%; }
#touch { position: fixed; inset: auto 0 0 0; height: 0; z-index: 4; }
#touch button { position: fixed; border-radius: 50%; margin: 0; padding: 0; touch-action: none; min-height: 0; transition: transform .07s, background .1s, border-color .1s; }
#touch button.on { transform: scale(.9); background: rgba(255, 255, 255, .3); border-color: rgba(255, 255, 255, .75); }
#touch .mv { width: 76px; height: 76px; bottom: max(16px, calc(env(safe-area-inset-bottom) + 6px)); }
#touch .mv.l { left: max(16px, env(safe-area-inset-left)); }
#touch .mv.r { left: calc(max(16px, env(safe-area-inset-left)) + 90px); }
#touch .jump { width: 94px; height: 94px; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px)); background: rgba(255, 180, 40, .28); border-color: rgba(255, 220, 120, .55); }
#touch .jump.on { background: rgba(255, 200, 70, .55); }
#touch .power { --cd: 0; width: 62px; height: 62px; right: calc(max(18px, env(safe-area-inset-right)) + 16px); bottom: calc(max(18px, calc(env(safe-area-inset-bottom) + 8px)) + 108px);
  background: conic-gradient(rgba(16, 20, 31, .7) calc(var(--cd) * 360deg), rgba(140, 90, 255, .45) 0); border-color: rgba(200, 170, 255, .7); }
#touch .power.cool svg { opacity: .45; }

/* popups */
#popups { position: fixed; top: max(56px, calc(env(safe-area-inset-top) + 48px)); left: 50%; transform: translateX(-50%); z-index: 8; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pop { background: #000a; color: #ffd34d; font-weight: 800; padding: 6px 14px; border-radius: 99px; animation: pop 1.8s ease-out forwards; white-space: nowrap; }
.pop.gold { background: #3a2600dd; border: 1px solid #ffd34d; }
@keyframes pop { 0% { transform: translateY(10px) scale(.7); opacity: 0; } 12% { transform: none; opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-16px); opacity: 0; } }
#rotate { display: none; position: fixed; inset: 0; z-index: 20; background: #10141f; align-items: center; justify-content: center; text-align: center; font-size: 22px; font-weight: 700; }
@media (orientation: portrait) and (pointer: coarse) { body.playing #rotate { display: flex; } }

/* short landscape screens (phones) */
@media (max-height: 460px) {
  .panel { padding: 10px 16px; } h1 { font-size: 40px; } .panel > button { padding: 7px 14px; margin: 3px; } button.big { padding: 8px 28px; min-height: 52px; font-size: 1.15em; }
  .sub { margin: 3px 0 6px; font-size: .85em; }
  .lobby-menu { padding: 10px 14px; }
  .lobby-menu h1 { font-size: 34px; }
  .lobby.has-cont .sub { display: none; }
  .lobby.has-cont .lobby-menu h1 { font-size: 28px; margin-bottom: 2px; }
  .lobby.has-cont #btn-play { min-height: 44px; padding: 4px 20px; }
  .cont-line { margin-bottom: 2px; }
  .lobby-top .coinpill, .lobby-top .pill { padding: 4px 10px; }
  .lobby-menu > button, #continue-box button.big { margin: 3px 0; }
  button.big.alt { min-height: 44px; }
  button.mid { min-height: 46px; }
  .shop-side { flex-basis: 150px; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
  .card .ic { height: 44px; } .card .mini { width: 44px; height: 44px; } .card .glyph { font-size: 28px; }
  .card .ds { display: none; }
}
/* portrait phones: stack the lobby and the shop */
@media (orientation: portrait) and (max-width: 600px) {
  .lobby-main { flex-direction: column; justify-content: flex-start; gap: 6px; }
  .lobby-figbox { flex: 1 1 200px; width: 100%; max-height: 300px; }
  .lobby-menu { flex: 0 0 auto; width: 100%; }
  .lobby-top .pill.site { display: none; }
  .shop-panel { height: 94vh; }
  .shop-body { flex-direction: column; }
  .shop-side { flex: 0 0 170px; flex-direction: row; }
  .shop-fig { flex: 1 1 auto; width: auto; height: 100%; }
  .shop-info { flex: 0 0 42%; align-self: center; }
  .shop-grid { grid-template-columns: repeat(2, 1fr); }
  .panel > button { min-width: 0; width: 100%; }
}

/* online races */
body.online #btn-restart, body.online #btn-select, body.online #btn-savequit { display: none; }
body:not(.online) #btn-leave-race { display: none; }
.on-panel { width: min(900px, 96vw); align-items: stretch; text-align: left; padding: 12px 18px; }
.on-head { display: flex; align-items: center; gap: 10px; }
.on-head h2 { margin: 0; flex: 1; font-size: 1.25em; }
.on-status { font-size: .8em; font-weight: 800; color: #7dff8f; white-space: nowrap; }
.on-panel h3 { margin: 10px 0 6px; font-size: .8em; text-transform: uppercase; letter-spacing: .8px; opacity: .7; }
.on-sub { margin: 6px 0 8px; opacity: .85; font-size: .92em; }
.on-big { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; }
.on-big button { margin: 0; }
.on-big .go-btn { background: linear-gradient(#7dff8f, #26c24a); color: #06320f; }
.on-join { display: flex; gap: 6px; }
.on-join input { flex: 1; min-width: 0; font: 900 20px system-ui, sans-serif; letter-spacing: 4px; text-transform: uppercase; text-align: center; border-radius: 14px;
  border: 2px solid #ffffff33; background: #0b0f1a; color: #fff; padding: 6px; user-select: text; -webkit-user-select: text; touch-action: manipulation; }
.on-join button { margin: 0; }
.on-msg { margin: 8px 0 2px; min-height: 1.2em; font-size: .9em; color: #ffd34d; font-weight: 700; }
.on-top { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.on-codebox { background: #0b0f1a; border: 2px dashed #ffd34d; border-radius: 16px; padding: 4px 14px; text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.on-codebox small { font-weight: 800; font-size: 11px; opacity: .7; }
.on-codebox b { font-size: 38px; letter-spacing: 6px; color: #ffd34d; line-height: 1.1; }
.on-codebox button { min-height: 30px; padding: 3px 10px; font-size: .75em; margin: 2px 0 4px; }
.on-players { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; min-width: 260px; }
.on-p { background: #ffffff14; border-radius: 12px; padding: 3px 6px 3px 3px; display: flex; align-items: center; gap: 4px; border: 2px solid transparent; position: relative; min-height: 50px; min-width: 0; }
.on-p.me { border-color: #ffd34d; }
.on-p.away { opacity: .5; }
.on-p.empty { opacity: .35; justify-content: center; font-weight: 700; font-size: 12px; }
.on-p canvas { width: 28px; height: 44px; flex: none; }
.on-p b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.on-p i { position: absolute; top: -8px; right: 2px; font-style: normal; font-size: 13px; }
.on-course { display: flex; align-items: center; gap: 6px; margin: 8px 0 2px; flex-wrap: wrap; }
.on-course .on-lbl { font-size: .8em; text-transform: uppercase; opacity: .7; font-weight: 800; }
.on-course b { min-width: 170px; text-align: center; background: #0b0f1a; border-radius: 10px; padding: 7px 10px; }
.on-course button { margin: 0; min-height: 38px; }
.on-course button:disabled { opacity: .35; cursor: default; }
#on-in .row { justify-content: flex-start; gap: 8px; }
#on-in .row button { margin: 4px 0; }
#on-start:disabled { filter: grayscale(.8); opacity: .55; cursor: default; }
.on-friends { display: flex; flex-wrap: wrap; gap: 6px; }
.on-f { display: flex; align-items: center; gap: 6px; background: #ffffff14; border-radius: 99px; padding: 3px 4px 3px 12px; font-weight: 800; font-size: 14px; }
.on-f em { font-style: normal; font-size: 11px; opacity: .7; font-weight: 700; }
.on-f .dot { width: 9px; height: 9px; border-radius: 50%; background: #666; } .on-f .dot.on { background: #4fdc7a; }
.on-f button, .on-f a { font-size: 13px; padding: 5px 12px; min-height: 34px; border-radius: 99px; margin: 0; background: #ffd34d; color: #3a2200; text-decoration: none; font-weight: 800; display: inline-flex; align-items: center; }
.on-f button:disabled { opacity: .6; }
.on-note { font-size: .88em; opacity: .85; margin: 2px 0; } .on-note a { color: #ffd34d; }
#race-board { position: fixed; z-index: 3; left: max(10px, env(safe-area-inset-left)); top: max(58px, calc(env(safe-area-inset-top) + 50px)); pointer-events: none;
  background: #0b0f1aa8; border-radius: 12px; padding: 4px 8px; font-size: 13px; font-weight: 700; line-height: 1.45; min-width: 130px; text-shadow: 0 1px 0 #0008; }
#race-board .me { color: #ffd34d; }
#race-board .gone { opacity: .45; text-decoration: line-through; }
#race-board .pl { display: inline-block; width: 1.6em; }
#race-board small { opacity: .75; font-weight: 600; }
#race-cd { position: fixed; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; pointer-events: none; font-size: min(26vh, 160px); font-weight: 900;
  color: #ffd34d; text-shadow: 0 6px 0 #0008, 0 0 30px #000a; }
#race-msg { position: fixed; z-index: 4; left: 50%; transform: translateX(-50%); top: max(10px, env(safe-area-inset-top)); pointer-events: none; background: #3a2600dd; border: 1px solid #ffd34d;
  color: #ffd34d; font-weight: 800; padding: 5px 14px; border-radius: 99px; white-space: nowrap; font-size: 14px; }
#net-banner { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: max(10px, env(safe-area-inset-bottom)); pointer-events: none; background: #141a2bee;
  border: 2px solid #ff6b6b; color: #ffb3b3; border-radius: 99px; padding: 5px 16px; font-weight: 800; font-size: 14px; }
.onres-table { display: flex; flex-direction: column; gap: 3px; min-width: min(420px, 86vw); margin-bottom: 4px; }
.onres-row { display: flex; gap: 10px; align-items: center; background: #ffffff12; border-radius: 10px; padding: 4px 10px; font-weight: 700; }
.onres-row.me { background: #ffd34d33; border: 1px solid #ffd34d88; }
.onres-row .pl { width: 2.2em; font-weight: 900; color: #ffd34d; }
.onres-row .nm { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.onres-row .tm { font-variant-numeric: tabular-nums; opacity: .9; }
@media (max-height: 460px) {
  .on-panel { padding: 8px 14px; } .on-panel h3 { margin: 6px 0 4px; } .on-codebox b { font-size: 28px; }
  .on-p { min-height: 44px; } .on-p canvas { height: 38px; width: 24px; }
  #race-board { font-size: 12px; line-height: 1.35; top: max(50px, calc(env(safe-area-inset-top) + 44px)); }
  .onres-row { padding: 2px 10px; }
}
@media (max-width: 640px) { .on-big { grid-template-columns: 1fr 1fr; } .on-join { grid-column: 1 / -1; } .on-players { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Clean Light menus (stick.cafe look, see /sunny.css). Scoped to .screen/.how so the HUD, touch buttons and canvas keep their look. ---- */
.screen, .how { font-family: var(--sun-font); color: var(--sun-ink); }
#pause, #result, #map, #shop, #online, #onres, .how { background: rgba(242,244,245,.85); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lobby { background: rgba(242,244,245,.35); }
.screen .panel, .how .panel, .lobby-menu { background: #fff; border: 1px solid var(--sun-panel-edge); border-radius: 14px; box-shadow: var(--sun-shadow); color: var(--sun-ink); }
.screen button, .how button { background: #fff; color: var(--sun-ink); border: 1px solid var(--sun-panel-edge); border-radius: 9px; font-weight: 800; box-shadow: none; transition: background .15s, transform .08s; }
.screen button:hover, .how button:hover { background: var(--sun-track); }
.screen button:active, .how button:active { transform: scale(.97); }
.screen button.big, .how button.big, .screen button.big.go, .on-big .go-btn { background: var(--sun-green); border-color: var(--sun-green); color: #fff; font-weight: 900; box-shadow: none; }
.screen button.big:hover, .how button.big:hover, .on-big .go-btn:hover { background: var(--sun-green-d); }
.screen button.big:active { transform: scale(.97); box-shadow: none; }
#btn-online { background: var(--sun-blue); border-color: var(--sun-blue); color: #fff; }
#btn-online:hover { background: var(--sun-blue-d); }
#btn-shop { background: var(--sun-yellow); border-color: var(--sun-yellow); color: var(--sun-ink); }
#btn-shop:hover { background: var(--sun-yellow-d); }
.screen button.mid { background: #fff; border: 1px solid var(--sun-panel-edge); }
#btn-online.mid { background: var(--sun-blue); border-color: var(--sun-blue); }
#btn-shop.mid { background: var(--sun-yellow); border-color: var(--sun-yellow); }
.screen .linkbtn { background: none; border: 0; color: var(--sun-pink); }
.screen h1 { font-family: var(--sun-font); font-weight: 900; letter-spacing: 1px; text-shadow: none; color: var(--sun-ink); }
.screen h1 span { color: var(--sun-blue); }
.screen h2, .how h2 { font-weight: 900; }
.screen .sub, .cont-line, .shop-info { color: var(--sun-dim); opacity: 1; font-weight: 700; }
.screen .coinpill, .screen .pill, .lobby-top a.home { background: #fff; border: 1px solid var(--sun-panel-edge); color: var(--sun-ink); font-family: var(--sun-font); font-weight: 800; opacity: 1; }
.screen .coinpill, .screen .coins { color: var(--sun-yellow-d); }
.lobby-top a.home:hover { background: var(--sun-track); }
.screen a.home { color: var(--sun-blue); }
.lobby-figbox::before { background: radial-gradient(ellipse at 50% 100%, #0000000f, #0000 70%); }
.earned { background: #fff; border: 1px solid var(--sun-panel-edge); color: var(--sun-yellow-d); }
/* stage map: world cards keep their sky colour like a picture */
.world { border: 1px solid var(--sun-panel-edge); box-shadow: 0 1px 2px rgba(0,0,0,.06); color: #fff; }
.world h3 { font-weight: 900; text-shadow: 0 1px 2px #0006; }
.screen .stages button { background: #ffffffe0; color: var(--sun-ink); border: 0; }
.screen .stages button.done { background: var(--sun-green); color: #fff; }
/* shop */
.shop-tabs .tab { background: transparent; border: 0; color: var(--sun-dim); border-radius: 8px; }
.shop-tabs .tab:hover { color: var(--sun-ink); background: transparent; }
.shop-tabs .tab.on { background: #e3e6e8; color: var(--sun-ink); }
.shop-side { background: var(--sun-track); border: 1px solid var(--sun-panel-edge); border-radius: 12px; }
.screen .card { background: #fff; border: 1px solid var(--sun-panel-edge); border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.screen .card.sel { border-color: var(--sun-blue); background: #f0f4ff; }
.screen .card.equipped { border-color: var(--sun-green); }
.card .ds { color: var(--sun-dim); opacity: 1; }
.card .swatch { border-color: #fff; box-shadow: 0 0 0 1px var(--sun-panel-edge); }
.badge { background: #e3e6e8; color: var(--sun-ink); } .badge.eqd { background: var(--sun-green); color: #fff; }
.pips i { background: #e3e6e8; } .pips i.on { background: var(--sun-yellow); }
.screen .card .act { background: var(--sun-yellow); border: 0; color: var(--sun-ink); box-shadow: none; }
.screen .card .act.eq { background: var(--sun-blue); color: #fff; box-shadow: none; }
.screen .card .act.on { background: var(--sun-track); color: var(--sun-dim); }
.screen .card .act.max { background: var(--sun-green); color: #fff; }
/* results */
.screen .earn { color: var(--sun-yellow-d); } .screen .earn small { color: var(--sun-dim); opacity: 1; }
.onres-row { background: var(--sun-track); } .onres-row.me { background: #e6f7ef; border-color: var(--sun-green); }
.onres-row .pl { color: var(--sun-yellow-d); }
/* online */
.on-status { color: var(--sun-green); }
.on-panel h3 { color: var(--sun-ink); opacity: 1; font-weight: 900; text-transform: none; letter-spacing: 0; font-size: .95em; }
.on-sub, .on-note { color: var(--sun-dim); opacity: 1; } .on-note a { color: var(--sun-blue); }
.on-msg { color: var(--sun-yellow-d); }
.on-join input { background: var(--sun-track); border: 1px solid var(--sun-panel-edge); color: var(--sun-ink); border-radius: 9px; font-family: var(--sun-font); }
.on-codebox { background: #fff; border: 1px dashed var(--sun-yellow); border-radius: 12px; } .on-codebox b { color: var(--sun-ink); } .on-codebox small { color: var(--sun-dim); opacity: 1; }
.on-p { background: var(--sun-track); } .on-p.me { border-color: var(--sun-green); }
.on-course .on-lbl { color: var(--sun-dim); opacity: 1; }
.on-course b { background: var(--sun-track); color: var(--sun-ink); }
.on-f { background: var(--sun-track); } .on-f em { color: var(--sun-dim); opacity: 1; }
.on-f .dot { background: #c4c8cc; } .on-f .dot.on { background: var(--sun-green); }
.screen .on-f button, .screen .on-f a { background: var(--sun-green); border: 0; color: #fff; border-radius: 9px; }
.lobby-menu h1 { font-size: clamp(34px, 5.4vw, 60px); white-space: nowrap; }
.lobby-top a.home { color: var(--sun-ink); }
@media (max-height: 460px) { .lobby-menu h1 { font-size: 34px; } }

/* ---- 2026-11: Daily / Endless / Boards, secret stars, coils ---- */
#boards { background: rgba(242,244,245,.85); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
#btn-daily.mid { background: var(--sun-green); border-color: var(--sun-green); color: #fff; }
#btn-daily.mid:hover { background: var(--sun-green-d); }
#btn-endless.mid { background: #8a5cff; border-color: #8a5cff; color: #fff; }
#btn-endless.mid:hover { background: #7446e8; }
.lobby-menu .row.modes { margin-top: 6px; }
.lobby-menu .row.modes button.mid { min-height: 44px; font-size: .98em; }
.b-panel { width: min(460px, 94vw); max-height: 92vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.b-head { display: flex; align-items: center; gap: 10px; } .b-head h2 { margin: 0; font-size: 1.3em; }
.b-head button.small { margin: 0; }
.b-tabs { display: flex; gap: 6px; } .b-tabs button { flex: 1; margin: 0; min-height: 40px; white-space: nowrap; }
.screen .b-tabs button.on { background: var(--sun-blue); border-color: var(--sun-blue); color: #fff; }
.b-mine { margin: 0; color: var(--sun-dim); font-weight: 700; font-size: .9em; }
.lb-list, .lb-mini { display: flex; flex-direction: column; gap: 3px; text-align: left; }
.lb-list > div, .lb-mini > div { display: flex; align-items: center; gap: 8px; background: var(--sun-track); border-radius: 8px; padding: 5px 10px; font-weight: 800; }
.lb-list > div.me, .lb-mini > div.me { background: #e6f7ef; outline: 1.5px solid var(--sun-green); }
.lb-list span, .lb-mini span { width: 26px; text-align: center; } .lb-list b, .lb-mini b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-list i, .lb-mini i { font-style: normal; color: var(--sun-yellow-d); }
.lb-list .note, .lb-mini .note { background: none; justify-content: center; color: var(--sun-dim); font-weight: 700; }
.lb-mini { margin: 4px 0 6px; font-size: .88em; }
#b-play { margin: 2px 0 0; width: 100%; }
.stages button i.st { font-style: normal; color: #c9a400; margin-left: 2px; font-size: .85em; opacity: .45; }
.stages button i.st.got { opacity: 1; color: #ffb800; }
.screen .stages button.done i.st.got { color: #fff6a8; }
.world h3 small.wstars { font-size: .7em; font-weight: 800; opacity: .9; margin-left: 6px; }
.hud-coils { font-weight: 800; }
.screen .card .act.lock { background: var(--sun-track); color: var(--sun-dim); }
@media (max-height: 460px) {
  .lobby-menu .sub { display: none; }
  .lobby-menu .row.modes { margin-top: 3px; }
  .lobby-menu .row.modes button.mid { min-height: 38px; font-size: .9em; padding: 4px 6px; }
  .row.sm button { padding: 5px 6px; font-size: .76em; }
  .b-panel { padding: 8px 12px; gap: 5px; } .lb-list > div { padding: 3px 10px; }
  #result .panel { max-height: 94vh; overflow-y: auto; }
}
@media (max-height: 460px) {
  #pause .panel { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 94vh; overflow-y: auto; width: min(520px, 94vw); }
  #pause .panel > h2, #pause #btn-resume, #pause .panel > a.home { grid-column: 1 / -1; }
  #pause .panel > h2 { margin: 0; }
  #pause .panel > button { margin: 0; min-height: 40px; font-size: .9em; }
  #pause .panel > button.hidden { display: none; }
}
