:root {
    --bg-color: #ffffff;
    --container-bg: #f8f9fa;
    --text-color: #212529;
    --card-bg: #ffffff;
    --btn-bg: #007bff;
    --btn-hover: #0056b3;
    --border-color: #dee2e6;
    --machine-color: #d1d8e0;
    --glass-color: rgba(255, 255, 255, 0.4);
}

body.dark-mode {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --card-bg: #2d2d2d;
    --btn-bg: #375a7f;
    --btn-hover: #2b4764;
    --border-color: #444;
    --machine-color: #4b4b4b;
    --glass-color: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.header {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 { margin: 0; font-size: 1.5rem; }

.controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

#theme-toggle {
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-weight: bold;
}

#generate-btn {
    padding: 12px 24px;
    background-color: var(--btn-bg);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background-color 0.2s;
}

#generate-btn:hover {
    background-color: var(--btn-hover);
}

/* Realistic CSS Lotto Machine Styles */
.machine-container {
    margin: 20px 0 40px 0;
    position: relative;
    width: 300px;
    height: 350px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.realistic-machine {
    width: 240px;
    height: 320px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.drum-sphere {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 8px solid var(--machine-color);
    background: var(--glass-color);
    backdrop-filter: blur(2px);
    position: relative;
    z-index: 5;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.1), 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.inner-balls {
    width: 100%;
    height: 100%;
    position: relative;
}

.machine-stand-top {
    width: 120px;
    height: 20px;
    background: linear-gradient(to bottom, #f0f0f0, #ccc);
    border-radius: 10px 10px 0 0;
    margin-bottom: -5px;
}

body.dark-mode .machine-stand-top {
    background: linear-gradient(to bottom, #555, #333);
}

.machine-base {
    width: 220px;
    height: 100px;
    background: linear-gradient(180deg, var(--machine-color), #888);
    border-radius: 10px;
    margin-top: -10px;
    position: relative;
    z-index: 2;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

body.dark-mode .machine-base {
    background: linear-gradient(180deg, #444, #222);
}

.exit-tube {
    width: 40px;
    height: 60px;
    background: rgba(255,255,255,0.3);
    border: 2px solid var(--machine-color);
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 20px 20px;
}

/* Spinning / Shaking Animations */
.spinning .drum-sphere {
    animation: shake-sphere 0.1s infinite alternate;
}

.spinning .inner-balls .mini-ball {
    animation: crazy-bounce 0.1s infinite alternate;
}

.mini-ball {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.mini-ball:nth-child(1) { top: 20%; left: 30%; background: #fbc02d; }
.mini-ball:nth-child(2) { top: 50%; left: 60%; background: #1976d2; }
.mini-ball:nth-child(3) { top: 70%; left: 20%; background: #d32f2f; }
.mini-ball:nth-child(4) { top: 40%; left: 40%; background: #388e3c; }
.mini-ball:nth-child(5) { top: 60%; left: 70%; background: #7b7b7b; }
.mini-ball:nth-child(6) { top: 30%; left: 60%; background: #ff9f43; }
.mini-ball:nth-child(7) { top: 15%; left: 50%; background: #8e44ad; }
.mini-ball:nth-child(8) { top: 65%; left: 35%; background: #16a085; }

@keyframes shake-sphere {
    from { transform: translate(-2px, 0); }
    to { transform: translate(2px, 0); }
}

@keyframes crazy-bounce {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 60px) scale(0.9); }
}

/* Result Styles */
.lotto-results {
    width: 100%;
    max-width: 800px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.lotto-set {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.lotto-set:hover {
    transform: translateY(-2px);
}

.set-banner {
    padding: 10px 20px;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.banner-1 { background: linear-gradient(90deg, #ff6b6b, #ee5253); }
.banner-2 { background: linear-gradient(90deg, #54a0ff, #2e86de); }
.banner-3 { background: linear-gradient(90deg, #1dd1a1, #10ac84); }
.banner-4 { background: linear-gradient(90deg, #feca57, #ff9f43); }
.banner-5 { background: linear-gradient(90deg, #5f27cd, #341f97); }

.set-content {
    padding: 20px;
}

.set-title {
    font-weight: bold;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
}

.numbers-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

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

.plus-sign {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 5px;
}

.ball-1-10 { background-color: #fbc02d; }
.ball-11-20 { background-color: #1976d2; }
.ball-21-30 { background-color: #d32f2f; }
.ball-31-40 { background-color: #7b7b7b; }
.ball-41-45 { background-color: #388e3c; }
