/* ==========================================================================
   DefenseTower · interfaz
   Campo azul pizarra, torre marfil y un solo acento ámbar. Los colores fuertes
   se reservan para lo que significa algo: monedas, prestigio, vida y enemigos.
   ========================================================================== */

:root {
    --bg: #0a0d12;
    --bg-1: #10141b;
    --bg-2: #161b24;
    --bg-3: #1e2430;
    --bg-4: #283040;

    --line: rgba(196, 210, 235, 0.08);
    --line-2: rgba(196, 210, 235, 0.14);
    --line-3: rgba(196, 210, 235, 0.24);

    --ink: #eef1f6;
    --ink-2: #aab3c3;
    --ink-3: #737d90;
    --ink-4: #4d5566;

    --ivory: #f1ece2;
    --amber: #f0b44c;
    --amber-hi: #ffd58a;
    --money: #f0b44c;
    --pp: #a996ff;
    --hp: #ff6a5c;
    --ok: #6fd39a;

    --font-display: "Saira Condensed", "Arial Narrow", system-ui, sans-serif;
    --font-body: "Saira", system-ui, -apple-system, "Segoe UI", sans-serif;

    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

    --hi: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --shadow: 0 24px 60px -20px rgba(2, 4, 8, 0.9), 0 2px 0 rgba(0, 0, 0, 0.4);

    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    overflow: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior: none;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }
h1, h2, h3 { font-weight: 400; }

.ico { width: 1em; height: 1em; fill: currentColor; flex-shrink: 0; display: block; }
.hidden { display: none !important; }

#gameCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.field-vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(130% 100% at 50% 50%, transparent 55%, rgba(3, 5, 9, 0.7) 100%);
}

.kicker {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.kicker--danger { color: var(--hp); }
.kicker--pp { color: var(--pp); }

/* ==========================================================================
   Botones
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 20px;
    border-radius: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--ink);
    background: var(--bg-3);
    box-shadow: var(--hi), inset 0 0 0 1px var(--line-2);
    transition: transform 140ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}
.btn .ico { font-size: 18px; }
.btn:active { transform: scale(0.97); }
.btn--primary {
    color: #14110b;
    background: linear-gradient(180deg, #fbf7ee, #e2dccf);
    box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(120, 105, 80, 0.25), 0 10px 30px -12px rgba(241, 236, 226, 0.45);
}
.btn--ghost { background: rgba(16, 20, 27, 0.6); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn--danger-ghost { color: var(--hp); box-shadow: inset 0 0 0 1px rgba(255, 106, 92, 0.3); background: transparent; }
.btn--xl { min-height: 56px; padding: 0 28px; font-size: 19px; border-radius: 12px; }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 6px; background: rgba(169, 150, 255, 0.12); color: var(--pp); font-size: 15px; letter-spacing: 0.02em; }
.btn-badge .ico { font-size: 14px; }
@media (hover: hover) and (pointer: fine) {
    .btn:hover { background-color: var(--bg-4); color: var(--ink); }
    .btn--primary:hover { background: linear-gradient(180deg, #ffffff, #ebe5d8); color: #14110b; }
    .btn--danger-ghost:hover { background: rgba(255, 106, 92, 0.08); color: var(--hp); }
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--ink-2);
    font-size: 18px;
    background: rgba(16, 20, 27, 0.72);
    box-shadow: var(--hi), inset 0 0 0 1px var(--line);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 140ms var(--ease-out), color 160ms ease;
}
.icon-btn:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { color: var(--ink); } }

/* Botón de velocidad x2 */
.speed-btn {
    width: auto;
    padding: 0 11px 0 9px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--ink-3);
    transition: transform 140ms var(--ease-out), color 160ms ease, box-shadow 200ms ease, background-color 200ms ease;
}
.speed-btn b {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.speed-chev { position: relative; display: inline-flex; width: 13px; height: 12px; }
.speed-chev i {
    position: absolute; top: 2px; width: 7px; height: 7px;
    border-top: 2px solid currentColor; border-right: 2px solid currentColor;
    border-radius: 1px;
    transform: rotate(45deg);
    opacity: 0.55;
}
.speed-chev i:first-child { left: -1px; }
.speed-chev i:last-child { left: 5px; }
.speed-btn.is-on {
    color: var(--amber-hi);
    background: rgba(240, 180, 76, 0.13);
    box-shadow: var(--hi), inset 0 0 0 1px rgba(240, 180, 76, 0.45), 0 0 18px -6px rgba(240, 180, 76, 0.55);
}
.speed-btn.is-on .speed-chev i { opacity: 1; animation: chevRun 0.9s linear infinite; }
.speed-btn.is-on .speed-chev i:last-child { animation-delay: -0.45s; }
.speed-btn.is-bump { animation: bump 260ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .speed-btn:not(.is-on):hover { color: var(--ink-2); } }
@keyframes chevRun {
    0% { translate: -3px 0; opacity: 0; }
    35% { opacity: 1; }
    70% { opacity: 1; }
    100% { translate: 4px 0; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .speed-btn.is-on .speed-chev i { animation: none; } }

/* ==========================================================================
   HUD
   ========================================================================== */
.hud {
    position: fixed;
    top: calc(16px + var(--safe-t));
    left: 16px;
    right: 16px;
    z-index: 5;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    pointer-events: none;
}
.hud > * { pointer-events: auto; }
/* En la tienda la hoja ocupa toda la pantalla: el HUD va por encima para que salir y estadísticas se puedan pulsar */
body:has(#shop-screen:not(.hidden)) .hud { z-index: 11; }

.hud-wave {
    display: grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    column-gap: 10px;
    row-gap: 6px;
    padding: 10px 16px 12px;
    border-radius: 14px;
    background: rgba(12, 15, 21, 0.72);
    box-shadow: var(--hi), inset 0 0 0 1px var(--line);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.hud-label { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.hud-wave-num { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 0.9; font-variant-numeric: tabular-nums; color: var(--ivory); }
.hud-wave-bar { grid-column: 1 / -1; width: 128px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.hud-wave-bar i { display: block; height: 100%; width: 0%; background: var(--ivory); border-radius: inherit; transition: width 240ms var(--ease-out); }
.hud-wave.is-boss .hud-wave-bar i { background: var(--amber); }

.hud-stats { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px 0 12px;
    border-radius: 10px;
    background: rgba(12, 15, 21, 0.72);
    box-shadow: var(--hi), inset 0 0 0 1px var(--line);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
}
.chip .ico { font-size: 17px; color: var(--c); }
.chip b { font-family: var(--font-display); font-weight: 700; font-size: 21px; font-variant-numeric: tabular-nums; color: var(--ink); min-width: 1.6ch; }
.chip--money { --c: var(--money); }
.chip--pp { --c: var(--pp); }
.chip--hp { --c: var(--hp); }
.chip-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255, 106, 92, 0.12); }
.chip-bar i { display: block; height: 100%; width: 100%; background: var(--hp); transition: width 200ms var(--ease-out); }
.chip.is-bump { animation: bump 260ms var(--ease-out); }
.chip.is-hit { animation: coinHit 220ms var(--ease-out); }
.chip.is-hit .ico { animation: coinSpin 420ms var(--ease-out); }
.chip--hp.is-low .ico { animation: heartbeat 1.1s ease-in-out infinite; }
.chip--hp.is-low { box-shadow: var(--hi), inset 0 0 0 1px rgba(255, 106, 92, 0.45); }
/* Entrada del HUD al empezar */
.hud > * { animation: hudIn 520ms var(--ease-out) both; }
.hud > :nth-child(2) { animation-delay: 80ms; }
.chip--hp.is-hurt { animation: hurt 360ms ease-out; }

/* Aviso de ronda */
.wave-banner {
    position: fixed;
    top: 22%;
    left: 50%;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    transform: translate(-50%, 8px);
    opacity: 0;
}
.wave-banner-kicker { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--ink-2); padding-left: 0.4em; }
.wave-banner-num { font-family: var(--font-display); font-weight: 800; font-size: 88px; line-height: 0.95; color: var(--ivory); font-variant-numeric: tabular-nums; text-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); }
.wave-banner.is-boss .wave-banner-kicker { color: var(--amber); }
.wave-banner.is-boss .wave-banner-num { color: var(--amber-hi); }
.wave-banner.show { animation: banner 1600ms var(--ease-out) forwards; }

/* ==========================================================================
   Pantallas
   ========================================================================== */
.screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(24px + var(--safe-t)) 24px calc(24px + var(--safe-b));
    animation: fadeIn 220ms ease-out;
}
.screen--overlay { background: rgba(6, 8, 12, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.screen--page { align-items: stretch; background: rgba(8, 10, 15, 0.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); overflow-y: auto; }
.screen--sheet { align-items: flex-end; padding-bottom: calc(20px + var(--safe-b)); background: linear-gradient(180deg, rgba(6, 8, 12, 0.1) 30%, rgba(6, 8, 12, 0.78)); }

/* Menú principal */
.screen--menu {
    justify-content: flex-start;
    padding-left: clamp(24px, 9vw, 140px);
    background: linear-gradient(90deg, rgba(8, 10, 15, 0.92) 0%, rgba(8, 10, 15, 0.55) 45%, rgba(8, 10, 15, 0) 75%);
}
.menu { max-width: 520px; }
.menu-mark { width: 52px; height: 52px; color: var(--ivory); margin-bottom: 28px; }
.menu-mark svg { width: 100%; height: 100%; }
.title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(64px, 11vw, 132px);
    line-height: 0.82;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--ivory);
}
.title span { display: block; color: transparent; -webkit-text-stroke: 1.5px rgba(241, 236, 226, 0.7); }
.tagline { margin-top: 22px; font-size: 17px; color: var(--ink-2); letter-spacing: 0.02em; }
.menu-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 40px; }
.menu-records { display: flex; gap: 36px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); max-width: 420px; }
.menu-records dt { font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.menu-records dd { font-family: var(--font-display); font-weight: 700; font-size: 30px; font-variant-numeric: tabular-nums; }
.menu > * { animation: rise 600ms var(--ease-out) both; }
.menu-mark { animation: none !important; }
.menu-mark path { stroke-dasharray: 220; stroke-dashoffset: 220; animation: draw 1100ms var(--ease-out) 100ms forwards; }
.menu-mark path + path { animation-delay: 360ms; }
.menu-mark circle { transform-origin: 32px 32px; animation: corePop 520ms cubic-bezier(0.34, 1.56, 0.64, 1) 700ms both; }
.menu > .title { animation: titleIn 900ms var(--ease-out) 120ms both; }
.title span { animation: titleIn 900ms var(--ease-out) 260ms both; }
.menu-records dd { animation: rise 600ms var(--ease-out) 380ms both; }
.screen--menu.is-leaving .menu { animation: menuOut 240ms cubic-bezier(0.4, 0, 1, 1) forwards; }
.screen--menu.is-leaving { animation: fadeOut 240ms ease-in forwards; }
@media (hover: hover) and (pointer: fine) {
    .btn--primary .ico { transition: transform 240ms var(--ease-out); }
    .btn--primary:hover .ico { transform: translateX(3px); }
}
.menu > :nth-child(2) { animation-delay: 60ms; }
.menu > :nth-child(3) { animation-delay: 120ms; }
.menu > :nth-child(4) { animation-delay: 180ms; }
.menu > :nth-child(5) { animation-delay: 240ms; }

/* Página de mejoras permanentes */
.page { width: min(1080px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; }
.page-title h2 { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1; text-transform: uppercase; letter-spacing: 0.01em; }
.balance { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 12px; background: var(--bg-2); box-shadow: var(--hi), inset 0 0 0 1px var(--line-2); color: var(--pp); }
.balance .ico { font-size: 18px; }
.balance b { font-family: var(--font-display); font-weight: 800; font-size: 26px; color: var(--ink); font-variant-numeric: tabular-nums; }
.balance span { font-size: 13px; color: var(--ink-3); }
.balance--money { color: var(--money); }
.page-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 14px; }

.perk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.perk {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 12px 12px 12px;
    border-radius: 14px;
    text-align: left;
    background: var(--bg-1);
    box-shadow: var(--hi), inset 0 0 0 1px var(--line);
    transition: transform 140ms var(--ease-out), box-shadow 160ms ease, background-color 160ms ease;
}
.perk:active { transform: scale(0.98); }
#prestige-cards-container:not(.no-anim) .perk { animation: rise 420ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 22ms + 80ms); }
.perk.just-bought { animation: perkBought 640ms var(--ease-out); }
.perk.just-bought .tile { animation: tilePop 520ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.perk.is-denied { animation: shake 340ms ease-in-out; }
.balance.is-spend { animation: spend 420ms var(--ease-out); }
.perk.is-locked { cursor: default; }
.perk.is-locked:active { transform: none; }
.perk.is-locked .tile { color: var(--ink-4); }
.perk.is-locked .perk-cost { color: var(--ink-4); }
.perk.is-max .perk-cost { color: var(--ok); }
@media (hover: hover) and (pointer: fine) {
    .perk:not(.is-locked):not(.is-max):hover { background: var(--bg-2); box-shadow: var(--hi), inset 0 0 0 1px rgba(169, 150, 255, 0.4); }
}
.perk-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.perk-name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.perk-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.3; }
.perk-lvl { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.06em; color: var(--ink-3); text-transform: uppercase; }
.perk-cost { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--pp); font-variant-numeric: tabular-nums; }
.perk-cost .ico { font-size: 14px; }

