/* Todo el diseño se mide en "unidades del mockup" (--s): 906 unidades = ancho de
   pantalla (hasta 1600px). Así la página se ve grande y proporcional en cualquier monitor. */
:root {
    --s: calc(min(100vw, 1600px) / 906);
    --bg: #d5d9de;
    --ink: #3c404c;
    --card: #403f4c;
    --soft: #aeb4bd;
    --lilac: #9a5fd6;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100svh;
    margin: 0;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: calc(14 * var(--s));
    line-height: 1.4;
}

img {
    max-width: 100%;
}

/* Imagen que todavía no existe: no se ve el ícono roto */
.missing {
    visibility: hidden;
}

.stage {
    display: grid;
    grid-template-columns: calc(232 * var(--s)) minmax(0, 1fr) calc(226 * var(--s));
    column-gap: calc(18 * var(--s));
    align-items: start;
    width: min(100%, 1600px);
    margin: 0 auto;
    /* el espacio de abajo hace que la página se pueda scrollear */
    padding: calc(66 * var(--s)) calc(28 * var(--s)) calc(300 * var(--s)) calc(34 * var(--s));
}

.col {
    min-width: 0;
}

.text {
    margin: 0;
}

/* ---------- Izquierda ---------- */
.col-left {
    display: flex;
    flex-direction: column;
    gap: calc(12 * var(--s));
}

.col-left > .text {
    margin-top: calc(6 * var(--s));
}

.ame {
    position: relative;
}

.ame-img {
    display: block;
    width: 100%;
    height: auto; /* anula el height="" del HTML para que valga la proporción */
    aspect-ratio: 230 / 163; /* provisoria: el script la reemplaza por la de tu imagen */
    object-fit: cover;
    background: #e4dcf0;
}

/* Zona clickeable de la cabeza (en % de la ventana). Ajustala si hace falta:
   abrí la página con ?hitbox al final de la URL para verla marcada. */
