:root {
  /* tema verde (el del logo de la intro, client/logo.json): paneles oscuros con tramado y texto crema; los acentos
     (rosa, amarillo, cian, lavanda) se quedan para lo importante. --cream es el fondo de los paneles y --ink el texto
     (los nombres vienen del tema claro de antes); --edge, los contornos pixelados */
  --ink: #eef8e4;
  --edge: #07130c;
  --cream: #173022;
  --cream-2: #24452f;
  --well: #0d2016;
  --tile: #e6f4da;
  --tile-2: #c9efb2;
  --btn: #2a5537;
  --pink: #ff8fb8;
  --pink-2: #ff6fa3;
  --mint: #9efe7c;
  --lime: #66ff00;
  --leaf: #2a5f1c;
  --sky: #9fd8ff;
  --yellow: #ffd96b;
  --lav: #cdb8ff;
  --muted: #9cc3a3;
  --danger: #8a2a3d; /* el botón de quitar (un jugador de la sala…) */
  --danger-ink: #ffe3ea;
  --hud-scale: 1; /* tamaño de todo el HUD de la partida (texto, botones y paneles a la vez) */
  --map-text: 1; /* tamaño de los nombres, la vida y los textos sobre el mapa (lo lee el Renderer) */
  --heading: #b9e3bf; /* títulos de sección (las categorías del arsenal y de la ayuda) */
  --font: 'Pixelify Sans', monospace;
  --base-size: 17px; /* tamaño del texto */
  --page: #0b1d12; /* fondo de las pantallas */
  --veil: #06160c; /* velo sobre el juego de fondo del menú, la sala y el lobby */
  --veil-k: 1; /* y su fuerza (0 = sin velo) */
  --dither-size: 6px; /* lo que mide cada píxel del tramado */
  /* tramado de 2 px (un píxel de luz cada 4): textura de los paneles y del fondo */
  --dither: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Crect width='1' height='1' fill='%23ffffff' fill-opacity='.05'/%3E%3Crect x='2' y='2' width='1' height='1' fill='%23ffffff' fill-opacity='.05'/%3E%3C/svg%3E");
  --dither-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Crect width='1' height='1' fill='%2307130c' fill-opacity='.5'/%3E%3Crect x='2' y='2' width='1' height='1' fill='%2307130c' fill-opacity='.5'/%3E%3Crect x='2' width='1' height='1' fill='%2307130c' fill-opacity='.25'/%3E%3C/svg%3E");
}

/* la fuente del juego (Visitor, de Brian Kent: gratis, también para uso comercial; su licencia en fonts/visitor.txt) */
@font-face { font-family: 'Visitor'; src: url('fonts/visitor1.ttf') format('truetype'); font-display: block; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: #ffd6ea; color: var(--ink); font-family: var(--font); font-weight: 500; font-synthesis: none; user-select: none; font-size: 17px; }
input, select, button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: .85em; }

/* Borde pixelado: esquinas "mordidas" sin redondeo */
.pix {
  box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge),
    inset 0 -4px 0 0 rgba(7, 19, 12, .12);
}

#menu-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; image-rendering: pixelated; pointer-events: none; filter: brightness(.82) saturate(.95); transition: clip-path .8s cubic-bezier(.65, 0, .35, 1); }

.screen { position: fixed; inset: 0; display: none; z-index: 1; }
.screen.active { display: flex; }

