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

:root {
    --gold: #FFDF00;
    --gold-dark: #B8860B;
    --bg-dark: rgba(20, 20, 20, 0.85);

    /*
     * Šířkový limit: 5 válců, padding 10px*2 + border 6px*2 + gap 2px*4 = 40px overhead
     * Výškový limit: dostupná výška = 100dvh - logo(~60px) - ui-panel(~160px) - bannery(~30px) - gapy(~60px) = 100dvh - 310px
     * symbol-size = min(šířkový, výškový) — ikona nikdy nepřeteče ani do stran ani dolů
     */
    --reels-overhead-w: 40px;
    --reels-overhead-h: 310px;
    --symbol-size: min(calc((100vw - var(--reels-overhead-w)) / 5),
            calc((100dvh - var(--reels-overhead-h)) / 3),
            180px);
    --reel-height: calc(var(--symbol-size) * 3);
}

button,
.bonus-chest,
.pt-item,
a {
    touch-action: manipulation;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: pan-x pan-y;
    position: fixed;
    /* Poznámka: flex center je na .slot-wrapper, ne zde */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.slot-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100dvh;
    backdrop-filter: blur(2px);
    background: radial-gradient(circle, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}

.game-layout {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px 10px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.paytable-panel {
    background: var(--bg-dark);
    border: 4px solid var(--gold-dark);
    border-radius: 15px;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    width: auto;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 5px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--gold);
    font-size: 2rem;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.close-btn:hover {
    color: #fff;
    transform: scale(1.1);
}

.paytable-panel h2 {
    grid-column: 1 / -1;
    color: var(--gold);
    margin: 0;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    font-size: 1.5rem;
    letter-spacing: 2px;
    padding-top: 5px;
}

.pt-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 223, 0, 0.2);
}

.pt-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

.pt-desc {
    font-size: 0.8rem;
    line-height: 1.2;
}

.pt-desc span {
    color: var(--gold);
    font-weight: bold;
    font-size: 1rem;
}

.pt-desc small {
    color: #aaa;
}

.pt-vals {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    color: #ccc;
}

.pt-vals b {
    color: var(--gold);
    margin-left: 5px;
}

.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: fit-content;
}

.logo {
    font-size: clamp(1.4rem, 5vw, 3.2rem);
    font-weight: 900;
    text-transform: uppercase;
    color: #FFDF00;
    letter-spacing: clamp(2px, 1.5vw, 8px);
    padding: clamp(10px, 2vw, 15px) clamp(20px, 4vw, 60px);
    background: linear-gradient(to bottom, rgba(40, 40, 40, 0.95), rgba(10, 10, 10, 0.95));
    border: 3px solid #B8860B;
    border-radius: 12px;
    width: fit-content;
    margin: 0 auto;
    box-shadow:
        0 15px 25px rgba(0, 0, 0, 0.9),
        inset 0 0 20px rgba(255, 223, 0, 0.2),
        0 0 40px rgba(255, 223, 0, 0.15);
    text-shadow:
        0 4px 6px rgba(0, 0, 0, 1),
        0 0 20px rgba(255, 223, 0, 0.5);
    position: relative;
    margin-bottom: -10px;
    /* Pull reels slightly closer */
    white-space: nowrap;
}

/* Decorative rivets on the sides */
.logo::before,
.logo::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: radial-gradient(circle, #FFF176, #B8860B);
    border-radius: 50%;
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
}

.logo::before {
    left: 25px;
}

.logo::after {
    right: 25px;
}

.reels-container {
    display: flex;
    gap: 2px;
    padding: 10px;
    background: var(--bg-dark);
    border: 6px solid var(--gold);
    border-radius: 15px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    position: relative;
    padding-top: 50px;
    /* Space for the integrated jackpot */
}

.jackpot-banner-integrated {
    position: absolute;
    top: 5px;
    left: 10px;
    right: 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid rgba(255, 223, 0, 0.3);
}

.jackpot-banner-integrated .jackpot-tier {
    padding: 2px 5px;
    border-width: 1px;
}

.jackpot-banner-integrated .jackpot-name {
    font-size: 0.6rem;
}

.jackpot-banner-integrated .jackpot-value {
    font-size: 0.75rem;
}

/* Gold inner frame */
.reels-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid rgba(255, 223, 0, 0.5);
    border-radius: 9px;
    pointer-events: none;
}

