/* ============ PokéSurvivor — interfaz estilo Mundo Misterioso ============
 * Cajas azules con doble borde blanco, como los menús de PMD, 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: #b9cbf0;
  --box1: #2c519f;
  --box2: #1a3170;
  --edge: #f4f8ff;
  --edge-in: #5b83d6;
  --edge-out: #0b1838;
  --gold: #ffd23f;
  --gold2: #f0a31e;
  --red: #ff5f6d;
  --green: #5fe08a;
  --shadow: #0a1430;
  --r1: #9fb1c9; --r2: #5fe08a; --r3: #4fb4ff; --r4: #c47bff; --r5: #ffcb3d;
  --font: 'Pixelify', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: #050914;
  color: var(--ink);
  font: 16px/1.35 var(--font);
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: 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-pyramid, #scr-goals, #scr-dex, #scr-upgrades, #scr-gacha, #scr-friends, #scr-rank, #scr-lobby, #scr-profile { padding-top: 66px; }
}
.scr.dim { background: radial-gradient(circle at 50% 40%, rgba(10,20,50,.55), rgba(3,6,16,.88)); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- caja PMD ---------- */
.box {
  position: relative;
  background: linear-gradient(180deg, var(--box1), var(--box2));
  border: 3px solid var(--edge);
  border-radius: 12px;
  box-shadow: 0 0 0 3px var(--edge-out), inset 0 0 0 2px var(--edge-in), 0 18px 50px rgba(0,0,0,.55);
  padding: 22px 24px;
  text-shadow: 2px 2px 0 var(--shadow);
  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;
  border: 3px solid var(--edge);
  border-radius: 9px;
  background: linear-gradient(180deg, #3d67c0, #26468f);
  box-shadow: 0 0 0 2px var(--edge-out), 0 4px 0 var(--edge-out);
  font-size: 17px; font-weight: 700;
  text-shadow: 2px 2px 0 var(--shadow);
  transition: transform .06s, filter .12s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 2px var(--edge-out), 0 2px 0 var(--edge-out); }
.btn:disabled { filter: grayscale(.8) brightness(.7); cursor: not-allowed; transform: none; }
.btn.gold {
  background: linear-gradient(180deg, #ffe37a, #f0a31e);
  color: #3a2300; text-shadow: 1px 1px 0 rgba(255,255,255,.4);
  border-color: #fff7d6;
}
.btn.ghost { background: transparent; box-shadow: none; border-color: rgba(244,248,255,.35); }
.btn.small { padding: 6px 12px; 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: 0; cursor: pointer;
  text-align: left; padding: 8px 10px 8px 30px; border-radius: 6px;
  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); outline: none; }
.menu-item:hover::before, .menu-item:focus-visible::before { opacity: 1; transform: none; }
.menu-item.play { font-size: 30px; color: var(--gold); }
.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: 8px;
  background: rgba(0,0,0,.2); border: 2px solid transparent;
  text-align: center; font-weight: 700;
}
.tab.on { border-color: var(--edge); background: rgba(255,255,255,.1); }
label { display: block; font-size: 14px; color: var(--muted); margin: 8px 0 4px; }
.field {
  width: 100%; padding: 10px 12px;
  background: #0f1f4a; color: #fff;
  border: 2px solid var(--edge-in); border-radius: 8px;
  font-size: 17px; outline: none;
}
.field:focus { border-color: var(--edge); }
.err { color: #ffb0b8; 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 .t1 { font-size: 46px; font-weight: 700; line-height: 1; color: var(--gold);
  text-shadow: 3px 3px 0 #a55f00, 6px 6px 0 var(--shadow); letter-spacing: 1px; }
.logo .t2 { font-size: 18px; color: #fff; margin-top: 6px; letter-spacing: 3px; text-transform: uppercase; }

/* ---------- test de personalidad ---------- */
.test-box { width: min(620px, 100%); }
.progress { height: 8px; background: rgba(0,0,0,.35); border-radius: 8px; overflow: hidden; margin-bottom: 18px; }
.progress i { display: block; height: 100%; background: var(--gold); 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: rgba(0,0,0,.18); border: 2px solid rgba(244,248,255,.25); border-radius: 9px;
  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 estilo PMD: fondo oscuro y borde del color del tipo (--stage-c). */
  background:
    radial-gradient(ellipse at 50% 88%, rgba(120,170,255,.22), transparent 60%),
    linear-gradient(180deg, rgba(20,36,78,.88), rgba(8,14,34,.92));
  border: 3px solid var(--stage-c, #5b83d6);
  border-radius: 14px;
  box-shadow: 0 0 0 3px #0b1838, 0 10px 30px rgba(0,0,0,.45), inset 0 0 0 2px rgba(255,255,255,.06);
}
.stage.shiny { box-shadow: 0 0 0 3px #0b1838, 0 0 22px rgba(154,230,255,.55), inset 0 0 0 2px 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 {
  position: relative; cursor: pointer; text-align: center;
  background: rgba(0,0,0,.2); border: 2px solid rgba(244,248,255,.18); border-radius: 10px;
  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,.08); }
.cell.on { border-color: var(--gold); background: rgba(255,210,63,.14); }
.cell.locked { cursor: default; opacity: .75; }
.cell.locked:hover { transform: none; border-color: rgba(244,248,255,.18); }
.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,.2); border: 2px solid rgba(244,248,255,.2); border-radius: 10px; padding: 14px;
}
.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: rgba(0,0,0,.35); border-radius: 6px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: var(--gold); }
.type {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700;
  color: #10131a; text-shadow: none; margin-right: 4px;
}
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  appearance: none; cursor: pointer; padding: 4px 10px; border-radius: 20px;
  background: rgba(0,0,0,.25); border: 2px solid rgba(244,248,255,.25); font-size: 13px;
  text-shadow: 1px 1px 0 var(--shadow);
}
.chip.on { border-color: var(--gold); color: var(--gold); }

/* ---------- 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(5,10,25,.65) 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: 30px;
  background: rgba(10,20,50,.85); border: 2px solid var(--edge);
  box-shadow: 0 0 0 2px var(--edge-out);
  font-weight: 700; text-shadow: 2px 2px 0 var(--shadow);
}
.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(185,203,240,.7);
  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; }
.tm-panel { grid-template-columns: 40px minmax(0, 1fr) auto; }
.tm-filters { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 8px; }
.tm-filters label, .tm-choice { min-width: 0; margin: 0; display: grid; gap: 4px; }
.tm-filters .field, .tm-choice .field { min-width: 0; width: 100%; margin: 0; }
.tm-choice, .tm-count { grid-column: 1 / -1; }
.tm-count { margin: 0; }
@media (max-width: 560px) { .tm-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tm-filters label:first-child { grid-column: 1 / -1; } }
.tm-preview { grid-column: 1 / -1; min-width: 0; }
.tm-preview-description { margin: 6px 0; }
.tm-preview small { display: block; color: var(--muted); margin-bottom: 6px; }
.tm-preview small[hidden] { display: none; }
.tm-preview-frame { display: block; width: min(100%, 560px); aspect-ratio: 24 / 11; margin: 0 auto; border: 0; border-radius: 16px; }
.tm-preview-frame[hidden] { display: none; }
#scr-dex .dex-favorite-mark { display: block; color: #ffd96b; line-height: 1; font-size: .95rem; }
#dex-favorite[aria-pressed="true"] { color: #ffe394; border-color: #d5b852; }
.pips { display: flex; gap: 3px; margin-top: 4px; }
.pips i { width: 12px; height: 6px; border-radius: 2px; background: rgba(0,0,0,.4); }
.pips i.on { background: var(--gold); }

/* ---------- gacha ---------- */
.banner {
  position: relative; border-radius: 12px; overflow: hidden;
  background:
    radial-gradient(circle at 80% 30%, rgba(255,210,63,.35), transparent 45%),
    radial-gradient(circle at 15% 80%, rgba(196,123,255,.35), transparent 50%),
    linear-gradient(135deg, #3a1d6e, #1b2f78 55%, #0f4d6e);
  border: 2px solid rgba(244,248,255,.4);
  padding: 18px;
}
.banner h3 { font-size: 28px; color: var(--gold); text-shadow: 3px 3px 0 #2a0f55; }
.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: 1px dashed rgba(244,248,255,.15); }

#pull-fx {
  position: fixed; inset: 0; z-index: 40;
  display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  overflow: hidden; overscroll-behavior: contain;
  background: radial-gradient(ellipse at 50% 18%, #25443a, #0b1b19 72%);
}
#pull-fx.hidden { display: none; }
@media (max-height: 520px) {
  .pull-results { gap: 6px; }
  .pcard { width: 100px; padding: 5px 3px; border-radius: 10px; }
  .pcard canvas { width: 84px; height: auto; }
  .pcard b { font-size: 12px; }
  .pcard .tag { font-size: 10px; }
  .pcard .stars { font-size: 11px; }
}

/* Mensaje de apoyo al acabar una partida (run-ui.js). */
.support-ask { position: relative; margin-top: 4px; padding: 10px 34px 12px 12px; border-radius: 10px; 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 {
  width: 150px; padding: 10px 6px; text-align: center; border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(0,0,0,.3));
  border: 3px solid var(--rc, #fff);
  box-shadow: 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 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(0,0,0,.2); border: 2px solid rgba(244,248,255,.3); border-radius: 12px;
  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: 10px; display: grid; place-items: center; font-size: 24px; }
.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 rgba(244,248,255,.3); border-radius: 6px; padding: 2px 8px; }
.tag-chip { font-size: 11px; padding: 2px 7px; border-radius: 5px; 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: rgba(0,0,0,.22); border-radius: 9px; padding: 8px 10px; }
.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 rgba(244,248,255,.4); border-bottom-width: 3px;
  border-radius: 5px; font: inherit; font-size: 13px; text-shadow: none;
}

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 60;
  padding: 10px 18px; border-radius: 10px;
  background: rgba(10,20,50,.95); border: 2px solid var(--edge);
  text-shadow: 2px 2px 0 var(--shadow); animation: pop .2s ease-out;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: rgba(244,248,255,.3); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 760px) and (min-height: 521px) {
  #scr-menu { flex-direction: column; overflow-y: auto; }
  .menu-right { width: 100%; background: rgba(5,10,25,.7); }
  .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; }
.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: 9px;
  background: rgba(0,0,0,.25); border: 2px solid rgba(244,248,255,.22);
  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: rgba(255,210,63,.14); }
.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 rgba(244,248,255,.35); border-radius: 9px; 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(154,230,255,.22); color: #c9f3ff; }
.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: #c9f3ff; }

