:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --primary-color: #6366f1;
    --secondary-color: #818cf8;
    --accent-color: #c084fc;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --number-bg: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --shadow-color: rgba(0, 0, 0, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(192, 132, 252, 0.15) 0%, transparent 20%);
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    text-align: center;
}

header {
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
    position: relative;
}

.logo {
    max-width: 200px;
    width: 100%;
    height: auto;
    margin-bottom: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
    /* Soft glow for visibility on dark background */
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
    transition: filter 0.3s ease;
}

.numbers-container {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem 2rem;
    /* Reduced vertical padding */
    min-height: 120px;
    /* Reduced min-height */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    box-shadow: 0 20px 40px var(--shadow-color);
    transition: all 0.3s ease;
}

.placeholder-text {
    color: #64748b;
    font-size: 1.2rem;
    width: 100%;
}

.lotto-number {
    width: 100px;
    /* Increased from 80px */
    height: 100px;
    /* Increased from 80px */
    border-radius: 50%;
    background: var(--number-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    /* Increased from 2rem */
    font-weight: 700;
    color: white;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
    transform: scale(0.5);
}

/* Different colors for number ranges */
.lotto-number[data-range="1"] {
    background: linear-gradient(135deg, #facc15 0%, #eab308 100%);
}

.lotto-number[data-range="2"] {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.lotto-number[data-range="3"] {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.lotto-number[data-range="4"] {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
}

.lotto-number[data-range="5"] {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.generate-btn {
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    border: none;
    padding: 1rem 3rem;
    border-radius: 50px;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.5);
}

.generate-btn:active {
    transform: translateY(1px);
}

.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

footer {
    margin-top: 3rem;
    color: #64748b;
    font-size: 0.9rem;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Mobile Responsiveness */
@media (max-width: 600px) {
    header {
        margin-bottom: 2rem;
        padding-top: 1rem;
    }

    .lotto-number {
        width: 50px;
        /* Increased from 38px */
        height: 50px;
        /* Increased from 38px */
        font-size: 1.4rem;
        /* Increased from 1rem */
    }

    .container {
        padding: 0.5rem;
        width: 100%;
        overflow-x: hidden;
    }

    .numbers-container {
        padding: 1.5rem 0.2rem;
        gap: 0.3rem;
        flex-wrap: nowrap;
    }

    /* Toggle Buttons Adjustment */
    .theme-toggle {
        top: 0.5rem;
        right: 0.2rem;
        /* Moved closer to right edge */
        width: 28px;
        /* Slightly smaller */
        height: 28px;
        font-size: 0.8rem;
    }

    .animation-toggle {
        top: 2.8rem;
        right: 0.2rem;
        /* Moved closer to right edge */
        width: 28px;
        /* Slightly smaller */
        height: 28px;
        font-size: 0.8rem;
    }

    /* Mode Selector Adjustment */
    .mode-selector {
        gap: 0;
        /* Removed gap completely */
        padding: 2px;
        /* Minimal padding */
        width: 100%;
        display: flex;
        justify-content: space-between;
        background: rgba(255, 255, 255, 0.05);
    }

    .mode-option {
        flex: 1;
        min-width: 0;
        display: flex;
        justify-content: center;
    }

    .mode-label {
        padding: 0.4rem 0;
        font-size: 0.65rem;
        white-space: nowrap;
        text-align: center;
        width: 100%;
        border-radius: 15px;
        letter-spacing: -0.5px;
    }
}

/* History Section */
.history-section {
    margin-top: 3rem;
    width: 100%;
    animation: fadeInDown 1s ease-out;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.history-header h2 {
    font-size: 1.2rem;
    color: #cbd5e1;
    font-weight: 600;
}

.clear-btn {
    background: transparent;
    border: 1px solid #475569;
    color: #94a3b8;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    border-color: #64748b;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Scrollbar styling for history list */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    animation: fadeInDown 0.3s ease-out;
}

.history-number {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--number-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Reuse range colors for history items */
.history-number[data-range="1"] {
    background: linear-gradient(135deg, #facc15 0%, #eab308 100%);
}

.history-number[data-range="2"] {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.history-number[data-range="3"] {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.history-number[data-range="4"] {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
}

.history-number[data-range="5"] {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.delete-item-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.delete-item-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Settings Section */
.settings-container {
    width: 100%;
    margin-bottom: 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
}

.settings-container summary {
    padding: 1rem;
    cursor: pointer;
    color: #cbd5e1;
    font-weight: 600;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.settings-container summary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.settings-container summary::after {
    content: "+";
    font-size: 1.2rem;
}

.settings-container[open] summary::after {
    content: "-";
}

.settings-content {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.input-group label {
    font-size: 0.9rem;
    color: #94a3b8;
}

.input-group input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #475569;
    padding: 0.8rem;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--primary-color);
}

/* Mode Selector */
.mode-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mode-option {
    position: relative;
    cursor: pointer;
}

.mode-option input {
    display: none;
}

.mode-label {
    display: block;
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
}

.mode-option input:checked+.mode-label {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.mode-option:hover .mode-label {
    color: white;
}

/* Theme Switcher */
body.light-mode {
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --glass-bg: rgba(0, 0, 0, 0.05);
    --glass-border: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Light Mode Logo Fix */
body.light-mode .logo {
    filter: none;
    mix-blend-mode: normal;
    /* Changed from multiply to normal for sticker style */
}

body.light-mode .history-item {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-mode .settings-container summary {
    color: #475569;
}

body.light-mode .settings-container summary:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.light-mode .input-group input {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid #cbd5e1;
    color: #1e293b;
}

body.light-mode .mode-selector {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .mode-label {
    color: #64748b;
}

body.light-mode .mode-option:hover .mode-label {
    color: #1e293b;
}

body.light-mode .mode-option input:checked+.mode-label {
    color: white;
}

.theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(15deg);
}

body.light-mode .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Light Mode Text Visibility Fixes */
body.light-mode header p {
    color: #475569;
}

body.light-mode .history-header h2 {
    color: #334155;
}

body.light-mode .clear-btn {
    color: #475569;
    border-color: #94a3b8;
}

body.light-mode .clear-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #1e293b;
    border-color: #64748b;
}

/* Animation Toggle Button */
.animation-toggle {
    position: absolute;
    top: 4.5rem;
    right: 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.animation-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

body.light-mode .animation-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}