@font-face {
    font-family: "Agdasima";
    src: url("../fonts/agdasima.woff") format("woff");
    font-display: swap;
}

:root {
    color-scheme: dark;
    --primary: #84b9ff;
    --text: #fff;
    --surface: rgba(2, 7, 16, 0.82);
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.72);
}

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

html {
    min-width: 320px;
    background: #030812;
}

body {
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    overflow-x: clip;
    color: var(--text);
    font-family: "Agdasima", system-ui, sans-serif;
    font-size: 1.15rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 4px;
}

.fullscreen-image {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: #030812;
}

.fullscreen-image::after {
    position: absolute;
    inset: 0;
    content: "";
    background: rgba(0, 0, 0, 0.18);
}

.fullscreen-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-header {
    width: min(100% - 32px, 1100px);
    margin: 18px auto 0;
    text-align: center;
}

.game-header > a {
    display: inline-block;
    max-width: min(75vw, 680px);
}

.game-title {
    width: auto;
    max-width: 100%;
    max-height: 280px;
    margin: 0 auto;
    object-fit: contain;
}

.game-header h1 {
    margin: 24px 0;
    color: var(--primary);
    font-size: clamp(2.6rem, 8vw, 5.5rem);
    line-height: 1;
    text-shadow: 0 4px #000;
}

.game-badges {
    display: flex;
    justify-content: center;
    margin: 14px 0 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.badge {
    display: inline-block;
    padding: 8px 22px;
    border-radius: 999px;
    color: #fff;
    font-family: system-ui, sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.45);
    text-transform: uppercase;
}

.badge-prototype { background: #237d35; }
.badge-patreon { background: #c52d2d; }

.trailer-container {
    width: min(100% - 32px, 800px);
    aspect-ratio: 16 / 9;
    margin: 28px auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #03060c;
    box-shadow: var(--shadow);
}

.trailer-placeholder,
.trailer-frame {
    width: 100%;
    height: 100%;
    border: 0;
}

.trailer-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    color: #fff;
    background:
        radial-gradient(circle at center, rgba(132, 185, 255, 0.2), transparent 42%),
        linear-gradient(145deg, #101925, #02050a);
    cursor: pointer;
    flex-direction: column;
    gap: 12px;
    font-size: clamp(1.5rem, 4vw, 2.15rem);
    font-weight: 700;
    text-transform: uppercase;
}

.play-icon {
    display: grid;
    width: 72px;
    height: 72px;
    padding-left: 6px;
    border: 2px solid #fff;
    border-radius: 50%;
    place-items: center;
    transition: transform 150ms ease, background-color 150ms ease;
}

.store-links {
    display: flex;
    width: min(100% - 32px, 1100px);
    margin: 34px auto;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
}

.store-links a {
    width: min(43vw, 240px);
}

.store-links img {
    width: 100%;
    transition: filter 130ms ease, transform 130ms ease;
}

.game-content {
    display: grid;
    width: min(100% - 40px, 1080px);
    margin: 38px auto 60px;
    align-items: start;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 52px;
}

.game-description {
    min-width: 0;
    padding: clamp(20px, 3vw, 34px);
    background: var(--surface);
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.25);
}

.game-description h2 {
    margin: 0 0 20px;
    color: var(--primary);
    font-size: clamp(1.9rem, 4vw, 2.35rem);
    line-height: 1.18;
}

.long-description {
    color: #fff;
    font-size: clamp(1.28rem, 2vw, 1.65rem);
    overflow-wrap: anywhere;
}

.long-description > :first-child { margin-top: 0; }
.long-description > :last-child { margin-bottom: 0; }
.long-description div { margin: 0 0 14px; }
.long-description p { margin: 0 0 18px; }

.long-description img {
    width: min(100%, 680px);
    margin: 24px auto;
    background: #000;
    box-shadow: var(--shadow);
}

.long-description h3 {
    margin: 30px 0 14px;
    color: var(--primary);
    font-size: clamp(1.7rem, 3vw, 2rem);
}

.long-description ul,
.long-description ol {
    margin: 16px 0;
    padding-left: 30px;
}

.long-description li { margin-bottom: 8px; }

.long-description a {
    color: #74c0fc;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.screenshot-gallery {
    display: grid;
    gap: 16px;
}

.screenshot-button {
    width: 100%;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #05080e;
    box-shadow: var(--shadow);
    cursor: zoom-in;
}

.screenshot-button img {
    width: 100%;
    transition: filter 140ms ease, transform 180ms ease;
}

.image-modal {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    padding: 58px 20px 20px;
    overflow: hidden;
    border: 0;
    background: rgba(0, 0, 0, 0.94);
}

.image-modal::backdrop { background: rgba(0, 0, 0, 0.92); }

.modal-image {
    width: 100%;
    height: 100%;
    margin: auto;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: max(8px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 2;
    display: grid;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(30, 30, 30, 0.82);
    cursor: pointer;
    font-family: system-ui, sans-serif;
    font-size: 2rem;
    line-height: 1;
    place-items: center;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

.image-modal.loaded .loading-spinner { display: none; }

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (hover: hover) {
    .trailer-placeholder:hover .play-icon {
        background: rgba(132, 185, 255, 0.28);
        transform: scale(1.08);
    }

    .store-links a:hover img {
        filter: brightness(1.25);
        transform: translateY(-2px);
    }

    .screenshot-button:hover img {
        filter: brightness(1.35);
        transform: scale(1.02);
    }
}

@media (max-width: 900px) {
    .game-content {
        width: min(100% - 28px, 720px);
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .screenshot-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    body { font-size: 1.1rem; }

    .game-header {
        width: min(100% - 20px, 1100px);
        margin-top: 12px;
    }

    .game-header > a {
        max-width: 92vw;
    }

    .game-title {
        max-height: 300px;
    }

    .badge {
        padding: 8px 16px;
        font-size: 0.84rem;
    }

    .trailer-container {
        width: min(100% - 20px, 800px);
        margin: 22px auto;
    }

    .play-icon {
        width: 60px;
        height: 60px;
    }

    .store-links {
        display: grid;
        width: min(100% - 28px, 340px);
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .store-links a {
        width: 100%;
    }

    .game-content {
        width: min(100% - 20px, 720px);
        margin-top: 28px;
    }

    .game-description {
        padding: 22px 17px 26px;
    }

    .game-description h2 {
        font-size: 1.8rem;
        text-align: left;
    }

    .long-description {
        font-size: 1.25rem;
        line-height: 1.58;
    }

    .long-description ul,
    .long-description ol {
        padding-left: 24px;
    }

    .screenshot-gallery {
        grid-template-columns: minmax(0, 1fr);
    }

    .screenshot-button img {
        width: 100%;
    }
}

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