.tile {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 22px;
    color: var(--tc, var(--ivory));
    background: radial-gradient(120% 120% at 30% 15%, color-mix(in srgb, var(--tc, var(--ivory)) 18%, transparent), transparent 60%), var(--bg);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc, var(--ivory)) 22%, transparent);
    flex-shrink: 0;
}

/* Fin de partida y botín */
.result { display: flex; flex-direction: column; align-items: center; text-align: center; width: min(760px, 100%); }
.result > * { animation: rise 520ms var(--ease-out) both; }
.result > .kicker { animation-delay: 60ms; }
.result > .result-title { animation: slam 700ms var(--ease-out) 120ms both; }
.result > .result-best { animation-delay: 380ms; }
.result > .result-reward { animation: rewardIn 520ms cubic-bezier(0.34, 1.56, 0.64, 1) 640ms both; }
.result > .btn { animation-delay: 860ms; }
#game-over-screen { animation: fadeIn 500ms ease-out both; }
#game-over-screen .kicker--danger { letter-spacing: 0.16em; animation: kickerIn 900ms var(--ease-out) 60ms both; }
.result-title { margin-top: 10px; font-family: var(--font-display); font-weight: 800; font-size: clamp(64px, 12vw, 120px); line-height: 0.9; text-transform: uppercase; color: var(--ivory); font-variant-numeric: tabular-nums; }
.result-title--sm { font-size: clamp(44px, 8vw, 72px); }
.result-best { margin-top: 12px; min-height: 1.4em; color: var(--ink-2); font-size: 15px; }
.result-reward { display: inline-flex; align-items: center; gap: 10px; margin: 28px 0 32px; padding: 12px 18px; border-radius: 12px; background: rgba(169, 150, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(169, 150, 255, 0.25); color: var(--ink); }
.result-reward .ico { color: var(--pp); font-size: 18px; }
.result-reward b { font-family: var(--font-display); font-size: 22px; color: var(--pp); }

/* Tienda (hoja inferior) */
.sheet {
    width: min(920px, 100%);
    padding: 22px;
    border-radius: 20px;
    background: rgba(14, 17, 24, 0.94);
    box-shadow: var(--hi), inset 0 0 0 1px var(--line-2), var(--shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: sheetIn 380ms var(--ease-drawer) both;
}
.sheet-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.sheet-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 34px; line-height: 1; text-transform: uppercase; }
.sheet-meta { display: flex; align-items: center; gap: 12px; }
.sheet-picks { font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; flex-wrap: wrap; }
.sheet-note { font-size: 13px; color: var(--ink-3); }

.offer-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
.offer-row--gift { grid-template-columns: repeat(2, minmax(0, 220px)); justify-content: center; margin: 26px 0 30px; }

.offer {
    --tc: var(--ivory);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    min-height: 210px;
    padding: 16px;
    border-radius: 16px;
    text-align: left;
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
    box-shadow: var(--hi), inset 0 0 0 1px var(--line);
    overflow: hidden;
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 420ms var(--ease-out), translate 220ms var(--ease-out), scale 140ms var(--ease-out), box-shadow 220ms ease;
}
.offer.is-tilt { transition: transform 90ms linear, translate 220ms var(--ease-out), scale 140ms var(--ease-out), box-shadow 220ms ease; }
.offer:active { scale: 0.97; }
/* Reflejo que sigue al cursor */
.offer::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(260px circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, 0.09), transparent 60%);
    opacity: 0;
    transition: opacity 220ms ease;
}
.offer.is-tilt::after { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
    .offer:not(.is-sold):not(.is-gift):hover { translate: 0 -4px; box-shadow: var(--hi), inset 0 0 0 1px var(--line-3), 0 26px 50px -24px rgba(0, 0, 0, 0.95); }
    .offer:not(.is-sold):not(.is-gift):hover .tile { scale: 1.08; rotate: -4deg; }
}
.offer .tile { transition: scale 260ms var(--ease-out), rotate 260ms var(--ease-out); }

/* Reparto de cartas al abrir la tienda */
.offer-row.is-dealing .offer { animation: deal 560ms var(--ease-out) both; }
.offer-row.is-dealing .offer:nth-child(1) { --deal-r: -5deg; }
.offer-row.is-dealing .offer:nth-child(2) { --deal-r: 0deg; animation-delay: 70ms; }
.offer-row.is-dealing .offer:nth-child(3) { --deal-r: 5deg; animation-delay: 140ms; }
.offer-row.is-dealing .offer .tile { animation: tilePop 520ms var(--ease-out) both; animation-delay: inherit; }

/* Carta con suerte: un brillo cruza la carta de vez en cuando */
.offer.is-lucky::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(105deg, transparent 35%, rgba(111, 211, 154, 0.16) 50%, transparent 65%);
    transform: translateX(-100%);
    animation: sheen 3.2s var(--ease-out) 600ms infinite;
}
.offer-ribbon { animation: ribbon 520ms cubic-bezier(0.34, 1.56, 0.64, 1) 320ms both; }

