:root {
  color-scheme: dark;
  --base: #111614;
  --panel: #1a211eee;
  --text: #f1f4e8;
  --sub: #aebbb1;
  --line: #ffffff29;
  --lime: #cbfb65;
  --blue: #83e7ff;
  --orange: #ffab69;
  font: 16px/1.45 system-ui, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--base);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; }
body.in-game, body.art { overflow: hidden; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; font-weight: 700; color: var(--text); border-radius: 8px; }
button:disabled { opacity: .52; cursor: wait; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
input { color: var(--text); width: 100%; min-width: 0; padding: 9px 13px; background: #141917; border: 1px solid var(--line); border-radius: 8px; }
input::placeholder { color: #91a095; }
#arena { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#top {
  position: absolute; z-index: 2; top: 0; left: 0; right: 0;
  padding: 22px max(5vw, env(safe-area-inset-right)) 0 max(5vw, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font: 800 .75rem/1.2 system-ui, sans-serif; letter-spacing: .13em;
}
.brand { display: flex; align-items: center; gap: 11px; }
#connection { background: #101613dc; border: 1px solid var(--line); padding: 8px 12px; border-radius: 100px; white-space: nowrap; }
#connection::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 8px 1px 0; background: #a9b0a5; border-radius: 50%; }
#connection[data-state="online"]::before { background: var(--lime); }
#menu {
  position: relative; display: grid; align-items: center; min-height: 100svh;
  padding: 81px 5vw 38px;
  background: linear-gradient(90deg, #121814fc 1%, #131a16f2 24%, #141a16c9 37%, #141a1630 66%, transparent 100%), linear-gradient(0deg, #131a1599, transparent 25%);
}
.menu-content { max-width: 392px; width: 100%; }
.eyebrow { color: var(--lime); letter-spacing: .18em; font-size: .72rem; font-weight: 850; margin: 0 0 11px; }
h1 { margin: 0; font-size: clamp(3rem, 6.2vw, 6.4rem); letter-spacing: -.085em; line-height: .87; font-weight: 900; }
h1 span { color: var(--lime); }
.intro { color: #d0dad1; margin: 18px 0 24px; font-size: 1.03rem; }
.field-label { display: block; color: var(--sub); font-size: .76rem; font-weight: 750; margin: 0 0 6px; }
fieldset { padding: 0; margin: 15px 0; border: none; min-width: 0; }
.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.modes button, #weapons button { border: 1px solid var(--line); background: #171e1b; padding: 9px; }
button[aria-pressed="true"] { border-color: var(--lime) !important; color: var(--lime); background: #26331f !important; }
.menu-actions, .join-actions, .invite { display: flex; gap: 8px; align-items: stretch; }
.menu-actions button { flex: 1 1 auto; }
.primary, .secondary { padding: 10px 14px; border: 1px solid var(--line); white-space: nowrap; }
.primary { background: var(--lime); color: #18200e; border-color: var(--lime); }
.primary:hover:not(:disabled) { background: #dcff99; }
.secondary { background: #252d28; }
.secondary:hover:not(:disabled), .modes button:hover, #weapons button:hover { border-color: #a4b295; }
#join-form { margin-top: 18px; }
#room-code, #invite-code { letter-spacing: .16em; text-transform: uppercase; font-family: ui-monospace, monospace; }
#room-code::placeholder { font-family: system-ui, sans-serif; text-transform: none; letter-spacing: normal; }
#notice { margin: 9px 0 0; min-height: 1.35em; color: #ffd691; font-size: .82rem; }
.map-caption { position: absolute; right: 5vw; bottom: 6vh; text-align: right; text-shadow: 0 2px 10px #131714; display: grid; gap: 3px; }
.map-caption b { font-size: .78rem; letter-spacing: .16em; }
.map-caption span { color: #e0e5da; font-size: .83rem; }
.overlay { position: fixed; inset: 0; display: grid; place-items: center; z-index: 5; background: #0d130ed9; padding: 15px; overflow: auto; }
.dialog { width: min(100%, 520px); background: var(--panel); border: 1px solid var(--line); padding: clamp(17px, 4vw, 34px); border-radius: 14px; box-shadow: 0 20px 80px #05070591; }
.dialog h2 { font-size: clamp(1.9rem, 5vw, 3.1rem); margin: 0; letter-spacing: -.06em; line-height: .98; }
.dialog p { color: var(--sub); }
.dialog p.eyebrow { color: var(--lime); }
.dialog button { margin: 4px 3px 0 0; }
.invite { align-items: center; justify-content: space-between; margin-bottom: 7px; }
#invite-code { font-size: 1.6rem; font-weight: 800; color: var(--lime); }
#invite-link { font-size: .82rem; }
.rosters { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 14px 0; }
.rosters div:first-child b { color: var(--blue); }
.rosters div:last-child b { color: var(--orange); }
.rosters ul { padding-left: 17px; margin: 5px 0; font-size: .9rem; }
.gesture { display: none; }
#hud { position: fixed; inset: 0; overflow: hidden; z-index: 3; pointer-events: none; user-select: none; }
#hud button { pointer-events: auto; }
.match-bar {
  position: absolute; top: max(9px, env(safe-area-inset-top)); left: 50%; translate: -50% 0;
  background: #151c18e6; border: 1px solid var(--line); border-radius: 9px;
  display: grid; grid-template-columns: 48px 82px 48px; align-items: center; text-align: center; overflow: hidden;
}
.match-bar > span { padding: 7px 0; font-size: 1.33rem; font-weight: 850; }
#blue-score { color: var(--blue); background: #3395ba22; }
#orange-score { color: var(--orange); background: #bc6b3829; }
.match-bar b, .match-bar small { display: block; line-height: 1.19; }
.match-bar b { font: 800 .98rem ui-monospace, monospace; }
.match-bar small { color: var(--sub); font-size: .64rem; }
#menu-game { position: absolute; z-index: 2; top: max(9px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); padding: 5px 9px; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 17px; height: 17px; translate: -50% -50%; filter: drop-shadow(0 1px 2px #000); color: white; }
#crosshair::before, #crosshair::after { position: absolute; content: ""; inset: 0; margin: auto; background: currentColor; }
#crosshair::before { width: 2px; }
#crosshair::after { height: 2px; }
#crosshair.hit { rotate: 45deg; color: var(--lime); }
#vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 16vmin 4vmin #df513b; opacity: 0; transition: opacity .13s; }
#vignette.hurt { opacity: .66; }
#respawn { position: absolute; left: 50%; top: 58%; translate: -50% 0; padding: 7px 13px; background: #151b17ed; border: 1px solid var(--line); border-radius: 8px; white-space: nowrap; }
#desktop-hint { position: absolute; bottom: 27px; left: 50%; translate: -50% 0; font-size: .75rem; padding: 5px 9px; border-radius: 6px; background: #151b17dc; white-space: nowrap; }
#feed { position: absolute; top: 9px; left: max(12px, env(safe-area-inset-left)); max-width: calc(50vw - 95px); color: white; text-shadow: 0 1px 4px #000; font-size: .73rem; }
#player-stats, #arsenal { position: absolute; z-index: 1; bottom: max(13px, env(safe-area-inset-bottom)); padding: 8px 10px; background: #151c18e8; border: 1px solid var(--line); border-radius: 9px; }
#player-stats { left: max(12px, env(safe-area-inset-left)); min-width: 111px; }
#team-label { color: var(--blue); font-size: .7rem; }
.health { font-size: .7rem; }
.health b { font-size: 1.18rem; padding-left: 5px; }
progress { display: block; width: 100%; height: 4px; accent-color: var(--lime); margin: 2px 0; }
#arsenal { right: max(12px, env(safe-area-inset-right)); }
.ammo { display: flex; gap: 9px; align-items: baseline; justify-content: space-between; padding-bottom: 4px; }
.ammo strong { font: 800 1rem ui-monospace, monospace; }
.ammo span { color: var(--sub); font-size: .73rem; }
#weapons { display: flex; gap: 4px; }
#weapons button { padding: 3px 7px; font-size: .69rem; font-weight: 500; }
#touch, #rotate { display: none; }
@media (pointer: coarse), (hover: none) {
  #desktop-hint { display: none; }
  .keys { display: none; }
  .gesture { display: block; }
  #touch { display: block; }
  #look { position: absolute; inset: 0 0 0 36%; pointer-events: auto; touch-action: none; }
  #stick { position: absolute; left: max(24px, env(safe-area-inset-left)); bottom: max(88px, calc(env(safe-area-inset-bottom) + 77px)); width: 105px; height: 105px; border-radius: 50%; background: #222a2580; border: 1px solid #f2ffe66b; pointer-events: auto; touch-action: none; display: grid; place-items: center; }
  #stick i { width: 43%; aspect-ratio: 1; border-radius: 50%; background: #e0efd394; pointer-events: none; }
  .action { position: absolute; touch-action: none; border: 1px solid #f0f5e375; border-radius: 50%; width: 51px; height: 51px; background: #252d25a8; font-size: 1.2rem; display: grid; align-content: center; line-height: 1; }
  .action:active { background: #65784c; }
  .action small { display: block; font-size: .58rem; margin-top: 4px; }
  #fire { right: max(19px, env(safe-area-inset-right)); bottom: 156px; width: 63px; height: 63px; color: var(--lime); }
  #jump { right: max(17px, env(safe-area-inset-right)); bottom: 89px; }
  #slide { right: max(76px, calc(env(safe-area-inset-right) + 58px)); bottom: 85px; }
  #reload { right: max(139px, calc(env(safe-area-inset-right) + 121px)); bottom: 84px; }
  #aim { right: max(91px, calc(env(safe-area-inset-right) + 70px)); bottom: 147px; font-size: .62rem; }
  #weapons button { min-height: 31px; padding-inline: 11px; }
}
@media (max-width: 680px) and (orientation: portrait) {
  #menu { padding-top: 29vh; align-items: start; background: linear-gradient(0deg, #121814 0%, #121814fa 54%, #12181433 85%), linear-gradient(180deg, #10161388, transparent 24%); }
  .map-caption { display: none; }
  #rotate { display: block; position: absolute; bottom: 17px; left: 50%; translate: -50% 0; font-size: .62rem; color: #e9f2da; text-align: center; width: 100px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  #top { padding-top: 10px; }
  #top img { width: 27px; height: 27px; }
  #menu { padding-top: 48px; padding-bottom: 10px; }
  h1 { font-size: clamp(2.2rem, 5vw, 3.9rem); }
  .intro { margin: 9px 0; }
  .eyebrow { margin-bottom: 7px; }
  fieldset, #join-form { margin-top: 7px; margin-bottom: 7px; }
  .primary, .secondary, .modes button, input { padding-block: 6px; }
  #notice { min-height: 0; margin-top: 4px; }
}
@media (max-height: 440px) and (min-width: 575px) and (orientation: landscape) {
  #menu { background: linear-gradient(90deg, #121814f5, #131b16d6 42%, #151d1694 70%, #151d1640); }
  .menu-content { display: grid; max-width: 694px; grid-template-columns: 1fr minmax(275px, 1.05fr); gap: 5vw; align-items: center; }
  .map-caption { display: none; }
}
