/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
    /* Smooth scrolling for anchor links */
    scroll-behavior: smooth;
    /* Better font rendering on mobile */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Courier New', 'Consolas', monospace;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #e9ecef 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(0.5rem, 2vw, 1.25rem);
    transition: background 0.3s ease;
    position: relative;
    overflow-x: hidden;
    /* Prevent text selection on UI elements */
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    /* Disable tap highlight on mobile */
    -webkit-tap-highlight-color: transparent;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(255, 0, 0, 0.02) 0px,
            transparent 1px,
            transparent 2px,
            rgba(255, 0, 0, 0.02) 3px
        );
    pointer-events: none;
    z-index: 0;
}

body.night-mode {
    background: linear-gradient(135deg, #000000 0%, #1a0033 50%, #0d0221 100%);
}

body.night-mode::before {
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(255, 0, 255, 0.05) 0px,
            transparent 1px,
            transparent 2px,
            rgba(255, 0, 255, 0.05) 3px
        );
}

/* Container */
.container {
    background: rgba(255, 255, 255, 0.98);
    border-radius: clamp(12px, 3vw, 20px);
    padding: clamp(1rem, 3vw, 2rem);
    box-shadow: 
        0 0 40px rgba(255, 0, 0, 0.2),
        0 0 80px rgba(255, 0, 0, 0.1),
        inset 0 0 60px rgba(255, 0, 0, 0.03);
    max-width: 700px;
    width: 100%;
    animation: fadeIn 0.5s ease-in;
    border: 2px solid rgba(255, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

body.night-mode .container {
    background: rgba(13, 2, 33, 0.95);
    border-color: rgba(255, 0, 255, 0.4);
    box-shadow: 
        0 0 40px rgba(255, 0, 255, 0.3),
        0 0 80px rgba(255, 0, 255, 0.1),
        inset 0 0 60px rgba(255, 0, 255, 0.05);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    gap: 0.5rem;
}

.night-mode-btn {
    position: absolute;
    right: 0;
    padding: clamp(4px, 1vw, 6px) clamp(6px, 1.5vw, 10px);
    font-size: clamp(14px, 3vw, 18px);
    background: rgba(255, 0, 0, 0.05);
    border: 2px solid rgba(255, 0, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.15);
}

.night-mode-btn:hover {
    background: rgba(255, 0, 0, 0.15);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.3);
    border-color: rgba(255, 0, 0, 0.5);
}

body.night-mode .night-mode-btn {
    background: rgba(255, 0, 255, 0.1);
    border-color: rgba(255, 0, 255, 0.5);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
}

body.night-mode .night-mode-btn:hover {
    background: rgba(255, 0, 255, 0.2);
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.5);
}

.back-btn {
    position: absolute;
    left: 0;
    padding: clamp(4px, 1vw, 6px) clamp(6px, 1.5vw, 10px);
    font-size: clamp(9px, 2vw, 12px);
    background: rgba(255, 0, 0, 0.05);
    border: 2px solid rgba(255, 0, 0, 0.3);
    border-radius: 8px;
    color: #dc0000;
    text-decoration: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.15);
    display: inline-block;
    white-space: nowrap;
}

.back-btn:hover {
    background: rgba(255, 0, 0, 0.15);
    transform: translateX(-3px);
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.3);
    border-color: rgba(255, 0, 0, 0.5);
}

body.night-mode .back-btn {
    background: rgba(255, 0, 255, 0.1);
    border-color: rgba(255, 0, 255, 0.5);
    color: #ff00ff;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
}

body.night-mode .back-btn:hover {
    background: rgba(255, 0, 255, 0.2);
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.5);
}

/* Title */
h1 {
    text-align: center;
    color: #dc0000;
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    margin: 0;
    text-shadow: 
        0 0 10px rgba(255, 0, 0, 0.3),
        0 0 20px rgba(255, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: 900;
}

body.night-mode h1 {
    color: #ff00ff;
    text-shadow: 
        0 0 10px rgba(255, 0, 255, 0.8),
        0 0 20px rgba(255, 0, 255, 0.6);
}

h3 {
    color: #dc0000;
    font-size: clamp(1rem, 3vw, 1.3rem);
    margin-bottom: 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
}

body.night-mode h3 {
    color: #ff00ff;
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}

/* Balance Wrapper */
.balance-wrapper {
    position: relative;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

/* Balance Display */
.balance-display {
    display: flex;
    justify-content: space-around;
    gap: clamp(0.5rem, 2vw, 1rem);
    background: linear-gradient(135deg, #dc0000, #a00000);
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 2.5vw, 1.5rem);
    border-radius: clamp(10px, 2vw, 15px);
    flex-wrap: wrap;
    border: 2px solid rgba(255, 0, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.3);
}

body.night-mode .balance-display {
    background: linear-gradient(135deg, #ff00ff, #aa00aa);
    border-color: rgba(255, 0, 255, 0.5);
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.4);
}

.balance-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    color: white;
}

.balance-item.rebirth-progress {
    position: relative;
}

.balance-item.rebirth-progress::before {
    content: '🌟';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.balance-label {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    font-weight: 500;
    opacity: 0.9;
}

.balance-value {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.rebirth-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: 'Courier New', 'Consolas', monospace;
    color: white;
    transition: all 0.3s ease;
}

.rebirth-btn:disabled {
    cursor: default;
    opacity: 1;
}

.rebirth-btn:not(:disabled) {
    cursor: pointer;
    animation: glow-pulse 1.5s ease-in-out infinite;
}

.rebirth-btn:not(:disabled):hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.rebirth-btn:not(:disabled):active {
    transform: scale(1.05);
}

@keyframes glow-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(76, 175, 80, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(76, 175, 80, 0.9));
    }
}

