* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    /* Viewport background (covers area outside scaled 1920x1080 body). */
    background: #000;
    background-image: url('../images/mg_background.png'), linear-gradient(135deg, #0f1412 0%, #181d1a 100%);
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
}

body {
    font-family: 'Manrope', sans-serif;
    /* Default to Base Game background with gradient fallback. */
    background: linear-gradient(135deg, #0f1412 0%, #181d1a 100%);
    background-image: url('../images/mg_background.png'), linear-gradient(135deg, #0f1412 0%, #181d1a 100%);
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    color: #dfe4e0;
    overflow: hidden;
    /* Design resolution kept fixed; auto-scaled via JS transform */
    width: 1920px;
    height: 1080px;
    transform-origin: 0 0;
}

body.free-game-bg {
    /* Switch to Free Game background while free spins are active. */
    background-image: url('../images/fs_background.png'), linear-gradient(135deg, #0f1412 0%, #181d1a 100%);
}

html.free-game-bg {
    /* Keep viewport background in sync with Free Game mode. */
    background-image: url('../images/fs_background.png'), linear-gradient(135deg, #0f1412 0%, #181d1a 100%);
}

#gameContainer {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 264px 1fr 280px;
    grid-template-rows: 56px 1fr auto;
    grid-template-areas: "header header header" "left center right" "footer footer footer";
    row-gap: 0;
    column-gap: 0;
    padding: 0;
    position: relative;
}

/* Game Area: reel grid centered in the main area */
#gameArea {
    grid-area: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
    position: relative;
}

#reelContainer {
    display: grid;
    gap: 8px;
    border-radius: 12px;
    padding: 15px;
    border: 2px solid #e9c349;
    background: rgba(10,15,13,0.85);
    box-shadow: 0 0 20px rgba(233,195,73,0.2), inset 0 0 8px rgba(0,0,0,0.6);
    /* 5 cols x 5 rows template grid */
    /* JS overrides width/height/grid-template at runtime via createReelGrid() */
    /* CSS values here are fallback only */
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    width: 820px;
    height: 820px;
    max-width: 72%;
    max-height: 96%;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}

/* Shared base style for overlay grids that match symbol cell geometry. */
.overlay-grid {
    display: grid;
    position: absolute;
    top: 15px;    /* match reelContainer padding */
    left: 15px;
    right: 15px;
    bottom: 15px;
    pointer-events: none;
    border-radius: 10px;
}

/* Background highlight layer (behind symbols). */
#highlightOverlay {
    z-index: 0;
}

/* Multiplier badge layer (in front of symbols). */
#multiplierOverlay {
    z-index: 2;
}

.highlight-cell {
    border-radius: 10px;
    position: relative;
}

.multiplier-cell {
    position: relative;
}

.symbol-cell {
    background: transparent;
    border: 2px solid transparent;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    z-index: 1;
    will-change: transform;
}

.symbol-cell:not(:empty) {
    background: rgba(10,15,13,0.6);
    border-color: rgba(66,72,66,0.15);
}

.symbol-cell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.symbol-cell.empty-top {
    background: transparent;
    border-color: transparent;
}

.symbol-cell.empty-top.has-bottom-layer {
    background: rgba(10,15,13,0.36);
    border-color: rgba(233,195,73,0.18);
}

#reelContainer.hold-spin-grid .symbol-cell.empty-top {
    background: rgba(10,15,13,0.36);
    border-color: rgba(233,195,73,0.18);
}

.hold-spin-cell-frame {
    position: absolute;
    inset: 9%;
    z-index: 1;
    border-radius: 9px;
    border: 2px solid rgba(56, 213, 181, 0.38);
    background: radial-gradient(circle at 35% 30%, rgba(72, 255, 209, 0.12), rgba(13, 68, 62, 0.36));
    box-shadow: inset 0 0 14px rgba(72, 255, 209, 0.1);
    pointer-events: none;
}

.hold-spin-cell-reel {
    position: absolute;
    inset: 8%;
    z-index: 3;
    overflow: hidden;
    border-radius: 9px;
    border: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
}

.hold-spin-reel-strip {
    display: flex;
    flex-direction: column;
    height: 900%;
    animation: holdSpinCellSpin 0.3s linear infinite;
}

.hold-spin-cell-reel.settling .hold-spin-reel-strip {
    animation: holdSpinCellSettleMiss 0.9s cubic-bezier(0.08, 0.72, 0.14, 1) forwards;
}

.hold-spin-cell-reel.will-land.settling .hold-spin-reel-strip {
    animation: holdSpinCellSettleHit 0.9s cubic-bezier(0.08, 0.72, 0.14, 1) forwards;
}

.hold-spin-reel-symbol {
    flex: 0 0 11.111111%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dffdf5;
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.85), 0 0 12px rgba(72,255,209,0.62);
}

.bottom-layer-marker {
    position: absolute;
    inset: 9%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    z-index: 0;
    pointer-events: none;
}

.bottom-layer-marker.covered {
    inset: auto 8px 8px auto;
    min-width: 30px;
    height: 24px;
    padding: 0 6px;
    border-radius: 6px;
    font-size: 13px;
    opacity: 0.76;
    z-index: 2;
}

.bottom-layer-digiwin {
    border: 2px solid rgba(56, 213, 181, 0.9);
    background: radial-gradient(circle at 35% 30%, rgba(72, 255, 209, 0.36), rgba(13, 68, 62, 0.86));
    color: #dffdf5;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

.bottom-layer-letter {
    border: 2px solid rgba(233,195,73,0.9);
    background: linear-gradient(180deg, rgba(255,232,126,0.34), rgba(102,76,16,0.84));
    color: #fff4bd;
    font-weight: 800;
    text-shadow: 0 1px 4px rgba(0,0,0,0.85);
}

.bottom-layer-marker.revealed {
    color: #ffffff;
    box-shadow: 0 0 16px rgba(72,255,209,0.76), inset 0 0 18px rgba(255,255,255,0.18);
}

.bottom-layer-marker.digit-revealed {
    font-size: 52px;
}

.bottom-layer-marker.new-digiwin {
    animation: bottomMarkerPulse 0.75s ease-out 2;
}

.bottom-layer-marker.digit-spinning {
    overflow: hidden;
    border-color: rgba(255, 237, 138, 0.96);
    background: radial-gradient(circle at 35% 30%, rgba(255, 237, 138, 0.28), rgba(13, 68, 62, 0.88));
    box-shadow: 0 0 0 3px rgba(255, 237, 138, 0.24),
                0 0 22px rgba(255, 237, 138, 0.68),
                inset 0 0 18px rgba(255, 255, 255, 0.18);
    z-index: 4;
}

.digiwin-digit-reel {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
}

.digiwin-digit-strip {
    display: flex;
    flex-direction: column;
    height: 1000%;
    animation: digiwinDigitSpin 0.3s linear infinite;
}

.bottom-layer-marker.digit-settling .digiwin-digit-strip {
    animation: digiwinDigitSettleCenter 0.9s cubic-bezier(0.08, 0.72, 0.14, 1) forwards;
}

.bottom-layer-marker.digit-settle-center .digiwin-digit-strip {
    animation: digiwinDigitSettleCenter 0.9s cubic-bezier(0.08, 0.72, 0.14, 1) forwards;
}

.bottom-layer-marker.digit-settle-advance .digiwin-digit-strip {
    animation: digiwinDigitSettleAdvance 0.9s cubic-bezier(0.08, 0.72, 0.14, 1) forwards;
}

.bottom-layer-marker.digit-settle-rollback .digiwin-digit-strip {
    animation: digiwinDigitSettleRollback 0.9s cubic-bezier(0.08, 0.72, 0.14, 1) forwards;
}

.digiwin-digit-symbol {
    flex: 0 0 10%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 52px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.85), 0 0 12px rgba(72,255,209,0.72);
}