/* Recién comprada */
.offer.just-sold { animation: soldPop 420ms var(--ease-out); }
.offer.just-sold .offer-sold .ico { animation: checkIn 460ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.offer.just-sold .offer-sold { animation: fadeIn 200ms ease-out both; }
.offer-name { font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.02em; }
.offer-desc { font-size: 13.5px; color: var(--ink-2); line-height: 1.4; }
.offer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.offer-lvl { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.offer-price { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--money); font-variant-numeric: tabular-nums; }
.offer-price .ico { font-size: 16px; }
.offer-price.is-free { color: var(--ok); font-size: 18px; letter-spacing: 0.08em; }
.offer.is-poor .offer-price { color: var(--ink-4); }
.offer.is-poor { cursor: not-allowed; }
.offer.is-lucky { box-shadow: var(--hi), inset 0 0 0 1px rgba(111, 211, 154, 0.5), 0 0 40px -16px rgba(111, 211, 154, 0.6); }
.offer-ribbon { position: absolute; top: 14px; right: 14px; padding: 3px 8px; border-radius: 6px; font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #0c1a12; background: var(--ok); }
.offer-ribbon--pp { background: var(--pp); color: #120e24; }
.offer.is-sold { cursor: default; background: var(--bg-1); }
.offer.is-sold > :not(.offer-sold) { opacity: 0.2; }
.offer-sold { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 6px; font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ok); }
.offer-sold .ico { font-size: 28px; }
.offer.is-gift .offer-price { color: var(--pp); }
.offer-row--gift { perspective: 1000px; }
.offer-row--gift .offer { animation: flipIn 720ms var(--ease-out) both; animation-delay: 380ms; backface-visibility: hidden; }
.offer-row--gift .offer:nth-child(2) { animation-delay: 540ms; }
.offer-row--gift .offer .offer-ribbon { animation-delay: 900ms; }
.offer.is-gift { --tc: var(--pp); min-height: 180px; box-shadow: var(--hi), inset 0 0 0 1px rgba(169, 150, 255, 0.35); cursor: default; }

/* Panel lateral de estadísticas */
.drawer { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: flex-end; background: rgba(6, 8, 12, 0.5); animation: fadeIn 200ms ease-out; }
.drawer-panel {
    width: min(400px, 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b));
    background: var(--bg-1);
    box-shadow: inset 1px 0 0 var(--line-2), var(--shadow);
    animation: drawerIn 320ms var(--ease-drawer) both;
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 32px; line-height: 1; text-transform: uppercase; }
.drawer-legend { display: flex; gap: 16px; margin: 16px 0 8px; font-size: 12.5px; color: var(--ink-3); }
.drawer-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 2px; }
.dot--p { background: var(--pp); }
.dot--r { background: var(--amber); }
.stats-list { flex: 1; overflow-y: auto; margin: 0 -8px; padding: 0 8px; scrollbar-width: thin; scrollbar-color: var(--bg-4) transparent; }
.stat-item { animation: slideIn 380ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 18ms + 120ms); }
.stat-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stat-item .tile { width: 34px; height: 34px; border-radius: 9px; font-size: 17px; }
.stat-name { font-size: 14px; font-weight: 500; }
.stat-lvls { display: flex; gap: 10px; margin-top: 1px; font-family: var(--font-display); font-size: 12.5px; letter-spacing: 0.04em; color: var(--ink-3); }
.stat-lvls .p { color: var(--pp); }
.stat-lvls .r { color: var(--amber); }
.stat-val { font-family: var(--font-display); font-weight: 700; font-size: 19px; font-variant-numeric: tabular-nums; color: var(--ink); }

/* ==========================================================================
   Animaciones
   ========================================================================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes hurt { 0%, 100% { transform: none; box-shadow: var(--hi), inset 0 0 0 1px var(--line); } 30% { transform: translateX(-3px); box-shadow: var(--hi), inset 0 0 0 1px rgba(255, 106, 92, 0.7); } 60% { transform: translateX(2px); } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes deal { from { opacity: 0; transform: perspective(900px) translateY(70px) rotate(var(--deal-r, 0deg)) scale(0.94); } to { opacity: 1; transform: perspective(900px); } }
@keyframes tilePop { 0% { scale: 0.6; rotate: -12deg; opacity: 0; } 60% { scale: 1.1; rotate: 3deg; opacity: 1; } 100% { scale: 1; rotate: 0deg; } }
@keyframes sheen { 0% { transform: translateX(-100%); } 45%, 100% { transform: translateX(100%); } }
@keyframes ribbon { from { opacity: 0; transform: translateY(-6px) scale(0.7); } to { opacity: 1; transform: none; } }
@keyframes soldPop { 0% { scale: 1; } 35% { scale: 1.035; } 100% { scale: 1; } }
@keyframes checkIn { from { opacity: 0; transform: scale(0.4) rotate(-30deg); } to { opacity: 1; transform: none; } }
@keyframes flipIn { from { opacity: 0; transform: rotateY(-100deg) translateY(20px) scale(0.92); } 60% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes perkBought { 0% { box-shadow: var(--hi), inset 0 0 0 1px rgba(169, 150, 255, 0.9), 0 0 0 0 rgba(169, 150, 255, 0.5); } 100% { box-shadow: var(--hi), inset 0 0 0 1px var(--line), 0 0 0 14px rgba(169, 150, 255, 0); } }
@keyframes shake { 0%, 100% { translate: 0; } 20% { translate: -6px; } 45% { translate: 5px; } 70% { translate: -3px; } 88% { translate: 1px; } }
@keyframes spend { 0% { scale: 1; } 30% { scale: 0.94; } 100% { scale: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes coinHit { 0% { scale: 1; } 40% { scale: 1.07; } 100% { scale: 1; } }
@keyframes coinSpin { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } 45% { transform: scale(1.15); } }
@keyframes hudIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes corePop { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: none; } }
@keyframes titleIn { from { opacity: 0; clip-path: inset(0 0 100% 0); transform: translateY(40%); } to { opacity: 1; clip-path: inset(0 0 -10% 0); transform: none; } }
@keyframes menuOut { to { opacity: 0; transform: translateX(-28px); } }
@keyframes slam { 0% { opacity: 0; transform: scale(1.25); filter: blur(8px); } 60% { opacity: 1; filter: blur(0); } 100% { opacity: 1; transform: none; filter: none; } }
@keyframes rewardIn { from { opacity: 0; transform: translateY(10px) scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes kickerIn { from { opacity: 0; letter-spacing: 0.6em; } to { opacity: 1; letter-spacing: 0.16em; } }
@keyframes banner {
    0% { opacity: 0; transform: translate(-50%, 14px) scale(0.98); }
    18% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    72% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -10px) scale(1); }
}

/* ==========================================================================
   Móvil
   ========================================================================== */
@media (max-width: 760px) {
    .hud { top: calc(10px + var(--safe-t)); left: 10px; right: 10px; gap: 8px; }
    .hud-wave { padding: 8px 12px 10px; }
    .hud-wave-num { font-size: 24px; }
    .hud-wave-bar { width: 84px; }
    .hud-stats { gap: 4px; }
    .chip { height: 34px; padding: 0 10px 0 9px; gap: 6px; }
    .chip b { font-size: 18px; }
    .chip .ico { font-size: 15px; }
    .icon-btn { width: 34px; height: 34px; }
    .speed-btn { width: auto; padding: 0 9px 0 7px; }
    .speed-btn b { font-size: 15px; }

    .screen { padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); }
    .screen--menu { align-items: flex-end; padding-left: 20px; padding-bottom: calc(40px + var(--safe-b)); background: linear-gradient(0deg, rgba(8, 10, 15, 0.95) 0%, rgba(8, 10, 15, 0.7) 50%, rgba(8, 10, 15, 0.1) 100%); }
    .menu-mark { margin-bottom: 18px; width: 44px; height: 44px; }
    .menu-actions { flex-direction: column; align-items: stretch; margin-top: 28px; }
    .menu-records { margin-top: 28px; gap: 28px; }

    .screen--sheet { padding: 0; }
    .sheet { border-radius: 20px 20px 0 0; padding: 18px 16px calc(16px + var(--safe-b)); max-height: 86dvh; overflow-y: auto; }
    .sheet-head { flex-direction: column; align-items: flex-start; gap: 10px; }
    .sheet-head h2 { font-size: 28px; }
    .sheet-meta { width: 100%; justify-content: space-between; }
    .offer-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .offer { min-height: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; row-gap: 2px; padding: 12px 14px; }
    .offer .tile { grid-row: span 2; }
    .offer-name { font-size: 18px; }
    .offer-desc { font-size: 13px; }
    .offer-foot { grid-column: 1 / -1; padding-top: 10px; margin-top: 8px; }
    .offer-ribbon { top: 10px; right: 10px; }
    .offer-row--gift { grid-template-columns: minmax(0, 1fr); }
    .sheet-foot { flex-direction: column-reverse; align-items: stretch; }
    .sheet-foot .btn { width: 100%; }
    .sheet-note { text-align: center; }

    .page-head { grid-template-columns: 1fr auto; }
    .page-head > .btn { grid-column: 1 / -1; justify-self: start; }
    .page-title h2 { font-size: 30px; }
    .perk-grid { grid-template-columns: minmax(0, 1fr); }
    .wave-banner-num { font-size: 64px; }
    .result .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* En móviles estrechos el x2 cabe en la misma fila que las monedas y la vida */
