/* ===== Design Tokens ===== */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --text-primary: #e8e8f0;
    --text-secondary: #8888aa;
    --text-muted: #555577;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-1: #667eea;
    --accent-2: #764ba2;
    --gold: #f6d365;
    --gold-gradient: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-subtle: rgba(255, 255, 255, 0.04);
    --border-color-input: rgba(255, 255, 255, 0.1);
    --separator-color: rgba(255, 255, 255, 0.08);
    --separator-dashed: rgba(255, 255, 255, 0.1);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.15);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Noto Sans KR', sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Light Mode ===== */
[data-theme="light"] {
    --bg-primary: #f0f2f8;
    --bg-secondary: #e4e7f0;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --text-primary: #1a1a2e;
    --text-secondary: #555577;
    --text-muted: #8888aa;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-subtle: rgba(0, 0, 0, 0.05);
    --border-color-input: rgba(0, 0, 0, 0.12);
    --separator-color: rgba(0, 0, 0, 0.08);
    --separator-dashed: rgba(0, 0, 0, 0.12);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    transition: background 0.4s ease, color 0.4s ease;
}

/* ===== Particles Background ===== */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-1);
    opacity: 0;
    animation: floatParticle 8s infinite;
}

@keyframes floatParticle {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }

    10% {
        opacity: 0.6;
    }

    90% {
        opacity: 0.2;
    }

    100% {
        opacity: 0;
        transform: translateY(-20vh) scale(1.5);
    }
}

/* ===== Container ===== */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 48px;
    position: relative;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    font-size: 1.3rem;
    transition: transform 0.4s ease;
    display: block;
    line-height: 1;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(30deg);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 40px;
    filter: drop-shadow(0 0 12px rgba(102, 126, 234, 0.5));
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.logo h1 {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 2.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.08em;
}

/* ===== Ball Stage ===== */
.ball-stage {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 48px 32px 32px;
    margin-bottom: 32px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.ball-stage::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-1), transparent);
    opacity: 0.5;
}

.ball-container {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.placeholder-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.placeholder-icon {
    font-size: 2rem;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {

    0%,
    100% {
        opacity: 0.4;
        transform: rotate(0deg) scale(1);
    }

    50% {
        opacity: 1;
        transform: rotate(15deg) scale(1.2);
    }
}

/* ===== Lotto Balls ===== */
.lotto-ball {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.4rem;
    color: #fff;
    position: relative;
    cursor: default;
    animation: ballDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    transform: translateY(-60px) scale(0.3);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 -4px 8px rgba(0, 0, 0, 0.2),
        inset 0 4px 8px rgba(255, 255, 255, 0.2);
    transition: transform 0.2s ease;
}

.lotto-ball:hover {
    transform: scale(1.15) !important;
}

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

@keyframes ballDrop {
    0% {
        opacity: 0;
        transform: translateY(-60px) scale(0.3) rotate(-180deg);
    }

    60% {
        opacity: 1;
        transform: translateY(8px) scale(1.05) rotate(10deg);
    }

    80% {
        transform: translateY(-4px) scale(0.97) rotate(-5deg);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

/* Ball Color Groups (Korean Lotto standard) */
.ball-1-10 {
    background: linear-gradient(145deg, #fbc531, #e1b12c);
    color: #333;
}

.ball-11-20 {
    background: linear-gradient(145deg, #48dbfb, #0abde3);
}

.ball-21-30 {
    background: linear-gradient(145deg, #ff6b6b, #ee5a24);
}

.ball-31-40 {
    background: linear-gradient(145deg, #a29bfe, #6c5ce7);
}

.ball-41-45 {
    background: linear-gradient(145deg, #55efc4, #00b894);
}

/* ===== Bonus Section ===== */
.bonus-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--separator-dashed);
}

.bonus-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    background: rgba(246, 211, 101, 0.1);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(246, 211, 101, 0.2);
}

.bonus-ball {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
    color: #fff;
    position: relative;
    animation: ballDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 -4px 8px rgba(0, 0, 0, 0.2),
        inset 0 4px 8px rgba(255, 255, 255, 0.2),
        0 0 20px rgba(246, 211, 101, 0.3);
}

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

/* ===== Set Separator ===== */
.set-separator {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 16px;
}

.set-separator::before,
.set-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--separator-color);
}

.set-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.set-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* ===== Action Area ===== */
.action-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.generate-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 48px;
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition);
    box-shadow: 0 4px 24px rgba(102, 126, 234, 0.35);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.5);
}

.generate-btn:active {
    transform: translateY(0) scale(0.97);
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.generate-btn:hover .btn-shine {
    left: 120%;
}

.options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.set-input {
    width: 52px;
    padding: 6px 10px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color-input);
    border-radius: var(--radius-sm);
    text-align: center;
    outline: none;
    transition: border-color var(--transition);
}

.set-input:focus {
    border-color: var(--accent-1);
}

/* ===== History Section ===== */
.history-section {
    margin-bottom: 40px;
}

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

.history-header h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
}