@keyframes holdSpinCellSpin {
    0% { transform: translateY(-88.888889%); }
    100% { transform: translateY(-44.444444%); }
}

@keyframes holdSpinCellSettleHit {
    0% { transform: translateY(-88.888889%); filter: blur(0.8px); }
    72% { transform: translateY(-55.555556%); filter: blur(0.3px); }
    100% { transform: translateY(-44.444444%); filter: blur(0); }
}

@keyframes holdSpinCellSettleMiss {
    0% { transform: translateY(-88.888889%); filter: blur(0.8px); }
    72% { transform: translateY(-66.666667%); filter: blur(0.3px); }
    100% { transform: translateY(-55.555556%); filter: blur(0); }
}

@keyframes digiwinDigitSpin {
    0% { transform: translateY(-90%); }
    100% { transform: translateY(-50%); }
}

@keyframes digiwinDigitSettleCenter {
    0% { transform: translateY(-90%); filter: blur(0.8px); }
    72% { transform: translateY(-60%); filter: blur(0.3px); }
    100% { transform: translateY(-50%); filter: blur(0); }
}

@keyframes digiwinDigitSettleAdvance {
    0% { transform: translateY(-90%); filter: blur(0.8px); }
    72% { transform: translateY(-55%); filter: blur(0.3px); }
    100% { transform: translateY(-50%); filter: blur(0); }
}

@keyframes digiwinDigitSettleRollback {
    0% { transform: translateY(-90%); filter: blur(0.8px); }
    72% { transform: translateY(-45%); filter: blur(0.3px); }
    100% { transform: translateY(-50%); filter: blur(0); }
}

.symbol-cell.landed {
    animation: landSettle 0.2s ease-out;
}

.symbol-cell.winning {
    box-shadow: 0 0 20px rgba(233, 195, 73, 1),
                0 0 30px rgba(233, 195, 73, 0.6),
                inset 0 0 15px rgba(233, 195, 73, 0.4);
    border: 3px solid #e9c349;
    background: rgba(233, 195, 73, 0.15);
    animation: winningPulse 1s ease-in-out infinite;
    z-index: 5;
    position: relative;
}

.symbol-cell.near-miss {
    animation: nearMissPulse 0.6s ease-in-out infinite;
    box-shadow: 0 0 25px rgba(255, 100, 100, 0.9);
    border: 3px solid rgba(255, 200, 0, 0.8);
    background: rgba(255, 200, 0, 0.2);
}

.symbol-cell.near-miss-preview {
    animation: nearMissPreview 0.5s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(233, 195, 73, 1);
    border: 4px solid rgba(255, 255, 0, 1);
    background: linear-gradient(135deg, rgba(233, 195, 73, 0.4), rgba(255, 100, 100, 0.4));
    position: relative;
    overflow: visible;
}

.symbol-cell.near-miss-preview::before {
    content: '?';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3em;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 10px rgba(233, 195, 73, 1);
    z-index: 5;
    animation: questionMarkPulse 0.8s ease-in-out infinite;
}

@keyframes landSettle {
    0% {
        transform: translateY(0) scale(1, 0.92);
    }
    50% {
        transform: translateY(-4px) scale(1, 1.04);
    }
    100% {
        transform: translateY(0) scale(1, 1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes winLinePulse {
    0%, 100% {
        opacity: 1;
        stroke-width: 6;
    }
    50% {
        opacity: 0.9;
        stroke-width: 7;
    }
}

@keyframes winningPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(233, 195, 73, 1),
                    0 0 30px rgba(233, 195, 73, 0.6),
                    inset 0 0 15px rgba(233, 195, 73, 0.4);
        border-color: #e9c349;
    }
    50% {
        box-shadow: 0 0 25px rgba(233, 195, 73, 1),
                    0 0 40px rgba(233, 195, 73, 0.8),
                    inset 0 0 20px rgba(233, 195, 73, 0.6);
        border-color: #ffff00;
    }
}

@keyframes bottomMarkerPulse {
    0% {
        transform: scale(0.92);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.06);
        filter: brightness(1.35);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

@keyframes nearMissPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(255, 100, 100, 0.9);
        border-color: rgba(255, 200, 0, 0.8);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 35px rgba(255, 150, 150, 1);
        border-color: rgba(255, 255, 0, 1);
    }
}

@keyframes nearMissPreview {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(233, 195, 73, 1);
        border-color: rgba(255, 255, 0, 1);
        background: linear-gradient(135deg, rgba(233, 195, 73, 0.4), rgba(255, 100, 100, 0.4));
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 40px rgba(255, 255, 0, 1);
        border-color: rgba(255, 255, 255, 1);
        background: linear-gradient(135deg, rgba(255, 255, 0, 0.6), rgba(255, 150, 150, 0.6));
    }
}

@keyframes questionMarkPulse {
    0%, 100% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

.win-line-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.win-line {
    fill: none;
    stroke: rgba(255, 215, 0, 0.85);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: url(#glow);
}

/* Left Sidebar */
#leftSidebar {
    grid-area: left;
    display: flex;
    flex-direction: column;
    gap: 15px;
    font-size: 1.1em;
    background: rgba(15,20,18,0.6);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(172,207,179,0.1);
    padding: 16px;
    overflow-y: auto;
}

/* Right Sidebar */
#rightSidebar {
    grid-area: right;
    display: flex;
    flex-direction: column;
    gap: 15px;
    font-size: 1.25em;
    background: rgba(15,20,18,0.6);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(172,207,179,0.1);
    padding: 16px;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Control Panel — pinned to bottom of screen */
#controlPanel {
    grid-area: footer;
    background: rgba(15,20,18,0.9);
    backdrop-filter: blur(30px);
    border-top: 1px solid rgba(233,195,73,0.2);
    border-radius: 0;
    padding: 0 40px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
    margin-top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    align-self: end;
}

/* Game Info bar: horizontal row above Spin buttons */
#gameInfo.game-info-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 20px;
    background: rgba(15, 15, 35, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 15px;
    border-radius: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#gameInfo.game-info-bar .info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 1.125em;
    flex-shrink: 0;
    width: 185px;
    min-width: 185px;
    box-sizing: border-box;
}

/* Keep row stable but give Win card a larger fixed width for high multipliers. */
#gameInfo.game-info-bar .info-item.win-info-item {
    width: 270px;
    min-width: 270px;
    padding: 7px 12px;
    font-size: 1.2em;
    background: linear-gradient(180deg, rgba(138, 116, 255, 0.34) 0%, rgba(88, 106, 255, 0.26) 100%);
    border: 1px solid rgba(163, 142, 255, 0.8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 0 12px rgba(120, 132, 255, 0.35);
}

#gameInfo.game-info-bar .info-item label {
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

#gameInfo.game-info-bar .info-item span {
    margin-left: 0;
    font-weight: bold;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

#win .win-main {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
}

#win .win-multiplier {
    color: rgba(216, 230, 255, 0.82);
    font-weight: 600;
    font-size: 0.9em;
}

/* Free Game Info: now in bottom-left bar, no grid-area needed */

#freeGameInfo.game-info-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 20px;
    background: rgba(15, 15, 35, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(233, 195, 73, 0.1);
    padding: 10px 15px;
    border-radius: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Keep space reserved when hidden so grid doesn't shift */
#freeGameInfo.hidden {
    display: flex !important;
    visibility: hidden;
    pointer-events: none;
}
}

#freeGameInfo.game-info-bar .info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(233, 195, 73, 0.15);
    border: 1px solid rgba(233, 195, 73, 0.3);
    border-radius: 8px;
    font-size: 1.125em;
    flex-shrink: 0;
    width: 220px;
    min-width: 220px;
    box-sizing: border-box;
    box-sizing: border-box;
}

