/* ===== CSS Variables ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --warm-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --cool-gradient: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    --dark-gradient: linear-gradient(135deg, #0c0c1e 0%, #1a1a3e 100%);
    --sri-lanka-gradient: linear-gradient(135deg, #8B4513 0%, #DAA520 50%, #228B22 100%);

    --bg-primary: #0a0a1a;
    --bg-secondary: rgba(255, 255, 255, 0.03);
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    --border-color: rgba(255, 255, 255, 0.1);
    --glow-purple: rgba(102, 126, 234, 0.5);
    --glow-pink: rgba(240, 147, 251, 0.5);
    --glow-gold: rgba(218, 165, 32, 0.5);

    --font-primary: 'Space Grotesk', sans-serif;
    --font-secondary: 'Inter', sans-serif;

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px var(--glow-purple);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-secondary);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ===== Loading Screen ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

.year-transition {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
}

.year-old,
.year-new {
    font-family: var(--font-primary);
    font-size: clamp(48px, 12vw, 100px);
    font-weight: 700;
    transition: all 0.5s ease;
}

.year-old {
    color: var(--text-muted);
    opacity: 0.5;
}

.year-old.fade-out {
    opacity: 0;
    transform: translateX(-20px);
}

.year-new {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 0.3;
}

.year-new.active {
    opacity: 1;
    animation: pulse-glow 1s ease-in-out;
}

@keyframes pulse-glow {

    0%,
    100% {
        text-shadow: 0 0 20px var(--glow-purple);
    }

    50% {
        text-shadow: 0 0 60px var(--glow-pink), 0 0 100px var(--glow-purple);
    }
}

.loading-bar {
    width: 200px;
    height: 6px;
    background: var(--bg-card);
    border-radius: 100px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: var(--primary-gradient);
    border-radius: 100px;
    transition: width 0.1s linear;
}

.loading-text {
    font-size: 16px;
    color: var(--text-muted);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* ===== Animated Background ===== */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--primary-gradient);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-gradient);
    top: 50%;
    right: -150px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: var(--warm-gradient);
    bottom: -100px;
    left: 30%;
    animation-delay: -14s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(50px, 50px) scale(1.1);
    }

    50% {
        transform: translate(-30px, 80px) scale(0.95);
    }

    75% {
        transform: translate(-60px, -30px) scale(1.05);
    }
}

/* ===== Confetti ===== */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: confetti-fall 4s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-100px) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.container.visible {
    opacity: 1;
}

/* ===== Hero Section ===== */
.hero {
    text-align: center;
    padding: 80px 0 100px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 8px 20px;
    border-radius: 100px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    backdrop-filter: blur(10px);
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.hero-title {
    font-family: var(--font-primary);
    margin-bottom: 24px;
}

.title-accent {
    display: block;
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.title-year {
    display: flex;
    justify-content: center;
    font-size: clamp(80px, 15vw, 180px);
    font-weight: 700;
    line-height: 1;
}

.digit {
    display: inline-block;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 0;
    transform: translateY(50px) scale(0.5);
    animation: digitReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.digit:nth-child(1) {
    animation-delay: 0.1s;
}

.digit:nth-child(2) {
    animation-delay: 0.2s;
}

.digit:nth-child(3) {
    animation-delay: 0.3s;
}

.digit:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes digitReveal {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.5) rotateX(-90deg);
    }

    60% {
        opacity: 1;
        transform: translateY(-10px) scale(1.1) rotateX(10deg);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0deg);
    }
}

.digit.counting {
    animation: countPulse 0.15s ease-in-out;
}

@keyframes countPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.title-year::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 4px;
    background: var(--primary-gradient);
    border-radius: 2px;
    animation: underlineGrow 1s 0.8s ease-out forwards;
}

@keyframes underlineGrow {
    to {
        width: 200px;
    }
}

@keyframes glow {
    from {
        filter: drop-shadow(0 0 30px var(--glow-purple));
    }

    to {
        filter: drop-shadow(0 0 60px var(--glow-pink)) drop-shadow(0 0 100px var(--glow-purple));
    }
}