.reel {
    flex: 1;
    height: var(--reel-height);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 223, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 10px 15px rgba(0, 0, 0, 0.8), inset 0 -10px 15px rgba(0, 0, 0, 0.8);
}

.symbols {
    display: flex;
    flex-direction: column;
    width: 100%;
    /* translateY will be manipulated by JS */
    will-change: transform;
}

.symbol {
    width: 100%;
    height: var(--symbol-size);
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding: 5px;
}

.symbol img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
    transform: translateZ(0);
    /* Hardware acceleration hint */
    will-change: transform;
}

/* Blur effect class applied during spin - optimized for mobile by removing drop-shadow */
.blur {
    filter: blur(2px);
    opacity: 0.8;
}

.ui-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(to bottom, rgba(30, 30, 30, 0.9), rgba(10, 10, 10, 0.95));
    border: 3px solid var(--gold-dark);
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), inset 0 2px 10px rgba(255, 223, 0, 0.2);
    width: 100%;
    box-sizing: border-box;
}

.ui-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}

.volume-icon {
    font-size: 1rem;
}

.volume-level-text {
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: 900;
}

.bet-group {
    flex-direction: row;
    gap: 15px;
}

.bet-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.ui-label {
    font-size: 0.8rem;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.ui-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    font-variant-numeric: tabular-nums;
}

.bet-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--gold-dark);
    background: radial-gradient(circle, #444, #111);
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.bet-btn:hover {
    background: radial-gradient(circle, #555, #222);
    border-color: var(--gold);
    transform: scale(1.05);
}

.bet-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}

.spin-btn {
    padding: 15px 50px;
    font-size: 2rem;
    font-weight: 900;
    color: #111;
    background: linear-gradient(to bottom, var(--gold), var(--gold-dark));
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6), inset 0 2px 5px rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all 0.2s;
}

.spin-btn:hover {
    background: linear-gradient(to bottom, #FFF176, var(--gold));
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.8), inset 0 2px 5px rgba(255, 255, 255, 0.7);
}

.spin-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8), inset 0 1px 3px rgba(255, 255, 255, 0.5);
}

.spin-btn:disabled {
    background: linear-gradient(to bottom, #777, #444);
    color: #aaa;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@keyframes pulse {
    0% {
        transform: scale(1) translateZ(0);
        filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
    }

    50% {
        transform: scale(1.15) translateZ(0);
        filter: drop-shadow(0 0 20px var(--gold));
        z-index: 10;
    }

    100% {
        transform: scale(1) translateZ(0);
        filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
    }
}

.win-pulse img {
    animation: pulse 1s infinite;
    position: relative;
    z-index: 10;
    will-change: transform, filter;
}

/* Bonus Modal Styles */
.bonus-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.bonus-content {
    background: linear-gradient(to bottom, #2a1f00, #111);
    border: 6px solid var(--gold);
    border-radius: 20px;
    padding: clamp(15px, 4vw, 40px);
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 223, 0, 0.3), inset 0 0 20px rgba(255, 223, 0, 0.1);
    max-width: min(600px, 95vw);
    width: 100%;
}

.bonus-title {
    color: var(--gold);
    font-size: 2.5rem;
    margin: 0 0 10px 0;
    text-shadow: 0 0 20px var(--gold-dark);
}

.bonus-subtitle {
    color: #ddd;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

/* Updates Modal (Audit 8) */
.updates-list {
    color: #fff;
    line-height: 1.6;
    margin: 20px 0;
    padding-left: 15px;
    font-size: 0.95rem;
    list-style: none;
}

.updates-list li {
    margin-bottom: 12px;
    position: relative;
    padding-left: 25px;
}

.updates-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--gold);
}

.hide-updates-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
}

.hide-updates-wrap input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

@media (max-width: 600px) {
    .bonus-title {
        font-size: 1.8rem;
    }
    .updates-list {
        font-size: 0.85rem;
        padding-left: 5px;
    }
}

.bonus-chests {
    display: flex;
    justify-content: center;
    gap: clamp(10px, 4vw, 30px);
    margin-bottom: 20px;
}

.bonus-chest {
    width: clamp(80px, 22vw, 150px);
    height: clamp(80px, 22vw, 150px);
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.8));
    position: relative;
}

