:root {
  color-scheme: dark;
  --ink: #eaf9ff;
  --muted: #89a3b7;
  --cyan: #54f5ff;
  --blue: #4b80ff;
  --danger: #ff4d78;
  --lime: #a6ff68;
  --panel: rgba(8, 17, 31, .76);
  --line: rgba(157, 223, 255, .18);
  --shadow: 0 24px 80px rgba(0, 0, 0, .46);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050811;
  color: var(--ink);
  font-family: "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
  user-select: none;
}

button { font: inherit; color: inherit; }

#app, #game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game { display: block; background: #060a13; }

.scanlines, .vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.scanlines {
  opacity: .12;
  background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(180, 235, 255, .05) 4px);
  mix-blend-mode: screen;
}

.vignette { box-shadow: inset 0 0 160px 35px rgba(0, 0, 0, .62); }

.glass {
  background: linear-gradient(145deg, rgba(15, 30, 50, .83), rgba(6, 14, 27, .72));
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.045);
  backdrop-filter: blur(18px);
}

.topbar {
  position: fixed;
  z-index: 20;
  left: clamp(18px, 3vw, 52px);
  right: clamp(18px, 3vw, 52px);
  top: 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.mini-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 600 12px/1 "IBM Plex Mono", monospace;
  letter-spacing: .22em;
  color: rgba(228, 249, 255, .74);
}

.brand-mark {
  width: 15px;
  height: 15px;
  border: 2px solid var(--cyan);
  transform: rotate(45deg);
  box-shadow: 0 0 15px rgba(84,245,255,.7);
}

.icon-button {
  pointer-events: auto;
  border: 1px solid var(--line);
  background: rgba(5, 12, 23, .65);
  padding: 9px 12px;
  border-radius: 4px;
  color: var(--muted);
  font: 500 10px/1 "IBM Plex Mono", monospace;
  letter-spacing: .12em;
  cursor: pointer;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease, visibility .35s;
}

.screen.is-visible { opacity: 1; visibility: visible; pointer-events: auto; }

#menu {
  padding: min(9vh, 82px) clamp(20px, 8vw, 130px) 48px;
  display: flex;
  align-items: center;
  gap: clamp(30px, 7vw, 130px);
}

.menu-card {
  position: relative;
  width: min(520px, 94vw);
  padding: clamp(26px, 4.4vh, 46px) clamp(24px, 3.5vw, 45px) 30px;
  border-radius: 8px;
  overflow: hidden;
}

.menu-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, transparent, var(--cyan) 25%, var(--blue) 72%, transparent);
  box-shadow: 0 0 22px var(--cyan);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font: 600 11px/1 "IBM Plex Mono", monospace;
  letter-spacing: .25em;
}

h1 {
  margin: 0;
  font: 900 clamp(72px, 11vh, 112px)/.68 "Arial Black", Impact, sans-serif;
  letter-spacing: -.04em;
  text-shadow: 0 0 34px rgba(84,245,255,.18);
}

h1 span { color: transparent; -webkit-text-stroke: 1.5px var(--cyan); }

.tagline { margin: 24px 0 28px; color: var(--muted); font-size: 14px; }
.tagline strong { color: var(--ink); font-weight: 700; }