.head-hit {
    position: absolute;
    left: 26%;
    top: 17%;
    width: 39%;
    height: 46%;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.head-hit:focus-visible {
    outline: 3px solid var(--lilac);
    outline-offset: 2px;
}

.debug .head-hit {
    outline: 2px dashed #e5484d;
    background: rgba(229, 72, 77, 0.18);
}

/* Tocar rápido (doble/triple click) no debe seleccionar ni arrastrar nada,
   ni dejar marcada la zona de la cabeza */
.ame,
.player {
    -webkit-user-select: none;
    user-select: none;
}

.ame img,
.player img {
    -webkit-user-drag: none;
    user-drag: none;
}

button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.head-hit:focus:not(:focus-visible) {
    outline: none;
}

.hornet {
    position: absolute;
    left: 62%;
    top: calc(-52 * var(--s));
    width: calc(56 * var(--s));
    pointer-events: none;
    z-index: 1;
}

/* Reproductor */
.player {
    display: flex;
    align-items: center;
    gap: calc(14 * var(--s));
    padding: calc(8 * var(--s)) calc(14 * var(--s)) calc(8 * var(--s)) calc(8 * var(--s));
    border-radius: calc(14 * var(--s));
    background: var(--card);
    color: #f2f2f5;
}

.album {
    flex: none;
    width: calc(52 * var(--s));
    height: calc(52 * var(--s));
    border-radius: calc(8 * var(--s));
    object-fit: cover;
    background: #15141a;
}

.player-body {
    min-width: 0;
}

.track {
    margin: 0 0 calc(6 * var(--s));
    font-size: calc(12.5 * var(--s));
    font-weight: 500;
    line-height: 1.3;
}

.controls {
    display: flex;
    align-items: center;
    gap: calc(26 * var(--s));
}

.icon-btn,
.play-btn {
    display: grid;
    place-items: center;
    width: calc(24 * var(--s));
    height: calc(24 * var(--s));
    padding: 0;
    border: 0;
    color: inherit;
    background: none;
    cursor: pointer;
}

.play-btn {
    border-radius: 50%;
    background: #f2f2f5;
    color: var(--card);
}

.play-btn svg {
    width: 66%;
    height: 66%;
}

.icon-btn svg {
    width: 100%;
    height: 100%;
}

.icon-btn .x,
.play-btn .i-pause {
    display: none;
}

.icon-btn[aria-pressed="true"] .waves {
    display: none;
}

.icon-btn[aria-pressed="true"] .x,
.play-btn[data-state="playing"] .i-pause {
    display: inline;
}

.play-btn[data-state="playing"] .i-play {
    display: none;
}

.icon-btn:focus-visible,
.play-btn:focus-visible {
    outline: 2px solid #f2f2f5;
    outline-offset: 2px;
}

/* ---------- Centro ---------- */
/* El título se ajusta al ancho de la columna: así el avatar entra al lado
   del nombre en vez de caer a una segunda línea (que dejaba un hueco). */
.col-center {
    container-type: inline-size;
}

h1 {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0 calc(8 * var(--s));
    margin: 0 0 calc(4 * var(--s));
    font-size: calc(40 * var(--s)); /* respaldo si el navegador no soporta cqw */
    font-size: min(calc(46 * var(--s)), 13.2cqw);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

/* Con avatar visible, el nombre se achica un poco para dejarle lugar */
h1:has(.avatar:not(.missing)) {
    font-size: min(calc(46 * var(--s)), 10.4cqw);
}

.avatar {
    flex: none;
    width: calc(48 * var(--s));
    height: calc(48 * var(--s));
    object-fit: contain;
    image-rendering: pixelated;
}

.avatar.missing {
    display: none; /* si no hay avatar, no ocupa lugar */
}

.playground {
    margin-top: calc(16 * var(--s));
}

.sprite {
    position: absolute;
    image-rendering: pixelated;
}

/* Mario: fijo al borde inferior, a la misma altura que el peek */
.mario {
    position: fixed;
    left: calc(128 * var(--s));
    bottom: calc(-5 * var(--s));
    width: calc(52 * var(--s));
    pointer-events: none;
    z-index: 4;
}

/* Tostada: el script la apoya sobre el banner de Arena Breakout (.banner-wrap) */
.toast {
    display: none;
}

.banner-wrap {
    position: relative;
}

.banner-wrap > .toast {
    display: block;
    right: 10%;
    bottom: calc(104% - 10 * var(--s));
    width: calc(64 * var(--s));
}

/* GIF: justo debajo del texto, centrado */
.gif {
    width: min(calc(184 * var(--s)), 60%);
    aspect-ratio: 1;
    margin: 0 auto;
    position: relative;
    left: calc(80 * var(--s));
    top: calc(0 * var(--s));
    border-radius: 50%;
    overflow: hidden;
    background: var(--lilac);
}

.gif img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- Derecha ---------- */
.cover {
    display: block;
    width: 100%;
    border-radius: calc(8 * var(--s));
    object-fit: cover;
    background: var(--soft);
}

.banner {
    aspect-ratio: 225 / 103;
}

.games {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(15 * var(--s));
    margin: calc(15 * var(--s)) 0 0;
    padding: 0;
    list-style: none;
}

.games .cover {
    aspect-ratio: 105 / 157;
}

/* ---------- Peek: fijo al borde inferior de la pantalla ---------- */
/* La imagen se muestra entera, sin recortes.
   --peek-hide: cuánto queda escondido bajo el borde (0% = se ve completa).
   bottom: cuánto se levanta del borde de la pantalla. */
.peek {
    --peek-hide: 0%;
    position: fixed;
    left: calc(24 * var(--s));
    bottom: calc(-3 * var(--s));
    width: calc(84 * var(--s));
    transform: translateY(var(--peek-hide));
    pointer-events: none;
    z-index: 5;
}

.peek img {
    display: block;
    width: 100%;
    height: auto;
}

/* ---------- Mobile: una columna ---------- */
@media (max-width: 820px) {
    :root {
        --s: calc(100vw / 330);
    }

    .stage {
        grid-template-columns: 1fr;
        row-gap: calc(28 * var(--s));
        width: 100%;
        padding: calc(70 * var(--s)) calc(24 * var(--s)) calc(260 * var(--s));
    }

    .col-center {
        order: -1;
        margin-bottom: calc(36 * var(--s)); /* deja lugar a Hornet sobre la ventana */
    }

}