:root {
  --ink: #e9eef2;
  --dim: #8fa3ad;
  --gold: #c8a24a;
  --blood: #b2323a;
  --gas: #6fc3d8;
  --steel: #cfd8dd;
  --panel: rgba(9, 14, 17, .55);
  --edge: rgba(200, 162, 74, .35);
  --font: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #0b0f12;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ── HUD ──────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; user-select: none; }

.panel {
  position: absolute;
  padding: 14px 16px;
  font-size: 12px;
  letter-spacing: .14em;
}
.bottom-left  { left: 22px;  bottom: 20px; }
.bottom-right { right: 22px; bottom: 20px; text-align: right; }
.top-right    { right: 22px; top: 18px;    text-align: right; }
.top-left     { left: 22px;  top: 18px; }

.meter { margin-bottom: 9px; width: 210px; }
.meter label { display: block; font-size: 10px; color: var(--dim); margin-bottom: 4px; }
.bar {
  height: 7px;
  background: rgba(0, 0, 0, .5);
  border: 1px solid rgba(255, 255, 255, .13);
  overflow: hidden;
}
.fill { display: block; height: 100%; width: 100%; transition: width .12s linear; }
.fill.health { background: linear-gradient(90deg, #8e2028, #d8474f); }
.fill.gas    { background: linear-gradient(90deg, #2b7f96, #7fdcf0); }
.fill.blade  { background: linear-gradient(90deg, #6d7a82, #dfe9ee); }
.fill.low    { animation: pulse .55s infinite alternate; }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }

.stat { line-height: 1; margin-bottom: 10px; }
.stat span {
  display: block;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: .02em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .8);
}
.stat label { font-size: 10px; color: var(--dim); }

/* ── ODM gear readout (bottom centre) ─────────────────────────────── */
#gear {
  position: absolute;
  left: 50%; bottom: 20px;
  transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 16px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(9, 14, 17, .28), rgba(9, 14, 17, .62));
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 2px;
  backdrop-filter: blur(3px);
}

.gauges { display: grid; gap: 8px; width: min(38vw, 300px); }
.gauge label {
  display: flex; justify-content: space-between;
  font-size: 9px; letter-spacing: .22em; color: var(--dim);
  margin-bottom: 4px;
}
.gauge output { color: var(--ink); letter-spacing: .06em; }
.bar.tall { height: 11px; }

.hook {
  position: relative;
  width: 64px; padding: 7px 4px 6px;
  text-align: center; line-height: 1.15;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(0, 0, 0, .38);
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.hook b {
  display: block; font-size: 15px; font-weight: 700;
  color: var(--steel); letter-spacing: .04em;
}
.hook em { display: block; font-size: 8px; font-style: normal; color: #5f7078; letter-spacing: .2em; }
.hook .state {
  display: block; margin-top: 4px;
  font-size: 8px; letter-spacing: .14em; color: var(--dim);
}
/* the little cable stub that lights up when anchored */
.hook .cable {
  position: absolute; left: 50%; top: -9px;
  width: 1px; height: 8px; margin-left: -.5px;
  background: rgba(255, 255, 255, .16);
  transition: background .12s, box-shadow .12s, height .12s;
}

.hook.on {
  background: rgba(111, 195, 216, .18);
  border-color: var(--gas);
  box-shadow: 0 0 14px rgba(111, 195, 216, .35);
}
.hook.on b { color: #cdf1fa; }
.hook.on .state { color: var(--gas); }
.hook.on .cable { background: var(--gas); height: 13px; box-shadow: 0 0 7px var(--gas); }

.hook.lock {
  background: rgba(200, 162, 74, .2);
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(200, 162, 74, .45);
  animation: lockPulse .9s ease-in-out infinite alternate;
}
.hook.lock b { color: #f6e4b4; }
.hook.lock .state { color: var(--gold); }
.hook.lock .cable { background: var(--gold); height: 15px; box-shadow: 0 0 8px var(--gold); }
@keyframes lockPulse {
  from { box-shadow: 0 0 10px rgba(200, 162, 74, .3); }
  to   { box-shadow: 0 0 22px rgba(200, 162, 74, .6); }
}

#view-mode { font-size: 10px; color: var(--dim); }
#view-mode b { color: var(--gold); }

#compass { opacity: .85; }
#radar { display: block; }

/* Crosshair */
#crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  transition: transform .12s ease-out, opacity .12s;
}
#crosshair i {
  position: absolute; background: rgba(255, 255, 255, .8);
  box-shadow: 0 0 4px rgba(0, 0, 0, .9);
}
#crosshair i:nth-child(1) { left: 50%; top: 0;  width: 1px; height: 9px; margin-left: -.5px; }
#crosshair i:nth-child(2) { left: 50%; bottom: 0; width: 1px; height: 9px; margin-left: -.5px; }
#crosshair i:nth-child(3) { top: 50%; left: 0;  height: 1px; width: 9px; margin-top: -.5px; }
#crosshair i:nth-child(4) { top: 50%; right: 0; height: 1px; width: 9px; margin-top: -.5px; }
#crosshair b {
  position: absolute; left: 50%; top: 50%;
  width: 2px; height: 2px; margin: -1px 0 0 -1px;
  background: var(--gold); border-radius: 50%;
}
/* Over a nape: the reticle flares red and rotates into a target. */
#crosshair.locked i { background: var(--blood); }
#crosshair.locked b { background: var(--blood); }
#crosshair.locked { transform: scale(1.4) rotate(45deg); }
/* Right mouse held — the camera has the mouse, so the reticle greys out. */
#crosshair.camlock { opacity: .4; }

#hit-marker {
  position: absolute; left: 50%; top: 50%;
  width: 28px; height: 28px; margin: -14px 0 0 -14px;
  opacity: 0; transform: scale(1.6);
}
#hit-marker::before, #hit-marker::after {
  content: ""; position: absolute; left: 50%; top: 0;
  width: 2px; height: 100%; background: #fff; margin-left: -1px;
}
#hit-marker::before { transform: rotate(45deg); }
#hit-marker::after  { transform: rotate(-45deg); }
#hit-marker.show { animation: hm .28s ease-out; }
@keyframes hm {
  from { opacity: 1; transform: scale(.55); }
  to   { opacity: 0; transform: scale(1.5); }
}

#vignette {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(150, 20, 26, .85) 100%);
  transition: opacity .25s;
}
#speedlines {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(255, 255, 255, .16) 78%, transparent 100%);
  mix-blend-mode: screen;
  transition: opacity .2s;
}

