/* ============ Minecraft Survivor — interfaz estilo Minecraft ============
 * Paneles de piedra oscura con bisel de un texel (claro arriba-izquierda,
 * oscuro abajo-derecha) sobre deepslate, botones de piedra gris, el botón
 * principal en el verde de Bedrock y fuente pixel local (Pixelify Sans, OFL).
 */
/* Pixelify Sans con los números redibujados para que no se confundan (tools/make_font.py). */
@font-face {
  font-family: 'Pixelify';
  src: url('../assets/fonts/PixelifyPS-400.ttf') format('truetype');
  font-weight: 400 550;
  font-display: block;
}
@font-face {
  font-family: 'Pixelify';
  src: url('../assets/fonts/PixelifyPS-700.ttf') format('truetype');
  font-weight: 551 900;
  font-display: block;
}

:root {
  --ink: #ffffff;
  --muted: #b4b4b8;
  --box1: #2e2e32;            /* panel */
  --box2: #1e1e21;
  --edge: #ffffff;            /* borde de selección / hover */
  --edge-in: #5c5c62;         /* bisel claro */
  --edge-out: #000000;        /* contorno */
  --bev-d: #111113;           /* bisel oscuro */
  --slot: rgba(0,0,0,.34);    /* ranura hundida */
  --gold: #ffd23f;
  --gold2: #f0a31e;
  --emerald: #17dd62;
  --lime: #80ff20;            /* experiencia */
  --enchant: #c77dff;         /* brillo de encantamiento */
  --red: #ff5555;
  --green: #55ff55;
  --shadow: #1c1c1c;          /* sombra dura del texto */
  --play: #3c8527; --play-d: #1d4d13; --play-l: #52a535;
  --r1: #9fb1c9; --r2: #5fe08a; --r3: #4fb4ff; --r4: #c47bff; --r5: #ffcb3d;
  --font: 'Pixelify', 'Segoe UI', system-ui, sans-serif;
  /* Texturas (a 4×, pixeladas). */
  --tx-panel: url('../assets/mc/blocks/deepslate/deepslate_tiles.png');
  --tx-stone: url('../assets/mc/blocks/stone.png');
  --tx-dirt: url('../assets/mc/blocks/deepslate/deepslate.png');
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: #0b0b0f;
  color: var(--ink);
  font: 16px/1.35 var(--font);
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: none;
  /* Pixelify's "fi" ligature is a broken glyph ("fire" read "Are"): no ligatures. */
  font-variant-ligatures: none;
}
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
#game { display: block; width: 100vw; height: 100vh; height: 100dvh; touch-action: none; }
button { font: inherit; color: inherit; }
input { font: inherit; }