.selector-block { margin-top: 18px; }
.selector-label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.selector-label span { font: 600 10px/1 "IBM Plex Mono", monospace; letter-spacing: .17em; color: #b8cada; }
.selector-label small { color: #5f7890; font-size: 10px; }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.segmented button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(4, 11, 21, .75);
  color: #7e95a8;
  font: 600 13px "IBM Plex Mono", monospace;
  cursor: pointer;
  transition: .18s ease;
}
.segmented button:hover, .segmented button.selected {
  color: #031319;
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: 0 0 20px rgba(84,245,255,.22);
}

.play-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.play-actions > button {
  min-width: 0;
  min-height: 62px;
  padding: 10px 11px;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  column-gap: 9px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(4,11,21,.78);
  color: #8ca4b6;
  cursor: pointer;
  transition: .18s ease;
}
.play-actions > button:hover { border-color: rgba(84,245,255,.68); background: rgba(19,51,67,.66); transform: translateY(-1px); }
.play-actions > button > span { grid-row: 1 / 3; display: grid; place-items: center; width: 29px; height: 29px; color: var(--cyan); border: 1px solid currentColor; transform: rotate(45deg); }
.play-actions > button b { color: #d8eaf2; font-size: 11px; }
.play-actions > button small { overflow: hidden; color: #657f92; font-size: 8px; white-space: nowrap; text-overflow: ellipsis; }
.play-actions > .custom-map-button.is-locked { opacity: .62; }
.play-actions > .custom-map-button.is-unlocked > span { color: var(--lime); box-shadow: 0 0 12px rgba(180,255,98,.22); }

.map-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.map-cards button { min-width: 0; height: 48px; padding: 5px 3px; border: 1px solid var(--line); border-radius: 4px; background: rgba(4,11,21,.75); color: #738a9c; cursor: pointer; transition: .18s ease; }
.map-cards b, .map-cards small { display: block; }
.map-cards b { color: #b7ccda; font: 600 11px "IBM Plex Mono", monospace; }
.map-cards small { margin-top: 3px; font-size: 8px; }
.map-cards button:hover, .map-cards button.selected { border-color: var(--map-accent, var(--cyan)); background: rgba(20,48,65,.72); box-shadow: inset 0 -2px var(--map-accent, var(--cyan)); }
.map-cards button.selected b { color: var(--map-accent, var(--cyan)); }
.map-description { min-height: 13px; margin: 6px 1px 0; color: #637b8f; font-size: 9px; }

.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-card {
  min-height: 67px;
  padding: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(4, 11, 21, .78);
  cursor: pointer;
  transition: .18s ease;
}
.mode-card:hover, .mode-card.selected { border-color: rgba(84,245,255,.72); background: rgba(21,51,70,.58); }
.mode-card[data-mode="extreme"].selected { border-color: rgba(255,77,120,.8); background: rgba(74,20,40,.48); }
.mode-icon { display: grid; place-items: center; flex: 0 0 30px; height: 30px; border: 1px solid; transform: rotate(45deg); }
.mode-icon.safe { color: var(--cyan); }
.mode-icon.danger { color: var(--danger); }
.mode-icon::first-letter { transform: rotate(-45deg); }
.mode-card span:nth-child(2) { min-width: 0; }
.mode-card b, .mode-card small { display: block; }
.mode-card b { font-size: 12px; }
.mode-card small { margin-top: 4px; color: #70869a; font-size: 8px; white-space: nowrap; }
.mode-card em { margin-left: auto; color: var(--danger); font: 600 9px "IBM Plex Mono", monospace; font-style: normal; }

.primary-button {
  width: 100%;
  height: 55px;
  margin-top: 23px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(100deg, #35dce7, #6ef7f4);
  color: #031317;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 9px 28px rgba(52,224,233,.22);
  transition: transform .18s, box-shadow .18s;
}
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 13px 36px rgba(52,224,233,.34); }
.secondary-button {
  width: 100%;
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(4, 12, 22, .66);
  color: #8fa8ba;
  font-size: 11px;
  cursor: pointer;
}
.secondary-button:hover { color: var(--cyan); border-color: rgba(84,245,255,.5); }
kbd, .keycap {
  padding: 4px 7px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font: 500 9px/1 "IBM Plex Mono", monospace;
  font-style: normal;
  opacity: .75;
}

.quick-guide { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 15px; }
.quick-guide div { display: flex; align-items: center; gap: 9px; color: #7b92a5; font-size: 10px; }
.keycap { min-width: 42px; text-align: center; color: #b9d0df; }
.gamepad-note { margin: 15px 0 0; text-align: center; color: #4f6679; font-size: 9px; }

.brief {
  width: min(320px, 26vw);
  padding: 27px;
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 10px 16px;
  align-items: center;
  border-radius: 6px;
}
.brief-number { color: var(--cyan); font: 500 25px "IBM Plex Mono", monospace; }
.brief b, .brief small { display: block; }
.brief b { font: 600 9px "IBM Plex Mono", monospace; letter-spacing: .13em; }
.brief small { margin-top: 4px; color: #7890a2; font-size: 10px; line-height: 1.55; }
.brief-line { grid-column: 1/-1; height: 1px; background: var(--line); margin: 5px 0; }

.hud { position: fixed; inset: 0; z-index: 5; display: none; pointer-events: none; }
.hud.is-visible { display: block; }
.run-info { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); padding: 11px 20px; display: flex; gap: 17px; align-items: center; border-radius: 5px; }
.run-info > span { width: 1px; height: 25px; background: var(--line); }
.run-info div { min-width: 75px; text-align: center; }
.run-info small, .run-info b { display: block; }
.run-info small, .objective small { color: #71899b; font: 500 8px "IBM Plex Mono", monospace; letter-spacing: .14em; }
.run-info b { margin-top: 3px; font: 600 13px "IBM Plex Mono", monospace; }

.player-hud { position: absolute; top: 82px; left: 26px; display: grid; gap: 7px; }
.player-chip { width: 238px; padding: 12px 13px; border-left: 4px solid var(--player); background: rgba(4,11,21,.86); box-shadow: 0 8px 26px rgba(0,0,0,.3); }
.player-chip .chip-top { display: flex; justify-content: space-between; align-items: center; font: 600 11px "IBM Plex Mono", monospace; }
.player-chip .chip-state { color: var(--player); }
.player-chip .hp { height: 12px; margin-top: 10px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; background: transparent; }
.player-chip .hp i { display: block; height: 100%; border: 2px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); transform: skewX(-10deg); transition: background .18s, box-shadow .18s, opacity .18s; }
.player-chip .hp i.on { background: var(--player); border-color: var(--player); box-shadow: 0 0 10px color-mix(in srgb, var(--player) 72%, transparent); }
.player-chip .hp i.partial { background: linear-gradient(90deg, var(--player) var(--fill), rgba(255,255,255,.07) var(--fill)); }
.player-chip .charges { margin-top: 8px; display: flex; gap: 5px; }
.player-chip .charges i { width: 25px; height: 5px; background: rgba(255,255,255,.1); }
.player-chip .charges i.on { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.player-chip .ability-cooldowns { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.player-chip .ability { position: relative; height: 30px; padding: 8px 7px; overflow: hidden; border: 2px solid rgba(255,255,255,.14); color: #8da5b5; background: rgba(1,7,13,.78); font: 600 8px/1 "IBM Plex Mono", monospace; }
.player-chip .ability::before { content: ""; position: absolute; inset: auto 0 0; height: var(--ready); background: rgba(84,245,255,.38); transition: height .1s linear; }
.player-chip .ability.boost-cd::before { background: rgba(255,212,92,.4); }
.player-chip .ability span { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; }
.player-chip .ability em { color: #f2fbff; font-size: 10px; font-style: normal; text-shadow: 0 1px 4px #000; }
.player-chip .ability.ready { color: #efffff; border-color: rgba(84,245,255,.62); box-shadow: inset 0 0 12px rgba(84,245,255,.12); }
.player-chip .ability.boost-cd.ready { border-color: rgba(255,212,92,.62); box-shadow: inset 0 0 12px rgba(255,212,92,.12); }

.objective { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); padding: 8px 19px 10px; text-align: center; border-radius: 4px; }
.objective b { display: block; margin-top: 4px; font-size: 11px; }
.hud-help { position: absolute; left: 50%; bottom: 19px; transform: translateX(-50%); padding: 8px 13px; display: flex; gap: 14px; border-radius: 4px; color: #8096a7; font-size: 9px; }
.hud-help kbd { margin-left: 4px; }

.center-message {
  position: fixed;
  z-index: 30;
  left: 50%; top: 46%;
  transform: translate(-50%,-50%) scale(.94);
  opacity: 0;
  text-align: center;
  font: 900 clamp(38px, 6vw, 70px)/1 "Arial Black", Impact, sans-serif;
  letter-spacing: .02em;
  text-shadow: 0 0 40px currentColor, 0 5px 22px #000;
  pointer-events: none;
  transition: .25s;
}
.center-message.show { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.center-message small { display: block; margin-top: 9px; color: #cde2ea; font: 500 10px "IBM Plex Mono", monospace; letter-spacing: .2em; }

.toast { position: fixed; z-index: 25; left: 50%; bottom: 70px; transform: translate(-50%, 18px); opacity: 0; padding: 10px 17px; border-radius: 4px; color: #c9dce6; font-size: 11px; transition: .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.revive-choice-overlay { position: fixed; z-index: 31; left: 50%; top: 50%; width: min(460px, calc(100vw - 28px)); padding: 20px; opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, calc(-50% + 16px)) scale(.97); border: 1px solid rgba(180,255,98,.55); border-radius: 7px; background: rgba(3,13,20,.94); box-shadow: 0 0 0 1px rgba(180,255,98,.08), 0 18px 60px rgba(0,0,0,.55), inset 0 0 36px rgba(180,255,98,.06); transition: .18s ease; }
.revive-choice-overlay.show { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%,-50%) scale(1); }
.revive-choice-overlay > small { color: var(--lime); font: 700 9px "IBM Plex Mono", monospace; letter-spacing: .16em; }
.revive-choice-heading { margin-top: 7px; display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.revive-choice-heading b { color: #ecfff1; font: 900 25px "Arial Black", Impact, sans-serif; }
.revive-choice-heading strong { min-width: 72px; color: var(--lime); text-align: right; font: 700 31px "IBM Plex Mono", monospace; text-shadow: 0 0 18px rgba(180,255,98,.55); }
.revive-choice-overlay > p { margin: 8px 0 15px; color: #8199a7; font-size: 10px; line-height: 1.55; }
.revive-choice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.revive-choice-actions button { min-height: 66px; padding: 10px 12px; display: flex; align-items: center; gap: 11px; border: 1px solid rgba(255,255,255,.11); border-radius: 4px; background: rgba(6,23,31,.8); color: #cce0e7; text-align: left; cursor: pointer; }
.revive-choice-actions button:hover, .revive-choice-actions button:focus-visible { border-color: var(--lime); background: rgba(50,84,45,.38); outline: none; }
.revive-choice-actions kbd { min-width: 34px; min-height: 34px; display: grid; place-items: center; border-color: rgba(180,255,98,.7); color: var(--lime); font-size: 15px; }
.revive-choice-actions span, .revive-choice-actions b, .revive-choice-actions small { display: block; }
.revive-choice-actions b { font-size: 11px; }
.revive-choice-actions small { margin-top: 4px; color: #738a98; font-size: 8px; }
.player-chip.revive-contact { border-color: var(--lime); background: rgba(29,51,28,.9); box-shadow: 0 0 22px rgba(180,255,98,.22); animation: revive-contact-pulse .62s infinite alternate; }
.player-chip.revive-contact .chip-state { color: var(--lime); }
@keyframes revive-contact-pulse { to { filter: brightness(1.24); } }

.modal-screen { display: grid; place-items: center; background: rgba(1,5,11,.62); backdrop-filter: blur(7px); }
.modal-card, .result-card, .settings-card, .tutorial-card { width: min(420px, calc(100vw - 32px)); padding: 36px; border-radius: 8px; text-align: center; }
.modal-card h2, .result-card h2 { margin: 6px 0 10px; font: 900 42px "Arial Black", Impact, sans-serif; }
.modal-card p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.text-button { width: 100%; margin-top: 8px; padding: 9px; border: 0; background: transparent; color: #7d96a9; font-size: 11px; cursor: pointer; }
.text-button:hover { color: var(--ink); }

.result-card { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 28px); overflow-y: auto; }

.tutorial-replay-button { margin-top: 2px; }
.tutorial-card { width: min(590px, calc(100vw - 30px)); text-align: left; }
.tutorial-card h2 { margin: 7px 0 12px; color: #effcff; font: 900 clamp(30px, 5vw, 48px)/.98 "Arial Black", Impact, sans-serif; letter-spacing: -.04em; }
.tutorial-copy, .tutorial-note { color: #8ea7b6; font-size: 11px; line-height: 1.7; }
.tutorial-copy b { color: var(--cyan); }
.tutorial-preview { margin: 18px 0 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.tutorial-preview span { min-height: 76px; padding: 11px 7px; display: grid; place-items: center; align-content: center; gap: 9px; border: 1px solid rgba(84,245,255,.16); background: rgba(4,17,28,.68); text-align: center; }
.tutorial-preview kbd { color: var(--cyan); font: 700 10px "IBM Plex Mono", monospace; }
.tutorial-preview b { color: #b8ced8; font-size: 9px; }
.tutorial-card .primary-button { margin-top: 17px; }
.tutorial-coach { position: fixed; z-index: 16; left: 50%; bottom: 76px; width: min(570px, calc(100vw - 28px)); padding: 12px 15px; opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, 12px); border-color: rgba(84,245,255,.34); transition: .18s ease; }
.tutorial-coach.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.tutorial-coach > small { display: block; color: var(--cyan); font: 700 8px "IBM Plex Mono", monospace; letter-spacing: .16em; }
.tutorial-coach > b { display: block; margin-top: 3px; color: #dceef3; font-size: 10px; }
.tutorial-coach > div { margin-top: 9px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tutorial-coach span { padding: 7px 5px; border: 1px solid rgba(255,255,255,.08); color: #708897; font: 600 8px "IBM Plex Mono", monospace; text-align: center; }
.tutorial-coach span.is-done { border-color: rgba(180,255,98,.42); color: var(--lime); background: rgba(180,255,98,.07); }
.result-summary { color: #8ca4b6; font-size: 12px; }
.score-line { margin: 24px 0 16px; padding: 18px; border: 1px solid rgba(84,245,255,.25); background: rgba(23,78,91,.2); }
.score-line small, .score-line b { display: block; }
.score-line small { color: var(--cyan); font: 600 9px "IBM Plex Mono", monospace; letter-spacing: .2em; }
.score-line b { margin-top: 4px; font: 600 38px "IBM Plex Mono", monospace; }
.result-grid { display: grid; grid-template-columns: repeat(4,1fr); border-block: 1px solid var(--line); }
.result-grid div { padding: 15px 4px; border-right: 1px solid var(--line); }
.result-grid div:last-child { border-right: 0; }
.result-grid small, .result-grid b { display: block; }
.result-grid small { color: #61798b; font-size: 9px; }
.result-grid b { margin-top: 5px; font: 600 12px "IBM Plex Mono", monospace; }
.record-message { min-height: 18px; color: var(--lime); font: 500 10px "IBM Plex Mono", monospace; }

.rankings { margin-top: 14px; display: grid; gap: 5px; }
.rank-row { padding: 7px 10px; display: grid; grid-template-columns: 38px 1fr auto auto; gap: 10px; align-items: center; border: 1px solid rgba(255,255,255,.07); background: rgba(3,10,18,.45); text-align: left; font: 600 10px "IBM Plex Mono", monospace; }
.rank-row .place { color: var(--rank-color); }
.rank-row .racer { color: var(--player-color); }
.rank-row .rank-deaths { color: #c48296; font-size: 9px; }
.rank-row .rank-time { color: #7890a2; }

.settings-card { width: min(520px, calc(100vw - 28px)); max-height: calc(100vh - 42px); overflow-y: auto; text-align: left; }
.settings-card h2 { margin: 5px 0 8px; font: 900 34px "Arial Black", Impact, sans-serif; }
.settings-copy { margin: 0 0 17px; color: #7890a2; font-size: 11px; line-height: 1.55; }
.key-player-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 13px; }
.key-player-tabs button { padding: 9px; border: 1px solid var(--line); border-radius: 3px; background: rgba(2,9,17,.62); color: #6e8799; font: 600 10px "IBM Plex Mono", monospace; cursor: pointer; }
.key-player-tabs button.selected { color: #06131a; background: var(--tab-color, var(--cyan)); border-color: var(--tab-color, var(--cyan)); }
.key-bindings { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.binding-row { min-height: 42px; padding: 7px 8px 7px 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid rgba(255,255,255,.07); background: rgba(3,10,18,.52); }
.binding-row span { color: #93aabc; font-size: 10px; }
.binding-button { min-width: 76px; padding: 7px 8px; border: 1px solid rgba(84,245,255,.3); border-radius: 3px; background: rgba(14,45,57,.5); color: #d9fbff; font: 600 9px "IBM Plex Mono", monospace; cursor: pointer; }
.binding-button.listening { color: #061116; background: var(--cyan); animation: key-pulse .7s infinite alternate; }
.binding-hint { min-height: 16px; margin: 11px 0 0; color: #6f8798; text-align: center; font-size: 9px; }
.settings-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; margin-top: 4px; }
.settings-actions .primary-button, .settings-actions .text-button { margin-top: 8px; height: 42px; }
@keyframes key-pulse { to { box-shadow: 0 0 18px rgba(84,245,255,.45); } }

.is-hidden { display: none !important; }
.channel-card, .custom-maps-card {
  width: min(620px, calc(100vw - 30px));
  max-height: calc(100vh - 36px);
  padding: 30px;
  overflow-y: auto;
  border-radius: 8px;
}
.modal-heading { display: flex; justify-content: space-between; align-items: flex-start; }
.modal-heading h2 { margin: 3px 0 0; font: 900 34px "Arial Black", Impact, sans-serif; }
.modal-heading .eyebrow { margin-bottom: 5px; }
.modal-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 4px; background: rgba(2,8,16,.65); color: #8098aa; font-size: 24px; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--cyan); border-color: rgba(84,245,255,.55); }
.network-status { margin: 18px 0 15px; padding: 9px 11px; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,.06); background: rgba(2,8,15,.42); color: #728b9d; font-size: 9px; }
.network-status i { width: 7px; height: 7px; border-radius: 50%; background: #627381; box-shadow: 0 0 8px currentColor; }
.network-status.is-online i { background: var(--lime); }
.network-status.is-error i { background: var(--danger); }
.channel-toolbar { display: grid; grid-template-columns: 1fr 1fr 40px; gap: 8px; }
.channel-toolbar .secondary-button, .custom-toolbar .secondary-button { margin-top: 0; min-height: 40px; }
.channel-toolbar .icon-button { width: 40px; padding: 0; font-size: 18px; }
.room-list-heading { margin: 19px 1px 9px; display: flex; align-items: baseline; justify-content: space-between; }
.room-list-heading b { color: #a8bfcd; font: 600 10px "IBM Plex Mono", monospace; letter-spacing: .14em; }
.room-list-heading small { color: #526b7e; font-size: 9px; }
.public-room-list { min-height: 190px; display: grid; align-content: start; gap: 7px; }
.empty-room-list { margin: 0; min-height: 190px; display: grid; place-items: center; border: 1px dashed rgba(255,255,255,.09); color: #60798c; font-size: 10px; text-align: center; line-height: 1.7; }
.room-row { width: 100%; padding: 12px 13px; display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; border: 1px solid rgba(255,255,255,.08); border-radius: 4px; background: rgba(3,10,18,.62); color: #adc3d0; text-align: left; cursor: pointer; }
.room-row:hover { border-color: rgba(84,245,255,.48); background: rgba(15,43,57,.6); }
.room-row .room-code { color: var(--cyan); font: 700 12px "IBM Plex Mono", monospace; }
.room-row b, .room-row small { display: block; }
.room-row b { color: #d9eaf1; font-size: 11px; }
.room-row small { margin-top: 3px; color: #61798b; font-size: 8px; }
.room-row em { color: var(--lime); font: 600 9px "IBM Plex Mono", monospace; font-style: normal; }
.back-button { margin: 1px 0 18px; padding: 0; border: 0; background: transparent; color: #7390a3; font-size: 10px; cursor: pointer; }
.back-button:hover { color: var(--cyan); }
.room-code-preview { margin-bottom: 18px; padding: 16px; display: flex; align-items: center; justify-content: space-between; border: 1px solid rgba(84,245,255,.25); background: rgba(21,78,91,.18); }
.room-code-preview small { color: #7290a3; font-size: 9px; }
.room-code-preview b { color: var(--cyan); font: 700 27px "IBM Plex Mono", monospace; letter-spacing: .16em; }
.field-label { margin-top: 12px; display: grid; gap: 7px; color: #8fa6b5; font-size: 10px; }
.field-label input, .field-label select { width: 100%; min-height: 43px; padding: 0 12px; border: 1px solid rgba(255,255,255,.11); border-radius: 3px; outline: none; background: rgba(2,8,15,.76); color: #e1f3f8; font: 600 11px "IBM Plex Mono", monospace; }
.field-label input:focus, .field-label select:focus { border-color: rgba(84,245,255,.65); box-shadow: 0 0 0 2px rgba(84,245,255,.07); }
.code-field { margin-top: 20px; }
.code-field input { height: 68px; text-align: center; color: var(--cyan); font-size: 28px; letter-spacing: .28em; text-transform: uppercase; }
.visibility-choice { margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border: 0; }
.visibility-choice legend { margin-bottom: 7px; color: #8fa6b5; font-size: 10px; }
.visibility-choice label { position: relative; cursor: pointer; }
.visibility-choice input { position: absolute; opacity: 0; }
.visibility-choice span { min-height: 57px; padding: 10px 12px; display: grid; align-content: center; border: 1px solid rgba(255,255,255,.09); background: rgba(2,8,15,.57); }
.visibility-choice b, .visibility-choice small { display: block; }
.visibility-choice b { color: #a6bac7; font: 600 10px "IBM Plex Mono", monospace; }
.visibility-choice small { margin-top: 4px; color: #61798b; font-size: 8px; }
.visibility-choice input:checked + span { border-color: var(--cyan); background: rgba(25,78,91,.32); }
.visibility-choice input:checked + span b { color: var(--cyan); }
.selected-map-label, .lobby-map-name { margin: 12px 0 0; color: #7690a1; font-size: 10px; }
.form-help { color: #617a8c; font-size: 9px; line-height: 1.55; }
.lobby-code { margin: 12px 0 16px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.lobby-code small { color: #627b8e; font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .15em; }
.lobby-code button { padding: 4px 10px; border: 0; background: transparent; color: var(--cyan); font: 700 31px "IBM Plex Mono", monospace; letter-spacing: .18em; cursor: pointer; }
.lobby-code span { justify-self: end; padding: 4px 7px; border: 1px solid rgba(180,255,98,.35); color: var(--lime); font: 600 8px "IBM Plex Mono", monospace; }
.lobby-map-name { margin-bottom: 11px; text-align: center; color: #b8d0dd; }
.lobby-players { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.lobby-player { min-height: 78px; padding: 10px 6px; display: grid; place-items: center; align-content: center; gap: 6px; border: 1px solid rgba(255,255,255,.08); background: rgba(2,8,15,.58); color: #5e7586; font-size: 9px; }
.lobby-player.is-filled { border-color: color-mix(in srgb, var(--player-color) 45%, transparent); color: var(--player-color); }
.lobby-player i { width: 19px; height: 19px; border: 2px solid currentColor; border-radius: 50%; }
#hostStartButton:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.custom-locked { min-height: 280px; display: grid; place-items: center; align-content: center; text-align: center; }
.custom-locked > span { width: 50px; height: 50px; display: grid; place-items: center; border: 1px solid var(--cyan); color: var(--cyan); font-size: 22px; transform: rotate(45deg); }
.custom-locked b { margin-top: 24px; color: #d9eaf1; font-size: 15px; }
.custom-locked p { max-width: 330px; margin: 8px auto 14px; color: #748c9d; font-size: 10px; line-height: 1.65; }
.custom-locked em { color: var(--cyan); font: 600 11px "IBM Plex Mono", monospace; font-style: normal; }
.custom-toolbar { margin: 18px 0 11px; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.custom-toolbar p { margin: 0; color: #9eb4c1; font-size: 10px; }
.custom-toolbar .secondary-button { width: auto; }
.custom-maps-card:has(.custom-create-form:not(.is-hidden)) { width: min(980px, calc(100vw - 30px)); }
.custom-create-form { margin-bottom: 12px; padding: 15px; border: 1px solid rgba(84,245,255,.18); background: rgba(4,13,22,.54); }
.custom-meta-fields { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; }
.custom-meta-fields .field-label { margin-top: 0; }
.custom-editor-heading { margin: 17px 0 9px; display: flex; justify-content: space-between; align-items: end; gap: 14px; }
.custom-editor-heading b, .custom-editor-heading small { display: block; }
.custom-editor-heading b { color: var(--cyan); font: 700 10px "IBM Plex Mono", monospace; letter-spacing: .12em; }
.custom-editor-heading small { margin-top: 3px; color: #688194; font-size: 8px; }
.custom-editor-heading > span { color: #96aeba; font-size: 9px; text-align: right; }
.custom-editor-heading > span.is-error { color: var(--danger); }
.custom-editor-heading > span.is-ready { color: var(--lime); }
.custom-editor-tools { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.custom-editor-tools button { min-height: 49px; padding: 5px 3px; display: grid; place-items: center; align-content: center; gap: 5px; border: 1px solid rgba(255,255,255,.09); border-radius: 3px; background: rgba(2,9,16,.74); color: #78909f; font-size: 8px; cursor: pointer; }
.custom-editor-tools button:hover { border-color: rgba(84,245,255,.42); color: #c9e4ec; }
.custom-editor-tools button.selected { border-color: var(--cyan); color: var(--cyan); background: rgba(25,73,86,.48); box-shadow: inset 0 0 12px rgba(84,245,255,.08); }
.custom-editor-tools i { width: 17px; height: 17px; display: block; border: 2px solid currentColor; }
.custom-editor-tools .tool-spawn { border-radius: 50%; background: rgba(84,245,255,.2); }
.custom-editor-tools .tool-exit { border-radius: 50%; color: var(--lime); box-shadow: 0 0 7px currentColor; }
.custom-editor-tools .tool-checkpoint { transform: rotate(45deg) scale(.72); }
.custom-editor-tools .tool-pillar, .custom-editor-tools .tool-bumper, .custom-editor-tools .tool-shockwave, .custom-editor-tools .tool-hole, .custom-editor-tools .tool-enemy { border-radius: 50%; }
.custom-editor-tools .tool-bumper { color: #ffb95a; }
.custom-editor-tools .tool-rotor { width: 24px; height: 5px; border-width: 0; background: #ff5c8d; }
.custom-editor-tools .tool-shockwave { border-style: double; border-width: 4px; color: #c889ff; }
.custom-editor-tools .tool-laser { width: 3px; border: 0; background: #ff4d78; box-shadow: 0 0 6px #ff4d78; }
.custom-editor-tools .tool-gate { width: 5px; border-color: #ff8458; }
.custom-editor-tools .tool-boost { width: 24px; height: 12px; transform: skewX(-18deg); color: #ffd85a; }
.custom-editor-tools .tool-hole { color: #374856; background: #01050a; }
.custom-editor-tools .tool-enemy { color: #ff4d78; background: rgba(255,77,120,.16); }
.custom-editor-tools .tool-floor-safe, .custom-editor-tools .tool-floor-ice, .custom-editor-tools .tool-floor-black { width: 25px; height: 15px; border-radius: 2px; }
.custom-editor-tools .tool-floor-safe { color: #65e6b7; background: rgba(101,230,183,.22); }
.custom-editor-tools .tool-floor-ice { color: #54f5ff; background: rgba(84,245,255,.19); }
.custom-editor-tools .tool-floor-black { color: #6d7d94; background: rgba(14,17,29,.92); }
.custom-editor-tools .tool-erase { border: 0; border-bottom: 5px solid #a4b2ba; transform: rotate(-35deg); }
.custom-editor-stage { margin-top: 7px; overflow: hidden; border: 1px solid rgba(84,245,255,.25); border-radius: 4px; background: #030a12; }
#customMapEditor { width: 100%; height: auto; min-height: 260px; display: block; cursor: crosshair; touch-action: none; }
.custom-editor-footer { min-height: 33px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #587184; font-size: 8px; }
.custom-editor-footer div { display: flex; gap: 5px; }
.custom-editor-footer button { padding: 5px 7px; border: 1px solid rgba(255,255,255,.1); border-radius: 3px; background: rgba(3,11,19,.7); color: #7e95a4; font-size: 8px; cursor: pointer; }
.custom-editor-footer button:hover { color: var(--cyan); border-color: rgba(84,245,255,.4); }
.custom-verification-note { margin: 8px 0 0; padding: 9px 11px; border-left: 3px solid var(--lime); background: rgba(180,255,98,.055); color: #789080; font-size: 9px; line-height: 1.55; }
.custom-verification-note b { color: var(--lime); }
.custom-form-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 7px; }
.custom-form-actions .primary-button, .custom-form-actions .text-button { margin-top: 15px; height: 42px; }
.custom-map-list { display: grid; gap: 8px; }
.custom-map-item { padding: 13px; display: grid; grid-template-columns: 1fr auto; gap: 10px; border: 1px solid rgba(255,255,255,.08); background: rgba(2,9,17,.56); }
.custom-map-info b, .custom-map-info small { display: block; }
.custom-map-info b { color: #d4e7ef; font-size: 11px; }
.custom-map-info small { margin-top: 5px; color: #617b8e; font: 500 8px "IBM Plex Mono", monospace; }
.custom-map-rating { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.custom-map-rating strong { color: #ffd85a; font: 700 11px "IBM Plex Mono", monospace; letter-spacing: .03em; }
.custom-map-rating span { color: #78909f; font-size: 8px; }
.custom-map-review-quote { margin: 6px 0 0; color: #8aa0ad; font-size: 9px; line-height: 1.45; }
.custom-map-actions { display: flex; gap: 5px; align-items: center; }
.custom-map-actions button { min-height: 34px; padding: 0 9px; border: 1px solid rgba(255,255,255,.1); border-radius: 3px; background: rgba(9,25,37,.72); color: #94abba; font-size: 8px; cursor: pointer; }
.custom-map-actions button:hover { border-color: var(--cyan); color: var(--cyan); }
.custom-map-actions .delete-custom { color: #ad6b7c; }

.custom-review-form { margin: 13px 0; padding: 13px; display: grid; gap: 8px; border: 1px solid rgba(255,216,90,.22); background: rgba(37,29,9,.3); text-align: left; }
.custom-review-form > div:first-child small, .custom-review-form > div:first-child b { display: block; }
.custom-review-form > div:first-child small { color: #c9a93c; font: 700 7px "IBM Plex Mono", monospace; letter-spacing: .14em; }
.custom-review-form > div:first-child b { margin-top: 3px; color: #e8edf0; font-size: 10px; }
.custom-review-stars { display: flex; gap: 4px; }
.custom-review-stars button { padding: 0; border: 0; background: transparent; color: #6a654d; font-size: 26px; line-height: 1; cursor: pointer; }
.custom-review-stars button.is-selected { color: #ffd85a; text-shadow: 0 0 10px rgba(255,216,90,.35); }
.custom-review-form textarea { width: 100%; min-height: 52px; padding: 9px 10px; resize: vertical; border: 1px solid rgba(255,255,255,.1); border-radius: 3px; outline: none; background: rgba(2,8,15,.76); color: #dcecf1; font: 500 9px/1.5 "IBM Plex Mono", monospace; }
.custom-review-form textarea:focus { border-color: rgba(255,216,90,.5); }
.custom-review-form .secondary-button { margin: 0; min-height: 34px; }
.custom-review-thanks { min-height: 12px; margin: 0; color: var(--lime); font-size: 8px; }
.custom-validation-actions { margin: 12px 0; display: grid; grid-template-columns: 1fr 1.25fr; gap: 7px; }
.custom-validation-actions .primary-button, .custom-validation-actions .secondary-button { margin: 0; min-height: 42px; }

.admin-body { min-height: 100%; overflow-y: auto; background: radial-gradient(circle at 30% 0, #112c3d, #050811 62%); color: var(--ink); }
.admin-shell { width: min(980px, calc(100% - 28px)); margin: 0 auto; padding: 50px 0; }
.admin-card { width: min(440px, 100%); margin: 0 auto; padding: 30px; }
.admin-card h1 { margin: 4px 0 24px; font: 900 42px "Arial Black", Impact, sans-serif; }
.admin-panel { width: 100%; }
.admin-panel .modal-heading h1 { margin: 3px 0 0; font-size: 32px; }
.admin-panel .modal-heading .secondary-button, .admin-panel > .secondary-button { width: auto; margin: 0; }
.admin-copy { color: var(--muted); font-size: 10px; }
.admin-map-list { margin-top: 18px; display: grid; gap: 8px; }
.admin-map-row { padding: 13px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; border: 1px solid rgba(255,255,255,.09); background: rgba(2,9,17,.62); }
.admin-map-row b, .admin-map-row small { display: block; }
.admin-map-row b { font-size: 11px; }
.admin-map-row small { margin-top: 4px; color: #6f8796; font-size: 8px; }
.admin-map-row strong { color: #748895; font: 700 10px "IBM Plex Mono", monospace; }
.admin-map-row strong.is-actionable { color: var(--danger); }
.admin-map-row button { min-height: 34px; padding: 0 10px; border: 1px solid var(--danger); background: rgba(255,77,120,.1); color: #ff8aa5; cursor: pointer; }
.admin-map-row button:disabled { opacity: .35; cursor: not-allowed; }
.admin-error { min-height: 18px; color: var(--danger); font-size: 9px; }

.mobile-controls { position: fixed; inset: 0; z-index: 8; display: none; pointer-events: none; touch-action: none; }
.joystick { position: absolute; left: max(24px, env(safe-area-inset-left)); bottom: max(28px, env(safe-area-inset-bottom)); width: 132px; height: 132px; border-radius: 50%; border: 2px solid rgba(84,245,255,.28); background: radial-gradient(circle, rgba(48,112,130,.24), rgba(4,13,23,.58)); box-shadow: inset 0 0 28px rgba(84,245,255,.08); pointer-events: auto; touch-action: none; }
.joystick::before, .joystick::after { content: ""; position: absolute; background: rgba(84,245,255,.11); }
.joystick::before { left: 14px; right: 14px; top: 50%; height: 1px; }
.joystick::after { top: 14px; bottom: 14px; left: 50%; width: 1px; }
.joystick-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; border-radius: 50%; transform: translate(-50%,-50%); border: 2px solid rgba(169,248,255,.68); background: rgba(28,81,97,.82); box-shadow: 0 0 18px rgba(84,245,255,.22); }
.mobile-actions { position: absolute; right: max(20px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom)); width: 228px; height: 190px; pointer-events: none; }
.mobile-action { position: absolute; width: 72px; height: 72px; overflow: hidden; border-radius: 50%; border: 3px solid rgba(255,255,255,.3); background: rgba(8,18,30,.88); color: #d9f7ff; box-shadow: 0 9px 28px rgba(0,0,0,.38); pointer-events: auto; touch-action: none; }
.mobile-action.jump { right: 0; bottom: 0; width: 104px; height: 104px; border-color: rgba(84,245,255,.82); box-shadow: 0 9px 28px rgba(0,0,0,.38), 0 0 18px rgba(84,245,255,.16); }
.mobile-action.boost { left: 20px; bottom: 7px; width: 90px; height: 90px; border-color: rgba(255,216,90,.78); box-shadow: 0 9px 28px rgba(0,0,0,.38), 0 0 18px rgba(255,216,90,.14); }
.mobile-action.brake { right: 42px; top: 0; border-color: rgba(255,92,141,.55); }
.mobile-action .mobile-cooldown { position: absolute; z-index: 0; inset: auto 0 0; height: var(--cooldown, 0%); background: rgba(1,5,10,.72); transition: height .08s linear; }
.mobile-action b, .mobile-action small { position: relative; z-index: 1; display: block; }
.mobile-action b { font: 700 11px "IBM Plex Mono", monospace; }
.mobile-action small { margin-top: 4px; color: #a8c0cf; font-size: 10px; font-weight: 700; text-shadow: 0 1px 4px #000; }
.mobile-action.pressed { transform: scale(.91); filter: brightness(1.4); }
.mobile-action.disabled { opacity: .72; }
.rotate-hint { display: none; position: fixed; z-index: 40; left: 50%; top: 12px; transform: translateX(-50%); padding: 7px 11px; border-radius: 4px; background: rgba(5,13,23,.88); color: #8ca7b8; font-size: 9px; pointer-events: none; }

@media (max-width: 820px) {
  #menu { justify-content: center; padding: 70px 16px 20px; }
  .brief { display: none; }
  .menu-card { max-height: calc(100vh - 86px); overflow-y: auto; }
  .quick-guide, .gamepad-note { display: none; }
  .mode-cards { grid-template-columns: 1fr; }
  .map-cards button { height: 44px; }
  .mode-card { min-height: 54px; }
  h1 { font-size: 68px; }
  .tagline { margin: 18px 0; }
  .hud-help { display: none; }
  .objective { top: auto; bottom: 20px; }
  .player-hud { top: 78px; left: 12px; }
  .player-chip { width: 180px; padding: 9px 10px; }
  .player-chip .hp { height: 10px; }
  .player-chip .ability-cooldowns { margin-top: 7px; gap: 5px; }
  .player-chip .ability { height: 24px; padding: 6px 5px; font-size: 7px; }
  .player-chip .ability em { font-size: 8px; }
  .settings-card { padding: 25px 20px; }
  .tutorial-card { padding: 25px 20px; }
  .tutorial-preview { grid-template-columns: repeat(2, 1fr); }
  .tutorial-preview span { min-height: 58px; }
  .tutorial-coach { bottom: 12px; }
  .tutorial-coach > div { grid-template-columns: repeat(2, 1fr); }
  .key-bindings { grid-template-columns: 1fr; }
  .channel-card, .custom-maps-card { padding: 22px 18px; }
  .play-actions { grid-template-columns: 1fr; }
  .play-actions > button { min-height: 54px; }
  .lobby-players { grid-template-columns: repeat(2, 1fr); }
  .custom-map-item { grid-template-columns: 1fr; }
  .custom-map-actions button { flex: 1; }
  .custom-meta-fields { grid-template-columns: 1fr; }
  .custom-editor-heading { align-items: start; flex-direction: column; }
  .custom-editor-heading > span { text-align: left; }
  .custom-editor-tools { grid-template-columns: repeat(4, 1fr); }
  #customMapEditor { min-height: 220px; }
  .custom-editor-footer { align-items: flex-start; flex-direction: column; padding: 7px 0; }
  .revive-choice-actions { grid-template-columns: 1fr; }
}

@media (pointer: coarse), (max-width: 820px) {
  .mobile-controls.is-visible { display: block; }
  .hud-help { display: none; }
  .objective { bottom: 8px; }
}

@media (pointer: coarse) and (orientation: portrait) {
  .rotate-hint.is-visible { display: block; }
  .joystick { width: 112px; height: 112px; }
  .mobile-actions { transform: scale(.9); transform-origin: right bottom; }
}

@media (max-height: 760px) and (min-width: 821px) {
  #menu { padding-top: 65px; }
  .menu-card { padding-top: 25px; }
  h1 { font-size: 70px; }
  .tagline { margin: 15px 0; }
  .selector-block { margin-top: 12px; }
  .primary-button { margin-top: 15px; }
  .quick-guide { display: none; }
}