#toast {
  /* Sits below the tutorial panel and objective line so they never collide. */
  position: absolute; left: 50%; top: 41%;
  transform: translateX(-50%);
  font-size: 15px; letter-spacing: .3em;
  color: var(--gold); text-shadow: 0 2px 12px #000;
  opacity: 0; transition: opacity .3s;
}
#toast.show { opacity: 1; }

/* ── Overlay / cards ──────────────────────────────────────────────── */
#overlay {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 35%, #16202608, #05080ad9 70%), #05080a99;
  backdrop-filter: blur(6px);
  z-index: 10;
}
#overlay.hidden { display: none; }

.card {
  width: min(620px, 92vw);
  max-height: 92vh; overflow-y: auto;
  padding: 34px 38px;
  background: linear-gradient(180deg, rgba(16, 22, 26, .96), rgba(9, 12, 15, .97));
  border: 1px solid var(--edge);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .05);
  text-align: center;
}

h1 {
  /* Scales with the card so a long title can't overflow the border. */
  font-size: clamp(22px, 5.4vw, 42px);
  letter-spacing: .24em; font-weight: 700;
  color: var(--gold); text-indent: .24em;
  text-shadow: 0 3px 22px rgba(200, 162, 74, .25);
}
h2 { font-size: 26px; letter-spacing: .3em; text-indent: .3em; }
h2.danger { color: var(--blood); }
.sub { color: var(--dim); font-size: 13px; margin: 10px 0 22px; letter-spacing: .06em; }

.keys {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 7px 18px; text-align: left; margin-bottom: 20px;
}
.keys div { display: flex; align-items: baseline; gap: 10px; font-size: 12px; }
.keys b {
  min-width: 74px; color: var(--gold); font-size: 11px;
  letter-spacing: .1em; border: 1px solid var(--edge);
  padding: 3px 6px; text-align: center; background: rgba(200, 162, 74, .07);
}
.keys span { color: var(--dim); }

.tip {
  font-size: 12px; color: #a9bcc6; line-height: 1.65;
  background: rgba(178, 50, 58, .08);
  border-left: 2px solid var(--blood);
  padding: 10px 14px; text-align: left; margin-bottom: 24px;
}
.tip b { color: var(--blood); }