#freeGameInfo.game-info-bar .info-item.fg-fs-item {
    width: 150px;
    min-width: 150px;
}

#freeGameInfo.game-info-bar .info-item.fg-half-item {
    width: 150px;
    min-width: 150px;
    padding: 8px 14px;
}

#freeGameInfo.game-info-bar .info-item.fg-win-item {
    width: 300px;
    min-width: 300px;
}

#freeGameInfo.game-info-bar .info-item label {
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
    color: #e9c349;
    font-size: 16px;
    font-weight: 700;
}

#freeGameInfo.game-info-bar .info-item span {
    margin-left: 0;
    font-family: 'Share Tech Mono', monospace;
    font-weight: bold;
    font-size: 20px;
    color: #dfe4e0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

#freeGameInfo .fg-win-main {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
}

#freeGameInfo .fg-win-multiplier {
    color: rgba(216, 230, 255, 0.82);
    font-weight: 600;
    font-size: 0.9em;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    font-size: 0.9em;
}

.info-item label {
    font-weight: bold;
    color: rgba(255, 255, 255, 0.82);
    white-space: nowrap;
}

.info-item span {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1em;
    margin-left: 10px;
}

#gameInfo .game-id-clickable {
    color: #4CAF50;
    cursor: pointer;
    text-decoration: underline;
}

#gameInfo .game-id-clickable:hover {
    color: #81c784;
}

#statisticsContainer {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    width: 100%; /* Match leftSidebar width */
}

#statistics {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(24,29,26,0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(66,72,66,0.15);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    flex-shrink: 0;
    width: 100%;
}

#statistics h3 {
    font-family: 'Epilogue', sans-serif;
    color: #e9c349;
    margin: 0;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: none;
    padding-bottom: 0;
}

.statistics-title-row {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    margin-bottom: 10px;
}

.statistics-title-row h3 {
    grid-column: 2;
}

.stat-reset-btn {
    grid-column: 3;
    justify-self: end;
}


.help-icon-btn {
    border: none;
    background: transparent;
    color: #e9c349;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
    transition: color 0.15s, transform 0.15s;
}

.help-icon-btn:hover {
    color: #ffe98f;
    transform: translateY(-1px);
}

.help-icon-btn:active {
    transform: translateY(0);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    background: none;
    border-bottom: 1px solid rgba(66,72,66,0.1);
    border-radius: 0;
    font-size: 0.9em;
}

.stat-item label {
    font-weight: bold;
    white-space: nowrap;
    color: #accfb3;
}

.stat-item span {
    margin-left: 10px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    color: #e9c349;
}

.current-mode-display {
    position: absolute;
    left: calc(50% + 90px);
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: rgba(233, 195, 73, 0.15);
    border: 1px solid rgba(233, 195, 73, 0.3);
    border-radius: 999px;
    color: #accfb3;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
}

#currentModeDisplay {
    grid-column: 3;
    position: static;
    left: auto;
    top: auto;
    transform: none;
    justify-self: start;
    align-self: center;
    text-align: center;
    justify-content: center;
    white-space: nowrap;
}

/* ========== Weight System State (Weight Table Panel in Left Sidebar) ========== */

#weightSystemState {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(24,29,26,0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(66,72,66,0.15);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-top: 0;
    width: 100%;
}

#weightSystemState h3 {
    font-family: 'Epilogue', sans-serif;
    color: #e9c349;
    margin-bottom: 0;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: none;
    padding-bottom: 0;
}

#weightSystemState .section-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-bottom: 1px solid rgba(172,207,179,0.1);
    padding-bottom: 8px;
    margin-bottom: 10px;
}

/* ========== Bonus Countdown Display (Bottom Bar) ========== */

#bonusCountdownDisplay {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 8px 0 0;
    padding: 8px 10px;
    font-size: 17px;
    line-height: 1.4;
    white-space: nowrap;
    width: auto;
    text-align: center;
    gap: 4px;
    font-family: 'Share Tech Mono', monospace;
}

#bonusCountdownDisplay .countdown-label {
    color: rgba(233, 195, 73, 0.78);
    font-weight: 600;
}

#bonusCountdownDisplay .countdown-value {
    color: #dfe4e0;
    font-weight: 700;
    display: inline-block;
    width: 74px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

#bonusCountdownDisplay .countdown-trigger-text {
    color: #ff8b8b;
    font-weight: 700;
    white-space: nowrap;
}

.countdwn-help-btn {
    margin-left: 8px;
    margin-right: 0;
    font-size: 18px;
    line-height: 1;
    color: #accfb3;
}

#buttonPanel {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 1.2em;
}

#secondaryButtons {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: center;
}

.game-btn {
    padding: 10px 16px;
    font-size: 16px;
    font-family: 'Epilogue', 'Manrope', sans-serif;
    font-weight: 600;
    color: #dfe4e0;
    background: linear-gradient(180deg,
        rgba(49,54,51,0.9) 0%,
        rgba(38,43,41,0.95) 50%,
        rgba(28,33,30,1) 100%);
    border: 1px solid rgba(66,72,66,0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 2px 0 rgba(20, 25, 60, 0.6),
        0 4px 10px rgba(0, 0, 0, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    min-width: 120px;
}

/* Buttons in Spin row: 1.2em font and 120% width */
#buttonPanel .game-btn {
    font-size: 1em;
    min-width: 144px;
    height: 52px; /* Keep all control-row buttons same height */
    padding: 0 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* Ensure wrapper-held buttons align to the same fixed height */
#buttonPanel .auto-spin-wrapper,
#buttonPanel .bias-settings-wrapper,
#buttonPanel .speed-settings-wrapper,
#buttonPanel .switch-modes-wrapper {
    display: inline-flex;
    align-items: center;
}

.game-btn.primary {
    min-width: 150px;
    padding: 0 24px;
    font-size: 16px;
    font-weight: 700;
    color: #0f1412;
    background: linear-gradient(135deg, #e9c349 0%, #b8962d 50%, #e9c349 100%);
    border: 1px solid rgba(233,195,73,0.5);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 3px 0 #574500,
        0 6px 16px rgba(233,195,73,0.3);
    text-shadow: none;
}

/* Button widths removed — now using .spin-btn, .settings-btn, .auto-btn classes */

#btnPaytable,
#btnPaylines,
#btnMaxWinRank,
#btnGenerateWinLog {
    width: 150px;
}

/* Hover: lift + brighten + expand shadow (state-clarity) */
.game-btn:hover {
    transform: translateY(-2px) scale(1.02);
    filter: brightness(1.15);
    color: rgba(230, 240, 255, 0.98);
    border-color: rgba(130, 150, 230, 0.55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 4px 0 rgba(20, 25, 60, 0.6),
        0 8px 20px rgba(0, 0, 0, 0.4);
}

.game-btn.primary:hover {
    filter: brightness(1.15);
    border-color: rgba(233,195,73,0.7);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        0 4px 0 #574500,
        0 8px 24px rgba(233,195,73,0.5);
}

/* Active: press down + scale-feedback (0.97) + inset shadow */
.game-btn:active {
    transform: translateY(2px) scale(0.97);
    filter: brightness(0.88);
    transition: all 0.06s ease;
    box-shadow:
        inset 0 3px 6px rgba(0, 0, 0, 0.4),
        0 0px 0 rgba(20, 25, 60, 0.6),
        0 1px 3px rgba(0, 0, 0, 0.3);
}

.game-btn.primary:active {
    box-shadow:
        inset 0 3px 6px rgba(0, 0, 0, 0.4),
        0 0px 0 #574500,
        0 1px 3px rgba(0, 0, 0, 0.3);
}

.game-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    filter: grayscale(0.3);
    transform: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 1px 0 rgba(20, 25, 60, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Sidebar toggle pair (two toggles side by side, same width as Info Pages btn) */
.sidebar-toggles-pair {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
}

.sidebar-toggle-row {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 6px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.45) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Win Breakdown Panel */
#winBreakdownPanel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
    padding: 15px;
    min-height: 300px;
    flex: 1;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

#winBreakdownPanel h3 {
    font-family: 'Epilogue', sans-serif;
    color: #e9c349;
    margin-bottom: 10px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: none;
}

.tumble-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 6px;
    background: rgba(233, 195, 73, 0.1);
    border: 1px solid rgba(233, 195, 73, 0.25);
    border-radius: 4px;
}

.tumble-total-label {
    color: #e9c349;
    font-weight: 700;
    font-size: 14px;
}

.tumble-total-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    color: #dfe4e0;
    padding-bottom: 0;
}

