/* ==========================================
   CSS Variables & Design System
   ========================================== */
:root {
    /* Colors - SkyCheonWon Theme */
    --primary: #00a8ff;
    /* Sky Blue */
    --primary-dark: #0097e6;
    --primary-light: #dff9fb;

    --secondary: #00d2d3;
    --secondary-dark: #01a3a4;

    --accent: #fbc531;
    /* Premium Gold */
    --accent-dark: #e1b12c;

    /* Ball Colors */
    --ball-yellow: #FFC107;
    --ball-yellow-dark: #FFA000;
    --ball-blue: #2196F3;
    --ball-blue-dark: #1976D2;
    --ball-red: #F44336;
    --ball-red-dark: #D32F2F;
    --ball-gray: #9E9E9E;
    --ball-gray-dark: #757575;
    --ball-green: #4CAF50;
    --ball-green-dark: #388E3C;

    /* Background & Surface */
    --bg-primary: #0F0F1A;
    --bg-secondary: #1A1A2E;
    --bg-tertiary: #16213E;
    --surface: rgba(255, 255, 255, 0.05);
    --surface-hover: rgba(255, 255, 255, 0.1);

    /* Text */
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    /* Glass effect */
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Font */
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #F8F9FA;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #E9ECEF;
    --surface: rgba(0, 0, 0, 0.03);
    --surface-hover: rgba(0, 0, 0, 0.06);

    --text-primary: #212529;
    --text-secondary: rgba(0, 0, 0, 0.7);
    --text-muted: rgba(0, 0, 0, 0.5);

    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at top left, rgba(0, 168, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(251, 197, 49, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ==========================================
   Utility Classes
   ========================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 10px 20px rgba(0, 168, 255, 0.2);
}

.sky-gradient {
    background: linear-gradient(180deg, #0a192f 0%, #112d4e 100%);
}

/* ==========================================
   Navigation
   ========================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--spacing-md) 0;
    background: rgba(10, 25, 47, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.8);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
    position: relative;
}

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

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--transition-normal);
}

.nav-links a:hover::after {
    width: 100%;
}

.theme-toggle {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--surface-hover);
    transform: scale(1.05);
}

.moon-icon {
    display: block;
}

.sun-icon {
    display: none;
}

[data-theme="light"] .moon-icon {
    display: none;
}

[data-theme="light"] .sun-icon {
    display: block;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.mobile-menu-btn span {
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    transition: all var(--transition-fast);
}

/* ==========================================
   Hero Section
   ========================================== */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 100px;
    position: relative;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-title {
    margin-bottom: var(--spacing-2xl);
}

.hero-title .gradient-text {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    display: block;
    margin-bottom: var(--spacing-sm);
}

.hero-title .subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.latest-draw {
    max-width: 700px;
    margin: 0 auto;
    padding: var(--spacing-2xl);
}

.draw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.draw-round {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.draw-date {
    color: var(--text-secondary);
}

/* ==========================================
   Lotto Balls
   ========================================== */
.winning-numbers {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-xl);
}

.ball,
.ball-placeholder {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 -3px 10px rgba(0, 0, 0, 0.2),
        inset 0 3px 10px rgba(255, 255, 255, 0.3);
    position: relative;
    animation: ballFloat 3s ease-in-out infinite;
}

.ball::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 12px;
    width: 15px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: rotate(-30deg);
}

.ball-placeholder {
    background: var(--surface);
    animation: pulse 1.5s ease-in-out infinite;
}

.ball.empty {
    background: var(--surface);
    color: var(--text-muted);
}

/* Ball Colors by Number Range */
.ball.yellow {
    background: linear-gradient(145deg, var(--ball-yellow) 0%, var(--ball-yellow-dark) 100%);
}

.ball.blue {
    background: linear-gradient(145deg, var(--ball-blue) 0%, var(--ball-blue-dark) 100%);
}

.ball.red {
    background: linear-gradient(145deg, var(--ball-red) 0%, var(--ball-red-dark) 100%);
}

.ball.gray {
    background: linear-gradient(145deg, var(--ball-gray) 0%, var(--ball-gray-dark) 100%);
}

.ball.green {
    background: linear-gradient(145deg, var(--ball-green) 0%, var(--ball-green-dark) 100%);
}

.bonus-separator {
    font-size: 2rem;
    color: var(--text-muted);
    font-weight: 300;
}

.ball.bonus {
    position: relative;
}

.ball.bonus::after {
    content: 'B';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
}

.winning-numbers.small .ball {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.winning-numbers.small .ball::before {
    width: 10px;
    height: 5px;
    top: 5px;
    left: 8px;
}

/* Ball Animation */
@keyframes ballFloat {

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

    50% {
        transform: translateY(-5px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 0.3;
    }
}

@keyframes ballSpin {
    0% {
        transform: rotateY(0deg) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: rotateY(180deg) scale(1.2);
    }

    100% {
        transform: rotateY(360deg) scale(1);
        opacity: 1;
    }
}

.ball.animate {
    animation: ballSpin 0.6s ease-out forwards;
}

/* Prize Info */
.prize-info {
    display: flex;
    justify-content: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--glass-border);
}

.prize-item {
    text-align: center;
}

.prize-rank {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.prize-amount {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: var(--spacing-xs);
}

.prize-winners {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Floating Balls Background */
.floating-balls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.floating-ball {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    opacity: 0.15;
    animation: floatAround 20s ease-in-out infinite;
}

.floating-ball.ball-1 {
    top: 10%;
    left: 5%;
    background: var(--ball-yellow);
    animation-delay: 0s;
}

.floating-ball.ball-2 {
    top: 60%;
    left: 10%;
    background: var(--ball-blue);
    animation-delay: -4s;
}

.floating-ball.ball-3 {
    top: 20%;
    right: 10%;
    background: var(--ball-red);
    animation-delay: -8s;
}

.floating-ball.ball-4 {
    top: 70%;
    right: 5%;
    background: var(--ball-gray);
    animation-delay: -12s;
}

.floating-ball.ball-5 {
    bottom: 10%;
    left: 50%;
    background: var(--ball-green);
    animation-delay: -16s;
}

@keyframes floatAround {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(30px, -30px) rotate(90deg);
    }

    50% {
        transform: translate(-20px, 20px) rotate(180deg);
    }

    75% {
        transform: translate(20px, 30px) rotate(270deg);
    }
}

/* ==========================================
   Sections
   ========================================== */
.section {
    padding: var(--spacing-3xl) 0;
}

.section-alt {
    background: var(--bg-secondary);
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--spacing-sm);
}

.section-desc {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-2xl);
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.5);
}

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

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-outline:hover {
    background: var(--surface);
}

.btn-outline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-large {
    padding: var(--spacing-lg) var(--spacing-2xl);
    font-size: 1.125rem;
}




/* ==========================================
   Statistics Section (Machine Redesign)
   ========================================== */
.stats-machine-container {
    display: flex;
    gap: var(--spacing-2xl);
    padding: var(--spacing-2xl);
    align-items: center;
    min-height: 500px;
}

.lotto-machine-area {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
    padding: var(--spacing-xl) 0;
}

.glass-sphere {
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
            rgba(255, 255, 255, 0.15) 0%,
            rgba(255, 255, 255, 0.05) 50%,
            rgba(0, 0, 0, 0.1) 100%);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    box-shadow:
        inset 0 0 20px rgba(255, 255, 255, 0.1),
        0 20px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.sphere-exit-hole {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 5;
}

.exit-tube {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 45px;
    background: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    z-index: 4;
}

.sphere-reflection {
    position: absolute;
    top: 15%;
    left: 15%;
    width: 25%;
    height: 25%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(5px);
}

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



.stats-result-area {
    flex: 1.2;
}

.stats-result-area h3 {
    margin-bottom: var(--spacing-xl);
    font-size: 1.5rem;
    font-weight: 700;
}

.element-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.element-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform var(--transition-base);
}