/* ---------- botones y campos ---------- */
.btn {
  border: 0; padding: 10px 16px; cursor: pointer; background: var(--cream); color: var(--ink); font-weight: 600;
  box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge), inset 0 -4px 0 0 rgba(7, 19, 12, .18);
  margin: 3px; transition: transform .06s, filter .12s;
}
.btn:hover, .btn.vhover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--pink); color: #fff; text-shadow: 2px 2px 0 var(--pink-2); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink); }
.btn.ghost:hover { background: rgba(255, 255, 255, .5); }
.btn.big { padding: 14px 20px; font-size: 1.15rem; }
.btn.wide { width: calc(100% - 6px); }
.btn.small { padding: 4px 9px; font-size: .85rem; }
.btn.danger { background: #ffd0dc; }
.btn.on { background: var(--mint); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
input, select {
  background: #fff; border: 0; padding: 9px 11px; outline: none; margin: 3px;
  box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge);
}
input:focus, select:focus { background: #fffbe6; }
.check { display: flex; align-items: center; gap: 8px; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--pink-2); box-shadow: none; }
.pill { background: var(--cream); padding: 6px 12px; font-size: .9rem; box-shadow: 0 -2px 0 0 var(--edge), 0 2px 0 0 var(--edge), -2px 0 0 0 var(--edge), 2px 0 0 0 var(--edge); }

/* ---------- menú ---------- */
/* menú en la esquina inferior izquierda, sin tarjeta: el juego de fondo queda a la vista */
#scr-menu { align-items: flex-end; justify-content: flex-start; }
#scr-menu::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(6, 18, 11, .62) 0%, rgba(6, 18, 11, .28) 30%, rgba(6, 18, 11, 0) 52%),
    linear-gradient(0deg, rgba(6, 18, 11, .45) 0%, rgba(6, 18, 11, 0) 35%);
}
.menu-card { position: relative; width: min(400px, calc(100vw - 32px)); margin: 0 0 clamp(16px, 4vh, 40px) clamp(16px, 4vw, 56px); text-align: left; color: #fff; }
.logo {
  margin: 0; font-weight: 700; font-size: clamp(3rem, 12vw, 4.6rem); line-height: 1; letter-spacing: .02em; color: #fff;
  text-shadow: 4px 0 0 var(--edge), -4px 0 0 var(--edge), 0 4px 0 var(--edge), 0 -4px 0 var(--edge), 4px 4px 0 var(--edge), -4px 4px 0 var(--edge), 4px -4px 0 var(--edge), -4px -4px 0 var(--edge), 0 9px 0 var(--pink-2);
  animation: bob 2.4s ease-in-out infinite;
}
.logo span { color: var(--yellow); }
@keyframes bob { 50% { transform: translateY(-5px); } }
.tagline { color: var(--muted); margin: 18px 0 22px; }
.menu-card .field { text-align: left; }
.menu-buttons { display: flex; flex-direction: column; gap: 8px; }
.menu-buttons small { display: block; font-size: .75rem; opacity: .75; }

/* estilo del menú sobre el juego: texto con contorno pixelado, botones compactos que se deslizan al pasar */
.menu-card .logo { font-size: clamp(2.6rem, 7vw, 4rem); animation: none; }
.menu-card .tagline {
  margin: 10px 0 20px; color: #fff3c4; font-size: .95rem; letter-spacing: .14em; text-transform: uppercase;
  text-shadow: 2px 0 0 var(--edge), -2px 0 0 var(--edge), 0 2px 0 var(--edge), 0 -2px 0 var(--edge);
}
.menu-card .field span { color: #fff; text-shadow: 2px 2px 0 var(--edge); }
.menu-card input { background: color-mix(in srgb, var(--edge) 72%, transparent); color: #fff; width: calc(100% - 6px); box-sizing: border-box; }
.menu-card input::placeholder { color: rgba(255, 255, 255, .55); }
.menu-card input:focus { background: rgba(10, 30, 19, .9); }
.menu-card .menu-buttons { gap: 6px; }
.menu-card .menu-buttons .btn {
  display: flex; align-items: center; gap: 10px; text-align: left; width: calc(100% - 6px); position: relative;
  transition: transform .12s steps(3), filter .12s;
}
.menu-card .menu-buttons .btn::after { content: '▶'; margin-left: auto; font-size: .8em; opacity: 0; transition: opacity .12s; }
.menu-card .menu-buttons .btn:hover, .menu-card .menu-buttons .btn.vhover { transform: translateX(8px); }
.menu-card .menu-buttons .btn:hover::after, .menu-card .menu-buttons .btn.vhover::after { opacity: 1; }
.menu-card .menu-buttons .btn .bt { display: flex; flex-direction: column; line-height: 1.15; }
.menu-card .menu-buttons .btn .bt small { display: block; margin-top: 3px; }
.menu-card .btn.big:not(.primary) { background: rgba(255, 248, 238, .92); }
.menu-card .btn.ghost { color: #fff; text-shadow: 2px 2px 0 var(--edge); }
.menu-card .btn.ghost:hover { background: rgba(255, 255, 255, .12); }
.menu-card .credits { margin-top: 14px; padding-top: 10px; border-top: 2px dashed rgba(255, 255, 255, .25); align-items: flex-start; color: rgba(255, 255, 255, .8); text-shadow: 2px 2px 0 var(--edge); }
.menu-card .credits b { color: #fff3c4; }
.menu-card .socials { justify-content: flex-start; }
.menu-card .socials a { color: #fff; }
.menu-card .socials a:hover { color: #ffd84a; }
@media (max-width: 600px) { .menu-card { margin: 0 auto 14px; } .menu-card .logo { font-size: 2.6rem; } }

/* ---------- lobby & sala ---------- */
#scr-lobby, #scr-room { flex-direction: column; padding: 18px; gap: 16px; overflow-y: auto; }
.topbar { display: flex; align-items: center; gap: 14px; max-width: 1280px; width: 100%; margin: 0 auto; }
.topbar h2 { margin: 0; flex: 1; font-weight: 700; font-size: 2rem; color: #fff; text-shadow: 3px 0 0 var(--edge), -3px 0 0 var(--edge), 0 3px 0 var(--edge), 0 -3px 0 var(--edge), 0 6px 0 var(--pink-2); }
.topbar .btn.ghost { background: var(--cream); }
.panel { background: var(--cream); padding: 16px; min-width: 0; margin: 3px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 1.2rem; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.lobby-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; max-width: 1280px; width: 100%; margin: 0 auto; flex: 1; min-height: 0; }
.room-list { display: flex; flex-direction: column; gap: 10px; }
.room-item { display: flex; align-items: center; gap: 12px; background: #fff; padding: 10px 12px; box-shadow: 0 0 0 2px var(--cream-2); }
.room-item .ri-main { flex: 1; min-width: 0; }
.room-item .ri-name { font-size: 1.1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-item .ri-meta { font-size: .82rem; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

.room-grid { display: grid; grid-template-columns: 1.1fr 1.2fr 0.9fr; gap: 16px; max-width: 1280px; width: 100%; margin: 0 auto; flex: 1; min-height: 0; }
.player-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.player { display: flex; align-items: center; gap: 8px; background: #fff; padding: 7px 8px; border-left: 6px solid var(--c); }
.player .swatch { width: 24px; height: 24px; background: var(--c); cursor: pointer; flex: none; box-shadow: 0 -2px 0 0 var(--edge), 0 2px 0 0 var(--edge), -2px 0 0 0 var(--edge), 2px 0 0 0 var(--edge); margin: 2px; }
.player .swatch.locked { cursor: default; }
.player.spec { opacity: .6; }
.player .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.player .pname small { display: block; color: var(--muted); font-size: .75rem; font-weight: 500; }
.player select { padding: 3px 5px; font-size: .82rem; }
.tag { font-size: .75rem; padding: 3px 7px; background: var(--cream-2); white-space: nowrap; }
.tag.ok { background: var(--mint); }
.tag.wait { background: var(--yellow); }
.add-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.add-row select { flex: 1; min-width: 110px; }

/* ---------- la sala: los equipos de pie, cada uno en su pedestal de pixel art, sobre el fondo del juego; a la
   izquierda, el resumen de la partida (el mapa, el jefe, el líquido y los peligros, en iconos). Igual en el ordenador
   y en el móvil (mobile.css sólo lo achica). Los personajes van al tresbolillo, una fila delante y otra detrás, así
   caben los 8 sin cortarse ---------- */
.room-grid > .panel:first-child { background: transparent; background-image: none; box-shadow: none; padding: 6px 0 0; }
.room-grid > .panel:first-child .panel-head h3, .room-grid > .panel:first-child .panel-head .muted { color: var(--well); text-shadow: 2px 2px 0 var(--edge); }
.stage { flex: 1; min-height: 0; display: flex; gap: 16px; align-items: stretch; }
.room-info { flex: none; width: 300px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overflow-x: hidden; padding: 3px; scrollbar-width: none; }
.room-info::-webkit-scrollbar { display: none; }
#ri-map { width: 100%; height: auto; aspect-ratio: 360 / 165; image-rendering: pixelated; background: var(--cream-2); box-shadow: 0 0 0 3px var(--edge); }
.ri-title { color: var(--well); font-weight: 700; font-size: .95rem; text-shadow: 2px 0 0 var(--edge), -2px 0 0 var(--edge), 0 2px 0 var(--edge), 0 -2px 0 var(--edge); }
.ri-icons { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.ri-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 40px; min-width: 40px; padding: 0 6px; box-sizing: border-box;
  background: var(--tile); color: var(--edge); font-size: .78rem; font-weight: 700; white-space: nowrap; cursor: help;
  box-shadow: 0 -2px 0 0 var(--edge), 0 2px 0 0 var(--edge), -2px 0 0 0 var(--edge), 2px 0 0 0 var(--edge); margin: 2px;
}
.ri-chip.boss { height: auto; padding: 4px 6px; }
.ri-chip.boss img { height: 64px; width: auto; image-rendering: pixelated; }
/* (la percha: el botón de vestirse, con su forma, sin caja; junto al título de los equipos) */
.room-grid > .panel:first-child .panel-head { align-items: center; gap: 10px; justify-content: flex-start; }
.room-grid > .panel:first-child .panel-head .muted { margin-left: auto; }
.dress-btn { border: 0; padding: 2px; background: none; cursor: pointer; line-height: 0; filter: drop-shadow(2px 2px 0 var(--edge)); }
.dress-btn:hover { transform: translateY(-2px) rotate(-6deg); }
.dress-btn:active { transform: translateY(1px); }
.room-grid .player-list { flex: 1; flex-direction: row; align-items: flex-end; justify-content: flex-start; gap: 0; overflow-x: auto; overflow-y: hidden; margin: 0; padding: 0 6px 8px 44px; min-height: 0; }
.room-grid .player-list::before, .room-grid .player-list::after { content: ''; margin: auto; } /* (centrados si caben; si no, se desliza desde el primero) */
.room-grid .player { flex: 0 0 150px; width: 150px; margin-left: -56px; min-width: 0; flex-direction: column; align-items: center; gap: 2px; background: transparent; border-left: 0; padding: 0; position: relative; z-index: 2; }
/* (los pares, en la fila de atrás: más arriba y por detrás) */
.room-grid .player:nth-child(even) { margin-bottom: 110px; z-index: 1; }
.room-grid .player .charbtn { order: 1; background: transparent; box-shadow: none; padding: 0; margin: 0; }
.room-grid .player .charbtn:hover { background: transparent; transform: translateY(-2px); }
/* (el dibujo sólo recibe el clic en el centro, donde está el cuerpo: lo transparente de alrededor tapaba el botón de color
   de los de la fila de atrás y los pedestales) */
.room-grid .player, .room-grid .player .charbtn { pointer-events: none; }
.room-grid .player > :not(.charbtn) { pointer-events: auto; }
.room-grid .player .charbtn { position: relative; }
.room-grid .player .charbtn img { pointer-events: none; }
.room-grid .player .charbtn::after { content: ''; position: absolute; inset: 35% 28% 18%; z-index: 2; pointer-events: auto; cursor: pointer; }
.room-grid .player .charbtn.locked::after { cursor: default; }
.room-grid .player .charbtn img { height: min(24vh, 200px); width: auto; image-rendering: pixelated; position: relative; z-index: 1; }
/* (el pedestal, del color del equipo; tocarlo cambia el color) */
.room-grid .player .swatch { order: 2; width: 117px; height: 27px; margin: -22px 0 0; background: var(--ped) center / 100% 100% no-repeat; image-rendering: pixelated; box-shadow: none; }
.room-grid .player .pname { order: 0; flex: none; width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--well); font-size: .85rem; text-shadow: 2px 0 0 var(--edge), -2px 0 0 var(--edge), 0 2px 0 var(--edge), 0 -2px 0 var(--edge); }
.room-grid .player:nth-child(even) .pname { margin-bottom: -34px; position: relative; z-index: 2; } /* (encima de la cabeza: el dibujo deja hueco arriba para los gorros) */
.room-grid .player:nth-child(odd) .pname { order: 5; } /* (los de delante, con el nombre debajo: arriba van los pies de los de atrás) */
.room-grid .player .pname small { display: inline; color: var(--yellow); font-size: .7rem; }
.room-grid .player .tag { order: 3; font-size: .62rem; padding: 1px 5px; margin-top: 3px; display: inline-flex; align-items: center; gap: 3px; }
.room-grid .player .tag .pxi { height: 10px; width: auto; }
.room-grid .player .tag.cycle { cursor: pointer; background: var(--tile); color: var(--edge); }
.room-grid .player .tag.cycle:hover { filter: brightness(1.1); }
.room-grid .player select { order: 4; min-height: 22px; font-size: .65rem; padding: 0 2px; max-width: 64px; }
/* (quitar y «sólo mirar»: botoncitos en las esquinas de arriba del personaje) */
.room-grid .player .btn.pkick, .room-grid .player .btn.pspec, .room-grid .player .btn.pcolor { position: absolute; top: 40px; z-index: 3; min-height: 0; width: 18px; height: 18px; padding: 0; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--edge); }
.room-grid .player:nth-child(odd) :is(.pkick, .pspec, .pcolor) { top: 12px; }
.room-grid .player .pkick { right: 18px; } .room-grid .player :is(.pspec, .pcolor) { left: 18px; }
.room-grid .player:has(.pspec) .btn.pcolor { translate: 0 24px; } /* (debajo del de sólo mirar) */
.room-grid .player .pcolor i { width: 10px; height: 10px; background: var(--c); box-shadow: 0 0 0 1px var(--edge); }
.room-grid .player .pkick .pxi, .room-grid .player .pspec .pxi { height: 10px; width: auto; }

.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.settings .check { margin-bottom: 8px; }
.settings.locked select, .settings.locked input { pointer-events: none; opacity: .7; }
.mode-desc { color: var(--muted); font-size: .9rem; min-height: 1.2em; }
.start-row { display: flex; gap: 10px; }
.start-row .btn { flex: 1; }

.chat-panel { display: flex; flex-direction: column; min-height: 260px; }
.chat-log { flex: 1; overflow-y: auto; font-size: .95rem; display: flex; flex-direction: column; gap: 4px; min-height: 120px; max-height: 50vh; padding: 6px; background: #fff; }
.chat-log .sys { color: var(--muted); }
.chat-log b { font-weight: 700; text-shadow: 1px 1px 0 var(--edge); }
.chat-form { display: flex; gap: 6px; margin-top: 10px; }
.chat-form input { flex: 1; min-width: 0; }

@media (max-width: 1000px) {
  .lobby-grid, .room-grid { grid-template-columns: 1fr; }
  .settings { grid-template-columns: 1fr; }
}

/* ---------- juego ---------- */
#scr-game { background: #000; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; image-rendering: pixelated; }
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { position: absolute; }

#hud-turn {
  top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  background: var(--cream); padding: 6px 8px 6px 16px; border-bottom: 6px solid var(--tc, #fff);
}
.turn-info { text-align: right; }
#turn-team { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
#turn-worm { font-size: 1.35rem; font-weight: 700; }
#turn-timer {
  width: 50px; height: 50px; display: grid; place-items: center; font-size: 1.7rem; font-weight: 700;
  background: var(--tc, #fff); color: #fff; text-shadow: 2px 2px 0 var(--edge);
  box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge);
}
#turn-timer.urgent { animation: pulse .5s steps(2) infinite alternate; background: #ff5e7a; }
#turn-timer.retreat { background: var(--lav); }
@keyframes pulse { to { transform: scale(1.12); } }
#hud-round { top: 140px; left: 50%; transform: translateX(-50%); font-size: .85rem; color: #fff; text-shadow: 2px 0 0 var(--edge), -2px 0 0 var(--edge), 0 2px 0 var(--edge), 0 -2px 0 var(--edge); white-space: nowrap; }
/* lo que está pasando en el mapa: el jefe y el evento del ambiente (ver gameclient.js) */
#hud-status { position: absolute; top: 196px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; pointer-events: none; white-space: nowrap; }
.st-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 5px; font-size: .78rem; color: #fff; background: color-mix(in srgb, var(--edge) 78%, transparent); border: 2px solid var(--edge); border-radius: 4px; animation: st-pop .35s steps(4) both; }
.st-boss { border-color: color-mix(in srgb, var(--heading) 80%, var(--edge)); }
.st-event { border-color: color-mix(in srgb, var(--pink) 70%, var(--edge)); }
@keyframes st-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#hud-buttons { top: 14px; left: 14px; display: flex; gap: 10px; pointer-events: auto; }
.hbtn { width: 42px; height: 42px; border: 0; background: var(--cream); font-size: 1.2rem; cursor: pointer; }
.hbtn:hover, .hbtn.vhover { background: #fff; transform: translateY(-1px); }

/* segunda cámara: lo que pasa de fondo (ver Renderer.drawPip) */
/* marco de "en directo": borde rojo que late, esquinas de visor, LIVE con su punto que parpadea, líneas de pantalla y
   una franja de barrido que baja */
#pip-box { top: 116px; left: 14px; width: 320px; height: 180px; background: var(--edge); pointer-events: auto; cursor: pointer; animation: pipin .18s steps(3), pipglow 1.6s steps(4) infinite; }
#pip { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#pip-box::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 3px #ff3b5c, inset 0 0 0 5px rgba(7, 19, 12, .55); animation: pipborder 1.6s steps(4) infinite; }
#pip-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .09) 0 1px, transparent 1px 3px); }
#pip-fx::after { content: ''; position: absolute; left: 0; right: 0; height: 18%; top: -20%;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .09), transparent); animation: pipscan 3.2s linear infinite; }
#pip-corners { position: absolute; inset: 9px; pointer-events: none; --c: rgba(255, 255, 255, .85);
  background:
    linear-gradient(var(--c), var(--c)) top left / 12px 2px no-repeat, linear-gradient(var(--c), var(--c)) top left / 2px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 12px 2px no-repeat, linear-gradient(var(--c), var(--c)) top right / 2px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 12px 2px no-repeat, linear-gradient(var(--c), var(--c)) bottom left / 2px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 12px 2px no-repeat, linear-gradient(var(--c), var(--c)) bottom right / 2px 12px no-repeat;
  animation: pipcorners 1.6s steps(2) infinite; }
#pip-live { position: absolute; top: 8px; right: 8px; display: flex; align-items: center; gap: 5px; padding: 2px 7px 2px 6px; font-size: .72rem; font-weight: 800; letter-spacing: .12em; color: #fff; background: #ff3b5c; box-shadow: 0 0 0 2px var(--edge); }
#pip-live i { width: 6px; height: 6px; background: #fff; box-shadow: 0 0 0 1px #b8173a; animation: piprec 1s steps(1) infinite; }
@keyframes pipglow { 50% { filter: drop-shadow(0 0 4px rgba(255, 59, 92, .55)); } }
@keyframes pipborder { 50% { box-shadow: inset 0 0 0 3px #ff7a92, inset 0 0 0 5px rgba(7, 19, 12, .55); } }
@keyframes pipscan { to { top: 105%; } }
@keyframes pipcorners { 50% { inset: 7px; } }
@keyframes piprec { 50% { opacity: 0; } }
body.mobile #pip-live { font-size: .6rem; top: 5px; right: 5px; padding: 1px 4px; }
body.mobile #pip-corners { display: none; }
#pip-label { position: absolute; left: 6px; bottom: 5px; max-width: calc(100% - 12px); padding: 2px 7px; font-size: .78rem; font-weight: 700; color: #fff; background: rgba(7, 19, 12, .78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes pipin { from { transform: scale(.85); opacity: 0; } }
body.mobile #pip-box { width: 168px; height: 96px; top: auto; left: auto; bottom: 8px; right: 8px; }
body.replay #pip-box { display: none; }
#minimap { top: 14px; right: 14px; width: 240px; height: 110px; background: var(--cream); pointer-events: auto; cursor: pointer; image-rendering: pixelated; }

#hud-teams { bottom: 16px; left: 16px; display: flex; flex-direction: column; gap: 5px; width: 250px; background: var(--cream); padding: 8px 10px; }
.tbar { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.tbar .tname { width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbar .track { flex: 1; height: 12px; background: #fff; box-shadow: 0 0 0 2px var(--edge); }
.tbar .fill { height: 100%; background: var(--c); transition: width .6s steps(12); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.tbar .num { width: 34px; text-align: right; }
.tbar .num.rt { width: auto; min-width: 34px; white-space: nowrap; } /* (batalla campal: bajas/muertes) */
.tbar.active .tname { font-weight: 700; }
.tbar.active .tname::before { content: ''; display: inline-block; width: 6px; height: 8px; margin-right: 5px; background: var(--c); clip-path: polygon(0 0, 34% 0, 34% 13%, 67% 13%, 67% 38%, 100% 38%, 100% 62%, 67% 62%, 67% 87%, 34% 87%, 34% 100%, 0 100%); }
.tbar.dead { opacity: .4; }

#hud-weapon { bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: var(--cream); padding: 6px 16px 6px 8px; pointer-events: auto; cursor: pointer; }
.wicon { font-size: 1.7rem; width: 56px; height: 56px; display: grid; place-items: center; background: #fff; }
#hw-name { font-size: 1.05rem; font-weight: 700; }
#hw-info { font-size: .8rem; color: var(--muted); }

/* mecha de las granadas (PC): encima del arma */
#hud-fuse { bottom: 120px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; background: var(--cream); padding: 6px 10px 5px; pointer-events: auto; }
#hud-fuse.hidden { display: none; }
.fz-row { display: flex; align-items: center; gap: 10px; }
#hud-fuse .hbtn { width: 30px; height: 30px; font-size: 1.3rem; font-weight: 700; line-height: 1; box-shadow: 0 0 0 2px var(--edge); color: var(--ink); }
#hud-fuse .hbtn:disabled { opacity: .35; cursor: default; transform: none; }
#fz-val { min-width: 54px; text-align: center; font-size: 1.05rem; }
#fz-num { font-size: 1.4rem; }
.fz-help { font-size: .7rem; color: var(--muted); }
body.replay #hud-fuse { display: none; }

#hud-wind { bottom: 16px; right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .75rem; color: var(--muted); letter-spacing: .1em; background: var(--cream); padding: 6px 10px; }
.wind-bar { width: 190px; height: 12px; background: #fff; position: relative; overflow: hidden; box-shadow: 0 0 0 2px var(--edge); }
.wind-mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--edge); }
#hud-wind.gale { color: #3fa8ff; animation: galeflash .5s steps(2) infinite; }
@keyframes galeflash { 50% { background: #e6f4ff; } }
#wind-fill { position: absolute; top: 0; bottom: 0; transition: all .5s steps(8); }
#wind-fill.l { background: repeating-linear-gradient(90deg, var(--sky) 0 6px, #6fbff0 6px 12px); animation: windl .5s steps(4) infinite; }
#wind-fill.r { background: repeating-linear-gradient(90deg, var(--sky) 0 6px, #6fbff0 6px 12px); animation: windr .5s steps(4) infinite; }
@keyframes windl { from { background-position: 0 0; } to { background-position: -12px 0; } }
@keyframes windr { from { background-position: 0 0; } to { background-position: 12px 0; } }

#center-msg {
  top: 30%; left: 50%; transform: translate(-50%, -50%); text-align: center; font-size: clamp(1.8rem, 4.5vw, 3.2rem); font-weight: 700;
  color: var(--cm, #fff); text-shadow: 4px 0 0 var(--edge), -4px 0 0 var(--edge), 0 4px 0 var(--edge), 0 -4px 0 var(--edge), 0 8px 0 var(--cm2, var(--pink-2));
  opacity: 0; transition: opacity .25s; white-space: nowrap;
}
/* cuenta atrás del jefe (ciempiés gigante) */
#boss-warn { top: 164px; left: 50%; transform: translateX(-50%); text-align: center; font-size: 1rem; font-weight: 700; color: #ffe0f0; white-space: nowrap;
  text-shadow: 2px 0 0 var(--edge), -2px 0 0 var(--edge), 0 2px 0 var(--edge), 0 -2px 0 var(--edge), 0 4px 0 #b0306a; }
#boss-warn.soon { font-size: 1.3rem; animation: bosspulse 1s steps(2) infinite; }
#boss-warn.hidden { display: none; }
#boss-warn b { font-size: 1.6em; color: #ff8fb8; }
@keyframes bosspulse { 50% { transform: translateX(-50%) scale(1.08); } }
body.mobile #boss-warn { top: 64px; font-size: .8rem; }
body.mobile #boss-warn.soon { font-size: .95rem; }
#center-msg.show { opacity: 1; animation: pop .4s steps(5); }
#center-msg small { display: block; font-size: .45em; margin-top: 8px; text-shadow: 2px 0 0 var(--edge), -2px 0 0 var(--edge), 0 2px 0 var(--edge), 0 -2px 0 var(--edge); }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.4); } }

#game-chat { bottom: 170px; left: 16px; width: 380px; display: flex; flex-direction: column; gap: 6px; }
#game-chat-log { display: flex; flex-direction: column; gap: 3px; font-size: .95rem; color: #fff; text-shadow: 2px 0 0 var(--edge), -2px 0 0 var(--edge), 0 2px 0 var(--edge), 0 -2px 0 var(--edge); }
#game-chat-log div { transition: opacity 1s; }
#game-chat-log div.fade { opacity: 0; }
#game-chat-form { pointer-events: auto; margin: 0; }

#key-hint { bottom: 84px; left: 50%; transform: translateX(-50%); font-size: .75rem; color: #fff; white-space: nowrap; text-shadow: 2px 0 0 var(--edge), -2px 0 0 var(--edge), 0 2px 0 var(--edge), 0 -2px 0 var(--edge); opacity: .9; }

#weapon-panel { position: absolute; right: 18px; bottom: 80px; width: min(560px, calc(100vw - 36px)); background: var(--cream); padding: 14px; animation: slideup .2s steps(4); }
@keyframes slideup { from { transform: translateY(20px); opacity: 0; } }
.wp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.wp-head h3 { margin: 0; font-size: 1.5rem; }
#wp-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.wbtn { position: relative; aspect-ratio: 1; border: 0; background: #fff; font-size: 1.7rem; cursor: pointer; display: grid; place-items: center; padding: 0; box-shadow: 0 0 0 2px var(--cream-2); }
.wbtn:hover, .wbtn.vhover { background: #fff3f8; transform: translateY(-2px); box-shadow: 0 0 0 2px var(--pink); }
.wbtn.sel { background: #ffe3ef; box-shadow: 0 0 0 3px var(--pink-2); }
.wbtn.off { opacity: .3; cursor: not-allowed; filter: grayscale(1); transform: none; }
.wbtn .ammo { position: absolute; right: 4px; bottom: 1px; font-size: .78rem; font-weight: 700; color: var(--ink); font-family: var(--font); }
.wbtn.new { box-shadow: 0 0 0 3px var(--yellow); animation: wbnew 0.9s ease-in-out infinite; }
.wbtn.new::after { content: attr(data-badge); position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: var(--yellow); color: var(--ink); font-family: var(--font); font-size: .58rem; font-weight: 700; padding: 0 4px; box-shadow: 0 0 0 2px var(--edge); white-space: nowrap; pointer-events: none; }
.wbtn.new.off { opacity: 1; filter: none; }
.wbtn.new.off .pxi, .wbtn.new.off .ammo, .wbtn.new.off .lock { opacity: .35; filter: grayscale(1); }
@keyframes wbnew { 50% { background: #fff6c8; } }
#hud-weapon.has-new, #mb-weapons.has-new { position: relative; }
#hud-weapon.has-new::after, #mb-weapons.has-new::after { content: ''; position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; background: var(--yellow); box-shadow: 0 0 0 2px var(--edge); animation: wbdot 0.9s ease-in-out infinite; }
@keyframes wbdot { 50% { transform: scale(1.3); } }
.wbtn .lock { position: absolute; left: 4px; top: 1px; font-size: .68rem; color: var(--pink-2); font-family: var(--font); }
/* la ficha del arma, arriba del arsenal (con alto fijo: así la cuadrícula no salta al pasar el ratón) */
#wp-desc { margin-bottom: 10px; font-size: .9rem; color: var(--ink); min-height: 8.6em; background: #fff; padding: 8px 10px; box-shadow: 0 0 0 2px var(--cream-2); }
.wc-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 1rem; }
.wc-cat { font-size: .72rem; color: var(--muted); background: var(--cream-2); padding: 1px 6px; }
.wc-dmg { margin-left: auto; font-weight: 700; background: #ffe0ea; color: #b8325f; padding: 1px 8px; box-shadow: 0 0 0 2px var(--pink); }
.wc-dmg small, .wc-round small { font-weight: 400; color: var(--muted); }
.wc-round { font-size: .78rem; background: #fff3c4; padding: 1px 6px; }
.wc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.wc-tags span { font-size: .72rem; background: var(--mint); color: var(--ink); padding: 1px 6px; }
.wc-desc { color: var(--muted); line-height: 1.35; }
.wcard { background: #fff; padding: 8px 10px; box-shadow: 0 0 0 2px var(--cream-2); }
.wcard .wc-desc { margin-top: 4px; }
#wp-desc b { color: var(--ink); }

#gameover { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(7, 19, 12, .45); }
.go-card { background: var(--cream); padding: 24px 28px; min-width: min(480px, 90vw); text-align: center; animation: pop2 .5s steps(6); }
@keyframes pop2 { from { transform: scale(.5); opacity: 0; } }
.go-card h2 { font-size: 2.8rem; margin: 0 0 14px; color: var(--yellow); text-shadow: 3px 0 0 var(--edge), -3px 0 0 var(--edge), 0 3px 0 var(--edge), 0 -3px 0 var(--edge), 0 6px 0 var(--pink-2); }
.go-row { display: grid; grid-template-columns: 1fr 70px 60px 60px; gap: 8px; padding: 7px 10px; text-align: left; font-size: .95rem; }
.go-row.head { color: var(--muted); font-size: .78rem; text-transform: uppercase; }
.go-row.win { background: #fff3c4; }
.go-row span:first-child { text-shadow: 1px 1px 0 var(--edge); }

/* el marcador (mantener Tab): cada bando con su franja de color y sus personajes debajo */
#scoreboard { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; pointer-events: none; }
.sb-card { background: var(--cream); padding: 16px 20px; min-width: min(560px, 92vw); max-height: 86vh; overflow: hidden; }
.sb-card h3 { margin: 0 0 10px; text-align: center; }
.sb-row { display: grid; grid-template-columns: 1fr 64px 72px 64px 52px; gap: 6px; padding: 4px 10px; text-align: right; font-size: .9rem; }
.sb-row span:first-child { text-align: left; }
.sb-row.head { color: var(--muted); font-size: .74rem; text-transform: uppercase; }
.sb-row.team { margin-top: 6px; background: var(--c); color: #fff; text-shadow: 1px 1px 0 var(--edge); font-size: .95rem; }
.sb-row:not(.head):not(.team) span:first-child { padding-left: 12px; border-left: 4px solid var(--c); }
.sb-row.dead { opacity: .5; }
/* en tiempo real (parkour, carreras, batalla campal): una fila por jugador, con su puesto y medalla los tres primeros */
#scoreboard.rt .sb-card { min-width: min(620px, 94vw); }
#scoreboard.rt .sb-row { grid-template-columns: 34px 1fr 170px 70px 64px; align-items: center; padding: 6px 10px; margin-top: 4px; }
#scoreboard.rt .sb-row.head { margin-top: 0; padding-bottom: 0; }
#scoreboard.rt .sb-row.pl { background: color-mix(in srgb, var(--c) 22%, transparent); box-shadow: inset 4px 0 0 var(--c); }
#scoreboard.rt .sb-row.pl span:first-child { border: 0; padding: 0; }
#scoreboard.rt .sb-row.me { background: color-mix(in srgb, var(--c) 42%, transparent); box-shadow: inset 4px 0 0 var(--c), 0 0 0 2px var(--c); }
#scoreboard.rt .sb-row.dead { opacity: .6; }
.sb-row span:nth-child(2) { text-align: left; display: flex; flex-direction: column; min-width: 0; }
.sb-row em { font-style: normal; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 1px 1px 0 var(--edge); }
.sb-row small { font-size: .7rem; color: var(--muted); }
.sb-row small.sb-me { color: var(--c); font-size: .7rem; margin-left: 4px; }
.sb-pos { display: inline-grid; place-items: center; width: 24px; height: 24px; font-style: normal; font-size: .95rem; background: var(--edge); color: var(--well); }
.sb-row.p1 .sb-pos, .tbar.p1 .tpos { background: var(--yellow); color: var(--edge); }
.sb-row.p2 .sb-pos, .tbar.p2 .tpos { background: color-mix(in srgb, var(--well) 75%, var(--sky)); color: var(--edge); }
.sb-row.p3 .sb-pos, .tbar.p3 .tpos { background: color-mix(in srgb, var(--yellow) 50%, var(--danger)); color: var(--edge); }
.sb-row span:nth-child(3) { display: flex; align-items: center; gap: 8px; }
.sb-bar { flex: 1; height: 10px; background: color-mix(in srgb, var(--well) 15%, transparent); box-shadow: 0 0 0 2px var(--edge); }
.sb-bar i { display: block; height: 100%; background: var(--c); }
.sb-row span:nth-child(3) b { min-width: 40px; font-weight: 400; }
.tbar .tpos { display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; font-style: normal; font-size: .72rem; background: var(--edge); color: var(--well); margin-right: -3px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(7, 19, 12, .45); padding: 16px; }
.modal-card { position: relative; background: var(--cream); padding: 24px 26px; width: min(840px, 100%); max-height: 90vh; overflow-y: auto; }
.modal-card h2 { margin-top: 0; font-size: 2rem; }
.modal-card h4 { margin: 16px 0 8px; color: var(--pink-2); font-size: 1.1rem; }
.modal-card ul { padding-left: 18px; margin: 0; line-height: 1.75; }
.modal-card ul.keys { list-style: none; padding: 0; }
.close { position: absolute; top: 14px; right: 14px; border: 0; background: var(--pink); color: #fff; width: 34px; height: 34px; cursor: pointer; box-shadow: 0 0 0 3px var(--edge); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
kbd { background: #fff; padding: 1px 6px; font-size: .85rem; box-shadow: 0 0 0 2px var(--edge), inset 0 -3px 0 rgba(7, 19, 12, .2); font-family: var(--font); margin: 0 2px; }
.help-weapons { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.help-weapons > div { background: #fff; padding: 8px 10px; font-size: .88rem; color: var(--muted); }
.help-weapons b { color: var(--ink); font-size: .95rem; }
@media (max-width: 700px) { .help-grid { grid-template-columns: 1fr; } #wp-grid { grid-template-columns: repeat(5, 1fr); } }

#toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(120px); z-index: 100; background: var(--cream);
  padding: 12px 18px; transition: transform .3s steps(5); max-width: 90vw;
  box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge), inset 0 -4px 0 0 var(--pink);
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- iconos pixel art ---------- */
.pxi { image-rendering: pixelated; image-rendering: crisp-edges; vertical-align: middle; display: inline-block; }
.btn .pxi, .tag .pxi, .pill .pxi { margin-top: -3px; }
.hbtn { display: grid; place-items: center; position: relative; }
/* atajos: la tecla (o, con el mando, su botón) de cada botón en un cuadradito que sobresale de su esquina (paintHotkeys
   en gameclient.js; va en data-k y lo pinta ::before para que no se borre cuando el botón cambia su contenido) */
[data-k]:not([data-k=""])::before { content: attr(data-k); position: absolute; top: -10px; left: -10px; z-index: 2; min-width: 22px; height: 22px;
  padding: 0 4px; box-sizing: border-box; display: grid; place-items: center; background: var(--well); color: var(--ink); box-shadow: 0 0 0 2px var(--edge);
  font-family: var(--font); font-size: .95rem; font-weight: 700; line-height: 1; white-space: nowrap; pointer-events: none; }
.btn[data-k]:not([data-k=""]) { position: relative; }
body.mobile [data-k]::before { display: none; }
.wbtn .pxi { max-width: 82%; max-height: 82%; }
.wicon .pxi { max-width: 92%; max-height: 92%; }
.close { display: grid; place-items: center; }
kbd .pxi { margin: -2px 0 0; }
.help-weapons .pxi { margin-right: 4px; }
#game-chat-log .pxi { margin-top: -3px; }
.settings .field, .settings .check { min-width: 0; }
.field select, .field input { min-width: 0; }
/* controles: panel a la derecha, debajo del minimapa */
#key-hint { top: 136px; bottom: auto; left: auto; right: 14px; transform: none; max-width: none; white-space: nowrap; text-align: left; line-height: 1; text-shadow: none; opacity: 1;
  background: rgba(10, 30, 19, .62); color: #fff; padding: 8px 10px 9px; display: flex; flex-direction: column; gap: 5px; font-size: .74rem; pointer-events: none; }
#key-hint .kh-title { font-weight: 700; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #ffd6e8; margin-bottom: 2px; }
#key-hint .kh-row { display: flex; align-items: center; gap: 8px; }
#key-hint .kh-k { min-width: 74px; display: flex; align-items: center; justify-content: flex-end; color: #fff; }
#key-hint kbd { font-size: .68rem; padding: 0 5px; line-height: 1.5; color: var(--ink); }
#key-hint .kh-sep { height: 1px; background: rgba(255, 255, 255, .18); margin: 1px 0; }
/* la flechita para ocultarlos (y, ocultos, para volver a abrirlos): sólo ella queda, pegada al borde derecho */
#kh-toggle { position: absolute; left: -22px; top: 0; width: 22px; height: 26px; padding: 0; border: 0; pointer-events: auto; cursor: pointer;
  background: rgba(10, 30, 19, .62); color: #ffd6e8; font: inherit; font-size: 1rem; line-height: 26px; }
#kh-toggle:hover { color: #fff; }
#key-hint.closed { padding: 0; background: none; }
#key-hint.closed > :not(#kh-toggle) { display: none; }
#key-hint.closed #kh-toggle { position: static; }
@media (max-height: 640px) { #key-hint { display: none; } }

/* ---------- sin gestos del navegador ---------- */
html, body { overscroll-behavior: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#scr-game, #scr-game * { touch-action: none; }
img, canvas { -webkit-user-drag: none; user-drag: none; }
#scr-game button:focus { outline: none; }

/* ---------- selector de personaje ---------- */
.charbtn { border: 0; background: #fff3f8; padding: 2px 4px; cursor: pointer; flex: none; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--edge); margin: 2px; }
.charbtn:hover { background: #ffe3ef; transform: translateY(-1px); }
.charbtn.locked { cursor: default; transform: none; }

/* ---------- armario ---------- */
.ward-card { width: min(980px, 100%); }
.ward-body { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 14px; flex-wrap: wrap; }
.ward-side { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: none; width: 200px; margin: 0 auto; }
#ward-preview { width: 144px; height: 192px; image-rendering: pixelated; background: linear-gradient(#cfeaff, #fff3f8); box-shadow: 0 0 0 3px var(--edge); }
.ward-name { text-align: center; font-weight: 600; min-height: 1.3em; font-size: .9rem; }
.ward-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.ward-nudge { display: grid; grid-template-columns: repeat(5, auto); justify-content: center; align-items: center; gap: 4px; margin-top: 6px; }
.ward-nudge .ward-label { grid-column: 1 / -1; text-align: center; }
.ward-nudge.off { opacity: .4; pointer-events: none; }
.ward-names { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
#ward-names { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: 100%; }
#ward-names input { width: 100%; font-size: .85rem; padding: 4px 6px; }
.ward-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ward-main { flex: 1; min-width: min(100%, 300px); display: flex; flex-direction: column; gap: 8px; }
.ward-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ward-tabs .btn.on, .ward-cats .chip.on { background: var(--pink); color: #fff; }
.ward-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ward-cats { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.ward-cats .chip { border: 0; cursor: pointer; padding: 2px 8px; font-size: .8rem; background: var(--cream-2); box-shadow: 0 0 0 2px var(--edge); margin: 2px; }
#ward-search { width: 150px; }
.ward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 6px; max-height: min(52vh, 460px); overflow-y: auto; padding: 4px; background: rgba(7, 19, 12, .05); }
.ward-tile { border: 0; padding: 2px 0 0; background: #fff3f8; box-shadow: 0 0 0 2px rgba(7, 19, 12, .25); cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.ward-tile canvas { width: 48px; height: 64px; image-rendering: pixelated; }
.ward-tile span { font-size: .62rem; line-height: 1.1; padding: 1px 2px 3px; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.ward-tile:hover { background: #ffe3ef; }
.ward-tile.on { background: var(--yellow); box-shadow: 0 0 0 3px var(--edge); }
.ward-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 20px; }

#hb-ai.on { outline: 2px solid #ff4fd8; }

/* ---------- cámara: ver personajes / siguiente turno ---------- */
#turn-next { font-size: .72rem; color: var(--muted); margin-top: 1px; }
#turn-next b { font-weight: 700; }
/* botones de cámara: debajo del panel del turno (donde dice quién sigue); en el móvil, abajo a la derecha */
#camnav { top: 94px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; pointer-events: auto; background: var(--cream); padding: 4px; }
#camnav .hbtn { width: 34px; height: 34px; box-shadow: 0 0 0 2px var(--edge); }
#cam-label { font-size: .78rem; padding: 0 6px 0 2px; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
#cam-label:empty { display: none; }

/* ---------- chat: historial ---------- */
#game-chat:not(.open) #game-chat-log div.old { display: none; }
/* cerrado: sólo los últimos mensajes y nunca más alto que el hueco entre la segunda cámara y los equipos */
#game-chat:not(.open) #game-chat-log { max-height: max(48px, calc(100vh - 500px)); overflow: hidden; justify-content: flex-end; }
#game-chat:not(.open) #game-chat-log div:nth-last-child(n+6) { display: none; }
/* móvil: el chat va en el marco de los controles, una sola línea con el último mensaje; tocándola, el historial */
#game-chat.open { pointer-events: auto; z-index: 5; }
#game-chat.open #game-chat-log {
  max-height: 46vh; overflow-y: auto; background: rgba(10, 30, 19, .82); padding: 8px 10px; pointer-events: auto;
  box-shadow: 0 0 0 3px var(--edge);
}
#game-chat.open #game-chat-log div { opacity: 1 !important; display: block; }
#game-chat.open #game-chat-log::before { content: 'Historial de la partida'; display: block; color: var(--yellow); font-size: .8rem; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- ratón atrapado en partida ---------- */
#vcursor { position: fixed; left: 0; top: 0; width: 22px; height: 30px; background-repeat: no-repeat; pointer-events: none; z-index: 10000; display: none; image-rendering: pixelated; }
body.mlocked #vcursor { display: block; }
#lockhint { position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 6; pointer-events: none; display: none;
  background: rgba(10, 30, 19, .78); color: #fff3c4; font-size: .78rem; padding: 4px 10px; white-space: nowrap; }
#lockhint.show { display: block; }
body.mobile #lockhint { display: none !important; }

/* ---------- repeticiones de las mejores jugadas ---------- */
#replay-bar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 7; pointer-events: auto;
  display: flex; align-items: center; gap: 12px; background: rgba(10, 30, 19, .88); color: #fff3c4; padding: 8px 12px;
  box-shadow: 0 0 0 3px var(--edge); white-space: nowrap; max-width: 94vw; }
#replay-bar.hidden { display: none; }
.rp-rec { color: #ff6b6b; font-weight: 700; font-size: .8rem; letter-spacing: .08em; display: flex; align-items: center; gap: 6px; }
.rp-rec i { width: 10px; height: 10px; background: #ff4d4d; display: inline-block; animation: rpblink 1s steps(2) infinite; }
@keyframes rpblink { 50% { opacity: 0; } }
#replay-title { font-weight: 700; font-size: .95rem; }
#replay-who { font-size: .8rem; color: #e8dcff; overflow: hidden; text-overflow: ellipsis; }
/* franjas de cine y sin HUD de juego mientras se repite */
body.replay #scr-game::before, body.replay #scr-game::after { content: ''; position: absolute; left: 0; right: 0; height: 7vh; background: #0b0710; z-index: 6; pointer-events: none; }
body.replay #scr-game::before { top: 0; }
body.replay #scr-game::after { bottom: 0; }
body.replay #hud-weapon, body.replay #camnav, body.replay #mpad, body.replay #lockhint, body.replay #hud-turn, body.replay #hud-round, body.replay #key-hint { visibility: hidden; }
body.mobile #replay-bar { top: 4px; gap: 8px; padding: 6px 8px; }

/* ---------- botones de zoom (móvil) ---------- */
.mzoom { display: flex; gap: 4px; }
.mzoom .mb { flex: 1; display: grid; place-items: center; }

/* ---------- créditos en el menú ---------- */
.credits { margin-top: 16px; padding-top: 12px; border-top: 2px dashed var(--cream-2); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.credits b { color: var(--ink); }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; }
.socials a { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.socials a:hover { color: var(--pink-2); }

/* ---------- vista previa del mapa (sala) ---------- */
.map-preview { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
#mp-canvas { width: 100%; aspect-ratio: 360 / 165; height: auto; image-rendering: pixelated; background: var(--cream-2); transition: opacity .15s; }
#mp-canvas.loading { opacity: .6; }
.mp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mp-name { flex: 1; font-weight: 700; font-size: .9rem; min-width: 120px; }
.mp-seed { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.mp-seed input { width: 104px; padding: 4px 6px; font: inherit; font-size: .85rem; }
#mp-dice { display: grid; place-items: center; padding: 4px 8px; }

/* ---------- botón de idioma ---------- */
#top-tools { position: fixed; top: 12px; right: 12px; z-index: 20; display: flex; gap: 6px; }
#lang-btn { display: flex; align-items: center; gap: 6px; font-weight: 700; }
#fps-btn { font-weight: 700; }
body.in-game #top-tools { display: none; }

/* ---------- límite de FPS ---------- */
#pause-banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 40; pointer-events: none; background: var(--cream); color: var(--ink); font-size: 2.2rem; font-weight: 700; letter-spacing: .2em; padding: 10px 30px 10px 36px; box-shadow: 0 0 0 4px var(--edge); }
#report-ready { right: 12px; bottom: 12px; max-width: 280px; }
#report-ready .rr-msg { font-size: .75rem; padding: 4px 8px; word-break: break-all; color: var(--muted); }
#report-menu, #report-ready { position: fixed; z-index: 60; background: var(--cream); color: var(--ink); padding: 6px; display: flex; flex-direction: column; min-width: 150px; }
#report-menu .fps-head, #report-ready .fps-head { font-weight: 700; font-size: .8rem; color: var(--muted); padding: 2px 8px 6px; border-bottom: 2px dashed var(--cream-2); margin-bottom: 4px; }
/* versión del juego, abajo a la derecha (en la partida, debajo de la caja del viento) */
#version { position: fixed; right: 6px; bottom: 2px; z-index: 70; font-size: .62rem; color: rgba(255, 255, 255, .75); text-shadow: 1px 1px 0 rgba(10, 30, 19, .8); pointer-events: none; letter-spacing: .04em; }
#fps-menu { position: fixed; z-index: 60; background: var(--cream); color: var(--ink); padding: 6px; display: flex; flex-direction: column; min-width: 128px; overflow-y: auto; }
#fps-menu .fps-head { font-weight: 700; font-size: .8rem; color: var(--muted); padding: 2px 8px 6px; border-bottom: 2px dashed var(--cream-2); margin-bottom: 4px; }
.fps-opt { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: .9rem; text-align: left; padding: 5px 8px; cursor: pointer; }
.fps-opt:hover, .fps-opt.vhover { background: var(--cream-2); }
.fps-opt.on { background: var(--mint); font-weight: 700; }

/* panel de rendimiento (F3, ver perfview.js) */
#perf-panel { position: fixed; top: 70px; left: 12px; z-index: 60; width: 580px; max-height: calc(100vh - 90px); overflow: auto; background: rgba(20, 14, 40, .92); color: #e6e0f5; font: 11px/1.35 ui-monospace, Consolas, monospace; padding: 8px 10px; border: 2px solid #6f5aa8; border-radius: 6px; pointer-events: auto; }
#perf-panel .pf-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
#perf-panel .pf-head b { font-size: 13px; color: #fff; }
#perf-panel .pf-head button, #perf-panel .pf-head a { margin-left: auto; background: #3a2c63; color: #fff; border: 1px solid #6f5aa8; border-radius: 4px; padding: 2px 7px; font: inherit; cursor: pointer; text-decoration: none; }
#perf-panel .pf-head button + button, #perf-panel .pf-head button + a { margin-left: 0; }
#perf-panel .pf-sub { color: #a99bd0; font-weight: normal; }
#perf-panel .pf-graph { width: 560px; height: 90px; display: block; margin-bottom: 6px; image-rendering: pixelated; }
#perf-panel .pf-top { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; }
#perf-panel .pf-top b { color: #ffd166; }
#perf-panel .pf-t { margin: 8px 0 3px; color: #fff; font-weight: bold; }
#perf-panel table { width: 100%; border-collapse: collapse; }
#perf-panel th { text-align: right; color: #a99bd0; font-weight: normal; padding: 0 4px; }
#perf-panel th:first-child, #perf-panel td:first-child { text-align: left; }
#perf-panel td { text-align: right; padding: 0 4px; border-top: 1px solid rgba(255,255,255,.06); }
#perf-panel td i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; vertical-align: -1px; }
#perf-panel .pf-c { margin-top: 3px; color: #cfc5ea; }
#perf-panel .pf-pk { margin-top: 3px; color: #ffb3c6; }
#perf-panel .pf-pk span { display: block; }
#perf-panel .pf-pk i { color: #a99bd0; font-style: normal; }

/* comandos de administración: la lista de /help y las respuestas en el chat */
#cmd-help .modal-card { width: min(760px, 100%); }
#cmd-help .cmd-intro { margin: 0 0 6px; line-height: 1.5; }
#cmd-help code, #game-chat-log .adm-cmd { font-family: var(--font); background: var(--edge); color: var(--yellow); padding: 1px 6px; white-space: nowrap; }
#cmd-list section h3 { margin: 18px 0 6px; color: var(--pink-2); font-size: 1.1rem; }
.cmd-row { display: grid; grid-template-columns: minmax(150px, 38%) 1fr; gap: 12px; align-items: baseline; width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink); font: inherit; padding: 6px 8px; cursor: pointer; }
.cmd-row:nth-child(odd) { background: rgba(7, 19, 12, .05); }
.cmd-row:hover, .cmd-row.vhover { background: rgba(255, 111, 163, .18); }
.cmd-row code { justify-self: start; white-space: normal; }
@media (max-width: 600px) { .cmd-row { grid-template-columns: 1fr; gap: 4px; } }
#game-chat-log .adm { text-shadow: none; background: rgba(20, 14, 32, .88); box-shadow: 0 0 0 2px rgba(42, 212, 255, .55); padding: 4px 8px; margin: 2px; font-size: .85rem; line-height: 1.45; }
#game-chat-log .adm.err { box-shadow: 0 0 0 2px rgba(255, 90, 122, .7); }
#game-chat-log .adm.note { color: #bfefff; box-shadow: 0 0 0 2px rgba(255, 217, 107, .55); }
#game-chat-log .adm-cmd { display: inline-block; margin-bottom: 2px; font-size: .8rem; }
#game-chat-log .adm-out { display: block; white-space: pre-line; color: #e8fbff; }
#game-chat-log .adm.err .adm-out { color: #ffc4d0; }

/* huecos de armas (PC): abajo en el centro, el arma elegida encima y la mecha más arriba */
#hud-slots { bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; background: var(--cream); padding: 6px 6px 6px 10px; pointer-events: auto; }
#hud-slots .slot:nth-child(7) { margin-left: 10px; } /* (entre el 6 y la Q, un hueco más ancho) */
body:not(.no-slots):not(.mobile) #hud-weapon { bottom: 100px; }
body:not(.no-slots):not(.mobile) #lockhint { bottom: 150px; }
body:not(.no-slots):not(.mobile) #hud-fuse { bottom: 196px; }
body.no-slots #hud-slots, body.mobile #hud-slots, body.replay #hud-slots { display: none; }
.slot { position: relative; width: 52px; height: 52px; border: 0; background: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; box-shadow: 0 0 0 2px var(--cream-2); font-family: var(--font); }
.slot:hover, .slot.vhover { box-shadow: 0 0 0 2px var(--pink); }
.slot.sel { background: #ffe3ef; box-shadow: 0 0 0 3px var(--pink-2); }
.slot.off .pxi, .slot.off .ammo { opacity: .3; filter: grayscale(1); }
.slot.empty { background: var(--cream-2); }
.slot .ammo { position: absolute; right: 3px; bottom: 0; font-size: .7rem; font-weight: 700; color: var(--ink); }
body.wdrag .slot { box-shadow: 0 0 0 2px var(--yellow); }
body.wdrag .slot.vhover, body.wdrag .slot:hover { box-shadow: 0 0 0 3px var(--pink-2); background: #fff3f8; }
.wp-tip { font-size: .72rem; margin-top: 6px; }
body.mobile .wp-tip { display: none; }
body.no-minimap #minimap { display: none; }

/* ventana de opciones */
#options { z-index: 70; }
#options .modal-card { width: min(620px, 100%); }
.op-seed { display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; }
.op-seed b { font-variant-numeric: tabular-nums; user-select: all; }
.op-seed.hidden { display: none; }
.op-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.op-tabs button, .op-choice button { border: 0; background: var(--cream-2); color: var(--ink); font: inherit; padding: 6px 12px; cursor: pointer; }
.op-tabs button:hover, .op-tabs button.vhover, .op-choice button:hover, .op-choice button.vhover { background: #ffe3ef; }
.op-tabs button.on { background: var(--pink); color: #fff; box-shadow: 0 0 0 2px var(--edge); }
.op-choice { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.op-choice button.on { background: var(--mint); font-weight: 700; box-shadow: 0 0 0 2px var(--edge); }
.op-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 2px dashed var(--cream-2); }
.op-lab { display: flex; flex-direction: column; flex-shrink: 0; }
.op-lab small { color: var(--muted); font-size: .75rem; }
.op-tog, .op-key { min-width: 64px; border: 0; background: var(--cream-2); color: var(--ink); font: inherit; font-weight: 700; padding: 6px 12px; cursor: pointer; box-shadow: 0 0 0 2px var(--edge); }
.op-tog.on { background: var(--mint); }
.op-key { min-width: 110px; background: #fff; }
.op-note { font-size: .8rem; color: var(--muted); margin: 6px 0; }
.op-body > .btn { margin-top: 12px; }
.op-x { font-size: 1.4rem; line-height: 1; }
#options input[type=range] { width: 200px; accent-color: var(--pink-2); }
/* (en el móvil, el zoom ya está en los controles de abajo) */
body.mobile #cam-zin, body.mobile #cam-zout { display: none; }
/* PC: la ficha del arma a la izquierda de la cuadrícula (siempre a la vista, sin hacer el panel más alto) */
body:not(.mobile) #weapon-panel { width: min(860px, calc(100vw - 36px)); max-height: calc(100vh - 100px); overflow-y: auto;
  display: grid; grid-template-columns: 260px 1fr; grid-template-rows: auto 1fr auto; column-gap: 12px; }
body:not(.mobile) #weapon-panel .wp-head { grid-column: 1 / -1; }
body:not(.mobile) #wp-desc { grid-column: 1; grid-row: 2 / 4; align-self: start; position: sticky; top: 0; margin: 0; min-height: 0; }
body:not(.mobile) #wp-grid { grid-column: 2; grid-row: 2; }
body:not(.mobile) .wp-tip { grid-column: 2; grid-row: 3; }
body:not(.mobile) #weapon-panel { overflow-x: hidden; }
body:not(.mobile) #wp-grid { grid-template-columns: repeat(10, 1fr); gap: 5px; align-self: start; }
/* vista previa animada del arma (en su ficha) */
.wprev { display: block; width: 224px; max-width: 100%; image-rendering: pixelated; margin: 6px 0 2px; box-shadow: 0 0 0 2px var(--cream-2); }
/* títulos de categoría en el arsenal y en la ayuda (ocupan toda la fila) */
.wp-cat { grid-column: 1 / -1; margin: 6px 0 -2px; font-size: .78rem; font-weight: 700; color: var(--pink-2); letter-spacing: .04em; border-bottom: 2px dashed var(--cream-2); }
.wp-cat:first-child { margin-top: 0; }
.help-weapons > h4.wp-cat { margin: 10px 0 0; font-size: 1rem; }
/* el arma que se arrastra hacia un hueco, siguiendo al ratón (por encima de todo y sin tapar lo que hay debajo) */
#drag-ghost { position: fixed; left: 0; top: 0; z-index: 80; width: 40px; height: 40px; display: grid; place-items: center; background: #fff; box-shadow: 0 0 0 2px var(--pink-2); opacity: .9; pointer-events: none; }
#drag-ghost.hidden { display: none; }

/* intro (client/intro.js): por encima de todo, pixel art escalado; al acabar se funde y deja ver el menú */
#intro { position: fixed; left: 0; top: 0; z-index: 200; image-rendering: pixelated; background: #07040d; box-shadow: 0 0 0 100vmax #07040d; transition: opacity .5s ease; cursor: pointer; }
#intro.out { opacity: 0; pointer-events: none; }

/* ======================================================================================================================
   Tema verde (pixel art con tramado, como el logo de la intro). Va al final: retoca lo de arriba que tenía colores del
   tema claro escritos a mano. Casillas con iconos: claras (los iconos de pixel art llevan contorno oscuro); campos,
   listas y chat: pozos oscuros; paneles: verde muy oscuro con tramado.
   ==================================================================================================================== */
body { background: var(--page) var(--dither) 0 0 / var(--dither-size) var(--dither-size); font-size: var(--base-size); }
::selection { background: var(--mint); color: var(--edge); }
* { scrollbar-color: color-mix(in srgb, var(--btn) 55%, var(--muted)) var(--well); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--well); }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--btn) 55%, var(--muted)); box-shadow: inset 0 0 0 2px var(--well); }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
input { caret-color: var(--mint); }

/* paneles con tramado (el color de cada uno, y encima la trama) */
.pix, .panel, .modal-card, .pill { background-image: var(--dither); background-size: var(--dither-size) var(--dither-size); image-rendering: pixelated; }
.modal { background: color-mix(in srgb, var(--page) 62%, transparent); }

/* menú, sala y lobby: el juego de fondo con un velo verde y tramado (más denso a la izquierda, donde va el menú) */
#scr-menu::before, #scr-lobby::before, #scr-room::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background: var(--dither-dark) 0 0 / var(--dither-size) var(--dither-size),
    linear-gradient(90deg, color-mix(in srgb, var(--veil) calc(78% * var(--veil-k)), transparent) 0%, color-mix(in srgb, var(--veil) calc(45% * var(--veil-k)), transparent) 32%, color-mix(in srgb, var(--veil) calc(18% * var(--veil-k)), transparent) 58%, color-mix(in srgb, var(--veil) calc(8% * var(--veil-k)), transparent) 100%),
    linear-gradient(0deg, color-mix(in srgb, var(--veil) calc(55% * var(--veil-k)), transparent) 0%, transparent 38%);
  image-rendering: pixelated;
}
#scr-lobby, #scr-room { isolation: isolate; }
#scr-lobby::before, #scr-room::before { position: fixed; background: var(--dither-dark) 0 0 / var(--dither-size) var(--dither-size), color-mix(in srgb, var(--veil) calc(72% * var(--veil-k)), transparent); }
#menu-bg { filter: brightness(.86) saturate(.9) hue-rotate(-8deg); }

/* el logo del menú: crema y lima, con la sombra verde del logo de la intro */
.logo { color: #fff7ef; text-shadow: 4px 0 0 var(--edge), -4px 0 0 var(--edge), 0 4px 0 var(--edge), 0 -4px 0 var(--edge), 4px 4px 0 var(--edge), -4px 4px 0 var(--edge), 4px -4px 0 var(--edge), -4px -4px 0 var(--edge), 0 9px 0 var(--leaf); }
.logo span { color: var(--mint); }
.topbar h2 { text-shadow: 3px 0 0 var(--edge), -3px 0 0 var(--edge), 0 3px 0 var(--edge), 0 -3px 0 var(--edge), 0 6px 0 var(--leaf); }
.menu-card .tagline { color: var(--mint); }
.menu-card .credits b { color: var(--mint); }
.menu-card .socials a:hover { color: var(--yellow); }

/* botones: verde algo más claro que el panel; el principal, rosa (acento); los encendidos, lima con texto oscuro */
.btn { background-color: var(--btn); }
.btn:hover, .btn.vhover { filter: brightness(1.12); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: color-mix(in srgb, var(--mint) 10%, transparent); }
.btn.on, .tag.ok, .tag.wait, .op-tog.on, .op-choice button.on { color: var(--edge); }
.btn.danger { background: #5b1f2e; color: #ffd0dc; }
.menu-card .btn.big:not(.primary) { background: color-mix(in srgb, var(--cream) 94%, transparent) var(--dither) 0 0 / var(--dither-size) var(--dither-size); }
.menu-card input, .menu-card input:focus { background: color-mix(in srgb, var(--edge) 82%, transparent); } /* (oscuro siempre: el texto del menú es blanco) */
.topbar .btn.ghost { background: var(--btn); }

/* campos, listas y chat: pozos oscuros */
input, select { background: var(--well); color: var(--ink); }
input:focus, select:focus { background: color-mix(in srgb, var(--well) 75%, var(--btn)); }
input::placeholder { color: color-mix(in srgb, var(--muted) 70%, var(--well)); }
select option { background: var(--well); color: var(--ink); }
.room-item, .player, .chat-log, #wp-desc, .wcard, .help-weapons > div, .op-key, .op-tabs button, .op-choice button, .op-tog { background: var(--well); color: var(--ink); }
.room-item, #wp-desc, .wcard { box-shadow: 0 0 0 2px var(--cream-2); }
.tag { background: var(--cream-2); }
.op-tabs button:hover, .op-tabs button.vhover, .op-choice button:hover, .op-choice button.vhover { background: var(--cream-2); }
.op-tabs button.on { background: var(--pink); color: var(--edge); box-shadow: 0 0 0 2px var(--edge); }
.op-tog.on { background: var(--mint); }
.op-row { border-bottom-color: var(--cream-2); }
kbd { background: var(--tile); color: var(--edge); }
.wc-dmg { background: color-mix(in srgb, var(--pink) 16%, transparent); color: var(--pink); }
.wc-round { background: rgba(255, 217, 107, .16); color: var(--yellow); }
.wc-cat { background: transparent; color: var(--heading); box-shadow: inset 0 0 0 1px var(--heading); } /* (sólo depende de "Títulos de sección": se lee igual que esos títulos) */
.wc-tags span { color: var(--edge); }
.go-row.win { background: color-mix(in srgb, var(--mint) 14%, transparent); }
.tbar .track, .wind-bar { background: var(--well); }
.chat-log b { text-shadow: none; }
.cmd-row:hover, .cmd-row.vhover { background: color-mix(in srgb, var(--mint) 10%, transparent); }

/* casillas con iconos de pixel art: claras, con el texto oscuro; elegida, con el contorno rosa */
.wicon, .wbtn, .slot, #drag-ghost, .charbtn, .ward-tile, .mb, .hbtn:hover, .hbtn.vhover { background-color: var(--tile); color: var(--edge); }
.wbtn .ammo, .slot .ammo { color: var(--edge); }
.wbtn:hover, .wbtn.vhover, body.wdrag .slot.vhover, body.wdrag .slot:hover, .charbtn:hover, .ward-tile:hover { background-color: color-mix(in srgb, var(--tile) 55%, #fff); }
.wbtn.sel, .slot.sel { background-color: var(--tile-2); }
.wbtn.off { background-color: color-mix(in srgb, var(--tile) 55%, var(--btn)); }
.slot.empty { background-color: var(--cream-2); }
.wp-cat { color: var(--heading); border-bottom-color: var(--cream-2); }
.mb.on, .mb:active { background: var(--yellow); }
.hbtn { color: var(--ink); }

/* la ventanita de la segunda cámara y su rótulo */
#pip-label { background: color-mix(in srgb, var(--edge) 82%, transparent); }
#key-hint kbd { color: var(--edge); }
/* botones de icono (barra de arriba, cámara): claros, como las casillas, para que se lean los iconos de pixel art */
.hbtn { background-color: var(--tile); color: var(--edge); }
.hbtn:hover, .hbtn.vhover { background-color: color-mix(in srgb, var(--tile) 55%, #fff); }
#camnav { background-color: var(--cream); }
.btn.danger { background: var(--danger); color: var(--danger-ink); }
/* (sala y lobby: hueco a la derecha para los botones de FPS e idioma, que van fijos arriba) */
@media (min-width: 700px) { #scr-lobby .topbar, #scr-room .topbar { padding-right: 190px; } }

/* ---------- curvatura de pantalla (Opciones → Interfaz; sólo la interfaz: el mapa de la partida no) ---------- */
/* curvatura (simulada: sin deformar nada, así los clics caen donde se ve): encima de los menús y las ventanas, un
   sombreado que oscurece en curva hacia los bordes (más en las esquinas, como el cristal abombado de un tubo), un
   reflejo de cristal arriba a la izquierda y una franja de brillo muy tenue. En la partida no (sólo la interfaz) */
#tube { position: fixed; inset: 0; pointer-events: none; z-index: 95; display: none;
  background:
    radial-gradient(ellipse 62% 46% at 30% 22%, rgba(255, 255, 255, .075), rgba(255, 255, 255, 0) 70%),
    linear-gradient(176deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .03) 34%, rgba(255, 255, 255, 0) 40%),
    radial-gradient(ellipse 72% 78% at 50% 50%, rgba(0, 0, 0, 0) 64%, rgba(0, 0, 0, .22) 86%, rgba(0, 0, 0, .45) 100%),
    radial-gradient(ellipse 120% 60% at 50% 50%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, .25) 100%),
    radial-gradient(ellipse 60% 120% at 50% 50%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, .25) 100%); }
body.crt-bend:not(.in-game) #tube { display: block; }

/* ---------- sin desplazar la página ----------
   En el ordenador, el lobby y la sala caben siempre en la pantalla: cada panel ocupa su alto y lo largo se desplaza
   dentro de él (la lista de salas o de equipos, los ajustes de la partida, el chat); los botones de empezar quedan
   siempre a la vista. Sólo si no hay más remedio (pantallas estrechas, donde los paneles van uno debajo de otro, o un
   menú en una pantalla muy baja) se desplaza la pantalla; entonces el velo y la curvatura van fijos y no se cortan */
#scr-menu { overflow-y: auto; }
#scr-menu::before { position: fixed; }
@media (min-width: 701px) {
  #scr-lobby, #scr-room { overflow: hidden; }
  .lobby-grid > *, .room-grid > *, .lobby-grid .col > * { min-height: 0; }
  .lobby-grid .panel, .room-grid > .panel { display: flex; flex-direction: column; overflow: hidden; }
  .lobby-grid .col > .panel:first-child { flex: none; }
  .lobby-grid .col > .chat-panel { flex: 1; }
  #room-list, #settings { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; align-content: start; }
  #settings { padding-right: 6px; }
  .chat-log { max-height: none; }
  /* (el mapa de la vista previa, más bajo si la pantalla es baja, para que quepan los ajustes) */
  #mp-canvas { max-height: 22vh; object-fit: contain; }
}
/* (pantallas medianas: en vez de un panel debajo de otro, dos columnas que caben: equipos y chat a la izquierda,
   los ajustes a la derecha) */
@media (min-width: 701px) and (max-width: 1000px) { .lobby-grid { grid-template-columns: 1.2fr 1fr; } }
/* ---------- tarjetas oscuras de pixel art (el estilo de la sala, para toda la interfaz): fondo oscuro tramado,
   borde de esquinas recortadas y un filo claro por dentro; el texto, claro ---------- */
:root {
  --card-bg: color-mix(in srgb, var(--edge) 78%, transparent) var(--dither-dark) 0 0 / var(--dither-size) var(--dither-size);
  --card-px: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge), inset 0 0 0 3px color-mix(in srgb, var(--well) 14%, transparent);
}
.card { background: var(--card-bg); box-shadow: var(--card-px); color: var(--well); }
/* ---------- la sala en el ordenador: como en el móvil, pero todo a la vez y a lo grande ----------
   Tres columnas: a la izquierda, de arriba abajo, la tarjeta de la partida (el mapa y sus fichas); en el centro, los
   ajustes en una franja arriba, los equipos de pie y la barra de abajo (añadir IA, empezar); a la derecha, el chat.
   (El panel de los equipos y su escenario van con display: contents: sus partes se colocan en la rejilla de la sala) */
@media (min-width: 701px) {
  body:not(.mobile) #scr-room { padding: 14px 20px 18px; gap: 12px; }
  body:not(.mobile) #scr-room .topbar { max-width: 1760px; }
  body:not(.mobile) .room-grid {
    max-width: 1760px; gap: 12px 20px;
    grid-template-columns: clamp(230px, 18vw, 310px) minmax(0, 1fr) clamp(250px, 19vw, 330px); grid-template-rows: auto auto minmax(0, 1fr) auto;
  }
  body:not(.mobile) .room-grid > .panel:nth-child(1), body:not(.mobile) .stage { display: contents; }
  body:not(.mobile) .room-grid > .panel:first-child > .panel-head { grid-column: 2; grid-row: 1; margin: 0; }
  body:not(.mobile) .room-grid > .panel:first-child .panel-head h3 { font-size: 1.5rem; }
  body:not(.mobile) .room-info { grid-column: 1; grid-row: 1 / 5; }
  body:not(.mobile) .room-grid > .panel:nth-child(2) { grid-column: 2; grid-row: 2; }
  body:not(.mobile) .room-grid .player-list { grid-column: 2; grid-row: 3; }
  body:not(.mobile) .room-bar { grid-column: 2; grid-row: 4; }
  body:not(.mobile) .room-grid > .chat-panel { grid-column: 3; grid-row: 1 / 5; min-height: 0; }
  body:not(.mobile) :is(.room-info, .room-grid > .panel:nth-child(2), .room-grid > .chat-panel, .room-bar) { margin: 3px; box-sizing: border-box; background: var(--card-bg); box-shadow: var(--card-px); color: var(--well); }
  body:not(.mobile) .room-grid > .panel :is(h3, .muted) { color: var(--well); text-shadow: 2px 2px 0 var(--edge); }
  body:not(.mobile) .room-info { width: auto; gap: 12px; padding: 14px; }
  body:not(.mobile) .ri-title { font-size: 1.15rem; text-align: center; order: -1; }
  body:not(.mobile) #ri-map { box-shadow: 0 0 0 3px var(--edge), 0 0 0 6px color-mix(in srgb, var(--well) 30%, transparent); }
  body:not(.mobile) .ri-desc { margin: auto 0 0; color: color-mix(in srgb, var(--well) 80%, transparent); font-size: .85rem; line-height: 1.35; }
  /* (las fichas: el icono y su nombre debajo, en una rejilla; el modo y el jefe, a lo ancho) */
  body:not(.mobile) .ri-icons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  body:not(.mobile) .ri-chip { flex-direction: column; height: auto; min-height: 62px; padding: 6px 2px 5px; margin: 2px; gap: 4px; min-width: 0; }
  body:not(.mobile) .ri-chip b { font-size: .7rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  body:not(.mobile) .ri-chip.wide, body:not(.mobile) .ri-chip.boss { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 6px 12px; min-height: 0; }
  body:not(.mobile) .ri-chip.wide b, body:not(.mobile) .ri-chip.boss b { font-size: .95rem; }
  body:not(.mobile) .ri-chip.boss { background: color-mix(in srgb, var(--danger) 30%, var(--tile)); }
  body:not(.mobile) .ri-chip.boss img { height: 72px; }
  /* (los ajustes: una franja arriba de los equipos, en columnas; el mapa ya se ve a la izquierda, aquí sólo su semilla) */
  body:not(.mobile) .room-grid > .panel:nth-child(2) { display: block; position: relative; padding: 10px 14px 4px; overflow: visible; }
  body:not(.mobile) .room-grid > .panel:nth-child(2) > .panel-head { display: none; }
  body:not(.mobile) #mp-canvas, body:not(.mobile) .mp-name, body:not(.mobile) .mode-desc { display: none; }
  body:not(.mobile) .map-preview { margin: 0; }
  body:not(.mobile) .room-grid .settings { overflow: visible; padding: 0; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 12px; }
  body:not(.mobile) .room-grid .settings .field { margin-bottom: 6px; }
  body:not(.mobile) .room-grid .settings .field span { color: color-mix(in srgb, var(--well) 75%, transparent); font-size: .64rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body:not(.mobile) .room-grid .settings select { padding: 4px 6px; font-size: .85rem; }
  body:not(.mobile) .room-grid .settings .check { margin: 4px 0 6px; font-size: .8rem; color: var(--well); }
  /* (la semilla y los dados, arriba a la derecha, junto al título de los equipos) */
  body:not(.mobile) .mp-row { position: absolute; right: 70px; top: -50px; color: var(--well); }
  body:not(.mobile) .mp-seed { color: var(--well); }
  /* (los equipos, de pie) */
  body:not(.mobile) .room-grid .player-list { padding: 0 10px 2vh 56px; position: relative; }
  body:not(.mobile) .room-grid .player { --pw: clamp(84px, calc(11vw - 24px), 170px); --ih: min(26vh, calc(var(--pw) * 1.45)); flex-basis: var(--pw); width: var(--pw); margin-left: calc(var(--pw) * -0.37); }
  body:not(.mobile) .room-grid .player:nth-child(even) { margin-bottom: calc(var(--ih) * 0.5); }
  body:not(.mobile) .room-grid .player .charbtn img { height: var(--ih); }
  body:not(.mobile) .room-grid .player .pname { font-size: 1rem; }
  /* (el dibujo deja hueco arriba para los gorros: el nombre y los botoncitos, pegados a la cabeza) */
  body:not(.mobile) .room-grid .player:nth-child(even) .pname { margin-bottom: calc(var(--ih) * -0.3); }
  body:not(.mobile) .room-grid .player:nth-child(even) .btn:is(.pkick, .pspec, .pcolor) { top: calc(var(--ih) * 0.06 + 20px); }
  body:not(.mobile) .room-grid .player:nth-child(odd) .btn:is(.pkick, .pspec, .pcolor) { top: calc(var(--ih) * 0.22); }
  /* (la barra de abajo) */
  body:not(.mobile) .room-bar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
  body:not(.mobile) .room-bar .add-row { flex: none; }
  body:not(.mobile) .room-bar .add-row select { flex: none; width: auto; min-width: 0; }
  body:not(.mobile) .room-bar .start-row { flex: none; margin-left: auto; }
  body:not(.mobile) .room-bar .start-row .btn { flex: none; min-width: 190px; }
  body:not(.mobile) .room-bar .add-row .btn, body:not(.mobile) .room-bar .add-row select { padding: 6px 10px; font-size: .9rem; }
  body:not(.mobile) #btn-ready { min-width: 0; }
}
/* (pantallas medianas: añadir IA o jugador, sólo con su icono; el nombre, al pasar el ratón) */
@media (min-width: 701px) and (max-width: 1450px) {
  body:not(.mobile) .room-bar .add-row .btn { font-size: 0; gap: 0; padding: 6px 10px; }
  body:not(.mobile) .room-bar .add-row .btn .pxi { transform: scale(1.3); }
}

/* ---------- tamaños (editor de la interfaz, grupo Tipografía) ---------- */
/* el texto de los menús: casi todo va en rem (relativo a la raíz), así que la raíz sigue a --base-size */
html { font-size: calc(var(--base-size) * 16 / 17); }
/* el HUD de la partida, entero a escala (texto, botones y paneles en proporción, sin descuadrarse) */
#hud, #weapon-panel { zoom: calc(var(--hud-scale) * var(--hud-user, 1)); } /* (--hud-user: Opciones → Interfaz) */

/* el logo del menú (client/mochilogo.js): el dibujo de 256×146 agrandado sin suavizar (a 1,5; al doble en pantallas
   grandes; tal cual en las bajas, para que el menú quepa sin salirse por arriba) */
.menu-card .logo { line-height: 0; text-shadow: none; }
#logo-cv { display: block; width: min(384px, 100%); image-rendering: pixelated; margin: -20px 0 -14px -6px; }
@media (min-height: 950px) and (min-width: 1300px) { #logo-cv { width: 512px; margin: -36px 0 -20px -8px; } }
@media (max-height: 800px) { #logo-cv { width: 256px; margin: -8px 0 -8px -4px; } }

/* tutorial: a la izquierda, a media altura (arriba y abajo está la interfaz de la partida), el paso y sus botones en columna */
#tut-bar { top: 50%; left: 14px; transform: translateY(-50%); display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 6px 10px; pointer-events: auto; font-size: .85rem; white-space: nowrap; }
#tut-bar.hidden { display: none; }
#tut-step { color: var(--muted); }
/* lo que dice Flan: un bocadillo grande encima de él, que le sigue (lo coloca placeTutBubble; --tail: dónde va el pico).
   Sin pico y con su cara cuando Flan queda fuera de la vista (far) o va arriba en el centro (mid) */
#tut-panel { position: fixed; z-index: 21; left: 0; top: 0; width: max-content; max-width: min(400px, calc(100vw - 24px)); display: flex; gap: 10px; align-items: center;
  padding: 10px 16px; background: var(--well); color: var(--ink); pointer-events: auto; box-shadow: 0 0 0 4px var(--edge), 0 0 0 8px var(--yellow), 0 0 0 12px var(--edge); }
#tut-panel.mid { max-width: min(640px, calc(100vw - 24px)); }
#tut-panel.gone { opacity: 0; pointer-events: none; transition: opacity .6s; }
#tut-panel::before, #tut-panel::after { content: ''; position: absolute; left: var(--tail, 50%); top: 100%; transform: translateX(-50%); clip-path: polygon(0 0, 100% 0, 50% 100%); }
#tut-panel::before { width: 44px; height: 32px; background: var(--edge); }
#tut-panel::after { width: 24px; height: 17px; background: var(--well); }
#tut-panel.below::before, #tut-panel.below::after { top: auto; bottom: 100%; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
#tut-panel:is(.far, .mid)::before, #tut-panel:is(.far, .mid)::after { display: none; }
#tut-panel.pop { animation: tutpop .3s steps(3); }
@keyframes tutpop { from { transform: scale(.7); } 60% { transform: scale(1.08); } }
#tut-face { display: none; flex: none; width: 56px; height: 64px; overflow: hidden; place-items: end center; background: color-mix(in srgb, var(--sky) 35%, var(--well));
  box-shadow: inset 0 0 0 3px var(--edge); }
#tut-panel:is(.far, .mid) #tut-face { display: grid; }
#tut-face img { display: block; width: 56px; height: 75px; margin-bottom: -10px; animation: flantalk .5s steps(2) infinite; }
@keyframes flantalk { 50% { transform: translateY(-4px); } }
.tut-body { flex: 1; min-width: 0; }
#tut-panel.hidden { display: none; }
#tut-text { margin: 0; font-size: 1.45rem; font-weight: 700; line-height: 1.25; }
#tut-text kbd { font-size: .8em; padding: 2px 8px; vertical-align: .1em; }
#tut-text kbd.pad { border-radius: 999px; padding: 2px 9px; }
#tut-next { margin-top: 10px; width: 100%; }
body.tut #hb-report, body.tut #hb-ai, body.tut #mb-chat { display: none; }
/* (la cámara aparece cuando llega su lección; el botón del arsenal del móvil, sólo cuando hay que elegir algo) */
body.tut:not(.tut-cam) #camnav, body.tut:not(.tut-cam) #mb-zin, body.tut:not(.tut-cam) #mb-zout,
body.tut:not(.tut-arm) #mb-weapons { display: none; }
body.tut #key-hint { display: none; }

/* los botones grandes del tutorial: teclas, botones del mando o de la pantalla; se hunden al pulsarlos de verdad */
#tut-keys { position: fixed; z-index: 20; left: 50%; top: 60%; transform: translateX(-50%); width: max-content; display: flex; gap: 34px; align-items: flex-end; pointer-events: none; }
#tut-keys.hidden { display: none; }
/* (el mando en los menús: el botón marcado, con un marco amarillo; ver installPadUI en gamepad.js) */
body.padui .padfocus, body.padui #scr-game .padfocus:focus { outline: 4px solid var(--yellow); outline-offset: 3px; }
/* (con el menú de la partida abierto, los botones grandes del tutorial no van encima) */
body:has(#tmenu:not(.hidden)) #tut-keys { display: none; }
/* (una barra en ajuste con el mando: A para empezar, los lados la mueven) */
body.padui .padedit { outline-color: var(--pink); }
/* (las opciones de una lista desplegable, con el mando) */
.pad-select { z-index: 200; }
.pad-select .modal-card { width: min(420px, 92vw); max-height: 80vh; display: flex; flex-direction: column; }
.pad-select-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; padding: 6px; }
.pad-select-list .btn.on { background: var(--yellow); color: var(--ink); }
/* (la flecha hacia el objetivo que queda fuera de la cámara: gira hacia él y empuja hacia fuera) */
#tut-off { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 21; pointer-events: none; }
#tut-off.hidden { display: none; }
/* (la flecha gira dentro de .rot; al lado, hacia dentro de la pantalla, lo que hay que usar y adónde: el portal, el regalo) */
#tut-off .rot { position: absolute; left: 0; top: 0; width: 0; height: 0; }
#tut-off-ic { position: absolute; left: 0; top: 0; display: flex; gap: 6px; padding: 6px 8px; background: var(--well); box-shadow: 0 0 0 3px var(--edge);
  transform: translate(-50%, -50%); white-space: nowrap; }
#tut-off-ic:empty { display: none; }
#tut-off-ic img { display: block; }
#tut-off b { position: absolute; left: -22px; top: -24px; font-size: 2.8rem; line-height: 1; color: var(--yellow); filter: drop-shadow(3px 0 0 var(--edge)) drop-shadow(-3px 0 0 var(--edge)) drop-shadow(0 3px 0 var(--edge)) drop-shadow(0 -3px 0 var(--edge)); animation: tutoff .5s steps(2) infinite alternate; }
@keyframes tutoff { to { transform: translateX(8px); } }
.tk-group { display: flex; flex-direction: column; align-items: center; gap: 14px; animation: tkbob 1.2s steps(2) infinite; }
.tk-group:nth-child(2) { animation-delay: .3s; } .tk-group:nth-child(3) { animation-delay: .6s; } .tk-group:nth-child(4) { animation-delay: .9s; }
@keyframes tkbob { 50% { transform: translateY(-6px); } }
.tk-row { display: flex; align-items: center; gap: 10px; }
.tk-label, .tk-plus { font-weight: 700; color: var(--well); white-space: nowrap;
  text-shadow: 3px 0 0 var(--edge), -3px 0 0 var(--edge), 0 3px 0 var(--edge), 0 -3px 0 var(--edge), 0 6px 0 var(--edge); }
.tk-label { font-size: 1.2rem; }
.tk-plus { font-size: 2.4rem; }
.tk { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 64px; height: 64px; padding: 0 14px;
  font-family: var(--font); font-weight: 700; font-size: 1.8rem; line-height: 1; background: var(--well); color: var(--edge);
  box-shadow: 0 0 0 4px var(--edge), inset 0 -8px 0 color-mix(in srgb, var(--edge) 20%, transparent), 0 10px 0 4px var(--edge); transform: translateY(-6px); }
.tk.wide { min-width: 150px; font-size: 1.4rem; }
.tk.round { width: 64px; padding: 0; border-radius: 50%; }
.tk.trig { min-width: 86px; border-radius: 18px 18px 4px 4px; background: color-mix(in srgb, var(--edge) 78%, var(--well)); color: var(--well); }
.c-xbox-A { background: var(--mint); } .c-xbox-B { background: var(--pink); } .c-xbox-X { background: var(--sky); } .c-xbox-Y { background: var(--yellow); }
.c-ps-A { background: var(--sky); } .c-ps-B { background: var(--pink); } .c-ps-X { background: var(--lav); } .c-ps-Y { background: var(--mint); }
.tk.stick { width: 70px; height: 70px; padding: 0; border-radius: 50%; background: color-mix(in srgb, var(--edge) 78%, var(--well)); color: var(--well); }
.tk.stick i { position: absolute; left: 17px; top: 14px; width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--edge) 45%, var(--well));
  box-shadow: inset 0 -5px 0 color-mix(in srgb, var(--edge) 40%, transparent); }
.tk.stick b { position: relative; font-size: 1.2rem; }
.tk.stick.lr i { animation: sticklr 1s steps(4) infinite alternate; }
@keyframes sticklr { from { transform: translateX(-11px); } to { transform: translateX(11px); } }
.tk.stick.spin i { animation: stickspin 1.6s steps(8) infinite; }
@keyframes stickspin { from { transform: rotate(0) translateX(10px) rotate(0); } to { transform: rotate(360deg) translateX(10px) rotate(-360deg); } }
/* (pulsado: hundido y en amarillo; va después de los colores de cada botón para ganarles) */
.tk.tk.down { transform: translateY(4px); background: var(--yellow); color: var(--edge);
  box-shadow: 0 0 0 4px var(--edge), inset 0 -3px 0 color-mix(in srgb, var(--edge) 20%, transparent), 0 0 0 4px var(--edge); }
.tk.mouse { height: auto; padding: 8px 14px; gap: 4px; }
.tk.mouse small { font-size: 1rem; }
.tk.mouse.move img { animation: sticklr 1s steps(4) infinite alternate; }
.tk.touch { font-size: 1.15rem; min-width: 90px; height: 52px; background: color-mix(in srgb, var(--pink) 55%, var(--well)); }
.tut-glow { animation: tutglow .7s steps(2) infinite; }
@keyframes tutglow { 50% { box-shadow: 0 0 0 4px var(--yellow), 0 0 22px 8px var(--yellow); } }
/* (en el móvil, la vista del juego es pequeña: en vez de los botones grandes, brillan los de verdad de abajo) */
body.mobile #tut-keys { display: none; }
/* fundido de entrada y salida del tutorial (blanco, como el laboratorio) */
#tut-fade { position: fixed; inset: 0; z-index: 150; background: var(--well); opacity: 0; pointer-events: none; transition: opacity .4s ease; }
#tut-fade.on { opacity: 1; pointer-events: auto; }
/* (lo ya hecho de un paso: verde y quieto) */
.tk-group.ok { animation: none; opacity: .75; }
.tk-group.ok .tk-label { color: var(--mint); }
/* la cruceta del mando: una cruz con los brazos de la acción encendidos */
.tk.dpad { width: 66px; height: 66px; padding: 0; background: transparent; box-shadow: none; }
.tk.dpad::before, .tk.dpad::after { content: ''; position: absolute; left: 22px; top: 0; width: 22px; height: 66px; background: color-mix(in srgb, var(--edge) 78%, var(--well));
  box-shadow: 0 0 0 4px var(--edge); }
.tk.dpad::after { left: 0; top: 22px; width: 66px; height: 22px; }
.tk.dpad i { position: absolute; z-index: 1; inset: 0; }
.tk.dpad.ud i { background: linear-gradient(var(--yellow) 0 18px, transparent 18px 48px, var(--yellow) 48px) 22px 0 / 22px 66px no-repeat; }
.tk.dpad.lr i { background: linear-gradient(90deg, var(--yellow) 0 18px, transparent 18px 48px, var(--yellow) 48px) 0 22px / 66px 22px no-repeat; }
.tk.dpad.down i { filter: brightness(1.3); }
.tk.stick.press i { animation: stickpress .8s steps(2) infinite; }
@keyframes stickpress { 50% { transform: scale(.8); } }
.tk.touch .pxi { margin: 0; }
/* el ratón al borde: la flecha va a cada borde de la pantallita (izquierda, arriba, derecha, abajo) y, al llegar, el fondo
   (el mapa) se desplaza hacia el otro lado, como al mover la cámara; la cuadrícula es de 16 px: al volver, no salta */
.tk.screen { width: 132px; height: 84px; padding: 0; overflow: hidden; justify-content: flex-end; background: color-mix(in srgb, var(--sky) 30%, var(--well)); }
.tk.screen .scr-bg { position: absolute; inset: 0; background-image: linear-gradient(color-mix(in srgb, var(--sky) 70%, transparent) 2px, transparent 2px),
  linear-gradient(90deg, color-mix(in srgb, var(--sky) 70%, transparent) 2px, transparent 2px); background-size: 16px 16px; animation: scrbg 6.4s infinite; }
.tk.screen .scr-cur { position: absolute; top: 18px; left: 56px; line-height: 0; animation: scrcur 6.4s infinite; }
.tk.screen small { position: relative; font-size: .85rem; margin-bottom: 4px; }
@keyframes scrcur {
  0% { left: 56px; top: 18px; animation-timing-function: steps(5); }
  8%, 25% { left: 2px; top: 18px; animation-timing-function: steps(5); }
  33%, 50% { left: 56px; top: 2px; animation-timing-function: steps(5); }
  58%, 75% { left: 109px; top: 18px; animation-timing-function: steps(5); }
  83%, 96% { left: 56px; top: 34px; animation-timing-function: steps(2); }
  100% { left: 56px; top: 18px; }
}
@keyframes scrbg {
  0%, 8% { background-position: 0 0; animation-timing-function: steps(8); }
  25%, 33% { background-position: 32px 0; animation-timing-function: steps(8); }
  50%, 58% { background-position: 32px 32px; animation-timing-function: steps(8); }
  75%, 83% { background-position: 0 32px; animation-timing-function: steps(8); }
  96%, 100% { background-position: 0 0; }
}
.tk.mouse.wheel img { animation: mwheel .6s steps(2) infinite; }
@keyframes mwheel { 50% { transform: translateY(-4px); } }
.tk-or { font-weight: 700; font-size: 1.6rem; text-transform: uppercase; color: var(--well); text-shadow: 3px 0 0 var(--edge), -3px 0 0 var(--edge), 0 3px 0 var(--edge), 0 -3px 0 var(--edge); margin: 0 4px; }
/* tutorial: hay que repetir. Fundido rápido a negro y vuelta, con el aviso en grande en medio */
#tut-retry { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: #000; opacity: 0; pointer-events: none; color: var(--well); text-align: center; }
#tut-retry b { font-size: 2.6rem; color: var(--yellow); }
#tut-retry small { font-size: 1.3rem; }
#tut-retry.on { animation: tutretry 1.5s ease-in-out; }
@keyframes tutretry { 0% { opacity: 0; } 15%, 70% { opacity: 1; } 100% { opacity: 0; } }
/* la flecha que señala lo de la interfaz de lo que habla Flan: debajo, apuntando hacia arriba (down: encima, hacia abajo) */
#tut-ptr { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 22; pointer-events: none; }
#tut-ptr.hidden { display: none; }
#tut-ptr b { position: absolute; left: -22px; top: 0; font-size: 2.8rem; line-height: 1; color: var(--yellow); animation: tutptr .5s steps(2) infinite alternate;
  filter: drop-shadow(3px 0 0 var(--edge)) drop-shadow(-3px 0 0 var(--edge)) drop-shadow(0 3px 0 var(--edge)) drop-shadow(0 -3px 0 var(--edge)); }
#tut-ptr.down b { top: auto; bottom: 0; animation-name: tutptrd; }
@keyframes tutptr { to { transform: translateY(8px); } }
@keyframes tutptrd { from { transform: scaleY(-1); } to { transform: scaleY(-1) translateY(8px); } }
/* en el arsenal, lo que el tutorial pide elegir: brilla */
.wbtn.tut-want { box-shadow: 0 0 0 4px var(--yellow); animation: tutglow .7s steps(2) infinite; }
/* en el tutorial, el arsenal no tapa el diálogo de Flan */
body.tut:not(.mobile) #weapon-panel { max-height: calc(100vh - 320px); }
body.tut.mobile #weapon-panel { top: 76px; max-height: calc(56% - 70px); }
/* el arma marcada con el mando en el arsenal (padsel; vhover es la del ratón): marco grueso y una flecha encima, que se ven
   también en las apagadas */
.wbtn.padsel { z-index: 2; transform: scale(1.12); box-shadow: 0 0 0 3px var(--well), 0 0 0 7px var(--edge); }
.wbtn.padsel::before { content: ''; position: absolute; top: -18px; left: 50%; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--edge);
  border-bottom: 0; animation: tkbob .6s steps(2) infinite; }
.wbtn.off.padsel { opacity: 1; filter: none; }
.wbtn.off.padsel .pxi, .wbtn.off.padsel .ammo, .wbtn.off.padsel .lock { opacity: .35; filter: grayscale(1); }
.wbtn.tut-want.padsel { box-shadow: 0 0 0 3px var(--yellow), 0 0 0 7px var(--edge); }
/* el tráiler del final del tutorial (client/trailer.js): las escenas, y encima los efectos de vídeo */
#trailer { position: fixed; inset: 0; z-index: 400; background: var(--edge); overflow: hidden; cursor: pointer; }
#trailer .tr-stage { position: absolute; inset: 0; }
/* (mientras se preparan las escenas: ocultas, pero con su tamaño, para que se dibujen bien al verlas) */
.tr-stage.tr-hidden { position: fixed; inset: 0; visibility: hidden; pointer-events: none; z-index: -1; }
.tr-stage .tr-cv { position: absolute; inset: 0; width: 100%; height: 100%; visibility: hidden; image-rendering: pixelated; }
/* (bandas de cine, líneas de tele, viñeta) */
#trailer .tr-bar { position: absolute; left: 0; right: 0; height: 11vh; background: var(--edge); z-index: 3; transition: height 1.2s ease; }
#trailer .tr-bar.top { top: 0; } #trailer .tr-bar.bot { bottom: 0; }
#trailer.tr-in .tr-bar { animation: trbars 1.4s ease-out; }
@keyframes trbars { from { height: 50vh; } }
#trailer .tr-scan { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: repeating-linear-gradient(transparent 0 2px, color-mix(in srgb, var(--edge) 22%, transparent) 2px 3px); }
#trailer .tr-vig { position: absolute; inset: 0; z-index: 2; pointer-events: none; box-shadow: inset 0 0 18vmin 4vmin color-mix(in srgb, var(--edge) 85%, transparent); }
#trailer .tr-flash { position: absolute; inset: 0; z-index: 5; background: var(--well); opacity: 0; pointer-events: none; }
/* (rótulos: en una esquina, de golpe, sin tapar la acción del centro) */
#trailer .tr-word { position: absolute; z-index: 4; left: 5vw; bottom: calc(11vh + 18px); transform-origin: left bottom; font-family: var(--font); font-weight: 700;
  font-size: clamp(1.6rem, 4.2vw, 3.4rem); color: var(--well); white-space: nowrap; pointer-events: none; opacity: 0;
  text-shadow: 4px 0 0 var(--edge), -4px 0 0 var(--edge), 0 4px 0 var(--edge), 0 -4px 0 var(--edge), 0 9px 0 var(--pink), 5px 5px 0 var(--sky); }
#trailer.tr-word-in .tr-word { animation: trword .9s steps(9) forwards; }
@keyframes trword { 0% { transform: translateX(-40px) scale(1.8) rotate(-6deg); opacity: 0; } 18% { transform: translateX(0) scale(.95) rotate(-4deg); opacity: 1; }
  28% { transform: scale(1.03) rotate(-4deg); } 82% { opacity: 1; } 100% { transform: translateX(14px) scale(1.06) rotate(-4deg); opacity: 0; } }
/* (golpe de zoom, sacudida y colores separados) */
#trailer.tr-punch .tr-stage { animation: trpunch .26s ease-out; }
@keyframes trpunch { from { transform: scale(1.18); } }
#trailer.tr-shake .tr-stage { animation: trshake .12s steps(2) infinite; }
@keyframes trshake { 0% { transform: translate(6px, -4px) scale(1.04); } 50% { transform: translate(-6px, 5px) scale(1.04); } 100% { transform: translate(3px, 6px) scale(1.04); } }
#trailer.tr-rgb .tr-stage { filter: drop-shadow(6px 0 0 color-mix(in srgb, var(--pink) 70%, transparent)) drop-shadow(-6px 0 0 color-mix(in srgb, var(--sky) 70%, transparent)) saturate(1.6) contrast(1.2); }
/* (el final: el logo en grande sobre un estallido, y fundido al menú) */
#trailer .tr-logo { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; opacity: 0; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--heading) 45%, var(--edge)) 0, var(--edge) 70%); }
#trailer .tr-logo canvas { width: min(80vw, 900px); image-rendering: pixelated; }
#trailer.tr-end .tr-logo { opacity: 1; transition: opacity .25s; }
#trailer.tr-end .tr-logo canvas { animation: trlogo 3.4s ease-out forwards; }
@keyframes trlogo { 0% { transform: scale(1.5); filter: brightness(3); } 12% { transform: scale(1); filter: brightness(1); } 100% { transform: scale(1); } } /* (acaba a escala 1: los píxeles, todos iguales) */
#trailer.tr-out { opacity: 0; transition: opacity .8s ease; pointer-events: none; }
#trailer .tr-skip { position: absolute; z-index: 7; right: 16px; bottom: 16px; }
/* (mientras se preparan las partidas del tráiler) */
#trailer .tr-load { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; font-family: var(--font); font-size: 1.4rem; color: var(--well);
  animation: trload 1s steps(2) infinite; pointer-events: none; }
#trailer.tr-go .tr-load, #trailer.tr-end .tr-load { display: none; }
@keyframes trload { 50% { opacity: .45; } }
#trailer .tr-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }

/* ---------- toda la interfaz con las tarjetas oscuras de la sala (--card-bg, --card-px): las ventanas, el lobby, el
   arsenal y el HUD de la partida. Dentro, el texto claro (y --muted, el gris, aclarado); los campos y las casillas
   siguen claros, con su texto oscuro ---------- */
:is(.modal-card:not(.ward-card), #scr-lobby .panel, #hud-turn, #hud-teams, #hud-weapon, #hud-fuse, #hud-wind, #camnav, #hud-slots, #weapon-panel, #tut-bar, #toast, #key-hint) {
  background: var(--card-bg); box-shadow: var(--card-px); color: var(--well); --muted: color-mix(in srgb, var(--well) 62%, transparent);
}
#minimap { box-shadow: var(--card-px); }
:is(#pause-banner, #report-menu, #report-ready, #fps-menu) { background: var(--card-bg); box-shadow: var(--card-px); color: var(--well); }
/* (con clases: los paneles de las salas y de la sala en el móvil, el fin de partida, el marcador y las etiquetas; el
   panel de los equipos de la sala, sin fondo, y los de la sala del ordenador ya tienen su regla) */
.panel, .go-card, .sb-card, .pill { background: var(--card-bg); box-shadow: var(--card-px); color: var(--well); --muted: color-mix(in srgb, var(--well) 62%, transparent); }
:is(.panel, .sb-card) :is(h2, h3) { color: var(--well); text-shadow: 2px 2px 0 var(--edge); }
.ri-chip.soon { opacity: .75; font-style: italic; }
.ri-chip.soon b, body:not(.mobile) .ri-chip.soon b { white-space: normal; text-align: center; overflow: visible; }
:is(.modal-card, #scr-lobby .panel, #weapon-panel) :is(h2, h3) { color: var(--well); text-shadow: 2px 2px 0 var(--edge); }
/* (lo que se abre encima del juego o de la sala, más opaco: se lee mejor sin el fondo detrás) */
:is(.modal-card:not(.ward-card), #weapon-panel, #tut-bar) { background: color-mix(in srgb, var(--edge) 94%, transparent) var(--dither-dark) 0 0 / var(--dither-size) var(--dither-size); }

/* ---------- el armario en el ordenador: como en el móvil, el personaje en grande sobre su pedestal a la izquierda
   (sin marco, con el fondo en degradado) y las prendas en tarjetas a la derecha; Listo, abajo a la derecha ---------- */
body:not(.mobile) .ward-card {
  width: min(1240px, 100%); height: min(820px, calc(100vh - 40px)); max-height: none; display: flex; flex-direction: column; box-sizing: border-box;
  background: radial-gradient(ellipse at 16% 58%, color-mix(in srgb, var(--sky) 50%, var(--edge)) 0, var(--edge) 62%); box-shadow: var(--card-px); color: var(--well);
}
body:not(.mobile) .ward-body { flex: 1; min-height: 0; flex-wrap: nowrap; align-items: stretch; gap: 26px; }
body:not(.mobile) .ward-side { width: 300px; justify-content: center; overflow-y: auto; scrollbar-width: none; }
body:not(.mobile) #ward-preview { width: auto; height: min(46vh, 384px); aspect-ratio: 144 / 192; box-shadow: none; }
/* (de pie sobre un pedestal de pixel art; el nombre, debajo, sin taparle los pies) */
#ward-preview { background: var(--px-ped) center bottom / 86% auto no-repeat; image-rendering: pixelated; padding-bottom: 5%; box-sizing: content-box; }
/* (el nombre, debajo del pedestal, en letras claras con contorno) */
body:not(.mobile) .ward-name { margin-top: 4px; color: var(--well); font-size: 1.15rem; font-weight: 700; text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink), 2px 2px 0 var(--ink); }
body:not(.mobile) .ward-label, body:not(.mobile) .ward-names small { color: color-mix(in srgb, var(--well) 70%, transparent); }
body:not(.mobile) .ward-btns .btn { background: var(--sky); color: var(--ink); box-shadow: 0 0 0 3px var(--ink), inset 0 -4px 0 color-mix(in srgb, var(--sky) 55%, var(--ink)); }
body:not(.mobile) .ward-main { min-width: 0; }
body:not(.mobile) .ward-tabs .btn { min-height: 38px; padding: 4px 16px; font-size: 1rem; background: color-mix(in srgb, var(--well) 16%, var(--edge)); color: var(--well); box-shadow: 0 0 0 3px var(--ink); }
body:not(.mobile) .ward-tabs .btn.on { background: var(--yellow); color: var(--ink); box-shadow: 0 0 0 3px var(--ink), inset 0 -4px 0 color-mix(in srgb, var(--yellow) 55%, var(--ink)); }
body:not(.mobile) .ward-cats .chip { padding: 3px 10px; background: color-mix(in srgb, var(--well) 12%, var(--edge)); color: var(--well); box-shadow: 0 0 0 2px var(--ink); }
body:not(.mobile) .ward-cats .chip.on { background: var(--leaf); color: var(--well); }
body:not(.mobile) .ward-grid { flex: 1; max-height: none; min-height: 0; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; padding: 6px; background: none; align-content: start; }
body:not(.mobile) .ward-tile { background: color-mix(in srgb, var(--sky) 35%, var(--well)); box-shadow: 0 0 0 3px var(--ink), inset 0 -5px 0 color-mix(in srgb, var(--sky) 45%, var(--ink)); padding: 6px 0 8px; }
body:not(.mobile) .ward-tile:hover { background: color-mix(in srgb, var(--sky) 20%, var(--well)); transform: translateY(-2px); }
body:not(.mobile) .ward-tile canvas { width: 60px; height: 80px; }
body:not(.mobile) .ward-tile span { color: var(--ink); font-size: .68rem; }
body:not(.mobile) .ward-tile.on { background: var(--yellow); box-shadow: 0 0 0 3px var(--ink), inset 0 -5px 0 color-mix(in srgb, var(--yellow) 55%, var(--ink)); }
body:not(.mobile) .ward-empty { color: var(--well); }
body:not(.mobile) .ward-card > .start-row { justify-content: flex-end; }
body:not(.mobile) #ward-done { flex: none; min-width: 220px; background: var(--yellow); color: var(--ink); text-shadow: none; box-shadow: 0 0 0 3px var(--ink), inset 0 -5px 0 color-mix(in srgb, var(--yellow) 55%, var(--ink)); }

/* botones de efectos y música: apagados, más apagados */
.snd-btn.off { opacity: .6; }

/* (lo de la interfaz que tapa a un personaje de quien juega: un círculo alrededor de él, transparente hasta --r1 y
   tramado a cuadros de 2 px hasta --r2, para verlo detrás; ver seeThru en gameclient.js. Capas: fuera del círculo grande,
   todo; más la trama recortada a fuera del pequeño) */
.see-thru {
  mask-image: radial-gradient(circle at var(--sx) var(--sy), transparent var(--r2), #000 var(--r2)),
    conic-gradient(#000 25%, transparent 0 50%, #000 0 75%, transparent 0),
    radial-gradient(circle at var(--sx) var(--sy), transparent var(--r1), #000 var(--r1));
  mask-size: auto, 4px 4px, auto;
  mask-repeat: no-repeat, repeat, no-repeat;
  mask-composite: add, intersect, add;
}

/* ---------- ajustes de la sala: tarjetas grandes con su ilustración (modo, mapa, ambiente, reglas) en vez de
   desplegables, y la lista de opciones (#picker) en tarjetas; las reglas, en su ventana con filas de botones (.seg).
   Los desplegables siguen en la página, escondidos: son los que lee y escribe main.js ---------- */
.seg-src, .settings .field.picked { display: none !important; }
.pick-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 3px 3px 8px; }
.pick-card {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 1px; min-width: 0; padding: 0 0 7px; border: 0;
  cursor: pointer; font: inherit; text-align: left; background: var(--tile); color: var(--ink);
  box-shadow: 0 0 0 3px var(--edge), inset 0 -4px 0 0 color-mix(in srgb, var(--tile) 60%, var(--edge)); transition: transform .06s, filter .12s;
}
.pick-card:hover:not(:disabled), .pick-card.vhover { transform: translateY(-2px); filter: brightness(1.05); }
.pick-card:active:not(:disabled) { transform: translateY(2px); }
.pick-card:disabled { cursor: default; }
.pick-card.on { background: var(--yellow); box-shadow: 0 0 0 3px var(--edge), 0 0 0 6px var(--yellow), inset 0 -4px 0 0 color-mix(in srgb, var(--yellow) 60%, var(--edge)); }
.pick-card canvas, .pick-card .rc-art { display: block; width: 100%; height: auto; aspect-ratio: 240 / 110; image-rendering: pixelated; box-shadow: 0 3px 0 0 var(--edge); margin-bottom: 5px; }
.pick-card .rc-art { display: grid; place-items: center; background: color-mix(in srgb, var(--sky) 55%, var(--tile)); }
.pick-card > span:not(.rc-art) { padding: 0 9px; font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: color-mix(in srgb, var(--ink) 62%, transparent); }
.pick-card > b { padding: 0 9px; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* (encima de la ilustración: el icono del modo, el jefe del ambiente, los dados de «Aleatorio») */
.pick-card .pc-art { position: absolute; left: 0; right: 0; top: 0; aspect-ratio: 240 / 110; display: grid; place-items: center; pointer-events: none;
  filter: drop-shadow(3px 0 0 var(--edge)) drop-shadow(-3px 0 0 var(--edge)) drop-shadow(0 3px 0 var(--edge)) drop-shadow(0 -3px 0 var(--edge)); }
.pick-card .pc-art img { position: absolute; inset: 9% 4%; width: 92%; height: 82%; object-fit: contain; image-rendering: pixelated; }
/* (los modos: su ilustración animada en el lienzo, sin el icono encima; ver MODE_ART en main.js) */
.pick-card.is-mode .pc-art { display: none; }
#rules-sum { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .85rem; }
#rules-sum span { display: inline-flex; align-items: center; gap: 4px; }
.picker-card { width: min(1120px, 100%); }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; padding: 8px; margin-bottom: 14px; }
.picker-grid .pick-card > b { font-size: 1.1rem; padding-top: 2px; white-space: normal; }
.picker-grid .pick-card p { margin: 2px 0 0; padding: 0 9px; font-size: .78rem; line-height: 1.3; color: color-mix(in srgb, var(--ink) 75%, transparent);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
:is(#picker, #rules) .start-row { display: flex; justify-content: flex-end; }
/* (las reglas: cada ajuste, su nombre y una fila de botones; el elegido, en amarillo) */
#rules .modal-card { width: min(820px, 100%); }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 26px; margin-bottom: 12px; }
.rules-grid .field span { color: var(--muted); }
.rules-grid .check { color: var(--well); margin: 4px 0; }
.seg { display: flex; flex-wrap: wrap; gap: 2px; }
.seg .btn { padding: 5px 10px; font-size: .85rem; }
.seg .btn.on { background: var(--yellow); }
body:not(.mobile) .room-bar .add-row .seg .btn { padding: 6px 10px; font-size: .85rem; } /* (las otras de la barra son de icono, sin texto) */

/* preguntas del juego en vez de las del navegador (ask.js) */
.modal.ask { z-index: 60; }
.ask .modal-card { width: min(460px, 100%); text-align: center; }
.ask h3 { margin: 0 0 16px; font-size: 1.3rem; }
.ask .ask-in { width: 100%; box-sizing: border-box; margin-bottom: 16px; font: inherit; padding: 8px 10px; }
.ask .ask-btns { display: flex; gap: 12px; justify-content: center; }

/* la ruleta de gestos (tecla T, ver openEmotes en gameclient.js): tu personaje haciendo cada uno, en corro */
#emotes { background: color-mix(in srgb, var(--page) 30%, transparent); }
#emotes .em-ring { position: relative; width: min(520px, 88vmin); aspect-ratio: 1; border-radius: 50%; background: color-mix(in srgb, var(--well) 70%, transparent); box-shadow: 0 0 0 4px var(--edge); }
#emotes .em-name { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.5rem; color: var(--heading); pointer-events: none; }
#emotes .em-b { position: absolute; translate: -50% -50%; display: grid; justify-items: center; gap: 2px; padding: 4px 6px; min-width: 0; font-size: .8rem; }
#emotes .em-b canvas { width: 66px; height: 54px; image-rendering: pixelated; }
#emotes .em-b.on { background: var(--pink); color: var(--well); scale: 1.12; z-index: 1; }
