*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

img,
svg {
    max-width: 100%;
}

html, body { 
    background-color: transparent !important; /* Để lộ lớp nền phía sau */
    color: #0f172a;
    margin: 0;
    padding: 0;
    transition: color 0.5s;
}
html.dark body { color: #f8fafc; }

/* ========================================= */
/* HỆ THỐNG PHÂN LỚP NỀN & HIỆU ỨNG BAY      */
/* ========================================= */
.csa-layer { position: fixed; inset: 0; pointer-events: none; transition: opacity 0.8s ease-in-out; overflow: hidden; }
.csa-layer-bg { z-index: -10; } 
.csa-layer-fg { z-index: 30; } 

.night-layer { opacity: 0; }
html.dark .night-layer { opacity: 1; }
.day-layer { opacity: 1; }
html.dark .day-layer { opacity: 0; }

/* NỀN VŨ TRỤ BAN ĐÊM */
.space-bg-layer { position: absolute; inset: 0; background-color: #020617; }
.night-planet-bg {
    position: absolute; top: 8%; right: 5%; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #facc15, #ca8a04, #020617);
    box-shadow: 0 0 30px rgba(234, 179, 8, 0.3), inset -10px -10px 20px rgba(0,0,0,0.8);
    animation: planet-spin 40s infinite linear; opacity: 0.8;
    width: 64px; height: 64px;
}
@media (min-width: 768px) { .night-planet-bg { width: 96px; height: 96px; } }
.night-planet-bg::before { content: ''; position: absolute; top: -20%; left: -20%; width: 140%; height: 140%; border-radius: 50%; border: 2px solid rgba(234, 179, 8, 0.2); transform: rotateX(75deg); box-shadow: 0 0 10px rgba(234, 179, 8, 0.1); }
@keyframes planet-spin { 100% { transform: rotate(360deg); } }

.orb { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.3; mix-blend-mode: screen;}
.orb-1 { top: 0%; left: 0%; width: 40vw; height: 40vw; background: #4f46e5; animation: blob 15s infinite alternate; }
.orb-2 { bottom: 0%; right: 0%; width: 50vw; height: 50vw; background: #eab308; animation: blob 18s infinite alternate-reverse; }
@keyframes blob { 0% { transform: translate(0px, 0px) scale(1); } 33% { transform: translate(30px, -50px) scale(1.1); } 66% { transform: translate(-20px, 20px) scale(0.9); } 100% { transform: translate(0px, 0px) scale(1); } }

.csa-star { position: absolute; background-color: #fff; border-radius: 50%; animation: twinkle var(--tw-dur, 3s) infinite alternate ease-in-out; }
@keyframes twinkle { 0% { opacity: 0.1; transform: scale(0.5); box-shadow: 0 0 2px #fff; } 100% { opacity: 1; transform: scale(1.5); box-shadow: 0 0 8px #fff, 0 0 15px #eab308; } }

/* HOẠT ẢNH BAN ĐÊM (BAY LƠ LỬNG) */
.csa-meteor { position: absolute; width: 150px; height: 2px; background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 80%, #fff 100%); border-radius: 50%; transform: rotate(-45deg); animation: meteor-fall var(--m-dur, 6s) infinite linear; opacity: 0; filter: drop-shadow(0 0 8px #eab308); }
.csa-meteor::after { content: ''; position: absolute; top: -2px; right: -2px; width: 6px; height: 6px; background: #fff; border-radius: 50%; box-shadow: 0 0 12px 3px #fff; }
@keyframes meteor-fall { 0% { transform: rotate(-45deg) translateX(-300px); opacity: 0; } 5% { opacity: 1; } 30% { transform: rotate(-45deg) translateX(2500px); opacity: 0; } 100% { opacity: 0; } }
.space-ship { position: absolute; font-size: 2.5rem; filter: drop-shadow(0 0 15px rgba(234, 179, 8, 0.8)); animation: cruise var(--s-dur, 15s) infinite linear; opacity: 0; }
@keyframes cruise { 0% { transform: translate(-10vw, 110vh) rotate(45deg) scale(0.5); opacity: 0; } 10% { opacity: 0.8; } 90% { opacity: 0.8; } 100% { transform: translate(110vw, -20vh) rotate(45deg) scale(1.5); opacity: 0; } }
.ufo { position: absolute; font-size: 3rem; filter: drop-shadow(0 0 20px rgba(168, 85, 247, 0.9)); animation: cruise-ufo var(--u-dur, 25s) infinite linear; opacity: 0; }
@keyframes cruise-ufo { 0% { transform: translate(110vw, 70vh) rotate(-15deg) scale(0.6); opacity: 0; } 10% { opacity: 0.6; } 50% { transform: translate(40vw, 40vh) rotate(5deg) scale(0.9); opacity: 0.6; } 90% { opacity: 0.6; } 100% { transform: translate(-20vw, 10vh) rotate(25deg) scale(1.2); opacity: 0; } }
.astronaut { position: absolute; font-size: 2.5rem; filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5)); animation: float-space var(--a-dur, 35s) infinite ease-in-out; opacity: 0; }
@keyframes float-space { 0% { transform: translate(-10vw, 20vh) rotate(0deg) scale(0.8); opacity: 0; } 10% { opacity: 0.7; } 50% { transform: translate(50vw, 60vh) rotate(180deg) scale(1); opacity: 0.7; } 90% { opacity: 0.7; } 100% { transform: translate(110vw, 30vh) rotate(360deg) scale(0.8); opacity: 0; } }

/* NỀN THIÊN NHIÊN BAN NGÀY */
.day-bg { position: absolute; inset: 0; background: linear-gradient(to bottom, #fdf4ff 0%, #fef9c3 60%, #f8fafc 100%); }
.day-sun { position: absolute; top: 5%; right: 5%; background: #fef08a; border-radius: 50%; box-shadow: 0 0 30px #fde047, 0 0 60px #fef08a, inset 0 0 15px #eab308; animation: sun-pulse 4s infinite alternate ease-in-out; width: 64px; height: 64px; }
@media (min-width: 768px) { .day-sun { width: 96px; height: 96px; } }
@keyframes sun-pulse { 0% { transform: scale(0.95); opacity: 0.9;} 100% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 40px #fde047, 0 0 80px #fef08a, inset 0 0 15px #eab308;} }
.day-cloud { position: absolute; background: #fff; border-radius: 50px; filter: drop-shadow(0 5px 15px rgba(0,0,0,0.05)); animation: cloud-move var(--c-dur, 20s) infinite linear; opacity: 0; }
.day-cloud::before, .day-cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.day-cloud::before { width: 45%; height: 150%; top: -60%; left: 15%; }
.day-cloud::after { width: 35%; height: 120%; top: -40%; right: 20%; }
@keyframes cloud-move { 0% { left: -30%; opacity: 0; } 5% { opacity: 0.8; } 95% { opacity: 0.8; } 100% { left: 110%; opacity: 0; } }

/* HOẠT ẢNH BAN NGÀY (BAY LƠ LỬNG) */
.float-item-day { position: absolute; opacity: 0; filter: drop-shadow(0 5px 10px rgba(0,0,0,0.1)); pointer-events: none; }
@keyframes day-balloon { 0% { transform: translate(-10vw, 60vh) rotate(-5deg) scale(0.7); opacity: 0; } 10% { opacity: 0.85; } 50% { transform: translate(40vw, 25vh) rotate(5deg) scale(1); opacity: 0.85; } 90% { opacity: 0.85; } 100% { transform: translate(110vw, -15vh) rotate(-5deg) scale(1.2); opacity: 0; } }
@keyframes day-fly-right { 0% { transform: translate(-10vw, 40vh) rotate(15deg) scale(0.8); opacity: 0; } 10% { opacity: 0.6; } 50% { transform: translate(50vw, 20vh) rotate(-5deg) scale(1); opacity: 0.6; } 90% { opacity: 0.6; } 100% { transform: translate(110vw, 50vh) rotate(10deg) scale(1.2); opacity: 0; } }
@keyframes day-fly-left { 0% { transform: translate(110vw, 60vh) scaleX(-1) rotate(10deg) scale(0.8); opacity: 0; } 10% { opacity: 0.5; } 50% { transform: translate(50vw, 30vh) scaleX(-1) rotate(-10deg) scale(1); opacity: 0.5; } 90% { opacity: 0.5; } 100% { transform: translate(-10vw, 40vh) scaleX(-1) rotate(5deg) scale(1.2); opacity: 0; } }
@keyframes day-leaf-fall { 0% { transform: translateY(-10vh) rotate(0deg) translateX(0); opacity: 0; } 10% { opacity: 0.7; } 50% { transform: translateY(50vh) rotate(180deg) translateX(10vw); opacity: 0.7; } 90% { opacity: 0.7; } 100% { transform: translateY(110vh) rotate(360deg) translateX(-5vw); opacity: 0; } }

/* --- GLASSMORPHISM & UI ELEMENTS --- */
.glass-header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
html.dark .glass-header {
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}
html.dark .glass-card {
    background: rgba(30, 41, 59, 0.5);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
@media (min-width: 768px) {
    .glass-card { padding: 32px; }
}
.glass-card::before {
    content: ""; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent);
    transform: skewX(-20deg); transition: 0.7s; pointer-events: none; z-index: 1;
}
html.dark .glass-card::before { background: linear-gradient(to right, transparent, rgba(255,255,255,0.05), transparent); }
.glass-card:hover::before { left: 150%; }

.text-glow-gold {
    text-shadow: 0 0 20px rgba(234, 179, 8, 0.3), 0 0 40px rgba(234, 179, 8, 0.1);
}
html.dark .text-glow-gold {
    text-shadow: 0 0 20px rgba(234, 179, 8, 0.6), 0 0 40px rgba(234, 179, 8, 0.3);
}
.hero-title,
.section-heading {
    overflow-wrap: anywhere;
}
@media (max-width: 640px) {
    .site-header-inner,
    .site-main {
        width: calc(100vw - 32px) !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .hero-media {
        width: 100% !important;
        max-width: 100% !important;
    }
    .brand-title { font-size: 0.95rem; }
    .hero-title { font-size: 2.25rem; }
    .hero-line { display: block; }
    .section-heading { font-size: 1.55rem; line-height: 1.2; }
    .home-link { display: none !important; }
    .glass-card { padding: 20px 18px; }
}

.btn-primary {
    transition: all 0.3s;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    min-height: 44px;
    text-align: center;
    overflow-wrap: anywhere;
}
html.dark .btn-primary { border: 1px solid rgba(255,255,255,0.2); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); }
.btn-primary:hover { filter: brightness(1.15); transform: translateY(-3px); box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2); }
html.dark .btn-primary:hover { box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-outline-glow {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1e293b;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    min-height: 44px;
    text-align: center;
    overflow-wrap: anywhere;
}
html.dark .btn-outline-glow { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.2); color: #e2e8f0; }
.btn-outline-glow:hover { background: rgba(255, 255, 255, 1); color: #2563eb; box-shadow: 0 0 15px rgba(0, 0, 0, 0.05); }
html.dark .btn-outline-glow:hover { background: rgba(255, 255, 255, 0.1); color: #fff; box-shadow: 0 0 15px rgba(255, 255, 255, 0.1); }
.btn-outline-glow.hover-blue:hover { border-color: #3b82f6; box-shadow: 0 0 20px rgba(59, 130, 246, 0.2); }
html.dark .btn-outline-glow.hover-blue:hover { box-shadow: 0 0 20px rgba(59, 130, 246, 0.4); }
.btn-outline-glow.hover-sky:hover { border-color: #0ea5e9; box-shadow: 0 0 20px rgba(14, 165, 233, 0.2); }
html.dark .btn-outline-glow.hover-sky:hover { box-shadow: 0 0 20px rgba(14, 165, 233, 0.4); }

.copy-input-container {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
html.dark .copy-input-container { background: rgba(15, 23, 42, 0.6); border: 1px solid #334155; }
.copy-input-container:hover { border-color: #3b82f6; box-shadow: 0 0 15px rgba(59, 130, 246, 0.1); }
html.dark .copy-input-container:hover { box-shadow: 0 0 15px rgba(59, 130, 246, 0.2); }
.apple-id-form button:disabled {
    cursor: wait;
    filter: saturate(0.75);
    opacity: 0.75;
    transform: none;
}
.apple-id-result {
    min-height: 0;
}
.apple-id-card,
.apple-id-message {
    border-radius: 14px;
    border: 1px solid rgba(99, 102, 241, 0.28);
    background: rgba(255, 255, 255, 0.78);
    color: #1e293b;
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.12);
}
html.dark .apple-id-card,
html.dark .apple-id-message {
    background: rgba(15, 23, 42, 0.7);
    color: #e2e8f0;
}
.apple-id-card {
    display: grid;
    gap: 9px;
    padding: 12px;
}
.apple-id-status,
.apple-id-message {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    font-size: 13px;
    font-weight: 800;
}
.apple-id-status {
    color: #15803d;
}
html.dark .apple-id-status {
    color: #86efac;
}
.apple-id-message {
    padding: 12px;
}
.apple-id-loading {
    color: #2563eb;
}
html.dark .apple-id-loading {
    color: #93c5fd;
}
.apple-id-error {
    border-color: rgba(251, 191, 36, 0.45);
    color: #92400e;
}
html.dark .apple-id-error {
    color: #fcd34d;
}
.apple-id-error a {
    display: inline-flex;
    margin-top: 5px;
    color: #2563eb;
    font-weight: 900;
    text-decoration: underline;
    text-underline-offset: 3px;
}
html.dark .apple-id-error a {
    color: #93c5fd;
}
.apple-id-row {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 10px;
    padding: 8px;
    background: rgba(248, 250, 252, 0.82);
}
html.dark .apple-id-row {
    background: rgba(2, 6, 23, 0.35);
}
.apple-id-row span {
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}
.apple-id-row code {
    overflow: hidden;
    color: #1d4ed8;
    font-family: Consolas, ui-monospace, SFMono-Regular, monospace;
    font-size: 12px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}
html.dark .apple-id-row code {
    color: #bfdbfe;
}
.apple-id-row button {
    border-radius: 8px;
    background: #4f46e5;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    padding: 7px 9px;
}
.apple-id-row-info {
    grid-template-columns: 76px minmax(0, 1fr);
}
.apple-id-row-info code {
    white-space: normal;
    text-overflow: clip;
    overflow-wrap: anywhere;
}
.apple-id-card p {
    margin: 0;
    color: #92400e;
    font-size: 11px;
    line-height: 1.45;
}
html.dark .apple-id-card p {
    color: #fcd34d;
}
@media (max-width: 520px) {
    .apple-id-row {
        grid-template-columns: 1fr auto;
    }
    .apple-id-row span {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .orb {
        filter: blur(64px);
        opacity: 0.22;
    }
    .csa-meteor {
        width: 110px;
    }
    .space-ship,
    .ufo,
    .astronaut {
        font-size: 2rem;
    }
    #scrollTopBtn {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* Steps Timeline */
.step-item { position: relative; padding-left: 28px; padding-bottom: 20px; }
.step-item::before {
    content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px;
    background: rgba(0, 0, 0, 0.1);
}
html.dark .step-item::before { background: rgba(255, 255, 255, 0.1); }
.step-item:last-child::before { display: none; }
.step-marker {
    position: absolute; left: 0; top: 2px; width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: bold; color: white; z-index: 2;
}

/* Animation Fade In Up */
.animate-up {
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0; transform: translateY(30px);
}
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }

/* Marquee */
.marquee-container { overflow: hidden; white-space: nowrap; position: relative; }
.marquee-content { display: inline-block; animation: marquee 25s linear infinite; }
@keyframes marquee { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }

/* Toast */
.toast {
    visibility: hidden; min-width: 250px; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px);
    color: #10b981; text-align: center;
    border-radius: 50px; padding: 12px 28px; position: fixed; z-index: 1000; left: 50%; bottom: 40px;
    transform: translateX(-50%) translateY(20px); opacity: 0; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); font-weight: 600; border: 1px solid #10b981;
}
html.dark .toast { background: rgba(15, 23, 42, 0.9); color: #4ade80; box-shadow: 0 10px 30px rgba(0,0,0,0.5); border-color: #4ade80; }
.toast.show { visibility: visible; opacity: 1; transform: translateX(-50%) translateY(0); }