.win-breakdown-entry {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    border: 1px solid rgba(233, 195, 73, 0.15);
    font-size: 0.85em;
    animation: wbSlideIn 0.25s ease-out;
}

.win-breakdown-entry img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.win-breakdown-count {
    color: rgba(200, 215, 240, 0.82);
    white-space: nowrap;
    display: inline-block;
    min-width: 1.6em;
    text-align: right;
}

.win-breakdown-win {
    color: #e9c349;
    font-weight: bold;
    margin-left: auto;
    white-space: nowrap;
}

@keyframes wbSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sidebar-toggle-label {
    color: #ccc;
    font-size: 0.85em;
    margin-right: 2px;
}

.sidebar-toggle-status {
    color: #e9c349;
    font-weight: bold;
    font-size: 0.85em;
}

/* Smaller toggle switch for sidebar pair */
label.bias-toggle.sidebar-mini-toggle {
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

label.sidebar-mini-toggle .bias-toggle-slider {
    border-radius: 20px;
}

label.sidebar-mini-toggle .bias-toggle-slider::before {
    height: 18px !important;
    width: 18px !important;
    left: 1px !important;
    bottom: 1px !important;
}

label.sidebar-mini-toggle input:checked + .bias-toggle-slider::before {
    transform: translateX(16px) !important;
}

.game-btn.cheat-active {
    background: linear-gradient(180deg,
        #ff9a9a 0%, #ff6b6b 50%, #c84050 100%);
    box-shadow:
        -2px 0 0 #a03848,
         2px 0 0 #a03848,
         0 -2px 0 #ff9090,
         0  3px 0 #882838,
        -2px  3px 0 #882838,
         2px  3px 0 #882838,
        -2px -2px 0 #ee7878,
         2px -2px 0 #ee7878,
         0  6px 12px rgba(200, 50, 60, 0.4);
}

.game-btn.cheat-active:hover {
    background: linear-gradient(180deg,
        #ff8888 0%, #ff5252 50%, #b83545 100%);
    box-shadow:
        -2px 0 0 #b04050,
         2px 0 0 #b04050,
         0 -2px 0 #ff9898,
         0  4px 0 #882838,
        -2px  4px 0 #882838,
         2px  4px 0 #882838,
        -2px -2px 0 #f08080,
         2px -2px 0 #f08080,
         0  8px 20px rgba(200, 50, 60, 0.5);
}

#gameIdInput {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: rgba(24,29,26,0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(66,72,66,0.15);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

#gameIdInput h3 {
    font-family: 'Epilogue', sans-serif;
    color: #e9c349;
    margin-bottom: 10px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: none;
}

#gameIdInput .game-id-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

#gameIdInput .game-id-inline-label {
    display: none;
}

#gameIdField {
    flex: 2;
    width: auto;
    min-width: 0;
    max-width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    text-align: center;
    border: 1px solid rgba(66, 72, 66, 0.3);
    border-radius: 4px;
    background: rgba(10, 15, 13, 0.8);
    color: #dfe4e0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.load-icon-btn {
    flex: none !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
}

#simulationRounds {
    flex: 1;
    width: auto;
    min-width: 0;
    max-width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.9);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* gameIdInput .game-btn now handled above with flex: 1 */

#gameIdField:focus,
#simulationRounds:focus {
    outline: none;
    border-color: rgba(233, 195, 73, 0.6);
    box-shadow: 0 0 12px rgba(233, 195, 73, 0.15);
}

/* Modals */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(160deg, #1c211e 0%, #262b29 100%);
    padding: 30px;
    border-radius: 15px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Max Win Rank modal: wider so Game ID / Game Mode columns fit */
#maxWinRankModal .modal-content {
    max-width: 1300px;
    min-width: 1100px;
}

.modal-content h2 {
    color: #e9c349;
    margin-bottom: 20px;
    text-align: center;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #e9c349;
}

/* ========== Cheat Mode Modal ========== */
.cheat-win-modal-content {
    max-width: 360px;
    text-align: center;
}

.cheat-quick-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 4px 0 8px;
}
.cheat-quick-btn {
    flex: 1;
    padding: 10px 0;
    border-radius: 8px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(233,195,73,0.2);
    background: rgba(255,255,255,0.05);
    color: rgba(200,215,200,0.85);
    transition: all 0.2s ease;
}
.cheat-quick-btn:hover {
    background: rgba(233,195,73,0.12);
    border-color: rgba(233,195,73,0.35);
    color: #e9c349;
}
.cheat-quick-btn.active {
    background: rgba(233,195,73,0.15);
    border-color: rgba(233,195,73,0.5);
    color: #e9c349;
}
.cheat-win-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0 4px;
}
.cheat-win-divider::before,
.cheat-win-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(233,195,73,0.15);
}
.cheat-win-divider span {
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: rgba(233,195,73,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.cheat-win-desc {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9em;
    margin-bottom: 24px;
}

.cheat-win-fields {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
}

.cheat-win-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.cheat-win-field label {
    color: #e9c349;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cheat-win-input-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.cheat-win-input-wrap input {
    width: 100px;
    padding: 10px 28px 10px 12px;
    font-size: 1.1em;
    border: 1px solid rgba(233, 195, 73, 0.4);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.cheat-win-input-wrap input:focus {
    border-color: #e9c349;
}

.cheat-win-input-wrap input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8em;
}

.cheat-win-input-unit {
    position: absolute;
    right: 10px;
    color: rgba(233, 195, 73, 0.7);
    font-size: 0.9em;
    font-weight: 600;
    pointer-events: none;
}

/* Hide native number spin buttons */
.cheat-win-input-wrap input::-webkit-outer-spin-button,
.cheat-win-input-wrap input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.cheat-win-input-wrap input {
    -moz-appearance: textfield;
    appearance: textfield;
}

.cheat-win-separator {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.4em;
    margin-top: 20px;
}

.cheat-win-toggle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.cheat-win-toggle-label {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9em;
}

.cheat-win-toggle {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.cheat-win-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cheat-win-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 22px;
    transition: background 0.2s;
}

.cheat-win-toggle-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    transition: transform 0.2s;
}

.cheat-win-toggle input:checked + .cheat-win-toggle-slider {
    background: rgba(233, 195, 73, 0.5);
}

.cheat-win-toggle input:checked + .cheat-win-toggle-slider::before {
    transform: translateX(20px);
    background: #e9c349;
}

.cheat-win-confirm {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 1em;
    font-weight: 600;
    color: #1c211e;
    background: linear-gradient(135deg, #e9c349, #d4a82a);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.cheat-win-confirm:hover {
    opacity: 0.9;
}

.cheat-win-confirm:active {
    opacity: 0.8;
}

#paytableContent {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    max-width: 100%;
}

#paylinesContent {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    max-width: 100%;
}

.paytable-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    gap: 8px;
}

.paytable-row.header {
    display: none; /* Hide header in grid layout */
}

.paytable-symbol {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100px;
    height: 100px;
    padding: 5px;
}

.paytable-pays {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
    font-size: 0.9em;
}

