/* =============================================================
   ZMIENNE GLOBALNE – CIEPŁY, ANTYCZNY KLIMAT
   ============================================================= */
:root {
    --parchment-base: #f2e5c7;
    --parchment-light: #fdf8eb;
    --wood-dark: #2a1a0e;
    --royal-blue: #4a1f2e;
    --blue-accent: #a5824e;
    --gold: #d4a54a;
    --gold-glow: rgba(212, 165, 74, 0.3);
    --gold-dark: #a67c2e;
    --white: #f5efe6;
    --red: #8f2828;
    --glass: rgba(245, 235, 205, 0.45);
    --glass-dark: rgba(235, 215, 175, 0.9);
    --ink: #26190f;
    --ink-dark: #1c110a;
    --shadow-soft: 0 20px 50px rgba(0, 0, 0, 0.6);
}

/* =============================================================
   ANIMACJE GLOBALNE
   ============================================================= */
@keyframes candlePulse {
    0% {
        filter: blur(70px) brightness(1);
        opacity: 0.5;
    }

    50% {
        filter: blur(85px) brightness(1.2);
        opacity: 0.8;
    }

    100% {
        filter: blur(70px) brightness(1);
        opacity: 0.5;
    }
}

@keyframes goldPulse {
    0% {
        text-shadow: 0 0 10px var(--gold-glow), 0 0 20px rgba(212, 165, 74, 0.15);
    }

    50% {
        text-shadow: 0 0 15px var(--gold-glow), 0 0 30px rgba(212, 165, 74, 0.3);
    }

    100% {
        text-shadow: 0 0 10px var(--gold-glow), 0 0 20px rgba(212, 165, 74, 0.15);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

@keyframes barGrow {
    0%, 100% {
        height: 10px;
    }

    50% {
        height: 40px;
    }
}

@keyframes pulseBadge {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

@keyframes pulseMic {
    from {
        transform: scale(1);
        filter: drop-shadow(0 0 2px var(--gold));
    }

    to {
        transform: scale(1.1);
        filter: drop-shadow(0 0 8px var(--gold));
    }
}

/* =============================================================
   RESET I TŁO – BIBLIOTEKA / ŚWIĄTYNIA
   ============================================================= */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    background-color: #1a100a !important;
    background-image: radial-gradient(circle at 50% 50%, rgba(100, 70, 45, 0.7) 0%, rgba(40, 28, 18, 0.9) 50%, rgba(15, 10, 6, 1) 100%), url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='smoothNoise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.005' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.96 0 0 0 0 0.92 0 0 0 0 0.85 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23smoothNoise)'/%3E%3C/svg%3E");
    background-blend-mode: normal, multiply;
    background-attachment: scroll;
    background-size: 100% 100%, 400px 400px;
    overflow-x: hidden;
    overflow-y: visible;
    font-family: 'Cinzel', 'Georgia', serif !important;
    /* DODANA LINIJKA: Blokada gumowego przewijania strony */
    overscroll-behavior: none !important;
}

.main-container,
.start-screen,
.game-layout,
.summary-view,
.ranking-view {
    min-height: 100vh;
    box-sizing: border-box;
    width: 100%;
}

.main-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: transparent;
    color: var(--white);
    font-family: 'Cinzel', serif;
    overflow: hidden;
    position: relative;
}

/* =============================================================
   EKRAN PODSUMOWANIA
   ============================================================= */
.summary-view {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 100dvh !important;
    overflow-y: auto !important;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    box-sizing: border-box !important;
}

.failed-question-box {
    background: rgba(0,0,0,0.3) !important;
    border: 1px solid #4a3427 !important;
    padding: 12px !important;
    border-radius: 4px !important;
    margin-bottom: 10px !important;
    color: #d8c4a0 !important;
    font-size: 0.9rem !important;
}

/* =============================================================
   TYPOGRAFIA – ZŁOTO Z Cieniem
   ============================================================= */
.main-title {
    color: var(--gold) !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 4px 12px rgba(212, 165, 74, 0.3);
    font-size: clamp(1.5rem, 9vw, 4rem);
    text-align: center;
    white-space: nowrap;
    margin: 10px 0;
    letter-spacing: 6px;
    font-weight: 700;
    animation: goldPulse 4s ease-in-out infinite;
}

.subtitle {
    color: #d4bfa0 !important;
    font-style: italic;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    font-size: clamp(0.9rem, 2.5vw, 1.4rem);
}

.mini-brand-header {
    text-align: center;
    font-weight: 900;
    color: var(--gold);
    font-size: clamp(1.2rem, 4.5vw, 1.8rem);
    letter-spacing: 3px;
    margin-bottom: 12px;
    margin-top: max(0px, env(safe-area-inset-top));
    opacity: 0.85;
    text-shadow: 0 0 15px var(--gold-glow);
    text-transform: uppercase;
}

/* =============================================================
   EKRAN STARTOWY
   ============================================================= */
.start-screen {
    position: relative;
    width: 100%;
    /* 1. Używamy dvh z fallbackiem na 100vh dla pełnej elastyczności */
    min-height: 100vh;
    min-height: 100dvh;
    background: radial-gradient(circle at 50% 50%, #3a2418 0%, #1a0e08 50%, #0a0502 100%) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* 2. FLEX-START zapobiega obcinaniu góry ekranu i odblokowuje scroll na iOS */
    justify-content: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    /* 3. Wymuszenie płynnego scrolla i rejestracji gestu w pionie na iPhone */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(40px, env(safe-area-inset-bottom));
}

    .start-screen::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 180vmin;
        height: 180vmin;
        background: radial-gradient(circle at 50% 50%, rgba(220, 150, 70, 0.6) 0%, rgba(160, 100, 40, 0.35) 40%, transparent 80%);
        pointer-events: none;
        z-index: 1;
        border-radius: 50%;
        animation: candlePulse 4s ease-in-out infinite alternate;
    }

    .start-screen .logo-container {
        margin-bottom: 30px !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        z-index: 2;
        width: 100%;
    }

    /* =============================================================
   PERGAMIN Z WAŁKAMI
   ============================================================= */
    .start-screen .form-card-wrapper {
        position: relative;
        width: 85%;
        max-width: 360px;
        margin: 50px auto;
        z-index: 2;
        transition: opacity 0.5s ease-out 1.0s;
        opacity: 1;
    }

        .start-screen .form-card-wrapper.rolling-up {
            transform: none;
            opacity: 0;
            pointer-events: none;
        }

    .start-screen .form-card {
        position: relative;
        width: 100%;
        margin: 0 !important;
        padding: 60px 35px;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 40px rgba(212, 165, 74, 0.15);
        display: flex;
        flex-direction: column;
        height: 340px !important;
        box-sizing: border-box !important;
        z-index: 1;
        background: radial-gradient(ellipse at 50% 50%, rgba(255, 245, 220, 0.95) 0%, rgba(230, 200, 160, 0.9) 60%, rgba(180, 140, 90, 0.85) 100%), linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.1) 100%);
        background-blend-mode: normal, multiply;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 400' preserveAspectRatio='none'%3E%3Cfilter id='heavyTornEdge'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04 0.12' numOctaves='5' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='28' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect x='20' y='20' width='960' height='360' fill='white' filter='url(%23heavyTornEdge)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 400' preserveAspectRatio='none'%3E%3Cfilter id='heavyTornEdge'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04 0.12' numOctaves='5' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='28' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect x='20' y='20' width='960' height='360' fill='white' filter='url(%23heavyTornEdge)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
        transform-origin: center center;
        transform: scaleY(1);
        transition: transform 1.0s ease-in-out;
    }

        .start-screen .form-card::after {
            content: "";
            position: absolute;
            inset: 0;
            box-shadow: inset 0 22px 15px -10px rgba(0,0,0,0.6), inset 0 -22px 15px -10px rgba(0,0,0,0.6);
            pointer-events: none;
            z-index: 2;
        }

        .start-screen .form-card::before {
            display: none !important;
        }

.rolling-up .form-card {
    transform: scaleY(0.08);
    width: 100%;
    overflow: hidden;
    transition: transform 1.0s ease-in-out;
}

.rolling-up .form-card-content,
.rolling-up .starting-game-text {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s ease-out, visibility 0.1s ease-out;
}

.start-screen .form-card-content {
    display: flex;
    flex-direction: column;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    width: 100%;
    height: 100%;
    gap: 15px;
    box-sizing: border-box;
    transition: opacity 0.2s ease-in-out;
}

    .start-screen .form-card-content .input-label {
        text-align: center;
    }

    .start-screen .form-card-content .custom-input {
        margin: 0 auto !important;
        text-align: center;
    }

