/* ================================
   DESIGN TOKENS
   ================================ */
:root {
  --red:     #ff3b5c;
  --orange:  #ff8c42;
  --blue:    #5b8eff;
  --green:   #6aff7a;
  --bg:      #04030a;
  --text:    #ede9f8;
  --muted:   rgba(220,215,235,.62);
  --border:  rgba(255,255,255,.08);
  --card:    rgba(255,255,255,.04);
  --glass:   rgba(10,8,20,.88);
  --r-lg:    28px;
  --r-md:    18px;
  --r-sm:    12px;
  --page-px: 2rem;
}

/* ================================
   RESET & BASE
   ================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Grid texture */
body::after {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  z-index: 0;
}

/* ================================
   ANIMATED ORB BACKGROUND
   ================================ */
.bg-orbs {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  contain: layout paint;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}

.orb-1 {
  width: min(55vw, 680px); height: min(55vw, 680px);
  top: -25%; left: -12%;
  background: radial-gradient(circle, rgba(255,59,92,.22) 0%, transparent 65%);
  animation: orbFloat 20s ease-in-out infinite;
}

.orb-2 {
  width: min(48vw, 580px); height: min(48vw, 580px);
  top: 20%; right: -16%;
  background: radial-gradient(circle, rgba(91,142,255,.2) 0%, transparent 65%);
  animation: orbFloat 16s ease-in-out infinite reverse;
  animation-delay: -4s;
}

.orb-3 {
  width: min(38vw, 460px); height: min(38vw, 460px);
  bottom: -10%; left: 25%;
  background: radial-gradient(circle, rgba(255,140,66,.22) 0%, transparent 65%);
  animation: orbFloat 22s ease-in-out infinite;
  animation-delay: -8s;
}

.orb-4 {
  width: min(24vw, 300px); height: min(24vw, 300px);
  top: 55%; left: 48%;
  background: radial-gradient(circle, rgba(168,85,247,.16) 0%, transparent 65%);
  animation: orbFloat 18s ease-in-out infinite reverse;
  animation-delay: -12s;
}

/* ================================
   HOMEPAGE WRAPPER
   ================================ */
#homepage {
  position: relative; z-index: 1;
  isolation: isolate;
  width: min(100%, 920px);
  padding: 2.5rem var(--page-px) 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  animation: fadeUp .8s cubic-bezier(.22,.68,0,1) both;
}

/* ================================
   SITE HEADER
   ================================ */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .9rem;
}

.logo-ring {
  flex-shrink: 0;
  border-radius: 50%;
  padding: 3px;
  position: relative;
  box-shadow: 0 0 40px rgba(255,59,92,.25), 0 0 70px rgba(91,142,255,.12);
}

.logo-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--red)     0%,
    var(--orange) 30%,
    var(--blue)   60%,
    transparent   78%,
    var(--red)   100%
  );
  animation: ringRotate 3s linear infinite;
  will-change: transform;
}

.logo-mark {
  width: 96px; height: 96px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, rgba(255,59,92,.18), transparent 55%);
  box-shadow: 0 0 48px rgba(255,59,92,.16), inset 0 1px 0 rgba(255,255,255,.1);
  position: relative;
  overflow: hidden;
}

.logo-mark::after {
  content: '';
  position: absolute;
  width: 62px; height: 62px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
}

.logo-mark video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .38rem .9rem;
  border-radius: 999px;
  background: rgba(106,255,122,.05);
  border: 1px solid rgba(106,255,122,.14);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(106,255,122,.82);
  white-space: nowrap;
}

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: dotPulse 2s ease infinite;
  flex-shrink: 0;
}

/* ================================
   HERO SECTION
   ================================ */
.hero-section {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ================================
   HERO VISUAL
   ================================ */
.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  width: min(100%, 520px);
}

.visual-glow {
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,59,92,.15) 0%, transparent 70%);
  filter: blur(50px);
  animation: glowPulse 5s ease-in-out infinite;
  will-change: transform, opacity;
  pointer-events: none;
}

.hero-card {
  position: relative;
  width: 100%;
  padding: 1.8rem 1.6rem 1.6rem;
  border-radius: var(--r-lg);
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 40px 100px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.06);
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,59,92,.52), transparent);
}

.hero-card-header {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-bottom: 1.25rem;
}

.card-dots { display: flex; gap: .5rem; }

.card-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}

.card-dots span:first-child  { background: rgba(255,96,96,.55); }
.card-dots span:nth-child(2) { background: rgba(255,210,70,.5); }
.card-dots span:nth-child(3) { background: rgba(80,230,110,.45); }

.card-label {
  font-size: .66rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(255,255,255,.42);
}

