html {
    scroll-behavior: smooth;
}

:root {
    --cta-color: #ee5e11;
    --cta-color-hover: #c55011;
    --top-bar-height: 82px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #111;
    color: #eee;
}

body.game-modal-open {
    overflow: hidden;
    overscroll-behavior: none;
}

.hidden {
    display: none !important;
}

/* Header */
.top-bar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    width: 100%;
    min-height: var(--top-bar-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid rgba(238, 94, 17, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    will-change: min-height, padding, background-color;
}

.top-bar .container {
    width: 100%;
    max-width: 1200px;
    min-height: var(--top-bar-height);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    will-change: min-height;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo img {
    display: block;
    width: auto;
    height: 3rem;
    max-width: min(40vw, 280px);
    object-fit: contain;
    will-change: height;
}

.menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
}

.menu a {
    color: var(--cta-color);
    font-size: 1.4rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.25s ease;
}

.menu a:hover,
.menu a:focus-visible {
    color: #ff7a2f;
}

/* Hero */
.highlight {
    position: relative;
    min-height: min(100vh, 1080px);
    overflow: hidden;
    background: #080808;
}

.highlight video {
    display: block;
    width: 100%;
    height: 100vh;
    object-fit: cover;
}

.highlight::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.08);
}

.highlight-overlay {
    position: absolute;
    inset: auto 0 clamp(20px, 5vh, 50px);
    z-index: 2;
    display: flex;
    justify-content: center;
    padding: 0 20px;
}

.button.cta {
    display: inline-flex;
    min-height: 48px;
    padding: 12px 20px;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: var(--cta-color);
    color: #fff;
    font-size: 1.2rem;
    text-decoration: none;
    transition: transform 0.25s ease, background-color 0.25s ease;
}

.button.cta:hover {
    background: var(--cta-color-hover);
    transform: translateY(-2px);
}

.welcome {
    padding: 28px 20px 18px;
    color: #ff7a2f;
    text-align: center;
}

/* Games */
.games {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
    padding: 40px 0;
}

.game-card {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 14px;
    background: #080808;
    cursor: pointer;
    outline: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.game-card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #080808;
}

.game-cover,
.game-preview,
.gif-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background: #080808;
}

.game-preview,
.gif-fallback {
    display: none;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

.game-card:focus-visible {
    outline: 3px solid var(--cta-color);
    outline-offset: 4px;
}

/* Modal */
.game-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(18px, 4vw, 64px);
    visibility: hidden;
    pointer-events: none;
}

.game-modal.is-visible {
    visibility: visible;
    pointer-events: auto;
}

