/* Демо-сайт провайдера (решение 70): тёмный лес, тёплое дерево и листва в духе Grove Run. Стиль самой игры
   задаёт клиент в iframe; здесь только витрина и окно вокруг него. */
@font-face {
    font-family: "Golos Text";
    src: url("/golos-latin.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    unicode-range:
        U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+20A0-20AB, U+20AD-20C0, U+2113,
        U+2C60-2C7F, U+A720-A7FF, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Golos Text";
    src: url("/golos-cyrillic.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: Lora;
    src: url("/lora-latin.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    unicode-range:
        U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+20A0-20AB, U+20AD-20C0, U+2113,
        U+2C60-2C7F, U+A720-A7FF, U+FEFF, U+FFFD;
}
@font-face {
    font-family: Lora;
    src: url("/lora-cyrillic.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
    color-scheme: dark;
    --forest: #0b1f17;
    --forest-deep: #07150f;
    --panel: #11281d;
    --panel-edge: rgba(156, 207, 92, 0.22);
    --leaf: #9ccf5c;
    --leaf-deep: #5f9a34;
    --gold: #f2c14e;
    --bark: #6b4a2b;
    --cream: #f3ead2;
    --muted: #b8c9b4;
    --danger: #f0a070;
    --ui: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
    --serif: Lora, Georgia, "Times New Roman", serif;
    font-family: var(--ui);
    background: var(--forest);
    color: var(--cream);
    line-height: 1.5;
}

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

html.game-open {
    /* Страница под окном игры не прокручивается. */
    overflow: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 20% -10%, rgba(156, 207, 92, 0.12), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(242, 193, 78, 0.08), transparent 55%),
        var(--forest);
}

[hidden] {
    display: none !important;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
}

svg {
    flex: none;
}

.site-header,
main,
.site-footer {
    width: min(1240px, 100%);
    margin: 0 auto;
    padding-inline: 16px;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-block: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--cream);
    text-decoration: none;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.brand-mark {
    width: 32px;
    height: 32px;
}

.brand-mark path {
    fill: var(--leaf);
}

.brand-mark .vein {
    fill: none;
    stroke: var(--forest);
    stroke-width: 2;
    stroke-linecap: round;
}

.brand-name {
    font-size: 1.15rem;
}

.brand-badge {
    padding: 2px 8px;
    border: 1px solid var(--panel-edge);
    border-radius: 999px;
    color: var(--leaf);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.language {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--panel-edge);
    border-radius: 999px;
    background: var(--panel);
}

.language button {
    min-width: 44px;
    min-height: 36px;
    padding: 4px 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
}

.language button[aria-pressed="true"] {
    background: var(--leaf-deep);
    color: var(--cream);
}

.game-card {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--panel-edge);
    border-radius: 20px;
    background: linear-gradient(160deg, #163423, var(--panel) 55%, var(--forest-deep));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.cover {
    position: relative;
    display: block;
    background: var(--forest-deep);
}

/* Видео забега лежит поверх обложки того же размера (решение 71): пока оно не началось, видна обложка. */
.cover-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 24px 20px 28px;
}

.eyebrow {
    margin: 0;
    color: var(--leaf);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

h1,
h2,
h3 {
    font-family: var(--serif);
    font-weight: 700;
    line-height: 1.15;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.25rem);
}

.lead {
    margin: 0;
    max-width: 46ch;
    color: var(--cream);
    font-size: 1.05rem;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tags li {
    padding: 4px 12px;
    border: 1px solid var(--panel-edge);
    border-radius: 999px;
    background: rgba(7, 21, 15, 0.55);
    color: var(--muted);
    font-size: 0.85rem;
}

.play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 12px 28px;
    border: 1px solid #c8e88f;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--leaf), var(--leaf-deep));
    box-shadow:
        0 8px 24px rgba(95, 154, 52, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    color: #10210f;
    font-size: 1.1rem;
    font-weight: 800;
}

.play svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.play:hover {
    filter: brightness(1.08);
}

.fine {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.how {
    padding-block: 40px 16px;
}

.how h2 {
    margin: 0 0 16px;
    font-size: 1.75rem;
}

.how ol {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.how li {
    position: relative;
    padding: 20px 20px 20px 72px;
    border: 1px solid var(--panel-edge);
    border-radius: 16px;
    background: var(--panel);
    counter-increment: step;
}

.how li::before {
    content: counter(step);
    position: absolute;
    top: 20px;
    left: 20px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bark);
    color: var(--gold);
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 700;
}

.how h3 {
    margin: 0 0 6px;
    font-size: 1.2rem;
}

.how p {
    margin: 0;
    color: var(--muted);
}

.site-footer {
    padding-block: 24px 40px;
    color: var(--muted);
    font-size: 0.85rem;
}

.site-footer p {
    margin: 0;
    padding-top: 16px;
    border-top: 1px solid var(--panel-edge);
}

@media (min-width: 960px) {
    .game-card {
        grid-template-columns: 1.4fr 1fr;
        align-items: stretch;
    }

    .cover img {
        height: 100%;
        aspect-ratio: auto;
        min-height: 420px;
    }

    .details {
        justify-content: center;
        padding: 40px;
    }

    .how ol {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Окно игры. На компьютере большое окно поверх затемнённой страницы, на телефоне весь экран. */
.game-dialog {
    width: min(1440px, calc(100vw - 48px));
    height: min(900px, calc(100vh - 48px));
    height: min(900px, calc(100dvh - 48px));
    max-width: none;
    max-height: none;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--panel-edge);
    border-radius: 16px;
    background: var(--forest);
    color: var(--cream);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    overscroll-behavior: contain;
}

.game-dialog::backdrop {
    background: rgba(4, 12, 8, 0.8);
}

.game-dialog.expanded {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
}

.game-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: var(--forest);
}

.game-shell:fullscreen {
    width: 100vw;
    height: 100vh;
}

.game-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 8px 0 16px;
    border-bottom: 1px solid var(--panel-edge);
    background: var(--panel);
}

.game-bar-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    margin: 0 auto 0 0;
    overflow: hidden;
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 700;
    white-space: nowrap;
}

.game-bar-note {
    overflow: hidden;
    color: var(--muted);
    font-family: var(--ui);
    font-size: 0.8rem;
    font-weight: 500;
    text-overflow: ellipsis;
}

.bar-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid var(--panel-edge);
    border-radius: 10px;
    background: var(--forest-deep);
    font-size: 0.9rem;
    font-weight: 600;
}

.bar-button:hover {
    border-color: var(--leaf);
}

.bar-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bar-button .to-collapse,
.bar-button.on .to-expand {
    display: none;
}

.bar-button.on .to-collapse {
    display: inline;
}

.game-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    background: var(--forest-deep);
}