@media (max-width: 420px) {
    .hud-stats { gap: 4px; }
    .chip { padding: 0 8px 0 7px; gap: 5px; }
    .speed-btn { padding: 0 8px; }
    .speed-btn .speed-chev { display: none; }
}


/* ==========================================================================
   En línea: perfil, clasificación y cuenta
   ========================================================================== */
.avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    flex-shrink: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.02em;
    color: var(--tc, var(--ivory));
    background: radial-gradient(120% 120% at 30% 15%, color-mix(in srgb, var(--tc, var(--ivory)) 22%, transparent), transparent 62%), var(--bg);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc, var(--ivory)) 26%, transparent);
}
.avatar--lg { width: 52px; height: 52px; border-radius: 14px; font-size: 22px; }

.profile-pill {
    position: absolute;
    top: calc(20px + var(--safe-t));
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(320px, calc(100% - 100px));
    padding: 7px 12px 7px 7px;
    border-radius: 14px;
    text-align: left;
    background: rgba(16, 20, 27, 0.72);
    box-shadow: var(--hi), inset 0 0 0 1px var(--line-2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 140ms var(--ease-out), box-shadow 160ms ease, background-color 160ms ease;
    animation: rise 600ms var(--ease-out) 300ms both;
}
.profile-pill:active { transform: scale(0.97); }
.profile-pill-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.profile-pill-text b { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-pill-text span { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-pill-edit { font-size: 15px; color: var(--ink-3); margin-left: 4px; }
.profile-pill.is-offline .avatar { color: var(--ink-4); }
@media (hover: hover) and (pointer: fine) {
    .profile-pill:hover { background: rgba(30, 36, 48, 0.85); box-shadow: var(--hi), inset 0 0 0 1px var(--line-3); }
    .profile-pill:hover .profile-pill-edit { color: var(--ink); }
}

/* Sonido: botón en la esquina del menú y su panel */
.sound-ctl { position: absolute; top: calc(20px + var(--safe-t)); left: 20px; z-index: 5; animation: rise 600ms var(--ease-out) 300ms both; }
.sound-btn {
    display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; border: 0; cursor: pointer; color: var(--ink-2);
    background: rgba(16, 20, 27, 0.72); box-shadow: var(--hi), inset 0 0 0 1px var(--line-2);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    transition: transform 140ms var(--ease-out), color 160ms ease, box-shadow 160ms ease;
}
.sound-btn .ico { width: 20px; height: 20px; }
.sound-btn:active { transform: scale(0.95); }
.sound-btn.is-muted { color: var(--ink-4); }
.sound-btn[aria-expanded="true"] { color: var(--ink); box-shadow: var(--hi), inset 0 0 0 1px var(--line-3); }
.sound-pop {
    position: absolute; top: calc(100% + 8px); left: 0; width: 220px; padding: 12px 14px; border-radius: 14px;
    background: rgba(16, 20, 27, 0.94); box-shadow: var(--hi), inset 0 0 0 1px var(--line-2), 0 18px 40px -12px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    transform-origin: top left; animation: soundPop 160ms var(--ease-out);
}
@keyframes soundPop { from { opacity: 0; transform: scale(0.96) translateY(-4px); } }
.sound-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font: 600 14px/1 var(--font-body); color: var(--ink); }
.sound-row--vol { margin-top: 14px; }
.sound-val { min-width: 42px; text-align: right; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; border: 0; padding: 0; cursor: pointer; background: var(--bg-4); transition: background-color 160ms ease; }
.switch i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink-2); transition: transform 180ms var(--ease-out), background-color 160ms ease; }
.switch[aria-checked="true"] { background: var(--amber); }
.switch[aria-checked="true"] i { transform: translateX(18px); background: #1a1408; }
.vol { -webkit-appearance: none; appearance: none; flex: 1; height: 24px; background: transparent; cursor: pointer; --p: 60%; }
.vol::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--amber) var(--p), var(--bg-4) var(--p)); }
.vol::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--amber) var(--p), var(--bg-4) var(--p)); }
.vol::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.vol::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--ink); }
.vol:disabled { opacity: 0.4; cursor: default; }

/* Selector segmentado (pestañas) */
.seg {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 12px;
    background: var(--bg-1);
    box-shadow: inset 0 0 0 1px var(--line);
    overflow-x: auto;
    scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg [role=tab] {
    flex: 1 0 auto;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 9px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--ink-3);
    transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}
.seg [role=tab][aria-selected=true] { color: var(--ink); background: var(--bg-3); box-shadow: var(--hi), inset 0 0 0 1px var(--line-2); }
@media (hover: hover) and (pointer: fine) { .seg [role=tab]:not([aria-selected=true]):hover { color: var(--ink-2); } }
.seg--sm [role=tab] { min-height: 32px; font-size: 13px; }