/* ============ 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; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 8px;
  background: rgba(0,0,0,.4); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 4px;
  background: var(--gold); border: 2px solid #fff7d6; cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 4px; background: var(--gold); border: 2px solid #fff7d6; }
#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: 2px;
  box-shadow: 0 0 0 2px #0b1838; vertical-align: 1px; }
.sync.ok { background: #5fe08a; }
.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: #050914; 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: 8px;
  background: rgba(0,0,0,.22); border: 2px solid rgba(244,248,255,.14);
}
.fr-row b { font-size: 17px; }
.fr-row .st { color: var(--muted); font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 2px; background: #6b7a94; 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: 10px; background: rgba(0,0,0,.25); border: 3px solid var(--pc, rgba(244,248,255,.2));
  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: rgba(244,248,255,.18); 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: 8px; background: rgba(0,0,0,.2); 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; }
.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; }
.rk-row.mod-row.rep { grid-template-columns: 54px auto 1fr auto auto; }
.mod-warn { color: #ff8a96 !important; }
.mod-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rk-me { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: rgba(0,0,0,.25); 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); }

/* ---------- 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: 8px;
  background: rgba(0,0,0,.22); border: 2px solid rgba(244,248,255,.14);
}
.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: 7px; background: rgba(0,0,0,.4); border-radius: 6px; overflow: hidden; margin: 4px 0 2px; }
.mission .bar i, .ach .bar i { display: block; height: 100%; background: var(--gold); }
.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: 8px;
  background: rgba(0,0,0,.2); border: 2px solid rgba(244,248,255,.1);
}
.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: 8px; background: rgba(0,0,0,.25); border: 2px solid transparent; }
.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: 10px; background: rgba(0,0,0,.28); border: 3px dashed rgba(244,248,255,.25); 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: 8px; padding: 1px 8px; }
.prof-marks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.prof-marks div { background: rgba(0,0,0,.25); border-radius: 8px; 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: 1px dotted rgba(244,248,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: var(--gold); }
.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; }
.bond-dialog { width: min(820px, 100%); max-height: min(90vh, 760px); display: flex; flex-direction: column; overflow: hidden; }
.bond-dialog h2 { margin: 0; }
.bond-filter { display: flex; align-items: center; gap: 8px; margin: 0; }
.bond-filter .field { width: auto; min-width: 150px; margin: 0; }
#bond-cards { width: 100%; overflow-y: auto; min-height: 0; padding: 2px 4px 8px 0; }
#bond-cards .card { width: 100%; text-align: left; font: inherit; color: inherit; }
.bond-types { color: var(--muted); font-size: 13px; margin: 3px 0; }
.bond-types span { display: inline-block; border-radius: 999px; padding: 2px 8px; color: #10221d; font-weight: 700; }
.fusion-reference-filters { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 8px; }
.fusion-reference-filters label { min-width: 0; margin: 0; }
.fusion-reference-filters .field { width: 100%; min-width: 0; margin: 4px 0 0; }
.fusion-reference-results { max-height: 260px; overflow-y: auto; }
.fusion-reference-item { padding: 8px 2px; border-top: 1px solid #a8edc525; }
.fusion-reference-item strong { display: block; }
.fusion-reference-item span { color: var(--gold); font-size: 13px; }
.fusion-reference-item p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
@media (max-width: 560px) { .fusion-reference-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fusion-reference-filters label:first-child { grid-column: 1 / -1; } }
@media (max-height: 520px) {
  #scr-bond .bond-hint { margin: 4px 0; font-size: 12px; }
  #scr-bond .box { width: min(820px, 100%); }
  #bond-cards .card { padding: 6px 10px; }
}
@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(5, 10, 30, .94);
}
#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; }
/* Colocar los botones (layout-ui.js): por delante de Ajustes */
#scr-layout { z-index: 66; display: block; background: radial-gradient(circle at 50% 40%, #24452c, #0d1a12); touch-action: none; }
#scr-layout.hidden { display: none; }
.lay-thing { position: absolute; z-index: 2; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.lay-thing.held { cursor: grabbing; filter: drop-shadow(0 0 8px rgba(255,210,63,.8)); }
.lay-thing.hidden { display: none; }
.lay-tag { position: absolute; left: 50%; top: -18px; transform: translateX(-50%); font-size: 11px; color: var(--gold); white-space: nowrap; pointer-events: none; }
.lay-pause { border-radius: 10px; background: rgba(10,16,28,.7); border: 2px solid rgba(244,248,255,.8); box-sizing: border-box; }
.lay-pause b { position: absolute; top: 9px; width: 5px; height: 18px; background: #f4f8ff; }
.lay-pause b:first-child { left: 11px; } .lay-pause b:last-child { left: 20px; }
.lay-stick { border-radius: 50%; background: rgba(10,20,48,.3); border: 3px solid rgba(244,248,255,.6); box-sizing: border-box; }
.lay-stick .knob { position: absolute; left: 50%; top: 50%; width: 42%; height: 42%; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(255,210,63,.85); border: 3px solid #a55f00; box-sizing: border-box; }
.lay-panel { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); width: min(340px, calc(100% - 32px)); padding: 10px 14px; text-align: center; opacity: .95; }
.lay-panel h3 { margin: 0 0 6px; font-size: 14px; }
#lay-mode { justify-content: center; align-items: center; gap: 6px; margin: 0; }
.lay-help { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.lay-turn { color: var(--gold); font-size: 13px; margin: 4px 0; }
.lay-btns { justify-content: center; gap: 8px; margin-top: 6px; }
.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: var(--gold); text-shadow: 2px 2px 0 #a55f00, 4px 4px 0 var(--shadow); margin-top: 6px; }
.btn.danger { background: #8a1f2e; border-color: #ff8a96; }
.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; border-radius: 10px; }
  .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: var(--gold); text-shadow: 3px 3px 0 #a55f00, 6px 6px 0 var(--shadow); font-weight: 700; }
.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(5,9,20,.35), rgba(5,9,20,.8)); animation: fade .4s; }
.tapstart .boot-in p { color: #dfe7ff; text-shadow: 2px 2px 0 #000; }
.tap-blink { color: #fff !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-official { margin: -6px 0 12px; font-size: 12px; color: var(--muted); text-align: center; opacity: .85; }
.login-links { margin-top: 10px; font-size: 13px; text-align: center; }
.login-links a { color: #9fd4ff; }

/* ---------- apoyar el proyecto ---------- */
#scr-support { z-index: 60; }
.box.support { width: min(560px, 100%); }
/* 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: 4px; color: #0b1020; 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 .seg { flex: none; }
  #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;
    box-shadow: 0 -6px 10px rgba(5,10,25,.6); }
}

/* IV Gem Pyramid */
#scr-pyramid .iv-box {
  width: min(850px, 100%);
  padding: clamp(14px, 3vw, 26px);
  border: 1px solid #87bfb146;
  border-radius: 28px;
  background: radial-gradient(ellipse at 50% 0%, #284b49, #142925 47%, #10201f 85%);
  font-family: system-ui, sans-serif;
}
#iv-slots { margin: 18px 0; display: grid; gap: 6px; }
.iv-tier { display: flex; justify-content: center; gap: clamp(4px, 1.2vw, 12px); }
.iv-slot {
  flex: 0 1 160px;
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 6px;
  text-align: center;
}
.iv-slot > span, .iv-slot > small { color: #b6d2cc; font-size: .76rem; }
.iv-slot.iv-leader { flex-basis: 245px; }
.iv-leader > span, .iv-leader > small { color: #f3d99e; }
.iv-choice {
  appearance: none;
  position: relative;
  min-width: 0;
  min-height: 42px;
  padding: 7px 25px 7px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #82cbbb64;
  border-radius: 999px;
  background: linear-gradient(145deg, #294744, #1c3332);
  color: #eefffa;
  font: 650 .9rem system-ui, sans-serif;
  cursor: pointer;
}
.iv-choice::after {
  content: '';
  position: absolute;
  inset: calc(50% - 5px) 11px auto auto;
  width: 6px;
  height: 6px;
  border: solid currentcolor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  opacity: .7;
}
.iv-choice:hover, .iv-choice:focus-visible { border-color: #b4eede; }
.iv-leader .iv-choice { border-color: #e7c27b9c; color: #fff0bf; background: linear-gradient(140deg, #464633, #253930); }
.iv-detail { padding: clamp(10px, 2.2vw, 20px); border-radius: 22px; background: #091a1aaa; }
.iv-inspect { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.iv-inspect .iv-choice { max-width: 62%; }
#iv-summary { margin: 6px 0 14px; }
#iv-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 14px 20px; margin-bottom: 16px; }
.iv-stat > div:first-child { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; }
.iv-stat small, #iv-attribution small { color: #b6d2cc; }
.iv-track { height: 6px; margin-top: 5px; border-radius: 9px; overflow: hidden; background: #375953; }
.iv-track > div { height: 100%; border-radius: inherit; }
.iv-history { padding-top: 12px; border-top: 1px solid #82cbbb36; }
.iv-history summary { cursor: pointer; font-weight: 650; }
#iv-attribution { padding-left: 20px; margin: 6px 0 0; }
#iv-attribution li { margin-bottom: 5px; }
#iv-picker {
  width: min(540px, calc(100% - 28px));
  max-height: calc(100dvh - 22px);
  padding: clamp(12px, 3vw, 22px);
  border: 1px solid #81c9b682;
  border-radius: 24px;
  background: linear-gradient(145deg, #254441, #152b2b 68%);
  color: #effff9;
  box-shadow: 0 22px 80px #061111b3;
}
#iv-picker::backdrop { background: #071417c4; backdrop-filter: blur(5px); }
.iv-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.iv-picker-head h3 { margin: 0; }
#scr-pyramid .btn.small {
  min-height: 36px; border: 1px solid #82cbbb64; border-radius: 999px;
  background: #23423f; color: #eefffa; box-shadow: none; transform: none;
}
.iv-picker-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, 34%); gap: 10px; margin: 12px 0; }
.iv-picker-filters label { display: grid; gap: 5px; color: #cae4dd; font-size: .8rem; }
.iv-picker-filters .field { width: 100%; min-height: 42px; border: 1px solid #80b3a080; border-radius: 13px; background: #102b2a; font: 1rem system-ui, sans-serif; }
.iv-picker-filters select { color-scheme: dark; }
#iv-picker-list { display: grid; gap: 5px; max-height: min(300px, 46dvh); overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.iv-match {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  min-height: 42px; gap: 4px 12px; padding: 7px 12px;
  border: 1px solid transparent; border-radius: 13px; background: #142e2d;
  color: #ebfff8; font: inherit; text-align: left; cursor: pointer;
}
.iv-match:hover, .iv-match:focus-visible, .iv-match[aria-pressed="true"] { border-color: #8bdcc4; background: #2a5149; }
.iv-match small { color: #bedbd4; }
@media (max-width: 430px) {
  .iv-slot { padding-inline: 1px; }
  .iv-choice { padding-left: 7px; padding-right: 17px; font-size: .8rem; }
  .iv-choice::after { right: 7px; }
}

.dex-shiny-moves { padding: 10px 12px; margin-top: 10px; border-radius: 12px; background: #9ae6ff12; }
.dex-shiny-moves > strong { color: #bdeffe; }
.dex-shiny-moves ul { list-style: none; display: grid; gap: 5px; margin: 6px 0 0; padding: 0; }
.dex-shiny-moves li { display: flex; align-items: center; gap: 6px; }

/* Per-Pokémon auto level-up plan */
#dex-auto-level { margin: 12px 0; text-align: left; }
#dex-auto-level details { padding: 9px; border: 1px solid #485b80; border-radius: 6px; }
#dex-auto-level summary { cursor: pointer; font-weight: 700; }
#dex-auto-level .sub { margin: 8px 0; }
#dex-auto-level ol { margin: 8px 0; padding-left: 20px; }
#dex-auto-level li { margin-bottom: 8px; }
#dex-auto-level li .row { gap: 4px; flex-wrap: wrap; margin-top: 4px; }
#dex-auto-level li .btn { min-width: 0; }
#dex-auto-level select { width: 100%; }

/* Poké Outbreak forest palette */
:root{--font:'Segoe UI',system-ui,sans-serif;--ink:#f6fff9;--muted:#c5d5ca;--box1:#192d22;--box2:#101a14;--edge:#416950;--edge-in:#294937;--edge-out:#080d0a;--gold:#79e69c;--gold2:#45b972;--shadow:#07110a}
body{font-family:var(--font)}
.box{border-width:1px;border-radius:20px;box-shadow:0 18px 60px #02060399;text-shadow:none}
.box h1,.box h2,.box h3{letter-spacing:0;font-weight:750}
.scr.dim{background:radial-gradient(ellipse at 50% 35%,#102e1da6,#080c09ed)}
.btn,.field,.menu-item{font-family:var(--font);border-radius:10px;text-shadow:none}

.tapstart{background:radial-gradient(ellipse at 50% 40%,#183c28,#070b08 72%);color:#f6fff9}
.tapstart h1{color:#f6fff9;letter-spacing:0;text-shadow:none}

.tapstart, #scr-login {
  background: linear-gradient(0deg, #07110af5, #07110a20 48%, transparent),
    #07110a url('../assets/login-guardian.webp') center / contain no-repeat;
}
.tapstart {
  align-items: flex-end;
  padding-bottom: max(4vh, env(safe-area-inset-bottom));
}
.tapstart .boot-in h1 {
  font-size: clamp(28px, min(8vw, 10vh), 56px);
}
#scr-login .box {
  background: linear-gradient(145deg, #192d22f5, #101a14f5);
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
}
#login-email-panel { margin-top: 12px; }
#login-form .row, .login-email-actions:not(:empty) { margin-top: 10px; }
#login-err:empty { display: none; }
@media (orientation: landscape) {
  .tapstart, #scr-login {
    justify-content: flex-end;
    align-items: center;
    padding: 0 max(4vw, env(safe-area-inset-right)) 0 0;
    background-image: linear-gradient(90deg, transparent 43%, #07110a 59%),
      url('../assets/login-guardian.webp');
    background-position: center, left 24%;
    background-size: cover, max(59vw, 100vh) auto;
  }
  .tapstart .boot-in, #scr-login .box {
    max-width: 46vw;
  }
}

/* Carry the guardian's moonlit palette into the space around the artwork. */
.tapstart, #scr-login {
  background-image: linear-gradient(0deg, #07110ada, transparent 44%),
    url('../assets/login-guardian.webp'),
    radial-gradient(ellipse at 78% 28%, #22547180, transparent 49%),
    radial-gradient(ellipse at 12% 70%, #38255d9c, transparent 52%),
    radial-gradient(circle, #d8edffbb 0.7px, transparent 1.25px),
    radial-gradient(circle, #85cff4a0 0.6px, transparent 1.1px);
  background-position: center, center, center, center, 7px 13px, 21px 4px;
  background-size: cover, contain, cover, cover, 71px 83px, 103px 67px;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat;
}
.tapstart .boot-in h1 {
  display: inline-block;
  font-family: 'Arial Black', system-ui, sans-serif;
  font-size: clamp(30px, min(9vw, 13vh), 76px);
  font-weight: 1000;
  line-height: 1.18;
  letter-spacing: -.065em;
  text-transform: uppercase;
  transform: skew(-7deg) rotate(-3deg);
  color: #f4dfb1;
  -webkit-text-stroke: .018em #253d51;
  paint-order: stroke fill;
  text-shadow: .025em .046em #89cbe9, .055em .095em #102638, 0 0 .5em #70caff55;
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .tapstart .boot-in h1 {
    background: linear-gradient(173deg, #fff7db 15%, #e6c28d 57%, #b18760 61%, #f1d6a6 92%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(.025em .045em 0 #8cd6f5)
      drop-shadow(.04em .07em 0 #102638)
      drop-shadow(0 0 .25em #70caff65);
  }
}
.tapstart .boot-in p {
  color: #c1dcf0;
}
@media (orientation: landscape) {
  .tapstart, #scr-login {
    background-image: linear-gradient(90deg, transparent 36%, #091525d9 57%, transparent 79%),
      url('../assets/login-guardian.webp'),
      radial-gradient(ellipse at 78% 28%, #225471a0, transparent 57%),
      radial-gradient(ellipse at 93% 80%, #38255dbb, transparent 46%),
      radial-gradient(circle, #d8edffbb 0.7px, transparent 1.25px),
      radial-gradient(circle, #85cff4a0 0.6px, transparent 1.1px);
    background-position: center, left 24%, center, center, 7px 13px, 21px 4px;
    background-size: cover, max(59vw, 100vh) auto, cover, cover, 71px 83px, 103px 67px;
  }
}

/* Main hub and IV inspection */
#scr-menu .menu-item {
  border: 1px solid #40685d;
  border-radius: 999px;
  background: linear-gradient(115deg, #162e29, #101d25);
  box-shadow: 0 4px 14px #080e1380;
}
#scr-menu .menu-item.play {
  color: #12251f;
  background: linear-gradient(115deg, #e6d1a0, #a8e8c5);
}
#scr-menu .menu-item.play small { color: #294a3f; }
#menu-partner-iv {
  margin: .45rem auto;
  border-radius: 999px;
  border: 1px solid #648796;
  background: #142633;
  color: #d0efff;
}
/* Compact partner HUD and expandable move list. */
/* Hunt HUD */
#hunt-dps {
  position: fixed;
  z-index: 9;
  top: max(58px, calc(env(safe-area-inset-top) + 54px));
  right: max(10px, env(safe-area-inset-right));
  width: min(245px, 48vw);
  color: #eefbf4;
  font: 600 12px system-ui, sans-serif;
  pointer-events: auto;
}
#hunt-dps[hidden], #hunt-dps-panel[hidden] { display: none; }
.hunt-dps-toggle {
  display: grid;
  width: 100%;
  min-height: 34px;
  gap: 3px;
  padding: 8px 10px 7px;
  border: 1px solid #8cc9ac80;
  border-radius: 14px;
  background: linear-gradient(145deg, #133c30f2, #091c18f5);
  box-shadow: 0 7px 22px #03120e80, inset 0 1px #ffffff12;
  color: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.hunt-dps-toggle:focus-visible { outline: 2px solid #bcebd4; outline-offset: 2px; }
.hunt-dps-top { display: flex; align-items: center; justify-content: space-between; line-height: 1; }
.hunt-dps-kicker { display: inline-flex; align-items: center; gap: 5px; color: #a7d9bf; font-size: 9px; letter-spacing: .12em; font-weight: 750; }
.hunt-dps-kicker i { width: 5px; height: 5px; flex: none; border-radius: 50%; background: #7ef0bc; box-shadow: 0 0 6px #6bf2b2b3; }
.hunt-dps-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.hunt-dps-arrow { color: #bcebd4; }
#hunt-dps.expanded .hunt-dps-arrow { transform: rotate(180deg); }
.hunt-dps-chart { display: block; height: 31px; min-width: 0; border-radius: 7px; overflow: hidden; background: #071b14a8; }
.hunt-dps-graph { display: block; width: 100%; height: 100%; overflow: visible; }
.hunt-dps-grid { fill: none; stroke: #9de8bd26; stroke-width: .65; vector-effect: non-scaling-stroke; }
.hunt-dps-area { fill: #70e9af23; stroke: none; }
.hunt-dps-line { fill: none; stroke: #7ef3bd; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.hunt-dps-point { fill: #d2ffe7; stroke: #64e7aa; stroke-width: 1; vector-effect: non-scaling-stroke; }
.hunt-dps-chart-caption { display: block; color: #a6cdbc; font-size: 9px; font-weight: 600; letter-spacing: .035em; line-height: 1.1; }
.hunt-dps-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: min(245px, 48vw);
  max-height: calc(100dvh - 155px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid #8cc9ac70;
  border-radius: 14px;
  background: #102820f5;
  box-shadow: 0 4px 14px #080e1380;
}
.hunt-dps-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; }
.hunt-dps-head small { color: #b6d2c2; font-size: 10px; }
.hunt-dps-note { margin: 5px 0 0; color: #b6d2c2; font-size: 10px; font-weight: 400; line-height: 1.25; }
.hunt-dps-columns, .hunt-dps-list li { display: grid; grid-template-columns: minmax(0, 1fr) 42px 55px; gap: 6px; }
.hunt-dps-columns { margin: 7px 0 3px; color: #a9c8b8; font-size: 10px; }
.hunt-dps-list { list-style: none; margin: 0; padding: 0; max-height: min(34vh, 220px); overflow-y: auto; }
.hunt-dps-list li { padding: 3px 0; font-size: 11px; }
.hunt-dps-list li span:first-child { min-width: 0; overflow-wrap: anywhere; }
.hunt-dps-list li span:not(:first-child), .hunt-dps-columns span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.hunt-dps-list li.hunt-dps-empty { display: block; color: #b6d2c2; }
@media (max-height: 520px) {
  #hunt-dps { width: min(215px, 43vw); }
  .hunt-dps-panel { width: min(215px, 43vw); }
  .hunt-dps-toggle { min-height: 30px; padding: 6px 8px; font-size: 11px; }
  .hunt-dps-summary { font-size: 11px; }
  .hunt-dps-chart { height: 25px; }
  .hunt-dps-kicker, .hunt-dps-chart-caption { font-size: 8px; }
  .hunt-dps-panel { padding: 7px 8px; }
  .hunt-dps-list { max-height: 28vh; }
}
/* The taller graph shares the old chat-notice position, even while compact. */
body:has(#hunt-dps:not([hidden])) #chat-dock.chat-in-hunt {
  right: auto; left: max(8px, env(safe-area-inset-left));
  top: max(110px, calc(env(safe-area-inset-top) + 105px)); justify-items: start;
}
#hunt-loadout {
  --hud-surface: #0a221bd4;
  --hud-border: #8cc9ac5c;
  --hud-ink: #eefbf4;
  --hud-mint: #bcebd4;
  position: fixed;
  z-index: 8;
  top: max(9px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  width: min(216px, 46vw);
  color: var(--hud-ink);
  font-size: 12px;
  pointer-events: none;
}
#hunt-loadout summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 39px;
  padding: 4px 7px 4px 4px;
  border: 1px solid var(--hud-border);
  border-radius: 10px;
  background: var(--hud-surface);
  cursor: pointer;
  list-style: none;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
#hunt-loadout summary::-webkit-details-marker { display: none; }
#hunt-loadout summary::after {
  content: '▾';
  align-self: start;
  color: var(--hud-mint);
}
#hunt-loadout details[open] summary::after { content: '▴'; }
#hunt-loadout :is(summary, button):focus-visible { outline: 2px solid var(--hud-mint); outline-offset: 2px; }
#hunt-loadout summary canvas { flex: 0 0 32px; width: 32px; height: 32px; image-rendering: pixelated; }
.hunt-summary { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 3px 5px; align-items:center; }
.hunt-partner { line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hunt-details { display: flex; gap: 4px; color: #e3d39d; white-space: nowrap; font-size: 9px; }
.hunt-health {
  position: relative;
  grid-column: 1 / -1;
  overflow: hidden;
  border-radius: 999px;
  height: 8px;
  background: #4a263a;
  text-align: center;
  line-height: 8px;
  font-weight: 750;
  font-size: 7px;
}
.hunt-health i, .hunt-cooldown { position: absolute; left: 0; bottom: 0; }
.hunt-health i { inset-block: 0; background: #399b73; border-radius: inherit; }
.hunt-health span { position: relative; text-shadow: 0 1px 2px #081710; }
.hunt-quick-moves { display:flex; align-items:center; gap:3px; grid-column:1 / -1; }
.hunt-quick-moves:empty { display:none; }
.hunt-move-chip {
  width:20px;
  height:19px;
  display:grid;
  place-items:center;
  border-radius:5px;
  background:#a8dbc326;
}
.hunt-move-more { color:var(--hud-mint); font-size:10px; padding-inline:3px; }
.hunt-actions { display:flex; align-items:center; flex-wrap:wrap; gap:4px; margin-top:4px; }
.hunt-action {
  min-height:30px;
  padding:3px 10px;
  border:1px solid var(--hud-border);
  border-radius:999px;
  background:var(--hud-surface);
  color:var(--hud-ink);
  font:700 11px/1.2 var(--font);
  cursor:pointer;
  pointer-events:auto;
  touch-action:manipulation;
}
.hunt-action[aria-pressed="true"] { color:#ffe0a1; border-color:#dfa868a8; }
@media (max-width:460px) {
  #hunt-loadout summary canvas { flex-basis:27px; width:27px; height:27px; }
  .hunt-summary { column-gap:3px; }
  .hunt-partner { font-size:11px; }
}
.hunt-loadout-panel {
  position:absolute;
  top:calc(100% + 4px);
  left:0;
  pointer-events:auto;
  width: min(378px, calc(100vw - 28px - env(safe-area-inset-left)));
  max-height: min(calc(100vh - 110px - env(safe-area-inset-bottom)), 320px);
  max-height: min(calc(100dvh - 110px - env(safe-area-inset-bottom)), 320px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 8px;
  border: 1px solid #6b9e9d70;
  border-radius: 13px;
  background: #0a201bf2;
  box-shadow: 0 8px 24px #0007;
}
.hunt-move-count { display: block; padding: 2px 4px 6px; color: #b5ddd9; }
.hunt-loadout-groups {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.hunt-loadout-group {
  min-width: 0;
  padding: 4px;
  border: 1px solid #6b9e9d55;
  border-radius: 8px;
}
.hunt-loadout-group h3 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  margin: 0 2px 4px;
  font-size: 11px;
  color: #b5ddd9;
}
.hunt-loadout-group h3 small { font-size: 10px; color: #9bb7cb; }
.hunt-loadout-group:nth-child(5) { border-color: #c9a45d80; }
.hunt-loadout-group:nth-child(5), .hunt-held-item { grid-column: 1 / -1; }
.hunt-loadout-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hunt-loadout-row {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 27px;
  padding: 2px 4px;
  border-radius: 8px;
  background: #243548;
}
.hunt-slot {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  min-width: 34px;
  color: #9bb7cb;
  font-size: 10px;
}
.hunt-slot-info { display: grid; min-width: 0; gap: 1px; }
.hunt-slot-info b { font-size: 11px; line-height: 1.1; overflow-wrap: anywhere; }
.hunt-slot-info small { color: #c1d0e0; font-size: 9px; text-transform: capitalize; }
.hunt-empty { background: #1b2938; color: #9bb7cb; }
.hunt-passives {
  width:max-content;
  max-width:min(285px,calc(100vw - 28px - env(safe-area-inset-left)));
  margin-top:4px;
  padding:3px 9px;
  border-radius:9px;
  background:#231b37bd;
  color:#efdcff;
  font-size:10px;
  overflow-wrap:anywhere;
}
.hunt-slot-info small:empty { display: none; }
.hunt-cooldown { height: 2px; background: #a3ded8; }
@media (min-width: 700px) {
  .hunt-loadout-panel { width: 550px; }
  .hunt-loadout-groups { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hunt-loadout-group:nth-child(5) { grid-column: span 3; }
  .hunt-held-item { grid-column: span 1; align-self: end; }
}
#hunt-gem-notice {
  position: fixed;
  z-index: 9;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 5px 12px;
  border: 1px solid #8c72bc;
  border-radius: 999px;
  background: #1a1329ef;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}


.stage-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(158px, 100%), 1fr));
  gap: 8px;
}
.stage-card {
  display: grid;
  gap: 4px;
  padding: 9px 12px;
  min-height: 68px;
  text-align: left;
  color: #eef9f3;
  background: #192c28;
  border: 1px solid #7ccfa168;
  border-radius: 12px;
  font: inherit;
  cursor: pointer;
}
.stage-card:hover:not(:disabled), .stage-card:focus-visible { border-color: var(--gold); }
.stage-card .stage-no { font-size: 11px; color: #9cdbb8; }
.stage-card small { font-size: 11px; color: #c8d7d0; }
.stage-card:disabled { opacity: .65; cursor: default; border-color: #81988c44; }
.lobby-stage { display: flex; align-items: center; gap: 5px; }

/* Shared menu and results surfaces. */
:root {
  --hunt-panel: #132521;
  --hunt-ink: #f0f5e9;
  --hunt-line: #89b3a041;
  --hunt-muted: #abc3b5;
  --hunt-accent: #c6e5a3;
  --hunt-copper: #e9ab79;
}
#scr-menu {
  padding: clamp(52px, 11vh, 94px) clamp(12px, 4vw, 68px) clamp(12px, 4vh, 32px);
  align-items: stretch;
  justify-content: center;
  overflow: auto;
  background: linear-gradient(110deg, #0d211eea 8%, #102c2099 46%, #141d18e8 96%);
}
.hunt-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.16fr);
  width: min(1120px, 100%);
  margin: auto;
  gap: clamp(10px, 2vw, 24px);
  color: var(--hunt-ink);
}
.hunt-home-partner, .hunt-home-nav {
  min-width: 0;
  position: relative;
  border: 1px solid var(--hunt-line);
  border-radius: clamp(16px, 2.5vw, 28px);
}
.hunt-home-partner {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: clamp(10px, 2.3vw, 26px);
  isolation: isolate;
  background:
    radial-gradient(ellipse at 20% 10%, #b0804533, transparent 60%),
    linear-gradient(150deg, #26382b, #101f20 65%);
}
.hunt-home-partner .logo { margin: 0; }
.hunt-home-partner .logo .t1 { font-size: clamp(22px, 4vw, 52px); letter-spacing: -.045em; color: #f3e2b5; text-shadow: 0 4px 15px #091a12; }
.hunt-partner-art {
  display: grid;
  place-items: center;
  width: 100%;
  position: relative;
  isolation: isolate;
}
.hunt-partner-art::before {
  content: '';
  position: absolute;
  z-index: -1;
  width: min(70%, 240px);
  aspect-ratio: 1;
  border-radius: 52% 44% 52% 45%;
  transform: rotate(-12deg);
  background: repeating-radial-gradient(ellipse at center, #b5d5a917 0 1px, transparent 1px 13px),
    radial-gradient(ellipse, #92be8749, transparent 67%);
}
#menu-partner {
  background: transparent; border: 0; box-shadow: none;
  width: auto; height: clamp(76px, 30vh, 210px); max-width: 100%;
}
#menu-partner-name { margin: 0 0 3px; font-size: clamp(1rem, 2.5vw, 2.1rem); letter-spacing: -.035em; }
.hunt-partner-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 6px; }
#menu-partner-iv { margin: 0; font-size: .78rem; color: var(--hunt-ink); background: #172f2e; border-color: #99c9ad65; }
.hunt-home-nav {
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: center;
  gap: clamp(5px, 1.4vh, 14px); padding: clamp(7px, 1.5vw, 18px);
  background: #10221ee8;
}
.hunt-home-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(4px, 1vh, 10px); }
#scr-menu .menu-item {
  display: grid;
  width: 100%; min-height: 42px; min-width: 0;
  align-items: center; column-gap: 8px;
  grid-template-columns: 26px minmax(0, 1fr);
  padding: clamp(4px, 1vh, 10px) clamp(6px, 1.3vw, 15px);
  border: 1px solid #789d8c4d; border-radius: 13px;
  background: linear-gradient(135deg, #263d33, #1a2b27 70%);
  box-shadow: none; color: var(--hunt-ink); font-size: clamp(.82rem, 1.65vw, 1.07rem);
}
#scr-menu .menu-item:hover, #scr-menu .menu-item:focus-visible { border-color: #c6e5a3bf; background-color: #2a463c; }
#scr-menu .menu-item .mi-ico { grid-row: 1 / span 2; justify-self: center; }
#scr-menu .menu-item small { grid-column: 2; color: var(--hunt-muted); font-size: clamp(.63rem, 1.3vw, .78rem); min-width: 0; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
#scr-menu .menu-item.play {
  grid-column: auto; min-height: 55px; color: #192820;
  border-color: #e4d5a3;
  background: linear-gradient(111deg, #e9bc8c 2%, #e3da9d 51%, #c6e5a3);
  font-size: clamp(1rem, 2.1vw, 1.35rem);
}
#scr-menu .menu-item.play small { color: #394c3c; }
.hunt-home-stats { color: var(--hunt-muted); font-size: .74rem; padding-inline: 5px; }
.topbar .pill, .topbar .btn {
  border: 1px solid #a1c0a965; box-shadow: none; text-shadow: none;
  background: #10231fec; color: var(--hunt-ink); border-radius: 999px;
}
:is(#scr-dex, #scr-goals, #scr-upgrades, #scr-gacha, #scr-friends, #scr-rank, #scr-stages, #scr-lobby, #scr-pyramid) {
  background: radial-gradient(ellipse at 18% 10%, #244b398c, #0b1614db 60%);
}
:is(#scr-upgrades, #scr-gacha, #scr-friends, #scr-rank, #scr-stages, #scr-lobby, #scr-profile) > .box {
  background: linear-gradient(145deg, #243b31, var(--hunt-panel) 55%);
  color: var(--hunt-ink); border-color: var(--hunt-line);
}
:is(#scr-dex, #scr-goals) .hunter-workspace {
  width: min(1160px, 100%); height: min(740px, 100%); min-height: 0;
  display: flex; flex-direction: column; overflow: hidden; gap: 10px;
  padding: clamp(10px, 2vw, 24px); border: 1px solid var(--hunt-line);
  background: linear-gradient(145deg, #213a30, var(--hunt-panel) 55%);
  color: var(--hunt-ink);
}
.hunter-heading { flex: 0 0 auto; gap: 8px; }
.hunter-heading h2 { margin: 0; letter-spacing: -.035em; }
.hunter-heading .btn { flex-shrink: 0; border-radius: 999px; }
.hunter-tabs, .hunter-switch { display: flex; align-items: center; gap: 5px; }
.hunter-switch button, .hunter-tabs .tab {
  box-shadow: none; text-shadow: none; border-radius: 999px; border: 1px solid var(--hunt-line);
  background: #172c26; color: #d9e7dc; font: 650 .78rem system-ui, sans-serif;
  min-height: 34px; padding: 4px 10px; white-space: nowrap; cursor: pointer;
}
.hunter-switch button.on, .hunter-tabs .tab.on {
  background: #3a5540; border-color: #c6e5a3a8; color: #f3ffe0;
}
.hunt-dex-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; }
#dex-total { font-size: .78rem; white-space: nowrap; margin-left: 4px; }
.hunt-dex-layout { display: grid; flex: 1; min-height: 0; grid-template-columns: minmax(0, 1.48fr) minmax(0, 1fr); gap: clamp(8px, 1.5vw, 18px); }
.hunt-dex-browser { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 7px; }
.hunt-dex-filters { display: grid; grid-template-columns: minmax(105px, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 5px; }
.hunt-dex-filters .field { width: 100%; min-width: 0; padding: 6px; min-height: 36px; color-scheme: dark; font: .77rem system-ui; border-color: var(--hunt-line); background: #112520; }
#scr-dex #dex-grid { flex: 1; min-height: 0; align-content: start; max-height: none; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); overscroll-behavior: contain; }
#scr-dex .cell {
  min-width: 0; padding-top: 9px; border: 1px solid var(--hunt-line);
  border-radius: 13px 13px 13px 4px; color: var(--hunt-ink);
  background: linear-gradient(160deg, color-mix(in srgb, var(--dex-type, #69adb6) 14%, #172922), #152820 70%);
  font: inherit; text-align: center; cursor: pointer;
}
#scr-dex .cell:hover, #scr-dex .cell:focus-visible, #scr-dex .cell.on { border-color: var(--hunt-accent); background: #304b37; transform: none; }
#scr-dex .cell canvas { width: min(92px, 100%); height: auto; }
#scr-dex .cell b { font-size: .8rem; }
#scr-dex .cell small { color: var(--hunt-muted); font-size: .69rem; }
.dex-page-controls { display: flex; flex: 0 0 auto; gap: 8px; justify-content: space-between; align-items: center; color: var(--hunt-muted); }
.dex-page-controls .btn { width: 42px; height: 33px; padding: 0; margin: 0; font-size: 1.25rem; }
.dex-empty { grid-column: 1 / -1; margin: 12px; color: var(--hunt-muted); }
#scr-dex #dex-detail {
  overflow: auto; display: flex; flex-direction: column; align-items: stretch; min-height: 0; gap: 7px;
  overscroll-behavior: contain; touch-action: pan-y;
  background: radial-gradient(ellipse at 0 0, color-mix(in srgb, var(--dex-type, #69adb6) 20%, #132522), #11231e 70%);
  border: 1px solid var(--hunt-line); border-radius: 15px; padding: clamp(6px, 1.4vw, 16px);
}
.dex-partner-head { min-width: 0; display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.dex-partner-head > div { min-width: 0; }
.dex-partner-head h3 { overflow-wrap: anywhere; margin: 2px 0; }
.dex-partner-head small, .dex-rarity { color: var(--hunt-muted); font-size: .72rem; }
#scr-dex #dex-big {
  width: clamp(54px, 10vw, 125px); aspect-ratio: 1.2; height: auto; flex: 0 0 auto;
  margin: 0; background: #071d1768; border: 1px solid var(--hunt-line); box-shadow: none;
}
#dex-detail .seg { margin: 0; align-self: flex-start; }
.dex-detail-tabs { flex: 0 0 auto; overflow-x: auto; scrollbar-width: thin; }
.dex-detail-content { flex: 0 0 auto; min-width: 0; padding-inline: 2px; }
.dex-detail-content > p { margin: 5px 0 9px; }
.dex-stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 7px; padding: 4px 0; font-size: .78rem; }
.dex-stat strong { color: #e1f5c5; }
.dex-stat meter { grid-column: 1/-1; width: 100%; height: 9px; accent-color: var(--hunt-accent); }
.dex-stat meter::-webkit-meter-bar { background: #284039; border: 0; border-radius: 99px; }
.dex-stat meter::-webkit-meter-optimum-value { background: var(--hunt-accent); border-radius: 99px; }
.dex-matchups { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.dex-matchups small { border: 1px solid var(--chip-tint); color: var(--hunt-ink); background: #21342e; padding: 2px 6px; border-radius: 999px; }
.dex-move-list h4 { margin: 3px 0 6px; }
.dex-move-list ul, .hunt-result-moves ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 4px; list-style: none; padding: 0; margin: 0 0 7px; }
.dex-move-list li, .hunt-result-moves li { padding: 5px 6px; border-radius: 8px; background: #203b32; font-size: .78rem; }
.dex-partner-footer { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 6px; }
#scr-dex #dex-detail .btn { position: static; margin: 0; box-shadow: none; font-size: .82rem; }
.dex-partner-footer .btn { flex: 1 1 125px; order: 0; }
#scr-goals #goals-body { flex: 1; max-height: none; min-height: 0; overscroll-behavior: contain; }
.hunter-tabs { flex: 0 0 auto; width: fit-content; }
.hunter-tabs .tab { min-width: min(13vw, 130px); }
.hunter-profile-hero {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  min-height: 140px; padding: clamp(10px, 2.1vw, 26px); border: 1px solid #d1ad785d;
  color: #fcf6df;
  border-radius: 19px 19px 19px 6px;
  background: radial-gradient(ellipse at 85% 35%, #d69c5c60, transparent 43%),
    repeating-linear-gradient(151deg, #e4af7322 0 1px, transparent 1px 16px),
    linear-gradient(110deg, #3c3021, #1b2822 63%);
}
.hunter-profile-hero h3 { font-size: clamp(1.25rem, 3vw, 2.3rem); overflow-wrap: anywhere; }
.hunter-profile-hero .sub, .hunter-profile-hero label { margin: 0 0 4px; color: #e3d0a9; }
.hunter-profile-hero .field { max-width: 230px; padding: 5px 8px; background: #262924; color-scheme: dark; border-color: #e5c17d67; }
.hunter-profile-art canvas { width: min(21vw, 188px); height: auto; }
.hunter-profile-metrics, .hunter-region-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.hunter-profile-metrics { margin: 12px 0; }
.hunter-profile-metrics > div, .hunter-region-grid > div { border: 1px solid var(--hunt-line); border-radius: 12px; background: #182d27; padding: 8px; }
.hunter-profile-metrics dt, .hunter-region-grid small, .hunter-profile-section small { color: var(--hunt-muted); font-size: .76rem; }
.hunter-profile-metrics dd { margin: 2px 0 0; font-size: 1.1rem; font-weight: 750; }
.hunter-profile-section { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.hunter-profile-section h3 { margin: 0; }
.hunter-profile-block { margin: 14px 0 2px; }
.hunter-region-grid div { display: grid; grid-template-columns: 1fr auto; gap: 5px; }
.hunter-region-grid progress { width: 100%; grid-column: 1/-1; height: 8px; accent-color: var(--hunt-accent); }
.hunter-region-grid progress::-webkit-progress-bar { background: #28403a; border-radius: 99px; }
.hunter-region-grid progress::-webkit-progress-value { background: #b6d893; border-radius: 99px; }
#scr-goals .fav-slot { width: 100%; min-width: 0; color: var(--hunt-ink); padding: 6px; border: 1px solid var(--hunt-line); border-radius: 13px; background: #1b3229; }
#scr-goals .fav-slot:hover, #scr-goals .fav-slot:focus-visible { border-color: var(--hunt-accent); }
#scr-goals .fav-slot canvas { max-width: 100%; height: auto; }
.hunter-shiny-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; text-align: center; }
.hunter-shiny-gallery div { min-width: 0; display: grid; justify-items: center; padding: 4px; border-radius: 10px; background: #1b3229; font-size: .77rem; }
.hunter-shiny-gallery canvas { max-width: 100%; height: auto; }
#scr-pyramid .iv-box { width: min(1080px, 100%); }
.hunt-iv-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start; gap: clamp(8px, 1.5vw, 18px); }
.hunt-iv-tree { border-radius: 22px; padding: clamp(8px, 1.5vw, 18px); background: linear-gradient(150deg,#2f3e2e,#152b28); border: 1px solid var(--hunt-line); }
#iv-slots { margin: 5px 0 0; gap: 0; }
.iv-slot { position: relative; z-index: 0; }
.iv-slot > span, .iv-slot > small { font-size: .69rem; }
.iv-tier + .iv-tier .iv-slot::before { content: ''; position: absolute; top: 0; left: 50%; width: 1px; height: 5px; background: #8eb3a09d; }
.iv-tier .iv-choice { min-height: 36px; }
.hunt-results {
  width: min(760px, 100%); display: flex; flex-direction: column; gap: 8px;
  padding: clamp(10px, 2.3vw, 24px); overflow: hidden; background: linear-gradient(150deg,#2d4538,#162820 60%);
  border: 1px solid var(--hunt-line); color: var(--hunt-ink);
}
.hunt-results header, .hunt-results footer { display: flex; justify-content: space-between; align-items: center; flex: 0 0 auto; }
.hunt-results footer { justify-content: flex-end; }
.hunt-results header .sub { margin: 4px 0 0; }
.hunt-results-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding-right: 4px; }
.hunt-results-metrics { display: flex; flex-wrap: wrap; gap: 5px; }
.hunt-results-metrics div { flex: 1 1 auto; min-width: 78px; display: grid; gap: 3px; padding: 7px; border-radius: 10px; background: #121e1a72; }
.hunt-results-metrics span, .hunt-coin-total span:not(.coin), .hunt-coin-total small { color: var(--hunt-muted); font-size: .76rem; }
.hunt-results-metrics strong { color: #eff8e9; }
.hunt-reward-board { padding: 9px; margin: 7px 0; border: 1px solid #a6b6744f; background: #283e3196; border-radius: 15px; }
.hunt-coin-total { display: grid; gap: 2px; padding: 4px 0 8px; }
.hunt-coin-total strong { font-size: 1.45rem; }
.hunt-caught, .hunt-result-moves { padding: 8px; background: #142a23; border-radius: 12px; margin: 7px 0; }
.hunt-caught .caught-row { justify-content: flex-start; }
.hunt-result-moves summary { font-weight: 700; cursor: pointer; }
.hunt-result-moves summary span, .hunt-result-moves li small { color: var(--hunt-muted); }
.hunt-result-moves ul { margin: 7px 0 0; }
#gacha-pulls { margin-top: 10px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.gacha-pull-tier { min-width: 0; padding: 5px; display: grid; align-content: start; gap: 5px; border: 1px solid var(--hunt-line); border-radius: 12px; background: #172c25; }
.gacha-pull-tier h3 { text-align: center; margin: 0; font-size: .92rem; color: var(--hunt-ink); }
.gacha-pull-tier .btn { width: 100%; min-height: 36px; padding: 4px 3px; font-size: .78rem; white-space: nowrap; box-shadow: none; }
#pull-summary { width: min(720px, 100%); padding: 8px 12px; border: 1px solid var(--hunt-line); border-radius: 14px; background: #152a25; }
#pull-summary h2 { margin: 0 0 4px; }
#pull-summary div { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--hunt-muted); font-size: .85rem; }
#pull-summary strong { color: var(--hunt-ink); }
#pull-summary p { margin-top: 6px; font-size: .77rem; }
#pull-report {
  width: min(960px, 100%); height: min(660px, 100%); min-width: 0; min-height: 0;
  display: grid; grid-template: auto minmax(0, 1fr) auto / minmax(0, 1fr); gap: 6px;
  justify-items: center;
}
#pull-summary { grid-row: 1; }
#pull-report .pull-results {
  grid-row: 2; width: 100%; max-width: none; min-width: 0; min-height: 0;
  align-content: flex-start; justify-content: center; overflow: auto;
  overscroll-behavior: contain; touch-action: pan-y; padding: 7px 3px;
}
#pull-report .pcard {
  flex: 0 1 112px; min-width: 0; padding: 5px 3px; border-width: 1px;
  box-shadow: none; overflow-wrap: anywhere;
}
#pull-report .pcard canvas { width: min(100%, 86px); height: auto; }
#pull-report .pcard b { font-size: .82rem; }
#pull-report .pcard .tag { font-size: .73rem; }
.pull-actions {
  grid-row: 3; z-index: 2;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; padding: 5px;
  background: #10231fed; border-radius: 12px; gap: 8px;
}
#pull-paging { display: flex; gap: 6px; align-items: center; }
#pull-paging button { font-size: 1.15rem; min-width: 33px; }
#pull-page-status { font-size: .8rem; white-space: nowrap; }
.ach-pop { pointer-events: none; }
body:has(#pull-fx:not(.hidden)) .ach-pop { top: auto; bottom: 66px; }
body:has(#summon-reveal:not(.hidden)) .ach-pop { visibility: hidden; }

#summon-reveal {
  --drop-height: clamp(24px, 15dvh, 76px);
  --ball-size: clamp(26px, min(9vw, 17dvh), 50px);
  width: min(920px, 100%); max-height: 100%; min-width: 0; min-height: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center; gap: clamp(5px, 1.5dvh, 15px);
  padding: clamp(8px, 2dvh, 18px);
  border: 1px solid #8dac9a63; border-radius: 22px;
  background: radial-gradient(ellipse at 50% 50%, #34594979, transparent 72%), #10251f;
  color: var(--hunt-ink);
}
#summon-reveal header { text-align: center; }
#summon-reveal-title { margin: 0; font-size: clamp(1.15rem, 4dvh, 1.8rem); }
#summon-preview-count { margin: 2px 0 0; color: var(--hunt-muted); font-size: .75rem; }
#summon-ledge {
  display: grid; grid-template-columns: repeat(var(--ball-count), minmax(0, 1fr));
  gap: 4px 2px; list-style: none; margin: 0; padding: 0 1px 5px;
  width: min(calc(var(--ball-count) * 104px), 100%); min-height: 0; overflow: auto;
  scrollbar-width: thin; overscroll-behavior: contain;
}
.summon-slot {
  --open-delay: calc(var(--drop-delay) + 615ms);
  min-width: 0; position: relative; text-align: center;
}
.summon-pad {
  display: grid; place-items: end center; position: relative; isolation: isolate;
  height: calc(var(--drop-height) + var(--ball-size) + 10px); padding-bottom: 8px;
}
.summon-pad::before {
  content: ''; position: absolute; inset: auto 0 1px;
  height: 7px; z-index: -1; border-top: 1px solid #acceac9c;
  background: linear-gradient(#48775f, #233f34); border-radius: 2px;
  box-shadow: 0 4px 9px #050d08ba;
}
.summon-ball {
  position: relative; width: min(var(--ball-size), 62%); aspect-ratio: 1;
  animation: summon-fall 570ms var(--drop-delay) both;
}
.summon-half { position: absolute; inset: 0; }
.summon-half img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.summon-half.top { clip-path: inset(0 0 50%); animation: summon-open-top 360ms var(--open-delay) both; }
.summon-half.bottom { clip-path: inset(50% 0 0); animation: summon-open-bottom 360ms var(--open-delay) both; }
.summon-flare {
  width: min(var(--ball-size), 61%); aspect-ratio: 1; position: absolute; bottom: 8px;
  border-radius: 100%; pointer-events: none;
  background: radial-gradient(circle, #fff, var(--rarity) 23%, transparent 66%);
  animation: summon-flash 420ms var(--open-delay) both;
}
.summon-slot.shiny .summon-flare { background: radial-gradient(circle, #fff 12%, #b4f9ff 32%, #b188fa 52%, transparent 70%); }
.summon-name, .summon-rarity {
  display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  animation: summon-type-in 190ms calc(var(--open-delay) + 140ms) both;
}
.summon-name { margin-top: 4px; font-size: clamp(.58rem, 1.55vw, .87rem); font-weight: 700; }
.summon-rarity { color: var(--rarity); font-size: clamp(.53rem, 1.45vw, .75rem); }
.summon-slot.shiny .summon-rarity { color: #c2f9ff; }
#summon-skip { margin: 0; border-radius: 999px; min-height: 32px; }
@keyframes summon-fall {
  0% { opacity: 0; transform: translateY(calc(-1 * var(--drop-height))) rotate(-35deg); }
  18% { opacity: 1; }
  70% { transform: none; }
  85% { transform: translateY(-5px) rotate(8deg); }
  100% { transform: none; }
}
@keyframes summon-open-top {
  0% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translate(-17%, -45%) rotate(-18deg); }
}
@keyframes summon-open-bottom {
  0% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translate(25%, 22%) rotate(14deg); }
}
@keyframes summon-flash {
  0% { opacity: 0; transform: scale(.35); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.55); }
}
@keyframes summon-type-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 500px) {
  #summon-ledge { grid-template-columns: repeat(var(--compact-count), minmax(0, 1fr)); }
}
@media (max-width: 500px) and (max-height: 320px) {
  #summon-reveal { --drop-height: 13px; --ball-size: 26px; padding: 6px; gap: 4px; }
  .summon-pad { height: calc(var(--drop-height) + var(--ball-size) + 5px); padding-bottom: 5px; }
  .summon-pad::before { height: 4px; }
  .summon-name { margin-top: 2px; }
  .summon-name, .summon-rarity { line-height: 1.1; }
  #summon-skip { min-height: 28px; }
}

@media (max-width: 760px) {
  .hunt-dex-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #dex-search { grid-column: 1/-1; }
}
@media (max-height: 520px) {
  :is(#scr-dex, #scr-goals, #scr-upgrades, #scr-gacha, #scr-friends, #scr-rank, #scr-stages, #scr-lobby, #scr-pyramid) { padding-top: 44px; }
  :is(#scr-dex, #scr-goals) .hunter-workspace { gap: 5px; }
  #scr-dex #dex-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 4px; }
  #scr-dex .cell canvas { width: min(100%, 57px); height: 48px; }
  .hunt-dex-filters .field { min-height: 31px; }
  .hunter-switch button, .hunter-tabs .tab { min-height: 29px; }
  #scr-menu .menu-item { min-height: 37px; }
  #scr-menu .menu-item.play { min-height: 44px; }
  #scr-menu .menu-item .mi-ico img { width: 20px; height: 20px; }
  #scr-pyramid .iv-box { padding: 9px; }
  .hunt-iv-tree { padding: 7px; }
  .iv-slot { padding: 3px; gap: 2px; }
  .iv-tier .iv-choice { padding-block: 3px; min-height: 31px; }
  .hunt-results-metrics div { padding: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .scr, .box, .cell, .menu-item, .pcard { animation: none !important; transition: none !important; }
}

.hunter-specialties { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hunter-medals { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.hunter-medals li { display: flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 9px; background: #3f3826; font-size: .8rem; }

/* Pause controls sit beside a scrollable snapshot of the current hunt. */
.hunt-pause {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(190px, .65fr) minmax(0, 1.55fr);
  align-items: start;
  gap: clamp(8px, 2vw, 22px);
  padding: clamp(10px, 2vw, 25px);
  border: 1px solid var(--hunt-line);
  background: linear-gradient(142deg, #263f35, #132720 65%);
  color: var(--hunt-ink);
}
.pause-controls { min-width: 0; }
.pause-controls h2 { margin: 0 0 8px; }
.pause-controls .sound-inline { min-width: 0; margin: 6px 0; }
.pause-actions { display: grid; gap: 6px; }
.pause-actions .btn { margin: 0; min-height: 38px; }
#pause-loadout {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--hunt-line);
  background: #11251f;
  max-height: min(74dvh, 510px);
  overflow: hidden;
  color: var(--hunt-ink);
}
.pause-loadout-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
#pause-loadout header h3 { margin: 0 0 2px; }
#pause-move-count { margin: 0 0 8px; font-size: .78rem; color: var(--hunt-muted); }
#pause-loadout .hunt-loadout-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#pause-loadout .hunt-loadout-group:nth-child(5), #pause-loadout .hunt-held-item { grid-column: auto; }
#pause-loadout .hunt-loadout-group { border-color: #86afa250; }
#pause-loadout .hunt-loadout-group h3 { font-size: .75rem; margin: 0 2px 4px; }
#pause-loadout .hunt-loadout-row { background: #213a32; }
#pause-loadout .hunt-empty { background: #142d26; }
#pause-loadout button.hunt-loadout-row {
  width: 100%; min-height: 31px; border: 1px solid transparent;
  text-align: left; color: inherit; font: inherit; cursor: pointer;
}
#pause-loadout button.hunt-loadout-row:hover, #pause-loadout button.hunt-loadout-row:focus-visible,
#pause-loadout button.hunt-loadout-row[aria-pressed="true"] { border-color: var(--hunt-accent); }
#pause-loadout .hunt-passives { max-width: 100%; }
#pause-move-detail {
  display: grid; gap: 2px; flex: 0 0 auto; min-height: 30px; max-height: min(20dvh, 88px);
  overflow: auto; overscroll-behavior: contain; margin-top: 7px;
  padding: 7px 9px; border-radius: 9px; background: #1e352c;
  color: var(--hunt-muted); font-size: .8rem;
}
#pause-move-detail strong { color: var(--hunt-ink); }
#pause-move-detail small { color: var(--hunt-accent); }
@media (min-width: 810px) {
  #pause-loadout .hunt-loadout-groups { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #pause-loadout .hunt-loadout-group:nth-child(5), #pause-loadout .hunt-held-item { grid-column: span 2; }
}
@media (max-width: 500px) {
  .hunt-pause { grid-template-columns: 1fr; }
}
@media (max-height: 350px) {
  .hunt-pause { padding: 8px 10px; }
  .pause-controls h2 { margin-bottom: 3px; }
  .pause-controls .sound-inline { margin: 3px 0; }
  .pause-actions { gap: 4px; }
  .pause-actions .btn { min-height: 33px; padding-block: 5px; }
}


/* Summon preferences live beside the Back button on small screens too. */
.gacha-heading-actions { gap: 7px; flex-shrink: 0; }
.gacha-heading h2 { margin: 0; }
.gacha-animation-switch {
  --switch-on: #87cdad;
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 4px 8px; border: 1px solid #8dac9a75;
  border-radius: 999px; color: #eaf7ed; background: #122b22;
  font-size: clamp(.72rem, 2.3vw, .85rem); white-space: nowrap; cursor: pointer;
}
.gacha-animation-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.gacha-animation-track {
  width: 26px; height: 15px; display: inline-flex; align-items: center; padding: 2px;
  border-radius: 999px; background: #425a51;
}
.gacha-animation-track::after {
  content: ''; width: 11px; height: 11px; border-radius: 100%; background: #eaf7ed;
}
.gacha-animation-switch input:checked + .gacha-animation-track {
  justify-content: flex-end; background: var(--switch-on);
}
.gacha-animation-switch input:checked + .gacha-animation-track::after { background: #112a20; }
.gacha-animation-switch input:focus-visible + .gacha-animation-track { outline: 2px solid #ddf6df; outline-offset: 2px; }
#gacha-animation-state { min-width: 3ch; }
.gacha-motion-control {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  margin: 0; color: #eaf7ed; font-size: clamp(.72rem, 2.3vw, .85rem);
}
.gacha-motion-control select.field {
  width: auto; min-height: 36px; margin: 0; padding: 4px 6px;
  border-radius: 10px; background: #122b22; color: #eaf7ed; color-scheme: dark;
}
.gacha-heading { flex-wrap: wrap; }
.gacha-heading-actions { flex-wrap: wrap; max-width: 100%; }
.summon-in-place .summon-ball { animation: none; }
.summon-in-place .summon-half { animation-name: summon-fade-out; }
.summon-in-place .summon-name, .summon-in-place .summon-rarity { animation-name: summon-fade-in; }
.summon-in-place .summon-flare { visibility: hidden; animation: none; }
@keyframes summon-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes summon-fade-in { from { opacity: 0; } to { opacity: 1; } }

.ascendant-grid-sprite { display: block; width: 76px; max-width: 100%; height: 76px; object-fit: contain; margin: auto; image-rendering: pixelated; }
.ascendant-entry .ascendant-artwork { display: block; width: 100%; max-height: 320px; object-fit: contain; border-radius: 12px; }
.ascendant-entry .ascendant-battle-sprite { display: block; width: 96px; height: 96px; object-fit: contain; image-rendering: pixelated; }

.ascendant-preview {
  width: min(100%, 112px);
  aspect-ratio: 1;
  background: url('../assets/pokemon/ascendant-marowak-motion.png') 0 0 / 200% 200% no-repeat;
  image-rendering: pixelated;
  animation: ascendant-preview-stride 560ms step-end infinite;
}
@keyframes ascendant-preview-stride {
  50% { background-position: 100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ascendant-preview { animation: none; }
}

/* Settings */
#scr-settings .box.settings {
  width: min(820px, 100%);
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: #112823;
  border: 1px solid #426258;
  border-radius: 20px;
  color: #edf8f1;
}
.settings-header {
  display: grid;
  grid-template-columns: 1fr minmax(0, 280px) auto;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
}
.settings-header h2 { margin: 0; }
.settings-header, #scr-settings #set-tabs, .settings-footer { flex: 0 0 auto; }
#set-search { min-width: 0; width: 100%; }
#scr-settings #set-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  margin-top: 0;
  padding: 0 22px 8px;
  border-bottom: 1px solid #426258;
}
#scr-settings #set-tabs button { flex: 0 0 auto; border-radius: 999px; padding: 8px 12px; text-shadow: none; }
#scr-settings #set-tabs button.on { color: #10241d; background: #a8e4bd; border-color: #a8e4bd; }
#scr-settings .set-body { flex: 1 1 auto; min-height: 0; padding: 12px 22px 16px; overflow: auto; overscroll-behavior: contain; }
.settings-category { margin-bottom: 16px; }
.settings-category > h3 { margin: 0 0 12px; font-size: 1.2rem; }
#scr-settings .set-h { color: #a8e4bd; margin: 16px 0 6px; }
#scr-settings .set-row { gap: 12px; border-bottom: 1px solid #38534a; }
#scr-settings .set-row small { color: #bdcfc6; }
#scr-settings .set-chips { flex-shrink: 0; }
#scr-settings .switch[aria-checked="true"], #scr-settings .set-chips .on {
  color: #10241d; background: #a8e4bd; border-color: #a8e4bd;
}
.settings-footer { display: flex; justify-content: flex-end; border-top: 1px solid #426258; padding: 12px 22px; }
#scr-settings [hidden] { display: none !important; }
@media (max-width: 560px) {
  .settings-header { grid-template-columns: 1fr auto; padding: 12px; }
  #set-search { grid-row: 2; grid-column: 1 / -1; }
  #scr-settings #set-tabs, #scr-settings .set-body, .settings-footer { padding-inline: 12px; }
  #scr-settings .set-row:has(.set-chips) { align-items: flex-start; flex-direction: column; }
}

@media (max-height: 430px) {
  #scr-settings .box.settings { max-height: 100%; border-radius: 12px; }
  .settings-header { grid-template-columns: 1fr minmax(0, 240px) auto; gap: 8px; padding: 7px 12px; }
  #set-search { grid-row: auto; grid-column: auto; padding: 5px 8px; }
  #scr-settings #set-tabs { padding: 0 12px 5px; }
  #scr-settings #set-tabs button { padding: 5px 9px; }
  #scr-settings .set-body { padding: 9px 12px; }
  .settings-footer { padding: 5px 12px; }

  #scr-starters > .box { min-height: 0; display:flex; flex-direction:column; overflow:hidden; }
  #scr-starters > .box > :not(#starter-grid) { flex:0 0 auto; }
  #starter-grid { min-height:0; max-height:none; flex:1 1 auto; overscroll-behavior:contain; }
}
.starter-actions { margin-top:7px; gap:6px; }
#starter-info { min-width:0; }

/* Poké Outbreak title treatment */
@font-face {
  font-family: "Outbreak Display";
  src: url("../assets/fonts/BarlowCondensed-ExtraBoldItalic.ttf") format("truetype");
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}

.outbreak-wordmark {
  display: block;
  max-width: 100%;
  padding-inline: .12em;
  font-family: "Outbreak Display", "Arial Narrow", system-ui, sans-serif;
  font-size: clamp(2.4rem, 8vw, 5.8rem);
  font-weight: 800;
  font-style: italic;
  line-height: .96;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.outbreak-wordmark > span { display: inline-block; }
.outbreak-wordmark .outbreak-poke {
  color: #fff6d8;
  text-shadow: 0 2px #9a6731, 0 5px #152119;
}
.outbreak-wordmark .outbreak-name {
  color: #affa9b;
  -webkit-text-stroke: .012em #e1ffbd;
  text-shadow: 0 2px #4ab879, 0 5px #1b6245, 0 7px #123a2c, 0 0 18px #6fe7a152;
}
#tap-start .outbreak-wordmark { font-size: clamp(2.8rem, 10vw, 8rem); }
.logo .outbreak-wordmark { font-size: clamp(2rem, 5.2vw, 4.25rem); }

#hunt-chat { width:min(28rem,92vw); max-height:85dvh; color:var(--ink); background:var(--box1); }
#hunt-chat::backdrop { background:#07130dc9; }
#chat-log { list-style:none; padding:0; height:min(38dvh,18rem); overflow:auto; overflow-wrap:anywhere; }
#chat-log li { padding:.3rem 0; }
#chat-text { min-width:0; }

.community-banner { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:6px 14px; padding:7px 12px; background:#10251f; border:1px solid #446b58; border-radius:12px; }
.community-count { display:inline-flex; align-items:center; gap:.35em; color:#d9eee2; font-size:.86rem; }
.community-count i { width:.55em; height:.55em; margin-right:.2em; border-radius:50%; background:#79e69c; }
.community-banner .btn { min-height:32px; color:#101d16; background:#a3edbd; }
.hunt-chat-button { pointer-events:auto; }

#chat-dock { position:fixed; z-index:180; right:max(8px,env(safe-area-inset-right)); top:clamp(66px,14dvh,126px); display:grid; justify-items:end; gap:4px; max-width:min(255px,65vw); pointer-events:none; }
#chat-dock[hidden] { display:none; }
#chat-notice { pointer-events:auto; }
#chat-notice { display:block; max-width:min(255px,65vw); padding:5px 8px; border:1px solid #486957; border-radius:7px; background:#12231eee; color:#e6f5e8; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; font:inherit; font-size:.76rem; cursor:pointer; }
#chat-notice[hidden] { display:none; }
#hunt-chat { position:fixed; z-index:181; inset:clamp(96px,19dvh,160px) max(8px,env(safe-area-inset-right)) auto auto; margin:0; max-height:min(66dvh,32rem); box-sizing:border-box; overflow:auto; }

#iv-transfer { margin-block:8px; display:grid; gap:6px; border:1px solid #456a57; padding:10px; border-radius:10px; }
#iv-transfer h3, #iv-transfer-help { margin:0; }
#iv-transfer-owner[hidden] { display:none; }
#iv-transfer .field { width:100%; }

.hunt-test-speed[hidden], #hunt-loadout .hunt-passives[hidden] { display:none; }


#chat-dock.chat-in-hunt { top:max(110px, calc(env(safe-area-inset-top) + 105px)); }
#chat-dock.chat-in-hunt #chat-notice { background:#0a221bc7; border-color:#8cc9ac5c; border-radius:9px; }
@media (max-width:599px) { #chat-dock.chat-in-hunt { top:max(145px, calc(env(safe-area-inset-top) + 135px)); } }

#chat-dock:not(.chat-in-hunt) { display:none; }
body:has(#scr-menu:not(.hidden), #scr-lobby:not(.hidden)):not(:has(#scr-settings:not(.hidden))) #chat-dock:not([hidden]) { display:grid; }
body:has(#scr-settings:not(.hidden), #scr-pause:not(.hidden)) #chat-dock { display:none; }

@media (max-height:430px) {
  body:has(#scr-settings:not(.hidden), #scr-starters:not(.hidden)) .ach-pop { visibility:hidden; }
  body:has(#scr-settings:not(.hidden), #scr-starters:not(.hidden)) .toast { max-width:min(320px, 80vw); top:auto; bottom:8px; z-index:19; }
}

/* Rounded controls and an open, divided layout for partner upgrades. */
.btn, .tab, .field { border-radius: 999px; }
.btn:not(.ghost), .btn:active { box-shadow: 0 3px 10px #0004; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .tab:focus-visible, .upgrade-loadout summary:focus-visible {
  outline: 2px solid var(--edge); outline-offset: 3px;
}
.scr > .box { border-radius: 26px; }
#scr-upgrades .upg { display: block; }
#scr-upgrades .upg-item {
  background: transparent; border: 0; border-bottom: 1px solid #a8edc525;
  border-radius: 0; box-shadow: none; padding: 12px 4px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
}
#scr-upgrades .upg-btns { max-width: 11rem; }
.upgrade-loadout { margin-block: 14px 8px; }
.upgrade-loadout details { border-block-end: 1px solid #a8edc525; padding: 7px 0; }
.upgrade-loadout summary { cursor: pointer; width: fit-content; max-width: 100%; padding: 8px 14px; border-radius: 999px; background: #a8edc513; font-weight: 700; }
.upgrade-loadout .sub { margin: 10px 0; }
.upgrade-loadout ol { padding-inline-start: 25px; }
.upgrade-loadout li { padding: 5px 0; }
.upgrade-loadout li .row { margin-block-start: 4px; flex-wrap: wrap; }
.upgrade-controls, #upg-item-ranks { display: flex; flex-wrap: wrap; gap: 8px; }
.upgrade-controls select { flex: 1 1 12rem; }
#upg-item-ranks label { display: flex; align-items: center; gap: 6px; flex: 1 1 11rem; }
#upg-item-ranks select { min-width: 0; }

/* Main-screen seven-slot prism and flanking navigation. */
#scr-menu {
  padding: clamp(56px, 9vh, 90px) 18px 20px;
  background: radial-gradient(ellipse at 50% 55%, #245044 0, #112c2b 36%, #07151d 78%);
}
.hunt-home-radial {
  --die-size: clamp(128px, 19vw, 220px);
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(220px, 1fr) minmax(150px, 210px);
  grid-template-areas: 'left center right' 'footer footer footer';
  align-items: center; gap: 8px clamp(12px, 3vw, 42px);
  width: min(1060px, 100%); margin: auto; position: relative;
}
.hunt-home-radial::before {
  content: ''; position: absolute; inset: 4% 18%; pointer-events: none; border-radius: 50%;
  background: repeating-radial-gradient(circle at center, transparent 0 38px, #b5d7a318 39px 40px, transparent 41px 66px);
}
.hunt-home-flank { position: relative; display: grid; gap: clamp(10px, 2.5vh, 20px); z-index: 2; }
.hunt-home-left { grid-area: left; }
.hunt-home-right { grid-area: right; }
.hunt-home-radial .hunt-home-partner {
  grid-area: center; min-width: 0; border: 0; border-radius: 0; background: transparent;
  padding: 0; gap: 5px; overflow: visible;
}
.hunt-die-halo {
  position: absolute; width: min(100%, 380px); aspect-ratio: 1; top: 0; left: 50%; transform: translateX(-50%);
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #d7f5a833 0, #73c99a16 38%, transparent 68%);
  filter: blur(2px);
}
.hunt-die-control {
  position: relative; display: grid; place-items: center; width: min(100%, calc(var(--die-size) * 1.55));
  height: calc(var(--die-size) * 1.35); margin: 0; padding: 0; border: 0; background: transparent;
  perspective: 1050px; cursor: grab; touch-action: none; color: #fff6c9;
  -webkit-tap-highlight-color: transparent;
}
.hunt-die-control:active { cursor: grabbing; }
.hunt-die-control:focus-visible { outline: 2px solid #f7df8a; outline-offset: 4px; border-radius: 24px; }
.hunt-die-tilt { display: block; width: var(--die-size); height: var(--die-size); transform-style: preserve-3d; transform: rotateX(-7deg) rotateZ(-4deg); }
.hunt-die-rotor { display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 850ms cubic-bezier(.42,0,.2,1); }
.hunt-die-face {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden;
  transform: rotateY(calc(var(--face) * 51.428571deg)) translateZ(calc(var(--die-size) * 1.038));
  backface-visibility: hidden; border: 3px solid #fff3bc; border-radius: 14px;
  background: linear-gradient(145deg, #fbf5cae8, #c3dcafda 55%, #809d83e8);
  box-shadow: inset 0 0 25px #ffffffa6, 0 0 16px #fff1a99c, 0 0 34px #dfdf9c64;
}
.hunt-die-face canvas { width: 90%; height: 90%; image-rendering: pixelated; }
.hunt-die-face-label { position: absolute; top: 8px; left: 10px; color: #344d3b; font-size: .7rem; font-weight: 900; }
.hunt-die-empty { font-size: clamp(2rem, 6vw, 4rem); color: #496d56a8; font-weight: 300; }
.hunt-die-hint { color: #b2cab6; font-size: .7rem; }
.hunt-home-radial .hunt-partner-info { position: relative; min-height: 88px; text-align: center; }
.hunt-home-radial #menu-partner-name { color: #fff; text-shadow: 0 2px 10px #000b; }
.hunt-home-radial .hunt-partner-actions { margin-top: 4px; }
.hunt-home-radial #menu-partner-iv { border: 0; background: transparent; color: #f4db95; padding: 2px 6px; }
#scr-menu .hunt-home-flank .menu-item {
  min-height: 48px; border: 1px solid #edd38d; border-radius: 999px; color: #f8f7e9;
  background: linear-gradient(100deg, #142b2de8, #0c2427ef); box-shadow: 0 0 0 2px #c1a45345, 0 0 14px #e5ca7c4d;
  font-size: clamp(.74rem, 1.3vw, .97rem); text-align: center;
}
#scr-menu .hunt-home-left .menu-item { grid-template-columns: minmax(0,1fr) 30px; }
#scr-menu .hunt-home-left .menu-item .mi-ico { grid-column: 2; grid-row: 1 / span 2; }
#scr-menu .hunt-home-left .menu-item small { grid-column: 1; }
#scr-menu .hunt-home-right .menu-item { grid-template-columns: 30px minmax(0,1fr); }
#scr-menu .hunt-home-flank .menu-item .mi-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #183e40; border: 1px solid #e6cf82a6; }
#scr-menu .hunt-home-flank .menu-item:hover, #scr-menu .hunt-home-flank .menu-item:focus-visible { border-color: #fff6c6; background: #284d42; }
#scr-menu .hunt-home-radial .menu-item.play { width: min(230px, 90%); min-height: 45px; border-radius: 999px; display: flex; justify-content: center; gap: 8px; }
#scr-menu .hunt-home-radial .menu-item.play small { display: none; }
.hunt-home-footer { grid-area: footer; display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
.hunt-home-footer .community-banner { padding: 3px 8px; }
@media (max-width: 700px) {
  #scr-menu { padding: 62px 8px 10px; }
  .hunt-home-radial { --die-size: clamp(94px, 19vw, 150px); grid-template-columns: minmax(92px, 1fr) minmax(120px, 1.35fr) minmax(92px, 1fr); gap: 5px; }
  #scr-menu .hunt-home-flank .menu-item { min-height: 39px; padding: 4px 5px; font-size: clamp(.62rem, 1.9vw, .78rem); gap: 3px; }
  #scr-menu .hunt-home-flank .menu-item small { display: none; }
  #scr-menu .hunt-home-left .menu-item { grid-template-columns: minmax(0,1fr) 24px; }
  #scr-menu .hunt-home-right .menu-item { grid-template-columns: 24px minmax(0,1fr); }
  #scr-menu .hunt-home-flank .menu-item .mi-ico { width: 24px; height: 24px; }
  #scr-menu .hunt-home-flank .menu-item .mi-ico img { width: 17px; height: 17px; }
  .hunt-home-radial .hunt-partner-info { min-height: 65px; }
  .hunt-die-hint { font-size: .58rem; }
  .hunt-home-footer { font-size: .65rem; }
}
@media (max-height: 520px) and (min-width: 550px) {
  #scr-menu { padding-top: 44px; padding-bottom: 4px; }
  .hunt-home-radial { --die-size: clamp(92px, 27vh, 145px); }
  .hunt-home-flank { gap: 6px; }
  #scr-menu .hunt-home-flank .menu-item { min-height: 35px; }
  .hunt-die-hint { display: none; }
  .hunt-home-radial .hunt-partner-info { min-height: 55px; }
  .hunt-home-footer { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) { .hunt-die-rotor { transition: none; } }
/* Keep the center face clear of navigation and fit the HUD on narrow screens. */
.hunt-home-radial { --die-size: clamp(112px, 15vw, 170px); }
.hunt-die-control { height: calc(var(--die-size) * 1.6); }
@media (max-width: 700px) {
  .hunt-home-radial { --die-size: clamp(76px, 18vw, 128px); }
}
@media (max-width: 500px) and (orientation: portrait) {
  #scr-menu { padding-top: 102px; }
  body:has(#scr-menu:not(.hidden)) .topbar {
    left: 5px; right: 5px; top: 5px; justify-content: center; flex-wrap: wrap; gap: 4px;
  }
  body:has(#scr-menu:not(.hidden)) .topbar .pill { font-size: 10px; padding: 3px 6px; gap: 3px; }
  body:has(#scr-menu:not(.hidden)) .topbar .btn.small { padding: 3px 6px; min-height: 26px; }
  body:has(#scr-menu:not(.hidden)) .topbar .coin { width: 13px; height: 13px; }
}
@media (max-height: 520px) and (min-width: 550px) {
  .hunt-home-radial { --die-size: clamp(76px, 23vh, 120px); }
}
.hunt-die-cap {
  position: absolute; left: 50%; top: 50%; width: 207.6%; aspect-ratio: 1;
  clip-path: polygon(50% 0, 89% 19%, 99% 61%, 72% 96%, 28% 96%, 1% 61%, 11% 19%);
  background: radial-gradient(circle at 50% 50%, #fff9cf, #cbdfad 65%, #d9d8a2);
  box-shadow: inset 0 0 30px #fffbd6;
  backface-visibility: hidden; pointer-events: none;
}
.hunt-die-cap.top { transform: translate(-50%, -50%) rotateX(90deg) translateZ(calc(var(--die-size) / 2)); }
.hunt-die-cap.bottom { transform: translate(-50%, -50%) rotateX(-90deg) translateZ(calc(var(--die-size) / 2)); }
.hunt-primary-actions { display: flex; justify-content: center; gap: 8px; width: min(350px, 100%); }
#scr-menu .hunt-home-radial .hunt-primary-actions .menu-item { width: 50%; min-width: 0; min-height: 45px; border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 6px; }
#scr-menu .hunt-home-radial .hunt-primary-actions .event-button:disabled {
  color: #a7b3a9; border-color: #6c7971; background: #293733; opacity: .7; cursor: not-allowed;
}
.online-players { gap: 5px; }
.online-players i { display: block; width: 8px; height: 8px; border-radius: 50%; background: #79e69c; box-shadow: 0 0 8px #79e69c99; }
.hunt-home-footer > [data-open-chat] { min-height: 32px; color: #101d16; background: #a3edbd; }
@media (max-width: 700px) {
  .hunt-primary-actions { gap: 4px; }
  #scr-menu .hunt-home-radial .hunt-primary-actions .menu-item { min-height: 37px; padding: 4px 6px; font-size: .8rem; }
}
