/* Military HUD: muted olive/charcoal panels, amber accents, condensed type.
   No webfonts: the sandbox cannot reach a font service, so a system stack. */
:root {
  --amber: #ffb547;
  --amber-dim: #b9822f;
  --red: #e2483d;
  --olive: #2b2f24;
  --panel: rgba(14, 15, 12, 0.72);
  --line: rgba(255, 220, 160, 0.18);
  --text: #f1eadb;
  --muted: #b8ae9a;
  --font: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
/* Panels use display:grid/flex; the hidden attribute must still win. */
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #0c0c0b; color: var(--text);
  font-family: var(--font); user-select: none; -webkit-user-select: none; touch-action: none;
}
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.status { min-height: 1.2em; color: var(--amber); font-size: 14px; margin: 8px 0 0; }
.eyebrow { letter-spacing: 0.24em; font-size: 11px; color: var(--amber-dim); margin: 0 0 6px; }

/* ------------------------------------------------------------------ menu */
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 20;
  background: radial-gradient(ellipse at 30% 70%, rgba(120, 50, 20, 0.35), transparent 60%),
              linear-gradient(180deg, rgba(8, 8, 7, 0.55), rgba(8, 8, 7, 0.88));
}
.menu-card { width: min(92vw, 420px); padding: 22px 22px 18px; }
.menu-card h1 { font-size: clamp(34px, 9vw, 64px); line-height: 0.9; margin: 0 0 10px; letter-spacing: 0.02em; font-weight: 800; }
.menu-card h1 span { color: var(--amber); }
.tagline { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.primary {
  width: 100%; min-height: 52px; border: 0; border-radius: 4px; background: var(--amber); color: #1a1408;
  font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 17px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(255, 160, 50, 0.18);
}
.primary:active { transform: translateY(1px); }
.join { display: flex; gap: 8px; margin-top: 10px; }
.join input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 12px; border-radius: 4px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45); color: var(--text); font: inherit; font-size: 22px; letter-spacing: 0.3em; text-transform: uppercase;
}
.join button { min-height: 48px; padding: 0 18px; border-radius: 4px; border: 1px solid var(--amber-dim); background: transparent; font-weight: 700; letter-spacing: 0.08em; }

