:root {
    --bg-color: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.9);
    --primary-gradient: linear-gradient(135deg, #4285f4, #9b72cb, #ea4335);
    --secondary-color: #58a6ff;
    --text-color: #c9d1d9;
    --sub-text: #8b949e;
    --excluded-color: #f85149;
    --grid-bg: rgba(0, 0, 0, 0.2);
    --border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] {
    --bg-color: #f8f9fa;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-color: #202124;
    --sub-text: #5f6368;
    --excluded-color: #d93025;
    --grid-bg: #f1f3f4;
    --border-color: #dadce0;
}

* { box-sizing: border-box; margin: 0; padding: 0; transition: background-color 0.3s, color 0.3s; }

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    display: flex; justify-content: center; min-height: 100vh; padding: 40px 20px;
}

.container {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    padding: 40px;
    max-width: 650px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    text-align: center;
}

.theme-toggle {
    position: absolute; top: 25px; right: 25px;
    background: var(--grid-bg); border: 1px solid var(--border-color);
    color: var(--text-color); padding: 10px; border-radius: 50%; cursor: pointer;
}

header { margin-bottom: 40px; }
header h1 { font-size: 3rem; margin-bottom: 10px; }
.gradient-text { background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; }
header p { color: var(--sub-text); font-size: 1.1rem; }

.nav-links { margin-top: 15px; }
.nav-btn {
    display: inline-block; background: var(--grid-bg); color: var(--text-color);
    text-decoration: none; font-size: 0.85rem; font-weight: 600; padding: 8px 20px;
    border: 1px solid var(--border-color); border-radius: 20px; transition: 0.2s;
}

.info-intro { margin-bottom: 30px; padding: 20px; border-radius: 16px; background: rgba(66, 133, 244, 0.05); }
.info-intro h2 { font-size: 1.4rem; margin-bottom: 10px; color: var(--secondary-color); }
.info-intro p { font-size: 0.95rem; color: var(--sub-text); }

.number-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 10px; margin-bottom: 30px; background: var(--grid-bg); padding: 20px; border-radius: 24px;
}
.number-cell {
    width: 45px; height: 45px; display: flex; align-items: center; justify-content: center;
    border-radius: 14px; border: 1px solid var(--border-color); cursor: pointer; font-weight: bold;
}
.number-cell.excluded { background: var(--excluded-color); color: white; border-color: transparent; opacity: 0.8; }

.button-group { display: flex; gap: 15px; justify-content: center; margin-bottom: 40px; }
.primary-btn {
    padding: 15px 25px; font-size: 1rem; font-weight: bold; border-radius: 16px; 
    cursor: pointer; transition: 0.2s; border: none; background: var(--primary-gradient); color: white;
}
.primary-btn:hover { transform: scale(1.02); box-shadow: 0 5px 20px rgba(66, 133, 244, 0.4); }

.result-container { 
    min-height: 80px; display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px; 
    max-height: 500px; overflow-y: auto; padding: 10px; border-radius: 20px;
}
.result-wrapper {
    display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px;
    animation: slideDown 0.4s ease-out both;
}
.result-row { 
    display: flex; justify-content: center; gap: 10px; 
    background: rgba(255, 255, 255, 0.05); padding: 15px; border-radius: 16px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
}
.history-badge {
    font-size: 0.85rem; color: var(--sub-text);
    background: var(--grid-bg); padding: 6px 12px; border-radius: 10px;
    display: inline-block; align-self: center;
}
.history-badge.win {
    color: var(--secondary-color);
    border: 1px solid rgba(88, 166, 255, 0.2);
    background: rgba(88, 166, 255, 0.05);
}
.history-badge strong { color: var(--excluded-color); font-weight: 800; }

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

.lotto-ball {
    width: 48px; height: 48px; border-radius: 50%; color: white;
    display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Ball Colors (Donghaeng Lottery) */
.ball-yellow { background: #fbc400; color: #333; }
.ball-blue   { background: #69c8f2; color: #fff; }
.ball-red    { background: #ff7272; color: #fff; }
.ball-gray   { background: #aaaaaa; color: #fff; }
.ball-green  { background: #b0d840; color: #fff; }

.how-to-use h3 { margin-bottom: 20px; color: var(--sub-text); }
.info-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; text-align: left; }
.card { background: var(--grid-bg); padding: 20px; border-radius: 16px; border: 1px solid var(--border-color); }
.card h4 { font-size: 1rem; margin-bottom: 8px; color: var(--secondary-color); }
.card p { font-size: 0.85rem; color: var(--sub-text); }

.divider { border: none; border-top: 1px solid var(--border-color); margin: 40px 0; }

.footer { margin-top: 50px; border-top: 1px solid var(--border-color); padding-top: 30px; }
.footer-links { margin-bottom: 15px; display: flex; justify-content: center; gap: 20px; }
.footer-links a { color: var(--sub-text); text-decoration: none; font-size: 0.9rem; }
.footer p { font-size: 0.8rem; color: #555; }