.game-stage iframe {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Слой до started и при ошибке: обложка игры вместо пустого прямоугольника. */
.overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background:
        linear-gradient(rgba(7, 21, 15, 0.74), rgba(7, 21, 15, 0.9)),
        url("/cover-640.webp") 40% center / cover;
    text-align: center;
}

.overlay-text {
    max-width: 36ch;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.overlay.failed .spinner {
    display: none;
}

.overlay.failed .overlay-text {
    color: var(--danger);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(156, 207, 92, 0.25);
    border-top-color: var(--leaf);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

.confirm {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(4, 12, 8, 0.72);
}

.confirm-box {
    width: min(440px, 100%);
    padding: 24px;
    border: 1px solid var(--panel-edge);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.confirm-box p {
    margin: 0 0 20px;
}

.confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.confirm-actions .play {
    min-height: 44px;
    padding: 8px 20px;
    font-size: 1rem;
}

@media (max-width: 720px), (max-height: 560px) {
    .game-dialog {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }
}

@media (max-width: 480px) {
    .game-bar-note {
        display: none;
    }

    /* Подписи кнопок остаются доступными именами, на узком экране видны только значки. */
    .bar-button span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .bar-button {
        min-width: 44px;
        min-height: 40px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .details .play {
        align-self: stretch;
    }
}

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation: none;
    }
}