.start-screen .form-card h1 {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

/* =============================================================
   WAŁKI PIONOWE
   ============================================================= */
.scroll-roller {
    position: absolute;
    left: -20px;
    right: -20px;
    height: 46px;
    display: flex;
    align-items: center;
    z-index: 5;
    pointer-events: none;
    transition: top 1.0s ease-in-out, bottom 1.0s ease-in-out, transform 1.0s ease-in-out;
}

.scroll-top {
    top: -15px;
    transform: translateY(0);
}

.scroll-bottom {
    bottom: -15px;
    transform: translateY(0);
}

.roller-center {
    flex-grow: 1;
    height: 32px;
    background: linear-gradient(to bottom, #241308 0%, #472915 25%, #825433 50%, #472915 75%, #1c0d05 100%);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.55);
}

.roller-left, .roller-right {
    width: 16px;
    height: 46px;
    background: linear-gradient(to bottom, #1a0c04 0%, #3d210f 20%, #734829 50%, #3d210f 80%, #120601 100%);
    box-shadow: inset 0 0 5px rgba(0,0,0,0.8), 0 8px 12px rgba(0, 0, 0, 0.4);
}

.roller-left {
    border-radius: 8px 3px 3px 8px;
    border-right: 2px solid #120601;
}

.roller-right {
    border-radius: 3px 8px 8px 3px;
    border-left: 2px solid #120601;
}

.rolling-up .scroll-top {
    top: 50%;
    transform: translateY(-110%);
}

.rolling-up .scroll-bottom {
    bottom: 50%;
    transform: translateY(110%);
}

/* =============================================================
   STYLE WEWNĄTRZ PERGAMINU
   ============================================================= */
.start-screen .form-card .welcome-back-msg {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #3d2312;
    letter-spacing: 1px;
    text-align: center;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    font-family: 'Cinzel', serif;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.start-screen .form-card .input-label {
    color: #3d2312 !important;
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.2);
}

.start-screen .form-card .custom-input {
    margin-bottom: 0 !important;
    border-radius: 6px !important;
    padding: 14px 20px !important;
    font-size: 1.1rem !important;
    color: #2c1a0e !important;
    font-weight: 700 !important;
    background: #f5efe6 !important;
    border: 2px solid #4a2a1a !important;
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1) !important;
    transition: all 0.2s ease;
    max-width: 290px;
    width: 100%;
    font-family: 'Cinzel', serif;
    text-align: center;
}

    .start-screen .form-card .custom-input:focus {
        border-color: var(--gold) !important;
        box-shadow: inset 0 4px 8px rgba(0,0,0,0.1), 0 0 20px rgba(212, 165, 74, 0.3) !important;
    }

.start-screen .btn-play-gold {
    background: linear-gradient(180deg, #5a3420 0%, #3a1f12 50%, #241008 100%) !important;
    border: 2px solid #d4a54a !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6), 0 0 20px rgba(212, 165, 74, 0.25) !important;
    color: #f5efe6 !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.7) !important;
    font-weight: 700 !important;
    padding: 14px 30px !important;
    transition: all 0.3s ease !important;
    letter-spacing: 2px;
}

    .start-screen .btn-play-gold:hover {
        background: linear-gradient(180deg, #6e3f28 0%, #4a2618 50%, #2e150a 100%) !important;
        box-shadow: 0 6px 25px rgba(0,0,0,0.7), 0 0 40px rgba(212, 165, 74, 0.4) !important;
        transform: translateY(-2px);
    }

    .start-screen .btn-play-gold:active {
        transform: translateY(2px);
        box-shadow: inset 0 2px 6px rgba(0,0,0,0.6), 0 2px 4px rgba(0,0,0,0.3) !important;
    }

/* =============================================================
   STYLE GLOBALNE (MODALE, INNE KARTY)
   ============================================================= */
.form-card {
    background: linear-gradient(180deg, #654634 0%, #4a3427 50%, #34231a 100%);
    padding: 40px;
    border-radius: 28px;
    border: 4px solid #24160f;
    box-shadow: inset 0 0 40px rgba(0,0,0,.7), 0 20px 50px rgba(0,0,0,.45);
    position: relative;
    overflow: hidden;
}

    .form-card::before {
        content: "";
        position: absolute;
        inset: 12px;
        border: 1px solid rgba(212,180,92,.35);
        border-radius: 12px;
        pointer-events: none;
    }

.input-label {
    display: block;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--gold);
    letter-spacing: 1px;
}

.custom-input {
    width: 100%;
    padding: 15px;
    border-radius: 4px;
    border: 2px solid var(--blue-accent);
    background: rgba(20, 12, 8, 0.85);
    color: #f3e7d3;
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 25px;
    outline: none;
    font-family: inherit;
    box-shadow: inset 0 2px 5px rgba(139, 90, 43, 0.3);
    box-sizing: border-box;
}

    .custom-input:focus {
        border-color: var(--gold);
        box-shadow: 0 0 10px var(--gold-glow), inset 0 2px 5px rgba(0,0,0,0.8);
    }

/* System offline - style */
.offline-badge {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #b32121;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 0.95rem;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    z-index: 999999 !important; /* Wymuszenie wyświetlania nad wszystkimi modalem i tłem */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    border: 2px solid #e64a4a;
    text-align: center;
    white-space: nowrap;
    pointer-events: none; /* Nie blokuje kliknięć w elementy pod spodem */
}
/* =============================================================
   PRZYCISKI BAZOWE
   ============================================================= */
.main-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-main-hero {
    padding: 18px 30px;
    font-size: 1.3rem;
    font-weight: 800;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: inherit;
}

.btn-play-gold {
    background: var(--royal-blue);
    color: var(--white);
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.1), 0 4px 6px rgba(0, 0, 0, 0.4);
}

    .btn-play-gold:hover {
        background: #3a1a28;
        border-color: var(--gold);
        color: var(--gold);
        transform: translateY(-2px);
        box-shadow: 0 0 15px var(--gold-glow), inset 0 1px 3px rgba(255, 255, 255, 0.2);
    }

.btn-quit-dark {
    background: #4a1c1c;
    border: 2px solid #a63232;
    color: #fff;
    box-shadow: inset 0 1px 3px rgba(255,255,255,0.1), 0 2px 4px rgba(0,0,0,0.3);
}

    .btn-quit-dark:hover {
        background: var(--red);
        border-color: var(--gold);
        color: var(--gold);
        transform: translateY(-2px);
    }

.bottom-bar {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.nav-btn-modern {
    background: var(--royal-blue);
    border: 2px solid var(--blue-accent);
    color: var(--white);
    padding: 12px 25px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.1), 0 4px 6px rgba(0, 0, 0, 0.4);
}

    .nav-btn-modern:hover {
        background: #3a1a28;
        border-color: var(--gold);
        color: var(--gold);
        transform: translateY(-3px);
        box-shadow: 0 0 10px var(--gold-glow);
    }

/* =============================================================
   PRZYCISK "POKAŻ RANKING"
   ============================================================= */
.start-screen .btn-ranking {
    background: linear-gradient(180deg, #3b1f10 0%, #1c0a02 100%) !important;
    border: none !important;
    color: #fffaf2 !important;
    font-family: 'Cinzel', serif !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    padding: 16px 28px !important;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 15px;
    -webkit-appearance: none;
    appearance: none;
    width: auto !important;
    min-width: 220px !important;
    align-self: center !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 400' preserveAspectRatio='none'%3E%3Cfilter id='heavyTornEdge'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04 0.12' numOctaves='4' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='35' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect x='20' y='20' width='960' height='360' fill='white' filter='url(%23heavyTornEdge)'/%3E%3C/svg%3E") no-repeat center / 100% 100% !important;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 400' preserveAspectRatio='none'%3E%3Cfilter id='heavyTornEdge'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04 0.12' numOctaves='4' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='35' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect x='20' y='20' width='960' height='360' fill='white' filter='url(%23heavyTornEdge)'/%3E%3C/svg%3E") no-repeat center / 100% 100% !important;
    box-shadow: none !important;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.8));
    transition: all 0.3s ease !important;
}

    .start-screen .btn-ranking:hover {
        background: linear-gradient(180deg, #6e3a1a 0%, #3d1f0a 100%) !important;
        filter: drop-shadow(0 0 12px rgba(184, 142, 85, 0.6)) drop-shadow(0 8px 12px rgba(0, 0, 0, 0.8));
        transform: translateY(-2px);
    }

/* =============================================================
   UKŁAD GRY – POPRAWIONE BEZPIECZNE ODSTĘPY
   ============================================================= */
.game-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    box-sizing: border-box;
    flex: 1;
    min-height: 0;
}

.game-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0;
}

.mini-brand-header-portrait {
    display: none;
}