.game-modal__backdrop {
    position: absolute;
    inset: 0;
    opacity: 0;
    background:
        radial-gradient(circle at 50% 15%, rgba(238, 94, 17, 0.15), transparent 38%),
        rgba(4, 4, 4, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: opacity 0.38s ease;
}

.game-modal.is-open .game-modal__backdrop {
    opacity: 1;
}

.game-modal__panel {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
    grid-template-rows: auto minmax(0, 1fr);
    width: min(1180px, 100%);
    max-height: calc(100dvh - 80px);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 28px;
    background: linear-gradient(145deg, #242424, #0d0d0d);
    box-shadow: 0 30px 90px rgba(0,0,0,0.7);
    opacity: 0;
    transform:
        translate(var(--modal-start-x, 0), var(--modal-start-y, 40px))
        scale(var(--modal-start-scale-x, 0.8), var(--modal-start-scale-y, 0.8));
    transform-origin: center;
    transition:
        transform 0.58s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.3s ease,
        border-radius 0.58s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform, opacity;
}

.game-modal.is-open .game-modal__panel {
    opacity: 1;
    transform: translate(0, 0) scale(1);
}

.game-modal__close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 5;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 50%;
    background: rgba(0,0,0,0.58);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.game-modal__close span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 19px;
    height: 2px;
    background: currentColor;
}

.game-modal__close span:first-child {
    transform: translate(-50%, -50%) rotate(45deg);
}

.game-modal__close span:last-child {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.game-modal__media {
    position: relative;
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-width: 0;
    overflow: hidden;
    background: #050505;
}

.game-modal__video,
.game-modal__image {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background: #050505;
}

.game-modal__video.is-active,
.game-modal__image.is-active {
    display: block;
}

.game-modal__header {
    grid-column: 1 / -1;
    grid-row: 1;
    padding: clamp(34px, 4vw, 54px) clamp(38px, 4vw, 62px) 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.game-modal__content {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    overflow-y: auto;
    padding: clamp(30px, 3.5vw, 48px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.game-modal__label {
    margin: 0 0 10px;
    color: var(--cta-color);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.game-modal__title {
    margin: 0;
    color: #fff;
    font-size: clamp(2.4rem, 4vw, 1.8rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.game-modal__producer {
    display: none;
    margin: 14px 0 0;
    color: rgba(255,255,255,0.65);
}

.game-modal__producer.is-visible {
    display: block;
}

.game-modal__producer::before {
    content: "By ";
    color: rgba(255,255,255,0.4);
}

.game-modal__description {
    display: none;
    margin-top: 0;
    color: rgba(255,255,255,0.78);
    font-size: 1.05rem;
    line-height: 1.7;
}

.game-modal__description.is-visible {
    display: block;
}

.game-modal__links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.game-modal__links a {
    min-height: 48px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 12px;
    background: rgba(255,255,255,0.07);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    text-transform: capitalize;
}

.game-modal__links a:first-child {
    border-color: transparent;
    background: var(--cta-color);
}

.game-modal__links img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

/* About */
.member-desc {
    max-width: 760px;
    margin: 0 auto;
    padding: 60px 20px 20px;
    text-align: center;
}

.member-desc h2 {
    margin-top: 0;
    font-size: clamp(2rem, 4vw, 3.2rem);
}

.member-desc p {
    color: rgba(255,255,255,0.72);
    line-height: 1.7;
}

.members {
    max-width: 1200px;
    margin: 0 auto;
}

.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 32px;
}

.member-card {
    padding: 16px;
    border-radius: 10px;
    background: #1c1c1c;
    text-align: center;
    cursor: pointer;
}

.member-card img {
    width: 84px;
    height: 84px;
    margin-bottom: 10px;
    object-fit: cover;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.member-card:hover img {
    transform: scale(1.08);
}

.member-company {
    margin-top: 5px;
    color: rgba(255,255,255,0.56);
    font-size: 0.88rem;
}

/* Footer */
.site-footer {
    padding: 50px 20px;
    background: #181818;
    text-align: center;
}

.site-footer a {
    color: var(--cta-color);
    text-decoration: none;
}

.footer-content {
    max-width: 760px;
    margin: 0 auto;
}

.social-links {
    margin: 20px 0;
}

.social-links a {
    display: inline-block;
    margin: 0 8px;
}

.social-links img {
    width: 30px;
    height: 30px;
}

/* Węższy desktop / tablet poziomy */
@media (min-width: 769px) and (max-width: 1024px) {
    .game-modal__panel {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        width: min(860px, 100%);
    }

    .game-modal__header {
        grid-column: 1;
        grid-row: 1;
        padding: 28px 32px 20px;
    }

    .game-modal__media {
        grid-column: 1;
        grid-row: 2;
        width: 100%;
        aspect-ratio: 16 / 9;
    }

    .game-modal__content {
        grid-column: 1;
        grid-row: 3;
        padding: 26px 32px 34px;
    }

    .game-modal__title {
        font-size: clamp(2rem, 5vw, 3.4rem);
    }
}

/* Tablet */
@media (max-width: 1279px) {
    :root {
        --top-bar-height: 74px;
    }

    .logo img {
        height: 2.6rem;
    }

    .menu a {
        font-size: 1.15rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --top-bar-height: 64px;
    }

    .top-bar {
        padding: 0 14px;
    }

    .top-bar .container {
        gap: 12px;
    }

    .logo img {
        height: 2.1rem;
        max-width: 38vw;
    }

    .menu {
        gap: 10px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .menu::-webkit-scrollbar {
        display: none;
    }

    .menu a {
        flex-shrink: 0;
        font-size: 0.95rem;
        white-space: nowrap;
    }

    .highlight {
        min-height: 100svh;
    }

    .highlight video {
        height: 100svh;
        object-fit: cover;
    }

    .games {
        grid-template-columns: 1fr;
        width: min(92%, 700px);
        gap: 16px;
        padding-top: 28px;
    }

    .game-card {
        border-radius: 12px;
    }

    /*
     * Mobile: cały film jest widoczny, bez cropowania.
     * Czarne pasy są celowe, jeśli proporcje filmu różnią się od kafelka.
     */
    .game-card__media {
        aspect-ratio: 16 / 9;
        background: #050505;
    }

    .game-cover,
    .game-preview,
    .gif-fallback {
        object-fit: contain;
        object-position: center;
        background: #050505;
    }

    .game-card:hover {
        transform: none;
        box-shadow: none;
    }

    .game-modal {
        padding:
            max(12px, env(safe-area-inset-top))
            10px
            max(12px, env(safe-area-inset-bottom));
    }

    .game-modal__panel {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: auto;
        max-height: calc(100dvh - 24px);
        border-radius: 20px;
    }

    .game-modal__media {
        flex: 0 0 auto;
        width: 100%;
        aspect-ratio: 16 / 9;
        background: #050505;
    }

    /*
     * Mobile modal: również bez przycinania filmu.
     */
    .game-modal__video,
    .game-modal__image {
        object-fit: contain;
        object-position: center;
        background: #050505;
    }


    .game-modal__header {
        padding: 22px 20px 16px;
    }

    .game-modal__content {
        display: block;
        padding: 22px 20px max(24px, env(safe-area-inset-bottom));
    }

    .game-modal__title {
        font-size: clamp(1.8rem, 9vw, 2.8rem);
    }

    .game-modal__description {
        margin-top: 18px;
        font-size: 1rem;
    }

    .game-modal__links {
        margin-top: 22px;
    }

    .game-modal__close {
        top: 10px;
        right: 10px;
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 420px) {
    .logo img {
        height: 1.9rem;
        max-width: 34vw;
    }

    .menu {
        gap: 8px;
    }

    .menu a {
        font-size: 0.85rem;
    }

    .game-modal__links {
        display: grid;
        grid-template-columns: 1fr;
    }

    .game-modal__links a {
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

.game-card__play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 68px;
    height: 68px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;

    background: rgba(0, 0, 0, 0.42);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);

    opacity: 0;
    pointer-events: none;

    transform: translate(-50%, -50%) scale(0.86);

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    transition:
        opacity 0.28s ease,
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.28s ease;
}

.game-card__play span {
    width: 0;
    height: 0;
    margin-left: 5px;

    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 16px solid #fff;
}

@media (hover: hover) and (pointer: fine) {
    .game-card:hover .game-card__play,
    .game-card:focus-visible .game-card__play {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    .game-card:hover .game-card__play {
        background: rgba(238, 94, 17, 0.78);
    }

    .game-card:hover .game-cover {
        filter: brightness(0.72);
    }
}

@media (hover: none) {
    .game-card__play {
        display: none;
    }
}

.footer-legal__link {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.footer-legal__link:hover,
.footer-legal__link:focus-visible {
    text-decoration: none;
}

.privacy-modal__panel {
    max-height: min(85vh, 900px);
    overflow-y: auto;
}

.privacy-modal__content {
    line-height: 1.65;
}

.privacy-modal__content h3 {
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
}

.privacy-modal__content ul {
    padding-left: 1.5rem;
}

.privacy-modal__content a {
    color: inherit;
    text-decoration: underline;
}

body.modal-open {
    overflow: hidden;
}

.privacy-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    visibility: hidden;
    opacity: 0;
    pointer-events: none;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

.privacy-modal.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.privacy-modal__backdrop {
    position: absolute;
    inset: 0;

    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.privacy-modal__panel {
    position: relative;
    z-index: 1;

    width: min(760px, 100%);
    max-height: 85vh;
    overflow-y: auto;

    padding: 40px;

    background: #181818;
    color: #ffffff;

    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;

    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.privacy-modal__content {
    line-height: 1.65;
}

.privacy-modal__content h3 {
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
}

.privacy-modal__content a {
    color: inherit;
    text-decoration: underline;
}

.privacy-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
}

.privacy-modal .game-modal__description {
    display: block;
    visibility: visible;
    opacity: 1;
}

/* Privacy modal — overrides game modal layout */
.privacy-modal.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.privacy-modal__panel {
    display: block;
    width: min(760px, 100%);
    max-height: 85vh;
    padding: 0;
    overflow-y: auto;
}

.privacy-modal .game-modal__header {
    display: block;
    padding: 40px 40px 24px;
}

.privacy-modal .game-modal__content {
    display: block;
    padding: 0 40px 40px;
    overflow: visible;
}

.privacy-modal .game-modal__description {
    display: block;
    visibility: visible;
    opacity: 1;
    margin: 0;
}

.privacy-modal .game-modal__producer {
    display: block;
}

.privacy-modal .game-modal__producer::before {
    content: none;
}

@media (max-width: 768px) {
    .privacy-modal {
        padding: 12px;
    }

    .privacy-modal__panel {
        max-height: calc(100dvh - 24px);
    }

    .privacy-modal .game-modal__header {
        padding: 28px 22px 18px;
    }

    .privacy-modal .game-modal__content {
        padding: 0 22px 28px;
    }
}
