@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700;900&display=swap');

/* Dark Mode (default) */
:root {
    --bg: #1a1a2e;
    --card-bg: #16213e;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --accent: #e94560;
    --text: #eee;
    --text-muted: #8892b0;
    --border: #334;
    --history-border: rgba(255, 255, 255, 0.05);
    --scrollbar: #334;
    --nav-bg: rgba(26, 26, 46, 0.95);
}

/* Light Mode */
[data-theme="light"] {
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.08);
    --accent: #d63851;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --border: #d1d5db;
    --history-border: rgba(0, 0, 0, 0.06);
    --scrollbar: #ccc;
    --nav-bg: rgba(240, 242, 245, 0.95);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-top: 70px;
    line-height: 1.7;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s;
}

.nav-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-size: 1.4rem;
    font-weight: 900;
    text-decoration: none;
    background: linear-gradient(135deg, var(--accent), #f5a623);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--accent);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s;
}

/* Container */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* Hero */
.hero {
    text-align: center;
    padding: 30px 0 10px;
}

h1 {
    font-size: 2.4rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent), #f5a623);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    margin-top: 10px;
    font-size: 1rem;
    line-height: 1.6;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 28px 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px var(--card-shadow);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 16px;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.7;
}

/* Lotto Display */
.lotto-display {
    background: var(--bg);
    border-radius: 12px;
    padding: 24px 16px;
    margin-bottom: 20px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.balls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ball {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: inset 0 -4px 6px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    position: relative;
}

.ball::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 12px;
    width: 16px;
    height: 8px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    transform: rotate(-20deg);
}

.ball:nth-child(1) { animation-delay: 0.05s; }
.ball:nth-child(2) { animation-delay: 0.15s; }
.ball:nth-child(3) { animation-delay: 0.25s; }
.ball:nth-child(4) { animation-delay: 0.35s; }
.ball:nth-child(5) { animation-delay: 0.45s; }
.ball:nth-child(6) { animation-delay: 0.55s; }
.ball.bonus { animation-delay: 0.75s; }