.paytable-pay-item {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 2px 5px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.paytable-pay-item span:first-child {
    font-weight: bold;
    color: #e9c349;
}

.paytable-symbol img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.paytable-row.header {
    font-weight: bold;
    background: rgba(233, 195, 73, 0.2);
}

.payline-visual {
    margin: 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.payline-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    width: 100%;
    max-width: 120px;
    aspect-ratio: 5 / 3;
    margin: 5px auto 0;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px;
}

.payline-cell {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.payline-cell.active {
    background: #e9c349;
    box-shadow: 0 0 10px rgba(233, 195, 73, 0.8);
}

.payline-visual h4 {
    margin: 0 0 5px 0;
    font-size: 0.9em;
    text-align: center;
}

#switchModesContent {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Speed Settings dropdown (panel above the button) */
.speed-settings-wrapper {
    position: relative;
    display: inline-block;
}

.speed-settings-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 6px;
    z-index: 500;
    background: linear-gradient(160deg, #1c211e 0%, #262b29 100%);
    border: 2px solid rgba(233, 195, 73, 0.5);
    border-radius: 12px;
    padding: 18px 20px;
    min-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
    font-size: 1rem;
}

.speed-settings-dropdown .speed-modal-content {
    margin-top: 8px;
}

.speed-settings-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(233, 195, 73, 0.3);
}

.speed-settings-title {
    color: #e9c349;
    margin: 0;
    font-size: 1.2em;
    text-align: center;
}

.speed-settings-title-wrap {
    display: inline-flex;
    align-items: center;
    justify-self: center;
    gap: 8px;
}

.speed-settings-header-spacer {
    min-height: 1px;
}

.speed-settings-header-controls {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.speed-settings-manual-label {
    color: #d8e6ff;
    font-weight: 600;
    font-size: 0.86em;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.speed-settings-dropdown .speed-slider-value {
    font-size: 1em;
    min-width: 40px;
}


/* Bet Multiplier dropdown */
.bet-multiplier-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}

.bet-multiplier-btn {
    font-size: 16px !important;
    padding: 0 8px !important;
    min-width: 56px !important;
    width: 56px !important;
    height: 30px !important;
    line-height: 30px !important;
    text-align: center !important;
    vertical-align: middle !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    white-space: nowrap;
}

.bet-multiplier-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 6px;
    z-index: 500;
    background: linear-gradient(160deg, #1c211e 0%, #262b29 100%);
    border: 2px solid rgba(233, 195, 73, 0.5);
    border-radius: 10px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 100px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.bet-multiplier-option {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9em;
    text-align: center;
    white-space: nowrap;
    font-weight: 700;
}

.bet-multiplier-option:hover {
    background: rgba(255, 255, 255, 0.25);
}

.bet-multiplier-option.active {
    background: rgba(233, 195, 73, 0.25);
    border: 2px solid #e9c349;
}


/* Auto Spin dropdown (vertical pop-up menu near the button) */
.auto-spin-wrapper {
    position: relative;
    display: inline-block;
}

.auto-spin-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 6px;
    z-index: 500;
    background: linear-gradient(160deg, #1c211e 0%, #262b29 100%);
    border: 2px solid rgba(233, 195, 73, 0.5);
    border-radius: 10px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.auto-spin-option {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9em;
    text-align: center;
    white-space: nowrap;
    font-weight: 700;
}

.auto-spin-option:hover {
    background: rgba(255, 255, 255, 0.25);
}

.auto-spin-option.active {
    background: rgba(233, 195, 73, 0.25);
    border: 2px solid #e9c349;
}


/* Switch Modes dropdown (vertical pop-up menu near the button) */
.switch-modes-wrapper {
    position: relative;
    display: inline-block;
}

.switch-modes-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 6px;
    z-index: 500;
    background: linear-gradient(160deg, #1c211e 0%, #262b29 100%);
    border: 2px solid rgba(233, 195, 73, 0.5);
    border-radius: 10px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.switch-mode-option {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9em;
    text-align: left;
    white-space: nowrap;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.switch-mode-name {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.88);
}

.switch-mode-cost {
    color: rgba(216, 230, 255, 0.78);
    font-size: 0.82em;
    font-weight: 600;
}

.switch-mode-option:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.25);
}

.switch-mode-option.active {
    background: rgba(233, 195, 73, 0.25);
    border: 2px solid #e9c349;
}

.switch-mode-option .coming-soon {
    color: #999;
    margin-left: 6px;
    font-style: italic;
    font-size: 0.85em;
}

/* Bias Settings dropdown (vertical pop-up like Switch Modes) */
.bias-settings-wrapper {
    position: relative;
    display: inline-block;
}

.bias-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 6px;
    z-index: 500;
    background: linear-gradient(160deg, #1c211e 0%, #262b29 100%);
    border: 2px solid rgba(233, 195, 73, 0.5);
    border-radius: 14px;
    padding: 18px 20px;
    min-width: 480px;
    max-width: 620px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    font-size: 1rem;
}

.bias-dropdown-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bias-dropdown-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(233, 195, 73, 0.3);
}

.bias-dropdown-title {
    color: #e9c349;
    margin: 0;
    text-align: center;
    font-size: 1.2em;
    line-height: 1.1;
}

.bias-dropdown-title-row .help-icon-btn {
    line-height: 1;
}

.bias-dropdown .bias-settings-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 2px;
}

.bias-dropdown .bias-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.16) 100%);
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(233, 195, 73, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.bias-dropdown .bias-switch-row {
    justify-content: flex-start;
}

.bias-dropdown .bias-slider-row {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    align-items: center;
    gap: 12px;
}

.bias-dropdown .bias-label {
    min-width: 0;
    margin: 0;
    font-size: 0.95em;
    font-weight: 700;
    color: #e9c349;
    white-space: nowrap;
}

.bias-dropdown .bias-status-text {
    width: 42px;
    text-align: center;
    display: inline-block;
    font-size: 0.95em;
    font-weight: 700;
    color: #ccc;
}

.bias-dropdown .bias-value-text {
    min-width: 56px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95em;
    font-weight: 700;
}

.bias-dropdown .bias-slider {
    width: 100%;
    flex: unset;
}

.bias-dropdown .bias-queue-count {
    min-width: 56px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(127, 255, 127, 0.35);
    background: rgba(127, 255, 127, 0.12);
    color: #7fff7f;
    font-size: 0.95em;
    font-weight: 800;
}

.bias-dropdown .bias-queue-row {
    padding-top: 12px;
    border-top: none;
}

.hidden {
    display: none !important;
}

/* Loading indicator */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #e9c349;
}

/* Loading modal (non-dismissable overlay) */
.loading-modal {
    z-index: 2000; /* Above all other modals */
}

.loading-modal-content {
    background: linear-gradient(160deg, #1c211e 0%, #262b29 100%);
    padding: 40px 60px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    border: 2px solid #e9c349;
}

.loading-modal-content h2 {
    color: #e9c349;
    margin: 20px 0 10px;
    font-size: 22px;
}

.loading-modal-content p {
    color: #ccc;
    font-size: 14px;
    margin: 0;
}

.feature-help-modal-content {
    width: min(1180px, 95vw);
    max-height: 96vh;
    overflow: hidden;
}

.feature-help-lang-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
}

.feature-help-lang-btn {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    border-radius: 999px;
    padding: 7px 16px;
    font-weight: 700;
    cursor: pointer;
}

.feature-help-lang-btn.active {
    background: rgba(233, 195, 73, 0.25);
    border-color: rgba(233, 195, 73, 0.8);
    color: #ffe47a;
}

.feature-help-body {
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    padding: 14px 16px;
    color: #eef4ff;
    font-size: 0.98em;
    line-height: 1.55;
    height: 500px;
    overflow-y: auto;
}

.feature-help-body h3 {
    color: #e9c349;
    margin: 0 0 8px;
    font-size: 1.08em;
}