.element-item:hover {
    transform: translateX(10px);
    background: rgba(255, 255, 255, 0.05);
}

.element-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.element-icon {
    font-size: 1.5rem;
}

.element-name {
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 60px;
}

.element-numbers-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
    max-width: 350px;
    justify-content: flex-end;
}

.number-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.small-ball {
    font-size: 0.7rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.small-ball.ball-yellow {
    background: var(--ball-yellow);
}

.small-ball.ball-blue {
    background: var(--ball-blue);
}

.small-ball.ball-red {
    background: var(--ball-red);
}

.small-ball.ball-gray {
    background: var(--ball-gray);
}

.small-ball.ball-green {
    background: var(--ball-green);
}

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

.element-body {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

/* Element Specific Colors */
.element-item.water .freq-bar {
    background: linear-gradient(to right, #3498db, #2980b9);
}

.element-item.fire .freq-bar {
    background: linear-gradient(to right, #e74c3c, #c0392b);
}

.element-item.wood .freq-bar {
    background: linear-gradient(to right, #2ecc71, #27ae60);
}

.element-item.metal .freq-bar {
    background: linear-gradient(to right, #95a5a6, #7f8c8d);
}

.element-item.earth .freq-bar {
    background: linear-gradient(to right, #f1c40f, #f39c12);
}

.freq-bar-container {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-pill);
    overflow: hidden;
    position: relative;
}

.freq-bar {
    height: 100%;
    border-radius: var(--radius-pill);
    width: 0;
    transition: width 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.freq-info {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 50px;
    text-align: right;
    white-space: nowrap;
}

/* Animations */
.machine-ball {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    /* Start positions and animations will be set by JS or generic ones here */
}

@keyframes bounceBallStable {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, -20px) rotate(120deg);
    }

    66% {
        transform: translate(-25px, 25px) rotate(240deg);
    }

    100% {
        transform: translate(15px, -15px) rotate(360deg);
    }
}

@keyframes bounceBall {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(60px, -40px) rotate(90deg);
    }

    50% {
        transform: translate(-50px, 80px) rotate(180deg);
    }

    75% {
        transform: translate(40px, -70px) rotate(270deg);
    }

    100% {
        transform: translate(0, 0) rotate(360deg);
    }
}

.ejecting-ball {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 10;
    transition: none;
    /* Override ball transition */
    animation: ejectBall 1.5s cubic-bezier(0.1, 0.7, 0.1, 1) forwards;
}

@keyframes ejectBall {
    0% {
        transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
        opacity: 0;
    }

    20% {
        transform: translate(-50%, -50%) scale(1.1) rotate(45deg);
        opacity: 1;
    }

    50% {
        transform: translate(calc(-50% + var(--eject-x-offset, 0px)), -250px) scale(1) rotate(180deg);
        opacity: 1;
    }

    100% {
        transform: translate(calc(-50% + var(--eject-x-offset, 0px) * 2), -150px) scale(0.8) rotate(360deg);
        opacity: 0;
    }
}




/* ==========================================
   Footer
   ========================================== */
.footer {
    background: var(--bg-tertiary);
    padding: var(--spacing-2xl) 0;
    text-align: center;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: var(--spacing-md);
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-md);
    line-height: 1.8;
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ==========================================
   Loading Overlay
   ========================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 26, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
}

.spinner-ball {
    font-size: 4rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.loading-spinner p {
    margin-top: var(--spacing-md);
    color: var(--text-secondary);
}

/* ==========================================
   Toast Notifications
   ========================================== */
.toast-container {
    position: fixed;
    bottom: var(--spacing-xl);
    right: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    z-index: 9999;
}

.toast {
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    animation: slideIn 0.3s ease-out;
    max-width: 350px;
}

.toast.success {
    border-color: var(--ball-green);
}

.toast.error {
    border-color: var(--ball-red);
}

.toast.info {
    border-color: var(--primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        flex-direction: column;
        padding: var(--spacing-lg);
        gap: var(--spacing-md);
        border-bottom: 1px solid var(--glass-border);
    }

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

    .mobile-menu-btn {
        display: flex;
    }

    .hero-title .gradient-text {
        font-size: 2.5rem;
    }

    .ball,
    .ball-placeholder {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .floating-balls {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .frequency-chart {
        grid-template-columns: repeat(9, 1fr);
    }

    .freq-bar-container {
        height: 60px;
    }


}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-md);
    }

    .glass-card {
        padding: var(--spacing-lg);
    }

    .hero-title .gradient-text {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .ball,
    .ball-placeholder {
        width: 44px;
        height: 44px;
        font-size: 1.125rem;
    }


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

/* ==========================================
   Accessibility
   ========================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    z-index: 10000;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
}


/* Frequency Chart Styles */
.frequency-chart {
    display: flex;
    align-items: flex-end;
    height: 180px;
    gap: 4px;
    margin-top: var(--spacing-lg);
    overflow-x: auto;
    padding-bottom: 20px;
}

.freq-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    min-width: 15px;
}

.freq-bar {
    width: 100%;
    background: linear-gradient(to top, var(--primary), var(--secondary));
    border-radius: 4px 4px 0 0;
    transition: height 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 4px;
}

.freq-num {
    font-size: 0.7rem;
    margin-top: 6px;
    color: var(--text-muted);
}

/* ==========================================
   Countdown Timer Styles
   ========================================== */
.countdown-banner {
    max-width: 800px;
    margin: 0 auto var(--spacing-xl);
    padding: var(--spacing-lg) var(--spacing-2xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    border: 1px solid rgba(0, 168, 255, 0.3);
    background: rgba(10, 25, 47, 0.4);
    box-shadow: 0 0 20px rgba(0, 168, 255, 0.15);
}

.countdown-label {
    flex: 1;
    min-width: 200px;
}

.next-round-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
}

.countdown-timer {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.timer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.timer-item span {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    text-shadow: 0 2px 10px rgba(251, 197, 49, 0.3);
}

.timer-item small {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-top: 4px;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .countdown-banner {
        flex-direction: column;
        text-align: center;
        padding: var(--spacing-md);
    }

    .countdown-timer {
        gap: var(--spacing-md);
    }

    .timer-item span {
        font-size: 1.5rem;
    }
}

/* ==========================================
   Restructured Hero & Dual Prediction
   ========================================== */
.main-branding {
    margin-bottom: var(--spacing-xl);
}

.main-branding .gradient-text {
    font-size: clamp(3rem, 8vw, 5rem);
    text-shadow: 0 10px 30px rgba(0, 168, 255, 0.3);
}

/* ==========================================
   Integrated Personal Fortune Section
   ========================================== */
.personal-fortune-container {
    max-width: 900px;
    margin: var(--spacing-xl) auto 0;
    padding: var(--spacing-lg) var(--spacing-xl);
    text-align: center;
    border: 1px solid rgba(0, 168, 255, 0.2);
}

.fortune-header {
    margin-bottom: var(--spacing-md);
}

.fortune-header h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: var(--spacing-sm) 0;
}

.fortune-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    text-align: left;
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding-left: 4px;
}

.form-input {
    background: #ffffff;
    border: 2px solid var(--primary);
    color: #000000;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    transition: all var(--transition-fast);
}

.form-input:focus {
    border-color: var(--secondary);
    background: #ffffff;
    box-shadow: 0 0 15px rgba(0, 168, 255, 0.2);
}

.fortune-result-area {
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.fortune-analysis {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: var(--spacing-md) 0 var(--spacing-xl);
}

.btn-prediction {
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 30px;
    box-shadow: 0 10px 20px rgba(0, 168, 255, 0.2);
}

@media (max-width: 768px) {
    .fortune-form-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   Fortune Animation Effects
   ========================================== */
@keyframes bounce-random {

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

    30% {
        transform: translateY(-40px) scale(1.1) rotate(5deg);
    }

    50% {
        transform: translateY(0) scale(0.9) rotate(-3deg);
    }

    70% {
        transform: translateY(-20px) scale(1.05) rotate(2deg);
    }
}

.ball.bouncing {
    animation: bounce-random 0.6s infinite ease-in-out;
}

.ball.pop-in {
    animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pop-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes shake-gentle {

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

    25% {
        transform: translateX(-2px) rotate(-1deg);
    }

    75% {
        transform: translateX(2px) rotate(1deg);
    }
}

.fortune-result-area.processing {
    animation: shake-gentle 0.5s infinite;
}

.recommendation-numbers {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
    min-height: 60px;
    padding: var(--spacing-md) 0;
}

@media (max-width: 480px) {
    .recommendation-numbers {
        gap: var(--spacing-sm);
    }

    .recommendation-numbers .ball,
    .recommendation-numbers .ball-placeholder {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ==========================================
   AI Fortune Message Effects
   ========================================== */
.ai-fortune-message {
    background: rgba(0, 168, 255, 0.05);
    border-left: 4px solid var(--accent);
    padding: var(--spacing-md) var(--spacing-lg);
    margin: var(--spacing-lg) 0;
    border-radius: 4px 12px 12px 4px;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    text-align: left;
    animation: slide-in-up 0.8s ease-out;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-height: 60px;
}

.ai-sparkle {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px var(--accent));
    flex-shrink: 0;
}

.message-content {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
    font-style: italic;
    font-weight: 500;
}

@keyframes slide-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Saju Analysis Result Styles */
.saju-result-card {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-lg);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 168, 255, 0.1);
    text-align: left;
    animation: slide-in-up 0.8s ease-out;
    border-radius: var(--radius-lg);
}

/* --- Traditional Korean Design System (Saju Overhaul) --- */
:root {
    --color-wood: #2e7d32;
    /* Green */
    --color-fire: #c62828;
    /* Red */
    --color-earth: #fbc02d;
    /* Yellow */
    --color-metal: #eeeeee;
    /* White/Silver */
    --color-water: #1a237e;
    /* Black/Indigo */
    --color-trad-gold: #c5a059;
    --color-trad-border: #8d6e63;
}

/* Toggle Groups */
.gender-toggle-group,
.calendar-toggle-group {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.gender-btn,
.calendar-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.gender-btn.active,
.calendar-btn.active {
    background: var(--color-trad-gold) !important;
    color: #fff !important;
    border-color: var(--color-trad-gold);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(197, 160, 89, 0.4);
    transform: translateY(-1px);
}

/* Traditional Saju Card */
.saju-result-card.traditional-style {
    background: #fdfaf5;
    /* Ivory / Traditional paper feel */
    color: #333;
    border: 2px solid var(--color-trad-gold);
    border-radius: 12px;
    padding: 30px 20px;
    position: relative;
    overflow: hidden;
    margin-top: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.dark-mode .saju-result-card.traditional-style {
    background: #1a1a1a;
    color: #eee;
}

.traditional-border-top,
.traditional-border-bottom {
    position: absolute;
    left: 0;
    right: 0;
    height: 12px;
    background-image: radial-gradient(circle, var(--color-trad-gold) 2px, transparent 2px);
    background-size: 10px 10px;
}

.traditional-border-top {
    top: 0;
    border-bottom: 2px solid var(--color-trad-gold);
}

.traditional-border-bottom {
    bottom: 0;
    border-top: 2px solid var(--color-trad-gold);
}

.saju-personalized-intro {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1rem;
    color: #5d4037;
    font-weight: 500;
    position: relative;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(141, 110, 99, 0.2);
}

.user-name-tag {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--color-trad-border);
    margin-right: 4px;
}

.traditional-seal {
    position: absolute;
    right: 10px;
    top: -10px;
    width: 60px;
    height: 60px;
    border: 3px solid #c62828;
    color: #c62828;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'serif';
    font-weight: 900;
    font-size: 0.9rem;
    line-height: 1.1;
    transform: rotate(-15deg);
    border-radius: 4px;
    opacity: 0.8;
    background: rgba(198, 40, 40, 0.05);
    pointer-events: none;
    user-select: none;
}

.saju-main-analysis {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.analysis-section {
    background: rgba(0, 0, 0, 0.02);
    border-left: 4px solid var(--color-trad-gold);
    padding: 15px 20px;
    border-radius: 0 8px 8px 0;
    transition: transform 0.3s ease;
}

.dark-mode .analysis-section {
    background: rgba(255, 255, 255, 0.03);
}

.analysis-section:hover {
    transform: translateX(5px);
}

.section-label {
    font-weight: 700;
    color: var(--color-trad-border);
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dark-mode .section-label {
    color: var(--color-trad-gold);
}

.section-content {
    line-height: 1.6;
    font-size: 0.98rem;
    color: #444;
}

.dark-mode .section-content {
    color: #ccc;
}

.saju-text-ai {
    line-height: 1.7;
    font-size: 1rem;
    white-space: pre-wrap;
}

.lotto-resonance-box {
    background: linear-gradient(135deg, #fff5e6 0%, #ffebcc 100%);
    border: 1px dashed var(--color-trad-gold);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.dark-mode .lotto-resonance-box {
    background: linear-gradient(135deg, #2c1f0a 0%, #1a1205 100%);
}

.resonance-header {
    font-weight: 700;
    color: #5d4037;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dark-mode .resonance-header {
    color: var(--color-trad-gold);
}

.resonance-content {
    font-size: 0.95rem;
    color: #333;
}

.dark-mode .resonance-content {
    color: #ccc;
}

.saju-report-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.saju-integration-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    margin-top: var(--spacing-sm);
}

.saju-pillars-container {
    display: flex;
    gap: 6px;
}

.saju-pillar-unit {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Element Colors */
.wood,
.element-badge.wood {
    background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
}

.fire,
.element-badge.fire {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
}

.earth,
.element-badge.earth {
    background: linear-gradient(135deg, #f1c40f, #f39c12) !important;
}

.metal,
.element-badge.metal {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d) !important;
}

.water,
.element-badge.water {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
}

.element-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
}

.saju-elements {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.saju-unified-report {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    text-align: left;
}

.saju-report-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.saju-ai-resonance {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: var(--spacing-sm) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.saju-ai-resonance .sparkle-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}



/* Sequential Prediction Step Styles */
.prediction-steps {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 30px;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.step-item {
    flex: 1;
    font-size: 0.75rem;
    padding: 8px 4px;
    text-align: center;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    border: 1px solid transparent;
}

.step-item.active {
    color: var(--accent);
    background: rgba(251, 197, 49, 0.1);
    border-color: rgba(251, 197, 49, 0.3);
    font-weight: 700;
    transform: translateY(-2px);
}

.step-item.completed {
    color: var(--secondary);
    background: rgba(0, 210, 211, 0.05);
}

.step-status-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    font-weight: 500;
    min-height: 1.5em;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}
/* Lottie Animation Containers */
.lottie-container-loading {
    width: 200px;
    height: 200px;
    margin: 20px auto;
}

.lottie-container-success {
    width: 150px;
    height: 150px;
    margin: 10px auto;
}

.lotto-discovery-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}