.clear-btn {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition);
}

.clear-btn:hover {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.3);
    background: rgba(255, 107, 107, 0.05);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color-subtle);
    border-radius: var(--radius-md);
    transition: background var(--transition);
    animation: fadeIn 0.4s ease;
}

.history-item:hover {
    background: var(--bg-card-hover);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 50px;
}

.history-balls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.history-ball {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.7rem;
    color: #fff;
    box-shadow:
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.history-ball.ball-1-10 {
    background: linear-gradient(145deg, #fbc531, #e1b12c);
    color: #333;
}

.history-ball.ball-11-20 {
    background: linear-gradient(145deg, #48dbfb, #0abde3);
}

.history-ball.ball-21-30 {
    background: linear-gradient(145deg, #ff6b6b, #ee5a24);
}

.history-ball.ball-31-40 {
    background: linear-gradient(145deg, #a29bfe, #6c5ce7);
}

.history-ball.ball-41-45 {
    background: linear-gradient(145deg, #55efc4, #00b894);
}

.history-bonus {
    font-size: 0.75rem;
    color: var(--gold);
    font-weight: 600;
}

/* ===== Stats Section ===== */
.stats-section {
    margin-bottom: 40px;
}

.stats-section h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 6px;
}

.stat-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color-subtle);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.stat-cell:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.stat-number {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.stat-count {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ===== Contact Section ===== */
.contact-section {
    margin-bottom: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.contact-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
    opacity: 0.5;
}

.contact-section h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.contact-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.form-group input,
.form-group textarea {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color-input);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    resize: vertical;
}

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

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.submit-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition);
    box-shadow: 0 4px 20px rgba(118, 75, 162, 0.3);
    margin-top: 8px;
    align-self: flex-start;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(118, 75, 162, 0.45);
}

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

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

.form-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px;
    animation: fadeIn 0.5s ease;
}

.success-icon {
    font-size: 2.5rem;
}

.form-success p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ===== Comments Section ===== */
.comments-section {
    margin-bottom: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.comments-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #48dbfb, transparent);
    opacity: 0.5;
}

.comments-section h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

#disqus_thread {
    min-height: 100px;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.8rem;
    position: relative;
    z-index: 1;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .container {
        padding: 24px 16px;
    }

    .logo h1 {
        font-size: 1.8rem;
    }

    .ball-stage {
        padding: 32px 20px 24px;
    }

    .lotto-ball {
        width: 52px;
        height: 52px;
        font-size: 1.15rem;
    }

    .ball-container {
        gap: 10px;
    }

    .generate-btn {
        padding: 14px 36px;
        font-size: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .contact-section {
        padding: 28px 20px;
    }

    .submit-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===== Confetti Animation ===== */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 100;
    pointer-events: none;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotateZ(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotateZ(720deg);
        opacity: 0;
    }
}

/* ===== Shake Animation ===== */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10% {
        transform: translateX(-8px) rotate(-1deg);
    }

    30% {
        transform: translateX(6px) rotate(1deg);
    }

    50% {
        transform: translateX(-6px) rotate(-0.5deg);
    }

    70% {
        transform: translateX(4px) rotate(0.5deg);
    }

    90% {
        transform: translateX(-2px);
    }
}