body.night-mode .rebirth-btn:not(:disabled) {
    animation: glow-pulse-night 1.5s ease-in-out infinite;
}

@keyframes glow-pulse-night {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(76, 175, 80, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(76, 175, 80, 0.9));
    }
}

@keyframes jiggle {
    0%, 50%, 100% {
        transform: rotate(0deg);
    }
    5%, 15%, 25%, 35%, 45% {
        transform: rotate(-3deg);
    }
    10%, 20%, 30%, 40% {
        transform: rotate(3deg);
    }
}

.rebirth-btn.jiggle {
    animation: jiggle 2s ease-in-out infinite, glow-pulse 1.5s ease-in-out infinite;
}

body.night-mode .rebirth-btn.jiggle {
    animation: jiggle 2s ease-in-out infinite, glow-pulse-night 1.5s ease-in-out infinite;
}

/* Slot Machine */
.slot-machine {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: clamp(12px, 3vw, 20px);
    padding: clamp(1rem, 3vw, 2rem);
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    box-shadow: 
        inset 0 2px 10px rgba(220, 0, 0, 0.05),
        0 0 30px rgba(220, 0, 0, 0.2);
    border: 3px solid rgba(220, 0, 0, 0.3);
}

body.night-mode .slot-machine {
    background: linear-gradient(145deg, #1a0033, #0d0221);
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.5),
                0 0 30px rgba(255, 0, 255, 0.3);
    border-color: rgba(255, 0, 255, 0.4);
}

.slot-display-wrapper {
    position: relative;
}

.slot-display {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: clamp(0.3rem, 1.5vw, 0.6rem);
    max-width: 700px;
    margin: 0 auto;
}

.win-lines-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    /* Ensure SVG is visible */
    display: block;
    overflow: visible;
}

.win-line {
    fill: none;
    stroke: #00d4ff;
    stroke-width: clamp(6, 1.5vw, 12);
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.9));
    animation: drawLine 0.8s ease-out forwards, pulseLine 1.5s ease-in-out infinite 0.8s, fadeOut 1s ease-out 7s forwards;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

body.night-mode .win-line {
    stroke: #ff00ff;
    filter: drop-shadow(0 0 15px rgba(255, 0, 255, 1));
}

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

@keyframes pulseLine {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

.reel {
    background: white;
    border: clamp(2px, 0.5vw, 4px) solid #dc0000;
    border-radius: clamp(8px, 2vw, 12px);
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1),
                0 0 10px rgba(255, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

body.night-mode .reel {
    background: rgba(255, 255, 255, 0.95);
    border-color: #ff00ff;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1),
                0 0 15px rgba(255, 0, 255, 0.3);
}

.reel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(255,255,255,0.8) 0%, 
        transparent 20%, 
        transparent 80%, 
        rgba(0,0,0,0.1) 100%);
    pointer-events: none;
    z-index: 1;
}

.symbol {
    font-size: clamp(2rem, 8vw, 4rem);
    animation: symbolAppear 0.3s ease;
    position: relative;
    z-index: 2;
}

@keyframes symbolAppear {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.reel.spinning {
    border-color: #ff0000;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1),
                0 0 25px rgba(255, 0, 0, 0.6);
}

body.night-mode .reel.spinning {
    border-color: #ff00ff;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1),
                0 0 30px rgba(255, 0, 255, 0.8);
}

.reel.spinning::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    right: 0;
    height: 300%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 30%,
        rgba(255, 0, 0, 0.3) 50%,
        transparent 70%,
        transparent
    );
    animation: reelSpin 0.15s linear infinite;
    z-index: 3;
}

body.night-mode .reel.spinning::after {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 30%,
        rgba(255, 0, 255, 0.4) 50%,
        transparent 70%,
        transparent
    );
}

@keyframes reelSpin {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(33.33%);
    }
}

.reel.spinning .symbol {
    animation: blurSpin 0.1s ease-in-out infinite;
    filter: blur(4px);
}

@keyframes blurSpin {
    0%, 100% {
        transform: translateY(-50px) scale(0.7);
        opacity: 0.3;
    }
    50% {
        transform: translateY(0) scale(1);
        opacity: 0.7;
    }
}

