:root {
    --primary-color: #4a90e2;
    --secondary-color: #f5a623;
    --background-color: #f0f2f5;
    --text-color: #333;
    --container-bg: #fff;
    --ball-bg: var(--secondary-color);
    --ball-text: #fff;
    --history-item-bg: #f9f9f9;
    --border-radius: 12px;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.1), 0 6px 6px rgba(0, 0, 0, 0.15);
    --transition-speed: 0.3s;
}

[data-theme="dark"] {
    --background-color: #1a1a1a;
    --text-color: #f0f2f5;
    --container-bg: #2d2d2d;
    --ball-bg: #e67e22;
    --ball-text: #fff;
    --history-item-bg: #3d3d3d;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.3), 0 6px 6px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle at top left, var(--primary-color), transparent 50%);
    opacity: 0.2;
    z-index: -1;
}

.container {
    background: var(--container-bg);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    width: 90%;
    max-width: 500px;
    transition: transform 0.3s ease, background-color var(--transition-speed), box-shadow var(--transition-speed);
    position: relative;
}

.container:hover {
    transform: translateY(-5px);
}

.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

#theme-btn {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: all var(--transition-speed);
}

#theme-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    font-size: 2.5rem;
    letter-spacing: -1px;
}

.lotto-display {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.lotto-ball {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: var(--ball-bg);
    color: var(--ball-text);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, background-color var(--transition-speed);
}

.lotto-ball:hover {
    transform: scale(1.1) rotate(10deg);
}

#generate-btn {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 1.2rem 2.5rem;
    font-size: 1.3rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
    width: 100%;
}

#generate-btn:hover {
    background-color: #357ABD;
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
    transform: translateY(-2px);
}

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

#history {
    margin-top: 2.5rem;
    text-align: left;
}

h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

#history-list {
    list-style: none;
    padding: 0;
    max-height: 250px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

#history-list::-webkit-scrollbar {
    width: 6px;
}

#history-list::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

#history-list li {
    background: var(--history-item-bg);
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 0.6rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    color: var(--text-color);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

#history-list li:first-child {
    border-left: 4px solid var(--primary-color);
}
