:root {
  --ink: #f4f8ff; --mut: #9fb2c8; --panel: rgba(10, 18, 32, 0.84); --panel2: rgba(18, 30, 50, 0.92); --line: rgba(160, 200, 255, 0.14);
  --ice: #38c6ff; --hot: #ff5a2a; --gold: #ffcf3a; --good: #3ae88a; --bad: #ff4a5a;
  --f: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0a1220; color: var(--ink); font-family: var(--f); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input { font-family: inherit; }
.hidden { display: none !important; }
.mut { color: var(--mut); font-weight: 500; }
.small { font-size: 12px; }

/* ---------- logo */
.logo { display: inline-flex; align-items: baseline; gap: 10px; font-style: italic; font-weight: 900; letter-spacing: -1px; line-height: 0.9; transform: skewX(-6deg); }
.logo span { font-size: 44px; color: #fff; text-shadow: 0 3px 0 #1a4a8a, 0 8px 24px rgba(0, 40, 90, 0.5); }
.logo b { font-size: 44px; background: linear-gradient(180deg, #9ae4ff, #38c6ff 50%, #1a7ad8); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 #0a2a5a); }
.logo i { font-size: 22px; color: var(--hot); font-style: italic; align-self: flex-start; margin-top: -4px; }
.logo.big span, .logo.big b { font-size: clamp(34px, 3.9vw, 54px); }
.logo.big i { font-size: clamp(20px, 2.4vw, 32px); }

/* ---------- boot / loading */
#boot, #loading { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 30%, #1e3a64, #08101e 70%); transition: opacity 0.5s; }
#loading { background: rgba(6, 12, 22, 0.88); z-index: 55; }
.bootIn, .ldIn { text-align: center; }
.bar { width: 260px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); margin: 26px auto 12px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ice), #fff); border-radius: 3px; transition: width 0.25s; }
.bar i.spin { width: 35%; animation: slide 1s ease-in-out infinite alternate; }
@keyframes slide { from { transform: translateX(-10%); } to { transform: translateX(200%); } }
#bootMsg, .ldTip { color: var(--mut); font-size: 13px; }
.ldMap { font-size: 40px; font-weight: 900; font-style: italic; letter-spacing: -1px; }
.ldMode { color: var(--ice); font-weight: 800; letter-spacing: 3px; font-size: 13px; margin-top: 4px; }
.ldTip { max-width: 420px; margin: 8px auto 0; line-height: 1.45; }
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 70; transition: opacity 0.35s; }

/* ---------- screens */
.screen { position: fixed; inset: 0; z-index: 20; display: none; padding: max(22px, env(safe-area-inset-top)) max(26px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(26px, env(safe-area-inset-left)); }
.screen.on { display: flex; }
.screen.sub { flex-direction: column; background: linear-gradient(90deg, rgba(6, 12, 24, 0.86), rgba(6, 12, 24, 0.55)); overflow: hidden; }
#home { justify-content: space-between; align-items: stretch; background: linear-gradient(90deg, rgba(4, 10, 22, 0.72) 0%, rgba(4, 10, 22, 0.25) 42%, rgba(4, 10, 22, 0) 60%, rgba(4, 10, 22, 0.35) 100%); }
.homeL { display: flex; flex-direction: column; gap: 18px; width: min(460px, 100%); overflow-y: auto; overflow-x: hidden; padding: 12px 8px 4px 4px; }
.homeR { display: flex; flex-direction: column; gap: 12px; width: 300px; justify-content: flex-start; }
.homeHint { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); color: rgba(255, 255, 255, 0.55); font-size: 12px; letter-spacing: 2px; }
.menu { display: flex; flex-direction: column; gap: 8px; }
.mrow { display: flex; gap: 8px; }
.mbtn { text-align: left; border: 1px solid var(--line); background: var(--panel); padding: 11px 16px; border-radius: 12px; display: flex; flex-direction: column; gap: 2px; transition: transform 0.12s, background 0.12s, border-color 0.12s; position: relative; overflow: hidden; }
.mbtn.half { flex: 1; }
.mbtn em { font-style: italic; font-weight: 900; font-size: 18px; letter-spacing: 0.3px; }
.mbtn small { color: var(--mut); font-size: 12px; }
.mbtn:hover, .mbtn:focus-visible { transform: translateX(4px); background: var(--panel2); border-color: rgba(56, 198, 255, 0.55); outline: none; }
.mbtn.hero { background: linear-gradient(100deg, #ff6a2a, #ff3a5a); border: none; padding: 16px 18px; box-shadow: 0 10px 30px rgba(255, 70, 60, 0.35); }
.mbtn.hero em { font-size: 26px; }
.mbtn.hero small { color: rgba(255, 255, 255, 0.85); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.cardH { font-size: 11px; letter-spacing: 2px; font-weight: 800; color: var(--mut); margin-bottom: 8px; }
.pTop { display: flex; gap: 10px; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--ice), #1a5ad8); display: grid; place-items: center; font-weight: 900; font-size: 20px; flex: none; }
.pId { flex: 1; min-width: 0; }
.pId input { width: 100%; background: transparent; border: none; color: #fff; font-size: 17px; font-weight: 800; padding: 0; outline: none; border-bottom: 1px dashed transparent; }
.pId input:focus { border-bottom-color: var(--ice); }
.lvl { font-size: 11px; color: var(--mut); letter-spacing: 1px; margin-top: 2px; }
.lvl b { color: #fff; }
.coins { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: 16px; }
.coin { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6b0, #ffcf3a 45%, #c8901a); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25) inset; display: inline-block; }
.xpbar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); margin-top: 12px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ice), #9ae4ff); width: 0; }
.xpTxt { font-size: 11px; color: var(--mut); margin-top: 4px; text-align: right; }
.dRow { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 0; border-top: 1px solid var(--line); }
.dRow:first-child { border-top: none; }
.dRow .dTxt { flex: 1; }
.dRow .dProg { font-size: 11px; color: var(--mut); }
.dRow.done .dTxt { color: var(--good); text-decoration: line-through; }
.weekly h4 { margin: 0 0 4px; font-size: 13px; letter-spacing: 1px; color: var(--gold); }
.weekly p { margin: 0; font-size: 13px; color: var(--mut); }
.netStatus { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--mut); padding: 0 4px; }
.netStatus i { width: 8px; height: 8px; border-radius: 50%; background: #667; }
.netStatus.on i { background: var(--good); box-shadow: 0 0 8px var(--good); }
.netStatus.err i { background: var(--bad); }
.netStatus.warn i { background: var(--gold); }

/* ---------- sub pages */
.subHead { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; flex: none; }
.subHead h2 { margin: 0; font-style: italic; font-weight: 900; font-size: 30px; letter-spacing: -0.5px; flex: 1; }
.back { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; font-weight: 800; font-size: 13px; letter-spacing: 1px; }
.back:hover { border-color: var(--ice); }
.lbl { font-size: 11px; letter-spacing: 2px; font-weight: 800; color: var(--mut); margin: 14px 0 8px; }
.lbl .mut { letter-spacing: 0; font-size: 12px; color: #fff; margin-left: 6px; }
.go { background: linear-gradient(100deg, #ff6a2a, #ff3a5a); border: none; border-radius: 12px; padding: 14px 22px; font-weight: 900; font-style: italic; font-size: 18px; letter-spacing: 0.5px; box-shadow: 0 8px 24px rgba(255, 70, 60, 0.3); transition: transform 0.1s, filter 0.1s; }
.go:hover { transform: translateY(-1px); filter: brightness(1.08); }
.go:active { transform: translateY(1px); }
.go.alt { background: var(--panel2); border: 1px solid var(--line); box-shadow: none; }
.go.alt:hover { border-color: var(--ice); }
.go.small { padding: 10px 14px; font-size: 14px; }
.go:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.6); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; font-weight: 800; font-size: 12px; letter-spacing: 0.5px; }
.seg button.on { background: var(--ice); color: #04121e; border-color: var(--ice); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; flex: none; }
.tabs button { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; font-weight: 800; font-size: 12px; letter-spacing: 1px; }
.tabs button.on { background: #fff; color: #04121e; }
.tabBody { flex: 1; overflow-y: auto; padding-right: 4px; }

/* play */
.playBody { display: flex; gap: 22px; flex: 1; min-height: 0; }
.modeGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; align-content: start; width: 54%; overflow-y: auto; padding-right: 4px; }
.mode { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; min-height: 104px; transition: border-color 0.12s, transform 0.12s; }
.mode:hover { transform: translateY(-2px); border-color: rgba(56, 198, 255, 0.5); }
.mode.on { border-color: var(--ice); background: linear-gradient(160deg, rgba(56, 198, 255, 0.22), var(--panel2)); box-shadow: 0 0 0 1px var(--ice) inset; }
.mode b { font-style: italic; font-weight: 900; font-size: 17px; }
.mode span { font-size: 12px; color: var(--mut); line-height: 1.35; }
.mode .mi { width: 30px; height: 30px; }
.setup { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow-y: auto; }
.mapStrip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; flex: none; }
.mcard { flex: none; width: 150px; border-radius: 12px; overflow: hidden; border: 2px solid transparent; background: var(--panel); text-align: left; padding: 0; position: relative; }
.mcard.on { border-color: var(--ice); }
.mcard .thumb { width: 100%; aspect-ratio: 16/9; background-size: cover; background-position: center; display: block; }
.mcard .mname { font-weight: 800; font-size: 12px; padding: 6px 8px 7px; display: block; }
.mcard .mtag { position: absolute; top: 6px; left: 6px; font-size: 9px; letter-spacing: 1px; font-weight: 900; background: rgba(0, 0, 0, 0.6); padding: 3px 6px; border-radius: 5px; }
.mcard .stars { position: absolute; top: 6px; right: 6px; font-size: 11px; color: var(--gold); text-shadow: 0 1px 2px #000; }
.opts { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: center; margin: 14px 0 18px; font-size: 13px; }
.opts > span { color: var(--mut); font-weight: 700; font-size: 12px; letter-spacing: 1px; }
.opts .desc { grid-column: 1 / -1; color: var(--mut); line-height: 1.45; background: var(--panel); border-radius: 10px; padding: 10px 12px; }
#startBtn { align-self: flex-start; font-size: 22px; padding: 16px 34px; }
.mapGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; overflow-y: auto; padding-right: 4px; }
.mapBig { background: var(--panel); border: 2px solid var(--line); border-radius: 14px; overflow: hidden; text-align: left; padding: 0; display: flex; flex-direction: column; }
.mapBig.on { border-color: var(--ice); }
.mapBig .thumb { aspect-ratio: 16/9; background-size: cover; background-position: center; }
.mapBig .mb { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.mapBig .mb b { font-size: 17px; font-style: italic; font-weight: 900; }
.mapBig .mb span { font-size: 12px; color: var(--mut); line-height: 1.35; }
.mapBig .mb .rec { color: #cfe6ff; font-size: 11px; }

/* online + lobby */
.onlineBody { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-content: start; overflow-y: auto; }
.card.big h3 { margin: 0 0 6px; font-style: italic; font-weight: 900; font-size: 22px; }
.card.big p { color: var(--mut); font-size: 13px; line-height: 1.45; margin: 0 0 14px; min-height: 56px; }
.joinRow { display: flex; gap: 8px; }
.joinRow input { flex: 1; min-width: 0; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 10px; color: #fff; font-size: 22px; font-weight: 900; letter-spacing: 6px; text-transform: uppercase; padding: 8px 12px; outline: none; }
.netNote { grid-column: 1 / -1; color: var(--mut); font-size: 12px; line-height: 1.5; background: var(--panel); border-radius: 12px; padding: 12px 14px; }
.lobbyBody { display: flex; gap: 20px; flex: 1; min-height: 0; }
.lobbyBody .col { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.lobbyBody .col.narrow { flex: 0 0 340px; overflow-y: auto; }
.codeBox { font-weight: 900; font-size: 24px; letter-spacing: 6px; background: var(--panel); border: 1px dashed var(--ice); border-radius: 10px; padding: 6px 14px; }
.plist { display: flex; flex-direction: column; gap: 6px; }
.prow { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; }
.prow .av { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 900; }
.prow .pn { flex: 1; font-weight: 800; }
.prow .pn small { display: block; color: var(--mut); font-weight: 500; font-size: 11px; }
.tag { font-size: 10px; font-weight: 900; letter-spacing: 1px; padding: 4px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); }
.tag.ready { background: var(--good); color: #032; }
.tag.host { background: var(--gold); color: #321; }
.tag.dc { background: var(--bad); }
.tag.ai { background: #445; }
.tag.red { background: #e53950; }
.tag.blue { background: #2a7ae0; }
.kick { background: none; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; padding: 3px 6px; color: var(--mut); }
.inviteRow { display: flex; gap: 8px; margin: 12px 0; }
.inviteRow input { flex: 1; min-width: 0; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 10px; color: #cfe6ff; padding: 8px 10px; font-size: 12px; }
.chat { flex: 1; display: flex; flex-direction: column; background: var(--panel); border-radius: 12px; padding: 10px; min-height: 120px; }
#chatLog { flex: 1; overflow-y: auto; font-size: 13px; line-height: 1.5; }
#chatLog .sys { color: var(--mut); font-style: italic; }
#chatLog b { color: var(--ice); }
#chatIn { background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: 8px; color: #fff; padding: 8px 10px; margin-top: 6px; outline: none; }
.lset { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; font-size: 12px; margin-bottom: 8px; }
.lset > span { color: var(--mut); font-weight: 800; letter-spacing: 1px; }
.lset select { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: #fff; padding: 7px 8px; font-weight: 700; }
.lset select:disabled { opacity: 0.75; }
.teamRow { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-size: 12px; color: var(--mut); font-weight: 800; }
.team { border: 2px solid transparent; border-radius: 8px; padding: 6px 12px; font-weight: 900; }
.team.red { background: #e53950; } .team.blue { background: #2a7ae0; }
.team.on { border-color: #fff; }
#readyBtn, #lobbyStart { width: 100%; margin-top: 8px; }
#readyBtn.on { background: linear-gradient(100deg, #2ad07a, #1aa860); }

/* garage */
.garageBody { display: flex; gap: 14px; flex: 1; min-height: 0; }
.gCats { width: 190px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: none; }
.gCats .grp { font-size: 10px; letter-spacing: 2px; color: var(--mut); font-weight: 900; margin: 10px 0 2px 4px; }
.gCats button { text-align: left; background: var(--panel); border: 1px solid transparent; border-radius: 9px; padding: 8px 11px; font-weight: 700; font-size: 13px; }
.gCats button.on { border-color: var(--ice); background: var(--panel2); }
.gItems { width: 330px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; align-content: start; overflow-y: auto; flex: none; padding-right: 4px; }
.gItem { background: var(--panel); border: 2px solid transparent; border-radius: 12px; padding: 10px; text-align: left; display: flex; flex-direction: column; gap: 6px; position: relative; }
.gItem.on { border-color: var(--ice); }
.gItem.eq::after { content: 'EQUIPPED'; position: absolute; top: 8px; right: 8px; font-size: 9px; font-weight: 900; letter-spacing: 1px; color: var(--good); }
.gItem .sw { height: 46px; border-radius: 8px; background-size: cover; background-position: center; }
.gItem b { font-size: 13px; }
.gItem .price { font-size: 12px; color: var(--gold); font-weight: 800; display: flex; align-items: center; gap: 4px; }
.gItem .price.own { color: var(--mut); }
.gItem.locked { opacity: 0.55; }
.gSide { margin-left: auto; width: 250px; display: flex; flex-direction: column; overflow-y: auto; flex: none; }
.gPreviewHint { font-size: 11px; color: var(--mut); line-height: 1.4; }
.gBuy { margin-top: 12px; }
.gBuy .go { width: 100%; }
.titleList { display: flex; flex-wrap: wrap; gap: 6px; }
.titleList button { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; font-weight: 700; }
.titleList button.on { background: var(--gold); color: #321; }
.titleList button:disabled { opacity: 0.35; }

/* challenges + boards */
.chRow { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.chRow .chT { flex: 1; }
.chRow .chT b { display: block; font-size: 15px; }
.chRow .chT span { color: var(--mut); font-size: 12px; }
.chRow .pbar { width: 160px; height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; }
.chRow .pbar i { display: block; height: 100%; background: var(--ice); }
.chRow.done { border-color: rgba(58, 232, 138, 0.5); }
.chRow.done .pbar i { background: var(--good); }
.achGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.ach { background: var(--panel); border-radius: 12px; padding: 12px; border: 1px solid var(--line); }
.ach b { display: block; }
.ach span { font-size: 12px; color: var(--mut); }
.ach.got { border-color: var(--gold); background: linear-gradient(160deg, rgba(255, 207, 58, 0.18), var(--panel)); }
.ach.got b::before { content: '★ '; color: var(--gold); }
.lbBody { display: flex; gap: 14px; flex: 1; min-height: 0; }
.lbMaps { width: 210px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: none; }
.lbMaps button { text-align: left; background: var(--panel); border: 1px solid transparent; border-radius: 9px; padding: 8px 11px; font-weight: 700; font-size: 13px; }
.lbMaps button.on { border-color: var(--ice); }
.lbMain { flex: 1; overflow-y: auto; }
table.lb { width: 100%; border-collapse: collapse; font-size: 14px; }
table.lb th { text-align: left; font-size: 11px; letter-spacing: 1px; color: var(--mut); padding: 6px 10px; }
table.lb td { padding: 8px 10px; border-top: 1px solid var(--line); }
table.lb tr.me td { color: var(--ice); font-weight: 800; }
.lbNote { background: var(--panel); border-radius: 12px; padding: 12px 14px; color: var(--mut); font-size: 13px; line-height: 1.5; margin-top: 14px; }
.recGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.recGrid div { background: var(--panel); border-radius: 12px; padding: 12px; }
.recGrid b { display: block; font-size: 20px; font-weight: 900; }
.recGrid span { font-size: 11px; color: var(--mut); letter-spacing: 1px; }
.setBody { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; overflow-y: auto; align-content: start; }
.setCard h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: 2px; color: var(--mut); }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 14px; border-top: 1px solid var(--line); }
.srow:first-of-type { border-top: none; }
.srow input[type=range] { width: 150px; accent-color: var(--ice); }
.keys { font-size: 13px; line-height: 1.8; color: var(--mut); }
.keys kbd { background: rgba(255, 255, 255, 0.1); border-radius: 5px; padding: 1px 6px; color: #fff; font-family: inherit; font-weight: 800; font-size: 12px; border-bottom: 2px solid rgba(255, 255, 255, 0.2); }

/* ---------- HUD */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud > * { position: absolute; }
.hTL { top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); }
.hMode { font-size: 11px; font-weight: 900; letter-spacing: 3px; color: var(--ice); text-shadow: 0 1px 3px #0008; }
.hTimer { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; text-shadow: 0 2px 6px #0009; }
.hGhost { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 1px 4px #000a; }
.hGhost.ahead { color: var(--good); } .hGhost.behind { color: var(--bad); }
.hExtra { font-size: 14px; font-weight: 800; text-shadow: 0 1px 4px #000a; margin-top: 4px; line-height: 1.5; }
.hTR { top: max(14px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); text-align: right; }
.hPos { font-size: 46px; font-weight: 900; font-style: italic; line-height: 1; text-shadow: 0 3px 8px #000a; }
.hPos small { font-size: 18px; color: var(--mut); }
.hScore b { font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; text-shadow: 0 2px 6px #0009; }
.hScore span { display: block; font-size: 10px; letter-spacing: 3px; color: var(--mut); font-weight: 900; }
.hTok { display: flex; gap: 6px; align-items: center; justify-content: flex-end; font-weight: 900; margin-top: 4px; text-shadow: 0 1px 4px #000a; }
.tok { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #e8fbff, #7fe3ff 45%, #2aa8ff); display: inline-block; }
.hObj { top: 150px; right: max(16px, env(safe-area-inset-right)); width: 230px; display: flex; flex-direction: column; gap: 5px; }
.hObj div { background: rgba(6, 14, 26, 0.7); border-radius: 9px; padding: 7px 10px; font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.hObj div.done { color: var(--good); }
.hObj div.done::before { content: '✓ '; }
.hSpeed { bottom: max(18px, env(safe-area-inset-bottom)); left: max(18px, env(safe-area-inset-left)); }
.hSpeed b { font-size: 54px; font-weight: 900; font-style: italic; line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 3px 10px #000a; }
.hSpeed span { font-size: 12px; font-weight: 900; letter-spacing: 2px; color: var(--mut); margin-left: 6px; }
.hProg { width: 180px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); margin-top: 6px; overflow: hidden; }
.hProg i { display: block; height: 100%; width: 0; background: #fff; }
#minimap { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); width: 96px; height: 240px; opacity: 0.92; }
.hCombo { left: 50%; top: 17%; transform: translateX(-50%); text-align: center; opacity: 0; transition: opacity 0.2s; }
.hCombo.on { opacity: 1; }
.cName { font-size: 22px; font-weight: 900; font-style: italic; text-shadow: 0 2px 8px #000c; max-width: 80vw; }
.cPts { margin-top: 2px; }
.cPts b { font-size: 30px; font-weight: 900; color: var(--gold); text-shadow: 0 2px 8px #000c; }
.cPts i { font-size: 26px; font-weight: 900; color: var(--ice); margin-left: 8px; font-style: italic; text-shadow: 0 2px 8px #000c; }
.cBar { width: 180px; height: 4px; margin: 6px auto 0; background: rgba(255, 255, 255, 0.2); border-radius: 2px; overflow: hidden; }
.cBar i { display: block; height: 100%; background: var(--gold); }
.hTricks { left: 50%; top: 31%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tpop { font-size: 15px; font-weight: 800; text-shadow: 0 1px 6px #000c; animation: tp 1.8s forwards; white-space: nowrap; }
.tpop em { color: var(--gold); font-style: normal; margin-left: 6px; }
.tpop.perfect { color: #bff; }
.tpop.sketchy { color: #fbb; }
.tpop.rep { opacity: 0.8; }
@keyframes tp { 0% { opacity: 0; transform: translateY(8px) scale(0.9); } 10% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.hFlash { left: 50%; top: 44%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.flash { font-size: 24px; font-weight: 900; font-style: italic; text-shadow: 0 2px 10px #000d; animation: fl 2.2s forwards; white-space: nowrap; }
.flash.bad { color: #ff8a8a; } .flash.good { color: #9fffd0; } .flash.gold { color: var(--gold); } .flash.info { color: #cfe6ff; } .flash.big { font-size: 40px; }
@keyframes fl { 0% { opacity: 0; transform: scale(1.3); } 8% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.hCount { left: 50%; top: 32%; transform: translate(-50%, -50%); font-size: 120px; font-weight: 900; font-style: italic; text-shadow: 0 6px 30px #000a; }
.hCount.pop { animation: cd 0.9s forwards; }
@keyframes cd { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.hAval { left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: 280px; display: none; text-align: center; }
.hAval span { font-size: 11px; letter-spacing: 3px; font-weight: 900; color: #ffb0b0; }
.hAval i { display: block; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #ff3a3a, #ffcf3a); margin-top: 4px; }
.hPause { pointer-events: auto; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: rgba(6, 14, 26, 0.6); border: 1px solid var(--line); border-radius: 10px; width: 42px; height: 34px; font-weight: 900; display: none; }
body.touch .hPause { display: block; }
.hKeys { bottom: max(10px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); font-size: 11px; color: rgba(255, 255, 255, 0.65); text-shadow: 0 1px 3px #000; white-space: nowrap; transition: opacity 1s; }
body.touch .hKeys { display: none; }
body.touch .hSpeed { bottom: auto; top: max(96px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); }
body.touch .hSpeed b { font-size: 30px; }
body.touch .hProg { width: 110px; }
body.touch #minimap { bottom: auto; top: max(150px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); height: 90px; width: 40px; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }
.nlabel { position: absolute; transform: translate(-50%, -100%); font-size: 12px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: rgba(6, 14, 26, 0.6); white-space: nowrap; }
.nlabel.dc::after { content: ' ⚠ reconnecting'; color: var(--gold); }

/* touch */
#touch { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
#touch > * { pointer-events: auto; position: absolute; }
#tStick { left: max(28px, env(safe-area-inset-left)); bottom: max(28px, env(safe-area-inset-bottom)); width: 150px; height: 150px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(255, 255, 255, 0.25); touch-action: none; }
#tKnob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px; border-radius: 50%; background: rgba(255, 255, 255, 0.5); }
#tJump, #tGrab, #tCorkL, #tCorkR { border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(10, 20, 36, 0.45); font-weight: 900; touch-action: none; }
#tJump { right: max(30px, env(safe-area-inset-right)); bottom: max(34px, env(safe-area-inset-bottom)); width: 104px; height: 104px; font-size: 16px; }
#tGrab { right: max(150px, env(safe-area-inset-right)); bottom: max(40px, env(safe-area-inset-bottom)); width: 76px; height: 76px; font-size: 13px; }
#tCorkL { right: max(146px, env(safe-area-inset-right)); bottom: 140px; width: 52px; height: 52px; font-size: 20px; }
#tCorkR { right: max(40px, env(safe-area-inset-right)); bottom: 160px; width: 52px; height: 52px; font-size: 20px; }
#touch button.on { background: rgba(56, 198, 255, 0.55); }
.tTop { top: max(60px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); display: flex; gap: 6px; }
.tTop button { background: rgba(6, 14, 26, 0.55); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 11px; font-weight: 900; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(4, 10, 20, 0.6); }
.box { background: var(--panel2); border: 1px solid var(--line); border-radius: 18px; padding: 24px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 10px; max-height: 92vh; overflow-y: auto; }
.box h2 { margin: 0 0 6px; font-style: italic; font-weight: 900; font-size: 30px; text-align: center; }
.box.wide { width: min(860px, 94vw); }
.rHead { display: flex; align-items: center; gap: 16px; }
.rPlace { font-size: 64px; font-weight: 900; font-style: italic; line-height: 1; color: var(--gold); }
.rHead h2 { text-align: left; margin: 0; }
.rCols { display: flex; gap: 16px; }
.rTable { flex: 1.3; }
.rStats { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; }
.rStats div { background: rgba(255, 255, 255, 0.05); border-radius: 10px; padding: 8px 10px; }
.rStats b { display: block; font-size: 18px; }
.rStats span { font-size: 10px; letter-spacing: 1px; color: var(--mut); }
.rRewards { display: flex; flex-wrap: wrap; gap: 8px; }
.rew { background: rgba(255, 255, 255, 0.06); border-radius: 10px; padding: 8px 12px; font-weight: 800; font-size: 14px; }
.rew.gold { background: rgba(255, 207, 58, 0.18); color: var(--gold); }
.rew.pb { background: rgba(56, 198, 255, 0.18); color: var(--ice); }
.rBtns { display: flex; flex-wrap: wrap; gap: 8px; }
.rBtns .go { flex: 1; min-width: 140px; }
#replayBar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 30; display: flex; gap: 8px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; flex-wrap: wrap; justify-content: center; }
#replayBar span { font-weight: 900; letter-spacing: 2px; font-size: 12px; color: var(--hot); padding: 0 6px; }
#replayBar button { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; font-weight: 800; font-size: 12px; }
.rpProg { width: 100%; height: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; overflow: hidden; }
.rpProg i { display: block; height: 100%; background: var(--hot); width: 0; }
#toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; font-weight: 700; font-size: 14px; box-shadow: 0 8px 30px #0008; animation: tin 0.25s; pointer-events: auto; display: flex; gap: 10px; align-items: center; }
.toast.gold { border-color: var(--gold); }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }
#sig { position: fixed; left: 10px; bottom: 6px; font-size: 10px; color: rgba(255, 255, 255, 0.25); z-index: 5; pointer-events: none; }

/* responsive */
@media (max-width: 900px) {
  .homeR { display: none; }
  .playBody { flex-direction: column; overflow-y: auto; }
  .modeGrid { width: 100%; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); overflow: visible; }
  .onlineBody { grid-template-columns: 1fr; }
  .lobbyBody { flex-direction: column; overflow-y: auto; }
  .lobbyBody .col.narrow { flex: none; }
  .garageBody { flex-direction: column; overflow-y: auto; }
  .gCats { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .gCats .grp { display: none; }
  .gItems, .gSide { width: 100%; }
  .lbBody { flex-direction: column; }
  .lbMaps { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .rCols { flex-direction: column; }
  .recGrid { grid-template-columns: repeat(2, 1fr); }
  .subHead h2 { font-size: 22px; }
}
@media (max-height: 500px) {
  .screen { padding-top: 10px; padding-bottom: 10px; }
  .logo.big span, .logo.big b { font-size: 36px; }
  .mbtn { padding: 7px 12px; }
  .mbtn em { font-size: 15px; }
  .mbtn.hero em { font-size: 20px; }
  .mbtn small { display: none; }
  .hPos { font-size: 32px; }
  .hSpeed b { font-size: 38px; }
  #minimap { height: 160px; width: 64px; }
  .hCount { font-size: 80px; }
  .homeHint { display: none; }
  .homeL { gap: 10px; }
}