/* ------------------------------------------------------------------- hud */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud button, #hud .panel, #hud select, #hud input { pointer-events: auto; }
.top-left { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.autoskip {
  display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: center; text-align: left;
  min-height: 44px; padding: 6px 12px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel);
  backdrop-filter: blur(4px);
}
.autoskip .as-label { font-weight: 700; letter-spacing: 0.04em; font-size: 14px; }
.autoskip b { font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }
.autoskip small { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }
.autoskip.voted { border-color: var(--amber); }
.autoskip.voted .as-label { color: var(--amber); }
.autoskip.on { background: rgba(120, 70, 10, 0.75); border-color: var(--amber); }
.autoskip.on b { color: var(--amber); }
.room-chip { font-size: 11px; letter-spacing: 0.18em; color: var(--muted); background: var(--panel); padding: 4px 8px; border-radius: 3px; }
.room-chip b { color: var(--text); letter-spacing: 0.24em; }
#squad { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
#squad li { display: grid; grid-template-columns: 90px 70px; gap: 6px; align-items: center; font-size: 12px; background: var(--panel); padding: 3px 6px; border-radius: 3px; }
#squad li .sq-bar { height: 4px; background: rgba(255, 255, 255, 0.12); }
#squad li .sq-bar i { display: block; height: 100%; background: #8fd16a; }
#squad li.down .sq-bar i { background: var(--red); }
#squad li.dead { opacity: 0.45; }
.top-center { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 2px 8px #000; }
.wave { font-size: 14px; letter-spacing: 0.3em; color: var(--muted); }
.wave b { display: block; font-size: 44px; line-height: 1; color: var(--text); letter-spacing: 0.02em; }
.wave-sub { font-size: 13px; color: var(--amber); min-height: 1em; }
.top-right { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.money { text-align: right; text-shadow: 0 2px 8px #000; }
.money b { font-size: 24px; color: #9be27a; }
.money small { display: block; font-size: 11px; color: var(--muted); }
.mission { width: 210px; background: var(--panel); border-left: 3px solid var(--amber); padding: 6px 10px; border-radius: 3px; }
.mission span { font-size: 10px; letter-spacing: 0.22em; color: var(--amber); }
.mission p { margin: 2px 0 5px; font-size: 13px; }
.mission.done { border-color: #9be27a; }
.bar { height: 5px; background: rgba(255, 255, 255, 0.12); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--amber); transition: width 0.15s; }
.small-btn { min-height: 34px; padding: 0 12px; border-radius: 3px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; letter-spacing: 0.06em; }

#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; --gap: 9px; }
#crosshair i { position: absolute; background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 2px #000; }
#crosshair i:nth-child(1) { width: 2px; height: 8px; left: -1px; top: calc(-1 * var(--gap) - 8px); }
#crosshair i:nth-child(2) { width: 2px; height: 8px; left: -1px; top: var(--gap); }
#crosshair i:nth-child(3) { width: 8px; height: 2px; top: -1px; left: calc(-1 * var(--gap) - 8px); }
#crosshair i:nth-child(4) { width: 8px; height: 2px; top: -1px; left: var(--gap); }
#crosshair.hidden { display: none; }
#hitmarker { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; opacity: 0;
  background: linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
  -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px); mask: radial-gradient(circle, transparent 5px, #000 6px); }
#hitmarker.show { opacity: 1; }
#hitmarker.head { filter: drop-shadow(0 0 3px var(--red)) sepia(1) saturate(8) hue-rotate(-30deg); }
#hitmarker.kill { transform: scale(1.4); }
#damage { position: absolute; inset: 0; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(150, 0, 0, 0.55) 100%); }
#damage .arc { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; margin: -110px; border-radius: 50%;
  border-top: 5px solid rgba(255, 40, 30, 0.85); opacity: 0; transition: opacity 0.8s; }
#notice { z-index: 12; position: absolute; top: 24%; left: 50%; transform: translateX(-50%); text-align: center; font-size: clamp(22px, 5vw, 46px); font-weight: 800; letter-spacing: 0.08em; text-shadow: 0 3px 14px #000; opacity: 0; transition: opacity 0.35s; white-space: nowrap; }
#notice.show { opacity: 1; }
#notice small { display: block; font-size: 0.42em; letter-spacing: 0.12em; color: var(--amber); }
#prompt { position: absolute; top: 64%; z-index: 11; left: 50%; transform: translateX(-50%); font-size: 15px; background: var(--panel); padding: 6px 12px; border-radius: 3px; opacity: 0; }
#prompt.show { opacity: 1; }
#down-screen { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; background: radial-gradient(circle, rgba(60, 0, 0, 0.2), rgba(40, 0, 0, 0.7)); }
#down-screen b { font-size: 40px; letter-spacing: 0.1em; color: var(--red); }

.bottom-left { position: absolute; left: 12px; bottom: 12px; }
.health { display: flex; align-items: center; gap: 10px; background: var(--panel); padding: 8px 12px; border-radius: 3px; }
.health .bar { width: 190px; height: 9px; }
.health .bar i { background: linear-gradient(90deg, #6fbf4a, #a7e27c); }
.health.low .bar i { background: var(--red); }
.health b { font-size: 22px; min-width: 40px; }
.bottom-right { position: absolute; right: 14px; bottom: 12px; text-align: right; text-shadow: 0 2px 8px #000; }
#weapon-name { font-size: 12px; letter-spacing: 0.22em; color: var(--muted); }
.ammo b { font-size: 46px; line-height: 1; }
.ammo span { font-size: 18px; color: var(--muted); margin-left: 4px; }
.ammo.empty b { color: var(--red); }
#reload-hint { font-size: 12px; color: var(--amber); letter-spacing: 0.18em; min-height: 1em; }
.controls-help { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); font-size: 11px; color: rgba(255, 255, 255, 0.45); margin: 0; white-space: nowrap; }

/* ---------------------------------------------------------------- panels */
.panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 420px); max-height: 86vh; overflow: auto;
  background: rgba(14, 15, 12, 0.9); border: 1px solid var(--line); border-radius: 6px; padding: 18px; z-index: 10; backdrop-filter: blur(6px); }
.panel h2 { margin: 0 0 10px; letter-spacing: 0.08em; }
.panel > button:not(.primary) { margin-top: 10px; min-height: 40px; padding: 0 16px; border-radius: 4px; border: 1px solid var(--line); background: transparent; }
/* Near the top, not the bottom: the shell page can leave the frame's lower
   part below a 768 px screen's fold, hiding "Classes" and "Estou pronto"
   (2026-10-31 playtest). */
.lobby { top: 92px; transform: translateX(-50%); }
.code-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.code-row b { font-size: 38px; letter-spacing: 0.3em; color: var(--amber); }
.code-row button { min-height: 36px; padding: 0 14px; border-radius: 4px; border: 1px solid var(--line); background: transparent; }
#lobby-players { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; }
#lobby-players li { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 10px; background: rgba(255, 255, 255, 0.05); border-radius: 3px; }
#lobby-players li.ready { color: #9be27a; }
.shop-head { display: flex; justify-content: space-between; align-items: baseline; }
.shop-head b { color: #9be27a; font-size: 22px; }
.shop-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.shop-item small { color: var(--muted); }
.shop-item .pips { display: flex; gap: 3px; }
.shop-item .pips i { width: 16px; height: 5px; background: rgba(255, 255, 255, 0.15); }
.shop-item .pips i.on { background: var(--amber); }
.shop-item button { grid-row: 1 / 3; grid-column: 2; min-height: 40px; padding: 0 12px; border-radius: 4px; border: 1px solid var(--amber-dim); background: rgba(255, 181, 71, 0.1); font-weight: 700; }
.shop-item button:disabled { opacity: 0.4; cursor: default; }
#create:disabled, #join:disabled { opacity: 0.5; cursor: progress; }
#settings label { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
#settings select, #settings input { pointer-events: auto; }
.loading { position: fixed; left: 50%; bottom: 14%; transform: translateX(-50%); z-index: 30; background: var(--panel); padding: 8px 14px; border-radius: 4px; font-size: 14px; }

/* ----------------------------------------------------------------- touch */
.touch { position: absolute; inset: 0; pointer-events: auto; display: none; z-index: 1; }
body.coarse .touch { display: block; }
body.coarse .controls-help { display: none; }
#stick { position: absolute; width: 112px; height: 112px; margin: -56px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); left: 90px; bottom: 30px; top: auto; opacity: 0.55; }
#stick.on { opacity: 0.9; }
#stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); }
.touch button { position: absolute; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3); background: rgba(10, 10, 10, 0.35); color: #fff; font-weight: 800; }
.t-fire { right: 28px; bottom: 70px; width: 84px; height: 84px; font-size: 30px; border-color: rgba(255, 181, 71, 0.6) !important; }
.t-reload { right: 124px; bottom: 40px; width: 52px; height: 52px; }
.t-switch { right: 40px; bottom: 166px; width: 52px; height: 52px; }
.t-use { right: 124px; bottom: 104px; width: 52px; height: 52px; }
body.coarse .bottom-right { bottom: auto; top: 110px; }
body.coarse .bottom-left { left: 50%; transform: translateX(-50%); bottom: auto; top: 74px; }
body.coarse .health .bar { width: 120px; }
body.coarse .top-center { top: 6px; }
body.coarse .health { padding: 4px 8px; }

/* Small landscape phone frame (about 390x219 before fullscreen). */
@media (max-height: 420px) {
  .wave b { font-size: 30px; }
  .mission { width: 170px; }
  .mission p { font-size: 11px; }
  .money b { font-size: 18px; }
  .autoskip { min-height: 44px; padding: 4px 8px; }
  #squad { display: none; }
  .panel { padding: 12px; max-height: 92vh; }
  .code-row b { font-size: 28px; }
  .menu-card { padding: 10px; }
  .menu-card h1 { font-size: 30px; }
  .tagline { margin-bottom: 8px; font-size: 13px; }
  .primary { min-height: 44px; }
}

/* ---------------------------------------------------------- classes --
   Lobby "Classes" button and panel (user request 2026-10-31). */
.class-btn { width: 100%; min-height: 44px; margin: 8px 0; display: flex; justify-content: space-between; align-items: center;
  padding: 0 14px; border-radius: 4px; border: 1px solid var(--amber-dim); background: rgba(40, 32, 16, 0.6); letter-spacing: 0.06em; }
.class-btn b { color: var(--amber); }
.classes { width: min(94vw, 560px); }
#classes-list { display: grid; gap: 10px; margin-top: 10px; }
.class-card { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; background: rgba(0, 0, 0, 0.25); }
.class-card.current { border-color: var(--amber); }
.class-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.class-head b { font-size: 18px; letter-spacing: 0.06em; }
.class-head button { min-height: 40px; padding: 0 14px; border-radius: 4px; border: 0; background: var(--amber); color: #1a1408; font-weight: 800; }
.class-head button:disabled { background: transparent; border: 1px solid var(--line); color: var(--muted); cursor: default; }
.class-card > small { color: var(--muted); }
.class-card ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.class-card li { display: grid; grid-template-columns: 26px 150px 1fr; gap: 6px; align-items: baseline; }
.class-card li span { color: var(--muted); }
kbd { display: inline-block; min-width: 20px; padding: 0 4px; border: 1px solid var(--line); border-radius: 3px; font: 11px/18px var(--font); text-align: center; color: var(--amber); }

/* Ability bar: bottom centre, above the controls line. The dark overlay
   shrinks from the top as the cooldown runs out (--cd = share remaining). */
.abilities { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; gap: 8px; }
.ability { position: relative; width: 54px; height: 54px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center; overflow: hidden; }
.ability::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--cd, 0%); background: rgba(0, 0, 0, 0.62); }
.ability.ready { border-color: var(--amber); box-shadow: 0 0 10px rgba(255, 181, 71, 0.35); }
.ability b { font-size: 24px; z-index: 1; }
.ability kbd { position: absolute; left: 3px; top: 3px; z-index: 2; background: rgba(0, 0, 0, 0.5); }
.ability .cd { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 18px; z-index: 2; text-shadow: 0 1px 4px #000; }
.t-ab { width: 50px; height: 50px; font-size: 20px; opacity: 0.55; }
.t-ab.ready { opacity: 1; border-color: rgba(255, 181, 71, 0.7) !important; }
.t-ab1 { right: 190px; bottom: 150px; }
.t-ab2 { right: 132px; bottom: 176px; }
.t-ab3 { right: 74px; bottom: 214px; }

/* Own shield (blue) and smoke (grey) as a screen-edge glow. */
#hud.shielded::before, #hud.smoked::before { content: ""; position: absolute; inset: 0; pointer-events: none; }
#hud.shielded::before { box-shadow: inset 0 0 90px rgba(80, 150, 255, 0.55); }
#hud.smoked::before { box-shadow: inset 0 0 140px rgba(150, 150, 155, 0.7); }

/* ------------------------------------------------------------- chat --
   Bottom-right, above the ammo counter; only shown with 2+ players. */
.chat { position: absolute; right: 14px; bottom: 112px; width: min(42vw, 340px); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#chat-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; max-height: 40vh; overflow: hidden; }
#chat-log li { background: var(--panel); padding: 4px 8px; border-radius: 3px; font-size: 13px; max-width: 100%; overflow-wrap: anywhere; transition: opacity 1s; user-select: text; }
#chat-log li b { color: var(--amber); }
#chat-log li.mine b { color: #9be27a; }
#chat-log li.old { opacity: 0; }
.chat.open #chat-log li.old { opacity: 0.85; }
#chat-form { width: 100%; }
#chat-input { width: 100%; min-height: 40px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--amber); background: rgba(10, 10, 8, 0.85);
  color: var(--text); font: 15px var(--font); outline: none; user-select: text; }
.chat-btn { min-height: 34px; padding: 0 10px; border-radius: 3px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; }
.chat.open .chat-btn { display: none; }
@media (max-height: 420px) {
  .chat { bottom: 92px; }
  .abilities { bottom: 18px; }
  .ability { width: 44px; height: 44px; }
}
/* Touch: ability buttons replace the desktop bar; chat moves clear of the thumbs. */
body.coarse .abilities { display: none; }
body.coarse .chat { bottom: auto; top: 170px; }

/* Money top right on the start screen and in the HUD (user request 2026-10-31). */
.menu-wallet { position: absolute; top: 12px; right: 16px; text-align: right; text-shadow: 0 2px 8px #000; }
.menu-wallet small, .money small.label { display: block; font-size: 10px; letter-spacing: 0.22em; color: var(--muted); }
.menu-wallet b { font-size: 26px; color: #9be27a; }
.class-top { border-color: var(--amber-dim); color: var(--amber); }
#menu-classes { margin-top: 10px; }
#menu-classes:disabled { opacity: 0.5; cursor: progress; }
/* The classes and weapons panels live outside #hud so the start screen can
   open them; above #menu (z 20). 2026-10-31: the weapons panel shipped
   without this, sat under the start screen, and no click reached its buttons. */
#classes, #weapons { position: fixed; z-index: 25; }
.life-btn { border-color: rgba(226, 72, 61, 0.7); }
.life-btn b { color: #9be27a; margin-left: 4px; }
.life-btn:disabled { opacity: 0.45; cursor: default; }
#hud.raging::before { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 90px rgba(255, 120, 30, 0.5); }
.over-bonus { color: #9be27a; font-weight: 700; }
.ability .cd.price { font-size: 12px; align-items: end; padding-bottom: 3px; color: #9be27a; }

/* ---------------------------------------------------------- weapons --
   Lobby "Armas" shop (user request 2026-10-31): one card per weapon, the
   accent colour names its family, the bars compare at a glance. */
.weapon-btn b { color: #9fd0ff; }
#weapons-list { display: grid; gap: 10px; margin-top: 10px; }
.weapon-card { --accent: #c9a35a; position: relative; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 4px; padding: 10px 12px; background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 14%, transparent), rgba(0, 0, 0, 0.3) 45%); }
.weapon-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.weapon-card .class-head b { font-size: 16px; letter-spacing: 0.05em; color: #f3ead8; }
.weapon-card .origin { margin-left: 8px; padding: 1px 6px; border-radius: 3px; font: 700 10px/16px var(--font); font-style: normal; letter-spacing: 0.1em; vertical-align: middle; }
.weapon-card .origin.real { background: rgba(200, 200, 200, 0.15); color: #cfd3d8; }
.weapon-card .origin.invented { background: color-mix(in srgb, var(--accent) 30%, transparent); color: #fff; }
.weapon-card > small { display: block; margin-top: 4px; color: var(--muted); }
.weapon-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.weapon-tags span { padding: 1px 6px; border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 10px; font-size: 11px; color: var(--accent); letter-spacing: 0.04em; }
.weapon-bars { display: grid; grid-template-columns: 70px 1fr 56px; gap: 3px 8px; align-items: center; font-size: 11px; }
.weapon-bars span { color: var(--muted); }
.weapon-bars .bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.weapon-bars .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.weapon-bars b { text-align: right; font-weight: 600; color: #e9e2d2; }
.weapon-card .class-head button { background: var(--accent); }