.feature-help-body ul {
    margin: 0 0 10px 20px;
    padding: 0;
}

.feature-help-body li {
    margin-bottom: 4px;
}

.feature-help-example {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(127, 255, 127, 0.35);
    background: rgba(127, 255, 127, 0.12);
    color: #d6ffe0;
}

.feature-help-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
}

.feature-help-nav-btn {
    min-width: 140px;
    height: 44px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.feature-help-page-indicator {
    color: #dbe7ff;
    font-weight: 700;
    min-width: 140px;
    text-align: center;
}

.feature-help-body.info-page-paytable,
.feature-help-body.info-page-paylines {
    height: 590px;
}

.feature-help-body.info-page-paytable {
    height: 700px;
    overflow-y: auto;
}

.feature-help-body.info-page-paylines {
    overflow-y: auto;
}

.feature-help-body.info-page-paylines .payline-visual {
    padding: 6px;
}

.feature-help-body.info-page-paylines .payline-visual h4 {
    margin: 0 0 4px 0;
    font-size: 0.8em;
}

.feature-help-body.info-page-paylines .payline-grid {
    max-width: 88px;
    padding: 2px;
    gap: 1px;
}

.bonus-wheel-modal-content {
    width: min(880px, 94vw);
    max-height: 94vh;
    overflow-y: hidden;
    text-align: center;
}

.bonus-wheel-wrapper {
    position: relative;
    width: 420px;
    height: 420px;
    margin: 8px auto 16px;
}

.bonus-wheel-disc {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid rgba(233, 195, 73, 0.85);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18), 0 8px 26px rgba(0, 0, 0, 0.45);
    transition: transform 3.2s cubic-bezier(0.12, 0.83, 0.08, 1);
    transform: rotate(0deg);
    position: relative;
    overflow: hidden;
}

.bonus-wheel-label-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.bonus-wheel-label {
    position: absolute;
    left: 0;
    top: 0;
    color: #f9fbff;
    font-size: 13px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    white-space: nowrap;
    pointer-events: none;
}

.bonus-wheel-legend {
    width: min(760px, 90%);
    margin: 0 auto 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    text-align: left;
}

.bonus-wheel-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e8f0ff;
    font-size: 0.95em;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    padding: 6px 8px;
}

.bonus-wheel-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex: 0 0 12px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.bonus-wheel-legend-text {
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
    white-space: nowrap;
}

.bonus-wheel-pointer {
    position: absolute;
    left: 50%;
    top: -2px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 24px solid #e9c349;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}

.bonus-wheel-result {
    height: 48px;
    margin-bottom: 10px;
    color: #dce8ff;
    font-size: 1.28em;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bonus-wheel-result.highlight {
    color: #ffe47a;
}

.bonus-wheel-actions {
    display: flex;
    justify-content: center;
}

.bonus-wheel-actions .game-btn {
    min-width: 180px;
    height: 52px;
    padding: 0 22px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05em;
    font-weight: 800;
}

/* Simulation running modal: progress text and bar */
.simulation-percent {
    font-size: 18px !important;
    font-weight: bold;
    color: #e9c349 !important;
    margin: 12px 0 8px !important;
}

.simulation-modal-progress-wrap {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 8px;
}

.simulation-modal-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* Spinning loader */
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(233, 195, 73, 0.2);
    border-top: 5px solid #e9c349;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Speed modal: vertical list of section cards */
.speed-modal-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
    min-width: 560px;
}

/* Each section as a card: label, optional threshold row, slider, presets */
.speed-slider-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.16) 100%);
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(233, 195, 73, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.speed-slider-row + .speed-slider-row {
    margin-top: 0;
}

/* Label + threshold input on same line (for Base/Free high-win cards) */
.speed-slider-label-with-input {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.speed-slider-row-label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.speed-slider-label {
    color: #e9c349;
    font-weight: bold;
    font-size: 1.05em;
}

.speed-slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.speed-tier-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78em;
    font-weight: bold;
    letter-spacing: 0.2px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

/* Wrapper: slider row + tick bar (integrated presets) */
.speed-slider-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.speed-slider-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.speed-slider-wrap .speed-slider {
    flex: 1;
    min-width: 240px;  /* 2x length for easier dragging */
    height: 12px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

.speed-slider-wrap .speed-slider::-webkit-slider-runnable-track {
    height: 12px;
    background: linear-gradient(to right, rgba(233, 195, 73, 0.2), rgba(233, 195, 73, 0.9));
    border-radius: 6px;
}

.speed-slider-wrap .speed-slider::-moz-range-track {
    height: 12px;
    background: linear-gradient(to right, rgba(233, 195, 73, 0.2), rgba(233, 195, 73, 0.9));
    border-radius: 6px;
}

.speed-slider-wrap .speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e9c349;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
    margin-top: -4px;
}

.speed-slider-wrap .speed-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e9c349;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

.speed-slider-value {
    min-width: 48px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-weight: bold;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.speed-threshold-input-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.speed-threshold-input {
    width: 72px;
    padding: 6px 22px 6px 8px;
    font-size: 1em;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.85);
}

/* Hide native number-input spin buttons for cleaner threshold UX */
.speed-threshold-input::-webkit-outer-spin-button,
.speed-threshold-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.speed-threshold-input {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Hide native number-input spin buttons for Simulation rounds input */
#simulationRounds::-webkit-outer-spin-button,
#simulationRounds::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#simulationRounds {
    -moz-appearance: textfield;
    appearance: textfield;
}

.speed-threshold-input-unit {
    position: absolute;
    right: 8px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.88em;
    font-weight: 600;
    pointer-events: none;
}

.speed-threshold-quick-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.speed-threshold-quick-label {
    color: rgba(216, 230, 255, 0.9);
    font-size: 0.82em;
    font-weight: 600;
    white-space: nowrap;
}

.speed-threshold-presets {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Tick bar: 5 clickable segments below slider (0%, 25%, 50%, 75%, 100%) */
.speed-preset-ticks {
    display: flex;
    width: 100%;
    gap: 2px;
}

.speed-preset-tick {
    flex: 1;
    min-width: 0;
    padding: 4px 2px;
    font-size: 0.75em;
    font-weight: bold;
    color: rgba(233, 195, 73, 0.9);
    background: rgba(233, 195, 73, 0.08);
    border: 1px solid rgba(233, 195, 73, 0.3);
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}

.speed-preset-tick:hover {
    background: rgba(233, 195, 73, 0.2);
    border-color: rgba(233, 195, 73, 0.5);
}

.speed-preset-tick:active {
    background: rgba(233, 195, 73, 0.35);
}

.speed-preset-tick.active {
    background: rgba(233, 195, 73, 0.38);
    border-color: rgba(233, 195, 73, 0.85);
    color: rgba(255, 255, 255, 0.88);
    box-shadow: 0 0 0 1px rgba(233, 195, 73, 0.2) inset;
}

.tier-slow {
    background: rgba(122, 162, 255, 0.2);
    border-color: rgba(122, 162, 255, 0.55);
    color: #cfe0ff;
}

.tier-normal {
    background: rgba(105, 196, 255, 0.2);
    border-color: rgba(105, 196, 255, 0.55);
    color: #d9f2ff;
}

.tier-fast {
    background: rgba(255, 209, 92, 0.22);
    border-color: rgba(255, 209, 92, 0.62);
    color: #fff2c8;
}

.tier-turbo {
    background: rgba(255, 128, 128, 0.24);
    border-color: rgba(255, 128, 128, 0.65);
    color: #ffe0e0;
}

.tier-super {
    background: rgba(197, 141, 255, 0.24);
    border-color: rgba(197, 141, 255, 0.7);
    color: #f1e5ff;
}

/* Legacy preset row (still used for threshold presets) */
.speed-preset-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.speed-preset-btn {
    background: rgba(233, 195, 73, 0.12);
    border: 1px solid rgba(233, 195, 73, 0.4);
    color: #e9c349;
    font-size: 0.9em;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    min-width: 48px;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}

.speed-preset-btn:hover {
    background: rgba(233, 195, 73, 0.35);
    border-color: #e9c349;
}

.speed-preset-btn:active {
    background: rgba(233, 195, 73, 0.55);
}

.speed-fs-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.speed-fs-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.speed-fs-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, #3a3a4a 0%, #2a2a35 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: background 0.3s, box-shadow 0.3s;
}

.speed-fs-toggle-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(145deg, #e8e8e8 0%, #c0c0c0 50%, #a8a8a8 100%);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.8);
    transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
}

.speed-fs-toggle input:checked + .speed-fs-toggle-slider {
    background: linear-gradient(180deg, #c9960a 0%, #a67c00 100%);
    border-color: rgba(233, 195, 73, 0.3);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 8px rgba(233, 195, 73, 0.25);
}

.speed-fs-toggle input:checked + .speed-fs-toggle-slider::before {
    transform: translateX(18px);
    background: linear-gradient(145deg, #fff8e0 0%, #e9c349 50%, #e6b800 100%);
    box-shadow: 0 2px 6px rgba(255, 180, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.7);
}

.speed-fs-toggle-status {
    font-size: 1.05em;
    font-weight: bold;
    color: #ccc;
    width: 42px;
    text-align: center;
    display: inline-block;
}


/* ========== Bias Settings Modal ========== */

.bias-modal-content {
    min-width: 420px;
    max-width: 500px;
}

.bias-settings-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 20px;
}

.bias-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bias-label {
    min-width: 140px;
    font-size: 15px;
    font-weight: bold;
    color: #e9c349;
}

.bias-status-text {
    font-size: 15px;
    font-weight: bold;
    color: #ccc;
    min-width: 36px;
}

.bias-value-text {
    min-width: 40px;
    text-align: right;
    font-size: 15px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.85);
}

.bias-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: pointer;
}

.bias-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e9c349;
    cursor: pointer;
    border: 2px solid #fff;
}

