/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Constellation canvas */
#constellation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100; /* Below start-screen */
    background: var(--bg-color);
    opacity: 0; /* Hidden until animation starts */
}

/* Background stars canvas */
#background-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
}

:root {
    --bg-color: #0A0A0A;
    --main-green: #38b557;
    --bright-green: #39FF14;
    --neon-green: #00FF00;
    --white: #FFFFFF;
}

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    background-color: var(--bg-color);
    color: var(--white);
    min-height: 100vh;
    overflow: hidden;
}

/* Main container */
#app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Top left logo */
#top-left-logo {
    position: absolute;
    top: 30px;
    left: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 50;
    opacity: 0;
}

#top-left-logo .checkmark-icon {
    width: 32px;
    height: 32px;
}

#top-left-logo span {
    font-size: 18px;
    font-weight: 600;
    color: var(--white);
}

/* Main content area */
#main-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0; /* Hidden until animation starts */
}

/* Center group - logo + circle wrapper */
#center-group {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 400px;
    height: 400px;
}

/* Particles container */
#particles-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 10;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--main-green);
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 6px var(--main-green), 0 0 10px var(--bright-green);
}

/* Swirl lines container - positioned inside center-group */
#swirl-lines-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 20;
    pointer-events: none;
}

.swirl-line {
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
    opacity: 0;
    top: 50%;
    left: 50%;
}

.swirl-1 {
    width: 380px;
    height: 380px;
    margin-left: -190px;
    margin-top: -190px;
    border-color: var(--main-green);
    border-top-color: transparent;
    border-left-color: transparent;
    box-shadow: 0 0 20px var(--main-green), inset 0 0 20px rgba(56, 181, 87, 0.1);
}

.swirl-2 {
    width: 320px;
    height: 320px;
    margin-left: -160px;
    margin-top: -160px;
    border-color: var(--bright-green);
    border-bottom-color: transparent;
    border-right-color: transparent;
    box-shadow: 0 0 15px var(--bright-green), inset 0 0 15px rgba(57, 255, 20, 0.1);
}

/* Speed lines for burst effect */
#speed-lines-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 15;
    pointer-events: none;
}

.speed-line {
    position: absolute;
    width: 2px;
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--bright-green), transparent);
    opacity: 0;
    transform-origin: center bottom;
}

/* Main logo wrapper - centered inside center-group */
#main-logo-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    opacity: 0;
}

.main-ckpro-logo {
    width: 200px;
    height: 200px;
    filter: drop-shadow(0 0 20px rgba(56, 181, 87, 0.3));
    transition: filter 0.1s ease;
    position: relative;
    z-index: 2;
}

/* Energy core - glowing sphere behind logo */
#energy-core {
    position: absolute;
    width: 180px;
    height: 180px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle,
        rgba(57, 255, 20, 0.4) 0%,
        rgba(56, 181, 87, 0.2) 40%,
        transparent 70%);
    border-radius: 50%;
    z-index: 1;
    opacity: 0;
}

/* Orbiting particles container */
#orbit-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 25;
    pointer-events: none;
}

.orbit-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--bright-green);
    border-radius: 50%;
    box-shadow:
        0 0 10px var(--bright-green),
        0 0 20px var(--main-green),
        0 0 30px var(--bright-green);
    opacity: 0;
}

.orbit-particle::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 3px;
    background: linear-gradient(to left, var(--bright-green), transparent);
    top: 50%;
    right: 100%;
    transform: translateY(-50%);
    opacity: 0.6;
}

/* Glow rings - smooth gradient rings around logo */
.glow-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    opacity: 0;
    z-index: 22;
    pointer-events: none;
    background: transparent;
}

.ring-1 {
    width: 240px;
    height: 240px;
    border: 3px solid transparent;
    background:
        linear-gradient(var(--bg-color), var(--bg-color)) padding-box,
        linear-gradient(135deg, var(--main-green) 0%, rgba(57, 255, 20, 0.8) 50%, var(--main-green) 100%) border-box;
    box-shadow:
        0 0 20px rgba(56, 181, 87, 0.5),
        0 0 40px rgba(56, 181, 87, 0.2),
        inset 0 0 20px rgba(56, 181, 87, 0.1);
    filter: blur(0.5px);
}