/* ---------- capas de pantalla ---------- */
.scr {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade .2s ease-out;
}
.scr.hidden { display: none; }
/* Pantallas que se abren con la barra superior a la vista: empiezan debajo de ella. */
@media (min-height: 521px) {
  #scr-goals, #scr-dex, #scr-upgrades, #scr-gacha, #scr-friends, #scr-rank, #scr-lobby, #scr-profile, #scr-support { padding-top: 66px; }
}
.scr.dim { background: radial-gradient(circle at 50% 40%, rgba(12,12,16,.5), rgba(6,6,9,.88)); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- panel de Minecraft ---------- */
.box {
  position: relative;
  background:
    linear-gradient(180deg, rgba(46,46,50,.9), rgba(26,26,29,.94)),
    var(--tx-panel) 0 0 / 64px 64px;
  border: 3px solid var(--edge-out);
  border-radius: 0;
  box-shadow: inset 3px 3px 0 var(--edge-in), inset -3px -3px 0 var(--bev-d), 0 18px 50px rgba(0,0,0,.6);
  padding: 22px 24px;
  text-shadow: 2px 2px 0 var(--shadow);
  image-rendering: pixelated;
  animation: pop .22s ease-out;
  max-height: 100%;
  overflow: auto;
}
.box h1, .box h2, .box h3 { margin: 0 0 6px; font-weight: 700; letter-spacing: .5px; }
.box h2 { font-size: 26px; }
.box h3 { font-size: 18px; }
.sub { color: var(--muted); margin: 0 0 16px; font-size: 15px; }
.gold { color: var(--gold); }
.center { text-align: center; }

/* ---------- botones ---------- */
.btn {
  appearance: none; cursor: pointer;
  padding: 10px 20px 12px;
  border: 2px solid var(--edge-out);
  border-radius: 0;
  /* Botón de piedra: textura de piedra aclarada, bisel claro arriba y borde grueso oscuro abajo. */
  background: linear-gradient(180deg, rgba(150,150,154,.55), rgba(96,96,100,.6)), var(--tx-stone) 0 0 / 48px 48px;
  background-color: #6f6f73;
  image-rendering: pixelated;
  box-shadow: inset 2px 2px 0 #b4b4b8, inset -2px -4px 0 #3c3c40;
  color: #fff;
  font-size: 17px; font-weight: 700;
  text-shadow: 2px 2px 0 #2a2a2a;
  transition: transform .06s, filter .12s;
}
.btn:hover { filter: brightness(1.12); border-color: var(--edge); }
.btn:active { transform: translateY(2px); box-shadow: inset 2px 2px 0 #3c3c40, inset -2px -2px 0 #8a8a8e; }
.btn:disabled { filter: grayscale(1) brightness(.6); cursor: not-allowed; transform: none; border-color: var(--edge-out); }
.btn.gold {
  /* El botón verde de Bedrock. */
  background: var(--play);
  color: #fff; text-shadow: 2px 2px 0 var(--play-d);
  border-color: var(--edge-out);
  box-shadow: inset 2px 2px 0 var(--play-l), inset -2px -5px 0 var(--play-d);
}
.btn.gold:hover { border-color: var(--edge); }
.btn.gold:active { box-shadow: inset 2px 2px 0 var(--play-d), inset -2px -2px 0 var(--play-l); }
.btn.ghost {
  background: rgba(16,16,18,.78);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.14), inset -2px -2px 0 rgba(0,0,0,.55);
  border-color: var(--edge-out);
}
.btn.ghost:hover { background: rgba(60,60,64,.85); border-color: var(--edge); filter: none; }
.btn.small { padding: 5px 12px 7px; font-size: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

/* Lista de menú con cursor (flecha pixel art), como en PMD */
.menu-list { display: flex; flex-direction: column; gap: 4px; }
.menu-item {
  appearance: none; background: none; border: 2px solid transparent; cursor: pointer;
  text-align: left; padding: 8px 10px 8px 30px; border-radius: 0;
  font-size: 22px; font-weight: 700; letter-spacing: .5px;
  text-shadow: 2px 2px 0 var(--shadow);
  position: relative;
}
.menu-item small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.menu-item::before {
  content: ''; position: absolute; left: 6px; top: 14px; width: 16px; height: 24px;
  background: var(--ico-cursor) no-repeat center / contain; image-rendering: pixelated;
  opacity: 0; transition: opacity .1s, transform .1s; transform: translateX(-4px);
}
.menu-item:hover, .menu-item:focus-visible { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.75); outline: none; }
.menu-item:hover::before, .menu-item:focus-visible::before { opacity: 1; transform: none; }
/* Jugar: el botón verde de Bedrock. */
.menu-item.play {
  font-size: 30px; color: #fff; margin-bottom: 6px;
  background: var(--play); border-color: var(--edge-out);
  box-shadow: inset 3px 3px 0 var(--play-l), inset -3px -5px 0 var(--play-d);
  text-shadow: 2px 2px 0 var(--play-d);
}
.menu-item.play small { color: #d6f5c8; }
.menu-item.play:hover, .menu-item.play:focus-visible { background: #46962f; border-color: var(--edge); }
.menu-item.play::before { display: none; }
.menu-item { display: grid; grid-template-columns: 34px 1fr; column-gap: 8px; align-items: center; }
.menu-item small { grid-column: 2; }
.mi-ico { grid-row: span 2; display: flex; }

/* ---------- formularios ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab {
  flex: 1; padding: 8px; cursor: pointer; border-radius: 0;
  background: var(--slot); border: 2px solid var(--edge-out);
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.45), inset -2px -2px 0 rgba(255,255,255,.08);
  text-align: center; font-weight: 700; color: var(--muted);
}
.tab:hover { color: #fff; }
.tab.on {
  color: #fff; background: #4a4a4f;
  box-shadow: inset 2px 2px 0 #7a7a80, inset -2px -2px 0 #2a2a2e;
}
label { display: block; font-size: 14px; color: var(--muted); margin: 8px 0 4px; }
.field {
  /* Campo de texto de Minecraft: negro con borde gris claro. */
  width: 100%; padding: 10px 12px;
  background: #000; color: #fff;
  border: 2px solid #a0a0a0; border-radius: 0;
  font-size: 17px; outline: none;
}
.field:focus { border-color: var(--edge); }
.err { color: #ff6b6b; min-height: 20px; font-size: 14px; margin: 8px 0 0; }
.note { color: var(--muted); font-size: 13px; margin-top: 14px; }

/* ---------- pantalla de inicio ---------- */
.logo { text-align: center; margin-bottom: 18px; }
/* Logo: letras de piedra (textura de piedra recortada al texto) con el canto
   oscuro en 3D del logo de Minecraft. El subtítulo es el texto amarillo
   que late, como el "splash" del menú del juego. */
.logo .t1 {
  font-size: 46px; font-weight: 700; line-height: 1.05; letter-spacing: 2px; text-transform: uppercase;
  color: #9a9a9e;
  background: linear-gradient(180deg, rgba(255,255,255,.38), rgba(255,255,255,.08) 48%, rgba(0,0,0,.18) 52%, rgba(0,0,0,.05)), var(--tx-stone) 0 0 / 32px 32px;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  image-rendering: pixelated;
  text-shadow: none;
  filter: drop-shadow(2px 0 0 #161618) drop-shadow(-2px 0 0 #161618) drop-shadow(0 -2px 0 #161618)
          drop-shadow(0 3px 0 #4a4a4e) drop-shadow(0 3px 0 #2a2a2c) drop-shadow(3px 3px 0 rgba(0,0,0,.6));
}
.logo .t2 {
  display: inline-block; font-size: 18px; font-weight: 700; color: #ffff55; margin-top: 8px; letter-spacing: 1px;
  text-shadow: 2px 2px 0 #3f3f15; transform: rotate(-3deg);
  animation: splash .55s ease-in-out infinite alternate;
}
@keyframes splash { to { transform: rotate(-3deg) scale(1.07); } }
@media (prefers-reduced-motion: reduce) { .logo .t2 { animation: none; } }

/* ---------- test de personalidad ---------- */
.test-box { width: min(620px, 100%); }
.progress { height: 10px; background: #1d2a12; border: 2px solid #000; border-radius: 0; overflow: hidden; margin-bottom: 18px; }
.progress i { display: block; height: 100%; background: linear-gradient(180deg, #c8ff7a 0 25%, var(--lime) 25% 75%, #4fb010 75%); transition: width .25s; }
.q { font-size: 22px; margin: 0 0 16px; min-height: 2.6em; }
.answers { display: flex; flex-direction: column; gap: 8px; }
.answer {
  appearance: none; text-align: left; cursor: pointer;
  padding: 12px 16px 12px 34px; position: relative;
  background: var(--slot); border: 2px solid var(--edge-out); border-radius: 0;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.1), inset -2px -2px 0 rgba(0,0,0,.45);
  font-size: 17px; text-shadow: 2px 2px 0 var(--shadow);
}
.answer::before {
  content: ''; position: absolute; left: 10px; top: 50%; width: 12px; height: 18px; margin-top: -9px;
  background: var(--ico-cursor) no-repeat center / contain; image-rendering: pixelated; opacity: 0;
}
.answer:hover { background: rgba(255,255,255,.1); border-color: var(--edge); }
.answer:hover::before { opacity: 1; }

.result { width: min(560px, 100%); text-align: center; }
.result .trait { font-size: 30px; color: var(--gold); margin: 4px 0; }
.stage {
  display: block; margin: 8px auto 6px;
  /* Recuadro de vitrina: ranura oscura con un foco abajo y borde del color del elemento (--stage-c). */
  background:
    radial-gradient(ellipse at 50% 88%, rgba(255,255,255,.14), transparent 60%),
    linear-gradient(180deg, rgba(24,24,28,.9), rgba(8,8,10,.94));
  border: 3px solid var(--stage-c, #6a6a70);
  border-radius: 0;
  box-shadow: 0 0 0 3px #000, 0 10px 30px rgba(0,0,0,.5), inset 3px 3px 0 rgba(0,0,0,.5), inset -3px -3px 0 rgba(255,255,255,.08);
}
.stage.shiny { box-shadow: 0 0 0 3px #000, 0 0 24px rgba(199,125,255,.6), inset 3px 3px 0 rgba(0,0,0,.5), inset -3px -3px 0 rgba(255,255,255,.08); }

/* ---------- rejilla de Pokémon ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px; max-height: 56vh; overflow-y: auto; padding: 4px;
}
.cell {
  /* Ranura de inventario hundida. */
  position: relative; cursor: pointer; text-align: center;
  background: var(--slot); border: 2px solid var(--edge-out); border-radius: 0;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.5), inset -2px -2px 0 rgba(255,255,255,.1);
  padding: 4px 2px 6px; transition: transform .08s, border-color .12s, background .12s;
}
.cell:hover { transform: translateY(-2px); border-color: var(--edge); background: rgba(255,255,255,.1); }
.cell.on { border-color: var(--gold); background: rgba(255,210,63,.14); }
.cell.locked { cursor: default; opacity: .7; }
.cell.locked:hover { transform: none; border-color: var(--edge-out); background: var(--slot); }
.cell canvas { display: block; margin: 0 auto; }
.cell b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .no { position: absolute; top: 3px; left: 6px; font-size: 11px; color: var(--muted); }
.cell .stars { font-size: 10px; letter-spacing: -1px; }
.cell .partner { position: absolute; top: 3px; right: 5px; font-size: 12px; }

.wide { width: min(980px, 100%); }
.split { display: grid; grid-template-columns: 1fr 300px; gap: 18px; }
.panel {
  background: rgba(0,0,0,.28); border: 2px solid var(--edge-out); border-radius: 0; padding: 14px;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.45), inset -2px -2px 0 rgba(255,255,255,.08);
}
.stat { display: grid; grid-template-columns: 90px 1fr 34px; gap: 8px; align-items: center; font-size: 14px; margin: 5px 0; }
.stat .bar { height: 8px; background: #111; border: 1px solid #000; border-radius: 0; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: linear-gradient(180deg, #ffe680 0 30%, var(--gold) 30%); }
.type {
  display: inline-block; padding: 2px 8px; border-radius: 0; font-size: 12px; font-weight: 700;
  color: #10131a; text-shadow: none; margin-right: 4px;
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.25), inset 2px 2px 0 rgba(255,255,255,.3);
}
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  appearance: none; cursor: pointer; padding: 4px 10px; border-radius: 0;
  background: rgba(0,0,0,.35); border: 2px solid #4a4a50; font-size: 13px;
  text-shadow: 1px 1px 0 var(--shadow);
}
.chip:hover { border-color: #9a9aa0; }
.chip.on { border-color: var(--gold); color: var(--gold); background: rgba(255,210,63,.1); }

/* ---------- menú principal ---------- */
#scr-menu { justify-content: space-between; align-items: stretch; padding: 0; }
.menu-left {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 30px; min-width: 0;
}
.menu-left .logo .t1 { font-size: clamp(36px, 6vw, 64px); }
.partner-card { text-align: center; margin-top: 10px; }
.partner-card .nm { font-size: 24px; font-weight: 700; text-shadow: 3px 3px 0 var(--shadow); }
.partner-card .lv { color: var(--muted); font-size: 14px; text-shadow: 2px 2px 0 var(--shadow); }
.menu-right {
  width: min(380px, 100%); display: flex; flex-direction: column;
  /* Arriba deja sitio a la barra superior; si no cabe todo, se desplaza
     (los márgenes auto lo centran sin que se salga por arriba). */
  padding: 70px 24px 18px; gap: 14px; overflow-y: auto;
  background: linear-gradient(90deg, transparent, rgba(8,8,11,.7) 30%);
}
.menu-right > :first-child { margin-top: auto; }
.menu-right > :last-child { margin-bottom: auto; }
/* Portátiles con poca altura: menú más compacto y, si hace falta, en dos columnas. */
@media (max-height: 780px) and (min-height: 521px) {
  .menu-right { padding-top: 62px; gap: 10px; }
  .menu-right .box { padding: 10px 14px; }
  .menu-item { font-size: 17px; padding: 5px 10px; }
  .menu-item.play { font-size: 24px; }
  .menu-item small { font-size: 11px; }
}
@media (max-height: 660px) and (min-height: 521px) {
  .menu-right { width: min(500px, 52vw); }
  .menu-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 6px; }
  .menu-item.play { grid-column: span 2; }
  .menu-item small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu-left .logo .t1 { font-size: clamp(32px, 5vw, 52px); }
  #menu-partner { height: min(30vh, 200px); width: auto; }
}
.topbar {
  position: fixed; top: 14px; right: 16px; z-index: 25;
  display: flex; gap: 10px; align-items: center;
}
.pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 0;
  background: rgba(16,16,18,.85); border: 2px solid var(--edge-out);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.14), inset -2px -2px 0 rgba(0,0,0,.55);
  font-weight: 700; text-shadow: 2px 2px 0 var(--shadow);
}
.pill:has(.coin) { color: var(--emerald); }
.coin {
  display: inline-block; width: 18px; height: 18px; vertical-align: -3px;
  background: var(--ico-coin) no-repeat center / contain; image-rendering: pixelated;
}
.credits-line {
  position: fixed; left: 14px; bottom: 10px; z-index: 25; font-size: 12px; color: rgba(200,200,205,.7);
  max-width: calc(100vw - 28px);
  text-shadow: 1px 1px 0 #000;
}

/* ---------- mejoras ---------- */
.upg { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.upg-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; }
.upg-item .ic { font-size: 26px; text-align: center; }
.pips { display: flex; gap: 3px; margin-top: 4px; }
.pips i { width: 12px; height: 6px; border-radius: 0; background: #111; box-shadow: 0 0 0 1px #000; }
.pips i.on { background: var(--lime); box-shadow: 0 0 0 1px #000, inset 0 2px 0 #c8ff7a; }

/* ---------- gacha ---------- */
.banner {
  /* El fondo de cada reino lo pone gacha-ui.js; aquí, el marco y una capa de textura. */
  position: relative; border-radius: 0; overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, #1f5a1c, #3a7a2a 55%, #2a5a8a);
  border: 3px solid var(--edge-out);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.2), inset -3px -3px 0 rgba(0,0,0,.45);
  padding: 18px;
}
.banner::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--tx-dirt) 0 0 / 64px 64px; image-rendering: pixelated; opacity: .16; mix-blend-mode: overlay;
}
/* Suelo de bloques bajo los mobs destacados. */
.banner::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 22px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.55)), var(--tx-dirt) 0 0 / 22px 22px;
  image-rendering: pixelated; border-top: 3px solid rgba(0,0,0,.6);
}
.banner h3 { font-size: 28px; color: var(--gold); text-shadow: 3px 3px 0 #3a2a00; }
.banner .feat {
  /* Debajo del texto, nunca encima: los legendarios a ×2 son grandes. */
  display: flex; align-items: flex-end; justify-content: center; gap: 6px;
  margin: 8px -10px -18px; height: 190px; overflow: hidden;
}
.banner .feat canvas { flex: 0 0 auto; }
.rates { font-size: 14px; }
.rates div { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 2px solid rgba(0,0,0,.35); }
.rates .rates-leg { margin-top: 12px; }
.rates .rate-mob { font-size: 13px; }
/* The rare lure (Herobrine): red, so its odds read at a glance. */
.rates .rate-mob.lure span, .banner .lure { color: var(--red); }

#pull-fx {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column;
  align-items: center; gap: 18px; padding: 14px 10px;
  /* Si las 10 cartas no caben (móvil en horizontal) se puede desplazar, y
     "Continuar" se queda siempre a la vista abajo (antes quedaba fuera y no
     había forma de cerrar sin recargar la página). */
  overflow-y: auto; overscroll-behavior: contain;
  /* Luz de las llamas del spawner en la oscuridad. */
  background: radial-gradient(circle at 50% 45%, #3a2414, #0c0806 55%, #030303 80%);
}
/* Centrado vertical que no corta por arriba cuando no cabe. */
#pull-fx::before, #pull-fx::after { content: ''; margin: auto; }
#pull-close { position: sticky; bottom: 8px; z-index: 2; flex-shrink: 0; box-shadow: 0 4px 18px rgba(0,0,0,.6); }
@media (max-height: 520px) {
  #pull-fx { gap: 10px; }
  .pull-results { gap: 6px; }
  .pcard { width: 100px; padding: 5px 3px; }
  .pcard canvas { width: 84px; height: auto; }
  .pcard b { font-size: 12px; }
  .pcard .tag { font-size: 10px; }
  .pcard .stars { font-size: 11px; }
}
#pull-fx.hidden { display: none; }
.ball {
  width: 120px; height: 120px; border-radius: 50%; position: relative;
  background: linear-gradient(180deg, #ff4d4d 0 47%, #1a1a1a 47% 53%, #f4f4f4 53% 100%);
  border: 5px solid #1a1a1a;
  box-shadow: 0 0 0 0 var(--glow, #fff);
}
.ball::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: #f4f4f4; border: 5px solid #1a1a1a;
}
.ball.drop { animation: drop .55s cubic-bezier(.3,1.6,.6,1) both; }
.ball.shake { animation: shake .45s ease-in-out 3; }
.ball.burst { animation: burst .45s ease-out forwards; }
@keyframes drop { from { transform: translateY(-60vh) rotate(-200deg); } to { transform: none; } }
@keyframes shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-18deg); } 75% { transform: rotate(18deg); } }
@keyframes burst {
  0% { box-shadow: 0 0 0 0 var(--glow); }
  60% { box-shadow: 0 0 80px 40px var(--glow); transform: scale(1.15); }
  100% { box-shadow: 0 0 200px 120px transparent; transform: scale(0); opacity: 0; }
}
/* Mensaje de apoyo al acabar una partida (run-ui.js). */
.support-ask { position: relative; margin-top: 4px; padding: 10px 34px 12px 12px; border-radius: 0; text-align: center;
  background: rgba(255,210,63,.08); border: 2px solid rgba(255,210,63,.45); }