.selected-prize {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1.5rem, 5vw, 3rem);
    font-weight: bold;
    color: var(--gold);
    text-shadow: 0 0 20px black, 0 0 30px #FFDF00;
    pointer-events: none;
    z-index: 5;
}

.unselected-prize {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1rem, 4vw, 2rem);
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 4px black, 0 0 10px black;
    pointer-events: none;
    z-index: 5;
}

.bonus-chest:hover {
    transform: scale(1.1) translateY(-10px);
    filter: drop-shadow(0 15px 25px rgba(255, 223, 0, 0.4));
}

.bonus-chest img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bonus-win {
    font-size: 3rem;
    font-weight: bold;
    color: #fff;
    min-height: 60px;
    text-shadow: 0 0 30px var(--gold);
    opacity: 0;
    transition: opacity 0.5s;
}

/* Free Spins Banner */
.free-spins-banner {
    background: linear-gradient(to right, transparent, var(--gold-dark), transparent);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 900;
    text-align: center;
    padding: 8px 0;
    width: 100%;
    text-shadow: 0 2px 4px #000;
    letter-spacing: 2px;
    animation: pulse 1.5s infinite;
    /* Záporný margin odstraněn — layout řeší gap v main-containeru */
    z-index: 5;
    border-radius: 8px;
}

/* Win Lines SVG */
.win-lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

.win-line-path {
    fill: none;
    stroke: var(--gold);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 10px #FFDF00);
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 1s forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* Big Win Overlay */
.big-win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

#coin-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    /* Ensure coins are ALWAYS behind text */
}

.big-win-text {
    font-size: clamp(4rem, 18vw, 8rem);
    font-weight: 900;
    color: var(--gold);
    text-transform: uppercase;
    text-shadow: 0 0 50px var(--gold-dark), 0 5px 15px #000;
    animation: bigWinEntrance 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, bigWinPulse 0.5s 0.6s infinite alternate;
    z-index: 5;
    position: relative;
    transform: scale(0);
    text-align: center;
    line-height: 1.1;
    width: 100vw;
}

.big-win-amount {
    font-size: 4rem;
    color: #fff;
    text-shadow: 0 0 20px var(--gold);
    margin-top: 20px;
    z-index: 5;
    position: relative;
    font-variant-numeric: tabular-nums;
}

@keyframes bigWinEntrance {
    0% {
        transform: scale(0) translateY(50px) rotate(-10deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.2) translateY(-20px) rotate(5deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) translateY(0) rotate(0deg);
        opacity: 1;
    }
}

@keyframes bigWinPulse {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.05);
    }
}

/* Toggle Buttons (Auto / Turbo / Volume) */
.toggle-group {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    min-width: fit-content;
}

#volume-cycle-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.volume-icon {
    display: none;
}

.toggle-btn {
    background: #333;
    color: #888;
    border: 2px solid #555;
    border-radius: 10px;
    padding: 5px 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--gold-dark);
    color: #fff;
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold);
}

/* Scatter Teaser Glow */
.teaser-glow {
    box-shadow: inset 0 0 30px var(--gold), 0 0 30px var(--gold) !important;
    border-color: var(--gold) !important;
    animation: teaserPulse 0.5s infinite alternate;
}

.teaser-active {
    box-shadow: inset 0 0 60px #FFDF00, 0 0 60px #FFDF00 !important;
    border-color: #FFDF00 !important;
    animation: teaserFiery 0.25s infinite alternate;
}

@keyframes teaserFiery {
    from {
        filter: brightness(1) contrast(1.1);
    }

    to {
        filter: brightness(1.5) contrast(1.3);
    }
}

@keyframes teaserPulse {
    from {
        filter: brightness(1);
    }

    to {
        filter: brightness(1.5);
    }
}

/* Dimming effect focusing on chests */
.reels-dimmed .reel {
    border-color: #333;
    box-shadow: none;
}

.reels-dimmed .symbol:not(.is-chest) {
    filter: brightness(0.2) grayscale(0.5);
    transition: filter 0.5s;
}