.ring-2 {
    width: 300px;
    height: 300px;
    border: 2px solid transparent;
    background:
        linear-gradient(var(--bg-color), var(--bg-color)) padding-box,
        linear-gradient(225deg, rgba(57, 255, 20, 0.6) 0%, var(--main-green) 50%, rgba(57, 255, 20, 0.6) 100%) border-box;
    box-shadow:
        0 0 25px rgba(57, 255, 20, 0.4),
        0 0 50px rgba(56, 181, 87, 0.15);
    filter: blur(0.3px);
}

.ring-3 {
    width: 360px;
    height: 360px;
    border: 2px solid transparent;
    background:
        linear-gradient(var(--bg-color), var(--bg-color)) padding-box,
        linear-gradient(315deg, var(--main-green) 0%, rgba(57, 255, 20, 0.4) 50%, var(--main-green) 100%) border-box;
    box-shadow:
        0 0 30px rgba(56, 181, 87, 0.3),
        0 0 60px rgba(56, 181, 87, 0.1);
    filter: blur(0.2px);
}

/* Lightning sparks */
#sparks-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 3;
}

.spark {
    position: absolute;
    width: 2px;
    height: 15px;
    background: linear-gradient(to bottom, var(--neon-green), transparent);
    opacity: 0;
    filter: blur(0.5px);
}

/* Text content */
#text-top {
    position: relative;
    z-index: 40;
    text-align: center;
    margin-top: 40px;
    opacity: 0;
}

.text-ra-mat {
    font-size: 28px;
    font-weight: 600;
    color: var(--white);
    margin-right: 15px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.text-ckpro {
    font-size: 42px;
    font-weight: 800;
    color: var(--white);
    text-shadow:
        0 0 10px rgba(56, 181, 87, 0.5),
        0 0 30px rgba(56, 181, 87, 0.3);
    animation: textGlow 2s ease-in-out infinite;
}

@keyframes textGlow {
    0%, 100% {
        text-shadow:
            0 0 10px rgba(56, 181, 87, 0.5),
            0 0 30px rgba(56, 181, 87, 0.3);
    }
    50% {
        text-shadow:
            0 0 15px rgba(57, 255, 20, 0.6),
            0 0 40px rgba(56, 181, 87, 0.4);
    }
}

#text-bottom {
    position: relative;
    z-index: 40;
    text-align: center;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    opacity: 0;
}

.text-line1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--white);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.text-line2 {
    font-size: 32px;
    font-weight: 800;
    color: var(--white);
    position: relative;
    display: inline-block;
}

/* Luồng sáng chạy quanh chữ */
.text-line2::before {
    content: 'CHỨNG KHOÁN THÔNG MINH';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(57, 255, 20, 0.4) 45%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(57, 255, 20, 0.4) 55%,
        transparent 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: lightSweep 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes lightSweep {
    0% {
        background-position: -100% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* CTA Button */
#cta-button {
    position: relative;
    z-index: 40;
    margin-top: 30px;
    padding: 14px 32px;
    font-size: 18px;
    font-weight: 700;
    font-family: 'Be Vietnam Pro', sans-serif;
    color: var(--white);
    background: linear-gradient(135deg, var(--main-green) 0%, #2d9648 100%);
    border: 2px solid var(--bright-green);
    border-radius: 50px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    cursor: pointer;
    overflow: hidden;
    box-shadow:
        0 0 20px rgba(56, 181, 87, 0.4),
        0 0 40px rgba(56, 181, 87, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

#cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

#cta-button:hover::before {
    left: 100%;
}

#cta-button:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow:
        0 0 30px rgba(57, 255, 20, 0.6),
        0 0 60px rgba(56, 181, 87, 0.4),
        0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--neon-green);
    background: linear-gradient(135deg, #3fc462 0%, var(--main-green) 100%);
}

#cta-button .btn-icon {
    width: 22px;
    height: 22px;
    stroke: var(--white);
    stroke-width: 2;
    transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
}

#cta-button .btn-text {
    transition: all 0.3s ease;
}

#cta-button.transformed .btn-icon {
    opacity: 0;
    transform: scale(0);
    width: 0;
    height: 0;
    overflow: hidden;
}