.hero-card-body {
  font-size: .93rem;
  line-height: 1.85;
  color: rgba(228,224,244,.8);
  margin-bottom: 1.6rem;
}


.float-dot {
  position: absolute;
  border-radius: 50%;
  filter: blur(16px);
  pointer-events: none;
  animation: floatAnim 7s ease-in-out infinite;
}

.dot-1 { width: 100px; height: 100px; top: 4%;  left: 2%;   background: rgba(255,59,92,.22); }
.dot-2 { width: 70px;  height: 70px;  top: 62%; right: 3%;  background: rgba(91,142,255,.18); animation-duration: 5.5s; animation-delay: 1.5s; }
.dot-3 { width: 50px;  height: 50px;  bottom: 8%; left: 52%; background: rgba(255,160,60,.2);  animation-duration: 6.5s; animation-delay: 2.5s; }

/* ================================
   STATS ROW
   ================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-top: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(255,255,255,.07);
}

.stat-card {
  padding: .9rem .7rem;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  text-align: center;
  transition: background .2s ease, border-color .2s ease;
}

.stat-card:hover {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.12);
}

.stat-card strong {
  display: block;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,.75) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.stat-card span {
  font-size: .65rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
}

/* ================================
   LOADER
   ================================ */
.loader-section {
  width: min(100%, 520px);
  margin-left: auto;
  margin-right: auto;
  padding: 1.5rem 1.6rem;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
}

.loader-section::before {
  content: '';
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,59,92,.45), transparent);
}

.loader-top {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.loader-ring {
  width: 52px; height: 52px;
  flex-shrink: 0;
  animation: ringRotate 1.8s linear infinite;
  will-change: transform;
  filter: drop-shadow(0 0 8px rgba(255,59,92,.4));
}

.loader-ring svg { width: 100%; height: 100%; }

.loader-copy { flex: 1; min-width: 0; }

.wait-text {
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.55);
  margin-bottom: .5rem;
  display: flex;
  align-items: baseline;
  gap: .1rem;
}

.loading-dots { display: inline-flex; gap: .05rem; margin-left: .1rem; }

.loading-dots span {
  color: var(--red);
  animation: dotBlink 1.4s ease-in-out infinite;
  font-size: 1.1em;
}

.loading-dots span:nth-child(2) { animation-delay: .22s; }
.loading-dots span:nth-child(3) { animation-delay: .44s; }

.loader-pct-row {
  display: flex;
  align-items: baseline;
  gap: .55rem;
}

.loader-pct-num {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.04em;
  line-height: 1;
}

.loader-pct-label {
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.38);
}

.page-progress { width: 100%; }

.page-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,.07);
  border-radius: 999px;
  overflow: hidden;
}

.page-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--red), var(--orange));
  box-shadow: 0 0 20px rgba(255,59,92,.55);
  border-radius: 999px;
  will-change: width;
  position: relative;
  overflow: hidden;
}

.page-progress-fill::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -60%;
  width: 55%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  animation: shimmerSlide 1.6s ease-in-out infinite;
}

/* ================================
   POPUP OVERLAY
   ================================ */
#overlay {
  position: fixed; inset: 0;
  z-index: 100;
  background: rgba(4,3,10,.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn .4s ease;
}


.popup-panel {
  width: 100%;
  max-width: 460px;
  background: rgba(10,8,20,.98);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-lg);
  padding: 3rem 2.5rem 2.5rem;
  box-shadow: 0 32px 100px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.05);
  position: relative;
  animation: slideUp .4s cubic-bezier(.22,.68,0,1.2);
  overflow: hidden;
}

.popup-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,59,92,.7), transparent);
}

.popup-panel::after {
  content: '';
  position: absolute;
  top: -140px; left: 50%;
  transform: translateX(-50%);
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,59,92,.08) 0%, transparent 70%);
  pointer-events: none;
}

.popup-state { display: none; flex-direction: column; align-items: center; text-align: center; }
.popup-state.active { display: flex; }

.p-icon {
  width: 58px; height: 58px;
  margin: 0 auto 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,59,92,.07);
  border: 1px solid rgba(255,59,92,.16);
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(255,59,92,.1);
}

.p-icon svg { width: 100%; height: 100%; }

.p-label {
  font-size: .62rem;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: rgba(255,80,105,.85);
  margin-bottom: .5rem;
}

.p-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.025em;
  color: #fff;
  line-height: 1.3;
  margin-bottom: .7rem;
}

.p-divider {
  width: 40px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,59,92,.6), transparent);
  margin: 1rem auto 1.2rem;
}

