* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #0a0f2e;
  --panel-top: #2c4499;
  --panel-bottom: #18245e;
  --border: #9bb8ff;
  --gold: #ffd93b;
  --gold-soft: #ffe27a;
  --font: "Fredoka", "Trebuchet MS", sans-serif;
}
html, body { width: 100%; height: 100%; overflow: hidden; background: #1a1020; color: #fff;
  font-family: var(--font); user-select: none; -webkit-user-select: none; }
canvas { display: block; touch-action: none; image-rendering: pixelated; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 16px; text-align: center; }
.hidden { display: none !important; }
#menu { overflow-y: auto; justify-content: flex-start; padding-top: 2vh;
  background: radial-gradient(ellipse at 50% 40%, rgba(10, 15, 46, 0.15), rgba(10, 15, 46, 0.55)); }
.overlay { background: rgba(10, 6, 20, .6); }

/* Caja estilo "Mundo Misterioso": doble borde azul */
.box { background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  border: 3px solid var(--ink); border-radius: 10px; padding: 18px 22px;
  box-shadow: inset 0 0 0 3px var(--panel-top), inset 0 0 0 5px var(--border), 0 8px 0 rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 100%; }
.menu-box { width: min(1120px, 100%); gap: 8px; padding: 14px 20px; }
.small-box { min-width: min(360px, 100%); }