#cta-button.transformed {
    padding: 16px 40px;
    animation: buttonPulse 2s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(56, 181, 87, 0.4),
            0 0 40px rgba(56, 181, 87, 0.2);
    }
    50% {
        box-shadow:
            0 0 30px rgba(57, 255, 20, 0.6),
            0 0 60px rgba(56, 181, 87, 0.4),
            0 0 80px rgba(57, 255, 20, 0.2);
    }
}

/* Flash overlay */
#flash-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 100;
    pointer-events: none;
    background: radial-gradient(circle at center, var(--bright-green), var(--main-green), transparent 70%);
    opacity: 0;
    transform: scale(0);
}

/* Replay button */
#replay-btn {
    position: absolute;
    bottom: 30px;
    right: 30px;
    padding: 12px 24px;
    background: var(--main-green);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    z-index: 200;
    opacity: 0;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#replay-btn:hover {
    background: var(--bright-green);
    transform: scale(1.05);
}

/* Audio toggle button */
#audio-toggle {
    position: absolute;
    bottom: 30px;
    left: 30px;
    padding: 12px;
    background: rgba(56, 181, 87, 0.2);
    border: 2px solid var(--main-green);
    border-radius: 50%;
    cursor: pointer;
    z-index: 200;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#audio-toggle:hover {
    background: var(--main-green);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(56, 181, 87, 0.5);
}

#audio-toggle .audio-on,
#audio-toggle .audio-off {
    width: 22px;
    height: 22px;
    stroke: var(--white);
    stroke-width: 2;
}

#audio-toggle.muted .audio-on {
    display: none;
}

#audio-toggle.muted .audio-off {
    display: block !important;
}

/* Start screen overlay */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.5s ease;
}

#start-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.start-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.start-logo {
    animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(56, 181, 87, 0.5)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 40px rgba(57, 255, 20, 0.8)); }
}

.start-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 50px;
    font-family: 'Be Vietnam Pro', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.start-btn i {
    width: 20px;
    height: 20px;
}

.start-btn.primary {
    background: linear-gradient(135deg, var(--main-green) 0%, #2d9648 100%);
    color: white;
    border-color: var(--bright-green);
    box-shadow: 0 0 20px rgba(56, 181, 87, 0.4);
}

.start-btn.primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(57, 255, 20, 0.6);
}

.start-btn.secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.3);
}

.start-btn.secondary:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.audio-hint-arrow {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    animation: arrowBounce 1s ease-in-out infinite;
    position: absolute;
    bottom: 90px;
    left: 30px;
}

.audio-hint-arrow i {
    width: 18px;
    height: 18px;
    stroke: var(--main-green);
}

@keyframes arrowBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

#auto-start-timer {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    margin-top: 10px;
}

#countdown {
    color: var(--main-green);
    font-weight: 700;
}

/* Glow effect class */
.glow-intense {
    filter: drop-shadow(0 0 30px var(--bright-green))
            drop-shadow(0 0 60px var(--main-green))
            brightness(1.5) !important;
}

.glow-extreme {
    filter: drop-shadow(0 0 50px var(--neon-green))
            drop-shadow(0 0 100px var(--bright-green))
            brightness(3) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .main-ckpro-logo {
        width: 150px;
        height: 150px;
    }

    .text-ra-mat {
        font-size: 20px;
    }

    .text-ckpro {
        font-size: 32px;
    }

    .text-line1 {
        font-size: 18px;
    }

    .text-line2 {
        font-size: 24px;
    }

    #center-group {
        width: 300px;
        height: 300px;
    }

    .swirl-1 {
        width: 260px;
        height: 260px;
        margin-left: -130px;
        margin-top: -130px;
    }

    .swirl-2 {
        width: 200px;
        height: 200px;
        margin-left: -100px;
        margin-top: -100px;
    }
}