.hero-subtitle {
    font-size: clamp(18px, 3vw, 24px);
    color: var(--text-secondary);
    margin-bottom: 60px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 16px;
    stroke: url(#icon-gradient);
    color: #667eea;
}

.stat-number {
    display: block;
    font-family: var(--font-primary);
    font-size: 42px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== Section Header ===== */
.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-header h2 {
    font-family: var(--font-primary);
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    margin-bottom: 16px;
    background: var(--cool-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.section-header p {
    font-size: 18px;
    color: var(--text-secondary);
}

/* ===== Fortune Section ===== */
.fortune-section {
    padding: 80px 0;
    text-align: center;
}

.fortune-card {
    position: relative;
    max-width: 600px;
    margin: 0 auto 40px;
    padding: 48px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.fortune-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--glow-purple) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0.2;
    transition: opacity 0.5s ease;
}

.fortune-card:hover .fortune-glow {
    opacity: 0.4;
}

.fortune-content {
    position: relative;
    z-index: 1;
}

.fortune-icon {
    margin-bottom: 24px;
}

.fortune-icon svg {
    width: 48px;
    height: 48px;
    stroke: #f5576c;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.2) rotate(10deg);
    }
}

.fortune-text {
    font-size: 20px;
    line-height: 1.8;
    color: var(--text-primary);
}

.magic-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--primary-gradient);
    border: none;
    padding: 16px 40px;
    border-radius: 100px;
    font-family: var(--font-primary);
    font-size: 18px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--glow-purple);
}

.magic-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 40px var(--glow-purple);
}

.magic-btn:active {
    transform: translateY(0) scale(0.98);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

/* ===== Resolution Section ===== */
.resolution-section {
    padding: 80px 0;
}

.resolution-display {
    max-width: 700px;
    margin: 0 auto 40px;
    padding: 48px 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    text-align: center;
    backdrop-filter: blur(20px);
}

.resolution-category {
    display: inline-block;
    background: var(--accent-gradient);
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 24px;
}

.resolution-text {
    font-family: var(--font-primary);
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 600;
    line-height: 1.4;
}

.resolution-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 48px;
}

.generate-btn,
.save-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    border-radius: 100px;
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.generate-btn {
    background: var(--warm-gradient);
    border: none;
    color: #1a1a1a;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(250, 112, 154, 0.4);
}

.save-btn {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.save-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-secondary);
}

.saved-resolutions {
    max-width: 600px;
    margin: 0 auto;
    display: none;
}

.saved-resolutions.has-items {
    display: block;
}

.saved-resolutions h3 {
    font-family: var(--font-primary);
    font-size: 24px;
    margin-bottom: 24px;
    text-align: center;
    color: var(--text-secondary);
}

#resolution-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#resolution-list li {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#resolution-list li::before {
    content: '';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary-gradient);
    border-radius: 50%;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 14px;
    background-repeat: no-repeat;
    background-position: center;
}

/* ===== Facts Section ===== */
.facts-section {
    padding: 80px 0;
}

.facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.fact-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.fact-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-8px);
    box-shadow: var(--shadow-glow);
}

.fact-icon {
    margin-bottom: 20px;
}

.fact-icon svg {
    width: 48px;
    height: 48px;
    stroke: #667eea;
}

.fact-card h3 {
    font-family: var(--font-primary);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.fact-card p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Celebration Section ===== */
.celebration-section {
    padding: 80px 0;
    text-align: center;
}

.celebrate-btn {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    background: var(--dark-gradient);
    border: 2px solid var(--border-color);
    padding: 24px 56px;
    border-radius: 100px;
    font-family: var(--font-primary);
    font-size: 24px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.celebrate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.celebrate-btn:hover::before {
    left: 100%;
}

.celebrate-btn:hover {
    border-color: var(--glow-pink);
    box-shadow: 0 0 40px var(--glow-pink);
    transform: scale(1.05);
}

.celebrate-btn:active {
    transform: scale(0.98);
}

.celebrate-icon {
    width: 28px;
    height: 28px;
    stroke: #fee140;
    animation: bounce 1s ease-in-out infinite;
}

.celebrate-icon:last-child {
    animation-delay: 0.5s;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.celebrate-hint {
    margin-top: 20px;
    font-size: 16px;
    color: var(--text-muted);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 60px 0 40px;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.footer p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.footer-sub {
    font-size: 14px;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }

    .hero {
        padding: 60px 0 80px;
    }

    .hero-stats {
        grid-template-columns: 1fr;
        max-width: 300px;
    }

    .stat-card {
        padding: 24px 20px;
    }

    .stat-number {
        font-size: 36px;
    }

    .fortune-card {
        padding: 32px 24px;
    }

    .resolution-display {
        padding: 32px 24px;
    }

    .resolution-controls {
        flex-direction: column;
        align-items: center;
    }

    .generate-btn,
    .save-btn {
        width: 100%;
        max-width: 300px;
    }

    .celebrate-btn {
        padding: 20px 40px;
        font-size: 20px;
    }

    .facts-grid {
        grid-template-columns: 1fr;
    }

    .year-transition {
        gap: 20px;
    }

    .loading-bar {
        width: 120px;
    }
}