/* ===== LOW BALANCE POPUP ===== */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    backdrop-filter: blur(6px);
}
.popup-overlay.active { display: flex; }
.popup {
    background: #1a1a24;
    border-radius: 20px;
    padding: 40px 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 340px;
    max-width: 420px;
    position: relative;
    border: 1px solid rgba(245, 200, 66, 0.15);
    box-shadow: 0 0 40px rgba(245, 200, 66, 0.1), 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
}
.popup__close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: #8a8a9a;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    font-family: inherit;
}
.popup__close:hover { color: #ffffff; }
.popup__title {
    font-size: 20px;
    font-weight: 800;
    color: #f5c842;
    letter-spacing: 0.5px;
}
.popup__text {
    font-size: 15px;
    font-weight: 500;
    color: #b0b0c0;
    line-height: 1.5;
}
.popup__btn {
    padding: 12px 36px;
    font-size: 15px;
    border-radius: 10px;
    margin-top: 4px;
}

/* ===== MINER PAGE ===== */
.miner-page {
    padding: 20px;
    min-height: calc(100vh - 170px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.miner-page__title {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #f5c842, #ff6b35);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 24px;
}

/* ===== GAME LAYOUT ===== */
.miner-game {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    max-width: 900px;
}

/* ===== CONTROLS PANEL ===== */
.miner-controls {
    width: 260px;
    flex-shrink: 0;
    background: #13131b;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.miner-controls__section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.miner-controls__label {
    font-size: 11px;
    font-weight: 700;
    color: #5a5a6a;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.miner-controls__bets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.miner-bet-btn {
    background: #1a1a26;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #aaa;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.miner-bet-btn:hover {
    border-color: rgba(245, 200, 66, 0.4);
    color: #f5c842;
}

.miner-bet-btn.active {
    background: linear-gradient(135deg, rgba(245, 200, 66, 0.15), rgba(255, 107, 53, 0.1));
    border-color: #f5c842;
    color: #f5c842;
    box-shadow: 0 0 12px rgba(245, 200, 66, 0.15);
}

/* Mines slider */
.miner-mines-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.miner-mines-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #1a1a26;
    outline: none;
}

.miner-mines-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5c842, #ff6b35);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(245, 200, 66, 0.3);
}

.miner-mines-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5c842, #ff6b35);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(245, 200, 66, 0.3);
}

.miner-mines-val {
    font-size: 18px;
    font-weight: 800;
    color: #f5c842;
    min-width: 30px;
    text-align: center;
}

/* Start / Cashout button */
.miner-start-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
    background: linear-gradient(135deg, #f5c842, #ff6b35);
    color: #000;
    box-shadow: 0 4px 20px rgba(245, 200, 66, 0.3);
}

.miner-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(245, 200, 66, 0.4);
}

.miner-start-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.miner-start-btn--cashout {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    box-shadow: 0 4px 20px rgba(39, 174, 96, 0.3);
    animation: cashoutPulse 1.5s ease-in-out infinite;
}

.miner-start-btn--cashout:hover {
    box-shadow: 0 6px 28px rgba(39, 174, 96, 0.4);
}

@keyframes cashoutPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(39, 174, 96, 0.3); }
    50% { box-shadow: 0 4px 30px rgba(39, 174, 96, 0.6); }
}

/* Info row */
.miner-info {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.miner-info__box {
    flex: 1;
    background: #1a1a26;
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.04);
}

.miner-info__box-label {
    font-size: 9px;
    font-weight: 700;
    color: #5a5a6a;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.miner-info__box-val {
    font-size: 16px;
    font-weight: 800;
}

.miner-info__box-val--multi {
    color: #f5c842;
}

.miner-info__box-val--win {
    color: #2ecc71;
}

/* ===== GRID ===== */
.miner-grid-wrap {
    flex: 1;
    max-width: 500px;
}

.miner-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    width: 100%;
    aspect-ratio: 1;
}

.miner-cell {
    position: relative;
    border-radius: 12px;
    background: #1a1a26;
    border: 2px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    overflow: hidden;
}

.miner-cell::before {
    content: '?';
    font-size: 22px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.08);
    transition: all 0.3s;
}