button {
  font-family: var(--font); font-size: 13px; letter-spacing: .26em;
  padding: 13px 30px; cursor: pointer; border: 1px solid var(--edge);
  background: transparent; color: var(--ink);
  transition: background .15s, color .15s, transform .1s;
  margin: 4px;
}
button:hover { background: var(--gold); color: #10161a; }
button:active { transform: translateY(1px); }
button.primary { background: rgba(200, 162, 74, .16); }
button.ghost { border-color: rgba(255, 255, 255, .15); color: var(--dim); font-size: 11px; padding: 10px 22px; }

.settings { text-align: left; margin: 6px 0 22px; display: grid; gap: 13px; }
.settings label { display: block; font-size: 11px; color: var(--dim); letter-spacing: .12em; }
.settings label.row { display: flex; align-items: center; gap: 9px; }
.settings output { float: right; color: var(--gold); }
.settings input[type=range] { width: 100%; margin-top: 6px; accent-color: var(--gold); }
.settings input[type=checkbox] { accent-color: var(--gold); width: 15px; height: 15px; }

.loadbar {
  height: 3px; background: rgba(255, 255, 255, .1);
  overflow: hidden; margin-top: 8px;
}
.loadbar span { display: block; height: 100%; width: 0%; background: var(--gold); transition: width .2s; }

.score { margin: 18px 0 26px; }
.score span { display: block; font-size: 60px; font-weight: 700; color: var(--gold); line-height: 1; }
.score label { font-size: 10px; color: var(--dim); letter-spacing: .3em; }

.fine { font-size: 10px; color: #5d6f78; margin-top: 14px; letter-spacing: .08em; }

@media (max-width: 620px) {
  .keys { grid-template-columns: 1fr; }
  .panel { transform: scale(.85); }
  #gear { gap: 9px; padding: 9px 10px; bottom: 12px; }
  #gear .hook { width: 52px; }
  .gauges { width: 46vw; }
}

/* ── menu: mode + map pickers ─────────────────────────────────────── */
.menu-block { text-align: left; margin-bottom: 16px; }
.menu-block > label {
  display: block; font-size: 10px; letter-spacing: .3em;
  color: var(--dim); margin-bottom: 7px;
}
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick {
  margin: 0; padding: 13px 6px; font-size: 12px; letter-spacing: .16em;
  border: 1px solid rgba(255, 255, 255, .14); background: rgba(0, 0, 0, .3);
}
.pick b { color: var(--gold); font-size: 11px; margin-left: 3px; }
.pick.selected {
  border-color: var(--gold); background: rgba(200, 162, 74, .18); color: var(--ink);
}
.pick.selected:hover { background: rgba(200, 162, 74, .3); color: var(--ink); }
.pick[data-locked] { opacity: .32; cursor: not-allowed; }
.pick[data-locked]:hover { background: rgba(0, 0, 0, .3); color: var(--ink); }

/* ── tutorial: instructor dialogue ────────────────────────────────── */
#tutorial {
  position: absolute; left: 50%; bottom: 132px;
  transform: translateX(-50%);
  width: min(720px, 92vw);
  display: flex; align-items: flex-end; gap: 0;
}
#tutorial.pop { animation: tutPop .28s ease-out; }
@keyframes tutPop {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#tutorial .portrait {
  width: 104px; flex: none;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .7));
}
#tutorial .portrait svg { display: block; width: 100%; height: auto; }

#tutorial .dbox {
  flex: 1; margin-left: -6px;
  background: rgba(10, 14, 18, .93);
  border: 2px solid var(--gold);
}
#tutorial.done .dbox { border-color: #4bd07a; }

.nameplate {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 14px;
  background: rgba(200, 162, 74, .16);
  border-bottom: 1px solid rgba(200, 162, 74, .4);
  font-size: 13px; letter-spacing: .26em; color: var(--gold); font-weight: 700;
}
.nameplate span { font-size: 9px; letter-spacing: .2em; color: var(--dim); font-weight: 400; }

.dbody { padding: 12px 16px 14px; text-align: left; }
#tut-title {
  font-size: 15px; letter-spacing: .2em; color: var(--ink);
  font-weight: 700; margin-bottom: 6px;
}
#tut-note { font-size: 13px; color: #ccd8de; line-height: 1.55; margin-bottom: 10px; }
#tut-hint {
  display: inline-block; padding: 5px 13px;
  border: 1px solid var(--edge); background: rgba(200, 162, 74, .12);
  color: var(--gold); font-size: 11px; letter-spacing: .18em;
}

#objective {
  position: absolute; left: 50%; top: 30%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .2em; color: var(--gold);
  text-shadow: 0 2px 10px #000;
}
#objective i {
  width: 7px; height: 7px; background: var(--gold);
  transform: rotate(45deg);
  animation: objPulse 1.1s ease-in-out infinite alternate;
}
@keyframes objPulse { from { opacity: .35; } to { opacity: 1; } }