.mini-brand-header-inline {
    display: block;
}

/* =============================================================
   BELKA GÓRNA – STYL ŚWIĄTYNNY, KAMIENNY
   ============================================================= */
.game-header-bar {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    overflow: hidden;
    gap: clamp(6px, 1.5vw, 12px);
    padding: 6px 16px !important;
    padding-top: max(8px, env(safe-area-inset-top)) !important;
    min-height: 48px;
    background: radial-gradient(ellipse at 50% 30%, rgba(220, 205, 180, 0.25) 0%, transparent 60%), linear-gradient(180deg, #d4c8b4 0%, #c4b8a2 30%, #b0a088 70%, #9a8a74 100%);
    border-top: 2px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(0, 0, 0, 0.12);
    border-bottom: 3px solid rgba(74, 63, 47, 0.5);
    border-radius: 0;
    box-shadow: inset 0 2px 4px rgba(255,255,255, 0.15), inset 0 -6px 15px rgba(74, 63, 47, 0.15), 0 4px 12px rgba(0, 0, 0, 0.3);
}

    .game-header-bar::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        z-index: -1;
        background: radial-gradient(circle at 80% 20%, rgba(255,255,255, 0.06), transparent 40%), radial-gradient(circle at 30% 80%, rgba(94, 80, 61, 0.08), transparent 50%), url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='sandGrain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' result='noise'/%3E%3CfeColorMatrix type='matrix' values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='white' filter='url(%23sandGrain)'/%3E%3C/svg%3E");
        background-repeat: repeat;
        mix-blend-mode: multiply;
        opacity: 0.4;
    }

    .game-header-bar::after {
        content: "";
        position: absolute;
        left: 6px;
        right: 6px;
        top: 4px;
        bottom: 4px;
        pointer-events: none;
        z-index: -1;
        border: 1px solid rgba(94, 80, 61, 0.12);
        box-shadow: inset 0 1px 2px rgba(0,0,0,0.06), 0 1px 0 rgba(255,255,255,0.15);
    }

    .game-header-bar .timer-section {
        flex: 0 0 auto;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 8px;
    }

    .game-header-bar .lifelines-section {
        flex: 1 1 auto;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
    }

    .game-header-bar .actions-section {
        flex: 0 0 auto;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 8px;
    }

    .game-header-bar .timer {
        background: rgba(0,0,0,0.5) !important;
        border: 1px solid #8f7a5c !important;
        box-shadow: inset 0 0 4px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.2) !important;
        padding: 2px 10px;
        border-radius: 6px;
        font-size: 0.9rem;
        font-weight: bold;
        color: #f0d070 !important;
        text-shadow: 0 0 4px rgba(0,0,0,0.4);
        height: 30px;
        line-height: 30px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 70px;
    }

    .game-header-bar .btn-resign {
        background: #2a1a1a !important;
        border: 2px solid #6a4a3a !important;
        color: #eeddbb !important;
        font-weight: bold;
        padding: 2px 14px;
        border-radius: 6px;
        text-shadow: none !important;
        box-shadow: inset 0 1px 2px rgba(255,255,255,0.1), 0 2px 6px rgba(0,0,0,0.5);
        transition: all 0.2s ease;
        font-size: 0.7rem;
        height: 30px;
        line-height: 30px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

        .game-header-bar .btn-resign:hover {
            background: #4a2a2a !important;
            border-color: #b98a32 !important;
            color: #ffd966 !important;
        }

    .game-header-bar .lifeline-btn {
        background: radial-gradient(circle at 35% 35%, #8b6b3c, #5a4124, #2e1f10) !important;
        border: 2px solid #b88d4a !important;
        box-shadow: inset 0 1px 2px rgba(255,255,200,0.3), 0 3px 6px rgba(0,0,0,0.4) !important;
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
        color: #f7e5c2 !important;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        border-radius: 50%;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cfilter id='torn'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.05' numOctaves='3' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='6'/%3E%3C/filter%3E%3Ccircle cx='50' cy='50' r='46' fill='white' filter='url(%23torn)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cfilter id='torn'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.05' numOctaves='3' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='6'/%3E%3C/filter%3E%3Ccircle cx='50' cy='50' r='46' fill='white' filter='url(%23torn)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
        font-family: 'Georgia', serif;
    }

        .game-header-bar .lifeline-btn:hover:not(:disabled) {
            background: radial-gradient(circle at 35% 35%, #a57d48, #6e4f2e, #3b2a18) !important;
            border-color: #dfb36b !important;
            transform: translateY(-2px);
            box-shadow: 0 0 12px rgba(200, 160, 80, 0.5), inset 0 1px 2px rgba(255,255,200,0.4) !important;
        }

        .game-header-bar .lifeline-btn:disabled {
            opacity: 0.4;
            filter: grayscale(0.3);
        }

/* =============================================================
   TIMER (POZA BELKĄ)
   ============================================================= */
.timer {
    font-family: inherit;
    font-size: 1.4rem;
    color: #f0d070;
    margin: 0;
    background: linear-gradient(180deg, #3f2a1e, #261913);
    border: 2px solid #b98a32;
    border-radius: 12px;
    box-shadow: inset 0 0 12px rgba(0,0,0,.7), 0 0 12px rgba(185,138,50,.25);
    width: 100px;
    height: 42px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    white-space: nowrap;
    box-sizing: border-box;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* =============================================================
   NAPISY W GRZE – KOMPAKTOWE, ELEGANCKIE
   ============================================================= */
.current-prize-info {
    text-align: center;
    padding: 0 12px;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(212, 165, 74, 0.1);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.15);
    gap: 0;
    overflow: hidden;
}

.current-amount {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e8dcc8;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

.gold-text {
    color: var(--gold);
    font-weight: 700;
    text-shadow: 0 0 12px var(--gold-glow), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.guaranteed-glow-badge {
    background: linear-gradient(135deg, #4a2a1a 0%, #6e3f28 50%, #4a2a1a 100%);
    border: 1.5px solid var(--gold);
    border-radius: 6px;
    color: var(--gold);
    padding: 2px 10px;
    font-weight: 700;
    font-size: 0.6rem;
    line-height: 1.2;
    display: inline-block;
    box-shadow: 0 0 15px rgba(212, 165, 74, 0.15);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    animation: pulseBadge 2s infinite;
    margin-bottom: 0;
}

/* =============================================================
   RANKING – POPRAWIONY: WIĘCEJ PRZESTRZENI, 1 LINIJKA
   ============================================================= */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 6px;
    max-height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gold) transparent;
}

    .ranking-list::-webkit-scrollbar {
        width: 4px;
    }

    .ranking-list::-webkit-scrollbar-track {
        background: transparent;
    }

    .ranking-list::-webkit-scrollbar-thumb {
        background: var(--gold);
        border-radius: 4px;
    }

.ranking-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(45, 25, 15, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 12px 18px !important;
    border-radius: 12px;
    border: 1px solid rgba(170, 124, 17, 0.05);
    color: rgba(255, 250, 242, 0.3);
    transition: all 0.3s ease;
    gap: 12px !important;
    font-size: 1rem !important;
    min-height: 48px !important;
    flex-wrap: nowrap;
}

    .ranking-row:hover {
        background: rgba(80, 45, 25, 0.4);
        transform: scale(1.01);
    }

    .ranking-row.current-player {
        background: rgba(30, 40, 60, 0.25) !important;
        border: 1px solid rgba(100, 150, 255, 0.25) !important;
        color: #fffaf2 !important;
    }

        .ranking-row.current-player .rank-pos {
            color: #8899bb !important;
        }

        .ranking-row.current-player .rank-score {
            color: #8899bb !important;
        }

    .ranking-row.rank-gold {
        background: linear-gradient(135deg, rgba(212, 165, 74, 0.5), rgba(45, 25, 15, 0.3)) !important;
        border-color: rgba(212, 165, 74, 0.7) !important;
        color: #fffaf2 !important;
    }

        .ranking-row.rank-gold .rank-pos {
            color: #ffd700 !important;
        }

        .ranking-row.rank-gold .rank-score {
            color: #ffd700 !important;
        }

    .ranking-row.rank-silver {
        background: linear-gradient(135deg, rgba(192, 192, 192, 0.35), rgba(45, 25, 15, 0.3)) !important;
        border-color: rgba(192, 192, 192, 0.6) !important;
        color: #fffaf2 !important;
    }

        .ranking-row.rank-silver .rank-pos {
            color: #c0c0c0 !important;
        }

        .ranking-row.rank-silver .rank-score {
            color: #c0c0c0 !important;
        }

    .ranking-row.rank-bronze {
        background: linear-gradient(135deg, rgba(205, 127, 50, 0.35), rgba(45, 25, 15, 0.3)) !important;
        border-color: rgba(205, 127, 50, 0.6) !important;
        color: #fffaf2 !important;
    }

        .ranking-row.rank-bronze .rank-pos {
            color: #cd7f32 !important;
        }

        .ranking-row.rank-bronze .rank-score {
            color: #cd7f32 !important;
        }

    .ranking-row:not(.rank-gold):not(.rank-silver):not(.rank-bronze):not(.current-player) {
        background: rgba(45, 25, 15, 0.15) !important;
        border-color: rgba(170, 124, 17, 0.03) !important;
        color: rgba(255, 250, 242, 0.25) !important;
    }

        .ranking-row:not(.rank-gold):not(.rank-silver):not(.rank-bronze):not(.current-player) .rank-pos {
            color: rgba(255, 250, 242, 0.25) !important;
        }

        .ranking-row:not(.rank-gold):not(.rank-silver):not(.rank-bronze):not(.current-player) .rank-score {
            color: rgba(255, 250, 242, 0.25) !important;
        }

        .ranking-row:not(.rank-gold):not(.rank-silver):not(.rank-bronze):not(.current-player) .rank-time {
            color: rgba(191, 163, 138, 0.3) !important;
        }

.rank-pos {
    font-weight: 700;
    width: 34px !important;
    font-size: 1.1rem !important;
    text-align: center;
    flex-shrink: 0;
}

.rank-name {
    flex: 1 1 auto;
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 1rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.rank-details {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.rank-score {
    font-weight: 700;
    font-size: 1rem !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.rank-time {
    font-size: 0.8rem !important;
    color: #bfa38a;
}

/* =============================================================
   NARRATOR – POWRÓT DO SPRAWDZONEJ MECHANIKI (BEZ CALC)
   ============================================================= */
.narrator-container {
    position: relative;
    width: calc(100% - 30px);
    margin: 12px auto;
    padding: 0;
    box-sizing: border-box;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    /* JS kontroluje opacity i pointer-events */
    opacity: 0;
    pointer-events: none;
}

.narrator-inner {
    position: relative;
    width: 100%;
    height: 46px;
    margin: 0 !important;
    padding: 0 35px;
    box-sizing: border-box !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 1;
    background: radial-gradient(circle at 50% 50%, #fdf5e2 0%, #dcb879 60%, #b58a4a 85%, #7a4f2a 100%) !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 400' preserveAspectRatio='none'%3E%3Cfilter id='torn'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04 0.12' numOctaves='4' result='n'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='n' scale='15' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect x='10' y='10' width='980' height='380' fill='white' filter='url(%23torn)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 400' preserveAspectRatio='none'%3E%3Cfilter id='torn'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04 0.12' numOctaves='4' result='n'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='n' scale='15' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect x='10' y='10' width='980' height='380' fill='white' filter='url(%23torn)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
    transform-origin: center center;
    /* JS kontroluje transform */
    transform: scaleX(0);
}

    .narrator-inner::after {
        content: "";
        position: absolute;
        inset: 0;
        box-shadow: inset 18px 0 15px -10px rgba(0,0,0,0.6), inset -18px 0 15px -10px rgba(0,0,0,0.6);
        pointer-events: none;
        z-index: 2;
    }

.narrator-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.narrator-text {
    font-family: 'Cinzel', serif;
    font-style: italic;
    color: #2c1e14;
    font-weight: 600;
    text-align: center;
    /* Płynne dopasowanie czcionki do ekranu, bez ryzyka skoków */
    font-size: clamp(0.7rem, 2.2vw, 0.9rem);
    line-height: 1.15;
    /* Gwarancja, że tekst mieści się w sztywnych ryzach 46px */
    max-height: 40px;
    overflow: hidden;
    word-break: break-word;
}

.narrator-container .scroll-roller {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 16px;
    height: auto !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
    pointer-events: none;
    /* JS kontroluje left/right/transform */
    flex-shrink: 0;
    will-change: transform, left, right;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.narrator-container .roller-left-edge {
    /* Wartości startowe (usunięto !important) */
    left: 50%;
    right: auto;
    transform: translateX(-100%);
}

.narrator-container .roller-right-edge {
    /* Wartości startowe (usunięto !important) */
    left: auto;
    right: 50%;
    transform: translateX(100%);
}

.narrator-container .roller-body {
    flex-grow: 1;
    width: 10px;
    margin: 0 auto;
    background: linear-gradient(to right, #6e481f 0%, #b38642 30%, #dec088 50%, #b38642 70%, #543411 100%);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.4);
}

.narrator-container .roller-cap-top,
.narrator-container .roller-cap-bottom {
    width: 16px;
    height: 6px;
    background: linear-gradient(to right, #543411 0%, #8c6027 25%, #b38642 50%, #8c6027 75%, #3d2105 100%);
    border-radius: 3px;
    box-shadow: inset 0 0 2px rgba(0,0,0,0.6);
}

/* =============================================================
   PYTANIE I ODPOWIEDZI
   ============================================================= */
.question-box {
    background: radial-gradient(circle at 50% 40%, #f4e2be 0%, #e2c286 60%, #bc8c43 100%);
    border: none !important;
    border-radius: 0 !important;
    min-height: 115px;
    max-height: 140px;
    filter: drop-shadow(3px 5px 6px rgba(28, 17, 10, 0.75)) !important;
    box-shadow: inset 0 0 35px rgba(92,64,51,.4), 0 10px 30px rgba(0,0,0,0.4) !important;
    padding: 24px 45px;
    text-align: center;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a100a;
    font-weight: 600;
    position: relative;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 400' preserveAspectRatio='none'%3E%3Cfilter id='parchmentEdge'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.015 0.04' numOctaves='5' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='28' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect x='25' y='25' width='950' height='350' fill='white' filter='url(%23parchmentEdge)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 400' preserveAspectRatio='none'%3E%3Cfilter id='parchmentEdge'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.015 0.04' numOctaves='5' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='28' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect x='25' y='25' width='950' height='350' fill='white' filter='url(%23parchmentEdge)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
    overflow-y: auto;
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.answer-btn {
    background: radial-gradient(circle at 30% 20%, #8b694a, #5a3f2a);
    border: 2px solid #c99c3e;
    border-radius: 8px;
    color: #f5eace;
    padding: 18px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: inset 0 1px 3px rgba(255,255,255,0.1), 0 4px 8px rgba(0,0,0,0.4);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 200' preserveAspectRatio='none'%3E%3Cfilter id='answerEdge'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.02 0.08' numOctaves='3' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='8'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='white' filter='url(%23answerEdge)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 200' preserveAspectRatio='none'%3E%3Cfilter id='answerEdge'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.02 0.08' numOctaves='3' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='8'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='white' filter='url(%23answerEdge)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}

    .answer-btn:hover {
        background: radial-gradient(circle at 30% 20%, #a57d56, #70533a);
        border-color: #dfb45e;
        transform: translateY(-2px);
        box-shadow: 0 0 18px rgba(223, 180, 94, 0.4), inset 0 1px 3px rgba(255,255,255,0.15), 0 6px 12px rgba(0,0,0,0.5);
    }

    .answer-btn:active {
        transform: translateY(1px);
        box-shadow: inset 0 2px 5px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
    }

.letter {
    color: #e5b83c;
    font-weight: 800;
    margin-right: 12px;
    text-shadow: 0 0 2px rgba(0,0,0,0.3);
}

.answer-btn.correct {
    background: radial-gradient(circle at 30% 20%, #7b8a6e, #4d5e3f);
    border-color: #9bc47a;
    box-shadow: 0 0 12px rgba(100, 160, 70, 0.4), inset 0 1px 3px rgba(255,255,255,0.1);
    color: #f9f2df;
}

    .answer-btn.correct .letter {
        color: #e5ffb3;
    }

.answer-btn.wrong {
    background: radial-gradient(circle at 30% 20%, #9a6b5e, #6e3f32);
    border-color: #d97a6a;
    box-shadow: 0 0 12px rgba(200, 80, 60, 0.4), inset 0 1px 3px rgba(255,255,255,0.1);
    color: #ffe6e0;
}

    .answer-btn.wrong .letter {
        color: #ffbcac;
    }

.answer-btn.selected-correct {
    background: radial-gradient(circle at 30% 20%, #6a8a5e, #3d5e2f);
    border-color: #7dbd5a;
    box-shadow: 0 0 20px rgba(100, 180, 70, 0.6), inset 0 1px 4px rgba(200, 255, 200, 0.3);
    transform: scale(1.01);
}

    .answer-btn.selected-correct .letter {
        color: #b3ff8a;
    }

.answer-btn.selected-wrong {
    background: radial-gradient(circle at 30% 20%, #b57a5a, #8a4a3a);
    border-color: #ff9f8a;
    box-shadow: 0 0 20px rgba(255, 100, 80, 0.6), inset 0 1px 4px rgba(255,200,200,0.3);
    transform: scale(1.01);
}

/* =============================================================
   PANEL NAGRÓD 
   ============================================================= */
.prize-panel {
    background: linear-gradient(180deg, #4a3327, #35241b) !important;
    padding: 15px 12px; /* Zmniejszone z 18px */
    border-radius: 24px;
    border: none;
    box-shadow: 0 12px 30px rgba(0,0,0,.35);
    overflow-y: auto;
    position: relative;
    align-self: start;
    margin-top: 12px !important; /* Zmniejszone z 18px -> tabela podnosi się wyżej */
    max-height: calc(100% - 12px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.prize-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 5px 12px; /* Zmniejszone z 6px */
    margin: 2px 0; /* Zmniejszone z 3px */
    border-radius: 4px;
    color: #bfa38a;
    font-size: 0.92rem;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.2s ease;
}

    .prize-item.active {
        background: #c39b55 !important;
        color: #1d140d !important;
        font-weight: 900;
        border-radius: 8px;
    }

    .prize-item.safe {
        color: #e5c158;
        font-weight: 900;
        border-bottom: 1px dashed rgba(229, 193, 88, 0.5);
    }

    .prize-item.won {
        color: rgba(191, 163, 138, 0.35);
        text-decoration: line-through;
    }

.prize-number {
    min-width: 24px;
    text-align: right;
}

.prize-value {
    text-align: right;
    flex: 1;
}

.safe-badge-icon {
    margin-left: 6px;
    font-size: 0.7rem;
}

/* =============================================================
   MODALE – PRZYCISKI PREMIUM
   ============================================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    backdrop-filter: blur(8px);
}

.maui-alert {
    background: #1f120c !important;
    border: 4px double var(--gold) !important;
    padding: clamp(32px, 5vw, 48px) !important;
    border-radius: 4px;
    text-align: center;
    width: 90%;
    max-width: 520px;
    margin: auto;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9), 0 0 30px rgba(212, 165, 74, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 400' preserveAspectRatio='none'%3E%3Cfilter id='modalTorn'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04 0.12' numOctaves='5' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='28' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect x='20' y='20' width='960' height='360' fill='white' filter='url(%23modalTorn)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 400' preserveAspectRatio='none'%3E%3Cfilter id='modalTorn'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04 0.12' numOctaves='5' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='28' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3Crect x='20' y='20' width='960' height='360' fill='white' filter='url(%23modalTorn)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}

.alert-header {
    flex-shrink: 0;
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--gold);
    margin-bottom: 15px;
    text-transform: uppercase;
    font-family: inherit;
    border-bottom: 2px solid var(--blue-accent);
    padding: 22px 24px 14px 24px !important;
    text-align: center;
    letter-spacing: 1.5px;
}

.alert-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    border: 1px solid rgba(139, 90, 43, 0.2);
    color: #fdf5e6;
}

.alert-text {
    font-family: inherit;
    white-space: pre-wrap;
    font-size: 1.1rem;
    line-height: 1.7;
    text-align: center;
    color: #fdf5e6 !important;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.alert-actions {
    flex-shrink: 0;
    background: transparent !important;
    border-top: 1px solid rgba(229, 193, 88, 0.3);
    padding: 16px 24px 18px 24px !important;
    margin-top: 10px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.alert-btn {
    padding: 14px 28px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    min-width: 130px;
    text-transform: uppercase;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    letter-spacing: 1.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--blue-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 200' preserveAspectRatio='none'%3E%3Cfilter id='btnTorn'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04 0.12' numOctaves='3' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='white' filter='url(%23btnTorn)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 200' preserveAspectRatio='none'%3E%3Cfilter id='btnTorn'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04 0.12' numOctaves='3' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='white' filter='url(%23btnTorn)'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}

.btn-ok, .btn-confirm {
    background: linear-gradient(180deg, #5a3420 0%, #3a1f12 50%, #241008 100%) !important;
    color: #f5efe6 !important;
    border: 2px solid #d4a54a !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 215, 140, 0.15);
}

    .btn-ok:hover, .btn-confirm:hover {
        background: linear-gradient(180deg, #6e3f28 0%, #4a2618 50%, #2e150a 100%) !important;
        border-color: #e8c86a !important;
        box-shadow: 0 6px 25px rgba(0, 0, 0, 0.6), 0 0 30px rgba(212, 165, 74, 0.35) !important;
        transform: translateY(-2px);
    }

    .btn-ok:active, .btn-confirm:active {
        transform: translateY(2px);
        box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    }

.btn-cancel {
    background: transparent !important;
    color: #bfa38a !important;
    border: 2px solid #6a4a3a !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

    .btn-cancel:hover {
        background: rgba(80, 40, 25, 0.3) !important;
        border-color: #8f2828 !important;
        color: #ff6b6b !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(143, 40, 40, 0.15) !important;
        transform: translateY(-2px);
    }

    .btn-cancel:active {
        transform: translateY(2px);
        box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    }

/* =============================================================
   ANIMACJE POMOCNICZE
   ============================================================= */
.loading-spinner {
    font-family: 'Cinzel', serif;
    color: var(--ink);
    font-size: 1.5rem;
    font-weight: bold;
    animation: pulse 1.5s infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.lifeline-processing {
    padding: 20px;
}

.processing-text {
    color: var(--gold);
    font-weight: bold;
    margin-bottom: 20px;
}

.calling-dots span {
    font-size: 3rem;
    animation: blink 1s infinite;
    color: var(--gold);
}

    .calling-dots span:nth-child(2) {
        animation-delay: 0.2s;
    }

    .calling-dots span:nth-child(3) {
        animation-delay: 0.4s;
    }

.audience-loader {
    display: flex;
    justify-content: center;
    gap: 10px;
    height: 40px;
    align-items: flex-end;
}

.bar-anim {
    width: 15px;
    background: var(--gold);
    animation: barGrow 1s infinite ease-in-out;
}

    .bar-anim:nth-child(2) {
        animation-delay: 0.2s;
    }

    .bar-anim:nth-child(3) {
        animation-delay: 0.4s;
    }

    .bar-anim:nth-child(4) {
        animation-delay: 0.6s;
    }

.audience-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 160px;
    margin: 15px 0;
    border-bottom: 2px solid #444;
    padding-bottom: 5px;
}

.chart-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 50px;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 80%;
    background: linear-gradient(to top, var(--royal-blue), var(--gold));
    border-radius: 5px 5px 0 0;
    position: relative;
    transition: height 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 10px var(--gold-glow);
}

.chart-percent {
    position: absolute;
    top: -22px;
    width: 100%;
    font-size: 0.7rem;
    font-weight: 900;
    color: var(--gold);
}

.chart-label {
    margin-top: 8px;
    font-weight: bold;
    color: var(--white);
    font-size: 0.9rem;
}

/* =============================================================
   RESPONSYWNOŚĆ – POPRAWIONE DLA IPAD, IPHONE Z NOTCHEM
   ============================================================= */

/* TABLETY (769px – 1199px) – OGÓLNE */
@media (min-width: 769px) and (max-width: 1199px) {
    .game-layout {
        display: grid !important;
        grid-template-columns: 1fr 2fr;
        gap: 20px;
        padding: 20px;
        padding-top: max(15px, env(safe-area-inset-top));
        padding-bottom: max(15px, env(safe-area-inset-bottom));
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        margin-top: 0 !important;
        align-items: start !important;
        max-width: 100% !important;
    }

    .game-header-bar {
        grid-column: 1 / -1 !important;
        margin-bottom: 10px !important;
        flex-wrap: nowrap !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        height: 54px !important;
        min-height: 54px !important;
        max-height: 54px !important;
        padding: 0 15px !important;
        box-sizing: border-box !important;
    }

    .mini-brand-header {
        font-size: clamp(1.4rem, 5vw, 2rem) !important;
    }

    .question-box {
        font-size: 1.1rem !important;
        min-height: 90px !important;
        max-height: 120px !important;
        padding: 16px 30px !important;
    }

    .answers-grid {
        gap: 12px !important;
    }

    .answer-btn {
        padding: 16px;
        font-size: 0.95rem;
    }

    .prize-panel {
        padding: 14px 12px !important; /* Lekko zmniejszone z 16px */
        max-width: 100% !important;
        align-self: start !important;
        margin-top: 34px !important; /* Zwiększone z 26px -> opuszcza całość niżej */
        max-height: calc(100% - 34px) !important;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .prize-item {
        font-size: 0.9rem !important;
        padding: 5px 12px !important; /* Zmniejszone z 6px */
        margin: 2px 0 !important; /* Zmniejszone z 3px */
    }

    .prize-number {
        min-width: 24px;
        font-size: 0.8rem;
    }

    .prize-value {
        font-size: 0.85rem;
    }

    .ranking-row {
        padding: 14px 18px !important;
        font-size: 1rem !important;
        min-height: 50px !important;
        gap: 14px !important;
    }

    .rank-pos {
        font-size: 1.1rem !important;
        width: 36px !important;
    }

    .rank-name {
        font-size: 1rem !important;
    }

    .rank-score {
        font-size: 1rem !important;
    }

    .rank-time {
        font-size: 0.8rem !important;
    }

    .rank-details {
        flex-direction: row !important;
        gap: 10px !important;
    }

    .maui-alert {
        max-width: 85% !important;
        padding: 30px !important;
    }

    .ranking-list {
        max-height: 55vh !important;
        gap: 12px !important;
    }
}

/* TABLETY – ORIENTACJA PIONOWA (iPad itp.) */
@media (min-width: 769px) and (max-width: 1199px) and (orientation: portrait) {
    .game-layout {
        display: grid !important;
        grid-template-columns: 210px 1fr !important;
        grid-template-rows: auto 1fr !important;
        gap: 20px 22px !important;
        padding: 20px !important;
        padding-top: max(20px, env(safe-area-inset-top)) !important;
        padding-bottom: max(20px, env(safe-area-inset-bottom)) !important;
        max-width: 880px !important;
        margin: 0 auto !important;
    }

    /* DUŻY NAGŁÓWEK – OPUSZCZONY O DODATKOWE 20PX W DÓŁ */
    .mini-brand-header-portrait {
        display: block !important;
        grid-column: 1 / -1 !important;
        grid-row: 1 !important;
        font-size: clamp(3.2rem, 6.5vw, 4.2rem) !important;
        text-align: center !important;
        letter-spacing: 6px !important;
        margin: 48px 0 10px 0 !important;
        padding: 0 !important;
    }

    .mini-brand-header-inline {
        display: none !important;
    }

    .prize-panel {
        grid-column: 1 !important;
        grid-row: 2 !important;
        margin-top: 15px !important;
        padding: 10px 8px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        gap: 2px !important;
    }

    .prize-item {
        font-size: 0.85rem !important;
        padding: 7px 8px !important;
    }

    .prize-number {
        min-width: 22px !important;
        font-size: 0.8rem !important;
    }

    .prize-value {
        font-size: 0.85rem !important;
    }

    /* PRAWA KOLUMNA – EKRAN GRY */
    .game-content {
        grid-column: 2 !important;
        grid-row: 2 !important;
        margin-top: 15px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 18px !important;
    }

    /* GÓRNA BELKA INTERFEJSU */
    .game-header-bar {
        height: 72px !important;
        min-height: 72px !important;
        max-height: 72px !important;
        padding: 0 16px !important;
    }

    .current-prize-info {
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
    }

    /* POLE PYTANIA */
    .question-box {
        font-size: clamp(1.1rem, 2.4vw, 1.35rem) !important;
        height: 140px !important;
        min-height: 140px !important;
        max-height: 140px !important;
        padding: 16px 20px !important;
        line-height: 1.35 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
    }

    /* NARRATOR */
    .narrator-container {
        width: calc(100% - 20px) !important;
        height: 70px !important;
        min-height: 70px !important;
        max-height: 70px !important;
    }

    .narrator-text {
        font-size: 1.05rem !important;
    }

    /* SIATKA ODPOWIEDZI */
    .answers-grid {
        gap: 18px !important;
    }

    .answer-btn {
        padding: 8px 14px !important;
        font-size: clamp(0.85rem, 1.6vw, 1.0rem) !important;
        height: 82px !important;
        min-height: 82px !important;
        max-height: 82px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        line-height: 1.18 !important;
        white-space: normal !important;
        overflow-wrap: break-word !important;
        word-break: normal !important;
        overflow: hidden !important;
    }
}

/* TABLETY – ORIENTACJA POZIOMA */
@media (min-width: 769px) and (max-width: 1199px) and (orientation: landscape) {
    .mini-brand-header-portrait {
        display: none !important;
    }

    .mini-brand-header-inline {
        display: block !important;
    }

    .game-layout {
        grid-template-columns: 1fr 2.5fr;
        gap: 25px !important;
        padding: 20px 25px !important;
        padding-top: max(20px, env(safe-area-inset-top)) !important;
        padding-bottom: max(20px, env(safe-area-inset-bottom)) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: 1100px !important;
    }

    .prize-panel {
        padding: 12px 10px !important;
        margin-top: 45px !important;
        max-height: calc(100% - 45px) !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        gap: 3px !important; /* Zwiększone z 2px na 3px */
    }

    .prize-item {
        font-size: 0.88rem !important;
        padding: 7px 12px !important; /* Zwiększone z 6px na 7px */
        margin: 1px 0 !important;
    }

    .prize-number {
        min-width: 26px !important;
        font-size: 0.85rem !important;
    }

    .prize-value {
        font-size: 0.9rem !important;
    }

    .current-prize-info {
        height: 55px !important;
        min-height: 55px !important;
        max-height: 55px !important;
        padding: 0 15px !important;
        display: flex !important;
        align-items: center !important;
    }

    .question-box {
        font-size: clamp(1.15rem, 2.5vw, 1.35rem) !important;
        min-height: 125px !important;
        max-height: 160px !important;
        display: flex !important;
        align-items: center !important;
        line-height: 1.3 !important;
    }

    .answers-grid {
        gap: 18px !important;
    }

    .answer-btn {
        padding: 12px 22px !important;
        font-size: clamp(1rem, 2vw, 1.2rem) !important;
        min-height: 72px !important;
        height: 72px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        line-height: 1.2 !important;
    }

    .game-header-bar {
        height: 68px !important;
        min-height: 68px !important;
        max-height: 68px !important;
        padding: 0 18px !important;
    }

    .narrator-container {
        width: calc(100% - 30px) !important;
        min-height: 54px !important;
        height: 54px !important;
    }

    .narrator-text {
        font-size: clamp(0.9rem, 1.5vw, 1.05rem) !important;
    }
}

/* TELEFONY – PORTRAIT */
@media (max-width: 768px) and (orientation: portrait) {

    /* --- BAZA DLA EKRANU STARTOWEGO (WYCZYŚCZONA) --- */
    .start-screen {
        height: 100dvh !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)) 16px !important;
        box-sizing: border-box !important;
        position: relative !important;
        overflow: hidden !important;
    }

        .start-screen .logo-container {
            margin-bottom: 20px !important;
            transform-origin: top center !important;
            transition: transform 0.2s ease, margin 0.2s ease !important;
        }

        .start-screen .form-card-wrapper {
            width: 100% !important;
            max-width: 320px !important;
            transform-origin: center center !important;
            transition: transform 0.2s ease !important;
            box-sizing: border-box !important;
        }

    .bottom-bar {
        transition: opacity 0.2s ease !important;
    }

    /* --- TRYB AKTYWNEJ KLAWIATURY (OBNIŻONY I BEZPIECZNY DLA WYSPY) --- */

    /* Sztywna blokada okna na czas wpisywania textu – brak podskakiwania Safari */
    body.keyboard-open {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: var(--vv-height, 100dvh) !important;
        overflow: hidden !important;
    }

        /* Układ ekranu startowego przy klawiaturze */
        body.keyboard-open .start-screen {
            height: var(--vv-height, 100dvh) !important;
            display: flex !important;
            flex-direction: column !important;
            justify-content: center !important;
            align-items: center !important;
            padding-top: max(16px, env(safe-area-inset-top)) !important;
            padding-bottom: 16px !important;
            box-sizing: border-box !important;
            overflow: hidden !important;
        }

            /* Ukrywanie logo i paska rankingu */
            body.keyboard-open .start-screen .logo-container,
            body.keyboard-open .start-screen .bottom-bar {
                display: none !important;
            }

            /* Zewnętrzna ramka zwoju – 25px opuszcza go bezpiecznie poniżej wyspy/notcha */
            body.keyboard-open .start-screen .form-card-wrapper {
                width: 100% !important;
                max-width: 320px !important;
                transform: none !important;
                margin: 25px auto 0 auto !important;
            }

            /* Wnętrze zwoju – 32px na dole daje luz przyciskowi od rolki */
            body.keyboard-open .start-screen .form-card {
                height: auto !important;
                padding: 36px 20px 32px 20px !important;
                box-sizing: border-box !important;
            }

            /* Elementy wewnątrz zwoju */
            body.keyboard-open .start-screen .welcome-back-msg {
                font-size: 0.8rem !important;
                margin-bottom: 6px !important;
            }

            body.keyboard-open .start-screen .input-label {
                font-size: 0.75rem !important;
                margin-bottom: 8px !important;
            }

            body.keyboard-open .start-screen .custom-input {
                padding: 10px 14px !important;
                font-size: 1rem !important; /* 1rem (16px) blokuje automatyczny zoom w Safari */
                margin-bottom: 14px !important;
                height: 44px !important;
            }

            body.keyboard-open .start-screen .btn-play-gold {
                padding: 10px 16px !important;
                height: 44px !important;
                font-size: 1rem !important;
            }

    /* --- POZOSTAŁE ELEMENTY GRY --- */
    .game-layout {
        display: flex;
        flex-direction: column;
        padding: 12px !important;
        padding-top: calc(12px + env(safe-area-inset-top)) !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
        gap: 10px !important;
        max-width: none !important;
        margin: 0 !important;
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .prize-panel {
        display: none !important;
    }

    .mini-brand-header {
        font-size: clamp(1.2rem, 6vw, 1.6rem) !important;
        margin-bottom: 8px;
    }

    .question-box {
        padding: 14px 16px !important;
        font-size: 0.9rem !important;
        line-height: 1.32 !important;
        min-height: 80px !important;
        max-height: none !important;
        filter: drop-shadow(0 5px 8px rgba(44,30,20,.22));
    }

    .narrator-container {
        width: calc(100% - 14px) !important;
    }

    .answer-btn {
        padding: 12px;
        font-size: 0.85rem;
    }

    .answers-grid {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    .game-header-bar {
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
        width: 94% !important;
        margin: 0 auto !important;
        margin-top: 2px !important;
        margin-bottom: 4px !important;
        padding: 0 12px !important;
        box-sizing: border-box !important;
        gap: 6px !important;
        background: radial-gradient(ellipse at 50% 30%, rgba(220, 205, 180, 0.2) 0%, transparent 60%), linear-gradient(180deg, #d4c8b4 0%, #c4b8a2 30%, #b0a088 70%, #9a8a74 100%) !important;
        border-top: 2px solid rgba(255, 255, 255, 0.15) !important;
        border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-right: 1px solid rgba(0, 0, 0, 0.12) !important;
        border-bottom: 3px solid rgba(74, 63, 47, 0.5) !important;
        border-radius: 0 !important;
        box-shadow: inset 0 2px 4px rgba(255,255,255, 0.12), inset 0 -6px 15px rgba(74, 63, 47, 0.12), 0 4px 12px rgba(0, 0, 0, 0.25) !important;
    }

    .timer-section, .actions-section, .lifelines-section {
        order: unset !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        height: 100% !important;
    }

    .game-header-bar span, .game-header-bar p, .game-header-bar h2, .game-header-bar h3 {
        font-size: clamp(0.7rem, 2.8vw, 0.85rem) !important;
        white-space: nowrap !important;
        line-height: 1.1 !important;
        margin: 0 !important;
    }

    .game-header-bar .timer {
        font-size: 0.85rem !important;
        font-weight: bold !important;
        font-variant-numeric: tabular-nums !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 70px !important;
        min-width: 70px !important;
        box-sizing: border-box !important;
        height: 28px !important;
        line-height: 28px !important;
        margin: 0 !important;
        padding: 0 6px !important;
        border-radius: 6px !important;
        background: rgba(0,0,0,0.5) !important;
        border: 1px solid #8f7a5c !important;
        color: #f0d070 !important;
        text-shadow: 0 0 4px rgba(0,0,0,0.5) !important;
        box-shadow: inset 0 0 4px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.2) !important;
    }

    .lifeline-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 1.0rem !important;
        margin: 0 !important;
        border-radius: 50% !important;
        background: radial-gradient(circle at 35% 35%, #8b6b3c, #5a4124, #2e1f10) !important;
        border: 2px solid #b88d4a !important;
        box-sizing: border-box !important;
        box-shadow: inset 0 1px 2px rgba(255,255,200,0.3), 0 3px 6px rgba(0,0,0,0.4) !important;
        color: #f7e5c2 !important;
    }

        .lifeline-btn:hover:not(:disabled) {
            background: radial-gradient(circle at 35% 35%, #a57d48, #6e4f2e, #3b2a18) !important;
            border-color: #dfb36b !important;
            transform: translateY(-2px);
            box-shadow: 0 0 12px rgba(200, 160, 80, 0.5), inset 0 1px 2px rgba(255,255,200,0.4) !important;
        }

        .lifeline-btn:disabled {
            opacity: 0.4;
            filter: grayscale(0.3);
        }

    .btn-resign {
        padding: 2px 10px !important;
        font-size: 0.65rem !important;
        white-space: nowrap !important;
        line-height: 1.4 !important;
        background: #2a1a1a !important;
        border: 2px solid #6a4a3a !important;
        color: #eeddbb !important;
        font-weight: bold !important;
        border-radius: 6px !important;
        box-sizing: border-box !important;
        box-shadow: inset 0 1px 2px rgba(255,255,255,0.1), 0 2px 6px rgba(0,0,0,0.5) !important;
        transition: all 0.2s ease;
        height: 28px !important;
        line-height: 28px !important;
    }

        .btn-resign:hover {
            background: #4a2a2a !important;
            border-color: #b98a32 !important;
            color: #ffd966 !important;
        }

    .current-prize-info {
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
    }

    .guaranteed-glow-badge {
        font-size: 0.55rem !important;
        padding: 1px 6px !important;
    }

    .current-amount {
        font-size: 0.95rem;
    }

    .maui-alert {
        padding: 32px 16px !important;
        max-width: 96% !important;
        max-height: 92vh !important;
    }

    .alert-header {
        font-size: 1.15rem !important;
        padding: 22px 14px 12px 14px !important;
        margin-bottom: 8px !important;
    }

    .ranking-list {
        max-height: 45vh !important;
        padding: 4px 4px !important;
        gap: 8px !important;
    }

    .ranking-row {
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
        min-height: 38px !important;
        gap: 8px !important;
        border-radius: 8px !important;
    }

    .rank-pos {
        width: 26px !important;
        font-size: 0.85rem !important;
    }

    .rank-name {
        font-size: 0.85rem !important;
    }

    .rank-score {
        font-size: 0.85rem !important;
    }

    .rank-time {
        font-size: 0.65rem !important;
    }

    .rank-details {
        flex-direction: row !important;
        gap: 6px !important;
    }

    .alert-actions {
        padding: 12px 14px 20px 14px !important;
        gap: 8px !important;
    }

    .alert-btn {
        padding: 10px 16px !important;
        font-size: 0.7rem !important;
        min-width: 90px !important;
    }
}

/* =============================================================
   TELEFONY – LANDSCAPE (SKORYGOWANY I OPTYMALIZOWANY)
   ============================================================= */
@media (max-height: 500px) and (orientation: landscape), (max-width: 900px) and (orientation: landscape) {

    /* --- 1. KONTENER GŁÓWNY --- */
    .start-screen {
        justify-content: center !important;
        height: var(--vv-height, 100dvh) !important;
        padding-top: max(6px, env(safe-area-inset-top)) !important;
        padding-bottom: max(6px, env(safe-area-inset-bottom)) !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

        /* RANKING I PASEK DOLNY – UKRYTY TYLKO NA EKRANIE STARTOWYM */
        .start-screen:not(.end-screen):not(.summary-screen):not(.summary-view) .bottom-bar {
            display: none !important;
        }

    .summary-view .bottom-bar,
    .summary-screen .bottom-bar,
    .end-screen .bottom-bar {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* --- 2. WIDOCZNOŚĆ LOGO I TYTUŁÓW --- */
    /* Domyślnie na ekranie startowym logo i tytuł są WIDOCZNE */
    .start-screen .logo-container,
    .start-screen .main-title,
    .start-screen .subtitle {
        display: block !important;
    }

    .start-screen .logo-container {
        margin-bottom: 2px !important;
        transform: scale(0.65);
        transform-origin: center center;
    }

    /* Ukrywanie tytułów i logo TYLKO podczas trwania gry */
    .game-layout .main-title,
    .game-layout .logo-container,
    .game-layout .subtitle {
        display: none !important;
    }

    /* --- 3. PERGAMIN STARTOWY (UKŁAD STATYCZNY) --- */
    .start-screen .form-card-wrapper {
        margin: 4px auto !important;
        width: 90% !important;
        max-width: 480px !important;
    }

    .start-screen .form-card {
        height: 110px !important;
        min-height: 110px !important;
        padding: 14px 30px !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transform-origin: center center !important;
        /* Usunięto transition: transform, by nie kłóciło się z JS */
    }

    /* Błyskawiczne ukrycie treści i tła papieru podczas zwijania */
    .form-card-wrapper.rolling-up .form-card-content,
    .form-card-wrapper.closing .form-card-content,
    .form-card-wrapper.rolling-up .starting-game-text,
    .form-card-wrapper.closing .starting-game-text {
        opacity: 0 !important;
        visibility: hidden !important;
        transition: opacity 0.2s ease-in-out !important;
    }

    /* Zawartość zwoju – Input i Przycisk w jednej linii */
    .start-screen .form-card-content {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 12px !important;
        width: 100% !important;
        transition: opacity 0.3s ease-in-out !important;
    }

    .start-screen .form-card .welcome-back-msg,
    .start-screen .form-card .input-label {
        display: none !important;
    }

    .start-screen .form-card .custom-input {
        flex: 1 1 auto !important;
        margin-bottom: 0 !important;
        height: 40px !important;
        padding: 6px 14px !important;
        font-size: 1rem !important;
        max-width: none !important;
    }

    .start-screen .btn-play-gold {
        flex: 0 0 auto !important;
        height: 40px !important;
        padding: 0 18px !important;
        font-size: 0.85rem !important;
        white-space: nowrap !important;
    }

    /* --- 4. KLAWIATURA NA TELEFONIE --- */
    body.keyboard-open .start-screen .logo-container,
    body.keyboard-open .start-screen .main-title,
    body.keyboard-open .start-screen .subtitle {
        display: none !important;
    }

    body.keyboard-open .start-screen {
        justify-content: center !important;
    }

        body.keyboard-open .start-screen .form-card-wrapper {
            margin: 0 auto !important;
        }

    /* --- 5. SIATKA I WIDOK GRY --- */
    .game-layout {
        max-width: 100% !important;
        padding-top: max(8px, env(safe-area-inset-top)) !important;
        padding-left: max(4px, env(safe-area-inset-left)) !important;
        padding-right: max(4px, env(safe-area-inset-right)) !important;
        padding-bottom: max(4px, env(safe-area-inset-bottom)) !important;
        margin-top: 0 !important;
        gap: 12px !important;
        display: grid !important;
        grid-template-columns: 150px minmax(0, 1fr) !important;
    }

    .game-content {
        padding: 0 !important;
        gap: 10px !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .game-header-bar {
        margin-top: 0 !important;
        padding: 4px 8px !important;
        min-height: 42px !important;
        height: 42px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
    }

        .game-header-bar .timer-section,
        .game-header-bar .lifelines-section,
        .game-header-bar .actions-section {
            display: flex !important;
            align-items: center !important;
            height: 100% !important;
            flex: 0 1 auto !important;
            gap: 4px !important;
        }

        .game-header-bar .lifelines-section {
            justify-content: center !important;
        }

        .game-header-bar .timer,
        .game-header-bar .btn-resign,
        .game-header-bar .lifeline-btn {
            margin: 0 !important;
            padding: 0 !important;
            line-height: 1 !important;
            transform: translateY(0) !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            flex-shrink: 0 !important;
            align-self: center !important;
        }

        .game-header-bar .timer {
            font-size: 0.7rem !important;
            min-width: 55px !important;
            height: 26px !important;
            line-height: 26px !important;
            padding: 0 4px !important;
        }

        .game-header-bar .btn-resign {
            font-size: 0.55rem !important;
            height: 26px !important;
            line-height: 26px !important;
            padding: 0 6px !important;
        }

        .game-header-bar .lifeline-btn {
            width: 28px !important;
            height: 28px !important;
            font-size: 0.75rem !important;
        }

    .mini-brand-header {
        font-size: clamp(1.0rem, 4.5vw, 1.3rem) !important;
        margin-bottom: 2px;
        padding: 0 !important;
    }

    .question-box {
        min-height: 70px !important;
        max-height: 80px !important;
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
        margin: 0 !important;
    }

    .answers-grid {
        gap: 6px !important;
    }

    .answer-btn {
        padding: 4px 10px !important;
        font-size: 0.72rem !important;
        min-height: 38px !important;
        height: 38px !important;
    }

    /* --- 6. NARRATOR --- */
    .narrator-container {
        margin: 2px auto !important;
        padding: 0 !important;
        height: 36px !important;
        min-height: 36px !important;
        max-height: 36px !important;
        width: 100% !important;
        max-width: none !important;
    }

    .narrator-inner {
        height: 30px !important;
        min-height: 30px !important;
        width: 100% !important;
        padding: 0 20px !important;
        gap: 6px !important;
        border-radius: 0 !important;
        box-sizing: border-box !important;
    }

    .narrator-icon {
        font-size: 0.75rem !important;
    }

    .narrator-text {
        font-size: 0.65rem !important;
        line-height: 1.2 !important;
    }

    .narrator-container .scroll-roller {
        top: -2px !important;
        bottom: -2px !important;
        width: 10px !important;
        will-change: transform;
        backface-visibility: hidden;
    }

    .narrator-container .roller-body {
        width: 6px !important;
    }

    .narrator-container .roller-cap-top,
    .narrator-container .roller-cap-bottom {
        width: 10px !important;
        height: 3px !important;
    }

    /* --- 7. PANEL DRABINKI WYGRANYCH --- */
    .prize-panel {
        display: flex !important;
        flex-direction: column !important;
        padding: 6px 8px !important;
        min-width: 95px !important;
        max-width: 165px !important;
        align-self: start !important;
        margin-top: 10px !important;
        margin-bottom: 6px !important;
        max-height: calc(100dvh - 16px) !important;
        justify-content: space-between !important;
        gap: 2px !important;
        overflow-y: auto !important;
    }

    .prize-item {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 4px 6px !important;
        font-size: 0.72rem !important;
        margin: 0 !important;
        gap: 3px !important;
        flex: 0 1 auto !important;
    }

    .prize-number {
        min-width: 16px !important;
        font-size: 0.5rem !important;
    }

    .prize-value {
        font-size: 0.55rem !important;
    }

    .safe-badge-icon {
        font-size: 0.35rem !important;
        margin-left: 2px !important;
    }

    .current-prize-info {
        height: 36px !important;
        min-height: 36px !important;
        max-height: 36px !important;
        padding: 0 8px !important;
        margin: 0 !important;
    }

    .guaranteed-glow-badge {
        font-size: 0.45rem !important;
        padding: 1px 4px !important;
    }

    .current-amount {
        font-size: 0.7rem;
    }

    /* --- 8. MODALE I ALERTY --- */
    .maui-alert {
        max-width: 98% !important;
        padding: 12px 10px !important;
        max-height: 98vh !important;
        overflow: hidden !important;
    }

    .alert-header {
        font-size: 0.9rem !important;
        padding: 8px 8px 4px 8px !important;
        margin-bottom: 4px !important;
        border-bottom-width: 1px !important;
    }

    .alert-body {
        padding: 8px 6px !important;
    }

    .ranking-list {
        max-height: 50vh !important;
        padding: 4px 4px !important;
        gap: 6px !important;
    }

    .ranking-row {
        padding: 6px 10px !important;
        font-size: 0.65rem !important;
        min-height: 26px !important;
        gap: 6px !important;
        border-radius: 6px !important;
        border-width: 1px !important;
    }

    .rank-pos {
        width: 20px !important;
        font-size: 0.65rem !important;
        flex-shrink: 0;
    }

    .rank-name {
        font-size: 0.65rem !important;
        flex: 1 1 auto;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .rank-score {
        font-size: 0.65rem !important;
        flex-shrink: 0;
    }

    .rank-time {
        font-size: 0.5rem !important;
        flex-shrink: 0;
    }

    .rank-details {
        flex-direction: row !important;
        gap: 6px !important;
    }

    .alert-actions {
        padding: 6px 10px 8px 10px !important;
        gap: 4px !important;
        margin-top: 4px !important;
        flex-shrink: 0 !important;
        position: relative !important;
        z-index: 10 !important;
    }

    .alert-btn {
        padding: 4px 10px !important;
        font-size: 0.6rem !important;
        min-width: 60px !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 20 !important;
    }

    .modal-overlay {
        pointer-events: auto !important;
    }

    .alert-icon {
        display: none !important;
    }
}

/* Ukrywanie/odkrywanie tytułu na summary i start w landscape */
@media (max-height: 500px) and (orientation: landscape), (max-width: 900px) and (orientation: landscape) {
    .summary-view .main-title,
    .summary-view .logo-container,
    .summary-view .subtitle {
        display: block !important;
    }

    .start-screen .main-title,
    .start-screen .logo-container,
    .start-screen .subtitle {
        display: block !important;
    }
}
