:root {
    --bg-color: #f4f7f9;
    --container-bg: #ffffff;
    --text-color: #2c3e50;
    --secondary-text: #5d6d7e;
    --muted-text: #85929e;
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --accent-color: #007BFF;
    --selection-bg: #f8f9fa;
    --selection-border: #e9ecef;
    --btn-border: #dee2e6;
    --modal-overlay: rgba(0,0,0,0.6);
    --shadow: rgba(0,0,0,0.08);
    --card-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

body.dark-mode {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --secondary-text: #b0b0b0;
    --muted-text: #707070;
    --selection-bg: #2d2d2d;
    --selection-border: #333333;
    --btn-border: #444444;
    --modal-overlay: rgba(0,0,0,0.8);
    --shadow: rgba(0,0,0,0.3);
}

body {
    font-family: 'Apple SD Gothic Neo', 'Pretendard', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
    transition: background-color 0.3s;
}

/* Header & Navigation */
.main-header {
    background-color: var(--container-bg);
    box-shadow: 0 2px 10px var(--shadow);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.main-nav {
    display: flex;
    align-items: center;
    gap: 25px;
}
.main-nav a {
    text-decoration: none;
    color: var(--secondary-text);
    font-weight: 600;
    font-size: 15px;
}
.theme-toggle {
    background: none; border: none; font-size: 20px; cursor: pointer;
}

/* Layout */
.app-wrapper {
    display: flex;
    gap: 25px;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
    align-items: flex-start;
}

.card {
    background-color: var(--container-bg);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    padding: 30px 25px;
}

/* Sidebar & Info Columns */
.sidebar { flex: 1; text-align: center; }

/* 최신 당첨 결과 번호 가로 정렬 및 크기 조정 */
.winning-balls {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 20px;
}
.winning-balls .ball {
    width: 36px;
    height: 36px;
    font-size: 14px;
    flex-shrink: 0;
}
.bonus-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-top: 1px solid var(--selection-border);
    padding-top: 15px;
    margin-top: 10px;
}
.bonus-area span {
    font-size: 20px;
    font-weight: bold;
    color: var(--muted-text);
}
.bonus-area .ball {
    width: 36px;
    height: 36px;
    font-size: 14px;
}
.container { flex: 1.5; text-align: center; }
.info-column { flex: 1; display: flex; flex-direction: column; gap: 25px; }

/* Components */
h1 { font-size: 24px; margin-bottom: 5px; }
h2 { font-size: 20px; margin-top: 0; }
h3 { font-size: 18px; margin-top: 0; }

.section-desc { color: var(--secondary-text); margin-bottom: 25px; font-size: 14px; }
.badge { background: var(--accent-color); color: white; padding: 2px 8px; border-radius: 5px; font-size: 12px; vertical-align: middle; }

/* Selection Grid */
.selection-area {
    background-color: var(--selection-bg);
    border: 1px solid var(--selection-border);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
}
.selection-header { display: flex; justify-content: space-between; margin-bottom: 15px; }
.selection-title { font-weight: bold; font-size: 14px; }
.reset-btn {
    padding: 5px 12px; font-size: 11px; background: #ff5252; color: white; border: none; border-radius: 5px; cursor: pointer;
}

.number-grid { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.num-btn {
    width: 32px; height: 32px; border: 1px solid var(--btn-border); background: var(--container-bg);
    border-radius: 50%; cursor: pointer; font-weight: bold; font-size: 12px; color: var(--text-color);
}
.num-btn.selected { background: var(--primary-color); color: white; border-color: var(--primary-color); }

/* Ball Styles */
.ball-container { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }
.game-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.game-label { width: 70px; text-align: left; font-size: 12px; color: var(--secondary-text); display: flex; flex-direction: column; }
.mode-toggle-btn { font-size: 9px; padding: 2px 5px; margin-top: 2px; border-radius: 3px; border: 1px solid var(--btn-border); cursor: pointer; }
.mode-toggle-btn.active-semi { background: var(--accent-color); color: white; }

.ball {
    width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 800; font-size: 16px; box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}
.ball-yellow { background: #fbc400; }
.ball-blue { background: #69c8f2; }
.ball-red { background: #ff7272; }
.ball-gray { background: #aaaaaa; }
.ball-green { background: #b0d840; }
.ball-black { background: #2a2a2a; color: #888; }

/* Buttons */
.button-group { display: flex; gap: 10px; }
.generate-btn { flex: 2; padding: 16px; background: var(--primary-color); color: white; border: none; border-radius: 12px; font-weight: bold; font-size: 17px; cursor: pointer; }
.share-btn { flex: 1; padding: 16px; background: var(--accent-color); color: white; border: none; border-radius: 12px; font-weight: bold; cursor: pointer; }

/* Info Column & Footer */
.algorithm-info ul { padding-left: 20px; font-size: 14px; text-align: left; }
.disclaimer { font-size: 11px; color: var(--muted-text); margin-top: 20px; border-top: 1px solid var(--selection-border); pt: 10px; }

.main-footer {
    background: var(--container-bg);
    padding: 40px 0;
    margin-top: 60px;
    border-top: 1px solid var(--selection-border);
}
.footer-content { max-width: 1200px; margin: 0 auto; text-align: center; color: var(--secondary-text); font-size: 14px; }
.footer-links { margin-top: 15px; display: flex; justify-content: center; gap: 20px; }
.footer-links a { color: var(--accent-color); text-decoration: none; font-weight: bold; }

/* Modals */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background: var(--modal-overlay); }
.modal-content { background: var(--container-bg); padding: 30px; border-radius: 20px; width: 90%; max-width: 500px; margin: 10vh auto; position: relative; }
.policy-content { max-width: 800px; max-height: 70vh; overflow-y: auto; text-align: left; }
.close-btn { position: absolute; right: 20px; top: 15px; font-size: 30px; cursor: pointer; }
.preview-img { width: 100%; border-radius: 15px; margin: 20px 0; box-shadow: 0 5px 15px var(--shadow); }

/* Responsive */
@media (max-width: 1100px) {
    .app-wrapper { flex-direction: column; align-items: center; }
    .sidebar, .container, .info-column { width: 100%; max-width: 600px; flex: none; }
}