.p-sub {
  font-size: .82rem;
  color: rgba(210,205,230,.6);
  letter-spacing: .03em;
  line-height: 1.85;
  margin-bottom: 2rem;
}

.btn-group {
  display: flex;
  gap: .85rem;
  width: 100%;
}

.btn {
  flex: 1;
  min-width: 120px;
  padding: .9rem 1rem;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, filter .15s;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,.1);
  opacity: 0;
  transition: opacity .14s;
}

.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(.976); }

.btn-yes {
  background: linear-gradient(135deg, var(--red), var(--orange));
  color: #fff;
  box-shadow: 0 16px 44px rgba(255,59,92,.22);
}

.btn-yes:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 55px rgba(255,59,92,.32);
  filter: brightness(1.06);
}

.btn-no {
  background: rgba(255,255,255,.06);
  color: rgba(220,215,235,.8);
  border: 1px solid rgba(255,255,255,.1);
}

.btn-no:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,.1);
  color: #fff;
  border-color: rgba(255,255,255,.18);
}

.decline-bar-wrap { width: 100%; margin-bottom: .5rem; }
.d-track { width: 100%; height: 2px; background: rgba(255,255,255,.07); border-radius: 1px; overflow: hidden; }
.d-fill  { height: 100%; width: 0%; background: linear-gradient(90deg, var(--red), var(--orange)); will-change: width; }
.d-note  { font-size: .64rem; color: rgba(200,195,220,.4); letter-spacing: .12em; margin-top: .5rem; }

.popup-foot {
  margin-top: 1.8rem;
  font-size: .62rem;
  color: rgba(180,175,200,.22);
  letter-spacing: .08em;
  line-height: 2;
}

/* ================================
   ANIMATIONS
   ================================ */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%       { transform: translate(3%, 4%) scale(1.03); }
  50%       { transform: translate(-2%, 6%) scale(.97); }
  75%       { transform: translate(4%, -2%) scale(1.02); }
}

@keyframes floatAnim {
  0%, 100% { transform: translateY(0) translateX(0); }
  33%       { transform: translateY(-14px) translateX(8px); }
  66%       { transform: translateY(-7px) translateX(-6px); }
}

@keyframes glowPulse {
  0%, 100% { opacity: .6; transform: scale(1); }
  50%       { opacity: 1; transform: scale(1.1); }
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 6px var(--green); opacity: 1; }
  50%       { box-shadow: 0 0 14px var(--green); opacity: .65; }
}

@keyframes ringRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes dotBlink {
  0%, 80%, 100% { opacity: .15; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-2px); }
}

@keyframes shimmerSlide {
  0%   { left: -60%; }
  100% { left: 140%; }
}

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

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 820px) {
  .hero-section { gap: 2rem; }
}

/* Tablet + Mobile perf */
@media (max-width: 640px) {
  :root { --page-px: 1.25rem; }
  body { align-items: flex-start; overflow-y: auto; }
  #homepage { padding: 1.5rem var(--page-px) 2rem; gap: 1.25rem; }
  .site-header { flex-direction: column; gap: .6rem; }

  /* Tắt backdrop-filter (GPU killer trên mobile) */
  .hero-card    { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(10,8,20,.95); }
  .loader-section { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(10,8,20,.92); }
  #overlay      { backdrop-filter: none; -webkit-backdrop-filter: none; }

  /* Giảm số lớp GPU: ẩn 2 orb và float dots */
  .orb-3, .orb-4 { display: none; }
  .float-dot     { display: none; }
}

/* Mobile */
@media (max-width: 480px) {
  #homepage { padding: 1.25rem var(--page-px) 1.8rem; gap: 1.1rem; }

  .logo-mark { width: 110px; height: 110px; }
  .logo-mark::after { width: 72px; height: 72px; }
  .header-badge { font-size: .62rem; padding: .3rem .75rem; }

  .hero-visual { min-height: auto; }
  .hero-card { padding: 1.4rem 1.2rem 1.2rem; border-radius: 22px; }

  .stats-row { grid-template-columns: repeat(3, 1fr); gap: .6rem; }
  .stat-card { padding: 1.1rem .8rem; }
  .stat-card strong { font-size: 1.55rem; }

  .loader-section { padding: 1.2rem var(--page-px); gap: 1rem; }
  .loader-ring { width: 44px; height: 44px; }
  .loader-pct-num { font-size: 1.55rem; }
  .wait-text { font-size: .72rem; }

  .popup-panel { padding: 2rem var(--page-px) 1.8rem; border-radius: 22px; }
  .p-title { font-size: 1.25rem; }
  .p-sub { font-size: .78rem; }
  .btn-group { flex-direction: column; gap: .65rem; }
  .btn { padding: .82rem 1rem; }
}