.miner-cell:hover:not(.miner-cell--revealed):not(.miner-cell--disabled) {
    border-color: rgba(245, 200, 66, 0.4);
    transform: scale(1.04);
    background: #1e1e2a;
}

.miner-cell:hover:not(.miner-cell--revealed):not(.miner-cell--disabled)::before {
    color: rgba(245, 200, 66, 0.3);
}

/* Revealed states */
.miner-cell--revealed {
    cursor: default;
    transform: rotateY(360deg);
    transition: transform 0.5s ease, background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.miner-cell--revealed::before {
    display: none;
}

.miner-cell--gem {
    background: rgba(46, 204, 113, 0.1);
    border-color: rgba(46, 204, 113, 0.4);
    box-shadow: 0 0 16px rgba(46, 204, 113, 0.15);
}

.miner-cell--mine {
    background: rgba(231, 76, 60, 0.15);
    border-color: rgba(231, 76, 60, 0.5);
    box-shadow: 0 0 16px rgba(231, 76, 60, 0.2);
}

.miner-cell--mine-hidden {
    background: rgba(231, 76, 60, 0.06);
    border-color: rgba(231, 76, 60, 0.2);
}

.miner-cell__icon {
    font-size: 28px;
    animation: cellReveal 0.4s ease;
}

@keyframes cellReveal {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    60% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.miner-cell--disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* ===== RESULT OVERLAY ===== */
.miner-result {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.miner-result.active {
    display: flex;
}

.miner-result__content {
    background: #15151f;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    padding: 40px 50px;
    text-align: center;
    animation: resultPop 0.4s cubic-bezier(.2,1,.3,1);
    max-width: 400px;
    width: 90%;
}

@keyframes resultPop {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes toastPop {
    0% { transform: translateX(-50%) scale(0.7); opacity: 0; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

.miner-result__icon {
    font-size: 60px;
    margin-bottom: 12px;
}

.miner-result__title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.miner-result__title--win {
    color: #2ecc71;
}

.miner-result__title--lose {
    color: #e74c3c;
}

.miner-result__amount {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 6px;
}

.miner-result__amount--win {
    color: #2ecc71;
}

.miner-result__amount--lose {
    color: #e74c3c;
}

.miner-result__multi {
    font-size: 14px;
    color: #888;
    margin-bottom: 20px;
}

.miner-result__btn {
    background: linear-gradient(135deg, #f5c842, #ff6b35);
    border: none;
    color: #000;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 36px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.2s, box-shadow 0.3s;
}

.miner-result__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 200, 66, 0.3);
}

/* ===== CONFETTI ===== */
.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -20px;
    z-index: 100000;
    pointer-events: none;
    border-radius: 2px;
    animation: confettiFall 3s ease-in forwards;
}

@keyframes confettiFall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translateY(110vh) rotate(720deg) scale(.5); }
}

/* ===== MULTIPLIER TABLE ===== */
.miner-multis {
    margin-top: 12px;
    max-height: 180px;
    overflow-y: auto;
    border-radius: 8px;
    background: #1a1a26;
    border: 1px solid rgba(255,255,255,0.04);
}

.miner-multis::-webkit-scrollbar {
    width: 4px;
}

.miner-multis::-webkit-scrollbar-track {
    background: transparent;
}

.miner-multis::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

.miner-multis__row {
    display: flex;
    justify-content: space-between;
    padding: 6px 12px;
    font-size: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.miner-multis__row:last-child {
    border-bottom: none;
}

.miner-multis__row--active {
    background: rgba(46, 204, 113, 0.1);
}

.miner-multis__gem {
    color: #888;
}

.miner-multis__val {
    font-weight: 700;
    color: #f5c842;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .miner-game {
        flex-direction: column-reverse;
        align-items: center;
    }
    .miner-controls {
        width: 100%;
        max-width: 500px;
    }
    .miner-grid-wrap {
        max-width: 100%;
        width: 100%;
    }
    .miner-cell__icon {
        font-size: 20px;
    }
    .miner-cell::before {
        font-size: 16px;
    }
    .miner-page__title {
        font-size: 22px;
    }
    .miner-grid {
        gap: 5px;
    }
}