/* ── live session ─────────────────────────────────────────────────── */
#session { margin-bottom: 8px; font-size: 10px; letter-spacing: .18em; }
.sess-row { color: var(--ink); font-size: 12px; }
.sess-row span { color: var(--gold); font-weight: 700; }
.sess-sub { color: var(--dim); font-size: 9px; margin-top: 2px; }
.sess-sub b { color: var(--gold); }

.stat.small span { font-size: 22px; }

#feed {
  position: absolute; right: 22px; top: 92px;
  list-style: none; text-align: right;
  font-size: 11px; letter-spacing: .1em;
}
#feed li {
  margin-bottom: 4px; padding: 4px 9px;
  background: rgba(9, 14, 17, .55);
  border-right: 2px solid var(--dim);
  color: #c6d3da;
  animation: feedIn .25s ease-out;
}
#feed li.titan  { border-right-color: var(--blood); }
#feed li.player { border-right-color: var(--gold); color: #f0e0b8; }
#feed li.join   { border-right-color: var(--gas); }
#feed li.fade   { opacity: 0; transition: opacity .5s; }
@keyframes feedIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; } }

#playerlist {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  min-width: min(520px, 88vw);
  padding: 20px 24px;
  background: rgba(8, 12, 15, .92);
  border: 1px solid var(--edge);
}
#playerlist h4 {
  font-size: 11px; letter-spacing: .3em; color: var(--gold);
  margin-bottom: 12px; font-weight: 700;
}
#playerlist table { width: 100%; border-collapse: collapse; font-size: 12px; }
#playerlist th {
  text-align: left; font-size: 9px; letter-spacing: .2em;
  color: var(--dim); font-weight: 400; padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
#playerlist td { padding: 6px 0; color: #cfd8dd; }
#playerlist td:first-child { display: flex; align-items: center; gap: 8px; }
#playerlist i { width: 8px; height: 8px; display: inline-block; }
#playerlist tr.me td { color: var(--gold); }
#playerlist tr.down td { opacity: .4; }

/* ── live movement tuner ──────────────────────────────────────────── */
#tuner {
  position: absolute; left: 22px; top: 180px;
  width: 300px; max-height: 66vh; overflow-y: auto;
  padding: 14px 16px;
  background: rgba(8, 12, 15, .93);
  border: 1px solid var(--edge);
  pointer-events: auto;
}
#tuner h4 {
  font-size: 10px; letter-spacing: .26em; color: var(--gold);
  margin-bottom: 12px; display: flex; justify-content: space-between; align-items: baseline;
}
#tuner h4 span { color: #5d6f78; letter-spacing: .1em; font-weight: 400; }
#tuner .grp {
  font-size: 9px; letter-spacing: .22em; color: var(--dim);
  margin: 12px 0 6px; padding-bottom: 3px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
#tuner label { display: block; font-size: 10px; color: #b7c4cb; margin-bottom: 8px; }
#tuner .row { display: flex; justify-content: space-between; margin-bottom: 2px; }
#tuner output { color: var(--gold); font-variant-numeric: tabular-nums; }
#tuner input[type=range] { width: 100%; accent-color: var(--gold); }
.tuner-actions { display: flex; gap: 8px; margin-top: 14px; }
.tuner-actions button {
  flex: 1; margin: 0; padding: 8px 4px; font-size: 10px; letter-spacing: .14em;
}

/* ── lobby: chunky, saturated, arcade ─────────────────────────────── */
#start.lobby {
  --amber:  #f5a623;
  --amber2: #d98a10;
  --blue:   #3d9be9;
  --blue2:  #2277c4;
  --red:    #e8483f;
  --red2:   #bf2f28;
  --green:  #4caf50;
  --grass:  #22402f;
  --grass2: #1a3325;
  --ink2:   #10201a;

  /* Edge to edge. The lobby is a HUD laid over the live forest, not a panel
   * floating on top of it — so it has no walls of its own and the world reads
   * straight through to the screen edges. Legibility comes from the scrims
   * below, which darken only where text actually sits. */
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 290px;
  grid-template-rows: auto 1fr;
  grid-template-areas: "top top top" "rail main side";
  gap: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  background:
    linear-gradient(180deg, rgba(6,14,10,.72) 0%, rgba(6,14,10,.28) 22%,
                            rgba(6,14,10,.30) 62%, rgba(6,14,10,.82) 100%),
    radial-gradient(ellipse at 50% 42%, transparent 30%, rgba(4,10,7,.55) 100%);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: left;
  overflow: hidden;
}

/* With the lobby up, the world behind stays legible instead of being blurred
 * into a wash — that blur is what made it read as a card on a backdrop. */