.separator {
    font-size: 1.6rem;
    color: var(--text-muted);
    margin: 0 4px;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: 0.65s;
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Ball Colors by Range */
.ball.range-1 { background: linear-gradient(145deg, #fdd835, #f9a825); }
.ball.range-2 { background: linear-gradient(145deg, #42a5f5, #1976d2); }
.ball.range-3 { background: linear-gradient(145deg, #ef5350, #c62828); }
.ball.range-4 { background: linear-gradient(145deg, #bdbdbd, #757575); }
.ball.range-5 { background: linear-gradient(145deg, #9ccc65, #558b2f); }

/* Color Guide */
.color-guide {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.color-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 8px 14px;
    border-radius: 8px;
}

.color-item strong {
    color: var(--text);
}

.color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2);
}

.color-dot.range-1 { background: linear-gradient(145deg, #fdd835, #f9a825); }
.color-dot.range-2 { background: linear-gradient(145deg, #42a5f5, #1976d2); }
.color-dot.range-3 { background: linear-gradient(145deg, #ef5350, #c62828); }
.color-dot.range-4 { background: linear-gradient(145deg, #bdbdbd, #757575); }
.color-dot.range-5 { background: linear-gradient(145deg, #9ccc65, #558b2f); }

/* Controls */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#generate-btn {
    background: linear-gradient(135deg, var(--accent), #c0392b);
    color: #fff;
    border: none;
    padding: 14px 40px;
    font-size: 1.15rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
    font-family: 'Noto Sans KR', sans-serif;
}

#generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(233, 69, 96, 0.6);
}

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

.set-count {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

#set-select {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Noto Sans KR', sans-serif;
    cursor: pointer;
}

/* Multi Results */
.multi-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-row {
    background: var(--bg);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    animation: slideIn 0.3s ease both;
}

.result-row .label {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 700;
    min-width: 20px;
}

.result-row .ball {
    width: 42px;
    height: 42px;
    font-size: 1.05rem;
}

.result-row .ball::after {
    top: 5px;
    left: 9px;
    width: 12px;
    height: 6px;
}

.result-row .separator {
    font-size: 1.2rem;
    margin: 0 2px;
}

@keyframes slideIn {
    0% { transform: translateX(-20px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.result-row:nth-child(1) { animation-delay: 0s; }
.result-row:nth-child(2) { animation-delay: 0.08s; }
.result-row:nth-child(3) { animation-delay: 0.16s; }
.result-row:nth-child(4) { animation-delay: 0.24s; }
.result-row:nth-child(5) { animation-delay: 0.32s; }

/* History */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.clear-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Noto Sans KR', sans-serif;
}

.clear-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

#history-list {
    list-style: none;
    max-height: 350px;
    overflow-y: auto;
}

#history-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--history-border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

#history-list li:last-child {
    border-bottom: none;
}

#history-list .timestamp {
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 100%;
    margin-bottom: 4px;
}

#history-list .ball {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
    animation: none;
}

#history-list .ball::after {
    top: 4px;
    left: 8px;
    width: 10px;
    height: 5px;
}

#history-list .separator {
    font-size: 1rem;
    animation: none;
}

.empty-msg {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 20px 0;
}

/* Scrollbar */
#history-list::-webkit-scrollbar { width: 6px; }
#history-list::-webkit-scrollbar-track { background: transparent; }
#history-list::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

/* Content Sections */
.content-section .article {
    margin-bottom: 24px;
}

.content-section .article:last-child {
    margin-bottom: 0;
}

.content-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    padding-left: 12px;
    border-left: 3px solid var(--accent);
}

.content-section p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.8;
}

.content-section code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--accent);
}

.content-section a {
    color: var(--accent);
    text-decoration: underline;
}

.info-list {
    list-style: none;
    padding: 0;
    margin-top: 8px;
}

.info-list li {
    padding: 6px 0 6px 16px;
    position: relative;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
}

.info-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

.info-list li strong {
    color: var(--text);
}

/* Probability Table */
.prob-table {
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.prob-row {
    display: grid;
    grid-template-columns: 80px 1fr 140px;
    padding: 12px 16px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.prob-row:last-child {
    border-bottom: none;
}

.prob-header {
    background: var(--bg);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.rank {
    font-weight: 900;
    font-size: 0.95rem;
}

.rank-1 { color: #fdd835; }
.rank-2 { color: #42a5f5; }
.rank-3 { color: #ef5350; }
.rank-4 { color: #bdbdbd; }
.rank-5 { color: #9ccc65; }

.prob {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
}

/* FAQ */
.faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    padding: 16px 0;
    cursor: pointer;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    text-align: left;
    gap: 12px;
    transition: color 0.2s;
}

.faq-question:hover {
    color: var(--accent);
}

.faq-arrow {
    font-size: 1.4rem;
    color: var(--text-muted);
    transition: transform 0.3s;
    flex-shrink: 0;
}

.faq-item.open .faq-arrow {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.open .faq-answer {
    max-height: 500px;
    padding-bottom: 16px;
}

.faq-answer p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.8;
}

/* Tax Calculator */
.calc-box {
    background: var(--bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.calc-result {
    margin-top: 20px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--history-border);
}

.calc-row:last-child {
    border-bottom: none;
}

.calc-row strong {
    color: var(--text);
}

.calc-row .tax-amount {
    color: var(--accent);
}

.calc-row.total-row {
    border-top: 2px solid var(--accent);
    margin-top: 8px;
    padding-top: 14px;
    font-size: 1.1rem;
}

.calc-row.total-row strong {
    color: #4caf50;
    font-size: 1.2rem;
}

/* Ad Slots */
.ad-slot {
    margin: 20px 0;
    min-height: 50px;
    text-align: center;
    overflow: hidden;
    border-radius: 12px;
}

/* Contact Form */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: 'Noto Sans KR', sans-serif;
    transition: border-color 0.2s;
    resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), #c0392b);
    color: #fff;
    border: none;
    padding: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
    font-family: 'Noto Sans KR', sans-serif;
    margin-top: 8px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(233, 69, 96, 0.6);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.form-status {
    text-align: center;
    margin-top: 12px;
    font-size: 0.9rem;
}

.form-status.success { color: #4caf50; }
.form-status.error { color: var(--accent); }

/* Theme Button */
.theme-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.theme-btn:hover {
    border-color: var(--accent);
    transform: scale(1.1);
}

.theme-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* Footer */
.footer {
    margin-top: 40px;
    border-top: 1px solid var(--border);
    padding: 30px 16px;
    text-align: center;
}

.footer-inner {
    max-width: 720px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-copy {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.footer-disclaimer {
    font-size: 0.78rem;
    color: var(--text-muted);
    opacity: 0.7;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* Policy Pages */
.policy-page {
    padding-top: 30px;
}

.policy-page .section-title {
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 640px) {
    h1 { font-size: 1.8rem; }
    .ball { width: 44px; height: 44px; font-size: 1.1rem; }
    .lotto-display { padding: 20px 12px; }
    .controls { flex-direction: column; gap: 14px; }
    .prob-row { grid-template-columns: 60px 1fr 110px; font-size: 0.82rem; padding: 10px 12px; }
    .prob { font-size: 0.78rem; }

    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--nav-bg);
        backdrop-filter: blur(12px);
        flex-direction: column;
        padding: 16px 20px;
        gap: 14px;
        border-bottom: 1px solid var(--border);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: flex;
    }
}
