/* Tibiri-Tabara — sistema de diseño e interfaz.
   1) fuentes  2) tokens  3) base  4) componentes  5) pantallas  6) mandos de juego  7) avisos  8) tamaños  9) movimiento */

/* ============================================================ 1. Fuentes (alojadas en el propio juego) */
@font-face {
  font-family: "Lilita One"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(assets/fonts/lilita-one-latin.woff2?v=36f2f0c1d8) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Lilita One"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(assets/fonts/lilita-one-latin-ext.woff2?v=36f2f0c1d8) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url(assets/fonts/nunito-latin.woff2?v=36f2f0c1d8) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url(assets/fonts/nunito-latin-ext.woff2?v=36f2f0c1d8) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ============================================================ 2. Tokens */
:root {
  /* color */
  --navy-950: #070d2a; --navy-900: #0a1438; --navy-800: #0f1d52; --navy-700: #152a6e; --navy-600: #1d3a8f; --navy-500: #2a4fb8; --navy-400: #4670dc;
  --sky: #3da5ff; --sky-300: #8fd0ff; --sky-700: #1463c4;
  --mango-200: #fff0a6; --mango-300: #ffe066; --mango: #ffc21f; --orange: #ff9a1f; --orange-700: #c25a00; --brown: #4a2500;
  --red: #ef3b47; --red-300: #ff7b84; --red-700: #a51322;
  --green: #36c46b; --green-700: #1a8742; --violet: #8a6bff; --violet-700: #4b34b8;
  --cream: #fff4d8; --white: #fff;
  --team-a: #ff4d5a; --team-b: #3da5ff;
  --text: #fff; --text-2: rgba(255,255,255,.8); --text-3: rgba(255,255,255,.6);
  --glass: rgba(10,20,56,.62); --glass-line: rgba(255,255,255,.3);
  /* tipografía */
  --f-display: "Lilita One", "Baloo 2", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --f-body: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --fs-2xs: 11px; --fs-xs: 12px; --fs-sm: 13.5px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 28px; --fs-3xl: 38px;
  /* espaciado, radios */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px; --r-pill: 999px;
  /* elevación */
  --e-1: 0 2px 6px rgba(4,8,30,.35); --e-2: 0 8px 20px rgba(4,8,30,.42); --e-3: 0 18px 48px rgba(4,8,30,.6);
  --edge: 0 4px 0 var(--navy-900);
  /* contorno de títulos (sombra en 8 direcciones: funciona en cualquier navegador) */
  --ol-2: 0 2px 0 var(--navy-900), 0 -2px 0 var(--navy-900), 2px 0 0 var(--navy-900), -2px 0 0 var(--navy-900), 1.5px 1.5px 0 var(--navy-900), -1.5px 1.5px 0 var(--navy-900), 1.5px -1.5px 0 var(--navy-900), -1.5px -1.5px 0 var(--navy-900);
  --ol-1: 0 1.5px 0 var(--navy-900), 0 -1.5px 0 var(--navy-900), 1.5px 0 0 var(--navy-900), -1.5px 0 0 var(--navy-900), 1.1px 1.1px 0 var(--navy-900), -1.1px 1.1px 0 var(--navy-900), 1.1px -1.1px 0 var(--navy-900), -1.1px -1.1px 0 var(--navy-900);
  --ol-3: 0 3px 0 var(--navy-900), 0 -3px 0 var(--navy-900), 3px 0 0 var(--navy-900), -3px 0 0 var(--navy-900), 2.2px 2.2px 0 var(--navy-900), -2.2px 2.2px 0 var(--navy-900), 2.2px -2.2px 0 var(--navy-900), -2.2px -2.2px 0 var(--navy-900), 0 6px 0 var(--navy-900);
  /* movimiento */
  --t-press: 70ms; --t-fast: 150ms; --t-med: 260ms; --t-slow: 520ms;
  --ease-out: cubic-bezier(.2,.8,.2,1); --ease-pop: cubic-bezier(.2,1.5,.4,1);
  /* medidas */
  --hit: 44px; --bar-h: 48px; --pad: 10px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

/* ============================================================ 3. Base */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--navy-900);
  font-family: var(--f-body); font-weight: 700; font-size: var(--fs-md); line-height: 1.25; color: var(--text);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none; touch-action: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; border: 0; margin: 0; padding: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--mango-300); outline-offset: 2px; }
h2, h3, p { margin: 0; }
img, canvas { -webkit-user-drag: none; }
.ic { width: 1.25em; height: 1.25em; flex: none; display: block; pointer-events: none; }

/* ============================================================ 4. Componentes */