#overlay:has(> #start.lobby:not(.hidden)) {
  background: none;
  backdrop-filter: blur(1.5px) saturate(1.05);
  place-items: stretch;
}

/* ── top bar ── */
.topbar {
  grid-area: top;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 30px;
  background: none;
  border-bottom: 0;
}
.logo b {
  font-size: 25px; font-weight: 900; letter-spacing: .02em; color: #ffd964;
  -webkit-text-stroke: 3px #0d1a14; paint-order: stroke fill;
}
.logo i {
  font-style: normal; font-size: 25px; font-weight: 900; color: #fff;
  -webkit-text-stroke: 3px #0d1a14; paint-order: stroke fill; margin-left: 6px;
}
.counters { display: flex; gap: 9px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(0,0,0,.4); border: 2px solid #0d1a14;
  box-shadow: 0 3px 0 rgba(0,0,0,.4);
  font-size: 13px; font-weight: 800; color: #fff;
  text-decoration: none;
}
.pill i { font-style: normal; font-size: 14px; }
.pill.kills i { color: var(--red); }
.pill.speed i { color: var(--amber); }
.discord-pill { background: #5865f2; border-color: #2c34a8; letter-spacing: .08em; font-size: 11px; }
.discord-pill:hover { background: #6b77ff; }

/* ── left rail ── */
.rail {
  grid-area: rail;
  padding: 18px 16px; display: flex; flex-direction: column; gap: 10px;
  background: none;
  border-right: 0;
}
.rail-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  margin: 0; padding: 14px 6px;
  border: 3px solid #0d1a14; border-radius: 14px;
  background: rgba(255,255,255,.07);
  box-shadow: 0 4px 0 rgba(0,0,0,.4);
  color: #cfe3d6; font-size: 11px; font-weight: 800; letter-spacing: .1em;
  text-decoration: none; cursor: pointer;
  transition: transform .1s, background .12s, box-shadow .1s;
}
.rail-btn span { font-size: 21px; line-height: 1; }
.rail-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(0,0,0,.4); background: rgba(255,255,255,.13); }
.rail-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.4); }
.rail-btn.active { color: #fff; }
.rail-btn.battle.active { background: var(--blue);  border-color: var(--blue2); }
.rail-btn.train.active  { background: var(--amber); border-color: var(--amber2); }
.rail-btn.ctrl.active   { background: #7c5cc4;      border-color: #543a92; }
.rail-btn.discord { margin-top: auto; background: #5865f2; border-color: #2c34a8; color: #fff; }

/* ── main column ── */
/* The centre column keeps a comfortable measure so the controls don't stretch
 * across an ultrawide, while the background still runs to both edges. */
.lobby-main {
  grid-area: main;
  padding: 8px 28px 28px;
  overflow-y: auto;
  width: 100%;
  max-width: 760px;
  justify-self: center;
  align-self: center;
}

.field > span, .choose > span {
  display: block; font-size: 13px; font-weight: 800; letter-spacing: .02em;
  color: #fff; margin-bottom: 8px;
  text-shadow: 0 2px 0 rgba(0,0,0,.5);
}
.field { margin-bottom: 18px; }
#nickname {
  width: 100%; padding: 14px 16px;
  background: rgba(0,0,0,.42);
  border: 3px solid #0d1a14; border-radius: 12px;
  box-shadow: inset 0 3px 8px rgba(0,0,0,.45);
  color: #fff; font-family: var(--font); font-weight: 700;
  font-size: 16px; letter-spacing: .02em;
}
#nickname:focus { outline: none; border-color: var(--amber); }

.choose { margin-bottom: 18px; }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode-card {
  position: relative; margin: 0; padding: 20px 8px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 3px solid rgba(0,0,0,.55); border-radius: 16px;
  box-shadow: 0 6px 0 rgba(0,0,0,.4);
  color: #fff; cursor: pointer; overflow: hidden;
  transition: transform .1s, box-shadow .1s, filter .15s;
}
.mode-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 42%;
  background: linear-gradient(180deg, rgba(255,255,255,.28), transparent);
  pointer-events: none;
}
.mode-card.solo  { background: var(--amber); border-color: var(--amber2); }
.mode-card.duo   { background: var(--blue);  border-color: var(--blue2); }
.mode-card.squad { background: var(--red);   border-color: var(--red2); }
.mode-card .glyph { font-size: 34px; font-style: normal; line-height: 1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
.mode-card b {
  font-size: 17px; font-weight: 900; letter-spacing: .04em;
  text-shadow: 0 2px 0 rgba(0,0,0,.45);
}
.mode-card em { font-size: 11px; font-style: normal; font-weight: 700; color: rgba(255,255,255,.85); }
.mode-card:not([data-locked]):hover { transform: translateY(-3px); box-shadow: 0 9px 0 rgba(0,0,0,.4); }
.mode-card:not([data-locked]):active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.4); }
.mode-card.selected { outline: 4px solid #fff3c4; outline-offset: 2px; }
.mode-card .lock {
  position: absolute; inset: auto 0 0 0; padding: 4px;
  font-size: 10px; font-weight: 800; letter-spacing: .16em;
  background: rgba(0,0,0,.72); color: #ffd964; display: none;
}
.mode-cards.locked .mode-card, .mode-card[data-locked] {
  filter: grayscale(.9) brightness(.6); cursor: not-allowed;
}
.mode-cards.locked .mode-card .lock, .mode-card[data-locked] .lock { display: block; }
.mode-cards.locked .mode-card:hover, .mode-card[data-locked]:hover {
  transform: none; box-shadow: 0 6px 0 rgba(0,0,0,.4);
}

.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pick {
  margin: 0; padding: 13px 6px; border-radius: 12px;
  border: 3px solid rgba(0,0,0,.5); background: rgba(255,255,255,.08);
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
  color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .06em;
}
.pick.selected { background: var(--green); border-color: #2f7c33; }
.pick.selected:hover { background: #5ec462; color: #fff; }
.pick[data-locked] { opacity: .35; cursor: not-allowed; }

button.big {
  width: 100%; margin: 4px 0 10px; padding: 17px;
  border-radius: 14px; border: 3px solid #2f7c33;
  background: var(--green); color: #fff;
  font-size: 17px; font-weight: 900; letter-spacing: .14em;
  box-shadow: 0 6px 0 #245c27;
  transition: transform .1s, box-shadow .1s;
}
button.big:hover { background: #5ec462; color: #fff; transform: translateY(-2px); box-shadow: 0 8px 0 #245c27; }
button.big:active { transform: translateY(4px); box-shadow: 0 2px 0 #245c27; }
button.primary[disabled] {
  background: #4a5750; border-color: #333c37; box-shadow: 0 6px 0 #2a312d;
  filter: none; cursor: not-allowed; color: #9fb0a6;
}
button.primary[disabled]:hover { background: #4a5750; transform: none; box-shadow: 0 6px 0 #2a312d; }
#start .ghost {
  width: 100%; margin: 0; padding: 12px; border-radius: 12px;
  border: 3px solid rgba(0,0,0,.45); background: rgba(255,255,255,.08);
  color: #cfe3d6; font-weight: 800; font-size: 11px;
}

#start .tip {
  border-radius: 12px; border-left: 5px solid var(--amber);
  background: rgba(0,0,0,.3); color: #dfeae2; font-weight: 600;
}
#start .keys b {
  border-radius: 8px; border: 2px solid rgba(0,0,0,.5);
  background: rgba(0,0,0,.32); color: #ffd964; font-weight: 800;
}
#start .keys span { color: #cfe3d6; }

/* ── right column ── */
.lobby-side {
  grid-area: side;
  padding: 8px 26px 26px; display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
  align-self: center;
}
.side-card {
  padding: 14px 16px; border-radius: 14px;
  background: var(--blue); border: 3px solid var(--blue2);
  box-shadow: 0 5px 0 rgba(0,0,0,.35);
  color: #fff; text-decoration: none; display: block;
}
.side-card h5 {
  font-size: 12px; font-weight: 900; letter-spacing: .08em; color: #ffd964;
  margin-bottom: 10px; text-shadow: 0 2px 0 rgba(0,0,0,.4);
}
.prog-row {
  display: flex; justify-content: space-between;
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,.85);
  padding: 6px 0; border-bottom: 2px solid rgba(0,0,0,.16);
}
.prog-row:last-child { border-bottom: 0; }
.prog-row b { color: #fff; }
.discord-card { background: #5865f2; border-color: #2c34a8; }
.discord-card:hover { background: #6b77ff; }
.discord-card p { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.9); line-height: 1.55; margin-bottom: 8px; }
.discord-card .cta { font-size: 11px; font-weight: 800; color: #ffd964; }

@media (max-width: 900px) {
  /* One scrolling column. A grid with fixed rows inside a fixed-height,
   * overflow-hidden box clipped the deploy button and let the side panel
   * paint over it — on narrow screens the lobby is simply a page. */
  #start.lobby {
    display: block;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .lobby-main, .lobby-side {
    max-width: none; width: auto; align-self: start;
    padding: 8px 16px 16px; overflow: visible;
  }
  .lobby-side { padding-bottom: 28px; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 14px 16px; }
  .logo b, .logo i { font-size: 20px; }
  .rail {
    flex-direction: row; flex-wrap: wrap; border-right: 0;
    padding: 4px 16px 8px; gap: 8px;
  }
  /* Three chunky cards will not fit 375 px — let them wrap instead of
     overflowing off the right edge. */
  .mode-cards { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .row3 { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); }
  .rail-btn { flex: 1 1 70px; }
  .rail-btn.discord { margin-top: 0; }
}

/* ── per-blade gauges flanking the gear panel ─────────────────────── */
.blade-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.blade-bar {
  width: 64px; height: 6px;
  background: rgba(0, 0, 0, .55);
  border: 1px solid rgba(255, 255, 255, .14);
  overflow: hidden;
}
.blade-fill {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #7d8a92, #e6eef3);
  transition: width .12s linear;
}
/* Worn steel yellows, then reds, then snaps. */
.blade-col.worn  .blade-fill { background: linear-gradient(90deg, #8a7a3a, #e8d27a); }
.blade-col.low   .blade-fill { background: linear-gradient(90deg, #8e2f28, #e05a4f); }
.blade-col.broken .blade-bar {
  border-color: var(--blood);
  background: repeating-linear-gradient(
    -45deg, rgba(178,50,58,.5) 0 4px, rgba(0,0,0,.6) 4px 8px);
}
.blade-col.broken .blade-fill { width: 0 !important; }
.blade-col.broken .hook { opacity: .55; }
.blade-col.broken::after {
  content: "SNAPPED";
  font-size: 8px; letter-spacing: .16em; color: var(--blood);
}


/* ── battle royale banner ─────────────────────────────────────────── */
#royale {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  padding: 9px 20px; border-radius: 3px;
  background: linear-gradient(180deg, rgba(9,14,17,.55), rgba(9,14,17,.82));
  border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(3px);
  pointer-events: none; white-space: nowrap;
}
#royale.hidden { display: none; }
#royale b {
  font-size: 12px; font-weight: 800; letter-spacing: .18em; color: var(--gold);
}
#royale span { font-size: 11px; letter-spacing: .1em; color: #cfe3d6; }
#royale i {
  font-style: normal; font-size: 15px; font-weight: 700; color: #fff;
  font-variant-numeric: tabular-nums; letter-spacing: .06em;
}
/* Locked drop and a closing zone both need to shout. */
#royale.locked b { color: #ff8b6b; }
#royale.ready b { color: #7ee787; }
#royale.closing i { color: #ff6b6b; }

/* ── flight path over the sky reveal ──────────────────────────────── */
#skypath {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 4;
}
#skypath.hidden { display: none; }


/* ── account panel + leaderboard ──────────────────────────────────── */
.field-label {
  display: block; font-size: 13px; font-weight: 800; color: #fff;
  margin-bottom: 8px; text-shadow: 0 2px 0 rgba(0,0,0,.5);
}
.acct-card {
  padding: 14px 16px; border-radius: 12px; margin-bottom: 12px;
  background: rgba(0,0,0,.42); border: 3px solid #0d1a14;
}
.acct-card > b { font-size: 19px; color: #ffd964; }
.acct-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.acct-stats span { font-size: 11px; letter-spacing: .1em; color: #9fb3a6; }
.acct-stats b { color: #fff; margin-left: 5px; font-size: 13px; }
.acct-msg { min-height: 17px; font-size: 12px; font-weight: 700; color: #ff8b6b; margin: 4px 0 10px; }
.acct-msg.ok { color: #7ee787; }
#panel-account input[type=text], #panel-account input[type=password] {
  width: 100%; padding: 13px 15px;
  background: rgba(0,0,0,.42); border: 3px solid #0d1a14; border-radius: 12px;
  box-shadow: inset 0 3px 8px rgba(0,0,0,.45);
  color: #fff; font-family: var(--font); font-weight: 700; font-size: 15px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#lb-table { width: 100%; border-collapse: collapse; font-size: 12px; }
#lb-body tr { border-bottom: 2px solid rgba(0,0,0,.2); }
#lb-body td { padding: 7px 4px; color: #cfe3d6; font-weight: 700; }
#lb-body td:first-child { color: #ffd964; width: 30px; }
#lb-body td:last-child { text-align: right; color: #fff; }
#lb-body tr.me td { color: #7ee787; }

/* ── squad invite ─────────────────────────────────────────────────── */
#squad-card { background: #3f8f5f; border-color: #2a6b43; }
#squad-card.hidden { display: none; }
#squad-card p { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.92); line-height: 1.5; margin-bottom: 9px; }
#squad-link {
  width: 100%; padding: 9px 11px; margin-bottom: 9px;
  background: rgba(0,0,0,.34); border: 2px solid #2a6b43; border-radius: 9px;
  color: #fff; font-family: var(--font); font-size: 11px; font-weight: 700;
}
#squad-card button { width: 100%; margin: 0; }


/* ── settings overlay ─────────────────────────────────────────────── */
/* Deliberately NOT a modal backdrop: the match is still running behind it,
   so the world stays visible and readable while you adjust things. */
#settings-panel {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  background: rgba(5, 9, 12, .55);
  backdrop-filter: blur(2px);
}
#settings-panel.hidden { display: none; }
.set-inner {
  width: min(900px, 94vw); max-height: 90vh; overflow-y: auto;
  padding: 26px 30px;
  background: linear-gradient(180deg, rgba(16,22,26,.97), rgba(9,12,15,.98));
  border: 1px solid rgba(200,162,74,.35);
}
.set-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.set-head h2 { font-size: 18px; letter-spacing: .22em; color: var(--gold); }
.set-head button { margin: 0; }
.set-head b { color: var(--gold); font-family: var(--font); }
.set-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
.set-cols h3 {
  font-size: 10px; letter-spacing: .22em; color: var(--dim);
  padding-bottom: 6px; margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.set-foot { display: flex; gap: 10px; margin-top: 22px; }
.set-foot button { flex: 1; margin: 0; }

/* ── keybinding editor ───────────────────────────────────────────── */
.bind-list { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px; }
.bind-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 10px;
  background: rgba(255,255,255,.03);
}
.bind-row span { font-size: 12px; color: #b7c4cb; }
.bind-row button {
  margin: 0; min-width: 92px; padding: 6px 10px;
  font-size: 11px; letter-spacing: .08em; font-weight: 700;
  border: 1px solid rgba(255,255,255,.16); background: rgba(0,0,0,.4); color: #fff;
}
.bind-row button.custom { border-color: rgba(200,162,74,.5); color: var(--gold); }
.bind-row button.listening {
  border-color: #7ee787; color: #7ee787; background: rgba(126,231,135,.1);
}
#layout-note { margin-bottom: 12px; }

@media (max-width: 760px) {
  .set-cols { grid-template-columns: 1fr; gap: 24px; }
}


/* ── tutorial: live progress ──────────────────────────────────────── */
/* A beginner needs to see the goal move. Without a count, "hook it twice"
   reads as "nothing happened" the first time it works. */
.tut-row { display: flex; align-items: center; gap: 12px; }
#tut-count {
  font-size: 19px; font-weight: 800; color: #7ee787;
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
}
#tut-count.hidden { display: none; }
.tut-track {
  height: 5px; margin-top: 10px; border-radius: 3px;
  background: rgba(255,255,255,.12); overflow: hidden;
}
.tut-track.hidden { display: none; }
#tut-bar {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #c8a24a, #7ee787);
  transition: width .18s ease-out;
}


/* ── item bar ─────────────────────────────────────────────────────── */
#itembar {
  position: absolute; left: 50%; bottom: 118px; transform: translateX(-50%);
  display: flex; gap: 9px; pointer-events: none;
}
#itembar.hidden { display: none; }
.slot {
  position: relative; width: 74px; padding: 7px 6px 6px;
  background: linear-gradient(180deg, rgba(9,14,17,.55), rgba(9,14,17,.85));
  border: 1px solid rgba(255,255,255,.11);
  text-align: center; overflow: hidden;
}
.slot .k {
  display: block; font-size: 15px; font-weight: 800; color: #fff; line-height: 1;
}
.slot .n {
  display: block; margin-top: 4px;
  font-size: 8px; letter-spacing: .1em; color: var(--dim); line-height: 1.25;
}
/* The cooldown is a shutter that wipes downward — readable at a glance without
   having to parse a number mid-fight. */
.slot .cd {
  position: absolute; inset: 0 0 auto 0;
  background: rgba(0,0,0,.62);
  pointer-events: none;
}
.slot.ready { border-color: rgba(200,162,74,.5); }
.slot.ready .k { color: var(--gold); }
.slot.active {
  border-color: #7ee787;
  box-shadow: 0 0 0 1px rgba(126,231,135,.35), 0 0 16px rgba(126,231,135,.25);
}
.slot.active .k { color: #7ee787; }


/* ── battlefield mode card ────────────────────────────────────────── */
.mode-card.field { background: #4f8fd1; border-color: #2f6ba8; }
/* Four cards no longer fit a rigid three-column grid. */
.mode-cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