.logo { font-size: clamp(32px, 5.5vw, 52px); font-weight: 700; letter-spacing: 2px; color: var(--gold); line-height: 1;
  text-shadow: 3px 3px 0 #c2410c, 6px 6px 0 var(--ink); }
.logo span { color: #fff; text-shadow: 3px 3px 0 #2546c9, 6px 6px 0 var(--ink); }
.subtitle { opacity: .9; font-size: 15px; }
.pick { font-size: 20px; }
.hint { opacity: .75; font-size: 13px; line-height: 1.5; }
.zeni { font-size: 15px; color: var(--gold-soft); }

/* Selección de personaje: cuadrícula de 4 columnas con tarjetas horizontales (dibujo | datos) */
.char-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; }
.char-card { display: grid; grid-template-columns: 62px 1fr; column-gap: 8px; align-items: center; text-align: left;
  background: rgba(10, 15, 46, .55); border: 2px solid rgba(155, 184, 255, .35);
  border-radius: 8px; padding: 6px 10px 6px 6px; cursor: pointer; transition: transform .1s, border-color .1s, background .1s; }
.char-card:hover { transform: translateY(-3px); border-color: var(--gold); background: rgba(10, 15, 46, .8); }
.char-card canvas { width: 62px; height: 85px; grid-row: span 2; }
.char-card h3 { color: var(--gold); font-size: 18px; line-height: 1.1; }
.char-card .title { font-size: 11px; opacity: .75; }
.char-card .info { font-size: 12px; margin-top: 4px; line-height: 1.35; text-align: left; }
.char-card .info b { color: #8fe3ff; font-weight: normal; }
.char-card .best { margin-top: 6px; font-size: 12px; color: var(--gold-soft); }
.char-card.selected { border-color: var(--gold); background: rgba(10, 15, 46, .85); box-shadow: 0 0 0 2px var(--gold) inset; }

/* Pantallas medianas: 2 columnas */
@media (max-width: 1000px) { .char-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Celulares: menú compacto, sin scroll accidental de la página */
.char-detail { display: none; font-size: 13px; line-height: 1.4; opacity: .9; }
html, body { overscroll-behavior: none; }
@media (max-width: 640px) {
  .screen { padding: 8px; }
  .menu-box, .box { padding: 12px 10px; }
  .logo { font-size: 34px; }
  .subtitle { font-size: 13px; }
  .char-list { gap: 6px; }
  .char-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .char-card { display: block; text-align: center; padding: 2px 4px 6px; }
  .char-card canvas { display: block; width: 60px; height: 82px; margin: 0 auto; }
  .char-card h3 { font-size: 15px; }
  .char-card .title, .char-card .info { display: none; }
  .char-card .best { font-size: 10px; margin-top: 2px; }
  .lock-info { font-size: 10px; gap: 2px; }
  .lock-info .btn { font-size: 10px; padding: 3px 4px; }
  .char-detail { display: block; }
  .hint { font-size: 11px; }
  .mode-row #btnSolo { min-width: 0; width: 100%; }
  .mode-row { width: 100%; }
  .join input { width: 96px; }
  .btn { min-width: 0; }
  .choice { width: 100%; padding: 10px; }
  .choice .desc { font-size: 13px; }
  .choices { gap: 8px; }
  h2 { font-size: 22px; }
  .pause-map { flex-basis: 100%; }
  .pause-map canvas { width: 240px; }
  .ps-grid { grid-template-columns: repeat(3, 1fr); }
  .btn-ki { width: 72px; height: 72px; right: 14px; bottom: 74px; font-size: 18px; }
}
/* Teléfono en horizontal: pantallas muy bajas */
@media (max-height: 500px) {
  .logo { font-size: 30px; }
  .menu-box { gap: 6px; }
  .char-card canvas { width: 56px; height: 77px; }
  .char-card .title, .char-card .info { display: none; }
  .char-detail { display: block; }
  .btn-ki { width: 68px; height: 68px; bottom: 60px; }
}

/* Pausa: estadísticas y mapa */
#pause { overflow-y: auto; }
.pause-box { width: min(860px, 100%); gap: 10px; }
.pause-cols { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; width: 100%; text-align: left; }
.pause-stats { flex: 1 1 340px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pause-stats h3 { color: var(--gold); font-size: 16px; margin-bottom: 4px; }
.ps-head { display: flex; align-items: center; gap: 10px; }
.ps-head canvas { width: 48px; height: 44px; image-rendering: pixelated; }
.ps-head .ps-name { font-size: 20px; font-weight: 700; color: var(--gold); }
.ps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ps-cell { background: rgba(10, 15, 46, .55); border-radius: 6px; padding: 4px 8px; }
.ps-cell b { display: block; font-size: 18px; color: #fff; }
.ps-cell span { font-size: 12px; opacity: .75; }
.ps-tech { display: grid; grid-template-columns: 14px 1fr auto; gap: 2px 8px; align-items: center; font-size: 14px; }
.ps-tech .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); }
.ps-tech .val { text-align: right; opacity: .9; font-variant-numeric: tabular-nums; }
.ps-tech .bar { grid-column: 2 / 4; height: 5px; background: rgba(255, 255, 255, .12); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.ps-tech .bar i { display: block; height: 100%; }
.ps-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ps-chips span { background: rgba(10, 15, 46, .55); border-radius: 10px; padding: 2px 8px; font-size: 12px; }
.pause-map { flex: 0 0 300px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.pause-map canvas { width: 300px; height: 300px; border: 3px solid var(--ink); border-radius: 6px; box-shadow: 0 0 0 2px var(--border);
  image-rendering: pixelated; max-width: 100%; height: auto; }
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center; font-size: 12px; }
.map-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
.map-legend i.big { width: 11px; height: 11px; }
.map-legend .legend-ball { width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; }
.pause-opts { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; justify-content: center; width: 100%;
  padding: 8px 12px; border-radius: 10px; background: rgba(0, 0, 0, .2); }
.pause-opts h3 { width: 100%; margin: 0; font-size: 15px; color: var(--gold-soft); text-align: center; }
.vol-row { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.vol-row input { width: 130px; accent-color: var(--gold); cursor: pointer; }
.vol-row span { min-width: 38px; font-size: 13px; opacity: .8; }
.pause-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* Cómo jugar y Técnicas */
#help, #techs, #achs, #rank { overflow-y: auto; justify-content: flex-start; padding-top: 3vh; }
.help-box { width: min(820px, 100%); }
.help-content { width: 100%; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.help-content details { background: rgba(10, 15, 46, .55); border: 2px solid rgba(155, 184, 255, .3); border-radius: 8px; padding: 6px 12px; }
.help-content details[open] { border-color: rgba(255, 217, 59, .55); }
.help-content summary { cursor: pointer; font-weight: 700; font-size: 17px; color: var(--gold); padding: 4px 0; }
.help-content p, .help-content li { font-size: 14px; line-height: 1.5; }
.help-content ul { padding-left: 20px; margin: 4px 0 8px; }
.help-content b { color: #8fe3ff; font-weight: 700; }
.help-content summary small { color: var(--gold-soft); font-weight: 500; font-size: 13px; }
.help-content table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0 8px; }
.help-content th { text-align: left; color: var(--gold-soft); font-weight: 700; padding: 3px 6px; border-bottom: 1px solid rgba(155, 184, 255, .3); }
.help-content td { padding: 3px 6px; border-bottom: 1px solid rgba(155, 184, 255, .12); vertical-align: top; }
.help-content .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; border: 2px solid var(--ink); vertical-align: -1px; }
.help-content kbd { background: var(--ink); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; font-family: inherit; font-size: 12px; }

/* Pie del menú y créditos */
.footer { font-size: 13px; opacity: .85; }
a { color: #8fe3ff; }
a:hover { color: var(--gold); }
.flag { width: 1.35em; height: .9em; vertical-align: -0.1em; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: #8fe3ff; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--gold); }
#credits { overflow-y: auto; justify-content: flex-start; padding-top: 4vh; }
.credits-box { width: min(620px, 100%); }
.credits-box section { width: 100%; text-align: center; }
.credits-box h3 { color: var(--gold); font-size: 17px; margin-bottom: 2px; }
.credits-box p { font-size: 14px; line-height: 1.45; opacity: .92; }
.credits-box .version { opacity: .6; font-size: 13px; }

/* Tienda de Zeni */
#shop { overflow-y: auto; justify-content: flex-start; padding-top: 4vh; }
.shop-box { width: min(900px, 100%); }
.shop-zeni { font-size: 20px; }
.shop-zeni b { color: var(--gold); }
.shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; width: 100%; }
.shop-item { display: flex; gap: 10px; align-items: flex-start; text-align: left; background: rgba(10, 15, 46, .55);
  border: 2px solid rgba(155, 184, 255, .35); border-radius: 8px; padding: 10px; }
.shop-item.maxed { border-color: rgba(255, 217, 59, .6); }
.shop-icon { width: 40px; height: 40px; flex: none; border-radius: 8px; border: 2px solid var(--ink); display: flex;
  align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: var(--ink); }
.shop-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.shop-name { font-weight: 700; font-size: 16px; }
.shop-desc { font-size: 13px; opacity: .85; }
.shop-pips { display: flex; gap: 3px; }
.shop-pips i { width: 12px; height: 6px; background: rgba(255, 255, 255, .2); border-radius: 1px; }
.shop-pips i.on { background: var(--gold); }
.btn.shop-buy { align-self: flex-start; font-size: 14px; padding: 6px 12px; min-width: 0; margin-top: 2px; }
.shop-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn.danger { background: linear-gradient(180deg, #ff7a7a, #d62f3f); color: #fff; }
.btn.danger.confirm { background: linear-gradient(180deg, #ffe27a, #ff8a1c); color: var(--ink); }
.btn:disabled { filter: grayscale(1); opacity: .55; cursor: default; }
.btn.shop-buy:disabled { filter: grayscale(1); opacity: .55; cursor: default; transform: none; }

/* Nombre, modos de juego y sala online */
input { font: inherit; color: #fff; background: var(--ink); border: 2px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-size: 16px; outline: none; }
input:focus { border-color: var(--gold); }
.name-row { display: flex; align-items: center; gap: 10px; }
.name-row input { width: 180px; }
.modes { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.mode-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.mode-row #btnSolo { min-width: 260px; font-size: 20px; }
.mode-or { opacity: .7; font-size: 14px; }
.opt-speed { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; user-select: none; }
.opt-speed small { opacity: .65; }
.opt-speed input { width: 18px; height: 18px; accent-color: var(--gold); cursor: pointer; }
/* Tienda a lo ancho y debajo las cuatro pantallas de consulta, en grilla (2 columnas en pantallas chicas) */
.shop-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 2px; padding-top: 10px;
  border-top: 2px solid rgba(155, 184, 255, .25); width: min(640px, 100%); }
.btn.shop-btn { background: linear-gradient(180deg, #6fe08a, #2f9e4f); color: #fff; grid-column: 1 / -1; }
.shop-row .btn { min-width: 0; padding: 8px 10px; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .shop-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.join { display: flex; gap: 6px; }
.join input { width: 110px; text-transform: uppercase; letter-spacing: 3px; text-align: center; }
.btn.small { font-size: 15px; padding: 8px 16px; min-width: 0; }
.net-msg { color: var(--gold-soft); font-size: 14px; }
.net-msg:empty { display: none; }
.lobby-box { width: min(560px, 100%); }
.room-code { color: #fff; letter-spacing: 4px; background: var(--ink); padding: 0 10px; border-radius: 6px; }
.lobby-players { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.lobby-player { display: flex; align-items: center; gap: 10px; background: rgba(10, 15, 46, .55); border: 2px solid rgba(155, 184, 255, .35);
  border-radius: 8px; padding: 4px 10px; min-height: 48px; text-align: left; }
.lobby-player canvas { width: 40px; height: 37px; image-rendering: pixelated; }
.lobby-player .lp-name { font-weight: 700; flex: 1; }
.lobby-player .lp-char { opacity: .8; font-size: 14px; }
.lobby-player.empty { justify-content: center; opacity: .5; font-size: 14px; }
.lobby-box h3 { color: var(--gold); }
.lobby-chars { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lobby-char { background: rgba(10, 15, 46, .55); border: 2px solid rgba(155, 184, 255, .35); border-radius: 8px; padding: 4px; cursor: pointer; }
.lobby-char canvas { width: 48px; height: 44px; image-rendering: pixelated; display: block; }
.lobby-char.selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }

h2 { font-size: 28px; color: var(--gold); text-shadow: 2px 2px 0 var(--ink); }
#levelup h2 { margin-bottom: 14px; }
.choices { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; max-width: 900px; }
.choice { width: 240px; background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom)); color: #fff; font: inherit;
  border: 3px solid var(--ink); border-radius: 10px; padding: 14px; cursor: pointer; text-align: left;
  box-shadow: inset 0 0 0 2px var(--panel-top), inset 0 0 0 4px var(--border), 0 6px 0 rgba(0, 0, 0, .35);
  transition: transform .1s; }
.choice:hover, .choice:focus { transform: translateY(-4px) scale(1.03); outline: none;
  box-shadow: inset 0 0 0 2px var(--panel-top), inset 0 0 0 4px var(--gold), 0 10px 0 rgba(0, 0, 0, .35); }
.choice .head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.choice .icon { width: 36px; height: 36px; border-radius: 50%; flex: none; border: 2px solid var(--ink); }
.choice .name { font-weight: 700; font-size: 17px; }
.choice .tag { font-size: 13px; color: var(--gold-soft); }
.choice .desc { font-size: 14px; opacity: .9; line-height: 1.35; }
.choice .stats { list-style: none; margin: 8px 0 0; padding: 6px 0 0; border-top: 1px solid rgba(155, 184, 255, .25); font-size: 13px; color: #8fe3ff; line-height: 1.45; text-align: left; }
.choice .evo-hint { margin-top: 6px; font-size: 12px; color: var(--gold-soft); text-align: left; line-height: 1.35; }
.choice.evolve { border-color: #7a4a00; background: linear-gradient(180deg, #8a5a10, #3a2206);
  box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(255, 217, 59, .7), 0 6px 0 var(--ink); animation: evo-glow 1.2s ease-in-out infinite; }
.choice.evolve .tag { color: #fff; font-weight: 700; }
.choice.evolve .stats { color: #ffe9a0; }
@keyframes evo-glow { 50% { box-shadow: 0 0 0 2px #fff6c0, 0 0 34px rgba(255, 217, 59, .95), 0 6px 0 var(--ink); } }

.btn { background: linear-gradient(180deg, #ffd34d, #f0a516); color: var(--ink); border: 3px solid var(--ink);
  border-radius: 8px; padding: 10px 28px; font: inherit; font-size: 18px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink); min-width: 220px; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.btn.ghost { background: linear-gradient(180deg, #f4f6ff, #c9d3f5); }
.stats { font-size: 17px; line-height: 1.8; }
.stats b { color: var(--gold); }

.btn-ki { position: fixed; right: 24px; bottom: 90px; width: 84px; height: 84px; border-radius: 50%;
  border: 3px solid var(--ink); background: radial-gradient(circle, #fff6b0, #ffb81c 60%, #e05a00); font-family: var(--font);
  color: #5a1a00; font-weight: 700; font-size: 20px; box-shadow: 0 0 24px var(--gold); animation: pulse 0.8s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); box-shadow: 0 0 40px var(--gold); } }
.btn-pause { position: fixed; top: 16px; right: 12px; width: 40px; height: 38px; border-radius: 6px; font-family: var(--font);
  border: 3px solid var(--ink); background: var(--panel-top); color: #fff; font-weight: 700; font-size: 16px; display: none;
  box-shadow: inset 0 0 0 2px var(--border); }
body.playing .btn-pause { display: block; }
/* --sb: ancho de la barra de desplazamiento de la pantalla abierta (los botones no la tapan) */
.btn-music { position: fixed; top: 16px; right: calc(12px + var(--sb, 0px)); width: 40px; height: 38px; border-radius: 6px; font-family: var(--font);
  border: 3px solid var(--ink); background: var(--panel-top); color: #fff; font-weight: 700; font-size: 20px; z-index: 5;
  box-shadow: inset 0 0 0 2px var(--border); cursor: pointer; }
body.playing .btn-music { right: calc(58px + var(--sb, 0px)); }
.btn-music.btn-sfx { right: calc(58px + var(--sb, 0px)); padding: 0; }
.btn-sfx svg { width: 20px; height: 20px; display: block; margin: 0 auto; }
body.playing .btn-music.btn-sfx { right: calc(104px + var(--sb, 0px)); }
.btn-pause.btn-map { right: 150px; font-size: 18px; }
.btn-music.off { color: rgba(255, 255, 255, .45); }
.btn-music.off::after { content: ''; position: absolute; left: 7px; right: 7px; top: 50%; height: 3px; background: #ff5c5c;
  transform: rotate(-40deg); border-radius: 2px; }

/* Fin de la partida: victoria (dorado y rayos) y derrota (rojo y apagado) */
.go-badge { font-size: clamp(38px, 7vw, 56px); font-weight: 700; letter-spacing: 4px; line-height: 1; }
#gameover.won { background: radial-gradient(circle at 50% 45%, rgba(255, 200, 60, .45), rgba(40, 20, 0, .55) 45%, rgba(10, 6, 20, .85) 75%); overflow: hidden; }
#gameover.won::before { content: ''; position: absolute; left: 50%; top: 45%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax;
  background: repeating-conic-gradient(rgba(255, 226, 122, .16) 0deg 8deg, transparent 8deg 22deg); animation: go-rays 24s linear infinite; pointer-events: none; }
#gameover .go-box { position: relative; z-index: 1; }
#gameover.won .go-box { border-color: #7a4a00;
  box-shadow: inset 0 0 0 3px var(--panel-top), inset 0 0 0 5px var(--gold), 0 0 40px rgba(255, 217, 59, .55), 0 8px 0 rgba(0, 0, 0, .35); }
#gameover.won .go-badge { color: var(--gold); text-shadow: 3px 3px 0 #c2410c, 6px 6px 0 var(--ink), 0 0 24px rgba(255, 217, 59, .8);
  animation: go-pulse 1.4s ease-in-out infinite; }
#gameover.won h2 { color: #fff; }
#gameover.lost { background: radial-gradient(circle at 50% 45%, rgba(120, 10, 10, .45), rgba(5, 0, 0, .88) 70%); }
#gameover.lost .go-box { background: linear-gradient(180deg, #3a2a3e, #1c1424); box-shadow: inset 0 0 0 3px #3a2a3e, inset 0 0 0 5px #8a3a3a, 0 8px 0 rgba(0, 0, 0, .35); }
#gameover.lost .go-badge { color: #ff4d4d; text-shadow: 3px 3px 0 #4a0000, 6px 6px 0 var(--ink); }
#gameover.lost h2 { color: #d8cfe0; font-size: 22px; }
@keyframes go-rays { to { transform: rotate(360deg); } }
@keyframes go-pulse { 50% { transform: scale(1.08); } }

/* Aviso de versión nueva y versiones distintas en la sala */
.update-banner { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 10px;
  max-width: calc(100% - 32px); padding: 8px 12px; border: 3px solid var(--ink); border-radius: 10px; font-size: 14px; text-align: left;
  background: linear-gradient(180deg, #2f9e4f, #1d6b34); box-shadow: inset 0 0 0 2px #6fe08a, 0 6px 0 rgba(0, 0, 0, .35); }
.update-banner .btn { min-width: 0; padding: 6px 14px; white-space: nowrap; }
.update-banner .link-btn { color: #fff; font-size: 16px; padding: 0 4px; }
body.playing .update-banner { display: none; }
.lp-ver { margin-left: auto; font-size: 12px; color: #ffb35c; }
.lobby-ver-warn { font-size: 13px; color: #ffb35c; padding: 4px 6px; text-align: left; }

/* Personajes bloqueados en el menú */
.char-card.locked { cursor: default; border-style: dashed; }
.char-card.locked canvas { filter: brightness(0) opacity(.55); }
.char-card.locked .info, .char-card.locked .best { display: none; }
.lock-info { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 4px; font-size: 11px; line-height: 1.25; }
.lock-info b { color: var(--gold-soft); }
.lock-info span { opacity: .85; }
.lock-info .btn { min-width: 0; padding: 4px 8px; font-size: 12px; }
.go-unlock { color: #3dff7a; }
body.playing.aim-on canvas { cursor: crosshair; }

/* Modo prueba */
.test-badge { position: fixed; left: 50%; bottom: 6px; transform: translateX(-50%); z-index: 40; max-width: calc(100% - 32px);
  padding: 4px 10px; border-radius: 8px; background: rgba(160, 30, 30, .85); border: 2px solid var(--ink); font-size: 12px;
  text-align: center; pointer-events: none; }
body.playing .test-badge { bottom: auto; top: 76px; opacity: .8; }

/* Descripciones al pasar el mouse (técnicas y mejoras en la pausa) */
[data-tip] { cursor: help; }
.ps-tech [data-tip]:hover, .ps-chips [data-tip]:hover { color: var(--gold-soft); }
.tip { position: fixed; z-index: 100; max-width: 300px; padding: 8px 10px; border: 2px solid var(--border); border-radius: 8px;
  background: rgba(10, 15, 46, .96); box-shadow: 0 6px 0 rgba(0, 0, 0, .35); font-size: 12px; line-height: 1.4; text-align: left;
  pointer-events: none; }
.tip b { display: block; color: var(--gold); font-size: 14px; margin-bottom: 2px; }
.tip div + div { margin-top: 3px; }
/* Zonas sobre las casillas del HUD (técnicas y mejoras) con la pausa abierta */
.hud-tips { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.hud-tip { position: absolute; pointer-events: auto; border: 2px solid rgba(255, 217, 59, .35); border-radius: 4px; }
.hud-tip:hover { border-color: var(--gold); background: rgba(255, 217, 59, .18); box-shadow: 0 0 10px rgba(255, 217, 59, .6); }

/* Estadísticas al final de la partida */
.go-box { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.go-detail { width: 100%; text-align: left; flex: none; }
.go-detail .mvp { color: var(--gold); font-weight: 700; }
.go-team { width: 100%; border-collapse: collapse; font-size: 13px; }
.go-team th { text-align: left; color: var(--gold-soft); padding: 2px 6px; border-bottom: 1px solid rgba(155, 184, 255, .3); }
.go-team td { padding: 3px 6px; border-bottom: 1px solid rgba(155, 184, 255, .12); }
.go-team tr.me td { color: var(--gold-soft); }
#gameover { overflow-y: auto; }

/* Logros: pantalla, cartel al conseguir uno y línea en la pantalla final */
.ach-list { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 6px; }
.ach { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px;
  background: rgba(10, 15, 46, .45); opacity: .6; }
.ach.done { opacity: 1; background: rgba(255, 217, 59, .12); box-shadow: inset 0 0 0 1px rgba(255, 217, 59, .45); }
.ach .trophy { font-size: 20px; text-align: center; filter: grayscale(1); }
.ach.done .trophy { filter: none; }
.ach b { display: block; color: #fff; font-size: 14px; }
.ach.done b { color: var(--gold); }
.ach span { font-size: 12px; opacity: .85; }
.ach em { font-style: normal; color: var(--gold-soft); font-size: 13px; font-weight: 700; }
.ach small { font-size: 11px; opacity: .75; }
.ach-prog { height: 5px; margin: 4px 0 1px; background: rgba(255, 255, 255, .12); border-radius: 3px; overflow: hidden; }
.ach-prog i { display: block; height: 100%; background: var(--gold); }
.ach-toast { position: fixed; top: 64px; left: 50%; z-index: 70; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px);
  padding: 8px 14px; border: 3px solid var(--ink); border-radius: 10px; text-align: left; pointer-events: none;
  background: linear-gradient(180deg, #8a5a10, #3a2206); box-shadow: 0 0 0 2px var(--gold), 0 0 20px rgba(255, 217, 59, .6), 0 6px 0 rgba(0, 0, 0, .35);
  transform: translate(-50%, -20px); opacity: 0; transition: transform .3s, opacity .3s; }
.ach-toast.in { transform: translate(-50%, 0); opacity: 1; }
.ach-toast .trophy { font-size: 26px; }
.ach-toast b { display: block; color: var(--gold); font-size: 15px; }
.ach-toast small { font-size: 12px; opacity: .9; }
.go-ach { color: var(--gold-soft); }

/* Contraseña del modo prueba */
#testLogin { z-index: 80; }
#testPass { font: inherit; font-size: 16px; padding: 8px 12px; border-radius: 8px; border: 2px solid var(--border);
  background: var(--ink); color: #fff; width: min(260px, 100%); text-align: center; }

/* Menú de Técnicas: pestañas de guerreros y tarjetas técnica → evolución */
.tk-tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tk-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px; min-width: 72px; font: inherit; font-size: 12px;
  color: #fff; background: rgba(10, 15, 46, .55); border: 2px solid rgba(155, 184, 255, .35); border-radius: 8px; cursor: pointer; }
.tk-tab canvas { width: 40px; height: 37px; image-rendering: pixelated; }
.tk-tab:hover { border-color: var(--gold-soft); }
.tk-tab.active { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); color: var(--gold); }
.tk-tab.locked canvas { filter: brightness(0) opacity(.55); }
.tk-head { margin-top: 4px; padding: 8px 10px; border-radius: 8px; background: rgba(10, 15, 46, .45); font-size: 13px; }
.tk-head > b { color: var(--gold); font-size: 18px; }
.tk-head div { margin-top: 2px; opacity: .9; }
.tk-lock { margin-top: 4px; color: var(--gold-soft); }
.tk-group { color: var(--gold); font-size: 16px; margin: 6px 0 0; }
.tk-group small { color: #fff; opacity: .65; font-weight: 400; font-size: 12px; }
.tk-card { display: grid; grid-template-columns: 40px 1fr 230px; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 8px;
  background: rgba(10, 15, 46, .55); border: 2px solid rgba(155, 184, 255, .25); }
.tk-icon { image-rendering: pixelated; border-radius: 4px; }
.tk-name { display: flex; align-items: center; gap: 8px; }
.tk-name b { font-size: 15px; color: #fff !important; }
.tk-type { font-size: 11px; padding: 1px 6px; border-radius: 8px; background: rgba(155, 184, 255, .2); color: #cfe0ff; }
.tk-main p { font-size: 13px; margin: 2px 0 4px; opacity: .9; }
.tk-stats { font-size: 12px; color: #cfe0ff; }
.tk-stats b { color: #fff !important; }
.tk-evo { padding: 6px 8px; border-radius: 6px; background: rgba(255, 217, 59, .1); box-shadow: inset 0 0 0 1px rgba(255, 217, 59, .4); font-size: 12px; }
.tk-evo.none { background: rgba(255, 255, 255, .04); box-shadow: none; opacity: .55; text-align: center; }
.tk-evo-path { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.tk-evo-path span { color: var(--gold); font-weight: 700; }
.tk-evo b { display: block; color: var(--gold) !important; font-size: 13px; }
.tk-evo small { display: block; opacity: .9; }
.tk-evo p { margin: 3px 0 0; font-size: 11px; opacity: .8; }
.tk-pas-list { display: flex; flex-direction: column; gap: 6px; }
.tk-pas { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 6px; background: rgba(10, 15, 46, .45); }
.tk-pas b { display: block; font-size: 13px; }
.tk-pas small { font-size: 11px; opacity: .85; }
@media (max-width: 640px) {
  .tk-card { grid-template-columns: 40px 1fr; }
  .tk-evo { grid-column: 1 / -1; }
  .tk-tab { min-width: 60px; font-size: 11px; }
}
/* Menú de Técnicas: columna fija de mejoras a la izquierda + técnicas del guerrero a la derecha */
#techs .help-box { width: min(1180px, 100%); }
.tk-layout { display: grid; grid-template-columns: 250px 1fr; gap: 14px; align-items: start; width: 100%; }
.tk-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 8px;
  background: rgba(10, 15, 46, .45); border: 2px solid rgba(155, 184, 255, .25); }
.tk-side .tk-group { margin: 0; }
.tk-side-note { font-size: 12px !important; opacity: .8; margin: 0; }
.tk-content { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tk-pas em { display: block; font-style: normal; font-size: 11px; color: var(--gold-soft); margin-top: 2px; }
@media (max-width: 760px) {
  .tk-layout { grid-template-columns: 1fr; }
  .tk-side { order: 2; position: static; }
}

/* Selección de nivel (una saga por nivel) */
.level-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; }
.level-card { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; text-align: left; font: inherit; color: #fff; cursor: pointer;
  background: rgba(10, 15, 46, .55); border: 2px solid rgba(155, 184, 255, .35); border-radius: 8px; transition: transform .1s, border-color .1s; }
.level-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.level-card.selected { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); background: rgba(10, 15, 46, .85); }
.level-card .lv-num { font-size: 11px; color: var(--gold-soft); }
.level-card b { font-size: 15px; color: var(--gold); line-height: 1.1; }
.level-card small { font-size: 11px; opacity: .8; }
.level-card .lv-state { font-size: 11px; color: #8fe3ff; }
.level-card.locked { cursor: default; opacity: .55; border-style: dashed; }
.level-card.locked:hover { transform: none; border-color: rgba(155, 184, 255, .35); }
.level-card .swatch { display: flex; gap: 2px; margin-top: 2px; }
.level-card .swatch i { width: 14px; height: 6px; border-radius: 2px; }
.go-level { color: var(--gold-soft); font-weight: 700; }
@media (max-width: 640px) {
  .level-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .level-card { padding: 4px 8px; }
  .level-card small { display: none; }
}
.lobby-level { font: inherit; font-size: 15px; padding: 6px 10px; border-radius: 8px; border: 2px solid var(--border); background: var(--ink); color: #fff; }
/* Volver a sortear las cartas de subida de nivel */
.reroll-btn { margin-top: 14px; min-width: 0; padding: 8px 18px; }

/* Ranking */
.go-rank { margin: 6px 0 2px; font-size: 14px; }
.go-rank:empty { display: none; }
.rk-res { color: var(--gold); }
.rk-note { opacity: .85; }
.rk-ask { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px;
  background: rgba(255, 217, 59, .08); border: 1px solid rgba(255, 217, 59, .35); }
.rk-name { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.rk-name input.rk-missing { border-color: #ff6b6b; }
.rk-name input { width: 120px; padding: 4px 8px; font: inherit; font-size: 14px; border-radius: 6px; border: 2px solid var(--border); background: rgba(0, 0, 0, .35); color: #fff; }
.rk-views { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
.rk-view { padding: 6px 14px; font: inherit; font-size: 14px; color: #fff; cursor: pointer; border-radius: 8px;
  background: rgba(0, 0, 0, .25); border: 2px solid rgba(155, 184, 255, .4); }
.rk-view.active { border-color: var(--gold); color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); }
.rk-chars { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin: -2px 0 10px; }
.rk-char { padding: 3px 9px; font: inherit; font-size: 12px; color: #fff; cursor: pointer; border-radius: 999px;
  background: rgba(0, 0, 0, .2); border: 1px solid rgba(155, 184, 255, .4); }
.rk-char:hover { border-color: var(--gold-soft); }
.rk-char.active { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.rk-soon { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center;
  border: 2px dashed rgba(155, 184, 255, .4); border-radius: 10px; }
.rk-soon b { font-size: 22px; color: var(--gold); }
.rk-soon span { opacity: .85; max-width: 420px; }
.rk-tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 10px; }
.rk-tab { display: flex; flex-direction: column; align-items: center; padding: 5px 10px; min-width: 110px; font: inherit; font-size: 13px; color: #fff; cursor: pointer;
  background: rgba(0, 0, 0, .25); border: 2px solid rgba(155, 184, 255, .4); border-radius: 8px; }
.rk-tab small { font-size: 11px; opacity: .8; }
.rk-tab:hover { border-color: var(--gold-soft); }
.rk-tab.active { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); color: var(--gold); }
.rk-table { overflow-x: auto; text-align: center; }
.rk-table table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.rk-table th { color: var(--gold-soft); padding: 4px 6px; border-bottom: 1px solid rgba(155, 184, 255, .3); white-space: nowrap; }
.rk-table td { padding: 4px 6px; border-bottom: 1px solid rgba(155, 184, 255, .12); white-space: nowrap; }
.rk-table tr.me td { background: rgba(255, 217, 59, .14); }
.rk-pos { text-align: center; font-weight: bold; width: 32px; font-size: 15px; }
.rk-beta { margin: 0 0 10px; padding: 6px 10px; font-size: 13px; text-align: center; color: #ffe0a0; background: rgba(255, 170, 40, .12); border: 1px solid rgba(255, 170, 40, .45); border-radius: 8px; }
.rk-won { color: #3dff7a; }
.rk-lost { color: #ffb0b0; }
.rk-date { opacity: .7; }
.rk-msg { opacity: .85; padding: 16px 0; }
#rankMore { margin-top: 10px; }
@media (max-width: 600px) {
  .rk-tab { min-width: 72px; padding: 4px 6px; font-size: 12px; }
  .rk-tab small, .rk-date { display: none; }
  .rk-table th:nth-child(8) { display: none; }
  .rk-aim-txt { display: none; }
}