.support-ask p { margin: 0 0 8px; font-size: 13px; color: var(--ink); line-height: 1.35; }
.support-ask .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.support-ask .x { position: absolute; top: 4px; right: 6px; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 2px 6px; }
.pull-results { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 900px; }
.pcard {
  /* Tarjeta como el recuadro de información de un objeto de Minecraft: fondo
     morado casi negro y borde del color de la rareza. */
  width: 150px; padding: 10px 6px; text-align: center; border-radius: 0;
  background: rgba(16,0,16,.94);
  border: 3px solid var(--rc, #fff);
  box-shadow: 0 0 0 3px #100010, 0 0 22px var(--rc, #fff);
  animation: pop .3s ease-out both;
  text-shadow: 2px 2px 0 var(--shadow);
}
.pcard .stars { color: var(--rc); font-size: 14px; }
.pcard b { display: block; font-size: 16px; }
.pcard .tag { font-size: 12px; margin-top: 2px; }
.pcard .new { color: var(--gold); font-weight: 700; }
.pcard.r5 { animation: pop .3s ease-out both, legend 1.4s ease-in-out infinite alternate; }
@keyframes legend { to { box-shadow: 0 0 0 3px #100010, 0 0 40px var(--rc), 0 0 80px var(--rc); } }

/* ---------- cartas de nivel ---------- */
.cards { display: flex; flex-direction: column; gap: 10px; width: min(560px, 100%); }
.card {
  display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer;
  background: rgba(16,16,18,.55); border: 2px solid var(--edge-out); border-radius: 0;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.12), inset -2px -2px 0 rgba(0,0,0,.5);
  padding: 12px 14px; transition: transform .08s, background .12s, border-color .12s;
}
.card:hover { background: rgba(255,255,255,.1); border-color: var(--edge); transform: translateX(4px); }
.card .ico {
  flex: 0 0 46px; height: 46px; border-radius: 0; display: grid; place-items: center; font-size: 24px;
  border: 2px solid #000; box-shadow: inset 2px 2px 0 rgba(0,0,0,.5), inset -2px -2px 0 rgba(255,255,255,.12);
}
.card .txt { flex: 1; }
.card .nm { font-weight: 700; font-size: 18px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card .ds { color: var(--muted); font-size: 14px; }
.card .key { font-size: 13px; color: var(--muted); border: 2px solid #55555a; border-bottom-width: 4px; border-radius: 0; padding: 1px 8px; background: rgba(0,0,0,.3); }
.tag-chip { font-size: 11px; padding: 2px 7px; border-radius: 0; color: #10131a; text-shadow: none; font-weight: 700; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 18px; }
.stats > div { background: var(--slot); border-radius: 0; padding: 8px 10px; box-shadow: inset 2px 2px 0 rgba(0,0,0,.45), inset -2px -2px 0 rgba(255,255,255,.08); }
.stats > div > span:first-child { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.stats b { font-size: 22px; }

kbd {
  display: inline-block; padding: 0 6px; border: 2px solid #6a6a70; border-bottom-width: 4px;
  border-radius: 0; font: inherit; font-size: 13px; text-shadow: none; background: rgba(0,0,0,.35);
}

.toast {
  /* Como los avisos (toasts) de logros de Minecraft. */
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 60;
  padding: 10px 18px; border-radius: 0;
  background: #212121; border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #5a5a5e, inset -2px -2px 0 #0e0e0e, 0 8px 24px rgba(0,0,0,.5);
  text-shadow: 2px 2px 0 var(--shadow); animation: pop .2s ease-out;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #7a7a80; border: 2px solid #000; box-shadow: inset 2px 2px 0 #b0b0b4, inset -2px -2px 0 #3c3c40; border-radius: 0; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.3); }

@media (max-width: 760px) and (min-height: 521px) {
  #scr-menu { flex-direction: column; overflow-y: auto; }
  .menu-right { width: 100%; background: rgba(8,8,11,.72); }
  .split { grid-template-columns: 1fr; }
  .logo .t1 { font-size: 34px; }
}

/* ============ iconos pixel art ============ */
img.pix { image-rendering: pixelated; image-rendering: crisp-edges; vertical-align: middle; }
/* Material de la rareza: contorno claro de un píxel para que el carbón se vea sobre fondo oscuro. */
.rarity-ball img { filter: drop-shadow(1px 0 0 rgba(255,255,255,.28)) drop-shadow(-1px 0 0 rgba(255,255,255,.28)) drop-shadow(0 1px 0 rgba(255,255,255,.28)) drop-shadow(0 -1px 0 rgba(255,255,255,.28)); }
.stars-row { display: inline-flex; gap: 1px; vertical-align: middle; }
.cell .stars-row { display: flex; justify-content: center; margin-top: 2px; }
.badge-r { position: absolute; top: 3px; right: 4px; }
.move-icons { display: flex; flex-wrap: wrap; gap: 3px; margin: 0 0 10px; }
.card .ico img { display: block; }
.upg-item .ic { display: flex; justify-content: center; }

/* ============ pestañas de generación ============ */
.gen-tabs { display: flex; gap: 5px; overflow-x: auto; padding: 4px 2px 8px; margin-top: 6px; }
.gen-tab {
  appearance: none; cursor: pointer; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; line-height: 1.1;
  padding: 6px 12px; border-radius: 0;
  background: var(--slot); border: 2px solid var(--edge-out);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.1), inset -2px -2px 0 rgba(0,0,0,.45);
  text-shadow: 2px 2px 0 var(--shadow);
}
.gen-tab b { font-size: 15px; }
.gen-tab small { font-size: 11px; color: var(--muted); }
.gen-tab:hover { border-color: var(--edge); }
.gen-tab.on { border-color: var(--gold); background: #4a4a4f; box-shadow: inset 2px 2px 0 #7a7a80, inset -2px -2px 0 #2a2a2e; }
.gen-tab.on b { color: var(--gold); }

/* ============ normal / shiny ============ */
.seg { display: flex; justify-content: center; gap: 0; margin: 2px auto 8px; width: max-content;
  border: 2px solid #000; border-radius: 0; overflow: hidden; }
.seg button { appearance: none; cursor: pointer; background: rgba(0,0,0,.25); border: 0;
  padding: 5px 14px; font-size: 14px; display: flex; gap: 5px; align-items: center;
  text-shadow: 2px 2px 0 var(--shadow); }
.seg button.on { background: rgba(199,125,255,.28); color: #ecd6ff; }
.pcard.shiny { animation: pop .3s ease-out both, legend 1.1s ease-in-out infinite alternate; }
.caught > span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.caught-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.caught-row > div { text-align: center; }
.caught-row small { display: block; font-size: 12px; color: #e3c4ff; }

/* ============ sonido ============ */
.sound-panel { position: fixed; top: 62px; right: 16px; z-index: 30; width: 270px; padding: 14px 16px; }
.sound-inline { margin: 6px auto 16px; max-width: 320px; }
.snd-row { display: grid; grid-template-columns: 20px 64px 1fr; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 14px; }
/* Deslizador de Minecraft: pista negra y tirador de piedra. */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border-radius: 0;
  background: #000; border: 2px solid #4a4a50; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 20px; border-radius: 0;
  background: #8a8a8e; border: 2px solid #000; box-shadow: inset 2px 2px 0 #c6c6c6, inset -2px -2px 0 #4a4a4e; cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 8px; height: 18px; border-radius: 0; background: #8a8a8e; border: 2px solid #000; }
#btn-sound { padding: 5px 9px; display: flex; }

/* ============ nube, aviso legal ============ */
.btn.google { background: linear-gradient(180deg, #ffffff, #dfe6f2); color: #1f2a44; text-shadow: none; }
.sync { display: inline-block; width: 9px; height: 9px; margin-left: 8px; border-radius: 0;
  box-shadow: 0 0 0 2px #000; vertical-align: 1px; }
.sync.ok { background: var(--green); }
.sync.syncing, .sync.pending { background: #ffd23f; }
.sync.offline { background: #ff5f6d; }
.sync.local { background: #9fb1c9; }
.sync.guest { display: none; }
.legal-link { color: var(--muted); }
.legal-link:hover { color: #fff; }
.credits-line a { color: inherit; }
.legal h3 { margin: 14px 0 4px; color: var(--gold); font-size: 17px; }
.legal p { margin: 0 0 8px; font-size: 14px; line-height: 1.45; }
.legal a { color: #9fd4ff; }
#scr-legal { z-index: 65; }   /* por delante de Ajustes y Apoyar (60) */
.boot { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  background: #0b0b0f; color: var(--muted); font-size: 18px; }

/* ---------- amigos, sala, invitaciones y ranking ---------- */
.fr-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.fr-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 0;
  background: var(--slot); border: 2px solid var(--edge-out);
}
.fr-row b { font-size: 17px; }
.fr-row .st { color: var(--muted); font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 0; background: #6b6b70; flex: 0 0 10px; }
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.play { background: var(--gold); }
.dot.pend { background: var(--r4); }
#fr-add { margin: 10px 0 0; }
#fr-add .field { min-width: 180px; }

.lobby-members { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.lob-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px;
  border-radius: 0; background: var(--slot); border: 3px solid var(--pc, #3a3a3e);
  min-height: 170px; justify-content: center; text-align: center;
}
.lob-card b { font-size: 17px; color: var(--pc); }
.lob-card small { color: var(--muted); font-size: 12px; }
.lob-card .conn { font-size: 12px; color: var(--green); }
.lob-card .conn.wait { color: var(--gold); }
.lob-card.empty { border-style: dashed; border-color: #3a3a3e; color: var(--muted); }

.invite-pop {
  position: fixed; right: 18px; bottom: 54px; z-index: 70; width: min(340px, calc(100% - 32px));
  padding: 14px 16px; animation: pop .2s ease-out;
}
.invite-pop img { vertical-align: middle; }

.rk-tools { gap: 8px; margin-bottom: 8px; }
.rk-tools .field { width: 220px; padding: 6px 10px; font-size: 15px; }
.rk-list { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.rk-row {
  display: grid; grid-template-columns: 54px auto 1fr auto 26px; gap: 10px; align-items: center;
  padding: 4px 12px; border-radius: 0; background: var(--slot); border: 2px solid transparent;
}
.rk-row .pos { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 4px; color: var(--muted); }
.rk-row.top1 .pos { color: var(--gold); }
.rk-row.top2 .pos { color: #dfe7f5; }
.rk-row.top3 .pos { color: #e0a36b; }
.rk-row .mons { display: flex; }
.rk-row .who { display: flex; flex-direction: column; min-width: 0; }
.rk-row .who b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-row .who small { color: var(--muted); font-size: 12px; }
.rk-row .time { font-size: 22px; font-weight: 700; color: #fff; }
/* Online leaderboard: the floor reached over the time (js/ui/ranking-ui.js). */
.rk-row .time:has(.rk-floor) { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.rk-row .rk-floor { font-size: 15px; white-space: nowrap; text-shadow: 1px 1px 0 #000; }
.rk-row .time small { font-size: 18px; color: #fff; }
.rk-row.mine { border-color: var(--gold); background: rgba(255,210,63,.1); }
.rk-rep { background: none; border: 0; padding: 4px; cursor: pointer; opacity: .35; line-height: 0; }
.rk-rep:hover { opacity: 1; }
.rk-rep.sent { opacity: .12; cursor: default; }
.rk-row.mod-row { grid-template-columns: 54px 1fr auto; }
.mod-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rk-me { margin-top: 10px; padding: 10px 12px; border-radius: 0; background: var(--slot); font-size: 15px; min-height: 20px; }

.cards.done .card { pointer-events: none; opacity: .45; }
.cards.done .card.picked { opacity: 1; border-color: var(--gold); }
#lvl-wait { color: var(--gold); font-size: 15px; }

@media (max-width: 760px) {
  .lobby-members { grid-template-columns: repeat(2, 1fr); }
  .rk-row { grid-template-columns: 40px auto 1fr auto 22px; gap: 6px; }
}

/* ---------- tickets y mejoras por Pokémon ---------- */
.tickets-line img, #tickets-pill img, #cost-1 img, #cost-10 img { vertical-align: middle; }
.upg-head { display: flex; gap: 14px; align-items: center; margin: 6px 0 12px; }
.upg-head .stage { width: 120px; height: 96px; flex: 0 0 120px; }
select.field { font-family: var(--font); }

/* ---------- tragaperras del gacha ---------- */
#slot { width: min(528px, 92vw, 66vh); height: auto; image-rendering: pixelated; cursor: pointer;
  filter: drop-shadow(0 0 34px rgba(255,120,40,.35)); animation: pop .25s ease-out both; }

/* ---------- misiones, logros, perfil y objetos ---------- */
.goals-body { max-height: 62vh; overflow-y: auto; padding-right: 6px; }
.goals-h { margin: 6px 0 4px; }
.goals-h h3 { margin: 0; }
.mission {
  display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center;
  padding: 10px 12px; margin-bottom: 6px; border-radius: 0;
  background: var(--slot); border: 2px solid var(--edge-out);
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.4), inset -2px -2px 0 rgba(255,255,255,.07);
}
.mission.ready { border-color: var(--gold); background: rgba(255,210,63,.1); }
.mission.claimed { opacity: .55; }
.mission small, .ach small { color: var(--muted); font-size: 12px; }
.mission .bar, .ach .bar { height: 8px; background: #1d2a12; border: 1px solid #000; border-radius: 0; overflow: hidden; margin: 4px 0 2px; }
.mission .bar i, .ach .bar i { display: block; height: 100%; background: linear-gradient(180deg, #c8ff7a 0 25%, var(--lime) 25%); }
.m-rw, .a-rw { font-size: 13px; color: var(--ink); }
.m-rw img, .a-rw img, .tag-chip img { vertical-align: middle; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.ach {
  display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 0;
  background: var(--slot); border: 2px solid var(--edge-out);
}
.ach.ok { border-color: rgba(255,210,63,.6); }
.ach .a-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.leg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.leg-cell { display: flex; flex-direction: column; align-items: center; padding: 4px; border-radius: 0; background: var(--slot); border: 2px solid var(--edge-out); }
.leg-cell.ok { border-color: rgba(255,210,63,.5); }
.leg-cell small { font-size: 10px; color: var(--muted); text-align: center; }
.fav-slots { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0; }
.fav-slot {
  width: 140px; min-height: 140px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 0; background: var(--slot); border: 3px dashed #4a4a50; cursor: pointer; text-align: center;
}
.fav-slots.view .fav-slot { cursor: default; border-style: solid; border-color: rgba(255,210,63,.55); }
.fav-slot b { font-size: 14px; }
.profile-box { width: min(640px, 100%); max-height: 90vh; overflow-y: auto; }
.prof-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: -10px; }
.prof-head h2 { margin: 0; }
.prof-title { color: var(--gold); font-size: 15px; border: 2px solid var(--gold); border-radius: 0; padding: 1px 8px; }
.prof-marks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.prof-marks div { background: var(--slot); border-radius: 0; padding: 6px 8px; display: flex; flex-direction: column; }
.prof-marks span { color: var(--muted); font-size: 12px; }
.prof-marks b { font-size: 18px; }
.prof-medals { display: flex; flex-wrap: wrap; gap: 8px; }
.prof-medals .pm { width: 84px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.prof-medals small { font-size: 10px; color: var(--muted); }
a.plink { color: inherit; text-decoration: none; border-bottom: 2px dotted rgba(255,255,255,.4); }
a.plink:hover { color: var(--gold); }
#user-pill { cursor: pointer; }
.ach-pop {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 80;
  display: flex; gap: 10px; align-items: center; padding: 10px 16px; animation: pop .2s ease-out;
  border-color: var(--gold) !important;
}
.ach-pop b { display: block; color: #ffff55; }
.ach-pop small { color: var(--muted); }
.card.evo { border-color: var(--gold); background: linear-gradient(90deg, rgba(255,210,63,.18), rgba(255,210,63,.04)); }
.card.evo .nm { color: var(--gold); }
/* Vínculo (premio de los legendarios): rosa */
.bond-title { color: #ff8ad8; }
.card.bond { border-color: #ff8ad8; background: linear-gradient(90deg, rgba(255,138,216,.18), rgba(255,138,216,.04)); }
.card.bond .nm { color: #ff8ad8; }
@media (max-height: 520px) {
  #scr-bond .bond-hint { display: none; }
  #scr-bond .box { width: min(820px, 100%); }
  #bond-cards { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
}
@media (max-width: 760px) { .mission { grid-template-columns: 1fr; } .prof-marks { grid-template-columns: repeat(2, 1fr); } }


/* ================= móvil y táctil ================= */
html, body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
body { touch-action: manipulation; }
/* iPhone: sin esto, mantener el dedo en el joystick sacaba "Copiar / Seleccionar
   todo" (Safari sólo hace caso a la versión -webkit- y no lo hereda bien). */
body, body * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
/* Con táctil no tienen sentido las pistas de teclas. */
body.touch kbd, body.touch .card .key, body.touch .kbd-hint { display: none !important; }
#rotate {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 8, 11, .95);
}
#rotate.hidden { display: none; }
#rotate .box { max-width: 320px; }
#rotate-ico { animation: rot-hint 1.6s steps(4) infinite; display: inline-block; }
@keyframes rot-hint { 0%, 30% { transform: rotate(0deg); } 60%, 100% { transform: rotate(90deg); } }

/* ---------- ajustes ---------- */
#scr-settings { z-index: 60; }
.box.settings { width: min(640px, 100%); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; }
.set-body { overflow-y: auto; padding-right: 4px; min-height: 0; }
#set-tabs { flex-wrap: wrap; }
#set-tabs .gen-tab { padding: 6px 12px; }
.set-h { color: var(--gold); font-size: 17px; margin: 14px 0 6px; }
.set-h:first-child { margin-top: 4px; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.set-row b { display: block; }
.set-row small { display: block; color: var(--muted); font-size: 12px; }
.set-row .switch { min-width: 58px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.set-chips { margin: 6px 0 10px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; font-size: 14px; }
.keys span { color: var(--muted); }
.credits { margin: 4px 0 12px; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.credits b { color: var(--ink); }
.about-logo { text-align: center; font-size: 34px; font-weight: 700; color: #c6c6c6; text-transform: uppercase; letter-spacing: 2px;
  text-shadow: 0 2px 0 #4a4a4e, 0 4px 0 #2a2a2c, 3px 6px 0 rgba(0,0,0,.6); margin-top: 6px; }
.btn.danger { background: #a3262a; box-shadow: inset 2px 2px 0 #d25050, inset -2px -4px 0 #5a1214; }
.row.wrap { flex-wrap: wrap; }
.touch-hint { display: none; }
body.touch .touch-hint { display: block; }
#pause-sound + .row, #scr-pause .row { flex-wrap: wrap; }
a.btn { text-decoration: none; display: inline-block; color: var(--ink); }

/* ================= pantallas bajas (móvil en horizontal) =================
 * Todo más compacto: la barra superior deja sitio, el menú va en dos
 * columnas y la línea de créditos se esconde (está en Ajustes → Acerca de). */
@media (max-height: 520px) {
  .scr { padding: 50px 10px 6px; }
  /* Sin barra superior encima: no hace falta dejarle hueco. */
  #scr-login, #scr-test, #scr-result, #scr-starters, #scr-nick, #scr-levelup, #scr-pause,
  #scr-over, #scr-item, #scr-settings, #scr-legal, #scr-profile { padding: 6px 10px; }
  .split { grid-template-columns: 1fr; }
  .logo .t1 { font-size: 30px; }
  .box { padding: 10px 14px; }
  .box h2 { font-size: 20px; }
  .box h3 { font-size: 16px; }
  .sub { font-size: 13px; margin-bottom: 8px; }
  .note { margin-top: 8px; font-size: 12px; }
  .btn { padding: 7px 14px; }
  .btn.small { padding: 4px 9px; font-size: 13px; }
  .topbar { top: 5px; right: 6px; gap: 5px; }
  .pill { padding: 2px 8px; font-size: 13px; gap: 5px; }
  #user-pill { max-width: 130px; overflow: hidden; white-space: nowrap; }
  .topbar .btn.small { padding: 2px 6px; }
  .credits-line { display: none !important; }
  .sound-panel { top: 40px; }

  #scr-menu { flex-direction: row; padding: 0; overflow: hidden; }
  .menu-left { padding: 50px 8px 6px; }
  .menu-left .logo { margin-bottom: 2px; }
  .menu-left .logo .t1 { font-size: 28px; }
  .logo .t2 { font-size: 10px; margin-top: 2px; letter-spacing: 2px; }
  #menu-partner { height: min(34vh, 130px); width: auto; }
  .partner-card { margin-top: 2px; }
  .partner-card .nm { font-size: 17px; }
  .partner-card .lv { font-size: 12px; }
  .menu-right { width: min(54vw, 420px); padding: 50px 8px 6px; gap: 6px; justify-content: flex-start; overflow-y: auto; }
  .menu-right .box { padding: 6px 8px; }
  .menu-right > .box:last-child { display: none; }
  .menu-right > :first-child { margin-top: 0; }
  .ach-pop { top: auto; bottom: 8px; }
  .menu-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 4px; }
  .menu-item { font-size: 15px; padding: 4px 6px; grid-template-columns: 22px 1fr; column-gap: 6px; }
  .menu-item small { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu-item.play { grid-column: span 2; font-size: 21px; }
  .menu-item::before { display: none; }
  .mi-ico img { width: 20px; height: 20px; }
  .box.settings { max-height: calc(100dvh - 12px); }
}
/* Móviles muy bajos (iPhone SE y similares): sin subtítulos en el menú, para que quepa entero. */
@media (max-height: 400px) {
  .menu-right { padding-top: 48px; }
  .menu-item small { display: none; }
  .menu-item { font-size: 14px; padding: 5px 6px; }
  .menu-item.play { font-size: 19px; }
  .menu-item.play small { display: block; }
  #menu-partner { height: min(30vh, 110px); }
}

/* ---------- pantalla de carga (lo primero que se ve y lo que lee Google) ---------- */
.boot-in { text-align: center; padding: 20px; max-width: 640px; }
.boot-in h1 { margin: 0 0 8px; font-size: clamp(38px, 8vw, 64px); color: #c6c6c6; text-transform: uppercase; letter-spacing: 2px; font-weight: 700;
  text-shadow: 0 3px 0 #4a4a4e, 0 6px 0 #2a2a2c, 4px 9px 0 rgba(0,0,0,.6); }
.boot-in p { margin: 6px 0; color: var(--muted); }
.boot-in a { color: #9fd4ff; }
.boot-ld { color: #fff; margin-top: 18px !important; }
.boot.noscript { z-index: 90; }
/* "Pulsa para empezar": encima de todo, se ve el mundo de fondo. */
.tapstart { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: radial-gradient(ellipse at center, rgba(8,8,11,.35), rgba(8,8,11,.82)); animation: fade .4s; }
.tapstart .boot-in p { color: #e6e6e6; text-shadow: 2px 2px 0 #000; }
.tap-blink { color: #ffff55 !important; font-size: 20px; margin-top: 22px !important; animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.login-tag { margin: -6px 0 12px; font-size: 13px; color: var(--muted); text-align: center; }
.login-links { margin-top: 10px; font-size: 13px; text-align: center; }
.login-links a { color: #9fd4ff; }

/* ---------- Support the game (js/ui/support-ui.js) ---------- */
.box.support { width: min(620px, 100%); }
.sup-lead { margin: 4px 0 8px; font-size: 17px; line-height: 1.4; }
.sup-coffee { display: flex; flex-direction: column; align-items: center; margin: 0 0 14px; }
.sup-coffee .btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; }
.sup-coffee .note { margin: 0; }
.sup-sol { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
/* The QR code: black on white whatever the theme, whole pixels (5 px per module). */
.sup-qr { display: block; width: 205px; height: 205px; background: #fff; image-rendering: pixelated;
  border: 3px solid var(--edge-out); }
.sup-sol-txt { min-width: 0; }
.sup-sol-txt h3 { color: var(--gold); }
.sup-sol-txt .sub { margin: 0 0 10px; font-size: 14px; }
/* The address: like a text field, monospace, selectable in one tap. */
.sup-addr { display: block; padding: 10px 12px; background: #000; color: var(--ink); border: 2px solid #a0a0a0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.4;
  word-break: break-all; text-shadow: none; user-select: all; -webkit-user-select: all; }
#sup-copy { width: 100%; min-height: 44px; margin-top: 10px; }
.fan-notice { line-height: 1.45; }
@media (max-width: 600px) {
  /* The fixed credits line wraps to two lines here: keep the box above it. */
  #scr-support { padding-bottom: 56px; }
  .sup-sol { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .sup-sol-txt { width: 100%; }
}
@media (max-height: 520px) {
  .sup-lead { font-size: 15px; }
  .sup-qr { width: 164px; height: 164px; }
}
/* Mejoras: botones y veto */
.upg-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ban-picker { grid-column: 1 / -1; }
.bind-panel { grid-column: 1 / -1; }
.bind-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bind-slot { display: flex; align-items: center; gap: 6px; margin: 0; }
.bind-slot span { font-weight: 700; color: var(--gold); min-width: 14px; }
.bind-slot select { width: 100%; min-width: 0; }
@media (max-width: 760px) { .bind-slots { grid-template-columns: repeat(2, 1fr); } }
.ban-moves { display: flex; flex-wrap: wrap; gap: 6px; }
.ban-moves .chip { display: inline-flex; align-items: center; gap: 5px; }
.ban-moves .chip.ban { background: rgba(255,95,109,.25); border-color: #ff5f6d; color: #ffd3d8; text-decoration: line-through; }
/* Novedades */
.news-btn { position: relative; }
.news-btn .dot { display: none; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; background: #ff5f6d; box-shadow: 0 0 0 2px var(--shadow); }
.news-btn.new .dot { display: block; }
.box.news-box { width: min(640px, 100%); max-height: calc(100dvh - 90px); display: flex; flex-direction: column; }
.news-body { overflow-y: auto; padding-right: 4px; }
.news-day { padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.1); }
.news-day:last-child { border-bottom: 0; }
.news-day h3 { color: var(--gold); margin: 14px 0 6px; font-size: 18px; }
.news-day h3 small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 2px; }
.news-part { margin: 6px 0 8px; }
.news-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 0; color: #0b0b0f; text-shadow: none; }
.news-tag.new { background: #5fe08a; } .news-tag.chg { background: #4fb4ff; } .news-tag.fix { background: #ffb347; }
.news-day ul { margin: 0; padding-left: 20px; }
.news-day li { margin: 4px 0; line-height: 1.35; font-size: 15px; }
@media (max-width: 760px) { .news-btn span { display: none; } }
.sup-tab { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 15px; }
.sup-tab td { padding: 5px 4px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sup-tab td.num { text-align: right; white-space: nowrap; }
.sup-tab tr.tot td { font-weight: 700; color: var(--gold); border-bottom: 0; }
#btn-support span { margin-left: 2px; }
@media (max-height: 520px) { #btn-support span { display: none; } }
/* ============ Pokémon en móvil horizontal ============
 * La lista a la izquierda y la ficha (con "Elegir de compañero") a la derecha,
 * siempre a la vista: antes la ficha quedaba debajo de la lista y había que
 * bajar hasta el borde para encontrar el botón. */
@media (max-height: 520px) {
  #scr-dex .box { height: 100%; display: flex; flex-direction: column; padding: 8px 10px; }
  #scr-dex .gen-tabs { margin-top: 2px; padding-bottom: 4px; flex: 0 0 auto; }
  #scr-dex .split { grid-template-columns: 1fr minmax(190px, 36%); gap: 8px; flex: 1; min-height: 0; margin-top: 2px !important; }
  #scr-dex .split > div:first-child { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
  #scr-dex .gen-tabs, #scr-dex .filters { scrollbar-width: none; }
  #scr-dex .gen-tabs::-webkit-scrollbar, #scr-dex .filters::-webkit-scrollbar { display: none; }
  #scr-dex .filters { flex-wrap: nowrap; overflow-x: auto; margin-bottom: 4px; flex: 0 0 auto; }
  #scr-dex .chip { flex: 0 0 auto; padding: 2px 8px; font-size: 12px; }
  #scr-dex .grid { max-height: none; flex: 1; min-height: 0; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 5px; }
  #scr-dex .cell canvas { width: 69px; height: 60px; }
  #scr-dex .cell b { font-size: 11px; }
  #dex-detail { min-height: 0; overflow-y: auto; padding: 6px 8px; display: flex; flex-direction: column; }
  #dex-detail .stage { width: 132px; height: 114px; margin: 2px auto 4px; }
  #dex-detail h3 { margin: 0; }
  #dex-detail .stat { grid-template-columns: 62px 1fr 34px; gap: 4px; font-size: 12px; margin: 2px 0; }
  #dex-detail p { margin: 4px 0 !important; font-size: 12px !important; }
  #dex-detail .move-icons { margin-bottom: 4px; }
  /* El botón de elegir, pegado abajo de la ficha: se ve aunque la ficha no quepa. */
  #dex-detail .btn { position: sticky; bottom: 0; order: 9; margin-top: auto; padding: 8px 6px; font-size: 15px;
    filter: drop-shadow(0 -6px 8px rgba(8,8,11,.6)); }
}

/* ============ Enchanting (js/ui/enchant-ui.js) ============ */
/* The enchantment glint: a purple sheen sweeping over an icon (weapons, books, level-up cards). */
@keyframes ench-glint { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.ench-ico { position: relative; display: inline-flex; vertical-align: middle; width: max-content; height: max-content; flex: none; align-self: center; justify-self: start; }
.ench-ico.glint::after, .card.ench .ico::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(115deg, rgba(199,125,255,.12) 25%, rgba(214,160,255,.75) 50%, rgba(199,125,255,.12) 75%);
  background-size: 300% 100%; animation: ench-glint 2.6s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .ench-ico.glint::after, .card.ench .ico::after { animation: none; background-position: 50% 0; } }
.ench-txt { color: var(--enchant); }
.st-locked { color: var(--muted); } .st-unlocked { color: var(--enchant); } .st-mastered { color: var(--gold); }
.ench-h { display: flex; align-items: center; gap: 6px; font-size: 15px; }

.ench-box { width: min(1040px, 100%); }
.ench-table { display: grid; grid-template-columns: 230px 1fr; gap: 14px; min-height: 0; }
.ench-list { display: flex; flex-direction: column; gap: 4px; max-height: 62vh; overflow-y: auto; padding: 10px; }
.ench-pick {
  appearance: none; cursor: pointer; text-align: left; color: #fff; font: inherit; font-size: 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 5px 8px;
  background: rgba(0,0,0,.3); border: 2px solid #3a3a3e; text-shadow: 1px 1px 0 var(--shadow);
}
.ench-pick small { font-size: 11px; white-space: nowrap; }
.ench-pick:hover { border-color: #9a9aa0; }
.ench-pick.on { border-color: var(--gold); background: rgba(255,210,63,.1); }
.ench-pick.locked > span { color: var(--muted); }
.ench-pick.unlocked { box-shadow: inset 3px 0 0 var(--enchant); }
.ench-pick.mastered { box-shadow: inset 3px 0 0 var(--gold); }
.ench-detail { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ench-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: start; }
.ench-head { display: flex; gap: 12px; align-items: center; }
.ench-head h3 { margin: 0 0 4px; }
.ench-locked { display: flex; gap: 12px; align-items: center; border-color: var(--enchant); }
.ench-weapons { display: grid; grid-template-columns: 1fr; gap: 4px; max-height: 46vh; overflow-y: auto; padding-right: 2px; }
.ench-books { max-height: 46vh; overflow-y: auto; }
.ench-weapon {
  appearance: none; cursor: pointer; color: #fff; font: inherit; text-align: left;
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: center; padding: 5px 8px;
  background: rgba(0,0,0,.28); border: 2px solid var(--edge-out); text-shadow: 1px 1px 0 var(--shadow);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.08), inset -2px -2px 0 rgba(0,0,0,.45);
}
.ench-weapon:hover { border-color: #9a9aa0; }
.ench-weapon.on { border-color: var(--enchant); background: rgba(199,125,255,.12); }
.ench-weapon .nm { font-weight: 700; font-size: 14px; }
.ench-weapon .nm small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.ench-slots { display: flex; gap: 4px; margin-top: 4px; }
.ench-slot {
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px 4px; font-size: 11px; text-align: center; color: var(--enchant);
  background: rgba(0,0,0,.4); border: 2px solid #000; box-shadow: inset 1px 1px 0 rgba(0,0,0,.5), inset -1px -1px 0 rgba(255,255,255,.1);
}
.ench-slot.empty { color: #6a6a70; }
.ench-slot.max { color: var(--gold); }
.ench-book { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-top: 2px solid rgba(255,255,255,.06); }
.ench-book:first-of-type { border-top: 0; }
.ench-book .ds { color: var(--muted); font-size: 13px; }
.ench-book small { color: var(--muted); }
.ench-book .why, .ench-books .why { color: #ff9b9b; font-size: 12px; }
.ench-lib { display: flex; flex-direction: column; gap: 6px; max-height: 64vh; overflow-y: auto; }
.ench-lib-h { display: flex; gap: 8px; align-items: center; margin: 10px 0 2px; }
.ench-lib-h small { margin: 0; font-size: 12px; font-weight: 400; }
.ench-lib-row { display: flex; gap: 10px; align-items: center; padding: 8px 10px; }
.ench-lib-row.none { opacity: .62; }
.ench-lib-row .ds { color: var(--muted); font-size: 13px; }
.ench-lib-row small { font-size: 12px; }
.ench-lvls { display: flex; gap: 3px; }
.ench-lvls span { display: flex; flex-direction: column; align-items: center; min-width: 30px; padding: 2px 4px; font-size: 11px;
  color: #6a6a70; background: rgba(0,0,0,.4); border: 2px solid #000; }
.ench-lvls span b { font-size: 12px; }
.ench-lvls span.on { color: var(--enchant); }
.ench-lvls span.on b { color: #fff; }
@media (max-width: 760px) {
  .ench-table { grid-template-columns: 1fr; }
  .ench-list { max-height: 26vh; }
  .ench-work { grid-template-columns: 1fr; }
}

/* Level-up card of an enchanted skill; Mobdex / partner frames by enchanting state. */
.card.ench { border-color: var(--enchant); }
.card .ico { position: relative; overflow: hidden; }
.card .ench-line { font-size: 12px; color: var(--enchant); margin-top: 2px; }
.cell.ench-on { box-shadow: inset 0 0 0 2px rgba(199,125,255,.55), 0 0 10px rgba(199,125,255,.35); }
.cell.ench-master { box-shadow: inset 0 0 0 2px rgba(255,210,63,.7), 0 0 12px rgba(255,210,63,.4); }
.stage.ench-on { box-shadow: 0 0 0 3px #000, 0 0 22px rgba(199,125,255,.65), inset 3px 3px 0 rgba(0,0,0,.5); }
.stage.ench-master { box-shadow: 0 0 0 3px #000, 0 0 24px rgba(255,210,63,.7), inset 3px 3px 0 rgba(0,0,0,.5); }
.ench-fits { margin: 2px 0 8px; font-size: 12px; }
#ench-body { min-height: min(470px, 64vh); }
#ench-body[data-tab=anvil] > .panel, #ench-body[data-tab=grind] > .panel { max-height: 64vh; overflow-y: auto; }

/* Ascended (reached the Aether with it): a small golden halo over the Mobdex cell and in the detail panel. */
.cell .halo { position: absolute; top: 6px; left: 50%; margin-left: -13px; }
.halo { display: inline-block; width: 26px; height: 8px; border-radius: 50%; border: 2px solid var(--gold);
  box-shadow: 0 0 6px rgba(255, 210, 63, .8), inset 0 0 3px rgba(255, 240, 180, .7); vertical-align: middle; }
.ascended { color: var(--gold); font-size: 13px; margin: 2px 0 6px; }
/* The run summary after reaching the Aether. */
#scr-over.victory .box { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold2), 0 0 40px rgba(255, 210, 63, .35); }
#scr-over.victory #over-title { color: var(--gold); text-shadow: 0 0 12px rgba(255, 210, 63, .6); }
.over-aether { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.over-aether > div { display: flex; flex-direction: column; align-items: center; font-size: 12px; }
