* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: radial-gradient(circle at top, #2c0b3f 0%, #0b0414 70%);
    font-family: "Segoe UI", Arial, sans-serif;
    color: #fff;
    overflow-x: hidden;
}

.btn-back {
    display: inline-block;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 13px;
    padding: 8px 4px;
    transition: color 0.15s;
}

.btn-back:hover {
    color: #fff;
}

.cabinet {
    display: flex;
    align-items: stretch;
}

.machine {
    background: linear-gradient(160deg, #3a0d5c, #1a0630);
    border: 4px solid #ffd54a;
    border-radius: 24px;
    padding: 32px 40px;
    box-shadow: 0 0 40px rgba(255, 213, 74, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 420px;
    max-width: 92vw;
}

.cabinet .machine {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

h1 {
    margin: 0 0 16px;
    font-size: 28px;
    text-shadow: 0 0 10px #ffd54a;
}

.lang-switch {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 10px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 213, 74, 0.4);
    color: rgba(255, 255, 255, 0.6);
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.lang-btn.active {
    color: #3a0d5c;
    background: linear-gradient(180deg, #ffe27a, #ffb400);
    border-color: #ffd54a;
}

.lang-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.user-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 10px;
    min-height: 36px;
    margin-bottom: 14px;
    max-width: 100%;
}

#google-btn-container {
    max-width: 100%;
    overflow: hidden;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: none;
    border: 2px solid #ffd54a;
}

#user-name {
    font-weight: bold;
    color: #ffd54a;
}

.user-link {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.user-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== Wyświetlacz LED/VFD w stylu starego automatu ===== */

.digital-display {
    position: relative;
    background: #050805;
    border: 3px solid #1c1c1c;
    border-radius: 6px;
    box-shadow:
        inset 0 0 14px rgba(0, 0, 0, 0.9),
        inset 0 3px 6px rgba(0, 0, 0, 0.85),
        0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.digital-display::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.35) 0px,
        rgba(0, 0, 0, 0.35) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 1;
}

.digital-display::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, transparent 35%);
    pointer-events: none;
    z-index: 1;
}

.digital-text {
    position: relative;
    z-index: 2;
    display: inline-block;
    font-family: "Consolas", "Courier New", monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
    color: #ffb02e;
    text-shadow: 0 0 4px #ffb02e, 0 0 10px rgba(255, 140, 0, 0.85), 0 0 22px rgba(255, 100, 0, 0.5);
}

.digital-text.win {
    color: #3dff7a;
    text-shadow: 0 0 4px #3dff7a, 0 0 10px rgba(61, 255, 122, 0.85), 0 0 22px rgba(61, 255, 122, 0.5);
}

.digital-text.lose {
    color: #ff4d4d;
    text-shadow: 0 0 4px #ff4d4d, 0 0 10px rgba(255, 77, 77, 0.85), 0 0 22px rgba(255, 77, 77, 0.5);
}

.digital-text.error {
    color: #ffe14d;
    text-shadow: 0 0 4px #ffe14d, 0 0 10px rgba(255, 225, 77, 0.85), 0 0 22px rgba(255, 225, 77, 0.5);
}

.credit-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    margin-bottom: 16px;
}

.credit-label {
    position: relative;
    z-index: 2;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 11px;
    letter-spacing: 3px;
    color: #ff9d3d;
    opacity: 0.75;
}

.credit-display .digital-text {
    font-size: 26px;
    font-weight: bold;
}

.combo-indicator {
    /* Okienko jest zawsze obecne w layoucie (nie znika przez [hidden]) — dzięki temu
       nie zmienia się wysokość strony i przycisk SPIN nie przesuwa się przy comba. */
    padding: 8px 12px;
    margin-bottom: 14px;
    min-height: 33px;
}

.combo-indicator.active {
    animation: combo-glow-pulse 0.8s ease-in-out infinite alternate;
}

.combo-indicator .digital-text {
    font-size: 13px;
    letter-spacing: 1px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
}

.combo-indicator.active .digital-text {
    opacity: 1;
}

@keyframes combo-glow-pulse {
    from { box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.9), 0 0 6px rgba(255, 176, 46, 0.3); }
    to   { box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.9), 0 0 16px rgba(255, 176, 46, 0.8); }
}