.reel.stopping {
    animation: reelStop 0.2s ease-out;
}

@keyframes reelStop {
    0% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(5px);
    }
    100% {
        transform: translateY(0);
    }
}

.reel.stopping .symbol {
    animation: symbolBounce 0.3s ease-out;
}

@keyframes symbolBounce {
    0% {
        transform: scale(1.3);
        opacity: 0;
    }
    50% {
        transform: scale(0.9);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.reel.winner {
    background: linear-gradient(145deg, #00d4ff, #6ae3ff);
    border-color: #00d4ff;
    animation: winnerPulse 0.6s ease 3;
}

/* Spinning overrides winner state */
.reel.spinning.winner {
    background: white;
    border-color: #ff0000;
    animation: none;
}

body.night-mode .reel.spinning.winner {
    background: rgba(255, 255, 255, 0.95);
    border-color: #ff00ff;
}

@keyframes winnerPulse {
    0%, 100% {
        box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1),
                    0 0 10px rgba(0, 212, 255, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1),
                    0 0 30px rgba(0, 212, 255, 1);
        transform: scale(1.05);
    }
}

.reel.winner .symbol {
    animation: symbolWin 0.6s ease 3;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.9);
}

@keyframes symbolWin {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(-5deg);
    }
    75% {
        transform: scale(1.1) rotate(5deg);
    }
}

/* Confetti Animation */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    pointer-events: none;
    z-index: 50;
    animation: confettiFall 1.5s ease-out forwards;
}

.confetti:nth-child(2n) {
    background: #ff0000;
}

.confetti:nth-child(3n) {
    background: #ff00ff;
}

.confetti:nth-child(4n) {
    background: #00ff00;
}

.confetti:nth-child(5n) {
    background: #00ffff;
}

body.night-mode .confetti:nth-child(2n) {
    background: #ff00ff;
}

body.night-mode .confetti:nth-child(3n) {
    background: #00ffff;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(var(--fall-y)) translateX(var(--fall-x)) rotate(var(--rotation)) scale(0.3);
        opacity: 0;
    }
}

/* Message Display */
.message-display {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: center;
    padding: 0.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: all 0.3s ease;
    pointer-events: none;
    opacity: 0;
    z-index: 10;
}

.message-display.show {
    opacity: 1;
    pointer-events: all;
}

#result-message {
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.message-display.win {
    background: rgba(46, 204, 113, 0.95);
    animation: pulse 0.5s ease;
}

.message-display.win #result-message {
    background: rgba(39, 174, 96, 0.9);
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.8);
}

.message-display.big-win {
    background: rgba(243, 156, 18, 0.95);
    animation: shake 0.5s ease;
}

.message-display.big-win #result-message {
    background: rgba(230, 126, 34, 0.9);
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.8);
}

.message-display.jackpot {
    background: rgba(231, 76, 60, 0.95);
    animation: jackpot 1s ease;
}

.message-display.jackpot #result-message {
    background: rgba(192, 57, 43, 0.9);
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    box-shadow: 0 0 30px rgba(231, 76, 60, 1);
}

.message-display.lose {
    opacity: 0;
}

.message-display.lose #result-message {
    color: white;
}

.message-display.error {
    background: rgba(231, 76, 60, 0.95);
}

.message-display.error #result-message {
    background: rgba(192, 57, 43, 0.9);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.8);
}

.message-display.info {
    background: rgba(52, 152, 219, 0.95);
}

.message-display.info #result-message {
    background: rgba(41, 128, 185, 0.9);
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.8);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

@keyframes jackpot {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(-5deg);
    }
    75% {
        transform: scale(1.1) rotate(5deg);
    }
}

/* Bet Controls */
.bet-controls {
    background: rgba(255, 0, 0, 0.05);
    padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(1rem, 2.5vw, 1.5rem);
    border-radius: clamp(8px, 2vw, 12px);
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    border: 2px solid rgba(255, 0, 0, 0.15);
}

body.night-mode .bet-controls {
    background: rgba(255, 0, 255, 0.08);
    border-color: rgba(255, 0, 255, 0.3);
}

.bet-buttons {
    display: flex;
    gap: clamp(0.3rem, 1vw, 0.5rem);
    justify-content: center;
    flex-wrap: wrap;
}

