/* Lottery Game Styles */
:root {
    --bg-gradient: radial-gradient(circle at center, #00A8E8, #004E89); /* Cyan to Deep Blue */
    --gold: #FFD700;
    --white: #ffffff;
    --text-dark: #333;
    --glass: rgba(255,255,255,0.2);
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg-gradient);
    font-family: 'Roboto', sans-serif;
    color: white;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    width: 100%;
    max-width: 1000px;
    height: 95vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 15px;
    margin-bottom: 20px;
}
.back-btn { color: white; font-size: 1.5rem; }
.balance-box { font-weight: bold; font-size: 1.2rem; color: var(--gold); }

.mode-switcher {
    display: flex;
    gap: 10px;
    background: rgba(0,0,0,0.5);
    padding: 5px;
    border-radius: 25px;
}
.mode-btn {
    background: transparent;
    border: none;
    color: #aaa;
    padding: 8px 15px;
    cursor: pointer;
    font-weight: bold;
    border-radius: 20px;
    transition: 0.3s;
}
.mode-btn.active {
    background: var(--gold);
    color: #333;
    box-shadow: 0 0 10px var(--gold);
}

/* Main Layout */
.main-stage {
    flex: 1;
    display: flex;
    gap: 20px;
    height: 100%;
    overflow: hidden;
}

/* Left: Drum */
.drum-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.drum-container {
    width: 300px;
    height: 300px;
    border: 5px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    position: relative;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.1), rgba(255,255,255,0));
    box-shadow: 0 0 30px rgba(255,255,255,0.2), inset 0 0 50px rgba(0,0,0,0.5);
    overflow: hidden;
    margin-bottom: 30px;
}

.balls-container {
    width: 100%; height: 100%;
    position: relative;
}

/* Ball Animation inside Drum */
.lotto-ball {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, #ddd);
    color: #333;
    font-weight: bold;
    display: flex; align-items: center; justify-content: center;
    position: absolute;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    font-size: 14px;
}
/* Winning Ball Highlight */
.lotto-ball.win {
    background: radial-gradient(circle at 30% 30%, #FFD700, #F57F17);
    border: 2px solid white;
    transform: scale(1.2);
}

/* Result Tray */
.result-tray {
    display: flex;
    gap: 10px;
    background: rgba(0,0,0,0.4);
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.3);
}
.tray-slot {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: #fff;
    border: 2px dashed rgba(255,255,255,0.3);
}
.tray-slot.filled {
    background: #fff;
    color: #E60000;
    border: none;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
    animation: dropIn 0.5s ease-out;
}
.tray-slot.rolling {
    background: rgba(255,215,0, 0.3);
    color: #FFD700;
    font-family: 'Consolas', monospace; /* Monospace for stability */
    animation: shake 0.1s infinite;
}
@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

@keyframes dropIn {
    0% { transform: translateY(-50px) scale(0.5); opacity: 0; }
    60% { transform: translateY(10px) scale(1.1); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.action-btn {
    background: linear-gradient(to bottom, #FFD700, #F57F17);
    border: none;
    padding: 15px 40px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 5px 0 #E65100, 0 10px 20px rgba(0,0,0,0.3);
    transition: transform 0.1s;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.action-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #E65100; }
.action-btn:disabled { filter: grayscale(1); cursor: not-allowed; opacity: 0.7; }

/* Right: Grid */
.ticket-section {
    flex: 1;
    background: #fff;
    border-radius: 20px;
    color: #333;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    max-width: 450px;
}

.ticket-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}
.ticket-header h3 { margin: 0; color: #004E89; }

.small-btn {
    background: #eee; border: none; padding: 5px 10px; border-radius: 5px;
    cursor: pointer; font-size: 0.9rem;
    transition: 0.2s;
}
.small-btn:hover { background: #ddd; }

.number-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    padding: 5px;
    align-content: start; /* Compact from top */
    overflow-y: hidden; /* Try to avoid scroll */
}

/* Responsive Grid for 55 numbers */
@media (min-width: 400px) {
    .number-grid {
        grid-template-columns: repeat(8, 1fr); /* 8 cols * 7 rows = 56 slots */
    }
}

.n-btn {
    aspect-ratio: 1;
    border: 1px solid #ccc;
    background: #f9f9f9;
    border-radius: 6px; /* Slightly less rounded */
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95rem; /* Smaller font */
    color: #555;
    transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
    padding: 0; /* Removing padding relies on flex centering */
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.n-btn:hover { background: #e0f7fa; border-color: #00A8E8; transform: translateY(-1px); }
.n-btn.active {
    background: #E60000;
    color: white;
    border-color: #B71C1C;
    box-shadow: 0 2px 5px rgba(230,0,0,0.4);
    transform: scale(1.05);
}

.ticket-footer {
    margin-top: 15px;
    text-align: right;
    font-size: 1.1rem;
    font-weight: bold;
    color: #004E89;
}

/* Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-overlay.hidden { display: none; }

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    width: 90%; max-width: 400px;
    color: #333;
    animation: popIn 0.3s;
}
@keyframes popIn { from {transform: scale(0.8);} to {transform: scale(1);} }

/* Result Panel */
.result-panel {
    display: flex; flex-direction: column; gap: 15px;
    animation: fadeIn 0.5s;
}
.result-panel.hidden { display: none; }

.score-table {
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}
.score-table h4, .user-picks h4 {
    margin: 0 0 10px 0; color: #004E89; text-align: center; font-size: 1.2rem;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
}

.score-row {
    display: flex; justify-content: space-between;
    padding: 8px 10px;
    margin-bottom: 5px;
    border-radius: 5px;
    background: #f5f5f5;
    font-weight: bold;
    color: #555;
}
.score-row.win {
    background: #FFD700;
    color: #333;
    animation: pulse 1s infinite;
    box-shadow: 0 0 10px var(--gold);
}
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.02); } 100% { transform: scale(1); } }

.prize { color: #E65100; }
.score-row.win .prize { color: #cc0000; font-weight: 900; }

.picked-balls {
    display: flex; gap: 5px; justify-content: center;
    flex-wrap: wrap;
}
.pb {
    width: 35px; height: 35px;
    border-radius: 50%;
    background: #ddd; color: #333;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    border: 1px solid #ccc;
}
.pb.match {
    background: linear-gradient(to bottom, #FFD700, #F57F17);
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.action-footer { text-align: center; margin-top: 10px; }
.action-btn.small { font-size: 1rem; padding: 10px 20px; }

/* Mobile Responsive */
@media (max-width: 768px) {
    .game-container { height: 100vh; flex-direction: column; overflow-y: auto; }
    .main-stage { flex-direction: column; height: auto; display: block; }
    .drum-section, .ticket-section { width: 100%; max-width: none; margin-bottom: 20px; }
    .ticket-section { flex: none; height: auto; }
}