.reels-frame {
    background: linear-gradient(180deg, #6c2b9e, #3a0d5c);
    border-radius: 16px;
    padding: 6px;
    margin-bottom: 16px;
    box-shadow: 0 0 20px rgba(108, 43, 158, 0.6);
}

.reels {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 10px;
    background: #0b0414;
    border: 3px solid #ffd54a;
    border-radius: 12px;
    padding: 10px;
}

.reel-window {
    width: 90px;
    height: 270px;
    overflow: hidden;
    background: #150726;
    border-radius: 8px;
    border: 2px solid #6c2b9e;
    position: relative;
}

.reel-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    will-change: transform;
}

.reel-strip .symbol {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    flex-shrink: 0;
}

.reel-window.spinning .reel-strip {
    filter: blur(3px);
}

.payline {
    position: absolute;
    left: 10px;
    right: 10px;
    top: 50%;
    height: 90px;
    transform: translateY(-50%);
    border-top: 2px dashed rgba(255, 213, 74, 0.85);
    border-bottom: 2px dashed rgba(255, 213, 74, 0.85);
    box-shadow: 0 0 12px rgba(255, 213, 74, 0.5);
    pointer-events: none;
}

.payline-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #ffd54a;
    font-size: 14px;
    text-shadow: 0 0 6px #ffd54a;
}

.payline-arrow.left { left: -18px; }
.payline-arrow.right { right: -18px; }