.bias-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e9c349;
    cursor: pointer;
    border: 2px solid #fff;
}

.bias-queue-row {
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.bias-queue-count {
    font-size: 18px;
    font-weight: bold;
    color: #7fff7f;
}

/* Toggle switch — premium material */
.bias-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.bias-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.bias-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, #3a3a4a 0%, #2a2a35 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: background 0.3s, box-shadow 0.3s;
}

.bias-toggle-slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(145deg, #e8e8e8 0%, #c0c0c0 50%, #a8a8a8 100%);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.8);
    transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
}

.bias-toggle input:checked + .bias-toggle-slider {
    background: linear-gradient(180deg, #c9960a 0%, #a67c00 100%);
    border-color: rgba(233, 195, 73, 0.3);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 8px rgba(233, 195, 73, 0.25);
}

.bias-toggle input:checked + .bias-toggle-slider::before {
    transform: translateX(24px);
    background: linear-gradient(145deg, #fff8e0 0%, #e9c349 50%, #e6b800 100%);
    box-shadow: 0 2px 6px rgba(255, 180, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.7);
}

/* Cascade / Tumble animation classes */
.symbol-cell.symbol-clearing {
    animation: symbolClear 280ms ease-out forwards;
    pointer-events: none;
}

@keyframes symbolClear {
    0%   { transform: scale(1); opacity: 1; filter: brightness(1); }
    25%  { transform: scale(1.15); opacity: 1; filter: brightness(2); }
    100% { transform: scale(0); opacity: 0; filter: brightness(0.5); }
}

/* Multiplier badge for cluster game cells */
.multiplier-badge {
    position: absolute;
    bottom: 1px;
    right: 1px;
    background: linear-gradient(135deg, #e9c349, #ff8c00);
    color: #000;
    font-weight: bold;
    font-size: 22px;
    padding: 2px 6px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    z-index: 10;
    line-height: 1.05;
    pointer-events: none;
}

/* Cluster paytable card styling */
.cluster-paytable-card {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 8px;
}

.cluster-paytable-card.scatter-card {
    border: 1px solid rgba(233, 195, 73, 0.3);
}

.cluster-paytable-card .paytable-pays {
    /* Show full paytable values without per-card scrollbars. */
    max-height: none;
    overflow: visible;
    font-size: 11px;
}

.cluster-paytable-card .paytable-pay-item {
    padding: 1px 0;
}

/* Near miss visuals are fully disabled for all states. */
.symbol-cell.near-miss,
.symbol-cell.near-miss-preview {
    animation: none !important;
    box-shadow: none !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.symbol-cell.near-miss-preview::before {
    content: none !important;
}

/* Persistent marker for any position that has won at least once (overlay layer). */
/* Disabled – no background tint for win-history cells */
.highlight-cell.win-history {
    background: none;
}

/* Stronger marker for positions that reached x2+ multiplier (overlay layer). */
/* Disabled – no background tint for multiplier-history cells */
.highlight-cell.multiplier-history {
    background: none;
}

/* ═══ Typography: Orbitron for numbers/amounts, Exo 2 for headings ═══ */

#balance, #bet,
#win,
#totalWin,
#freeSpins,
#roundsPlayed, #rtp, #hitRate, #maxWin,
#recent100RTP, #recent200RTP, #recent300RTP,
#hwiDisplay, #ftiDisplay, #bfviDisplay {
    font-family: 'Share Tech Mono', 'Manrope', monospace;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    letter-spacing: 0.5px;
}

#win .win-main,
#freeGameInfo .fg-win-main {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

#win .win-multiplier,
#freeGameInfo .fg-win-multiplier {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

#gameIdField {
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ═══ Unified typography for all UI components ═══ */

/* All h2 headings (modals, info pages) */
.modal-content h2,
.loading-modal-content h2,
.feature-help-modal-content h2 {
    font-family: 'Epilogue', sans-serif;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* All dropdown titles */
.speed-settings-title,
.bias-dropdown-title {
    font-family: 'Epilogue', sans-serif;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* Info Pages body text */
.feature-help-body {
    font-family: 'Manrope', sans-serif;
}

.feature-help-body h3 {
    font-family: 'Epilogue', sans-serif;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* Info Pages page indicator & nav buttons */
.feature-help-page-indicator {
    font-family: 'Epilogue', sans-serif;
}

.feature-help-nav-btn {
    font-family: 'Epilogue', 'Manrope', sans-serif;
}

.feature-help-lang-btn {
    font-family: 'Manrope', sans-serif;
    font-size: 0.88em;
}

/* Dropdown options (Auto Spin, Game Modes, Bet Multiplier) */
.auto-spin-option,
.switch-mode-name,
.bet-multiplier-option {
    font-family: 'Epilogue', 'Manrope', sans-serif;
}

.switch-mode-cost {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.78em;
    letter-spacing: 0.3px;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Speed settings labels and values */
.speed-slider-label,
.speed-settings-manual-label {
    font-family: 'Manrope', sans-serif;
}

.speed-tier-chip,
.speed-slider-value {
    font-family: 'Share Tech Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Bias settings labels and values */
.bias-dropdown .bias-label {
    font-family: 'Manrope', sans-serif;
}

.bias-dropdown .bias-value-text,
.bias-dropdown .bias-status-text,
.bias-dropdown .bias-queue-count {
    font-family: 'Share Tech Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Paytable numbers */
.paytable-pay-item span:first-child {
    font-family: 'Share Tech Mono', monospace;
    font-variant-numeric: tabular-nums;
}

/* Loading modal */
.loading-modal-content p {
    font-family: 'Manrope', sans-serif;
}

/* Simulation progress percentage */
.simulation-percent {
    font-family: 'Share Tech Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Current mode display badge */
.current-mode-display {
    font-family: 'Epilogue', sans-serif;
    letter-spacing: 0.3px;
}

/* Max Win Rank table numbers */
#maxWinRankModal td {
    font-family: 'Share Tech Mono', monospace;
    font-variant-numeric: tabular-nums;
}

#maxWinRankModal th {
    font-family: 'Epilogue', sans-serif;
}

/* Win breakdown panel entries */
.win-breakdown-entry {
    font-family: 'Manrope', sans-serif;
}

.win-breakdown-entry .wb-win {
    font-family: 'Share Tech Mono', monospace;
    font-variant-numeric: tabular-nums;
}

/* ========== Header Theme ========== */

#topHeader {
    grid-area: header;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr);
    column-gap: 10px;
    align-items: center;
    padding: 0 24px;
    position: relative;
    background: rgba(15,20,18,0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(172,207,179,0.15);
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
    z-index: 50;
}
.header-title {
    grid-column: 2;
    justify-self: end;
    font-family: 'Epilogue', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: #e9c349;
    text-shadow: 0 0 12px rgba(233,195,73,0.5);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin: 0;
    white-space: nowrap;
}
.header-right {
    grid-column: 4;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 12px;
}
.header-icon-btn {
    background: none;
    border: none;
    color: #accfb3;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: color 0.2s;
    font-size: 16px;
}
.header-icon-btn:hover { color: #e9c349; }
.header-toggle {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 2px 6px !important;
}
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 22px;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

/* ========== Sidebar Header ========== */

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 0 12px 0;
    border-bottom: 1px solid rgba(172,207,179,0.1);
    margin-bottom: 4px;
}
.sidebar-header-icon {
    font-size: 28px;
    color: #e9c349;
}
.sidebar-header-title {
    font-family: 'Epilogue', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #dfe4e0;
    margin: 0;
}
.sidebar-header-sub {
    font-size: 11px;
    color: #accfb3;
    margin: 0;
}
.sidebar-btn-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: 4px;
}
.sidebar-action-btn {
    flex: 1;
}
.sidebar-action-btn {
    min-width: 0;
    font-size: 13px !important;
    padding: 8px 12px !important;
}

/* ========== Bottom Bar Layout ========== */

.bottom-bar-layout {
    display: flex;
    align-items: center;
    width: 100%;
    height: 96px;
}
.bottom-left, .bottom-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1 1 0;
    min-width: 0;
}
.bottom-left {
    justify-content: flex-end;
}
.bottom-right {
    justify-content: flex-start;
}
.bottom-center {
    flex: 0 0 auto;
    padding: 0 50px;
}

/* ── Free Game Info (bottom-left, matches right-side structure) ── */
.fg-bottom-group {
    display: flex;
    gap: 12px;
}
.fg-bottom-group.hidden {
    visibility: hidden;
    pointer-events: none;
}
.fg-bottom-label {
    color: #e87040 !important;
}
.fg-bottom-plate {
    border-color: rgba(232, 112, 64, 0.2) !important;
}
.fg-bottom-cell:not(.fg-bottom-cell-win) .fg-bottom-plate {
    justify-content: center !important;
}
.bottom-info-cell-balance .bottom-info-value {
    justify-content: center;
}
.fg-bottom-plate span {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    color: #e9c349;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    white-space: nowrap;
}
.fg-bottom-cell .fg-bottom-plate { min-width: 75px; }
.fg-bottom-cell-fs .fg-bottom-plate { min-width: 100px; }
.fg-bottom-cell-win .fg-bottom-plate { min-width: 300px; }
.fg-bottom-cell-win .fg-bottom-plate span { font-size: 26px; font-weight: 900; }

/* .bottom-center is now flex item (defined above in bottom-bar-layout) */

/* ========== Win Display ========== */

.win-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 300px;
}
.win-display-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #e9c349;
    animation: pulse 2s ease-in-out infinite;
}
.win-display-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 26px;
    font-weight: 900;
    color: #e9c349;
    text-shadow: 0 0 20px rgba(233,195,73,0.6);
    line-height: 1;
    padding: 8px 16px;
    min-width: 300px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.win-display-value.recessed-plate {
    background: rgba(10,15,13,0.8);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
    border: 1px solid rgba(233,195,73,0.2);
    border-radius: 4px;
}

/* ========== Bottom Info ========== */

.bottom-info-group {
    display: flex;
    gap: 16px;
}
.bottom-info-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.bottom-info-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    text-transform: uppercase;
    color: #accfb3;
    letter-spacing: 1px;
}
.bottom-info-value {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    color: #e9c349;
    min-width: 180px;
    height: 44px;
}
.recessed-plate {
    background: rgba(10,15,13,0.8);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
    border: 1px solid rgba(172,207,179,0.1);
}

/* ========== Spin Button ========== */

.spin-btn {
    width: 80px !important;
    height: 80px !important;
    min-width: 80px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    background: linear-gradient(135deg, #e9c349 0%, #b8962d 50%, #e9c349 100%) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 4px 15px rgba(0,0,0,0.4), 0 0 30px rgba(233,195,73,0.5) !important;
    color: #0f1412 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0 !important;
    overflow: hidden;
}
.spin-btn::before {
    font-family: 'Material Symbols Outlined';
    font-size: 40px;
    font-variation-settings: 'FILL' 1, 'wght' 400;
    content: '\e037';
    color: #0f1412;
}
.spin-icon {
    font-size: 40px;
    font-variation-settings: 'FILL' 1;
}
.spin-cluster {
    display: flex;
    align-items: center;
    gap: 12px;
}
.auto-btn {
    /* legacy — Auto now uses .settings-btn */
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px !important;
    letter-spacing: 1px;
    min-width: 60px !important;
    width: auto !important;
    height: 40px !important;
    padding: 6px 14px !important;
}

/* ========== Settings Buttons ========== */

.settings-btn {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0 !important;
    overflow: hidden;
}
.settings-btn::before {
    font-family: 'Material Symbols Outlined';
    font-size: 22px;
    font-variation-settings: 'FILL' 0, 'wght' 400;
    line-height: 1;
}
#btnBias.settings-btn::before { content: '\e9ee'; }
#btnSpeed.settings-btn::before { content: '\ea0b'; }
#btnSwitchModes.settings-btn::before { content: '\e9b0'; }
#btnAutoSpin.settings-btn::before { content: '\e863'; }
/* Auto active with countdown — show number, hide icon */
#btnAutoSpin.settings-btn.auto-active {
    font-size: 16px !important;
    font-family: 'Share Tech Mono', monospace;
    color: #ff4444;
    border-color: rgba(255, 68, 68, 0.6);
    box-shadow: 0 0 12px rgba(255, 68, 68, 0.3);
}
#btnAutoSpin.settings-btn.auto-active::before {
    content: none;
}
/* Auto active infinite — no text, show red stop icon */
#btnAutoSpin.settings-btn.auto-active:empty::before {
    content: '\e047';
    font-variation-settings: 'FILL' 1;
    color: #ff4444;
}
.settings-cluster {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ========== Override old buttonPanel styles ========== */

#buttonPanel.spin-cluster {
    font-size: 1em;
    flex-wrap: nowrap;
    justify-content: center;
}
#buttonPanel.spin-cluster .game-btn {
    min-width: unset;
    height: auto;
}

/* Override old #gameInfo.game-info-bar styles when using .bottom-info-group */
#gameInfo.bottom-info-group {
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
    backdrop-filter: none;
}

/* Override old #buttonPanel wrapper alignment */
#buttonPanel .auto-spin-wrapper,
#buttonPanel .bias-settings-wrapper,
#buttonPanel .speed-settings-wrapper,
#buttonPanel .switch-modes-wrapper {
    display: inline-flex;
    align-items: center;
}
