/* Dead Zone — interfaz mínima sobre el lienzo del juego.
   Paleta de ceniza, óxido y bengala; tipografía condensada de rótulo militar. */
:root {
  --bg: #0c0e0b;
  --ink: #e6e0d2;
  --dim: #9c968a;
  --panel: rgba(15, 17, 13, 0.74);
  --panel-solid: #15170f;
  --line: rgba(230, 224, 210, 0.14);
  --hp: #b5463a;
  --st: #c7a24a;
  --xp: #86a892;
  --accent: #d9783a;
  --accent-ink: #1a0f08;
  --display: 'Teko', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --ui: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#game {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

[hidden] { display: none !important; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- HUD ---------- */

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.state-menu #hud { display: none; }

.xp-track {
  position: absolute;
  top: var(--sat);
  left: 0;
  right: 0;
  height: 5px;
  background: rgba(0, 0, 0, 0.45);
}
.xp-fill {
  height: 100%;
  width: 0;
  background: var(--xp);
  box-shadow: 0 0 8px rgba(134, 168, 146, 0.5);
  transition: width 0.15s linear;
}

.hud-left {
  position: absolute;
  top: calc(var(--sat) + 14px);
  left: max(14px, var(--sal));
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.lvl-badge {
  display: grid;
  place-items: center;
  align-content: center;
  width: 46px;
  background: var(--panel);
  border: 1px solid var(--line);
  clip-path: polygon(0 0, 100% 0, 100% 78%, 78% 100%, 0 100%);
  line-height: 0.8;
}
.lvl-badge small { font-size: 11px; letter-spacing: 0.14em; color: var(--dim); }
.lvl-badge b { font-family: var(--display); font-size: 30px; font-weight: 600; color: var(--xp); }

.vitals { display: grid; gap: 5px; width: 210px; }
.bar {
  position: relative;
  height: 20px;
  background: rgba(10, 11, 9, 0.7);
  border: 1px solid var(--line);
  overflow: hidden;
}
.bar.st { height: 12px; }
.bar .fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  transform-origin: left;
}
.bar.hp .fill { background: linear-gradient(180deg, #c8574a, var(--hp)); }
.bar.st .fill { background: linear-gradient(180deg, #d6b45e, var(--st)); }
.bar.rb { height: 14px; }
.bar.rb .fill { background: linear-gradient(180deg, #8fa3b3, #4f6574); }
.bar.rb .lbl, .bar.rb .val { font-size: 10px; }
.bar.st.exhausted .fill { background: #6d5d38; }
.bar.hp.low { animation: pulse 0.8s ease-in-out infinite; }
@keyframes pulse { 50% { border-color: rgba(200, 80, 60, 0.9); } }
.bar .lbl, .bar .val {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.bar .lbl { left: 7px; }
.bar .val { right: 7px; font-variant-numeric: tabular-nums; }
.bar.st .lbl { font-size: 9px; }

.hud-right {
  position: absolute;
  top: calc(var(--sat) + 14px);
  right: max(14px, var(--sar));
  display: flex;
  gap: 4px;
  align-items: stretch;
}
.stat {
  display: grid;
  align-content: center;
  min-width: 58px;
  padding: 3px 10px 1px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: right;
  line-height: 1;
}
.stat small {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.stat b {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 0.95;
}
.icon-btn {
  pointer-events: auto;
  width: 44px;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
}
.icon-btn svg { width: 20px; height: 20px; fill: var(--ink); }

#toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sab) + 28%);
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow: 0 2px 6px #000;
  opacity: 0;
  transition: opacity 0.25s;
  white-space: nowrap;
}
#toast.show { opacity: 1; }

#banner {
  position: absolute;
  top: calc(var(--sat) + 22%);
  left: 0;
  right: 0;
  display: grid;
  justify-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s, transform 0.4s;
  padding-inline: 16px;
}
#banner.show { opacity: 1; transform: none; }
#banner b {
  font-family: var(--display);
  font-size: clamp(44px, 9vw, 84px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 0.85;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.8);
}
#banner span {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 2px 6px #000;
}

/* Panel de equipo: armas, munición, granadas y bloques en la esquina superior izquierda */
.hud-left { flex-direction: column; gap: 6px; width: 226px; }
.hud-row { display: flex; gap: 8px; align-items: stretch; }
.vitals { flex: 1; width: auto; min-width: 0; }
.loadout {
  display: grid;
  gap: 4px;
  padding: 5px 7px 6px;
  background: rgba(10, 11, 9, 0.55);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
}
.lo-weapon { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.lo-weapon .slots { min-width: 0; }
.wname {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}
.count { font-family: var(--display); font-variant-numeric: tabular-nums; line-height: 0.85; white-space: nowrap; }
.count b { font-size: 24px; font-weight: 600; }
.count i { font-style: normal; color: var(--dim); margin: 0 2px; font-size: 14px; }
.count span { font-size: 14px; color: var(--dim); }
.count.empty b { color: var(--hp); }
.reload-track { height: 2px; background: rgba(255, 255, 255, 0.08); }
.reload-fill { height: 100%; width: 0; background: var(--ink); }
.slots, .inv { display: flex; flex-wrap: wrap; gap: 3px; }
.slot {
  pointer-events: auto;
  padding: 1px 5px 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 15px;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
}
.slot.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.it {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 19px;
  padding: 0 5px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.3);
}
.it svg { width: 12px; height: 12px; flex: none; }
.it.zero { opacity: 0.35; }
.it.on { border-color: var(--xp); }
.it.gren b { color: var(--accent); }
.it.money { color: var(--st); font-family: var(--display); font-size: 16px; font-weight: 600; padding-top: 2px; }

/* ---------- Ronda completada ---------- */

#round-panel {
  display: none;
  position: absolute;
  top: calc(var(--sat) + 72px);
  right: max(14px, var(--sar));
  width: 214px;
  padding: 8px 9px 9px;
  text-align: left;
  background: rgba(13, 15, 11, 0.8);
  border: 1px solid var(--line);
  border-left: 2px solid var(--xp);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: rise 0.3s ease-out;
}
.state-play #round-panel.show { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(-6px); } }
#round-panel .kicker, .round-sub { display: none; }
#round-panel h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: 0.06em; color: var(--xp); }
.round-actions { display: grid; grid-template-columns: 1fr; gap: 4px; }
.round-actions .btn { font-size: 15px; padding: 8px 8px 5px; letter-spacing: 0.08em; clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); }
#btn-round-shop { font-size: 13px; padding: 5px 8px 3px; color: var(--dim); }
.round-key { margin: 5px 0 0; font-size: 11px; color: var(--dim); }
.touch .round-key { display: none; }

/* ---------- Dinero flotante ---------- */

#money-pops { position: relative; height: 0; }
.money-pop {
  position: absolute;
  left: 8px;
  top: 0;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  animation: pop-up 1.25s ease-out forwards;
  pointer-events: none;
  white-space: nowrap;
}
.money-pop.loss { color: #e05a48; }
.money-pop.gold { color: #f0c040; font-size: 30px; }
@keyframes pop-up {
  0% { opacity: 0; transform: translateY(6px) scale(0.9); }
  15% { opacity: 1; transform: translateY(0) scale(1.08); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-26px) scale(1); }
}

/* ---------- Cuenta y clasificación ---------- */

.account-bar {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: -8px 0 16px;
  font-size: 16px;
  color: var(--dim);
}
.account-bar b { color: var(--ink); letter-spacing: 0.04em; }
.link-btn { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }
#btn-leaderboard { width: min(300px, 100%); font-size: 20px; padding: 10px 18px 7px; }
.acct-lead, .acct-note { margin: 0 0 14px; font-size: 15px; line-height: 1.35; color: #cfc8b8; text-align: left; }
.acct-note { font-size: 13px; color: var(--dim); margin: 10px 0 0; }
.acct-form { display: grid; gap: 6px; text-align: left; margin-bottom: 12px; }
.acct-form label { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.acct-form input {
  font: inherit;
  font-size: 20px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 0;
  -webkit-user-select: text;
  user-select: text;
}
.acct-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.acct-error { min-height: 1.2em; margin: 4px 0; color: #e05a48; font-size: 15px; }
.acct-known { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
#btn-acct-back { margin-top: 12px; }
.board-tabs { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.board-tabs .chip { font-size: 13px; padding: 4px 12px 2px; }
.board { list-style: none; margin: 0 0 6px; padding: 0; max-height: 52vh; overflow-y: auto; text-align: left; }
.board li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}
.board li b { grid-row: span 2; align-self: center; font-family: var(--display); font-size: 26px; color: var(--dim); text-align: center; }
.board li:nth-child(1) b { color: #f0c040; }
.board li:nth-child(2) b { color: #c9c4b6; }
.board li:nth-child(3) b { color: #c98a52; }
.board li.me { background: rgba(134, 168, 146, 0.12); }
.board .nm { font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .st { font-size: 14px; color: var(--dim); font-variant-numeric: tabular-nums; }
.board-empty { display: block !important; color: var(--dim); text-align: center; }

/* ---------- Pausa ---------- */

.panel.pause-panel { width: min(760px, 100%); }
.pause-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); gap: 22px; text-align: left; }
.keys-title { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
.keys-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 15px; align-items: center; }
.keys-list dt { color: var(--ink); white-space: nowrap; }
.keys-list dd { margin: 0; color: #cfc8b8; }
.keys-list kbd { margin-right: 2px; }
.help-touch-block { display: none !important; }
.touch .help-touch-block { display: block !important; }
.touch dl.help-touch-block { display: grid !important; }
.touch .help-desktop-block { display: none !important; }
@media (max-width: 640px) {
  .pause-grid { grid-template-columns: 1fr; }
  .keys-list { font-size: 14px; }
}

/* ---------- Tienda ---------- */

.panel.shop { text-align: left; }
.shop .kicker { text-align: left; }
.shop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.shop-head h2 { margin-bottom: 4px; }
.shop-money { font-family: var(--display); font-size: 44px; font-weight: 600; color: var(--st); font-variant-numeric: tabular-nums; }
.shop-note { margin: 0 0 14px; font-size: 15px; color: var(--dim); }
.shop-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 8px; margin-bottom: 14px; }
.shop-item {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(230, 224, 210, 0.05);
  border: 1px solid var(--line);
}
.shop-item.hot { border-color: rgba(217, 120, 58, 0.45); }
.shop-ic { width: 60px; height: 60px; }
.shop-txt { display: grid; gap: 2px; min-width: 0; }
.shop-txt b { font-family: var(--display); font-size: 24px; font-weight: 500; line-height: 0.9; letter-spacing: 0.03em; text-transform: uppercase; }
.shop-txt span { font-size: 15px; line-height: 1.2; color: #cfc8b8; }
.shop-txt small { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.btn.buy { width: auto; min-width: 84px; padding: 11px 14px 8px; font-size: 24px; background: var(--st); color: #1d1607; border-color: var(--st); }
.shop-sec {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
}
.shop-sec:first-child { margin-top: 0; }
.shop-empty { grid-column: 1 / -1; margin: 0; font-size: 14px; color: var(--dim); }
.shop-item.owned { border-color: rgba(134, 168, 146, 0.35); }
.btn.buy.sell { min-width: 0; font-size: 16px; padding: 8px 10px 5px; background: none; color: var(--accent); border-color: rgba(217, 120, 58, 0.6); }
.btn.buy.sell:hover { background: rgba(217, 120, 58, 0.15); }
.tag-owned { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--xp); padding: 0 8px; }
.buy-col { display: grid; gap: 4px; }
.btn.buy.sm { min-width: 0; font-size: 17px; padding: 7px 10px 4px; }
.btn.buy.poor { background: rgba(230, 224, 210, 0.06); color: var(--dim); border-color: var(--line); cursor: not-allowed; }

/* ---------- Controles táctiles ---------- */

#touch { display: none; position: absolute; inset: 0; pointer-events: none; }
.touch.state-play #touch { display: block; }

#joy-zone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50%;
  height: 72%;
  pointer-events: auto;
  touch-action: none;
}
#joy-base {
  position: absolute;
  left: 0;
  top: 0;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  border: 2px solid rgba(230, 224, 210, 0.22);
  background: radial-gradient(circle, rgba(230, 224, 210, 0.08), rgba(230, 224, 210, 0.02) 70%);
  opacity: 0.5;
  transition: opacity 0.15s;
  pointer-events: none;
}
#joy-base:not(.active) {
  left: calc(max(16px, var(--sal)) + 84px);
  top: auto;
  bottom: calc(var(--sab) + 84px);
  margin: 0 0 -60px -60px;
}
#joy-base.active { opacity: 1; }
#joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(230, 224, 210, 0.35);
  border: 2px solid rgba(230, 224, 210, 0.5);
}

.tbtns {
  position: absolute;
  right: max(16px, var(--sar));
  bottom: calc(var(--sab) + 18px);
  width: 210px;
  height: 240px;
  pointer-events: none;
}
.tbtn {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(15, 17, 13, 0.55);
  border: 2px solid rgba(230, 224, 210, 0.28);
  color: var(--ink);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.tbtn svg { width: 46%; height: 46%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tbtn.down { background: rgba(230, 224, 210, 0.25); }
.tbtn.big { right: 0; bottom: 0; width: 92px; height: 92px; border-color: rgba(217, 120, 58, 0.75); }
.tbtn.big.down { background: rgba(217, 120, 58, 0.45); }
.tbtn.mid { right: 104px; bottom: 6px; width: 70px; height: 70px; }
.tbtn.mid span { font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.tbtn.mid.on { background: var(--st); color: #1d1607; border-color: var(--st); }
.tbtn.small { width: 52px; height: 52px; }
.tbtn.off { opacity: 0.4; }
.tbtn .badge {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 20px;
  height: 20px;
  padding: 2px 5px 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  background: var(--accent);
  color: var(--accent-ink);
}
#btn-grenade { right: 144px; bottom: 88px; }
#btn-molotov { right: 100px; bottom: 156px; }
#btn-robot { right: 160px; bottom: 200px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; border-color: rgba(201, 165, 74, 0.7); }
.tbtn.gone { display: none; }
#btn-build { right: 34px; bottom: 176px; }
#btn-reload { right: 4px; bottom: 112px; }
#btn-swap { right: 74px; bottom: 96px; }

.touch #view { cursor: default; }

/* ---------- Pantallas ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(var(--sat) + 16px) max(16px, var(--sar)) calc(var(--sab) + 16px) max(16px, var(--sal));
  background: radial-gradient(ellipse at center, rgba(8, 9, 7, 0.35), rgba(8, 9, 7, 0.85));
  overflow-y: auto;
  touch-action: pan-y;
}
#screen-start { display: none; }
.state-menu #screen-start { display: grid; }

.panel {
  width: min(440px, 100%);
  padding: 28px 28px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  text-align: center;
}
.panel.wide { width: min(860px, 100%); }
.title-panel { width: min(560px, 100%); background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }

.kicker {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}
.logo {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(76px, 20vw, 150px);
  font-weight: 700;
  line-height: 0.78;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.9);
}
.logo span {
  display: block;
  color: transparent;
  -webkit-text-stroke: 2px var(--ink);
  letter-spacing: 0.08em;
}
.lead {
  max-width: 40ch;
  margin: 18px auto 22px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.35;
  color: #cfc8b8;
  text-wrap: balance;
}
h2 {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: 52px;
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-wrap: balance;
}
.dead-title { color: var(--hp); }

.btn {
  display: block;
  width: 100%;
  padding: 13px 18px 10px;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  background: rgba(230, 224, 210, 0.07);
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: rgba(230, 224, 210, 0.14); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #e58a4c; }
.btn.ghost { background: none; color: var(--dim); }
.start-actions { display: grid; gap: 10px; justify-items: center; }
#btn-start, #btn-continue { width: min(300px, 100%); font-size: 30px; padding: 14px 18px 10px; white-space: nowrap; }
@media (max-width: 560px) { #btn-continue { font-size: 24px; } }
#btn-continue + #btn-start:not(.primary) { font-size: 22px; padding: 10px 18px 7px; }
.stack { display: grid; gap: 10px; }

.controls-help { margin-top: 26px; font-size: 14px; color: var(--dim); }
.controls-help > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; }
.help-touch { display: none !important; }
.touch .help-touch { display: flex !important; }
.touch .help-desktop { display: none !important; }
kbd {
  display: inline-block;
  padding: 1px 6px 0;
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  background: rgba(255, 255, 255, 0.04);
}
.best { min-height: 1em; margin: 18px 0 0; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.card {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 16px 16px 18px;
  text-align: left;
  background: rgba(230, 224, 210, 0.05);
  border: 1px solid var(--line);
  border-top: 3px solid var(--xp);
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
  opacity: 0.5;
}
.cards.ready .card { opacity: 1; }
.card:hover, .card:focus-visible { background: rgba(230, 224, 210, 0.11); transform: translateY(-2px); }
.card.weapon { border-top-color: var(--accent); }
.card .ic { width: 34px; height: 34px; color: var(--xp); }
.card.weapon .ic { color: var(--accent); }
.card .ic svg { width: 100%; height: 100%; }
.card .nm { font-family: var(--display); font-size: 28px; font-weight: 500; line-height: 0.9; letter-spacing: 0.03em; text-transform: uppercase; }
.card .ds { font-size: 16px; line-height: 1.25; color: #cfc8b8; }
.card .tg { font-size: 11px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); }
.card .key { font-size: 11px; color: var(--dim); letter-spacing: 0.1em; }
.touch .card .key { display: none; }

.results {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 18px;
  margin: 0 0 6px;
  text-align: left;
  font-size: 17px;
}
.results dt { color: var(--dim); }
.results dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.results .sep { grid-column: 1 / -1; height: 1px; background: var(--line); margin: 4px 0; }

/* ---------- Pantallas estrechas ---------- */

@media (max-width: 720px) {
  .cards { grid-template-columns: 1fr; gap: 8px; }
  .card { grid-template-columns: 34px 1fr; column-gap: 12px; row-gap: 2px; padding: 12px 14px; }
  .card .ic { grid-row: span 3; width: 30px; height: 30px; align-self: center; }
  .card .nm { font-size: 24px; }
  .card .ds { font-size: 15px; }
  h2 { font-size: 42px; margin-bottom: 12px; }
  .panel { padding: 22px 18px 18px; }
}

@media (max-width: 560px) {
  .hud-left { width: 184px; }
  .slot { padding: 1px 4px 0; font-size: 9px; line-height: 14px; }
  #round-panel { top: calc(var(--sat) + 62px); width: 184px; right: max(10px, var(--sar)); }
  #round-panel h2 { font-size: 17px; }
  .round-actions .btn { font-size: 13px; }
  .lvl-badge { width: 38px; }
  .loadout { padding: 4px 6px 5px; gap: 3px; }
  .count b { font-size: 20px; }
  .wname { font-size: 10px; letter-spacing: 0.1em; }
  .it { height: 17px; padding: 0 4px; font-size: 11px; }
  .it svg { width: 11px; height: 11px; }
  .it.money { font-size: 14px; }
  .lvl-badge b { font-size: 26px; }
  .stat { min-width: 0; padding: 3px 7px 1px; }
  .stat small { font-size: 9px; letter-spacing: 0.1em; }
  .stat b { font-size: 21px; }
  .icon-btn { width: 38px; }
  .hud-left { left: max(10px, var(--sal)); gap: 6px; }
  .hud-right { right: max(10px, var(--sar)); }
}

@media (max-width: 560px) {
  .shop-item { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; padding: 8px 10px; }
  .shop-ic { width: 44px; height: 44px; }
  .shop-txt b { font-size: 20px; }
  .shop-txt span { font-size: 13px; }
  .shop-txt small { font-size: 10px; }
  .btn.buy { min-width: 64px; padding: 9px 10px 6px; font-size: 20px; }
  .shop-money { font-size: 36px; }
  .shop-note { font-size: 13px; }
}

@media (max-height: 460px) {
  #round-panel { top: calc(var(--sat) + 8px); right: auto; left: 50%; transform: translateX(-50%); width: 272px; padding: 6px 8px 7px; animation: none; }
  #round-panel h2 { font-size: 15px; margin-bottom: 4px; }
  .round-actions { grid-template-columns: 1fr auto; }
  .round-actions .btn, #btn-round-shop { font-size: 13px; padding: 6px 8px 4px; }
  .hud-left, .hud-right { top: calc(var(--sat) + 10px); }
  .bar { height: 17px; }
  .bar.st { height: 10px; }
  .panel { padding: 16px 18px; }
  .panel.wide .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .panel.wide .card { grid-template-columns: 1fr; padding: 10px 12px; }
  .panel.wide .card .ic { grid-row: auto; }
  .logo { font-size: 84px; }
  .lead { margin: 10px auto 12px; font-size: 15px; }
  .controls-help { margin-top: 12px; }
  h2 { font-size: 34px; margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Salón de la fama (menú principal) ---------- */

.menu-layout {
  display: grid;
  gap: 28px;
  width: min(1060px, 100%);
  margin: auto;
  justify-items: center;
  align-items: center;
}
@media (min-width: 760px) {
  .menu-layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 36px; }
}
#screen-start { place-items: stretch; }

.hall {
  --gold: #f0c040;
  --silver: #c9c4b6;
  --bronze: #c98a52;
  position: relative;
  width: min(440px, 100%);
  padding: 22px 20px 16px;
  overflow: hidden;
  isolation: isolate;
  text-align: center;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(217, 120, 58, 0.28), transparent 60%),
    linear-gradient(180deg, rgba(34, 18, 9, 0.92), rgba(10, 9, 7, 0.95));
  border: 1px solid rgba(240, 192, 64, 0.38);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 0 46px rgba(217, 120, 58, 0.28), inset 0 0 70px rgba(217, 120, 58, 0.12);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}
.hall::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), #fff2c0, var(--gold), transparent);
  background-size: 200% 100%;
  animation: hall-sweep 3.5s linear infinite;
}
.hall > * { position: relative; z-index: 1; }
.hall-embers {
  position: absolute !important;
  inset: 0;
  z-index: 0 !important;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    radial-gradient(2px 2px at 12% 80%, #ffb060, transparent 60%),
    radial-gradient(1.5px 1.5px at 30% 60%, #ffd890, transparent 60%),
    radial-gradient(2px 2px at 52% 90%, #ff9040, transparent 60%),
    radial-gradient(1.5px 1.5px at 70% 70%, #ffcf80, transparent 60%),
    radial-gradient(2px 2px at 88% 85%, #ffb060, transparent 60%),
    radial-gradient(1.5px 1.5px at 42% 40%, #ffd890, transparent 60%),
    radial-gradient(1.5px 1.5px at 80% 30%, #ff9040, transparent 60%);
  background-size: 100% 260px;
  animation: hall-embers 7s linear infinite;
}
.hall-kicker {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(240, 160, 40, 0.6);
}
.hall-title {
  margin: 0 0 10px;
  font-size: clamp(54px, 9vw, 72px);
  line-height: 0.85;
  letter-spacing: 0.06em;
  color: transparent;
  background: linear-gradient(100deg, #7a4a12 0%, var(--gold) 28%, #fff4c8 44%, var(--gold) 60%, #7a4a12 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 14px rgba(240, 150, 40, 0.5));
  animation: hall-shimmer 4s linear infinite;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  margin: 12px 0 10px;
}
.pod { --c: var(--gold); display: grid; justify-items: center; gap: 1px; min-width: 0; }
.pod.p2 { --c: var(--silver); }
.pod.p3 { --c: var(--bronze); }
.pod-crown { width: 46px; color: var(--gold); filter: drop-shadow(0 0 8px rgba(240, 192, 64, 0.9)); animation: hall-float 2.4s ease-in-out infinite; }
.pod-crown svg { display: block; width: 100%; height: auto; }
.pod-medal {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 4px;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  padding-top: 3px;
  color: #1a1206;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8e0, var(--c) 45%, color-mix(in srgb, var(--c) 55%, #000) 100%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6), 0 0 18px color-mix(in srgb, var(--c) 70%, transparent);
}
.pod.p1 .pod-medal { width: 52px; height: 52px; font-size: 34px; animation: hall-glow 2s ease-in-out infinite; }
.pod-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 700; color: var(--ink); }
.pod.p1 .pod-name { font-size: 19px; color: #fff2c8; }
.pod.me .pod-name::after { content: ' (tú)'; color: var(--xp); font-weight: 600; }
.pod-wave { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.pod-wave b { font-family: var(--display); font-size: 34px; font-weight: 600; line-height: 0.8; letter-spacing: 0; color: var(--c); text-shadow: 0 0 14px color-mix(in srgb, var(--c) 55%, transparent); }
.pod.p1 .pod-wave b { font-size: 46px; }
.pod-kills { min-height: 1.2em; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pod-base {
  width: 100%;
  height: 30px;
  margin-top: 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, transparent), color-mix(in srgb, var(--c) 8%, transparent));
  border-top: 2px solid var(--c);
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
}
.pod.p2 .pod-base { height: 46px; }
.pod.p1 .pod-base { height: 66px; position: relative; overflow: hidden; }
.pod.p1 .pod-base::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 244, 200, 0.45) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: hall-shimmer 3s linear infinite;
}
.pod.empty { opacity: 0.45; }
.pod.empty .pod-crown, .pod.empty .pod-medal { animation: none; }

.hall-list { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow-y: auto; text-align: left; }
.hall-list li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 3px;
  padding: 7px 8px 6px;
  border-bottom: 1px solid rgba(240, 192, 64, 0.12);
  background: linear-gradient(90deg, rgba(240, 192, 64, 0.05), transparent 70%);
}
.hall-list .rk { grid-row: span 3; align-self: center; font-family: var(--display); font-size: 24px; color: var(--dim); text-align: center; }
.hall-list .nm { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hall-list .st { font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; }
.hall-list .bar-w { display: block; height: 3px; width: var(--w); min-width: 6px; background: linear-gradient(90deg, var(--accent), var(--gold)); box-shadow: 0 0 8px rgba(240, 160, 40, 0.5); }
.hall-list li.me { background: linear-gradient(90deg, rgba(134, 168, 146, 0.22), transparent 80%); box-shadow: inset 3px 0 0 var(--xp); }
.hall-list li.me .nm::after { content: ' (tú)'; color: var(--xp); }
.hall-list .board-empty { display: block; padding: 10px 0; color: var(--dim); text-align: center; background: none; border: 0; }

.hall-me {
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 10px 0 8px;
  padding: 7px 10px 5px;
  border: 1px dashed rgba(240, 192, 64, 0.4);
  background: rgba(0, 0, 0, 0.32);
}
.hall-me:empty { display: none; }
.me-tag { font-size: 12px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); }
.me-rank { font-family: var(--display); font-size: 32px; line-height: 0.8; color: var(--gold); text-shadow: 0 0 12px rgba(240, 160, 40, 0.6); }
.me-st { font-size: 14px; color: #cfc8b8; }
.hall #btn-leaderboard { width: auto; padding: 4px 0 0; font-size: 15px; }

.hall-full { width: min(560px, 100%); }
.hall-full .hall-list { max-height: 40vh; }

.rank-badge {
  display: inline-block;
  padding: 3px 10px 0;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.rank-badge.r1 { background: linear-gradient(100deg, #b07a18, #f0c040, #fff2c0, #f0c040, #b07a18); background-size: 250% 100%; animation: hall-shimmer 3s linear infinite; }
.rank-badge.r2 { background: linear-gradient(100deg, #8a857a, #e6e1d4, #8a857a); }
.rank-badge.r3 { background: linear-gradient(100deg, #8a5a2e, #e0a468, #8a5a2e); }
.rank-badge.none { color: var(--dim); background: rgba(230, 224, 210, 0.08); }

@keyframes hall-shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@keyframes hall-sweep { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes hall-embers { from { background-position: 0 0; } to { background-position: 0 -260px; } }
@keyframes hall-float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-4px) rotate(3deg); } }
@keyframes hall-glow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6), 0 0 14px rgba(240, 192, 64, 0.6); }
  50% { box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 220, 120, 0.95); }
}

@media (max-height: 460px) {
  .hall { padding: 12px 14px 10px; }
  .hall-title { font-size: 40px; margin-bottom: 4px; }
  .podium { margin: 6px 0; }
  .pod.p1 .pod-base { height: 36px; }
  .pod.p2 .pod-base { height: 24px; }
  .pod-base { height: 16px; }
  .pod-crown { width: 34px; }
  .hall-list { max-height: 90px; }
}
@media (prefers-reduced-motion: reduce) {
  .hall-embers { display: none; }
}
@media (max-width: 759px) {
  #screen-start .controls-help { display: none; }
  #screen-start .best:empty { display: none; }
}
.ver { margin: 10px 0 0; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(156, 150, 138, 0.7); }
.hall-list .online-err { color: #e0a060; font-size: 13px; }

/* ---------- Cooperativo ---------- */

#btn-coop, #btn-online { width: min(300px, 100%); font-size: 20px; padding: 10px 18px 7px; border-color: rgba(159, 208, 255, 0.45); color: #cfe6ff; }
.panel.coop-panel { width: min(460px, 100%); }
.coop-step { display: grid; gap: 12px; margin: 6px 0 4px; }
.coop-or { font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
.coop-join { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.coop-join input {
  font: inherit;
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: 0.4em;
  text-align: center;
  text-transform: uppercase;
  padding: 6px 8px 2px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 0;
  -webkit-user-select: text;
  user-select: text;
}
.coop-join .btn { width: auto; font-size: 22px; }
.coop-label { margin: 0; font-size: 14px; color: var(--dim); }
.coop-code { font-family: var(--display); font-size: 84px; line-height: 0.9; letter-spacing: 0.25em; color: #cfe6ff; text-shadow: 0 0 22px rgba(120, 180, 255, 0.5); padding-left: 0.25em; }
.coop-status { min-height: 1.3em; margin: 10px 0; font-size: 15px; color: #cfc8b8; }
.coop-status.bad { color: #e0a060; }

#net-stat {
  align-self: flex-start;
  padding: 2px 7px 1px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #9fd0ff;
  background: rgba(10, 11, 9, 0.6);
  border: 1px solid rgba(159, 208, 255, 0.25);
  pointer-events: auto;
  cursor: pointer;
  white-space: nowrap;
}

/* en línea: panel de diagnóstico (tocar el indicador o F3) */
#net-diag {
  align-self: flex-start;
  margin: 4px 0 0;
  padding: 6px 8px;
  max-width: min(520px, calc(100vw - 32px));
  font: 700 10px/1.5 ui-monospace, Menlo, Consolas, monospace;
  color: #cfe6ff;
  background: rgba(10, 11, 9, 0.78);
  border: 1px solid rgba(159, 208, 255, 0.25);
  white-space: pre-wrap;
  pointer-events: none;
}

/* sala en línea */
.ol-name { margin: 0; }
.ol-code { font-size: 56px; letter-spacing: 0.18em; }
.ol-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 34vh; overflow-y: auto; text-align: left; }
.ol-member { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px 5px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); font-size: 15px; }
.ol-member.me { border-color: rgba(159, 208, 255, 0.45); }
.ol-member.off { opacity: 0.55; }
.ol-member .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-member .tg { flex: none; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.ol-results { padding: 8px 10px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); text-align: left; font-size: 14px; }
.ol-res-head { margin: 0 0 6px; color: #cfe6ff; font-weight: 700; }
.ol-res-row { color: #cfc8b8; }
#btn-ol-start:disabled { opacity: 0.55; cursor: default; }