.bet-btn {
    padding: clamp(0.4rem, 1.2vw, 0.5rem) clamp(0.8rem, 2vw, 1.2rem);
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    font-weight: 700;
    border: 2px solid #dc0000;
    background: white;
    color: #dc0000;
    border-radius: clamp(6px, 1.5vw, 10px);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bet-btn:hover {
    background: #dc0000;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
}

.bet-btn.active {
    background: #dc0000;
    color: white;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

body.night-mode .bet-btn {
    border-color: #ff00ff;
    color: #ff00ff;
    background: rgba(255, 255, 255, 0.95);
}

body.night-mode .bet-btn:hover,
body.night-mode .bet-btn.active {
    background: #ff00ff;
    color: white;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.6);
}

/* Game Controls */
.game-controls {
    display: flex;
    gap: clamp(0.5rem, 2vw, 1rem);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

.btn {
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1.25rem, 3vw, 2rem);
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-weight: 600;
    border: none;
    border-radius: clamp(8px, 2vw, 12px);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    flex: 1;
    min-width: clamp(100px, 25vw, 140px);
}

.btn:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn:active:not(.disabled) {
    transform: translateY(0);
}

.btn-spin {
    background: linear-gradient(135deg, #dc0000, #a00000);
    color: white;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border: 2px solid rgba(255, 0, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 900;
}

.btn-spin:hover:not(.disabled) {
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.6);
}

body.night-mode .btn-spin {
    background: linear-gradient(135deg, #ff00ff, #aa00aa);
    border-color: rgba(255, 0, 255, 0.5);
}

body.night-mode .btn-spin:hover:not(.disabled) {
    box-shadow: 0 0 40px rgba(255, 0, 255, 0.8);
}

.btn-spin .btn-cost {
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    opacity: 0.9;
}

.btn-secondary {
    background: linear-gradient(135deg, #dc0000, #a00000);
    color: white;
    border: 2px solid rgba(255, 0, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

body.night-mode .btn-secondary {
    background: linear-gradient(135deg, #ff00ff, #aa00aa);
    border-color: rgba(255, 0, 255, 0.4);
}

.btn-reset {
    background: linear-gradient(135deg, #dc0000, #a00000);
    color: white;
    border: 2px solid rgba(255, 0, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

body.night-mode .btn-reset {
    background: linear-gradient(135deg, #ff00ff, #aa00aa);
    border-color: rgba(255, 0, 255, 0.4);
}

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

/* Paytable Drawer */
.paytable {
    background: white;
    border-radius: 15px;
    padding: 0;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

body.night-mode .paytable {
    background: #2a2a2a;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.paytable-toggle {
    width: 100%;
    background: linear-gradient(135deg, #dc0000, #a00000);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.paytable-toggle:hover {
    background: linear-gradient(135deg, #a00000, #800000);
}

body.night-mode .paytable-toggle {
    background: linear-gradient(135deg, #ff00ff, #cc00cc);
}

body.night-mode .paytable-toggle:hover {
    background: linear-gradient(135deg, #cc00cc, #990099);
}

.paytable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 clamp(1rem, 2.5vw, 1.5rem);
}

.paytable-content.open {
    max-height: 1000px;
    padding: clamp(1rem, 2.5vw, 1.5rem);
}

.paytable-grid {
    display: flex;
    flex-direction: column;
    gap: clamp(0.3rem, 1vw, 0.5rem);
}

.paytable-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(0.5rem, 1.5vw, 0.8rem);
    background: white;
    border-radius: clamp(6px, 1.5vw, 8px);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.1);
    gap: clamp(0.5rem, 1vw, 1rem);
    flex-wrap: wrap;
}

body.night-mode .paytable-row {
    background: rgba(26, 0, 51, 0.6);
    border-color: rgba(255, 0, 255, 0.3);
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.2);
}

.paytable-symbols {
    font-size: clamp(1rem, 3.5vw, 1.5rem);
    letter-spacing: clamp(0.15rem, 0.5vw, 0.3rem);
}

.paytable-payout {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    font-weight: bold;
    color: #dc0000;
    text-transform: uppercase;
    letter-spacing: clamp(0.5px, 0.15vw, 1px);
}

body.night-mode .paytable-payout {
    color: #ff00ff;
}

.paytable-payout.jackpot {
    color: #dc0000;
    font-size: clamp(1.1rem, 3.5vw, 1.3rem);
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

body.night-mode .paytable-payout.jackpot {
    color: #ff00ff;
    text-shadow: 0 0 15px rgba(255, 0, 255, 0.8);
}

.paytable-note {
    text-align: center;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    color: #666;
    margin-top: 1rem;
    font-style: italic;
}

body.night-mode .paytable-note {
    color: #aaa;
}

/* Number Reference Drawer */
.number-reference {
    background: white;
    border-radius: 15px;
    padding: 0;
    margin: 2rem auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
    overflow: hidden;
}

body.night-mode .number-reference {
    background: #2a2a2a;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.number-ref-toggle {
    width: 100%;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.number-ref-toggle:hover {
    background: linear-gradient(135deg, #357abd, #2868a8);
}

body.night-mode .number-ref-toggle {
    background: linear-gradient(135deg, #5a4fcf, #4338ca);
}

body.night-mode .number-ref-toggle:hover {
    background: linear-gradient(135deg, #4338ca, #3730a3);
}

.toggle-icon {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.number-ref-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 1.5rem;
}

.number-ref-content.open {
    max-height: 1000px;
    padding: 1.5rem;
}

.number-ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.number-ref-column h4 {
    color: #dc0000;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #dc0000;
}

body.night-mode .number-ref-column h4 {
    color: #ff00ff;
    border-bottom-color: #ff00ff;
}

.number-ref-item {
    font-size: 0.85rem;
    padding: 0.4rem 0;
    color: #333;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}

body.night-mode .number-ref-item {
    color: #ddd;
}

.number-ref-item .abbr {
    font-weight: bold;
    color: #4a90e2;
    min-width: 3rem;
    font-family: 'Courier New', monospace;
}

body.night-mode .number-ref-item .abbr {
    color: #5a4fcf;
}

/* Statistics */
.stats {
    background: linear-gradient(135deg, #dc0000, #a00000);
    padding: clamp(1rem, 2.5vw, 1.5rem);
    border-radius: clamp(8px, 2vw, 12px);
    color: white;
    border: 2px solid rgba(255, 0, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.3);
}

body.night-mode .stats {
    background: linear-gradient(135deg, #ff00ff, #aa00aa);
    border-color: rgba(255, 0, 255, 0.5);
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.4);
}

.stats h3 {
    color: white;
}

.stats-grid {
    display: flex;
    justify-content: space-around;
    gap: clamp(0.5rem, 2vw, 1rem);
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.2rem, 0.5vw, 0.3rem);
}

.stat-label {
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    opacity: 0.9;
}

.stat-value {
    font-size: clamp(1rem, 3.5vw, 1.5rem);
    font-weight: bold;
}

.stat-item span:last-child {
    font-size: clamp(1rem, 3.5vw, 1.5rem);
    font-weight: bold;
}

/* Danger Zone */
.danger-zone {
    margin-top: clamp(1rem, 3vw, 2rem);
    padding: clamp(1rem, 2.5vw, 1.5rem);
    background: rgba(220, 0, 0, 0.1);
    border: 2px solid rgba(220, 0, 0, 0.3);
    border-radius: clamp(10px, 2vw, 15px);
    text-align: center;
}

.btn-danger {
    background: linear-gradient(135deg, #dc0000 0%, #990000 100%);
    color: white;
    border: 3px solid #770000;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    padding: clamp(0.6rem, 1.8vw, 0.8rem) clamp(1rem, 2.5vw, 1.5rem);
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    border-color: #990000;
    box-shadow: 
        0 0 20px rgba(220, 0, 0, 0.5),
        0 0 40px rgba(220, 0, 0, 0.3);
    transform: scale(1.05);
}

.btn-danger:active {
    transform: scale(0.98);
}

body.night-mode .danger-zone {
    background: rgba(255, 0, 255, 0.1);
    border-color: rgba(255, 0, 255, 0.3);
}

body.night-mode .btn-danger {
    background: linear-gradient(135deg, #ff00ff 0%, #cc00cc 100%);
    border-color: #990099;
}

body.night-mode .btn-danger:hover {
    background: linear-gradient(135deg, #ff33ff 0%, #ff00ff 100%);
    border-color: #cc00cc;
    box-shadow: 
        0 0 20px rgba(255, 0, 255, 0.5),
        0 0 40px rgba(255, 0, 255, 0.3);
}

/* Responsive Adjustments */

/* Tablets and small laptops */
@media (max-width: 768px) {
    h1 {
        letter-spacing: 2px;
    }
    
    h3 {
        letter-spacing: 1px;
        margin-bottom: 0.75rem;
    }
    
    .balance-item {
        min-width: 80px;
    }
    
    .paytable-symbols {
        font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    }
}

/* Small tablets and large phones (landscape) */
@media (max-width: 600px) {
    .container {
        padding: clamp(0.75rem, 2vw, 1.5rem);
    }

    .slot-machine {
        padding: clamp(0.75rem, 2vw, 1rem);
    }

    .slot-display {
        gap: clamp(0.25rem, 1vw, 0.4rem);
    }

    .reel {
        border-width: clamp(2px, 0.5vw, 3px);
        border-radius: clamp(6px, 1.5vw, 10px);
    }

    .balance-display {
        padding: clamp(0.5rem, 1.5vw, 1rem);
        gap: clamp(0.4rem, 1.5vw, 0.75rem);
    }
    
    .balance-item {
        min-width: 70px;
    }

    .bet-controls, .paytable, .stats {
        padding: clamp(0.5rem, 2vw, 1rem);
    }

    .btn {
        min-width: clamp(90px, 22vw, 120px);
        padding: clamp(0.65rem, 1.8vw, 0.8rem) clamp(1rem, 2.5vw, 1.5rem);
    }
    
    .back-btn {
        font-size: clamp(8px, 1.8vw, 10px);
        padding: clamp(3px, 1vw, 5px) clamp(5px, 1.2vw, 8px);
        letter-spacing: 0.3px;
    }
    
    .night-mode-btn {
        font-size: clamp(12px, 2.5vw, 16px);
        padding: clamp(3px, 1vw, 5px) clamp(5px, 1.2vw, 8px);
    }
    
    .modal-content {
        padding: clamp(1rem, 3vw, 1.5rem);
        max-width: 90%;
    }
    
    .modal-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .modal-btn {
        width: 100%;
        min-width: unset;
        padding: clamp(0.75rem, 2vw, 1rem) clamp(1.25rem, 3vw, 2rem);
    }
    
    .rebirth-options {
        gap: 1rem;
    }
    
    .rebirth-option {
        min-width: 160px;
        padding: clamp(1rem, 3vw, 1.5rem) clamp(0.75rem, 2vw, 1rem);
    }
    
    .rebirth-option-icon {
        font-size: clamp(2rem, 6vw, 2.5rem);
    }
    
    .rebirth-option-title {
        font-size: clamp(1rem, 3vw, 1.2rem);
    }
}

/* Phones (portrait and small landscape) */
@media (max-width: 480px) {
    body {
        padding: clamp(0.3rem, 1vw, 0.5rem);
    }
    
    .container {
        padding: clamp(0.5rem, 1.5vw, 1rem);
        border-radius: clamp(8px, 2vw, 12px);
    }
    
    h1 {
        letter-spacing: 1px;
    }
    
    h3 {
        letter-spacing: 0.5px;
    }
    
    .slot-machine {
        padding: clamp(0.5rem, 1.5vw, 0.8rem);
        border-width: 2px;
    }
    
    .slot-display {
        gap: clamp(0.2rem, 0.8vw, 0.3rem);
    }
    
    .reel {
        border-width: 2px;
        border-radius: clamp(4px, 1vw, 8px);
    }
    
    .symbol {
        font-size: clamp(1.5rem, 6vw, 3rem);
    }
    
    .balance-display {
        padding: clamp(0.4rem, 1.2vw, 0.75rem) clamp(0.6rem, 1.5vw, 1rem);
        gap: clamp(0.3rem, 1vw, 0.5rem);
    }
    
    .balance-item {
        min-width: 60px;
        gap: 0.2rem;
    }
    
    .balance-label {
        font-size: clamp(0.65rem, 1.5vw, 0.8rem);
    }
    
    .balance-value {
        font-size: clamp(1.1rem, 3vw, 1.5rem);
    }
    
    .bet-controls {
        padding: clamp(0.4rem, 1.2vw, 0.5rem) clamp(0.75rem, 2vw, 1rem);
    }
    
    .bet-btn {
        padding: clamp(0.35rem, 1vw, 0.4rem) clamp(0.6rem, 1.5vw, 0.8rem);
        font-size: clamp(0.8rem, 2vw, 0.9rem);
        min-width: 42px;
        letter-spacing: 0.5px;
    }
    
    .btn {
        padding: clamp(0.6rem, 1.5vw, 0.75rem) clamp(0.9rem, 2vw, 1.25rem);
        min-width: clamp(80px, 20vw, 100px);
    }
    
    .btn-spin {
        font-size: clamp(1rem, 3.5vw, 1.2rem);
        letter-spacing: 1px;
        gap: 0.2rem;
    }
    
    .btn-spin .btn-cost {
        font-size: clamp(0.7rem, 2vw, 0.8rem);
    }
    
    .paytable-toggle {
        padding: clamp(0.6rem, 1.8vw, 1rem) clamp(0.8rem, 2vw, 1.5rem);
        font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    }
    
    .paytable-content {
        padding: clamp(0.5rem, 1.5vw, 1rem);
    }
    
    .paytable-symbols {
        font-size: clamp(0.8rem, 2vw, 1rem);
        letter-spacing: 0.05rem;
    }
    
    .paytable-payout,
    .paytable-rarity {
        font-size: clamp(0.85rem, 2vw, 1rem);
    }
    
    .modal-content {
        padding: clamp(0.75rem, 2vw, 1rem);
        border-width: 3px;
    }
    
    .modal-header h2 {
        font-size: clamp(1.2rem, 4vw, 1.5rem);
    }
    
    .modal-warning {
        font-size: clamp(1rem, 3vw, 1.2rem);
    }
    
    .modal-subtext {
        font-size: clamp(0.85rem, 2.5vw, 1rem);
    }
    
    .modal-question {
        font-size: clamp(0.95rem, 3vw, 1.1rem);
    }
    
    .modal-btn {
        font-size: clamp(0.9rem, 2.5vw, 1rem);
        padding: clamp(0.7rem, 2vw, 0.8rem) clamp(1rem, 2.5vw, 1.5rem);
        border-width: 2px;
    }
    
    .rebirth-options {
        gap: 0.75rem;
        flex-direction: column;
    }
    
    .rebirth-option {
        min-width: unset;
        width: 100%;
        padding: clamp(0.75rem, 2vw, 1.25rem) clamp(0.5rem, 1.5vw, 1rem);
    }
    
    .rebirth-option-icon {
        font-size: clamp(1.75rem, 5vw, 2.25rem);
        margin-bottom: 0.5rem;
    }
    
    .rebirth-option-title {
        font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    }
    
    .rebirth-option-desc {
        font-size: clamp(0.75rem, 2vw, 0.85rem);
    }
    
    .rebirth-cancel {
        padding: clamp(0.6rem, 1.8vw, 0.8rem) clamp(1rem, 2.5vw, 1.5rem);
        font-size: clamp(0.85rem, 2.2vw, 0.95rem);
    }
    
    .stats {
        padding: clamp(0.5rem, 1.5vw, 1rem);
    }
    
    .stat-item {
        gap: clamp(0.2rem, 0.5vw, 0.3rem);
    }
    
    .stat-label {
        font-size: clamp(0.7rem, 1.8vw, 0.85rem);
    }
    
    .stat-value {
        font-size: clamp(1rem, 2.5vw, 1.3rem);
    }
}

/* Extra small phones */
@media (max-width: 360px) {
    .header {
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    
    h1 {
        font-size: clamp(1.2rem, 4vw, 1.8rem);
        letter-spacing: 0.5px;
        order: 2;
        width: 100%;
        margin-top: 0.3rem;
    }
    
    .back-btn,
    .night-mode-btn {
        position: static;
        order: 1;
    }
    
    .slot-display {
        gap: 0.15rem;
    }
    
    .reel {
        border-width: 1.5px;
    }
    
    .symbol {
        font-size: clamp(1.2rem, 5vw, 2rem);
    }
    
    .balance-display {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .balance-item {
        flex-direction: row;
        justify-content: space-between;
        min-width: unset;
    }
    
    .bet-btn {
        min-width: 38px;
        padding: 0.3rem 0.5rem;
    }
    
    .game-controls {
        gap: 0.4rem;
    }
}

/* Landscape orientation optimization for phones */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 0.3rem;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .header {
        margin-bottom: 0.5rem;
    }
    
    h1 {
        font-size: clamp(1rem, 3vw, 1.5rem);
    }
    
    .balance-wrapper,
    .slot-machine,
    .bet-controls,
    .game-controls {
        margin-bottom: 0.5rem;
    }
    
    .slot-machine {
        padding: 0.5rem;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Ensure all buttons have minimum touch target size of 44x44px */
    .btn,
    .bet-btn,
    .modal-btn,
    .rebirth-option,
    .paytable-toggle,
    .back-btn,
    .night-mode-btn,
    .rebirth-btn,
    .rebirth-cancel {
        min-height: 44px;
        touch-action: manipulation; /* Disable double-tap zoom */
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover:not(.disabled),
    .bet-btn:hover,
    .modal-btn:hover {
        transform: none;
    }
    
    /* Add active states for better touch feedback */
    .btn:active:not(.disabled),
    .bet-btn:active,
    .modal-btn:active {
        transform: scale(0.95);
        opacity: 0.9;
    }
}

/* Old media query for compatibility */
@media (max-width: 400px) {
    .slot-display {
        gap: clamp(0.15rem, 0.6vw, 0.3rem);
    }

    .reel {
        border-width: clamp(1.5px, 0.4vw, 2px);
        border-radius: clamp(4px, 1vw, 8px);
    }

    .paytable-symbols {
        letter-spacing: 0.1rem;
        font-size: clamp(0.85rem, 2.2vw, 1rem);
    }
    
    .slot-machine {
        padding: clamp(0.5rem, 1.5vw, 0.8rem);
    }
    
    .back-btn {
        font-size: clamp(7px, 1.5vw, 9px);
        padding: clamp(3px, 0.8vw, 4px) clamp(4px, 1vw, 6px);
    }
    
    .night-mode-btn {
        font-size: clamp(10px, 2vw, 14px);
        padding: clamp(3px, 0.8vw, 4px) clamp(4px, 1vw, 6px);
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 4px solid #dc0000;
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 
        0 0 40px rgba(220, 0, 0, 0.6),
        0 0 80px rgba(220, 0, 0, 0.4),
        inset 0 0 20px rgba(220, 0, 0, 0.1);
    transform: translateY(-100vh);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
    animation: shake 0.5s ease 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(220, 0, 0, 0.03) 0px,
            transparent 1px,
            transparent 2px,
            rgba(220, 0, 0, 0.03) 3px
        );
    pointer-events: none;
}

.modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.modal-header h2 {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: clamp(1.5rem, 5vw, 2rem);
    color: #dc0000;
    text-shadow: 
        0 0 10px rgba(220, 0, 0, 0.5),
        0 0 20px rgba(220, 0, 0, 0.3);
    letter-spacing: 0.1rem;
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(220, 0, 0, 0.5),
            0 0 20px rgba(220, 0, 0, 0.3);
    }
    50% {
        text-shadow: 
            0 0 20px rgba(220, 0, 0, 0.8),
            0 0 40px rgba(220, 0, 0, 0.5),
            0 0 60px rgba(220, 0, 0, 0.3);
    }
}

.modal-body {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.modal-warning {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    color: #dc0000;
    font-weight: bold;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

.modal-warning strong {
    font-size: 1.3em;
    text-shadow: 0 0 10px rgba(220, 0, 0, 0.5);
}

.modal-subtext {
    font-size: clamp(1rem, 3vw, 1.1rem);
    color: #555;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.modal-question {
    font-size: clamp(1.1rem, 3.5vw, 1.3rem);
    color: #333;
    font-weight: bold;
    margin-top: 1.5rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
}

.modal-btn {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-weight: bold;
    padding: 1rem 2rem;
    border: 3px solid;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    min-width: 150px;
    position: relative;
    overflow: hidden;
}

.modal-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.modal-btn:hover::before {
    width: 300px;
    height: 300px;
}

.modal-btn-yes {
    background: linear-gradient(135deg, #dc0000 0%, #ff0000 100%);
    color: white;
    border-color: #ff0000;
    box-shadow: 0 0 20px rgba(220, 0, 0, 0.5);
}

.modal-btn-yes:hover {
    background: linear-gradient(135deg, #ff0000 0%, #ff3333 100%);
    box-shadow: 
        0 0 30px rgba(220, 0, 0, 0.8),
        0 0 50px rgba(220, 0, 0, 0.5);
    transform: scale(1.05);
}

.modal-btn-no {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border-color: #495057;
    box-shadow: 0 0 20px rgba(108, 117, 125, 0.3);
}

.modal-btn-no:hover {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    box-shadow: 
        0 0 30px rgba(108, 117, 125, 0.5),
        0 0 50px rgba(108, 117, 125, 0.3);
    transform: scale(1.05);
}

/* Rebirth Modal Specific Styles */
.rebirth-modal {
    max-width: 600px;
}

.rebirth-options {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.rebirth-option {
    flex: 1;
    min-width: 200px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border: 3px solid #45a049;
    border-radius: 15px;
    padding: 2rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.4);
}

.rebirth-option::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.rebirth-option:hover::before {
    width: 400px;
    height: 400px;
}

.rebirth-option:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: scale(1.05) translateY(-5px);
    box-shadow: 
        0 0 30px rgba(76, 175, 80, 0.6),
        0 0 50px rgba(76, 175, 80, 0.4),
        0 5px 15px rgba(0, 0, 0, 0.3);
}

.rebirth-option-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.rebirth-option-title {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.rebirth-option-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

.rebirth-cancel {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border: 3px solid #495057;
    border-radius: 10px;
    padding: 0.8rem 2rem;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(108, 117, 125, 0.3);
}

.rebirth-cancel:hover {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    transform: scale(1.05);
    box-shadow: 
        0 0 30px rgba(108, 117, 125, 0.5),
        0 0 50px rgba(108, 117, 125, 0.3);
}

/* Night Mode Modal Styles */
body.night-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.95);
}

body.night-mode .modal-content {
    background: linear-gradient(135deg, #1a0033 0%, #0d0221 100%);
    border-color: #ff00ff;
    box-shadow: 
        0 0 40px rgba(255, 0, 255, 0.6),
        0 0 80px rgba(255, 0, 255, 0.4),
        inset 0 0 20px rgba(255, 0, 255, 0.1);
}

body.night-mode .rebirth-option {
    background: linear-gradient(135deg, #ff00ff 0%, #cc00cc 100%);
    border-color: #cc00cc;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
}

body.night-mode .rebirth-option:hover {
    background: linear-gradient(135deg, #cc00cc 0%, #990099 100%);
    box-shadow: 
        0 0 30px rgba(255, 0, 255, 0.6),
        0 0 50px rgba(255, 0, 255, 0.4),
        0 5px 15px rgba(0, 0, 0, 0.3);
}

body.night-mode .modal-content::before {
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(255, 0, 255, 0.05) 0px,
            transparent 1px,
            transparent 2px,
            rgba(255, 0, 255, 0.05) 3px
        );
}

body.night-mode .modal-header h2 {
    color: #ff00ff;
    text-shadow: 
        0 0 10px rgba(255, 0, 255, 0.8),
        0 0 20px rgba(255, 0, 255, 0.5);
}

body.night-mode .modal-warning {
    color: #ff00ff;
}

body.night-mode .modal-warning strong {
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.8);
}

body.night-mode .modal-subtext {
    color: #b8b8b8;
}

body.night-mode .modal-question {
    color: #ecf0f1;
}

body.night-mode .modal-btn-yes {
    background: linear-gradient(135deg, #cc00cc 0%, #ff00ff 100%);
    border-color: #ff00ff;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
}

body.night-mode .modal-btn-yes:hover {
    background: linear-gradient(135deg, #ff00ff 0%, #ff33ff 100%);
    box-shadow: 
        0 0 30px rgba(255, 0, 255, 0.8),
        0 0 50px rgba(255, 0, 255, 0.5);
}

/* Responsive modal adjustments are handled in the main responsive section above */