.reels-dimmed .symbol.is-chest {
    filter: brightness(1.2) drop-shadow(0 0 30px #FFDF00);
    position: relative;
    z-index: 10;
    transform: scale(1.05);
    transition: all 0.5s;
}

.sticky-wild {
    position: absolute;
    box-sizing: border-box;
    padding: 10px;
    z-index: 18;
    animation: stickyDrop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sticky-wild img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 15px #FFDF00) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
}

@keyframes stickyDrop {
    from {
        transform: scale(3) translateY(-50px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    :root {
        /*
         * Mobil portrait (S22 = 360px wide, ~780px high po odečtení system UI):
         * Šířkový limit: 5 válců v 96vw, overhead ~28px (border+padding+gap)
         * Výškový limit: 100dvh - logo(~48px) - fs-banner(~36px) - ui-panel(~130px) - jackpot(~44px) - gapy(~50px) = ~dvh-308px
         * safe-area-inset pro notch/průstřel
         */
        --reels-overhead-w: 28px;
        --reels-overhead-h: calc(308px + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px));
        --symbol-size: min(calc((96vw - var(--reels-overhead-w)) / 5),
                calc((100dvh - var(--reels-overhead-h)) / 3),
                110px);
        --reel-height: calc(var(--symbol-size) * 3);
    }

    .game-layout {
        padding: 6px 2px;
        gap: 6px;
        justify-content: center;
    }

    .main-container {
        gap: 6px;
        width: 96vw;
    }

    .logo {
        font-size: clamp(1rem, 5vw, 1.6rem);
        padding: 6px 12px;
        margin-bottom: 0;
        border-width: 2px;
        border-radius: 8px;
        letter-spacing: 2px;
        width: 100%;
        text-align: center;
    }

    .logo::before,
    .logo::after {
        display: none;
    }

    /* === VÁLCE === */
    .reels-container {
        padding: 4px;
        padding-top: 44px;
        /* jackpot banner ~38px + top offset 4px + mezera 2px */
        width: 100%;
        margin: 0 auto;
        border-width: 3px;
        border-radius: 10px;
        gap: 2px;
    }

    .reel {
        flex: 1;
        min-width: 0;
        /* důležité pro flex children */
    }

    .symbol {
        width: 100%;
        height: var(--symbol-size);
        padding: 3px;
    }

    .symbol img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    /* === JACKPOT BANNER — 4 sloupce, kompaktní === */
    .jackpot-banner-integrated {
        grid-template-columns: repeat(4, 1fr);
        gap: 3px;
        top: 4px;
        left: 4px;
        right: 4px;
        padding: 2px;
        border-radius: 6px;
    }

    .jackpot-banner-integrated .jackpot-tier {
        padding: 2px 3px;
        border-width: 1px;
        border-radius: 4px;
        min-height: 0;
    }

    .jackpot-banner-integrated .jackpot-name {
        font-size: 0.45rem;
        letter-spacing: 0;
        margin-bottom: 0;
    }

    .jackpot-banner-integrated .jackpot-value {
        font-size: 0.58rem;
        font-weight: 700;
        letter-spacing: -0.3px;
        /* zkompaktnit čísla */
    }

    /* === FREE SPINS BANNER === */
    .free-spins-banner {
        font-size: 1rem;
        padding: 5px 0;
        letter-spacing: 1px;
        width: 100%;
    }

    /* === UI PANEL — kompaktní grid === */
    .ui-panel {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px 8px;
        padding: 6px 8px;
        border-radius: 10px;
        width: 100%;
        border-width: 2px;
    }

    .ui-group {
        min-width: 0;
        margin: 0;
    }

    .ui-group:nth-child(1) {
        grid-column: 1;
        align-items: center;
    }

    .ui-group:nth-child(2) {
        grid-column: 2;
        align-items: center;
    }

    .bet-group {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: center;
        gap: 12px;
        width: 100%;
    }

    .toggle-group {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: center;
        gap: 6px;
    }

    .toggle-btn {
        flex: 1;
        max-width: 70px;
        padding: 4px 6px;
        font-size: 0.7rem;
    }

    .ui-label {
        font-size: 0.65rem;
        letter-spacing: 1px;
        margin-bottom: 2px;
    }

    .ui-value {
        font-size: 1.1rem;
    }

    .bet-btn {
        width: 34px;
        height: 34px;
        font-size: 1.2rem;
    }

    .spin-btn {
        grid-column: 1 / -1;
        padding: 9px 0;
        font-size: 1.3rem;
        width: 80%;
        max-width: 220px;
        margin: 2px auto;
        height: 44px;
        letter-spacing: 2px;
    }

    /* === MODALY === */
    .paytable-panel {
        grid-template-columns: 1fr;
        padding: 12px;
        max-height: 85dvh;
    }

    .bonus-title {
        font-size: 1.5rem;
    }

    .bonus-subtitle {
        font-size: 0.95rem;
        margin-bottom: 15px;
    }

    .bonus-win {
        font-size: 1.8rem;
        min-height: 40px;
    }

    .auto-panel,
    .bet-panel {
        width: 92vw;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .logo {
        display: none;
    }

    .game-layout {
        flex-direction: row;
        gap: 10px;
    }

    .ui-panel {
        width: auto;
        padding: 6px 8px;
        flex-direction: column;
        gap: 4px;
    }

    .ui-value {
        font-size: 0.9rem;
    }

    .spin-btn {
        padding: 6px 20px;
        font-size: 1rem;
        height: auto;
    }

    .bet-btn {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }

    .reels-container {
        padding: 4px;
        padding-top: 40px;
    }

    :root {
        --reels-overhead-h: 80px;
        /* V landscape je výška omezující faktor */
        --reels-overhead-w: 280px;
        /* ui-panel zabírá stranu */
    }
}

/* Modals for Auto & Bet */
.auto-panel,
.bet-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 400px;
    width: 90vw;
}

.auto-panel p {
    font-size: 1.2rem;
    color: #ddd;
    margin-bottom: 20px;
}

.auto-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.auto-opt-btn,
.bet-opt-btn {
    background: linear-gradient(to bottom, #444, #222);
    border: 2px solid var(--gold-dark);
    border-radius: 10px;
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: bold;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.auto-opt-btn:hover,
.bet-opt-btn:hover {
    background: linear-gradient(to bottom, #666, #333);
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 223, 0, 0.2);
}

.auto-opt-btn:active,
.bet-opt-btn:active {
    transform: scale(0.95);
}

.auto-stop-option {
    margin-top: 20px;
    font-size: 1.2rem;
    color: #fff;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.auto-stop-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--gold);
}

.bet-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (max-width: 400px) {

    .auto-options,
    .bet-grid {
        gap: 8px;
    }

    .auto-opt-btn,
    .bet-opt-btn {
        padding: 10px;
        font-size: 1.2rem;
    }
}

/* Live Players */
.live-players {
    position: absolute;
    top: 15px;
    left: 20px;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    z-index: 100;
    text-shadow: 0 2px 4px #000;
    animation: livePulse 2s infinite alternate;
}

@keyframes livePulse {
    from {
        opacity: 0.7;
    }

    to {
        opacity: 1;
    }
}

/* Jackpot Panel (standalone, pokud se použije mimo reels-container) */
.jackpot-panel {
    background: linear-gradient(to bottom, rgba(30, 30, 30, 0.95), rgba(10, 10, 10, 0.98));
    border: 3px solid var(--gold-dark);
    border-radius: 25px;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(255, 223, 0, 0.05);
}

.jackpot-title {
    color: var(--gold);
    font-size: 1.3rem;
    font-weight: 900;
    text-align: center;
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-shadow: 0 0 10px var(--gold-dark);
}

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

.jackpot-tier {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #111;
    border-radius: 6px;
    padding: 6px;
    border: 1px solid #333;
}

.jackpot-name {
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.jackpot-value {
    font-size: 0.95rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

/* Tier Colors */
.diamond {
    border-color: #00ffff;
    box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.2);
}

.diamond .jackpot-name,
.diamond .jackpot-value {
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff;
}

.gold {
    border-color: #ffd700;
    box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.2);
}

.gold .jackpot-name,
.gold .jackpot-value {
    color: #ffd700;
    text-shadow: 0 0 5px #ffd700;
}

.silver {
    border-color: #c0c0c0;
    box-shadow: inset 0 0 10px rgba(192, 192, 192, 0.2);
}

.silver .jackpot-name,
.silver .jackpot-value {
    color: #c0c0c0;
    text-shadow: 0 0 5px #c0c0c0;
}

.bronze {
    border-color: #cd7f32;
    box-shadow: inset 0 0 10px rgba(205, 127, 50, 0.2);
}

.bronze .jackpot-name,
.bronze .jackpot-value {
    color: #cd7f32;
    text-shadow: 0 0 5px #cd7f32;
}

@media (max-width: 600px) {
    .jackpot-tiers {
        grid-template-columns: repeat(2, 1fr);
    }

    .live-players {
        font-size: 0.8rem;
        top: 10px;
        left: 10px;
    }
}

/* Height-based responsiveness — POUZE pro desktop (šířka > 768px) */
@media (max-height: 900px) and (min-width: 769px) {
    :root {
        --reels-overhead-h: 280px;
        /* Na menším desktopu trochu zvětšit dostupný prostor */
    }

    .main-container {
        gap: 10px;
    }

    .jackpot-panel {
        margin-bottom: 5px;
        padding: 5px;
    }

    .jackpot-title {
        font-size: 1.1rem;
        margin-bottom: 4px;
    }

    .logo {
        font-size: clamp(1.2rem, 4vw, 2rem);
        padding: 5px 15px;
        margin-bottom: 0;
    }
}

@media (max-height: 750px) and (min-width: 769px) {
    :root {
        --reels-overhead-h: 260px;
    }

    .main-container {
        gap: 5px;
    }

    .ui-panel {
        padding: 5px 10px;
    }

    .jackpot-value {
        font-size: 0.8rem;
    }
}

/* Jackpot Wheel Animation */
.jp-overlay-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.15) 0%, transparent 60%);
    animation: jpBgPulse 2s infinite alternate;
    pointer-events: none;
    z-index: 1;
}

@keyframes jpBgPulse {
    from {
        opacity: 0.5;
    }

    to {
        opacity: 1;
        transform: scale(1.1);
    }
}

.jp-title-glow {
    font-size: clamp(3rem, 10vw, 5rem);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 20px #FFDF00, 0 0 40px #FFDF00, 0 0 60px #FF8C00;
    margin-bottom: 40px;
    z-index: 10;
    animation: bigWinEntrance 1s forwards;
    text-align: center;
}

.wheel-container {
    position: relative;
    width: min(320px, 85vw);
    height: min(320px, 85vw);
    z-index: 10;
}

.wheel-pointer {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3.5rem;
    color: #fff;
    text-shadow: 0 2px 5px #000, 0 0 10px var(--gold);
    z-index: 15;
}

.jackpot-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid var(--gold);
    box-shadow: 0 0 30px var(--gold), inset 0 0 20px #000;
    position: relative;
    overflow: hidden;
    background: conic-gradient(#cd7f32 0deg 45deg,
            #c0c0c0 45deg 90deg,
            #cd7f32 90deg 135deg,
            #ffd700 135deg 180deg,
            #cd7f32 180deg 225deg,
            #c0c0c0 225deg 270deg,
            #cd7f32 270deg 315deg,
            #00ffff 315deg 360deg);
    transition: transform 6s cubic-bezier(0.1, 0.7, 0.05, 1);
}

.wheel-slice {
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 50%;
    transform-origin: 0% 100%;
    transform: rotate(calc(var(--rot) - 45deg));
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1rem;
    color: #fff;
    text-shadow: 1px 1px 3px #000;
    padding-left: 30px;
    padding-bottom: 20px;
    box-sizing: border-box;
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: #111;
    border: 4px solid var(--gold);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--gold);
    box-shadow: 0 0 10px #000;
}

/* Leaderboard Styles */
.leaderboard-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 5px;
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: background 0.2s;
}

.leaderboard-row:hover {
    background: rgba(255, 255, 255, 0.1);
}

.leaderboard-row.current-user {
    border-left-color: var(--gold);
    background: rgba(255, 223, 0, 0.1);
}

.lb-rank {
    width: 30px;
    font-weight: 900;
    color: var(--gold);
}

.lb-name {
    flex: 1;
    text-align: left;
    padding-left: 10px;
    font-weight: bold;
}

.lb-score {
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

#nickname-input:focus {
    outline: none;
    box-shadow: 0 0 15px var(--gold);
    border-color: #fff;
}

/* Scrollbar for Leaderboard */
#leaderboard-list::-webkit-scrollbar {
    width: 6px;
}
#leaderboard-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}
#leaderboard-list::-webkit-scrollbar-thumb {
    background: var(--gold-dark);
    border-radius: 10px;
}