:root {
    --bg-color: #f0f0f0;
    --text-color: #333;
    --container-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --button-bg: #4CAF50;
    --button-hover: #45a049;
    --circle-bg: #eee;
    --transition-speed: 0.3s;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --container-bg: #2d2d2d;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --button-bg: #388e3c;
    --button-hover: #2e7d32;
    --circle-bg: #444;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.container {
    position: relative;
    text-align: center;
    background-color: var(--container-bg);
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: background-color var(--transition-speed), box-shadow var(--transition-speed);
    max-width: 90%;
}

.theme-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: rgba(128, 128, 128, 0.1);
}

h1 {
    margin-top: 0;
    font-weight: 700;
}

.numbers-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 30px 0;
    min-height: 50px;
}

.number {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--circle-bg);
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff; /* White text for better contrast on lottery colors */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#generate-btn {
    background-color: var(--button-bg);
    color: white;
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

#generate-btn:hover {
    background-color: var(--button-hover);
    transform: translateY(-2px);
}

#generate-btn:active {
    transform: translateY(0);
}

/* History Section */
.history-section {
    margin-top: 40px;
    width: 100%;
}

.history-section hr {
    border: 0;
    border-top: 1px solid var(--shadow-color);
    margin-bottom: 30px;
}

.history-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-color);
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    background-color: var(--container-bg);
    max-height: 400px;
    overflow-y: auto;
}

.secondary-btn {
    margin-top: 20px;
    background-color: transparent;
    color: var(--button-bg);
    border: 2px solid var(--button-bg);
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background-color: var(--button-bg);
    color: white;
}

.secondary-btn:disabled {
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
}

.status-msg {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #888;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 14px 10px;
    text-align: center;
    border-bottom: 1px solid var(--shadow-color);
}

th {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-weight: 600;
}

.history-numbers {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.history-ball {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
}

.loading {
    padding: 30px;
    font-style: italic;
    color: #888;
}

@media (max-width: 600px) {
    .container {
        padding: 1.5rem;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    .history-ball {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    th, td {
        padding: 10px 5px;
    }
}