/* ---- Botón: 3D brillante con canto inferior y pulsación ---- */
.btn {
  --b-top: #5c86ee; --b-mid: #3c64d6; --b-bot: #2a4bb4; --b-ink: #fff; --b-edge: var(--navy-900);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--hit); min-width: var(--hit); padding: 0 16px 3px; border-radius: var(--r-md);
  font: 400 16px/1.05 var(--f-display); letter-spacing: .4px; text-transform: uppercase; text-align: center; color: var(--b-ink);
  background: linear-gradient(180deg, var(--b-top) 0%, var(--b-mid) 52%, var(--b-bot) 100%);
  border: 2.5px solid var(--b-edge);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.42), inset 0 -4px 0 rgba(0,0,0,.2), 0 4px 0 var(--b-edge), 0 8px 14px rgba(4,8,30,.35);
  text-shadow: 0 1.5px 0 rgba(8,14,50,.55);
  transition: transform var(--t-press) ease-out, box-shadow var(--t-press) ease-out, filter var(--t-fast);
}
.btn::after { /* brillo superior */
  content: ""; position: absolute; left: 7px; right: 7px; top: 3px; height: 38%; border-radius: 9px 9px 14px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.34), rgba(255,255,255,0)); pointer-events: none;
}
.btn > span { position: relative; z-index: 1; min-width: 0; }
.btn > .ic { position: relative; z-index: 1; }
.btn:active, .btn.pressed {
  transform: translateY(3px);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25), inset 0 -2px 0 rgba(0,0,0,.2), 0 1px 0 var(--b-edge), 0 2px 5px rgba(4,8,30,.35);
  filter: brightness(.96);
}
.btn-primary { --b-top: #fff08a; --b-mid: #ffc21f; --b-bot: #ff9218; --b-ink: var(--brown); text-shadow: 0 1.5px 0 rgba(255,255,255,.55); }
.btn-sky { --b-top: #9be0ff; --b-mid: #39aaf5; --b-bot: #1b7fe0; --b-ink: #06224f; text-shadow: 0 1.5px 0 rgba(255,255,255,.45); }
.btn-danger { --b-top: #ff8a90; --b-mid: #ef3b47; --b-bot: #c81f2f; }
.btn-green { --b-top: #8ff0a8; --b-mid: #36c46b; --b-bot: #1f9a4c; --b-ink: #05301a; text-shadow: 0 1.5px 0 rgba(255,255,255,.4); }
.btn-ghost {
  background: rgba(10,20,56,.55); border-color: rgba(255,255,255,.45); text-shadow: none;
  box-shadow: 0 3px 0 rgba(4,8,30,.45);
}
.btn-ghost::after { display: none; }
.btn-ghost:active { box-shadow: 0 0 0 rgba(4,8,30,.45); }
.btn-sm { font-size: 14px; padding: 0 12px 2px; gap: 6px; border-radius: var(--r-sm); }
.btn-lg { min-height: 48px; font-size: 18px; padding: 0 18px 3px; }
.btn-xl { min-height: 54px; font-size: 22px; padding: 0 22px 4px; border-radius: var(--r-lg); gap: 10px; }
.btn-xl::after { border-radius: 13px 13px 18px 18px; }
.btn-icon { width: var(--hit); padding: 0 0 2px; flex: none; }
.btn[disabled] { filter: saturate(.25) brightness(.78); opacity: .7; pointer-events: none; }

/* ---- Paneles, hojas y fondos ---- */
.card, .panel {
  background: linear-gradient(180deg, rgba(34,66,160,.94), rgba(15,29,82,.96));
  border: 2.5px solid var(--navy-900); border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.16), inset 0 10px 18px rgba(255,255,255,.05), var(--e-2);
}
.card { padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: none; }
.card::-webkit-scrollbar { display: none; }
.card-grow { flex: 1; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none; }
.card-h { font: 400 15px/1.1 var(--f-display); letter-spacing: .6px; text-transform: uppercase; color: var(--mango-300); text-shadow: 0 1.5px 0 var(--navy-900); flex: none; }
.card-h small { font: 800 11.5px/1.1 var(--f-body); letter-spacing: 0; text-transform: none; color: var(--text-2); margin-left: 6px; text-shadow: none; }
.overlay {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  padding: max(10px, var(--sat)) max(10px, var(--sar)) max(10px, var(--sab)) max(10px, var(--sal));
  background: rgba(6,10,32,.72); touch-action: pan-y;
}
.panel { padding: 14px 16px; width: min(100%, 420px); max-height: 100%; overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; text-align: center; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.16), var(--e-3); scrollbar-width: none; }
.panel-title { font: 400 var(--fs-2xl)/1 var(--f-display); letter-spacing: .6px; color: var(--mango-300); text-shadow: var(--ol-2); text-transform: uppercase; }
.sheet { /* hoja a pantalla completa (personajes, ayuda, ajustes de la sala) */
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px;
  padding: calc(8px + var(--sat)) max(12px, var(--sar)) calc(8px + var(--sab)) max(12px, var(--sal));
  background: linear-gradient(180deg, rgba(13,27,76,.86), rgba(7,13,42,.94)), url(assets/ui/bg_soga.webp?v=36f2f0c1d8) center / cover no-repeat var(--navy-800);
  animation: sheet-in var(--t-med) var(--ease-out) both;
}
.note { font: 800 var(--fs-xs)/1.25 var(--f-body); color: var(--text-2); text-align: center; }
.note.bad { color: #ffb0b5; }

/* ---- Barra superior de las pantallas ---- */
.topbar { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto); align-items: center; gap: 10px; flex: none; min-height: var(--bar-h); }
.topbar-title { font: 400 clamp(20px, 3.4vw, 30px)/1 var(--f-display); letter-spacing: .6px; text-align: center; text-transform: uppercase; color: var(--white); text-shadow: var(--ol-2); min-width: 0; }
.sheet > .topbar { grid-template-columns: minmax(0, 1fr) auto; }
.sheet > .topbar .topbar-title { text-align: left; padding-left: 4px; }
.topbar-gap { width: 96px; }
.btn-back { padding-left: 10px; }
.btn-go { font-size: 19px; padding: 0 18px 3px; }

/* ---- Control segmentado ---- */
.seg { display: flex; gap: 5px; flex: none; }
.seg > button {
  flex: 1 1 0; min-width: var(--hit); min-height: var(--hit); padding: 0 6px 2px; border-radius: 12px;
  font: 400 15px/1.05 var(--f-display); letter-spacing: .3px; text-transform: uppercase; color: var(--text);
  background: rgba(10,20,56,.5); border: 2px solid rgba(255,255,255,.2);
  transition: transform var(--t-press), background var(--t-fast);
}
.seg > button:active { transform: translateY(2px); }
.seg > button.on {
  color: var(--brown); border-color: var(--navy-900);
  background: linear-gradient(180deg, #fff08a, #ffc21f 52%, #ff9a1f);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5), inset 0 -3px 0 rgba(150,70,0,.25), 0 3px 0 var(--navy-900);
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
.seg.locked { opacity: .55; pointer-events: none; }
.seg-modes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.seg-modes > button { padding: 0 1px 2px; font-size: 19px; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 2px; }
.seg-modes > button small { font: 400 9.5px/1 var(--f-display); letter-spacing: 0; opacity: .85; }
.seg-modes > button:nth-child(6) { grid-column: 1 / -1; font-size: 15px; }

/* ---- Pestañas ---- */
.tabs { display: flex; gap: 6px; min-width: 0; }
.tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--hit); padding: 0 14px 2px; border-radius: 14px 14px 6px 6px;
  font: 400 16px/1 var(--f-display); letter-spacing: .4px; text-transform: uppercase; color: var(--text-2);
  background: rgba(10,20,56,.5); border: 2px solid rgba(255,255,255,.18);
}
.tab.on { color: var(--brown); background: linear-gradient(180deg, #fff08a, #ffc21f 55%, #ff9a1f); border-color: var(--navy-900); box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 3px 0 var(--navy-900); text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.tab .tab-n { font: 900 11px/1 var(--f-body); background: rgba(10,20,56,.28); border-radius: 9px; padding: 3px 6px; letter-spacing: 0; }

/* ---- Chips, insignias ---- */
.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 2px 9px; border-radius: var(--r-pill); font: 800 var(--fs-xs)/1.1 var(--f-body); background: rgba(10,20,56,.55); border: 1.5px solid rgba(255,255,255,.22); }
.chip canvas { width: 20px; height: 20px; }
.badge { position: absolute; right: -6px; top: -7px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font: 900 12px/1 var(--f-body); color: #fff; background: var(--red); border: 2px solid var(--navy-900); }

/* ---- Contador (− n +) ---- */
.stepper { display: flex; align-items: center; gap: 8px; flex: none; }
.stepper-l { flex: 1; font: 400 15px/1 var(--f-display); letter-spacing: .4px; text-transform: uppercase; color: var(--mango-300); text-shadow: 0 1.5px 0 var(--navy-900); }
.stepper b { min-width: 34px; text-align: center; font: 400 24px/1 var(--f-display); text-shadow: var(--ol-2); }

/* ---- Campo de texto ---- */
.field {
  width: 100%; min-width: 0; min-height: var(--hit); padding: 6px 12px; border-radius: var(--r-md);
  font: 800 18px/1.2 var(--f-body); color: #0d1b4c; background: var(--cream);
  border: 2.5px solid var(--navy-900); box-shadow: inset 0 3px 0 rgba(13,27,76,.14), 0 3px 0 var(--navy-900);
  -webkit-user-select: text; user-select: text; touch-action: manipulation;
}
.field::placeholder { color: rgba(13,27,76,.42); }
.field:focus { outline: 3px solid var(--mango); outline-offset: 1px; }
.field-code { text-transform: uppercase; letter-spacing: 8px; text-align: center; font: 400 24px/1 var(--f-display); padding-left: 20px; }

/* ---- Interruptor de dos opciones (Jugador / CPU) ---- */
.switch2 { display: flex; flex: none; border-radius: 12px; overflow: hidden; background: rgba(10,20,56,.62); box-shadow: inset 0 0 0 2px rgba(255,255,255,.22); }
.switch2 > button { min-width: var(--hit); min-height: var(--hit); padding: 0 8px 1px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; font: 400 12.5px/1 var(--f-display); letter-spacing: .3px; text-transform: uppercase; color: var(--text-3); }
.switch2 > button .ic { width: 15px; height: 15px; }
/* si no cabe en su puesto (lo detecta seats.js): sin iconos y más prieto */
.seats.tight .switch2 > button { padding: 0 6px 1px; font-size: 12px; }
.seats.tight .switch2 > button .ic { display: none; }
.switch2 > button.on[data-k="p"] { color: #05301a; background: linear-gradient(180deg, #a5f5ba, #36c46b); box-shadow: inset 0 2px 0 rgba(255,255,255,.5), inset 0 0 0 2px var(--navy-900); }
.switch2 > button.on[data-k="c"] { color: #fff; background: linear-gradient(180deg, #a996ff, #6a4fe0); box-shadow: inset 0 2px 0 rgba(255,255,255,.4), inset 0 0 0 2px var(--navy-900); }

/* ---- Barra de progreso ---- */
.load-bar { width: min(70vw, 340px); height: 20px; border-radius: 12px; background: var(--navy-900); border: 3px solid var(--navy-900); box-shadow: 0 0 0 2px rgba(255,255,255,.28), 0 6px 14px rgba(4,8,30,.45); overflow: hidden; }

/* ---- Aviso flotante ---- */
#toast {
  position: fixed; left: 50%; bottom: calc(16px + var(--sab)); transform: translateX(-50%); z-index: 90;
  max-width: min(92vw, 520px); padding: 9px 18px 10px; border-radius: var(--r-lg); text-align: center;
  font: 800 var(--fs-sm)/1.25 var(--f-body); color: #fff;
  background: linear-gradient(180deg, #24409c, #101f5a); border: 2.5px solid var(--navy-900);
  box-shadow: inset 0 0 0 1.5px rgba(255,224,102,.75), var(--e-2);
  animation: toast-in var(--t-med) var(--ease-pop) both;
  pointer-events: none;      /* nunca se traga un toque */
}
/* en partida sale arriba: abajo están el mando y los botones del final */
body.playing #toast { bottom: auto; top: calc(8px + var(--sat)); animation-name: toast-in-top; }

/* ---- Botón redondo de sonido ---- */
.tgl { position: relative; width: var(--hit); height: var(--hit); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; color: #fff; background: var(--glass); border: 2px solid var(--glass-line); box-shadow: 0 3px 0 rgba(4,8,30,.4); transition: transform var(--t-press); }
.tgl:active { transform: translateY(2px); }
.tgl.off { color: rgba(255,255,255,.5); }
.tgl.off::after, .tglw.off .ic-wrap::after { content: ""; position: absolute; left: 50%; top: 50%; width: 62%; height: 3px; border-radius: 2px; background: var(--red-300); box-shadow: 0 0 0 1.5px var(--navy-900); transform: translate(-50%, -50%) rotate(-42deg); }
.tglw-row { display: flex; gap: 6px; }
.tglw { position: relative; flex: 1 1 0; min-width: 0; min-height: 48px; padding: 4px 4px 5px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 800 11.5px/1 var(--f-body); color: #fff; background: rgba(10,20,56,.55); border: 2px solid rgba(255,255,255,.3); }
.tglw .ic { width: 20px; height: 20px; }
.tglw.off { color: rgba(255,255,255,.5); border-color: rgba(255,255,255,.14); }
.tglw.off::after { content: ""; position: absolute; left: 50%; top: 15px; width: 26px; height: 3px; border-radius: 2px; background: var(--red-300); box-shadow: 0 0 0 1.5px var(--navy-900); transform: translate(-50%, -50%) rotate(-42deg); }

/* ============================================================ 5. Pantallas */
.screen { position: fixed; inset: 0; z-index: 20; overflow: hidden; }
.screen.sub {
  display: flex; flex-direction: column; gap: 8px;
  padding: calc(8px + var(--sat)) max(12px, var(--sar)) calc(8px + var(--sab)) max(12px, var(--sal));
  background: linear-gradient(180deg, rgba(13,27,76,.72), rgba(7,13,42,.9)), url(assets/ui/bg_soga.webp?v=36f2f0c1d8) center / cover no-repeat var(--navy-800);
  animation: screen-in var(--t-med) var(--ease-out) both;
}

/* ---------- Título ---------- */
#screen-title { background: #2b7fd9; }
.hero, .hero-blur, .hero-fx, .title-shade { position: absolute; inset: 0; }
.hero { overflow: hidden; }
.hero-blur { background: #2b7fd9 center / cover no-repeat; transform: scale(1.08); }
.hero-pan { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: var(--kx, 70%) var(--ky, 55%); animation: hero-drift 26s ease-in-out infinite alternate; will-change: transform; }
.hero-img { position: absolute; left: 0; top: 0; display: block; max-width: none; opacity: 0; transition: opacity .5s ease-out; }
.hero-img.ready { opacity: 1; }
.hero-img.feather { /* difumina los bordes del arte que no llegan al borde de la pantalla */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 var(--ft, 0%), #000 calc(100% - var(--fb, 0%)), transparent 100%), linear-gradient(90deg, transparent 0, #000 var(--fl, 0%), #000 calc(100% - var(--fr, 0%)), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 var(--ft, 0%), #000 calc(100% - var(--fb, 0%)), transparent 100%), linear-gradient(90deg, transparent 0, #000 var(--fl, 0%), #000 calc(100% - var(--fr, 0%)), transparent 100%);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
.hero-fx { pointer-events: none; overflow: hidden; }
.fx { position: absolute; left: 0; top: 0; will-change: transform; opacity: 0; animation: fx-drift var(--d, 14s) linear var(--dl, 0s) infinite; }
.fx i { display: block; width: var(--s, 12px); height: calc(var(--s, 12px) * .72); border-radius: 60% 40% 60% 40%; background: var(--c, #ff6fb1); box-shadow: inset -2px -2px 0 rgba(0,0,0,.12); animation: fx-spin var(--sp, 3.2s) ease-in-out infinite alternate; }
.title-shade { pointer-events: none; }
.title-ui { position: absolute; }
.title-logo { display: block; height: auto; aspect-ratio: 560 / 313; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(4,8,30,.5)); animation: logo-in .8s var(--ease-pop) both, logo-float 5.5s ease-in-out .9s infinite alternate; }
.menu .btn { width: 100%; animation: menu-in .5s var(--ease-pop) both; }
.menu .btn:nth-child(1) { animation-delay: .12s; } .menu .btn:nth-child(2) { animation-delay: .19s; }
.menu .btn:nth-child(3) { animation-delay: .26s; } .menu .btn:nth-child(4) { animation-delay: .33s; }
.menu .btn .ic { width: 1.15em; height: 1.15em; }
.menu .btn > span { white-space: nowrap; }
#btn-play { overflow: hidden; }
#btn-play::before { /* destello que cruza el botón principal */
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 30%; transform: translateX(-160%) skewX(-20deg);
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.7), rgba(255,255,255,0)); animation: shine 4.2s ease-in-out 1.4s infinite; pointer-events: none;
}
#btn-kart-play { overflow: hidden; }
#btn-kart-play::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 30%; transform: translateX(-160%) skewX(-20deg);
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.7), rgba(255,255,255,0)); animation: shine 4.2s ease-in-out 1.4s infinite; pointer-events: none; }
/* selector de juego de la portada: Puntería / ¡A correr! */
.game-pick { flex: none; gap: 6px; padding: 4px; border-radius: 16px; background: rgba(7,13,42,.55); border: 2px solid rgba(255,255,255,.18); animation: menu-in .5s var(--ease-pop) .05s both; }
.game-pick > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--hit); font-size: 16px; text-transform: none; white-space: nowrap; }
.game-pick > button .ic { width: 1.1em; height: 1.1em; flex: none; }
.title-dock .note { text-shadow: 0 1.5px 0 var(--navy-900), 0 0 8px rgba(9,19,58,.9); }
.title-foot { font: 800 var(--fs-2xs)/1.2 var(--f-body); color: rgba(255,255,255,.9); text-align: center; text-shadow: 0 1.5px 0 var(--navy-900), 0 0 8px rgba(9,19,58,.9); letter-spacing: .2px; }
.title-tools { display: flex; gap: 8px; }
/* a) menú en columna a la izquierda (teléfonos anchos) */
#screen-title.t-col .title-shade { background: linear-gradient(90deg, rgba(9,19,58,.66) 0, rgba(9,19,58,.42) 22%, rgba(9,19,58,0) 46%); }
#screen-title.t-col .title-ui { left: max(12px, var(--sal)); top: calc(6px + var(--sat)); bottom: calc(6px + var(--sab)); width: clamp(204px, 27vw, 330px); display: flex; flex-direction: column; justify-content: center; gap: 7px; }
#screen-title.t-col .title-logo { width: 104%; margin: 0 -2%; flex: 0 1 auto; min-height: 0; }
#screen-title.t-col .title-dock, #screen-title.t-col .menu { display: flex; flex-direction: column; gap: 7px; flex: none; }
#screen-title.t-col .menu .btn { justify-content: flex-start; padding-left: 16px; }
#screen-title.t-col .menu .btn > span { flex: 1; text-align: left; }
#screen-title.t-col .title-meta { display: contents; }
#screen-title.t-col .title-tools { position: fixed; right: max(12px, var(--sar)); bottom: calc(10px + var(--sab)); }
/* b) logo arriba y botones en barra inferior (16:9, tabletas) */
#screen-title.t-bar .title-shade { background: linear-gradient(180deg, rgba(9,19,58,0) 60%, rgba(9,19,58,.72) 84%, rgba(7,13,42,.94) 100%); }
#screen-title.t-bar .title-ui, #screen-title.t-port .title-ui { inset: 0; }
#screen-title.t-bar .title-logo { position: absolute; left: max(10px, var(--sal)); top: calc(6px + var(--sat)); width: var(--logo-w, 200px); }
#screen-title.t-bar .title-dock { position: absolute; left: max(12px, var(--sal)); right: max(12px, var(--sar)); bottom: calc(8px + var(--sab)); display: flex; flex-direction: column; gap: 5px; }
#screen-title.t-bar .menu { display: flex; gap: 8px; }
#screen-title.t-bar .menu .btn { flex: 1 1 auto; width: auto; min-height: clamp(48px, 8vh, 66px); padding: 0 8px 3px; gap: 7px; font-size: clamp(14px, 2.15vw, 24px); border-radius: var(--r-md); }
#screen-title.t-bar .title-meta { display: contents; }
#screen-title.t-bar .title-foot { order: -1; text-align: right; }
#screen-title.t-bar .title-dock .note { order: -1; text-align: left; }
#screen-title.t-bar .title-tools { position: fixed; right: max(12px, var(--sar)); top: calc(8px + var(--sat)); }
/* si en su sitio taparían a la familia (lo decide js/ui/title.js): en columna y/o arriba */
#screen-title.tools-v .title-tools { flex-direction: column; }
#screen-title.t-col.tools-top .title-tools { bottom: auto; top: calc(8px + var(--sat)); }
/* c) vertical: póster, logo en el cielo y botones abajo */
#screen-title.t-port .title-shade { background: linear-gradient(180deg, rgba(9,19,58,.12) 0, rgba(9,19,58,0) 30%, rgba(9,19,58,0) 56%, rgba(9,19,58,.82) 76%, rgba(7,13,42,.97) 100%); }
#screen-title.t-port .title-logo { position: absolute; left: 0; right: 0; top: calc(8px + var(--sat)); margin: 0 auto; width: var(--logo-w, 70vw); }
#screen-title.t-port .title-dock { position: absolute; left: max(14px, var(--sal)); right: max(14px, var(--sar)); bottom: calc(10px + var(--sab)); display: flex; flex-direction: column; gap: 8px; }
#screen-title.t-port .menu { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
#screen-title.t-port .menu .btn:nth-child(-n+2) { grid-column: 1 / -1; }
#screen-title.t-port .menu .btn:nth-child(n+3) { font-size: 15px; padding: 0 6px 3px; gap: 6px; }
#screen-title.t-port .title-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#screen-title.t-port .title-foot { flex: 1; text-align: left; }

/* ---------- Preparar partida local ---------- */
.setup-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: clamp(254px, 31%, 340px) minmax(0, 1fr); gap: 8px; }
#setup-mode { gap: 7px; }
.cpu-row { display: flex; align-items: center; gap: 6px; flex: none; }
.cpu-cap { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; font: 400 10px/1 var(--f-display); letter-spacing: .4px; color: var(--mango-300); text-shadow: 0 1px 0 var(--navy-900); }
.cpu-cap .ic { width: 22px; height: 22px; }
.cpu-row .seg { flex: 1; }
.cpu-row .seg { gap: 4px; }
.cpu-row .seg > button { font-size: 12.5px; letter-spacing: 0; padding: 0 1px 2px; }

/* escenario: tarjeta grande con flechas (toca la imagen para verlos todos) */
.stage { position: relative; flex: 1 1 auto; min-height: 76px; border-radius: 14px; overflow: hidden; border: 2.5px solid var(--navy-900); background: var(--navy-900); box-shadow: 0 3px 0 var(--navy-900); }
.stage-art { position: absolute; inset: 0; display: block; }
.stage-art > img, .stage-art > canvas, .lvl > img, .lvl > canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.stage-pic { position: absolute; left: 54px; right: 54px; top: 0; bottom: 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; }
.stage-all { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 4px; border-radius: var(--r-pill); font: 400 11.5px/1 var(--f-display); letter-spacing: .3px; text-transform: uppercase; color: #fff; background: rgba(10,20,56,.72); border: 1.5px solid rgba(255,255,255,.4); }
.stage-all .ic { width: 12px; height: 12px; }
.stage-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font: 400 16px/1.05 var(--f-display); letter-spacing: .4px; text-transform: uppercase; text-align: center; text-shadow: var(--ol-2); background: linear-gradient(180deg, rgba(7,13,42,0), rgba(7,13,42,.86)); pointer-events: none; }
.stage-nav { position: absolute; top: 50%; width: var(--hit); height: var(--hit); margin-top: -22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--brown); background: linear-gradient(180deg, #fff08a, #ffc21f 55%, #ff9a1f); border: 2.5px solid var(--navy-900); box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 3px 0 var(--navy-900); }
.stage-nav:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,.4), 0 1px 0 var(--navy-900); }
.stage-nav.prev { left: 5px; } .stage-nav.next { right: 5px; }
.rand-art { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; background: radial-gradient(circle at 30% 25%, #ffb347, rgba(255,179,71,0) 55%), radial-gradient(circle at 75% 80%, #ff5fa2, rgba(255,95,162,0) 55%), linear-gradient(135deg, #7b3ff2, #2a6fe8 60%, #19c2b0); }
.rand-art .ic { width: 34%; height: auto; aspect-ratio: 1; max-height: 70%; filter: drop-shadow(0 3px 0 rgba(10,20,56,.5)); }

/* rejilla de escenarios (hoja "todos los escenarios" y ajustes de la sala) */
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; align-content: start; }
.levels-body { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: none; padding: 4px 2px; }
.levels-body > .levels { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.lvl { position: relative; aspect-ratio: 16 / 10; min-height: var(--hit); border-radius: 14px; overflow: hidden; border: 3px solid var(--navy-900); background: var(--navy-900); box-shadow: 0 3px 0 var(--navy-900); transition: transform var(--t-press); }
.lvl:active { transform: translateY(2px); }
.lvl-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 6px 5px; font: 400 14.5px/1.05 var(--f-display); letter-spacing: .3px; text-transform: uppercase; text-align: center; text-shadow: var(--ol-2); background: linear-gradient(180deg, rgba(7,13,42,0), rgba(7,13,42,.88)); }
.lvl.on { border-color: var(--mango); box-shadow: 0 0 0 3px rgba(255,194,31,.5), 0 3px 0 var(--navy-900); }
.lvl.on::after { content: ""; position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--mango) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a2500' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.8l4 4L18 8'/%3E%3C/svg%3E") center / 16px no-repeat; border: 2px solid var(--navy-900); }
.levels.locked { pointer-events: none; }

/* puestos (la distribución y el tamaño del retrato los calcula js/ui/seats.js según el sitio que haya) */
#setup-seats { padding: 6px; }
.seats { flex: 1; min-height: 0; display: grid; gap: 4px 8px; align-content: start; }
.seats.sides { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); align-content: stretch; }
.seats.ffa { grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-template-rows: auto; grid-auto-rows: var(--row-h, auto); }
.seats-head { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; min-height: var(--hit); }
.seats-head.ffa-head { grid-template-columns: minmax(0, 1fr) auto; }
.side-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 0; }
.side-title { display: flex; align-items: center; justify-content: center; min-height: 30px; padding: 2px 10px 4px; border-radius: 12px; font: 400 17px/1 var(--f-display); letter-spacing: .5px; text-transform: uppercase; text-align: center; color: #fff; text-shadow: var(--ol-2); background: var(--tc); border: 2.5px solid var(--navy-900); box-shadow: inset 0 2px 0 rgba(255,255,255,.35), inset 0 -3px 0 rgba(0,0,0,.18); }
.side-title.all { --tc: var(--violet); }
.vs { padding: 0 4px; font: 400 20px/1 var(--f-display); color: var(--mango-300); text-shadow: var(--ol-2); }
.seat {
  position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 48px; padding: 0 5px 0 0;
  border-radius: 14px; background: rgba(10,20,56,.55); border: 2px solid var(--tc, rgba(255,255,255,.3));
  background: linear-gradient(90deg, color-mix(in srgb, var(--tc, #fff) 34%, rgba(10,20,56,.7)), rgba(10,20,56,.5)); border-color: color-mix(in srgb, var(--tc, #fff) 75%, #0a1438);
}
.seats.sides .seat { flex: 1 1 0; max-height: 190px; }
.seat .ph { position: relative; width: var(--ph, 44px); height: var(--ph, 44px); min-width: var(--hit); min-height: var(--hit); flex: none; border-radius: 11px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.85); font-size: 20px; background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.42), rgba(255,255,255,.06) 70%); }
.seat .ph img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; display: block; pointer-events: none; }
.seat .ph[disabled] { cursor: default; }
.seat .ph.sit { color: var(--brown); background: linear-gradient(180deg, #fff08a, #ffc21f 55%, #ff9a1f); border: 2px solid var(--navy-900); box-shadow: inset 0 2px 0 rgba(255,255,255,.5); }
.seat .ph .ph-swap { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; border-radius: 8px 0 9px 0; background: var(--mango); color: var(--brown); display: flex; align-items: center; justify-content: center; }
.seat .ph .ph-swap .ic { width: 12px; height: 12px; }
.seat-body { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; }
.seat .tx { align-self: stretch; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.seat .tx b { display: flex; align-items: center; gap: 4px; min-width: 0; font: 400 15px/1.08 var(--f-display); letter-spacing: .3px; white-space: nowrap; text-shadow: 0 1.5px 0 rgba(7,13,42,.7); }
.seat .tx b > span, .seat .tx small > span { flex: none; }      /* si no cabe, fitText encoge la letra o deja partir (clase wrap) */
.seat .tx b.wrap > span, .seat .tx small.wrap > span { flex: 0 1 auto; min-width: 0; }
.seat .tx b .ic { width: 14px; height: 14px; flex: none; color: var(--mango-300); }
.seat .tx small { display: flex; align-items: center; gap: 3px; min-width: 0; font: 800 11px/1.1 var(--f-body); color: var(--text-2); white-space: nowrap; }
.seat .tx b.wrap, .seat .tx small.wrap { white-space: normal; overflow-wrap: anywhere; }
.seat .act { flex: none; }
.seat.me { border-color: var(--mango); box-shadow: 0 0 0 2px rgba(255,194,31,.38); }
.seat.free { border-style: dashed; background: rgba(10,20,56,.4); }
.seat.away { opacity: .72; }
/* mando de un solo botón (filas compactas) */
.ctl1 { flex: none; width: 54px; min-height: var(--hit); border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font: 400 9.5px/1 var(--f-display); letter-spacing: .2px; text-transform: uppercase; border: 2px solid var(--navy-900); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.45); }
.ctl1 .ic { width: 17px; height: 17px; }
.ctl1.p { color: #05301a; background: linear-gradient(180deg, #a5f5ba, #36c46b); }
.ctl1.c { color: #fff; background: linear-gradient(180deg, #a996ff, #6a4fe0); }
.ctl1:active { transform: translateY(2px); }
/* a) fila compacta: retrato · nombre · mando */
.seats.lay-row .seat-body { flex-direction: row; align-items: center; gap: 6px; }
.seats.lay-row .seat .tx { flex: 1 1 0; align-self: center; }
/* a') columnas muy estrechas: el nombre a todo lo ancho, encima del mando */
.seats.lay-row.stack .seat { min-height: 68px; }
.seats.lay-row.stack .seat-body { flex-direction: column; align-items: stretch; justify-content: center; gap: 2px; }
.seats.lay-row.stack .seat .tx { flex: none; align-self: stretch; }
.seats.lay-row.stack .ctl1 { align-self: flex-start; width: auto; min-width: 54px; flex-direction: row; gap: 4px; padding: 0 8px; }
/* b) fila ancha: retrato grande y, a su derecha, nombre encima del interruptor */
.seats.lay-wide .seat { gap: 10px; }
.seats.lay-wide .seat .tx b { font-size: 18px; }
/* c) tarjeta: retrato arriba, nombre y mando debajo */
.seats.lay-card .seat { flex-direction: column; justify-content: center; gap: 6px; padding: 6px; max-height: none; }
.seats.lay-card .seat .ph { border-radius: 16px; }
.seats.lay-card .seat-body { flex: none; align-self: stretch; align-items: center; gap: 6px; }
.seats.lay-card .seat .tx { align-items: center; text-align: center; }
.seats.lay-card .seat .tx b { font-size: 17px; justify-content: center; max-width: 100%; }
.seats.lay-card .seat .tx small { justify-content: center; }

/* ---------- En línea: entrada ---------- */
.online-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: clamp(250px, 34%, 360px) minmax(0, 1fr); gap: 8px; }
#online-me { gap: 7px; }
.join-row { display: flex; gap: 8px; align-items: stretch; flex: none; }
.join-row .field { flex: 1; }
.join-row .btn { flex: none; }
.room-list { display: flex; flex-direction: column; gap: 6px; }
.room { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 4px 6px 4px 12px; border-radius: 14px; background: rgba(10,20,56,.5); border: 2px solid rgba(255,255,255,.18); }
.room-code-s { font: 400 22px/1 var(--f-display); letter-spacing: 3px; color: var(--mango-300); text-shadow: var(--ol-2); flex: none; }
.room-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.room-tx b { font: 900 14px/1.1 var(--f-body); overflow-wrap: anywhere; }
.room-tx span { font: 800 12px/1.1 var(--f-body); color: var(--text-2); }
.room-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; flex: 1; padding: 14px; text-align: center; font: 800 var(--fs-sm)/1.3 var(--f-body); color: var(--text-2); }
.room-empty .ic { width: 40px; height: 40px; color: var(--mango-300); }

/* ---------- En línea: sala de espera ---------- */
.room-code-box { display: flex; align-items: center; justify-content: center; gap: 8px; text-shadow: none; }
.room-code-box .btn { flex: none; }
.room-code-l { font: 400 clamp(16px, 2.6vw, 22px)/1 var(--f-display); text-shadow: var(--ol-2); letter-spacing: .5px; }
.room-code { font: 400 clamp(26px, 4.4vw, 38px)/1 var(--f-display); letter-spacing: 5px; padding: 2px 6px 4px 12px; border-radius: 12px; color: var(--mango-300); background: var(--navy-900); border: 2px solid rgba(255,224,102,.75); text-shadow: 0 2px 0 rgba(0,0,0,.4); -webkit-user-select: text; user-select: text; }
.lobby-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: clamp(226px, 28%, 320px) minmax(0, 1fr); gap: 8px; }
.lobby-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.mychar { flex: 1 1 auto; }
.mychar-btn { flex: 1; min-height: 84px; display: flex; align-items: stretch; gap: 10px; padding: 5px 8px 5px 5px; border-radius: 14px; text-align: left; background: linear-gradient(180deg, rgba(255,224,102,.28), rgba(255,154,31,.16)); border: 2.5px solid var(--mango); box-shadow: 0 3px 0 var(--navy-900); transition: transform var(--t-press); }
.mychar-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy-900); }
.mychar-pose { position: relative; flex: none; align-self: stretch; width: clamp(64px, 38%, 150px); min-height: 72px; border-radius: 11px; overflow: hidden; background: radial-gradient(circle at 50% 100%, rgba(255,224,102,.55), rgba(255,224,102,0) 62%), linear-gradient(180deg, #58b7ff, #2a6fe0); border: 2px solid var(--navy-900); }
.mychar-pose canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mychar-btn.empty .mychar-pose::after { content: "?"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 400 44px/1 var(--f-display); color: #fff; text-shadow: var(--ol-2); }
.mychar-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.mychar-tx b { font: 400 19px/1.05 var(--f-display); letter-spacing: .3px; text-shadow: var(--ol-1); white-space: nowrap; }
.mychar-tx b.wrap { white-space: normal; overflow-wrap: anywhere; }
.mychar-cta { display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; padding: 5px 10px 6px; border-radius: 10px; font: 400 13.5px/1 var(--f-display); letter-spacing: .3px; text-transform: uppercase; color: var(--brown); background: linear-gradient(180deg, #fff08a, #ffc21f 55%, #ff9a1f); border: 2px solid var(--navy-900); box-shadow: 0 2px 0 var(--navy-900); }
.mychar-cta .ic { width: 14px; height: 14px; }
.roominfo { flex: none; }
.roominfo-row { display: flex; align-items: center; gap: 8px; }
.roominfo-thumb { position: relative; width: 84px; aspect-ratio: 16 / 10; flex: none; border-radius: 10px; overflow: hidden; border: 2px solid var(--navy-900); background: var(--navy-900); }
.roominfo-thumb > img, .roominfo-thumb > canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.roominfo-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font: 800 12px/1.15 var(--f-body); color: var(--text-2); }
.roominfo-tx b { font: 400 14.5px/1.05 var(--f-display); letter-spacing: .3px; text-transform: uppercase; color: #fff; text-shadow: 0 1.5px 0 var(--navy-900); }
.room-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: clamp(254px, 34%, 340px) minmax(0, 1fr); gap: 8px; }

/* ---------- Personajes (galería y selector) ---------- */
.chars-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(214px, 28%, 320px); gap: 8px; }
.cgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(84px, 1fr); gap: 7px; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: none; padding: 2px 2px 5px; }
.cgrid::-webkit-scrollbar { display: none; }
.cg {
  position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 1px; padding: 3px 4px 5px; border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, #4f7ff0 0%, #2b55c8 60%, #1b3a9a 100%); border: 2.5px solid var(--navy-900);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 4px 0 var(--navy-900); transition: transform var(--t-press), box-shadow var(--t-press);
}
.cg::before { content: ""; position: absolute; left: -20%; right: -20%; top: -30%; height: 80%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255,255,255,.4), rgba(255,255,255,0)); pointer-events: none; }
.cg img { position: relative; flex: 1 1 0; min-height: 0; width: 100%; object-fit: contain; object-position: center bottom; display: block; pointer-events: none; filter: drop-shadow(0 3px 0 rgba(10,20,56,.35)); }
.cg-name { position: relative; flex: none; max-width: 100%; font: 400 14.5px/1.08 var(--f-display); letter-spacing: .3px; text-shadow: var(--ol-1); white-space: nowrap; }
.cg-name.wrap { white-space: normal; overflow-wrap: anywhere; text-align: center; }
.cg:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 1px 0 var(--navy-900); }
.cg.on { background: linear-gradient(180deg, #fff08a 0%, #ffc21f 55%, #ff9a1f 100%); box-shadow: inset 0 2px 0 rgba(255,255,255,.6), 0 4px 0 var(--navy-900), 0 0 0 3px rgba(255,224,102,.6); }
.cg-tag { position: absolute; left: 4px; top: 4px; z-index: 1; display: none; align-items: center; gap: 3px; padding: 2px 6px 3px; border-radius: 8px; font: 900 10.5px/1 var(--f-body); color: #fff; background: var(--navy-900); border: 1.5px solid rgba(255,255,255,.5); }
.cg-tag .ic { width: 11px; height: 11px; flex: none; }
.cg-tag { max-width: calc(100% - 8px); text-align: left; overflow-wrap: anywhere; }
.cg-tag.long { font-size: 9px; letter-spacing: -.1px; }
.cg.taken .cg-tag { display: inline-flex; }
.cg.taken img { filter: grayscale(.75) brightness(.8); }
.cg.taken.locked { pointer-events: none; }
.cg.mine .cg-tag { display: inline-flex; background: var(--mango); color: var(--brown); border-color: var(--navy-900); }
.cdetail { align-items: stretch; gap: 6px; padding: 8px; }
.cpose { position: relative; flex: 1 1 0; min-height: 84px; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 50% 100%, rgba(255,224,102,.55), rgba(255,224,102,0) 62%), linear-gradient(180deg, #58b7ff, #2a6fe0); border: 2.5px solid var(--navy-900); }
.cpose::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: 5%; height: 9%; border-radius: 50%; background: rgba(10,20,56,.3); }
.cpose canvas { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; display: block; }
.cinfo { flex: none; display: flex; flex-direction: column; gap: 5px; align-items: stretch; text-align: center; }
.cname { font: 400 24px/1.05 var(--f-display); letter-spacing: .4px; color: var(--mango-300); text-shadow: var(--ol-2); overflow-wrap: anywhere; }
.cquote { font: 800 12.5px/1.2 var(--f-body); color: var(--text-2); font-style: italic; }
.cactions { display: flex; gap: 6px; justify-content: center; }
.cactions .btn { flex: 1; }
.rename { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.rename .field { grid-column: 1 / -1; text-align: center; }
.rename #rename-reset { grid-column: 1 / -1; font-size: 14px; }
.cinfo.renaming .cname { display: none; }

/* ---------- Ayuda ---------- */
.help-body { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-content: start; }
.help-body::-webkit-scrollbar { display: none; }
.help-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.help-item { display: flex; align-items: center; gap: 9px; padding: 6px 10px 6px 6px; border-radius: 14px; background: linear-gradient(180deg, rgba(34,66,160,.9), rgba(15,29,82,.92)); border: 2px solid var(--navy-900); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.14); }
.help-item p { font: 700 12.5px/1.28 var(--f-body); color: var(--text); }
.help-item b { font-weight: 900; color: var(--mango-300); }
.help-item > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.help-ic { flex: none; width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; gap: 0; font-size: 21px; color: var(--brown); background: linear-gradient(180deg, #fff08a, #ffc21f 55%, #ff9a1f); border: 2.5px solid var(--navy-900); box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 3px 0 var(--navy-900); }
.help-ic .ic + .ic { margin-left: -5px; }
.help-ic .ic:first-child:not(:last-child) { margin-left: -2px; }
.help-fire { font: 400 18px/1 var(--f-display); color: #fff; background: radial-gradient(circle at 35% 28%, #ff9c7a, #ef3b47 58%, #a51322); text-shadow: 0 1.5px 0 var(--red-700); border-radius: 50%; }
.help-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.help-chips canvas { width: 28px; height: 28px; padding: 2px; border-radius: 9px; background: linear-gradient(180deg, #fffdf2, #ffe9a6); border: 1.5px solid var(--navy-900); }
@media (pointer: coarse) { .help-keys { display: none; } }
.help-keys { padding: 6px 10px; border-radius: 12px; font: 800 12px/1.25 var(--f-body); color: var(--text-2); background: rgba(10,20,56,.5); border: 2px dashed rgba(255,255,255,.2); }
.help-keys b { color: var(--mango-300); }

/* ---------- Pausa ---------- */
.pause { width: min(100%, 560px); }
.pause-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.pause-grid > * { min-width: 0; }
.pause-grid .btn { width: 100%; }

/* ---------- Fin de partida ---------- */
.overlay.end { background: linear-gradient(180deg, rgba(9,19,58,.62), rgba(7,13,42,.9)), url(assets/ui/bg_poster.webp?v=36f2f0c1d8) center / cover no-repeat var(--navy-800); overflow: hidden; }
.overlay.end::before { /* rayos de luz detrás de los ganadores */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg at 50% 46%, rgba(255,224,102,.17) 0deg 9deg, rgba(255,224,102,0) 9deg 18deg);
  -webkit-mask-image: radial-gradient(ellipse 75% 85% at 50% 46%, #000 0, rgba(0,0,0,.5) 45%, transparent 100%); mask-image: radial-gradient(ellipse 75% 85% at 50% 46%, #000 0, rgba(0,0,0,.5) 45%, transparent 100%);
  animation: rays 3.6s ease-in-out infinite alternate;
}
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.end-box { position: relative; width: 100%; max-width: 820px; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.end-kicker { font: 400 clamp(15px, 2.4vw, 20px)/1 var(--f-display); letter-spacing: 3px; text-transform: uppercase; color: var(--mango-300); text-shadow: var(--ol-2); animation: menu-in .5s var(--ease-pop) both; }
.end-title { font: 400 clamp(30px, 6.4vw, 60px)/1 var(--f-display); letter-spacing: 1px; text-transform: uppercase; color: var(--wc, #fff); text-shadow: var(--ol-3); overflow-wrap: anywhere; animation: title-pop .7s var(--ease-pop) .1s both; }
.end-stage { display: flex; align-items: flex-end; justify-content: center; gap: 6px; flex: 0 1 auto; min-height: 0; max-width: 100%; padding: 0 6px 6px; border-bottom: 5px solid rgba(255,224,102,.75); border-radius: 0 0 40px 40px / 0 0 14px 14px; }
.end-who { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 0; flex: 0 1 auto; animation: who-in .6s var(--ease-pop) both; }
.end-who canvas { display: block; width: var(--pw, 96px); height: var(--pwh, 96px); }
.end-who span { max-width: 100%; font: 400 13.5px/1.1 var(--f-display); letter-spacing: .3px; text-shadow: var(--ol-1); white-space: nowrap; }
.end-who span.wrap { white-space: normal; overflow-wrap: anywhere; }
.end-who.out canvas { filter: grayscale(1) brightness(.72); }
.end-who.out span { color: var(--text-3); }
.end-mvp { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 3px 14px 3px 4px; border-radius: var(--r-pill); font: 800 var(--fs-sm)/1.15 var(--f-body); background: rgba(10,20,56,.72); border: 2px solid rgba(255,224,102,.8); max-width: 100%; }
.end-mvp:empty { display: none; }
.end-mvp img { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 50% 30%, #8fd0ff, #2a6fe0); border: 2px solid var(--mango); object-fit: contain; flex: none; }
.end-mvp b { color: var(--mango-300); font-weight: 900; }
.end-mvp .ic { color: var(--mango); width: 18px; height: 18px; }
.end-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 2px; }
.end-note { max-width: 520px; padding: 0 8px; color: #fff; text-shadow: 0 1.5px 0 var(--navy-900), 0 0 8px rgba(9,19,58,.9); }

/* ============================================================ 6. Mandos de juego */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud button, #weapon-panel { pointer-events: auto; }
.hud-top { position: absolute; top: calc(8px + var(--sat)); right: calc(10px + var(--sar)); display: flex; align-items: center; gap: 8px; }
.hbtn { width: var(--hit); height: var(--hit); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 19px; color: #fff; background: var(--glass); border: 2px solid var(--glass-line); box-shadow: 0 3px 0 rgba(4,8,30,.4); transition: transform var(--t-press); }
.hbtn:active { transform: translateY(2px); }
.net { display: flex; align-items: center; gap: 5px; min-height: 26px; padding: 2px 10px 3px 8px; border-radius: var(--r-pill); font: 900 11.5px/1 var(--f-body); white-space: nowrap; color: #b9f5cd; background: rgba(10,20,56,.84); border: 2px solid rgba(54,196,107,.7); }
.net .ic { width: 15px; height: 15px; }
/* sin conexión: rojo macizo con letras blancas (siempre legible); solo late el borde */
.net.bad { color: #fff; background: var(--red); border-color: #fff; animation: net-pulse 1.1s ease-in-out infinite; }
/* en apaisado cuelga debajo de los botones, por debajo también de los retratos del panel de equipo
   (la fila de arriba es del HUD del canvas, que en pantallas estrechas llega hasta los botones) */
@media (min-width: 560px) { .hud-top .net { position: absolute; top: calc(100% + 18px); right: 0; } }
.turn-tag { position: absolute; left: 50%; bottom: calc(14px + var(--sab)); transform: translateX(-50%); max-width: min(64vw, 520px); padding: 7px 16px 8px; border-radius: var(--r-pill); text-align: center; font: 800 var(--fs-sm)/1.2 var(--f-body); background: var(--glass); border: 2px solid var(--glass-line); }

.pad { position: absolute; bottom: calc(10px + var(--sab)); display: flex; gap: 9px; align-items: flex-end; transition: opacity var(--t-fast); }
#pad-left { left: calc(12px + var(--sal)); }
#pad-right { right: calc(12px + var(--sar)); }
.pad-col { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.pad-cap { font: 900 9.5px/1 var(--f-body); letter-spacing: .8px; text-transform: uppercase; color: #fff; text-shadow: 0 1px 0 var(--navy-900), 0 0 6px rgba(10,20,56,.9); margin: -4px 0; }
.ctl {
  --s: clamp(50px, 14.4vh, 64px);
  position: relative; width: var(--s); height: var(--s); border-radius: 30%; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: calc(var(--s) * .44); color: #fff; background: rgba(10,20,56,.5); border: 2.5px solid rgba(255,255,255,.62);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 0 3px 0 rgba(4,8,30,.4); transition: transform var(--t-press), background var(--t-press);
}
.ctl.on { background: rgba(255,194,31,.86); border-color: #fff; color: var(--brown); transform: scale(.93); }
.ctl-move { --s: clamp(60px, 18.6vh, 80px); border-radius: 50%; }
.ctl-act { width: calc(var(--s) * 1.24); border-radius: 18px; }
.ctl-act .ic { width: calc(var(--s) * .4); height: calc(var(--s) * .4); }
.ctl-lbl { font: 900 9px/1 var(--f-body); letter-spacing: .2px; text-transform: uppercase; white-space: nowrap; }
.ctl-fire {
  --s: clamp(74px, 22.5vh, 96px); border-radius: 50%; border-color: #fff;
  background: radial-gradient(circle at 35% 28%, #ff9c7a, #ef3b47 58%, #a51322); box-shadow: inset 0 3px 0 rgba(255,255,255,.35), inset 0 -6px 0 rgba(90,0,10,.3), 0 5px 0 rgba(4,8,30,.5), 0 10px 16px rgba(4,8,30,.4);
}
.fire-lbl { font: 400 calc(var(--s) * .215)/1 var(--f-display); letter-spacing: .5px; text-shadow: 0 2px 0 var(--red-700); }
.ctl-fire.on { background: radial-gradient(circle at 35% 28%, #fff6b8, #ffc21f 58%, #f07a00); color: var(--brown); }
.ctl-fire.on .fire-lbl { text-shadow: 0 1.5px 0 rgba(255,255,255,.5); }
.ctl-weapon { --s: clamp(60px, 17.4vh, 74px); border-radius: 26%; padding-top: 2px; color: #0d1b4c; background: linear-gradient(180deg, #fffdf2, #ffe9a6); border-color: var(--mango); box-shadow: inset 0 2px 0 #fff, 0 3px 0 rgba(4,8,30,.5); }
.ctl-weapon canvas { width: 62%; height: 62%; flex: none; }
.ctl-weapon .ctl-lbl { max-width: calc(100% - 8px); font-size: 9.5px; color: #0d1b4c; }
.ctl-weapon:active { transform: scale(.94); }
#hud.cpu .pad, #hud.cpu #btn-center { opacity: 0; pointer-events: none; }
#hud.cpu .pad button { pointer-events: none; }

#weapon-panel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: max(6px, var(--sat)) max(8px, var(--sar)) max(6px, var(--sab)) max(8px, var(--sal)); background: rgba(6,10,32,.6); }
.wp { width: min(100%, 640px); max-height: 100%; display: flex; flex-direction: column; gap: 7px; padding: 8px 10px 10px; border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(34,66,160,.97), rgba(15,29,82,.98)); border: 2.5px solid var(--navy-900); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.16), var(--e-3); animation: pop-in var(--t-med) var(--ease-pop) both; }
.wp-head { display: flex; align-items: center; gap: 8px; flex: none; }
.wp-head .tabs { flex: 1; }
.wp-extra { display: flex; flex: none; }
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: none; padding: 7px 5px 5px 1px; }
.wgrid::-webkit-scrollbar { display: none; }
.wgrid[data-tab="arma"] .wbtn:not([data-cat="arma"]), .wgrid[data-tab="habilidad"] .wbtn:not([data-cat="habilidad"]) { display: none; }
.wbtn {
  position: relative; min-width: 0; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 3px 3px 5px; border-radius: 14px;
  color: #0d1b4c; background: linear-gradient(180deg, #fffdf2, #ffeeb8); border: 2.5px solid var(--navy-900); box-shadow: inset 0 2px 0 #fff, 0 3px 0 var(--navy-900); transition: transform var(--t-press);
}
.wbtn:active { transform: translateY(2px); }
.wbtn canvas { width: clamp(34px, 10.5vh, 46px); height: clamp(34px, 10.5vh, 46px); flex: none; }
.wbtn .wn { max-width: 100%; font: 400 12.5px/1.02 var(--f-display); letter-spacing: .2px; text-transform: uppercase; white-space: nowrap; }
.wbtn .wn.wrap { white-space: normal; overflow-wrap: anywhere; text-align: center; }
.wbtn .wa { position: absolute; right: -5px; top: -6px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font: 900 11.5px/1 var(--f-body); color: #fff; background: var(--red); border: 2px solid var(--navy-900); }
/* "en uso" (propulsores encendidos): punto verde en vez del contador */
.wbtn .wa.live, .badge.live { min-width: 20px; width: 20px; height: 20px; padding: 0; background: var(--green); }
.wbtn .wa.live::after, .badge.live::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.wbtn.on { background: linear-gradient(180deg, #fff08a, #ffc21f 55%, #ff9a1f); box-shadow: inset 0 2px 0 rgba(255,255,255,.7), 0 3px 0 var(--navy-900), 0 0 0 3px rgba(255,224,102,.65); }
.wbtn.empty { filter: grayscale(.9) brightness(.82); opacity: .6; }
.wbtn-skip { flex-direction: row; gap: 5px; min-height: var(--hit); padding: 0 12px 2px 8px; color: #fff; background: linear-gradient(180deg, #8a9bd0, #56679f); box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 3px 0 var(--navy-900); }
.wbtn-skip canvas { width: 26px; height: 26px; }
.wbtn-skip .wn { font-size: 14px; text-shadow: 0 1.5px 0 rgba(10,20,56,.6); }
.wbtn-skip.on { color: var(--brown); }
.wbtn-skip.on .wn { text-shadow: none; }
.wp-detail { display: flex; align-items: center; gap: 10px; flex: none; min-height: 56px; padding: 5px 6px 5px 8px; border-radius: 14px; background: rgba(10,20,56,.55); border: 2px solid rgba(255,255,255,.16); }
.wp-detail canvas { width: 44px; height: 44px; flex: none; border-radius: 12px; background: linear-gradient(180deg, #fffdf2, #ffe9a6); border: 2px solid var(--navy-900); }
.wp-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.wp-info b { font: 400 17px/1.05 var(--f-display); letter-spacing: .3px; color: var(--mango-300); text-shadow: 0 1.5px 0 var(--navy-900); }
.wp-info span { font: 700 12.5px/1.22 var(--f-body); color: var(--text); }
.wp-info .wp-hint { font: 800 12px/1.2 var(--f-body); font-style: normal; color: var(--mango-300); }
.wp-detail .btn { flex: none; }

/* ============================================================ 7. Avisos */
#level-loading { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(6,10,32,.5); }
.ll-card { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: min(80vw, 260px); max-width: 92vw; padding: 16px 22px 18px; border-radius: var(--r-xl); text-align: center; background: linear-gradient(180deg, rgba(34,66,160,.97), rgba(15,29,82,.98)); border: 2.5px solid var(--navy-900); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.16), var(--e-3); animation: pop-in var(--t-med) var(--ease-pop) both; }
.ll-spin { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #fff08a, #ffc21f 45%, #ff8a1f 78%, #e8501a); border: 3px solid var(--navy-900); box-shadow: inset -4px -5px 0 rgba(160,40,0,.22); position: relative; animation: mango-bounce .7s ease-in-out infinite alternate; }
.ll-spin::after { content: ""; position: absolute; left: 50%; top: -9px; width: 16px; height: 9px; margin-left: -1px; border-radius: 9px 0 9px 0; background: var(--green); border: 2.5px solid var(--navy-900); }
.ll-text { font: 400 var(--fs-lg)/1.1 var(--f-display); letter-spacing: .4px; text-shadow: var(--ol-2); }
.ll-bar { width: 100%; height: 16px; }
.ll-fill { height: 100%; width: 100%; border-radius: 8px; background: linear-gradient(#ffe680, #ffc21f 45%, #ff9a1f); transform-origin: 0 50%; transition: transform .2s ease-out; }
.ll-fill.busy { background: repeating-linear-gradient(-45deg, #ffc21f 0 12px, #ff9a1f 12px 24px); background-size: 34px 100%; animation: stripes .7s linear infinite; }

#rotate-hint { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; padding: 24px; text-align: center; background: linear-gradient(180deg, rgba(13,27,76,.94), rgba(7,13,42,.97)); }
.rot-phone { font-size: 76px; color: var(--mango-300); animation: rot 2s ease-in-out infinite; filter: drop-shadow(0 4px 0 var(--navy-900)); }
.rot-text { font: 400 var(--fs-xl)/1.15 var(--f-display); letter-spacing: .4px; text-shadow: var(--ol-2); }

/* ============================================================ 8. Tamaños */
/* teléfono apaisado bajo */
@media (orientation: landscape) and (max-height: 380px) {
  .screen.sub, .sheet { padding-top: calc(6px + var(--sat)); padding-bottom: calc(6px + var(--sab)); gap: 6px; }
  .seats { row-gap: 2px; } .side-col { gap: 2px; }
}
@media (orientation: landscape) and (max-height: 400px) {
  .btn-xl { min-height: 48px; font-size: 20px; }
  .btn-lg { min-height: 44px; font-size: 16.5px; }
  #screen-title.t-col .title-ui, #screen-title.t-col .title-dock, #screen-title.t-col .menu { gap: 6px; }
  .panel { padding: 10px 14px; gap: 8px; }
  .panel-title { font-size: var(--fs-xl); }
  .help-item p { font-size: 12px; line-height: 1.22; }
  .help-ic { width: 44px; height: 44px; }
  .end-actions .btn-xl { min-height: 46px; }
}
/* apaisado estrecho: la barra de la sala prescinde de la etiqueta para que quepa todo */
@media (orientation: landscape) and (max-width: 720px) {
  #screen-lobby .room-code-l { display: none; }
  #screen-lobby .room-code { letter-spacing: 4px; }
}
/* teléfonos de 320 px de alto o de ancho (iPhone SE de 1.ª generación, o los de 4,7" con la pantalla ampliada) */
@media (orientation: landscape) and (max-width: 620px) {
  #screen-title.t-bar .menu { gap: 5px; }
  #screen-title.t-bar .menu .btn { font-size: 12.5px; letter-spacing: 0; padding: 0 5px 3px; gap: 4px; }
  #screen-title.t-bar .menu .btn .ic { width: 1em; height: 1em; }
}
@media (max-width: 400px) {
  .tab { padding: 0 8px 2px; font-size: 14px; letter-spacing: .2px; gap: 4px; }
  .tab .ic { width: 1.05em; height: 1.05em; }
}
@media (max-width: 340px) {
  #screen-title.t-port .menu .btn:nth-child(n+3) { font-size: 13px; letter-spacing: 0; padding: 0 4px 3px; gap: 4px; }
  .tab .ic { display: none; }
  .rename #rename-ok { font-size: 14px; padding: 0 8px 3px; }
  .rename #rename-ok .ic { display: none; }
}
/* tableta y escritorio */
@media (min-width: 900px) and (min-height: 600px) {
  :root { --bar-h: 58px; --fs-xs: 13px; --fs-sm: 15px; }
  .btn { font-size: 18px; min-height: 48px; }
  .btn-sm { font-size: 15px; min-height: 44px; }
  .btn-lg { min-height: 58px; font-size: 22px; }
  .btn-xl { min-height: 68px; font-size: 28px; }
  .btn-go { font-size: 23px; padding: 0 24px 4px; }
  .screen.sub, .sheet { padding: calc(14px + var(--sat)) max(20px, var(--sar)) calc(14px + var(--sab)) max(20px, var(--sal)); gap: 12px; }
  .setup-grid, .online-grid, .lobby-grid, .room-grid, .chars-body { gap: 12px; }
  .card { padding: 14px; gap: 12px; }
  .card-h { font-size: 18px; } .card-h small { font-size: 13px; }
  .seg > button { min-height: 52px; font-size: 18px; }
  .seg-modes > button { font-size: 17px; }
  .cpu-row .seg > button { font-size: 16px; }
  .side-title { min-height: 40px; font-size: 22px; }
  .seg-modes > button { font-size: 24px; } .seg-modes > button small { font-size: 12px; }
  .seat { gap: 10px; padding: 4px 8px 4px 4px; }
  .seat .tx b { font-size: 16px; } .seat .tx small { font-size: 13px; }
  .seats.lay-card .seat .tx b { font-size: 24px; } .seats.lay-wide .seat .tx b { font-size: 22px; }
  .ctl1 { width: 70px; min-height: 52px; font-size: 12px; } .ctl1 .ic { width: 21px; height: 21px; }
  .switch2 > button { min-height: 48px; font-size: 15px; padding: 0 12px 1px; }
  .stage-name { font-size: 22px; padding-bottom: 10px; }
  .levels { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
  .lvl-name { font-size: 18px; padding-bottom: 8px; }
  #screen-title.t-col .title-ui { left: max(28px, var(--sal)); }
  #screen-title.t-col .title-ui, #screen-title.t-col .title-dock, #screen-title.t-col .menu { gap: 12px; }
  #screen-title.t-col .menu .btn { padding-left: 22px; }
  #screen-title.t-bar .title-dock { left: max(20px, var(--sal)); right: max(20px, var(--sar)); bottom: calc(16px + var(--sab)); gap: 8px; }
  #screen-title.t-bar .menu { gap: 12px; }
  #screen-title.t-bar .title-logo { left: max(20px, var(--sal)); top: calc(14px + var(--sat)); }
  .title-foot { font-size: 13px; }
  .tgl { width: 52px; height: 52px; font-size: 21px; }
  .title-tools { gap: 10px; }
  #screen-title.t-col .title-tools { right: 20px; bottom: 18px; }
  #screen-title.t-bar .title-tools { right: 20px; top: 16px; }
  .cgrid { gap: 12px; }
  .cg-name { font-size: 19px; } .cname { font-size: 34px; } .cquote { font-size: 16px; }
  .cdetail { padding: 14px; gap: 10px; }
  .help-item { padding: 10px 14px 10px 10px; gap: 14px; }
  .help-item p { font-size: 16px; } .help-keys { font-size: 14px; }
  .help-chips canvas { width: 40px; height: 40px; border-radius: 12px; }
  .help-chips { gap: 6px; }
  .help-ic { width: 60px; height: 60px; font-size: 28px; }
  .help-fire { font-size: 24px; }
  .help-body { gap: 12px; } .help-col { gap: 10px; }
  .room-tx b { font-size: 17px; } .room-tx span { font-size: 14px; } .room-code-s { font-size: 28px; }
  .mychar-tx b { font-size: 28px; } .mychar-cta { font-size: 17px; }
  .roominfo-thumb { width: 120px; } .roominfo-tx { font-size: 14px; } .roominfo-tx b { font-size: 20px; }
  .wp { width: min(100%, 780px); padding: 14px; gap: 10px; }
  .wgrid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 9px; }
  .wbtn { min-height: 92px; } .wbtn canvas { width: 58px; height: 58px; } .wbtn .wn { font-size: 15px; }
  .wp-info b { font-size: 21px; } .wp-info span { font-size: 15px; }
  .wp-detail canvas { width: 58px; height: 58px; }
  .tab { font-size: 19px; min-height: 50px; padding: 0 18px 2px; }
  .panel { width: min(100%, 520px); padding: 20px; gap: 14px; }
  .pause { width: min(100%, 640px); }
  .end-who span { font-size: 18px; }
  .end-mvp { font-size: 17px; min-height: 52px; } .end-mvp img { width: 44px; height: 44px; }
  .ctl { --s: 72px; } .ctl-move { --s: 92px; } .ctl-fire { --s: 112px; } .ctl-weapon { --s: 86px; }
  .ctl-lbl, .ctl-weapon .ctl-lbl { font-size: 11.5px; } .pad-cap { font-size: 11px; }
  .hbtn { width: 52px; height: 52px; font-size: 22px; }
  .hud-top .net { top: calc(100% + 8px); font-size: 13px; }
  #toast { font-size: 16px; }
}
/* vertical */
@media (orientation: portrait) {
  .setup-grid, .online-grid, .lobby-grid, .room-grid { display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: none; }
  .setup-grid > .card, .online-grid > .card, .lobby-grid > .card, .room-grid > .card, .lobby-side, .lobby-side > .card { flex: none; overflow: visible; }
  .stage { min-height: 0; aspect-ratio: 16 / 9; flex: none; }
  .seats.sides { grid-template-rows: auto auto; }
  .seats.sides .seat { flex: none; }
  .seats.ffa { grid-auto-rows: auto; }
  .topbar { gap: 6px; }
  .topbar-title { font-size: clamp(17px, 5vw, 26px); }
  .btn-back > span { display: none; }
  .btn-back { padding: 0 0 2px; width: var(--hit); }
  .btn-go { font-size: 17px; padding: 0 12px 3px; }
  .topbar-gap { width: var(--hit); }
  .room-code-box { justify-content: flex-end; gap: 6px; }
  .room-code-l { display: none; }
  #screen-lobby .topbar { grid-template-columns: auto minmax(0, 1fr); row-gap: 6px; }
  #screen-lobby #btn-lobby-start { grid-column: 1 / -1; }
  .mychar-btn { min-height: 110px; }
  .chars-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .cdetail { order: -1; flex-direction: row; }
  .cpose { flex: 0 0 38%; min-height: 150px; }
  .cinfo { flex: 1; min-width: 0; justify-content: center; }
  .cgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(96px, 1fr); }
  .help-body { grid-template-columns: minmax(0, 1fr); }
  .pause-grid { grid-template-columns: minmax(0, 1fr); }
  .ctl { --s: clamp(46px, 13vw, 58px); } .ctl-move { --s: clamp(54px, 15.6vw, 70px); } .ctl-fire { --s: clamp(66px, 19.5vw, 86px); } .ctl-weapon { --s: clamp(54px, 15.4vw, 66px); }
  .pad { gap: 6px; } .pad-col { gap: 6px; }
  #pad-left { left: calc(8px + var(--sal)); } #pad-right { right: calc(8px + var(--sar)); }
  .turn-tag { max-width: 90vw; }      /* solo sale cuando el mando está oculto: va abajo, lejos de la acción */
  .end-actions .btn { flex: 1 1 100%; }
  .wp-head { flex-wrap: wrap; }
  .wp-extra { order: 3; flex: 1 1 100%; }
  .wp-extra .wbtn { flex: 1; }
}
@media (orientation: portrait) and (min-width: 600px) {
  #screen-title.t-port .title-dock { left: 50%; right: auto; width: min(560px, 92vw); margin-left: max(-280px, -46vw); }
  .cgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ============================================================ 9. Movimiento */
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px) scale(.92); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes logo-in { from { opacity: 0; transform: scale(.55) rotate(-9deg); } to { opacity: 1; transform: none; } }
@keyframes logo-float { from { transform: translateY(0) rotate(-.6deg); } to { transform: translateY(-4px) rotate(.8deg); } }
@keyframes menu-in { from { opacity: 0; transform: translateX(-22px); } to { opacity: 1; transform: none; } }
@keyframes title-pop { from { opacity: 0; transform: scale(.4) rotate(-6deg); } to { opacity: 1; transform: none; } }
@keyframes who-in { from { opacity: 0; transform: translateY(26px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes shine { 0%, 62% { transform: translateX(-160%) skewX(-20deg); } 100% { transform: translateX(460%) skewX(-20deg); } }
@keyframes hero-drift { from { transform: scale(1) translate3d(0, 0, 0); } to { transform: scale(1.028) translate3d(-.35%, -.3%, 0); } }
@keyframes fx-drift { 0% { transform: translate3d(var(--x0), var(--y0), 0); opacity: 0; } 8% { opacity: var(--o, .9); } 88% { opacity: var(--o, .9); } 100% { transform: translate3d(var(--x1), var(--y1), 0); opacity: 0; } }
@keyframes fx-spin { from { transform: rotate(-40deg) scaleX(1); } to { transform: rotate(150deg) scaleX(.45); } }
@keyframes rays { from { opacity: .55; } to { opacity: 1; } }
@keyframes net-pulse { 50% { box-shadow: 0 0 0 5px rgba(239,59,71,.42); } }
@keyframes toast-in-top { from { opacity: 0; transform: translate(-50%, -14px) scale(.92); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes rot { 0%, 18% { transform: rotate(0); } 58%, 100% { transform: rotate(-90deg); } }
@keyframes mango-bounce { from { transform: translateY(3px) scale(1.04, .96); } to { transform: translateY(-9px) scale(.97, 1.03); } }
@keyframes stripes { to { background-position: 34px 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .hero-fx { display: none; }
}

/* ---------- ¡A correr! (juego de carreras, js/kart/) ---------- */
#screen-kart { background: #0d1b4c; touch-action: none; user-select: none; -webkit-user-select: none; }
#screen-kart.k-setup-on { background: linear-gradient(180deg, rgba(13,27,76,.25), rgba(7,13,42,.55)), var(--k-bg) center / cover no-repeat #3f8fe0; }
.k-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.k-ui { position: absolute; inset: 0; pointer-events: none; }
.k-ui > * { pointer-events: auto; }
/* preparación */
.k-setup { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; pointer-events: none;
  padding: calc(8px + var(--sat)) max(12px, var(--sar)) calc(8px + var(--sab)) max(12px, var(--sal)); }
.k-setup > * { pointer-events: auto; }
.k-setup-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 46%, 520px); gap: 10px; pointer-events: none; }
.k-stage { position: relative; pointer-events: none; }
.k-stage-name { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.k-stage-name b { font: 400 clamp(20px, 3.4vw, 30px)/1 var(--f-display); color: #fff; text-shadow: var(--ol-2); }
.k-stage-name span { font: 900 14px/1 var(--f-body); color: var(--mango-300); text-shadow: 0 1.5px 0 var(--navy-900); }
.k-opts { display: flex; flex-direction: column; gap: 7px; overflow-y: auto; min-height: 0; scrollbar-width: none; pointer-events: auto; touch-action: pan-y; }
.k-opts::-webkit-scrollbar { display: none; }
.k-opts .card { flex: none; overflow: visible; }
.k-h { font: 400 14px/1.1 var(--f-display); letter-spacing: .6px; text-transform: uppercase; color: var(--mango-300); text-shadow: 0 1.5px 0 var(--navy-900); }
.k-faces { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.k-face { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 2px 4px; border-radius: 12px; background: rgba(10,20,56,.5); border: 2px solid rgba(255,255,255,.18); min-width: 0; min-height: var(--hit); }
.k-face img { width: 100%; max-width: 54px; aspect-ratio: 1; object-fit: cover; border-radius: 50%; background: #2a4bb4; }
.k-face span { font: 800 10.5px/1.1 var(--f-body); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.k-face.on { border-color: var(--mango); background: linear-gradient(180deg, rgba(255,194,31,.45), rgba(255,146,24,.3)); box-shadow: 0 0 0 2px var(--navy-900); }
.k-vehs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.k-veh { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 6px 7px; border-radius: 14px; background: rgba(10,20,56,.5); border: 2px solid rgba(255,255,255,.18); color: #fff; min-width: 0; }
.k-veh strong { font: 400 15px/1.05 var(--f-display); letter-spacing: .2px; text-wrap: balance; }
.k-veh small { font: 700 10.5px/1.15 var(--f-body); color: var(--text-2); min-height: 2.3em; }
.k-veh.on { border-color: var(--mango); background: linear-gradient(180deg, rgba(255,194,31,.38), rgba(255,146,24,.22)); }
.k-stat { display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 5px; font: 800 10px/1 var(--f-body); color: var(--text-2); }
.k-stat i { height: 7px; border-radius: 9px; background: rgba(255,255,255,.18); overflow: hidden; }
.k-stat b { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, #ffe066, #ff9218); }
.k-step { display: flex; align-items: center; gap: 8px; }
.k-step b { font: 400 22px/1 var(--f-display); color: #fff; min-width: 1.4em; text-align: center; }
.k-step .btn { min-height: 40px; min-width: 44px; }
.k-check { display: flex; align-items: center; gap: 8px; font: 800 13px/1.2 var(--f-body); color: var(--text-2); min-height: 32px; }
.k-check input { width: 20px; height: 20px; accent-color: var(--mango); }
/* marcador */
.k-hud { position: absolute; inset: 0; pointer-events: none; font-family: var(--f-display); color: #fff; }
.k-hud > * { position: absolute; }
.k-pos { left: max(12px, var(--sal)); top: calc(8px + var(--sat)); display: flex; align-items: baseline; gap: 4px; text-shadow: var(--ol-2); }
.k-pos b { font-size: clamp(40px, 9vh, 70px); line-height: 1; color: #fff; }
.k-pos.first b { color: var(--mango-300); }
.k-pos small { font-size: 20px; color: var(--text-2); }
.k-lap { left: max(14px, var(--sal)); top: calc(8px + var(--sat) + clamp(44px, 10vh, 76px)); font-size: 18px; text-shadow: var(--ol-2); }
.k-lap span { font: 900 13px/1 var(--f-body); text-transform: uppercase; letter-spacing: .5px; color: var(--mango-300); }
.k-time { left: max(14px, var(--sal)); top: calc(30px + var(--sat) + clamp(44px, 10vh, 76px)); font: 900 14px/1 var(--f-body); text-shadow: 0 1.5px 0 var(--navy-900); font-variant-numeric: tabular-nums; }
.k-cut { left: max(14px, var(--sal)); top: calc(50px + var(--sat) + clamp(44px, 10vh, 76px)); display: none; padding: 4px 10px 5px; border-radius: 999px; background: rgba(13,27,76,.82); border: 2px solid var(--mango); font: 900 13px/1 var(--f-body); color: #fff; font-variant-numeric: tabular-nums; }
.k-cut.on { display: block; }
.k-cut.hurry { background: #c22c38; border-color: #fff; animation: k-hurry .5s ease-in-out infinite alternate; }
@keyframes k-hurry { to { transform: scale(1.08); } }
.k-map { right: max(10px, var(--sar)); top: calc(56px + var(--sat)); width: clamp(84px, 24vh, 150px); height: clamp(84px, 24vh, 150px); opacity: .92; pointer-events: none; }
.k-pausebtn { pointer-events: auto; right: max(10px, var(--sar)); top: calc(8px + var(--sat)); width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: rgba(10,20,56,.6); border: 2px solid rgba(255,255,255,.3); }
.k-pausebtn .ic { width: 22px; height: 22px; }
.k-msg { left: 50%; top: calc(14px + var(--sat)); transform: translateX(-50%) scale(.6); opacity: 0; font-size: clamp(18px, 4.4vh, 30px); text-shadow: var(--ol-2); white-space: nowrap; transition: transform .25s var(--ease-pop), opacity .2s; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
.k-msg.show { opacity: 1; transform: translateX(-50%) scale(1); }
.k-msg.final { color: var(--mango-300); } .k-msg.hurt { color: #ffb0b5; } .k-msg.good { color: #9ef0b8; }
.k-msg.big { font-size: clamp(26px, 7vh, 46px); color: var(--mango-300); top: 26%; }
.k-count { left: 50%; top: 34%; transform: translate(-50%, -50%) scale(.3); opacity: 0; font-size: clamp(60px, 22vh, 150px); color: #fff; text-shadow: 0 6px 0 var(--navy-900), 0 0 30px rgba(9,19,58,.7); white-space: nowrap; }
.k-count.pop { animation: k-pop .9s var(--ease-pop) both; }
.k-count.go { color: var(--mango-300); font-size: clamp(44px, 15vh, 110px); }
@keyframes k-pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 80% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); } }
.k-pad { inset: 0; pointer-events: none; }
.k-pad button { pointer-events: auto; position: absolute; display: grid; place-items: center; color: #fff; border-radius: 50%; background: rgba(10,20,56,.45); border: 3px solid rgba(255,255,255,.55); box-shadow: 0 3px 0 rgba(4,8,30,.5); font: 400 15px/1 var(--f-display); text-transform: uppercase; letter-spacing: .3px; touch-action: none; -webkit-tap-highlight-color: transparent; }
.k-pad button.on { background: rgba(255,194,31,.55); border-color: #fff; transform: scale(.95); }
.k-pad button .ic { width: 46%; height: 46%; }
.k-steer button { --s: clamp(64px, 20vh, 92px); width: var(--s); height: var(--s); bottom: calc(14px + var(--sab)); }
.k-steer [data-k="left"] { left: max(16px, var(--sal)); }
.k-steer [data-k="right"] { left: calc(max(16px, var(--sal)) + clamp(64px, 20vh, 92px) + 14px); }
.k-pad.tilt .k-steer { display: none; }
.k-acts .k-item { --s: clamp(70px, 22vh, 104px); width: var(--s); height: var(--s); right: max(16px, var(--sar)); bottom: calc(clamp(64px, 19vh, 88px) + 26px + var(--sab)); border-radius: 26%; background: rgba(10,20,56,.3); border-style: dashed; opacity: .75; }
.k-acts .k-item.full { background: linear-gradient(180deg, #fffdf2, #ffe9a6); border-color: var(--mango); border-style: solid; opacity: 1; animation: k-ready .9s var(--ease-pop) both; }
@keyframes k-ready { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.k-acts .k-item canvas { width: 86%; height: 86%; }
.k-acts .k-drift { --s: clamp(64px, 19vh, 88px); width: calc(var(--s) * 1.25); height: var(--s); border-radius: 22px; right: max(16px, var(--sar)); bottom: calc(14px + var(--sab)); background: rgba(61,165,255,.45); }
.k-acts .k-brake { --s: clamp(54px, 16vh, 74px); width: var(--s); height: var(--s); right: calc(max(16px, var(--sar)) + clamp(64px, 19vh, 88px) * 1.25 + 12px); bottom: calc(14px + var(--sab)); background: rgba(239,59,71,.4); font-size: 13px; }
.k-acts .k-brake.rev { background: rgba(255,194,31,.6); border-color: #fff; }
.k-acts .k-gas { display: none; }
.k-pad:not(.autogas) .k-gas { display: grid; --s: clamp(54px, 16vh, 74px); width: var(--s); height: var(--s); right: calc(max(16px, var(--sar)) + clamp(64px, 19vh, 88px) * 1.25 + 12px); bottom: calc(26px + var(--sab) + clamp(54px, 16vh, 74px)); background: rgba(54,196,107,.45); font-size: 12px; }
@media (hover: hover) and (pointer: fine) { .k-pad { display: none; } }
/* paneles */
.k-sheet { width: min(100%, 560px); }
.k-sheet h2 { font: 400 var(--fs-xl)/1.1 var(--f-display); color: var(--mango-300); text-shadow: var(--ol-2); text-transform: uppercase; letter-spacing: .5px; }
.k-sheet p { font: 700 14px/1.35 var(--f-body); color: var(--text-2); text-align: left; }
.k-sheet .btn { width: 100%; }
.k-btns { display: flex; gap: 8px; flex: none; }
.k-btns .btn { flex: 1; }
.k-table ol { list-style: none; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; min-height: 0; padding: 0; margin: 0; }
.k-table li, .k-thead { display: grid; grid-template-columns: 38px 34px minmax(0, 1fr) 64px 44px 44px; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 12px; background: rgba(255,255,255,.07); font: 800 14px/1.1 var(--f-body); color: #fff; text-align: left; }
.k-standings li { grid-template-columns: 38px 34px minmax(0, 1fr) 50px; }
.k-thead { background: none; font-size: 11px; color: var(--text-3); text-transform: uppercase; padding-top: 0; padding-bottom: 0; }
.k-table li.me { background: linear-gradient(90deg, rgba(255,194,31,.42), rgba(255,146,24,.18)); box-shadow: inset 0 0 0 2px var(--mango); }
.k-table li.champ { background: linear-gradient(90deg, #fff08a, #ffc21f); color: var(--brown); }
.k-pl { font: 400 18px/1 var(--f-display); }
.k-fc { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #2a4bb4; display: block; }
.k-nm { display: flex; flex-direction: column; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-nm small { font: 700 11px/1.1 var(--f-body); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.k-table li.champ .k-nm small { color: rgba(74,37,0,.7); }
.k-tm { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-2); }
.k-pts { color: #9ef0b8; }
.k-tot { font: 400 18px/1 var(--f-display); text-align: right; }
.k-sub { text-align: center !important; font-size: 12px !important; }
.k-pause .k-sheet, .k-confirm .k-sheet { width: min(100%, 360px); }
/* pausa: botones y, al lado (debajo en vertical), el sonido */
.k-pause-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.k-pause-btns { display: flex; flex-direction: column; gap: 8px; }
.k-sound { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 14px; background: rgba(10,20,56,.45); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.12); text-align: left; }
.k-sound-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.k-sound-top .btn { width: auto; min-height: 36px; padding: 0 12px 2px; font-size: 13px; }
.k-vol { display: grid; grid-template-columns: 70px minmax(0, 1fr) 44px; align-items: center; gap: 8px; min-height: 34px; font: 800 13px/1 var(--f-body); color: #fff; }
.k-vol input { width: 100%; height: 28px; margin: 0; accent-color: var(--mango); }
.k-vol output { text-align: right; font: 800 12px/1 var(--f-body); color: var(--text-2); font-variant-numeric: tabular-nums; }
.k-sound.muted .k-vol { opacity: .45; }
@media (min-aspect-ratio: 1/1) and (min-width: 560px) {
  .k-pause .k-pausesheet { width: min(100%, 640px); }
  .k-pause-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
}
.k-items { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; text-align: left; }
.k-items li { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 4px 6px; border-radius: 12px; background: rgba(255,255,255,.07); }
.k-items canvas { width: 40px; height: 40px; grid-row: span 2; }
.k-items b { font: 900 13px/1.1 var(--f-body); color: #fff; }
.k-items span { font: 700 11.5px/1.2 var(--f-body); color: var(--text-2); }
.k-helpsheet { width: min(100%, 680px); }
/* barra de escritura (js/ui/typebar.js): lo único que el teclado deja a la vista en un teléfono apaisado */
.typebar { position: fixed; z-index: 10000; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--sat)) max(10px, var(--sar)) 7px max(10px, var(--sal)); background: linear-gradient(180deg, #16296e, #0d1b4c); border-bottom: 3px solid var(--mango); box-shadow: 0 6px 18px rgba(4,8,30,.55); }
.typebar-lbl { flex: none; max-width: 30vw; font: 900 12px/1.1 var(--f-body); color: var(--mango-300); text-transform: uppercase; letter-spacing: .5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.typebar-in { flex: 1; min-width: 0; height: 46px; font-size: 20px; }
.typebar-ok { flex: none; min-height: 46px; padding: 0 16px 2px; }
/* qué se corre: copa o una carrera, escenario, vueltas · objetos de las cajas */
.k-plan { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 7px 10px; }
.k-plan .seg > button { min-height: 40px; min-width: 0; }
.k-plan .k-wide { grid-column: 1 / -1; }
.k-setup.k-single .k-if-copa, .k-setup:not(.k-single) .k-if-single { display: none; }
.k-tracks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.k-track { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 3px 3px 5px; border-radius: 12px; background: rgba(10,20,56,.5); border: 2px solid rgba(255,255,255,.18); color: #fff; min-width: 0; text-align: center; }
.k-track img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #2a4bb4; }
.k-track b { font: 400 13px/1.05 var(--f-display); letter-spacing: .2px; text-wrap: balance; }
.k-track small { font: 800 10px/1 var(--f-body); color: var(--text-2); }
.k-track.on { border-color: var(--mango); background: linear-gradient(180deg, rgba(255,194,31,.45), rgba(255,146,24,.3)); box-shadow: 0 0 0 2px var(--navy-900); }
.k-boxes { display: flex; flex-direction: column; gap: 6px; }
.k-boxes-top { display: flex; align-items: center; gap: 6px; }
.k-boxes-top .k-h { margin-right: auto; }
.k-boxes-top .k-h small { display: block; margin-top: 3px; font: 800 11px/1 var(--f-body); letter-spacing: 0; text-transform: none; color: var(--text-2); text-shadow: none; white-space: nowrap; }
.k-boxes-top .btn { min-height: 34px; padding: 0 10px 2px; font-size: 13px; }
.k-itemgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
@media (max-width: 800px) { .k-itemgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.k-itm { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 1px 4px; border-radius: 12px; background: rgba(10,20,56,.5); border: 2px solid rgba(255,255,255,.14); min-width: 0; min-height: var(--hit); opacity: .5; filter: grayscale(1); transition: opacity var(--t-fast), filter var(--t-fast); }
.k-itm canvas { width: 34px; height: 34px; }
.k-itm span { font: 800 9.5px/1.1 var(--f-body); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.k-itm.on { opacity: 1; filter: none; border-color: var(--mango); background: linear-gradient(180deg, rgba(255,194,31,.38), rgba(255,146,24,.22)); }
.k-pad.noitems .k-item { display: none; }
.k-table.k-one li, .k-table.k-one .k-thead { grid-template-columns: 38px 34px minmax(0, 1fr) 64px; }
.k-standings.k-results .k-one li { grid-template-columns: 38px 34px minmax(0, 1fr); }
/* mando: una fila compacta arriba del todo */
.k-ctl { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 10px; }
.k-ctl .seg > button { min-height: 40px; }
.k-ctl .k-check { grid-column: 1 / -1; }
/* solo con sitio de sobra cabe todo en una fila; en un teléfono el texto se salía de los botones */
@media (min-width: 1000px) and (min-aspect-ratio: 1/1) { .k-ctl { grid-template-columns: auto minmax(0, 1fr) auto; } .k-ctl .k-check { grid-column: auto; } }
/* sala en línea */
.k-top-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.k-btn-online { min-height: 44px; flex: none; padding: 0 12px 2px; font-size: 15px; }
@media (max-width: 620px) { .k-btn-online > span { display: none; } }
.k-online .k-sheet { width: min(100%, 420px); }
.k-lbl { display: flex; flex-direction: column; gap: 4px; text-align: left; font: 900 12px/1 var(--f-body); color: var(--mango-300); text-transform: uppercase; letter-spacing: .5px; }
.k-join { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.k-join .btn { width: auto; }
.k-tip { display: flex; align-items: center; gap: 10px; }
.k-tip p { flex: 1; margin: 0; font: 700 13px/1.35 var(--f-body); color: #fff; }
.k-room { display: flex; flex-direction: column; gap: 6px; box-shadow: inset 0 0 0 2px var(--mango); }
.k-room-top { display: flex; align-items: center; gap: 6px; }
.k-room-code { display: flex; flex-direction: column; margin-right: auto; }
.k-room-code small { font: 900 11px/1 var(--f-body); color: var(--mango-300); text-transform: uppercase; letter-spacing: .5px; }
.k-room-code b { font: 400 28px/1 var(--f-display); letter-spacing: 5px; color: #fff; text-shadow: var(--ol-2); }
.k-room-players { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 5px; }
.k-room-players li { display: flex; align-items: center; gap: 7px; padding: 4px 8px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.08); min-width: 0; }
.k-room-players li.me { background: linear-gradient(90deg, rgba(255,194,31,.42), rgba(255,146,24,.18)); box-shadow: inset 0 0 0 2px var(--mango); }
.k-room-players li.off { opacity: .45; }
.k-room-players span { display: flex; flex-direction: column; min-width: 0; }
.k-room-players b { font: 900 13px/1.1 var(--f-body); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-room-players small { font: 700 10.5px/1.1 var(--f-body); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-locked { opacity: .55; pointer-events: none; }
.btn-go:disabled { filter: saturate(.4) brightness(.85); }
/* campeón */
.k-champ { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 0 max(14px, var(--sar)) calc(14px + var(--sab)) max(14px, var(--sal)); pointer-events: none; }
.k-champ > * { pointer-events: auto; }
.k-champ-card { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: 22px; background: linear-gradient(180deg, rgba(34,66,160,.92), rgba(15,29,82,.95)); border: 2.5px solid var(--navy-900); box-shadow: var(--e-3); animation: menu-in .6s var(--ease-pop) .8s both; max-width: 70vw; }
.k-champ-card .k-fc { width: 64px; height: 64px; border: 3px solid var(--mango); flex: none; }
.k-champ-card small { font: 900 12px/1 var(--f-body); color: var(--mango-300); text-transform: uppercase; letter-spacing: .5px; }
.k-champ-card b { display: block; font: 400 clamp(24px, 6vh, 40px)/1.05 var(--f-display); color: #fff; text-shadow: var(--ol-2); }
.k-champ-card q { display: block; font: 800 14px/1.25 var(--f-body); color: var(--text-2); }
.k-skip { min-height: 44px; flex: none; }
@media (max-aspect-ratio: 1/1) {
  .k-setup-grid { grid-template-columns: 1fr; grid-template-rows: minmax(150px, 34vh) minmax(0, 1fr); }
  .k-faces { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .k-vehs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