/* Lista de la clasificación */
.page--narrow { width: min(760px, 100%); }
.board { list-style: none; display: flex; flex-direction: column; gap: 4px; transition: opacity 160ms ease; }
.board.is-loading { opacity: 0.45; }
.board-row {
    display: grid;
    grid-template-columns: 40px auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 8px 16px 8px 8px;
    border-radius: 12px;
    background: var(--bg-1);
    box-shadow: var(--hi), inset 0 0 0 1px var(--line);
    animation: rise 380ms var(--ease-out) both;
    animation-delay: calc(min(var(--i, 0), 14) * 22ms);
}
.board-rank {
    text-align: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-3);
}
.board-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.board-who b { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-sub { font-size: 12.5px; color: var(--ink-3); }
.board-val {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 24px;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.board-val small { font-weight: 600; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.board-row.is-top1 { background: linear-gradient(90deg, rgba(240, 180, 76, 0.12), var(--bg-1) 60%); box-shadow: var(--hi), inset 0 0 0 1px rgba(240, 180, 76, 0.32); }
.board-row.is-top1 .board-rank { color: var(--amber-hi); font-size: 22px; }
.board-row.is-top2 .board-rank { color: var(--ivory); font-size: 20px; }
.board-row.is-top3 .board-rank { color: #d39a6a; font-size: 20px; }
.board-row.is-me { box-shadow: var(--hi), inset 0 0 0 1px rgba(241, 236, 226, 0.4); }
.tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 5px;
    font-style: normal;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    vertical-align: 2px;
    color: #14110b;
    background: var(--ivory);
}
/* Clasificación: build de la mejor partida al pulsar un jugador */
.board-row.is-clickable { cursor: pointer; transition: background 160ms ease, transform 140ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .board-row.is-clickable:hover { background-color: var(--bg-2, #151b25); } }
.board-row.is-clickable:active { transform: scale(0.99); }
.board-row.is-clickable:focus-visible { outline: 2px solid rgba(240, 180, 76, 0.6); outline-offset: 2px; }
.board-best { grid-column: 1 / -1; padding: 4px 4px 6px 52px; color: var(--ink-3); font-size: 13.5px; animation: fadeIn 200ms ease-out; cursor: default; }
.board-best-head { color: var(--ink-2); font-weight: 500; margin-bottom: 8px; }
.board-best-none { color: var(--ink-3); }
.board-best-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.board-chip { font-size: 12.5px; padding: 3px 8px; border-radius: 7px; background: rgba(170, 190, 225, 0.08); color: var(--ink-2); white-space: nowrap; }
.board-chip b { color: var(--ink); font-weight: 600; margin-left: 2px; }
@media (max-width: 600px) { .board-best { padding-left: 6px; } }

/* Selector de mapa en el menú */
.map-tabs { margin-top: 26px; width: max-content; max-width: 100%; }
.map-tabs [role=tab] { display: inline-flex; align-items: center; gap: 7px; min-width: 104px; justify-content: center; }
.map-tabs .map-lock { width: 13px; height: 13px; display: none; opacity: 0.7; }
.map-tabs .is-locked { color: var(--ink-4, #5d5c58); }
.map-tabs .is-locked .map-lock { display: inline-block; }
.map-hint { margin-top: 8px; min-height: 1.3em; font-size: 12.5px; color: var(--ink-3); max-width: 44ch; }
.map-hint:empty { display: none; }
/* Modo difícil: interruptor bajo los mapas (se abre superando la ronda 60 de ese mapa) */
.hard-btn { margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-1); color: var(--ink-2); font: 600 13px/1 var(--font-body); cursor: pointer; transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 160ms var(--ease-out); }
.hard-btn:active { transform: scale(0.97); }
.hard-btn .ico { width: 15px; height: 15px; }
.hard-switch { position: relative; width: 28px; height: 16px; border-radius: 999px; background: var(--bg-4); transition: background-color 160ms ease; }
.hard-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink-3); transition: transform 200ms var(--ease-out), background-color 160ms ease; }
.hard-btn[aria-pressed="true"] { color: #ff8a7c; border-color: rgba(255, 106, 92, 0.45); background: rgba(255, 106, 92, 0.08); }
.hard-btn[aria-pressed="true"] .hard-switch { background: rgba(255, 106, 92, 0.5); }
.hard-btn[aria-pressed="true"] .hard-switch::after { transform: translateX(12px); background: #ffd1cb; }
.hard-btn.is-locked { color: var(--ink-4); }
.hard-btn.is-locked .hard-switch { display: none; }
.hard-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.btn--reroll.is-free .reroll-price { background: rgba(111, 211, 154, 0.14); color: var(--ok); }
.btn--reroll.is-free .reroll-price .ico { display: none; }

/* Notas del parche */
.notes-btn { margin-top: 22px; gap: 8px; }
.notes-btn .notes-new { margin-left: 2px; }
.notes-new { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(240, 180, 76, 0.16); }
.notes { display: flex; flex-direction: column; gap: 14px; }
.note { padding: 18px 20px 20px; border-radius: 14px; background: var(--bg-1); box-shadow: var(--hi), inset 0 0 0 1px var(--line); animation: rise 380ms var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 8) * 40ms); }
.note.is-latest { box-shadow: var(--hi), inset 0 0 0 1px rgba(240, 180, 76, 0.3); }
.note-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.note-ver { font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1; letter-spacing: 0.01em; text-transform: uppercase; }
.note-title { color: var(--ink-2); font-weight: 500; }
.note-date { margin-left: auto; color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.note ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--ink-2); font-size: 14.5px; line-height: 1.5; max-width: 68ch; }
.note li::marker { color: var(--ink-4, #5d5c58); }
.note li b { color: var(--ink); font-weight: 600; }

/* Aviso de reinicio en el menú */
.reset-note { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 5px 11px; border-radius: 999px; font-size: 12px; line-height: 1.3; color: var(--ink-2); background: rgba(240, 180, 76, 0.08); box-shadow: inset 0 0 0 1px rgba(240, 180, 76, 0.22); max-width: 100%; }
.reset-note i { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); flex-shrink: 0; }

.board--me { margin-top: -8px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.board-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 48px 24px;
    text-align: center;
    border-radius: 14px;
    background: var(--bg-1);
    box-shadow: inset 0 0 0 1px var(--line);
}
.board-empty b { font-family: var(--font-display); font-weight: 700; font-size: 22px; text-transform: uppercase; letter-spacing: 0.02em; }
.board-empty p { max-width: 42ch; color: var(--ink-3); font-size: 14px; }
.board-empty .btn { margin-top: 10px; }
.icon-btn.is-spin .ico { animation: spin 520ms var(--ease-out); }
@keyframes spin { from { rotate: 0deg; } to { rotate: 360deg; } }

/* Panel de perfil */
#profile-panel .drawer-panel { width: min(440px, 100%); }
.profile-scroll { flex: 1; overflow-y: auto; margin: 18px -8px 0; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 22px; scrollbar-width: thin; scrollbar-color: var(--bg-4) transparent; user-select: text; -webkit-user-select: text; }
.name-form { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; column-gap: 12px; }
.name-form .form-msg { grid-column: 1 / -1; }
.name-form.is-denied { animation: shake 340ms ease-in-out; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.field-row { display: flex; gap: 6px; }
.input {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-size: 16px; /* evita el zoom automático en iPhone */
    color: var(--ink);
    background: var(--bg);
    box-shadow: inset 0 0 0 1px var(--line-2);
    transition: box-shadow 160ms ease, background-color 160ms ease;
}
.input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--amber), 0 0 0 3px rgba(240, 180, 76, 0.16); }
.input:disabled { opacity: 0.5; }
.field-row .btn { height: 44px; flex-shrink: 0; }
.form-msg { min-height: 0; font-size: 13px; color: var(--ink-3); }
.form-msg:empty { display: none; }
.form-msg.is-error { color: var(--hp); }
.form-msg.is-ok { color: var(--ok); }
.form-msg.is-warn { color: var(--amber); }
.name-form .form-msg { margin-top: 8px; }

.pstats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pstats > div {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-2);
    box-shadow: var(--hi), inset 0 0 0 1px var(--line);
    animation: rise 380ms var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 24ms + 100ms);
}
.pstats dt { font-size: 12px; color: var(--ink-3); line-height: 1.25; }
.pstats dd { margin-top: 2px; font-family: var(--font-display); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.pstats .is-big dd { font-size: 30px; font-weight: 800; color: var(--ivory); }

.account { padding: 16px; border-radius: 14px; background: var(--bg-2); box-shadow: var(--hi), inset 0 0 0 1px var(--line-2); }
.account-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 0.02em; text-transform: uppercase; }
.account-title .ico { font-size: 18px; color: var(--ink-3); }
.account-title--ok .ico { color: var(--ok); }
.account-text { margin: 6px 0 14px; font-size: 13.5px; color: var(--ink-2); }
.account-text b { color: var(--ink); font-weight: 600; }
.account-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.account-hint { font-size: 12.5px; color: var(--ink-3); }
.account-form .btn { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: progress; }
#logout-btn.is-confirm { color: var(--hp); box-shadow: inset 0 0 0 1px rgba(255, 106, 92, 0.45); }
#account-user .form-msg { margin-top: 10px; }

/* Puesto al terminar la partida */
.result-rank { margin-top: 6px; min-height: 1.4em; font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: 0.04em; color: var(--ivory); animation: rise 520ms var(--ease-out) 520ms both; }
.result-rank.is-up { color: var(--ok); }
.result-rank.is-gold { color: var(--amber-hi); }
.result-rank.is-muted { color: var(--ink-3); font-family: var(--font-body); font-weight: 400; font-size: 14px; letter-spacing: 0; }

@media (max-width: 760px) {
    .profile-pill { top: calc(12px + var(--safe-t)); right: 12px; left: auto; }
    .sound-ctl { top: calc(12px + var(--safe-t)); left: 12px; }
    .profile-pill { max-width: calc(100% - 84px); }
    .menu-records { gap: 22px; }
    .menu-records dd { font-size: 26px; }
    .board-row { grid-template-columns: 30px auto minmax(0, 1fr) auto; gap: 10px; padding: 8px 12px 8px 6px; min-height: 54px; }
    .board-row .avatar { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
    .board-val { font-size: 20px; }
    .board-val small { display: none; }
    #ranking-screen .page-head { grid-template-columns: 1fr auto; }
    #ranking-screen .page-head > .btn { grid-column: 1; }
    #ranking-screen .page-head > .page-title { grid-column: 1; grid-row: 2; }
    #ranking-screen .page-head > .icon-btn { grid-column: 2; grid-row: 2; }
}

/* Ramas de mejoras permanentes */
.branches { display: flex; flex-direction: column; gap: 26px; }
.branch-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.branch-name { position: relative; padding-left: 14px; font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); }
.branch-name::before { content: ""; position: absolute; left: 0; top: 50%; width: 6px; height: 6px; border-radius: 2px; translate: 0 -50%; background: var(--tc); box-shadow: 0 0 10px var(--tc); }
.branch-spent { font-size: 13px; color: var(--ink-3); }
.branch-refund {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--ink-2);
    box-shadow: inset 0 0 0 1px var(--line-2);
    transition: transform 140ms var(--ease-out), color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.branch-refund .ico { font-size: 14px; }
.branch-refund:active { transform: scale(0.96); }
.branch-refund.is-armed, #prestige-respec-btn.is-armed { color: var(--hp); background: rgba(255, 106, 92, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 106, 92, 0.55); }
@media (hover: hover) and (pointer: fine) { .branch-refund:not(.is-armed):hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-3); } }
#prestige-respec-btn:disabled { opacity: 0.4; cursor: default; }

