/* Same Roboto files the site loads from assets/fonts/Roboto. */
@font-face {
    font-family: "Roboto";
    src: url("../fonts/Roboto-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Roboto";
    src: url("../fonts/Roboto-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Roboto";
    src: url("../fonts/Roboto-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Roboto";
    src: url("../fonts/Roboto-ExtraBold.woff2") format("woff2");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

/* Palettes mirror scss/helpers/themes/_{skin}-palettes.scss. */
[data-skin="latamwin"] {
    --bg-from: #1e0635;
    --bg-to: #29084a;
    --glow-1: rgba(131, 79, 201, 0.45);
    --glow-2: rgba(66, 13, 122, 0.7);
    --accent: #ffa727;
    --on-accent: #25252b;
    --text-heading: #ffffff;
    --text-body: #d8c1f0;
    --text-muted: #af88dd;
    --glass-bg: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.14);
}

[data-skin="winchile"] {
    --bg-from: #0c0c0e;
    --bg-to: #132243;
    --glow-1: rgba(0, 71, 255, 0.4);
    --glow-2: rgba(23, 53, 104, 0.6);
    --accent: #4775ff;
    --on-accent: #ffffff;
    --text-heading: #f3f4f6;
    --text-body: #abafbe;
    --text-muted: #9095a9;
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
}

[data-skin="pokerenchile"] {
    --bg-from: #0c0c0e;
    --bg-to: #25252b;
    --glow-1: rgba(188, 0, 0, 0.32);
    --glow-2: rgba(102, 26, 26, 0.35);
    --accent: #ffb744;
    --on-accent: #121216;
    --text-heading: #eeeef2;
    --text-body: #b8b8c8;
    --text-muted: #8a8a99;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

[data-skin="casinoenchile"] {
    --bg-from: #0c0c0e;
    --bg-to: #25252b;
    --glow-1: rgba(228, 167, 0, 0.12);
    --glow-2: rgba(255, 255, 255, 0.04);
    --accent: #eeba2d;
    --on-accent: #121216;
    --text-heading: #eeeef2;
    --text-body: #b8b8c8;
    --text-muted: #8a8a99;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

html,
body {
    min-height: 100%;
}

body {
    position: relative;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    overflow-x: hidden;
    font-family:
        Roboto,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: linear-gradient(
        160deg,
        var(--bg-from) 0%,
        var(--bg-to) 100%
    );
    background-color: var(--bg-from);
    color: var(--text-heading);
    -webkit-font-smoothing: antialiased;
}

/* Ambient glows + dot grid. */
body::before,
body::after {
    content: "";
    position: fixed;
    z-index: 0;
    border-radius: 9999px;
    filter: blur(90px);
    pointer-events: none;
}

body::before {
    top: -15%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    max-width: 720px;
    max-height: 720px;
    background: var(--glow-1);
}

body::after {
    bottom: -20%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    max-height: 600px;
    background: var(--glow-2);
}

.grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image: radial-gradient(
        rgba(255, 255, 255, 0.08) 1px,
        transparent 1px
    );
    background-size: 28px 28px;
    mask-image: radial-gradient(
        ellipse at center,
        #000 30%,
        transparent 75%
    );
    -webkit-mask-image: radial-gradient(
        ellipse at center,
        #000 30%,
        transparent 75%
    );
    pointer-events: none;
}

.header,
.main,
.footer {
    position: relative;
    z-index: 1;
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 0;
}

.logo {
    max-width: 180px;
    max-height: 44px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.main {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 32px;
}

.hero {
    display: grid;
    width: 100%;
    max-width: 1080px;
    grid-template-columns: 1fr;
    grid-template-areas:
        "visual"
        "content"
        "eta";
    align-items: center;
    justify-items: center;
    gap: 24px;
}

.hero > .visual {
    grid-area: visual;
}

.hero > .content {
    grid-area: content;
    width: 100%;
}

.hero > .eta {
    grid-area: eta;
}

.visual {
    position: relative;
    display: flex;
    justify-content: center;
}

.visual::before {
    content: "";
    position: absolute;
    bottom: 4%;
    left: 50%;
    width: 70%;
    height: 14%;
    transform: translateX(-50%);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    filter: blur(14px);
    animation: shadow 4s ease-in-out infinite;
}

.illustration {
    position: relative;
    width: 100%;
    max-width: 260px;
    height: auto;
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-12px);
    }
}

@keyframes shadow {
    0%,
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) scale(0.85);
        opacity: 0.6;
    }
}

.content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

/*
 * Mirrors ui-latamwin <Label colorScheme="secondary" size="lg" />:
 * bg-revamp-warning-default, text-revamp-neutral-text-light,
 * rounded, h-6, px-1, text-sm, font-normal.
 */
.badge {
    display: inline-flex;
    height: 24px;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border-radius: 4px;
    background-color: #e17a0d;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 400;
    white-space: nowrap;
}

.title {
    font-size: clamp(2rem, 6vw, 3.25rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--text-heading);
}

.title span {
    color: var(--accent);
}

.description {
    max-width: 460px;
    font-size: clamp(1rem, 2.2vw, 1.125rem);
    line-height: 1.6;
    color: var(--text-body);
}

.eta {
    display: flex;
    width: 100%;
    max-width: 460px;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background-color: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.eta-label {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.eta-text {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-body);
}

.eta-text strong {
    color: var(--text-heading);
}

.countdown {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.countdown[hidden] {
    display: none;
}

.unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px;
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.22);
}

.unit-value {
    font-size: clamp(1.375rem, 5vw, 1.75rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    color: var(--text-heading);
}

.unit-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.footer {
    padding: 0 16px 24px;
    font-size: 0.8125rem;
    text-align: center;
    color: var(--text-muted);
}

/* Embedded mini game */
.game {
    display: flex;
    width: 100%;
    max-width: 460px;
    flex-direction: column;
    gap: 10px;
}

/* No frame: the canvas is transparent over the page background. */
.game-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 320 / 192;
    image-rendering: pixelated;
    touch-action: none;
    cursor: pointer;
}

.game-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.game-fullscreen {
    display: inline-flex;
    height: 32px;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 0 10px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--glass-bg);
    color: var(--text-heading);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.game-fullscreen svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.game-fullscreen:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/*
 * Fullscreen: same page background, game centered and as large as
 * fits. .game--expanded is the fallback where the Fullscreen API
 * is missing (iPhone). Rules are split: an unknown selector would
 * drop the whole list.
 */
.game--expanded {
    position: fixed;
    inset: 0;
    z-index: 20;
}

.game:fullscreen {
    --game-width: min(
        calc(100vw - 32px),
        calc((100vh - 150px) * 320 / 192)
    );
    max-width: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: linear-gradient(
        160deg,
        var(--bg-from) 0%,
        var(--bg-to) 100%
    );
}

.game:-webkit-full-screen {
    --game-width: min(
        calc(100vw - 32px),
        calc((100vh - 150px) * 320 / 192)
    );
    width: 100%;
    height: 100%;
    max-width: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: linear-gradient(
        160deg,
        var(--bg-from) 0%,
        var(--bg-to) 100%
    );
}

.game--expanded {
    --game-width: min(
        calc(100vw - 32px),
        calc((100dvh - 150px) * 320 / 192)
    );
    max-width: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: linear-gradient(
        160deg,
        var(--bg-from) 0%,
        var(--bg-to) 100%
    );
}

.game:fullscreen > * {
    width: var(--game-width);
}

.game--expanded > * {
    width: var(--game-width);
}

.game:-webkit-full-screen > * {
    width: var(--game-width);
}

.game-canvas:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.game-help {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Touch devices: auto-run, tap to jump (no on-screen buttons). */
.game-help-touch {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .game-help-keys {
        display: none;
    }

    .game-help-touch {
        display: block;
    }
}

/* Mobile: compact sizes so the page fits without feeling huge. */
@media (max-width: 640px) {
    .header {
        padding: 14px 16px 0;
    }

    .logo {
        max-width: 130px;
        max-height: 32px;
    }

    .main {
        align-items: flex-start;
        padding: 12px 16px 20px;
    }

    .hero {
        gap: 16px;
    }

    .illustration {
        max-width: 120px;
    }

    .content {
        gap: 12px;
    }

    .title {
        font-size: 1.625rem;
        line-height: 1.12;
    }

    .description {
        font-size: 0.9375rem;
        line-height: 1.5;
    }

    .game {
        gap: 6px;
    }

    .game-help {
        font-size: 0.75rem;
    }

    .game-fullscreen {
        height: 28px;
        padding: 0 8px;
        font-size: 0.75rem;
    }

    .eta {
        gap: 10px;
        padding: 14px;
        border-radius: 12px;
    }

    .eta-label {
        font-size: 0.75rem;
    }

    .eta-text {
        font-size: 0.875rem;
    }

    .countdown {
        gap: 6px;
    }

    .unit {
        padding: 8px 2px;
        border-radius: 10px;
    }

    .unit-value {
        font-size: 1.25rem;
    }

    .unit-label {
        font-size: 0.625rem;
    }

    .footer {
        padding: 0 16px 16px;
        font-size: 0.75rem;
    }
}

@media (min-width: 860px) {
    /* Text + game on the left; fox with the countdown on the right. */
    .hero {
        grid-template-columns: 1.1fr 0.9fr;
        grid-template-areas:
            "content visual"
            "content eta";
        grid-template-rows: auto 1fr;
        column-gap: 48px;
        row-gap: 16px;
    }

    .hero > .eta {
        align-self: start;
    }

    .content {
        align-items: flex-start;
        text-align: left;
    }

    .illustration {
        max-width: 340px;
    }

    .header {
        justify-content: flex-start;
        max-width: 1112px;
        width: 100%;
        margin: 0 auto;
        padding-top: 32px;
    }
}

/*
 * Loading screen: html.is-loading is added by js/skin.js and removed by
 * js/maintenance.js once the skin images are loaded.
 */
.loader {
    display: none;
}

.is-loading .loader {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--bg-from) 0%, var(--bg-to) 100%);
    background-color: var(--bg-from);
}

.is-loading .header,
.is-loading .main,
.is-loading .footer {
    visibility: hidden;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .illustration,
    .visual::before {
        animation: none;
    }

    .loader-spinner {
        animation-duration: 2s;
    }
}