.payline.win {
    animation: payline-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes payline-pulse {
    from { box-shadow: 0 0 12px rgba(255, 213, 74, 0.5); }
    to { box-shadow: 0 0 30px 4px rgba(255, 213, 74, 1); }
}

.diagonal {
    position: absolute;
    left: 10px;
    width: 396px;
    height: 4px;
    background: linear-gradient(90deg, rgba(255, 213, 74, 0), #ffd54a, rgba(255, 213, 74, 0));
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    transform-origin: 0 0;
}

.diagonal-down {
    top: 10px;
    transform: rotate(42.9deg);
}

.diagonal-up {
    top: 280px;
    transform: rotate(-42.9deg);
}

.diagonal.active {
    opacity: 1;
    box-shadow: 0 0 16px 3px rgba(255, 213, 74, 0.9);
    animation: payline-pulse 0.5s ease-in-out infinite alternate;
}

.hold-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 0 auto 6px;
    width: 290px;
}

.hold-btn {
    flex: 1;
    padding: 8px 0;
    font-size: 18px;
    border-radius: 8px;
    border: 2px solid #6c2b9e;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    transition: transform 0.05s, box-shadow 0.15s, background 0.15s;
}

.hold-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.hold-btn.locked {
    background: linear-gradient(180deg, #ffe27a, #ffb400);
    color: #3a0d5c;
    box-shadow: 0 0 12px rgba(255, 213, 74, 0.8);
}

.reel-window.locked {
    border-color: #ffd54a;
    box-shadow: 0 0 14px rgba(255, 213, 74, 0.7);
}

.hold-btn.sticky {
    background: linear-gradient(180deg, #ff6b6b, #c0392b);
    color: #fff;
    box-shadow: 0 0 12px rgba(255, 60, 60, 0.9);
    animation: sticky-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes sticky-pulse {
    from { box-shadow: 0 0 10px rgba(255, 60, 60, 0.55); }
    to { box-shadow: 0 0 20px rgba(255, 60, 60, 1); }
}

.reel-window.sticky {
    border-color: #ff4d4d;
    box-shadow: 0 0 14px rgba(255, 60, 60, 0.7);
}

.hold-info {
    min-height: 18px;
    padding: 6px 12px;
    margin-bottom: 14px;
}

.hold-info .digital-text {
    font-size: 11px;
    letter-spacing: 0.5px;
}

.gamble-panel {
    background: linear-gradient(160deg, #4a1770, #1a0630);
    border: 2px solid #ffd54a;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
    animation: gamble-pulse 1s ease-in-out infinite alternate;
}

@keyframes gamble-pulse {
    from { box-shadow: 0 0 14px rgba(255, 213, 74, 0.35); }
    to { box-shadow: 0 0 30px rgba(255, 213, 74, 0.8); }
}

.gamble-amount {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    margin-bottom: 10px;
}

.gamble-amount .digital-text {
    font-size: 22px;
    font-weight: bold;
}

.gamble-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.gamble-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.05s;
}

.gamble-btn:active:not(:disabled) {
    transform: translateY(2px);
}

.gamble-btn.cashout {
    background: linear-gradient(180deg, #6bff8f, #2ecc71);
    color: #0b3d1e;
}

.gamble-btn.double {
    background: linear-gradient(180deg, #7fc8ff, #2f8fd1);
    color: #06243b;
}

.gamble-btn.triple {
    background: linear-gradient(180deg, #ff8a8a, #d13a3a);
    color: #430707;
}

.gamble-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.message {
    /* Miejsce na 2 wiersze tekstu zarezerwowane na stałe — dzięki temu dłuższy komunikat
       (np. "Wygrana: X żetonów! Odbierz albo zaryzykuj.") nie powiększa okienka i nie
       przesuwa przycisku SPIN niżej. */
    min-height: 62px;
    padding: 8px 14px;
    margin-bottom: 12px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message .digital-text {
    font-size: 15px;
    font-weight: bold;
    line-height: 1.3;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

select {
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
}

#spin-btn {
    padding: 10px 24px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 30px;
    background: linear-gradient(180deg, #ffe27a, #ffb400);
    color: #3a0d5c;
    cursor: pointer;
    box-shadow: 0 4px 0 #b57900;
    transition: transform 0.05s, box-shadow 0.05s;
}

#spin-btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 0 0 #b57900;
}

#spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#sound-btn {
    padding: 10px 14px;
    font-size: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
}

#sound-btn.muted {
    opacity: 0.4;
}

#reset-btn {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}

#reset-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#reset-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#reset-btn.pulse {
    background: rgba(255, 77, 77, 0.35);
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.6);
    animation: reset-pulse 1.2s ease-out infinite;
}

@keyframes reset-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(255, 77, 77, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); }
}

.paytable {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    opacity: 0.85;
}

.paytable caption {
    margin-bottom: 8px;
    font-size: 13px;
    opacity: 0.7;
}

.paytable td {
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.paytable td:last-child {
    text-align: right;
    color: #ffd54a;
}

.combo-note {
    font-size: 12px;
    opacity: 0.8;
    text-align: center;
    margin: 10px 0 0;
}

.lever {
    width: 64px;
    flex-shrink: 0;
    margin-left: -4px;
    border: none;
    border-left: 2px solid #0a0a0a;
    border-radius: 0 22px 22px 0;
    cursor: pointer;
    position: relative;
    overflow: visible;
    background: linear-gradient(100deg, #6e6e6e 0%, #d9d9d9 14%, #4a4a4a 32%, #767676 52%, #3c3c3c 74%, #5c5c5c 100%);
    box-shadow: inset -3px 0 6px rgba(0, 0, 0, 0.5), inset 2px 0 4px rgba(255, 255, 255, 0.15);
}

.lever-housing {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20px 22px, rgba(0, 0, 0, 0.4) 0 2px, transparent 3px),
        radial-gradient(circle at 44px 22px, rgba(0, 0, 0, 0.4) 0 2px, transparent 3px),
        radial-gradient(circle at 20px calc(100% - 22px), rgba(0, 0, 0, 0.4) 0 2px, transparent 3px),
        radial-gradient(circle at 44px calc(100% - 22px), rgba(0, 0, 0, 0.4) 0 2px, transparent 3px);
    pointer-events: none;
}

.lever-pivot {
    position: absolute;
    left: 50%;
    top: 62%;
    width: 24px;
    height: 24px;
    margin-left: -12px;
    margin-top: -12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #f2f2f2, #999 55%, #2b2b2b 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    z-index: 3;
}

.lever-arm {
    position: absolute;
    left: 50%;
    bottom: 38%;
    width: 14px;
    height: 132px;
    margin-left: -7px;
    border-radius: 7px;
    background: linear-gradient(90deg, #333 0%, #cfcfcf 28%, #fbfbfb 46%, #cfcfcf 62%, #3a3a3a 100%);
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.45);
    transform-origin: 50% 100%;
    transform: rotate(90deg);
    z-index: 2;
}

.lever-knob {
    position: absolute;
    top: -26px;
    left: 50%;
    width: 48px;
    height: 48px;
    margin-left: -24px;
    border-radius: 50%;
    overflow: hidden;
    background: radial-gradient(circle at 32% 28%, #ffffff 0%, #ff7a7a 16%, #d40000 55%, #6b0000 100%);
    box-shadow: 0 4px 9px rgba(0, 0, 0, 0.55), inset 0 0 8px rgba(255, 255, 255, 0.25);
}

.lever-knob::after {
    content: '';
    position: absolute;
    left: 0;
    top: 42%;
    width: 100%;
    height: 20%;
    background: linear-gradient(180deg, #f7dd8a, #b9860a 50%, #f7dd8a);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5), inset 0 -1px 2px rgba(0, 0, 0, 0.4);
}

@keyframes lever-pull {
    0%   { transform: rotate(90deg); }
    30%  { transform: rotate(186deg); }
    52%  { transform: rotate(186deg); }
    72%  { transform: rotate(76deg); }
    86%  { transform: rotate(96deg); }
    100% { transform: rotate(90deg); }
}

@keyframes lever-knob-squash {
    0%   { transform: scale(1, 1); }
    26%  { transform: scale(1, 1); }
    32%  { transform: scale(1.16, 0.82); }
    40%  { transform: scale(1, 1); }
    68%  { transform: scale(1, 1); }
    73%  { transform: scale(0.86, 1.16); }
    82%  { transform: scale(1, 1); }
    100% { transform: scale(1, 1); }
}

.lever-arm.pulling {
    animation: lever-pull 0.85s cubic-bezier(0.33, 1, 0.68, 1);
}

.lever-arm.pulling .lever-knob {
    animation: lever-knob-squash 0.85s cubic-bezier(0.33, 1, 0.68, 1);
}

.lever:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

/* ===== Dopasowanie do telefonów: dźwignia znika, zostaje sam przycisk SPIN ===== */

@media (max-width: 480px) {
    body {
        justify-content: flex-start;
        padding: 12px 0 100px;
    }

    .lever {
        display: none;
    }

    .cabinet .machine {
        border-top-right-radius: 24px;
        border-bottom-right-radius: 24px;
    }

    .machine {
        width: 94vw;
        max-width: 310px;
        padding: 20px 14px 84px;
    }

    h1 {
        font-size: 22px;
    }

    .credit-display .digital-text {
        font-size: 20px;
    }

    .reels {
        gap: 8px;
        padding: 8px;
    }

    .reels-frame {
        padding: 4px;
    }

    .reel-window {
        width: 70px;
        height: 210px;
    }

    .reel-strip .symbol {
        width: 70px;
        height: 70px;
        font-size: 38px;
    }

    .payline {
        left: 8px;
        right: 8px;
        height: 70px;
    }

    .payline-arrow.left { left: -14px; }
    .payline-arrow.right { right: -14px; }

    .diagonal {
        left: 8px;
        width: 308px;
    }

    .diagonal-down { top: 8px; }
    .diagonal-up { top: 218px; }

    .hold-row {
        width: 226px;
        gap: 8px;
    }

    /* Stały pasek SPIN przypięty do dołu ekranu — nie przesuwa się,
       niezależnie od tego, ile tekstu pojawi się w wyświetlaczu komunikatów. */
    .controls {
        position: fixed;
        left: 50%;
        bottom: max(10px, env(safe-area-inset-bottom));
        transform: translateX(-50%);
        width: 94vw;
        max-width: 310px;
        margin: 0;
        z-index: 100;
        flex-wrap: wrap;
        gap: 8px;
        background: linear-gradient(160deg, #3a0d5c, #1a0630);
        border: 2px solid #ffd54a;
        border-radius: 30px;
        padding: 10px 12px;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(255, 213, 74, 0.25);
    }

    .paytable {
        font-size: 12px;
    }
}