/* Foto de perfil */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; animation: fadeIn 240ms ease-out; }
.avatar.has-photo { background: var(--bg); }
.avatar-edit { position: relative; display: inline-flex; }
.avatar-edit .avatar { cursor: pointer; transition: transform 140ms var(--ease-out), box-shadow 160ms ease; }
.avatar-edit .avatar:active { transform: scale(0.95); }
.avatar-edit .avatar:disabled { cursor: default; }
.avatar-cam {
    position: absolute; right: -5px; bottom: -5px;
    display: grid; place-items: center;
    width: 22px; height: 22px; border-radius: 7px;
    font-size: 12px; color: #14110b; background: var(--ivory);
    box-shadow: 0 0 0 3px var(--bg-1);
    pointer-events: none;
}
.avatar.is-busy { opacity: 0.5; animation: busy 900ms ease-in-out infinite alternate; }
.avatar.is-new { animation: tilePop 520ms cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes busy { to { opacity: 0.25; } }
@media (hover: hover) and (pointer: fine) { .avatar-edit .avatar:not(:disabled):hover { box-shadow: inset 0 0 0 1px var(--line-3), 0 0 0 3px rgba(241, 236, 226, 0.08); } }
.avatar-actions { grid-column: 1 / -1; display: flex; gap: 16px; margin-top: 10px; }
.link-btn { font-size: 13px; font-weight: 500; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.link-btn:disabled { opacity: 0.4; cursor: default; }
.link-btn--danger { color: var(--hp); text-decoration-color: rgba(255, 106, 92, 0.4); }
@media (hover: hover) and (pointer: fine) { .link-btn:not(:disabled):hover { color: var(--ink); } .link-btn--danger:hover { color: var(--hp); } }

@media (max-width: 760px) {
    .branch-head { flex-wrap: wrap; row-gap: 6px; }
    .branch-name { font-size: 18px; }
}

/* Aviso para invitados en la clasificación */
.ranking-guest { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: 14px; background: rgba(240, 180, 76, 0.07); box-shadow: inset 0 0 0 1px rgba(240, 180, 76, 0.3); animation: rise 380ms var(--ease-out) both; }
.ranking-guest p { font-size: 14px; color: var(--ink-2); max-width: 60ch; }
.ranking-guest b { color: var(--ink); font-weight: 600; }
.ranking-guest .btn { flex-shrink: 0; }
.result-rank .link-btn { font-family: var(--font-body); font-size: inherit; letter-spacing: 0; }
@media (max-width: 760px) { .ranking-guest { flex-direction: column; align-items: stretch; } }


/* Aviso flotante (mejoras incompatibles) */
.toast {
    position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 60;
    width: max-content; max-width: min(440px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 14px;
    background: rgba(22, 27, 36, 0.96); color: var(--ink); font-size: 15px; line-height: 1.4; text-align: center;
    box-shadow: inset 0 0 0 1px rgba(255, 106, 92, 0.35), 0 18px 40px rgba(0, 0, 0, 0.45);
    opacity: 0; transform: translate(-50%, 12px) scale(0.97); pointer-events: none;
    transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.perk.is-blocked { opacity: 0.55; }
.perk.is-blocked .perk-lvl { color: var(--hp); }

/* Continuar partida guardada */
.btn--continue { justify-content: center; }
/* Continuar y Nueva partida van juntos en la misma fila; sin partida guardada, Jugar se coloca como antes */
.menu-run { display: contents; }
.menu-run:has(.btn--continue:not(.hidden)) { display: flex; gap: 10px; flex-basis: 100%; }
.menu-run:has(.btn--continue:not(.hidden)) > .btn { flex: 1 1 0; min-width: 0; justify-content: center; }
@media (max-width: 760px) {
    .menu-run { display: flex; gap: 10px; }
    .menu-run > .btn:not(.hidden) { flex: 1 1 0; min-width: 0; justify-content: center; }
    .menu-run:has(.btn--continue:not(.hidden)) .continue-label { flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1.1; }
    .menu-run:has(.btn--continue:not(.hidden)) .continue-label small { font-size: 11px; }
    .menu-run:has(.btn--continue:not(.hidden)) > .btn { padding-left: 12px; padding-right: 12px; font-size: 15px; }
}
@media (max-width: 380px) {
    .menu-run:has(.btn--continue:not(.hidden)) { gap: 8px; }
    .menu-run:has(.btn--continue:not(.hidden)) > .btn { padding-left: 10px; padding-right: 10px; font-size: 13px; letter-spacing: 0.04em; gap: 8px; }
    .menu-run:has(.btn--continue:not(.hidden)) #menu-play-btn .ico { display: none; }
}
.continue-label { display: inline-flex; align-items: baseline; gap: 12px; }
.continue-label small { font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.72; font-variant-numeric: tabular-nums; }

/* La barra de arriba nunca salta a una segunda fila (ver fitHud en game.js) */
.hud-wave { flex-shrink: 0; }
.hud-stats { flex-wrap: nowrap; min-width: 0; }
.hud-stats > * { flex-shrink: 0; }
.hud.is-tight { gap: 6px; }
.hud.is-tight .hud-wave { padding-left: 10px; padding-right: 10px; column-gap: 6px; }
.hud.is-tight .hud-label { letter-spacing: 0.08em; }
.hud.is-tight .hud-stats { gap: 3px; }
.hud.is-tight .chip { padding: 0 6px; gap: 4px; }
.hud.is-tighter .hud-wave { padding-left: 8px; padding-right: 8px; }
.hud.is-tighter .chip { padding: 0 5px; gap: 3px; }
.hud.is-tighter .icon-btn { width: 30px; }
.hud.is-tighter .speed-btn { width: auto; padding: 0 6px; }

/* Aviso de versión nueva */
.update-banner {
    position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); z-index: 80;
    display: flex; align-items: center; gap: 16px;
    width: max-content; max-width: min(560px, calc(100vw - 32px)); padding: 14px 14px 14px 18px; border-radius: 16px;
    background: rgba(22, 27, 36, 0.97); color: var(--ink-2); font-size: 15px; line-height: 1.4;
    box-shadow: inset 0 0 0 1px rgba(240, 180, 76, 0.45), 0 18px 40px rgba(0, 0, 0, 0.5);
    opacity: 0; transform: translate(-50%, -12px) scale(0.97);
    transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out);
}
.update-banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.update-banner b { color: var(--ink); font-weight: 600; }
.update-banner .btn { flex-shrink: 0; }
@media (max-width: 520px) { .update-banner { flex-direction: column; align-items: stretch; text-align: center; } }

/* Mejora especial (Ventisca): se paga con puntos de prestigio */
.offer-price.is-pp { color: var(--pp); }
.offer.is-poor .offer-price.is-pp { color: var(--ink-4); }
.offer.is-special { box-shadow: var(--hi), inset 0 0 0 1px rgba(169, 150, 255, 0.5), 0 0 44px -16px rgba(159, 220, 255, 0.55); }
.offer.is-special::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(105deg, transparent 35%, rgba(159, 220, 255, 0.14) 50%, transparent 65%);
    transform: translateX(-100%); animation: sheen 3.6s var(--ease-out) 700ms infinite;
}

/* Cambiar las mejoras de la tienda (rerroll) */
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn--reroll { gap: 8px; }
.reroll-price { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; padding: 2px 8px; border-radius: 999px; background: rgba(240, 194, 92, 0.12); color: #f0c25c; font-variant-numeric: tabular-nums; }
.reroll-price .ico { width: 14px; height: 14px; }
.btn--reroll.is-poor { opacity: 0.55; }
@media (max-width: 760px) {
    .sheet-actions { width: 100%; flex-direction: column; }
    .sheet-actions .btn { width: 100%; justify-content: center; }
}
.btn--reroll.is-denied { animation: shake 340ms ease-in-out; }

/* ==========================================================================
   Móvil compacto: tienda, botín, menú y clasificación caben en la pantalla
   sin tener que desplazarse
   ========================================================================== */
/* Las pestañas no se encogen aunque la lista sea larga (en iPhone se quedaban en una franja) */
.seg { flex-shrink: 0; }
@media (max-width: 760px) {
    /* Tienda a pantalla completa (debajo de la barra de arriba): las cartas grandes se reparten
       el alto que haya, así nunca hace falta desplazarse */
    .screen--sheet { align-items: flex-end; }
    .sheet { display: flex; flex-direction: column; height: calc(100dvh - 62px - var(--safe-t)); max-height: none; overflow: hidden; padding: 18px 16px calc(14px + var(--safe-b)); }
    .sheet-head { flex-shrink: 0; margin-bottom: 14px; }
    /* Cada carta mide al menos lo que su texto: si no caben las tres, la fila se desplaza en vez de cortar el texto */
    .offer-row { flex: 1 1 auto; min-height: 0; grid-auto-rows: minmax(min-content, 1fr); overflow-y: auto; overscroll-behavior: contain; padding: 2px; margin: -2px; }
    .offer { align-content: safe center; overflow: hidden; }
    .offer:has(.offer-ribbon) :is(.offer-name, .offer-desc) { padding-right: 62px; }   /* que el texto no pise «Gratis» */
    .sheet-foot { flex-shrink: 0; margin-top: 12px; gap: 8px; }
    /* Cambiar tienda y Saltar, uno al lado del otro */
    .sheet-actions { flex-direction: row; gap: 6px; }
    .sheet-actions .btn { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 4px 8px; font-size: 13.5px; letter-spacing: 0.04em; gap: 6px; white-space: normal; line-height: 1.1; }
    .sheet-actions .btn.hidden { display: none; }
    .reroll-price { margin-left: 0; padding: 1px 6px; }

    /* Botín del jefe: las dos cartas igual de compactas */
    .offer.is-gift { min-height: 0; }
    .offer-row--gift { margin: 14px 0 16px; width: 100%; }
    .result-title--sm { font-size: 40px; }
    #boss-loot-screen .result-best { font-size: 14px; margin-top: 8px; }

    /* Clasificación: pestañas en dos filas (sin desplazar a los lados) y filas más bajas */
    #ranking-screen .page { gap: 12px; }
    #ranking-screen .page-head { gap: 8px 12px; }
    #ranking-screen .page-title h2 { font-size: 28px; }
    #ranking-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
    #ranking-tabs [role=tab] { min-height: 32px; padding: 0 4px; font-size: 12.5px; letter-spacing: 0.04em; }
    .board { gap: 3px; }
    .board-row { min-height: 46px; padding: 5px 12px 5px 6px; border-radius: 10px; }
    .board-who b { font-size: 14.5px; }
    .board-sub { font-size: 11.5px; }
    .board-val { font-size: 18px; }
}
/* Menú en móviles de poca altura: todo más junto para que no se corte por arriba */
@media (max-width: 760px) and (max-height: 760px) {
    .screen--menu { padding-bottom: calc(18px + var(--safe-b)); }
    .menu-mark { display: none; }
    .title { font-size: 56px; }
    .tagline { margin-top: 10px; font-size: 14.5px; }
    .map-tabs { margin-top: 14px; }
    .map-hint { margin-top: 6px; font-size: 12px; }
    .hard-btn { margin-top: 8px; padding: 5px 10px 5px 12px; }
    .menu-actions { margin-top: 16px; gap: 8px; }
    .menu-actions .btn--xl { min-height: 48px; font-size: 17px; }
    .menu-records { margin-top: 16px; padding-top: 12px; }
    .menu-records dd { font-size: 22px; }
    .notes-btn { margin-top: 12px; }
}
@media (max-width: 760px) and (max-height: 600px) {
    .title { font-size: 44px; }
    .tagline { display: none; }
    .menu-actions .btn--xl { min-height: 44px; }
    .sheet-note { display: none; }
    .sheet-head { margin-bottom: 8px; gap: 6px; }
    .sheet-head h2 { font-size: 24px; }
    .offer { padding: 9px 12px; }
    .offer-foot { padding-top: 6px; margin-top: 4px; }
    .title { font-size: 40px; }
    .menu-actions { margin-top: 12px; }
    .menu-records { margin-top: 10px; padding-top: 8px; }
    .notes-btn { margin-top: 8px; }
}

/* ===== Menú nuevo, retos diarios y torneos ===== */

.menu.m2 { width: min(460px, 100%); }
.m2 .menu-top { display: flex; align-items: center; gap: 12px; }
.m2 .menu-top .menu-mark { width: 40px; height: 40px; margin: 0; }
.m2 .title { font-size: 46px; }
.m2 .map-row { display: flex; align-items: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.m2 .map-row .seg { margin: 0; }
.m2 .map-row .hard-btn { margin: 0; }
.m2 .play { margin-top: 16px; width: 100%; justify-content: center; min-height: 60px; font-size: 21px; }
.m2 .tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.tile-btn { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 14px 13px; min-height: 104px; border-radius: 14px; border: 0; text-align: left; cursor: pointer;
  background: rgba(16, 20, 27, 0.72); box-shadow: var(--hi), inset 0 0 0 1px var(--line-2); color: var(--ink); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tile-btn .tb-ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--bg-3); }
.tile-btn .tb-ico .ico { width: 19px; height: 19px; }
.tile-btn b { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1; }
.tile-btn small { font-size: 12.5px; color: var(--ink-3); line-height: 1.25; }
.tile-btn small strong { color: var(--ink-2); font-weight: 600; }
.tile-btn .dot { position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(240, 180, 76, 0.15); }
.tile-btn .tb-badge { position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; gap: 4px; font: 700 13px/1 var(--font-display); color: var(--pp); }
.tile-btn .tb-badge .ico { width: 13px; height: 13px; }
.tile-btn.is-daily .tb-ico { color: var(--amber); background: rgba(240, 180, 76, 0.12); }
.tile-btn.is-cup .tb-ico { color: #ffd58a; background: rgba(255, 213, 138, 0.10); }
.tile-btn.is-pp .tb-ico { color: var(--pp); background: rgba(169, 150, 255, 0.12); }
.tile-btn.is-rank .tb-ico { color: #8fb8e8; background: rgba(143, 184, 232, 0.12); }
.m2 .menu-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.m2 .rec { display: flex; gap: 22px; }
.m2 .rec div { display: flex; flex-direction: column; gap: 2px; }
.m2 .rec dt { font: 600 11px/1 var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.m2 .rec dd { font: 700 22px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.m2 .foot-btns { display: flex; gap: 8px; }
.m2 .chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 10px; border: 0; background: var(--bg-2); box-shadow: var(--hi), inset 0 0 0 1px var(--line-2); color: var(--ink-2); font: 600 13px/1 var(--font-body); }
.m2 .chip-btn .ico { width: 15px; height: 15px; }
.m2 .chip-btn.is-tokens { color: var(--amber); }
@media (max-width: 760px) {
  .m2 .title { font-size: 40px; }
  .m2 .tagline { display: none; }
}



.comp-page .page { gap: 18px; max-width: 720px; }
.comp-page .tokens { color: var(--amber); }
.comp-page .card { border-radius: 16px; background: rgba(16, 20, 27, 0.8); box-shadow: var(--hi), inset 0 0 0 1px var(--line-2); padding: 18px; }
.comp-page .card h3 { font: 800 28px/1 var(--font-display); text-transform: uppercase; letter-spacing: 0.01em; }
.comp-page .card p { color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.comp-page .card .kicker { margin-bottom: 8px; display: block; }
.comp-page .daily-hero { position: relative; overflow: hidden; padding: 22px 20px; box-shadow: var(--hi), inset 0 0 0 1px rgba(240, 180, 76, 0.35), 0 0 60px -30px rgba(240, 180, 76, 0.6); }
.comp-page .daily-hero .badge-ico { position: absolute; right: -18px; top: -18px; width: 140px; height: 140px; color: rgba(240, 180, 76, 0.07); }
.comp-page .daily-hero .badge-ico .ico { width: 100%; height: 100%; }
.comp-page .daily-hero h3 { margin-top: 2px; font-size: 34px; }
.comp-page .daily-hero p { margin-top: 10px; max-width: 46ch; }
.comp-page .rules { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.comp-page .rules span { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; background: var(--bg-3); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.comp-page .rules span .ico { width: 14px; height: 14px; }
.comp-page .goal-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 16px; }
.comp-page .goal { padding: 12px; border-radius: 12px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.comp-page .goal dt { font: 600 11px/1 var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.comp-page .goal dd { margin-top: 6px; font: 700 22px/1 var(--font-display); }
.comp-page .goal dd.amber { color: var(--amber); }
.comp-page .goal.is-done { box-shadow: inset 0 0 0 1px rgba(111, 211, 154, 0.5); }
.comp-page .goal.is-done dd { color: var(--ok); }
.comp-page .hero-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.comp-page .hero-actions .btn { flex: 1 1 200px; justify-content: center; }
.comp-page .hero-actions .left { color: var(--ink-3); font-size: 13px; }
.comp-page .streak { display: flex; gap: 8px; margin-top: 12px; }
.comp-page .streak i { flex: 1; height: 38px; border-radius: 10px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; font: 700 12px/1 var(--font-display); color: var(--ink-4); font-style: normal; }
.comp-page .streak i.on { background: rgba(240, 180, 76, 0.16); color: var(--amber); box-shadow: inset 0 0 0 1px rgba(240, 180, 76, 0.4); }
.comp-page .streak i.today { box-shadow: inset 0 0 0 2px var(--amber); color: var(--amber); }
.comp-page .streak i.gift { color: var(--pp); }
.comp-page .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.comp-page .mini-rank { margin-top: 10px; display: flex; flex-direction: column; }
.comp-page .mini-rank li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; height: 38px; border-bottom: 1px solid var(--line); font-size: 14px; }
.comp-page .mini-rank li:last-child { border: 0; }
.comp-page .mini-rank li .n { font: 700 14px/1 var(--font-display); color: var(--ink-3); }
.comp-page .mini-rank li .w { font: 700 16px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.comp-page .mini-rank li.me { background: rgba(240, 180, 76, 0.08); border-radius: 8px; padding: 0 6px; margin: 0 -6px; }
.comp-page .mini-rank li.me .n, .comp-page .mini-rank li.me .w { color: var(--amber); }
.comp-page .mini-rank li.gap { height: 18px; color: var(--ink-4); border: 0; display: block; text-align: center; line-height: 10px; }
.comp-page .sub-h { display: flex; align-items: baseline; justify-content: space-between; }
.comp-page .sub-h h4 { font: 700 15px/1 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.comp-page .sub-h span { font-size: 12.5px; color: var(--ink-3); }
.comp-page .next-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.comp-page .next-list div { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--bg-2); font-size: 14px; color: var(--ink-2); }
.comp-page .next-list div span:last-child { color: var(--ink-4); font-size: 12.5px; }

/* Torneo */
.comp-page .t-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.comp-page .pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font: 700 12px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; }
.comp-page .pill.open { background: rgba(111, 211, 154, 0.14); color: var(--ok); }
.comp-page .pill.live { background: rgba(255, 106, 92, 0.14); color: var(--hp); }
.comp-page .pill.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.comp-page .week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 14px; }
.comp-page .week div { padding: 9px 4px; border-radius: 10px; background: var(--bg-2); text-align: center; box-shadow: inset 0 0 0 1px var(--line); }
.comp-page .week b { display: block; font: 700 13px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.comp-page .week small { display: block; margin-top: 5px; font-size: 11px; color: var(--ink-3); line-height: 1.2; }
.comp-page .week .on { background: rgba(111, 211, 154, 0.10); box-shadow: inset 0 0 0 1px rgba(111, 211, 154, 0.4); }
.comp-page .week .on b { color: var(--ok); }
.comp-page .week .play b { color: #ffd58a; }
.comp-page .week .final { background: rgba(255, 213, 138, 0.10); box-shadow: inset 0 0 0 1px rgba(255, 213, 138, 0.4); }
.comp-page .fill { margin-top: 16px; }
.comp-page .fill-bar { height: 8px; border-radius: 8px; background: var(--bg-3); overflow: hidden; margin-top: 8px; }
.comp-page .fill-bar i { display: block; height: 100%; width: 59%; background: linear-gradient(90deg, #f0b44c, #ffd58a); border-radius: 8px; }
.comp-page .fill-txt { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); }
.comp-page .fill-txt b { color: var(--ink); font-weight: 600; }
.comp-page .t-rules { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.comp-page .t-rules li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.comp-page .t-rules li .ico { width: 18px; height: 18px; margin-top: 1px; color: var(--ink-3); }
.comp-page .t-rules li b { color: var(--ink); font-weight: 600; }
.comp-page .prizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.comp-page .prizes div { padding: 10px 8px; border-radius: 10px; background: var(--bg-2); text-align: center; }
.comp-page .prizes b { display: block; font: 700 13px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.comp-page .prizes span { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font: 700 18px/1 var(--font-display); color: var(--amber); }
.comp-page .prizes span .ico { width: 14px; height: 14px; }
.comp-page .prizes .first { box-shadow: inset 0 0 0 1px rgba(255, 213, 138, 0.45); }
.comp-page .prizes .first b { color: #ffd58a; }
.comp-page .match { padding: 20px; box-shadow: var(--hi), inset 0 0 0 1px rgba(255, 213, 138, 0.35), 0 0 60px -30px rgba(255, 213, 138, 0.5); }
.comp-page .vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 14px; }
.comp-page .vs .side { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.comp-page .vs .av { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--bg-3); font: 700 18px/1 var(--font-display); }
.comp-page .vs .side.me .av { background: rgba(240, 180, 76, 0.16); color: var(--amber); box-shadow: inset 0 0 0 1px rgba(240, 180, 76, 0.5); }
.comp-page .vs .nm { font-weight: 600; font-size: 15px; }
.comp-page .vs .best { font: 800 34px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.comp-page .vs .best small { display: block; font: 600 11px/1 var(--font-display); letter-spacing: 0.14em; color: var(--ink-3); text-transform: uppercase; margin-top: 4px; }
.comp-page .vs .x { font: 800 18px/1 var(--font-display); color: var(--ink-4); }
.comp-page .tries { display: flex; justify-content: center; gap: 6px; }
.comp-page .tries i { width: 26px; height: 6px; border-radius: 6px; background: var(--bg-4); }
.comp-page .tries i.used { background: var(--amber); }
.comp-page .match-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.comp-page .match-meta b { color: var(--ink); font-weight: 600; }
.comp-page .match-meta .pp { color: var(--pp); }
.comp-page .bracket { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }
.comp-page .bracket .col { display: flex; flex-direction: column; justify-content: space-around; gap: 8px; }
.comp-page .bracket .col > b { font: 700 12px/1 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
.comp-page .bm { border-radius: 10px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.comp-page .bm div { display: flex; justify-content: space-between; height: 30px; align-items: center; padding: 0 10px; font-size: 13px; color: var(--ink-2); }
.comp-page .bm div + div { border-top: 1px solid var(--line); }
.comp-page .bm div.w { color: var(--ink); font-weight: 600; }
.comp-page .bm div.l { color: var(--ink-4); }
.comp-page .bm div span:last-child { font: 700 13px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.comp-page .bm.me { box-shadow: inset 0 0 0 1px rgba(240, 180, 76, 0.55); }
.comp-page .bm div.you { color: var(--amber); }
.comp-page .bm.tbd div { color: var(--ink-4); }
@media (max-width: 760px) {
  .comp-page .row2 { grid-template-columns: 1fr; }
  .comp-page .goal-row { grid-template-columns: 1fr 1fr 1fr; }
  .comp-page .daily-hero h3 { font-size: 28px; }
  .comp-page .prizes { grid-template-columns: repeat(2, 1fr); }
  .comp-page .bracket { grid-template-columns: repeat(4, 150px); }
  .comp-page .page-title h2 { font-size: 30px; }
}
.comp-page .page > * { flex-shrink: 0; }
.comp-page .week div { min-width: 0; }
@media (max-width: 760px) {
  .comp-page .week { gap: 4px; }
  .comp-page .week div { padding: 8px 2px; }
  .comp-page .week b { font-size: 11px; letter-spacing: 0.04em; }
  .comp-page .week small { font-size: 10px; }
}

/* ===== Menú principal con retos y torneo (1.15) ===== */
.m2 .play-run { display: flex; gap: 10px; margin-top: 16px; }
.m2 .play-run > .btn:not(.hidden) { flex: 1 1 0; min-width: 0; justify-content: center; min-height: 60px; font-size: 21px; }
.m2 .map-hint:empty { display: none; }
.m2 .map-hint { margin-top: 8px; }
.m2 .reset-note { margin-top: 10px; }
.m2 .notes-btn { margin-top: 0; position: relative; }
.m2 .notes-btn .notes-new { position: absolute; top: 6px; right: 6px; margin: 0; }
.m2 .chip-btn.is-tokens { cursor: default; }
.tile-btn { transition: transform 160ms var(--ease-out), box-shadow 200ms ease; font-family: var(--font-body); }
.tile-btn:hover { box-shadow: var(--hi), inset 0 0 0 1px var(--line-3); }
.tile-btn:active { transform: scale(0.97); }
.tile-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.tile-btn.is-daily.is-done .tb-ico { color: var(--ok); background: rgba(111, 211, 154, 0.12); }
.m2 .rec dd { animation: rise 600ms var(--ease-out) 380ms both; }
@media (max-width: 760px) {
  .m2 .play-run > .btn:not(.hidden) { min-height: 54px; font-size: 18px; }
  .m2 .play-run:has(.btn--continue:not(.hidden)) > .btn { font-size: 14px; padding-left: 10px; padding-right: 10px; }
  .m2 .play-run .continue-label { flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1.1; }
  .tile-btn { min-height: 92px; padding: 12px; }
  .tile-btn b { font-size: 16px; }
  .m2 .rec { gap: 16px; }
  .m2 .rec dd { font-size: 20px; }
}
@media (max-height: 640px) {
  .m2 .map-row { margin-top: 10px; }
  .tile-btn { min-height: 78px; gap: 4px; }
  .tile-btn .tb-ico { width: 28px; height: 28px; }
}

/* Páginas de reto y torneo */
.comp-page .page { gap: 14px; }
.comp-body { display: flex; flex-direction: column; gap: 14px; }
.comp-body > * { flex-shrink: 0; }
.comp-page .balance.tokens b { color: var(--amber); }
.comp-page .muted { color: var(--ink-3); font-size: 13px; }
.comp-page .empty { padding: 28px 18px; text-align: center; color: var(--ink-3); }
.comp-page .msg { font-size: 13.5px; color: var(--ink-2); min-height: 0; }
.comp-page .msg.is-err { color: var(--hp); }
.comp-page .msg.is-ok { color: var(--ok); }
.comp-page .reg-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; max-height: 180px; overflow-y: auto; }
.comp-page .reg-list span { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--bg-2); font-size: 13px; color: var(--ink-2); }
.comp-page .reg-list span.me { color: var(--amber); box-shadow: inset 0 0 0 1px rgba(240, 180, 76, 0.45); }
.comp-page .group-tabs { margin-top: 10px; }
.comp-page .bracket { grid-template-columns: repeat(var(--cols, 4), minmax(150px, 1fr)); }
.comp-page .bm div span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.comp-page .bm div { gap: 8px; }
.comp-page .bm .tries-s { font: 600 10px/1 var(--font-display); color: var(--ink-4); margin-left: 4px; }
.comp-page .daily-hero .btn[disabled] { opacity: 0.5; }
.comp-page .cup-pp { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.comp-page .cup-pp b { color: var(--pp); }
.comp-page .tries i.used { background: var(--amber); }
@media (max-width: 760px) {
  .comp-page .bracket { grid-template-columns: repeat(var(--cols, 4), 150px); }
  .comp-page .daily-hero { padding: 18px 16px; }
  .comp-page .goal { padding: 10px 8px; }
  .comp-page .goal dd { font-size: 17px; }
  .comp-page .goal dt { font-size: 10px; letter-spacing: 0.08em; }
}

/* Reto: tienda abierta durante la ronda (desplegable que no tapa el campo) */
#shop-screen.is-live { background: none; pointer-events: none; }
#shop-screen.is-live .sheet { pointer-events: auto; }
@media (max-width: 760px) {
  #shop-screen.is-live .sheet { height: auto; max-height: 58dvh; overflow-y: auto; }
  #shop-screen.is-live .offer-row { flex: none; grid-auto-rows: auto; }
}
.live-shop-btn[aria-expanded="true"] { color: var(--amber); box-shadow: inset 0 0 0 1px rgba(240, 180, 76, 0.5); }
/* Reto: ruleta y tienda a ciegas */
.offer.is-picked { box-shadow: 0 0 0 2px var(--amber), 0 0 40px -8px rgba(240, 180, 76, 0.7); transform: translateY(-4px) scale(1.02); }
.offer.is-blind .tile { color: var(--ink-3); }
.offer.is-blind .offer-name { color: var(--ink-2); }
.blind-alts { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.blind-alt { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink); line-height: 1.25; }
.blind-alt svg { width: 15px; height: 15px; flex: none; color: var(--ac); }
/* En los retos no hay prestigio en la barra de arriba */
.hud.is-daily #prestige-container { display: none; }

.comp-page .bracket .col { justify-content: flex-start; }
.comp-page .bracket .col-m { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 8px; }
