/* Meechu — shared + splash + home */
:root {
  --meechu-blue: #38bdf8;
  --meechu-mint: #14b8a6;
  --meechu-bg: #f8fafc;
  --meechu-bg-soft: #eef6fb;
  --meechu-text: #1e293b;
  --meechu-muted: #64748b;
  --meechu-splash-ms: 6000;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Pretendard", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ===== SPLASH (P0 — official opening video + cinematic fallback) ===== */
body.splash-body {
  overflow: hidden;
  background: var(--meechu-bg);
  color: var(--meechu-text);
}

body.splash-body--opening {
  background: #f8fafc;
}

#splash-root {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: max(16px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse 100% 60% at 20% 0%, rgba(186, 230, 253, 0.7), transparent 55%),
    radial-gradient(ellipse 80% 50% at 85% 10%, rgba(204, 251, 241, 0.6), transparent 50%),
    linear-gradient(180deg, #ffffff 0%, var(--meechu-bg-soft) 48%, var(--meechu-bg) 100%);
  transition: opacity 0.25s ease;
}

#splash-root[data-mode="video"] {
  padding: 0;
  gap: 0;
  background: #f8fafc;
}

#splash-root[data-mode="video"]::after {
  display: none;
}

.splash-video-shell {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.splash-opening-video,
.meechu-opening-video {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  object-fit: cover;
  object-position: center;
  background: #f8fafc;
}

.splash-cinematic-fallback {
  position: relative;
  z-index: 4;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

#splash-root::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(248, 250, 252, 0.4) 100%);
  z-index: 2;
}

#splash-root.is-fadeout {
  opacity: 0;
  pointer-events: none;
  filter: none;
}

.splash-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 28%, rgba(56, 189, 248, 0.12), transparent 42%),
    radial-gradient(circle at 82% 72%, rgba(94, 234, 212, 0.1), transparent 40%);
  animation: ambient-pulse 6s ease-in-out infinite;
  z-index: 0;
}

@keyframes ambient-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

/* Cinematic stage — large card / near-fullscreen */
.splash-cinematic-shell {
  position: relative;
  z-index: 5;
  width: min(96vw, 720px);
  flex-shrink: 0;
}

.splash-cinematic-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 307 / 142;
  border-radius: 24px;
  overflow: hidden;
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.06),
    0 16px 48px rgba(15, 23, 42, 0.08),
    0 4px 16px rgba(56, 189, 248, 0.1);
}

/* Stacked cinematic frames — long crossfade overlap */
.splash-cine {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transform: scale(1) translate3d(0, 0, 0);
  filter: blur(0);
  transition:
    opacity 0.85s ease-in-out,
    transform 2.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    filter 0.85s ease-in-out;
  will-change: opacity, transform, filter;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.splash-cine.is-active {
  opacity: 1;
  transform: scale(1.025) translate3d(0, -0.25%, 0);
  filter: blur(0);
  z-index: 3;
}

.splash-cine.is-exiting {
  opacity: 0;
  transform: scale(1.008) translate3d(0, 0.15%, 0);
  filter: blur(1.2px);
  z-index: 2;
  transition:
    opacity 0.85s ease-in-out,
    transform 0.85s ease-in-out,
    filter 0.85s ease-in-out;
}

/* Glow overlay */
.splash-cine-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(74, 144, 226, 0.14), transparent 68%),
    radial-gradient(ellipse 50% 40% at 50% 60%, rgba(80, 227, 194, 0.1), transparent 70%);
  mix-blend-mode: screen;
  opacity: 0.55;
  animation: glow-breathe 3.2s ease-in-out infinite;
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.72; }
}

/* Parallax drift layer */
.splash-cine-parallax {
  position: absolute;
  inset: -4%;
  pointer-events: none;
  z-index: 5;
  background:
    radial-gradient(circle at 30% 40%, rgba(74, 144, 226, 0.06), transparent 45%),
    radial-gradient(circle at 70% 60%, rgba(80, 227, 194, 0.05), transparent 42%);
  animation: parallax-drift 6s ease-in-out infinite alternate;
}

@keyframes parallax-drift {
  from { transform: translate3d(-0.6%, 0.3%, 0); }
  to { transform: translate3d(0.6%, -0.3%, 0); }
}

/* White flash — frames 7–9 (phase 6–8) */
.splash-cine-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.95), transparent 72%);
  opacity: 0;
  mix-blend-mode: screen;
}

#splash-root[data-phase="6"] .splash-cine-flash {
  animation: white-flash 0.55s ease-out forwards;
}

#splash-root[data-phase="7"] .splash-cine-flash,
#splash-root[data-phase="8"] .splash-cine-flash {
  opacity: 0.12;
  animation: flash-hold 0.4s ease forwards;
}

@keyframes white-flash {
  0% { opacity: 0; }
  18% { opacity: 0.85; }
  100% { opacity: 0.08; }
}

@keyframes flash-hold {
  from { opacity: 0.18; }
  to { opacity: 0.06; }
}

/* Final copy — slogan + Nice to MEECHU only */
.splash-copy-block {
  position: relative;
  z-index: 10;
  text-align: center;
  max-width: min(92vw, 520px);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.splash-slogan-final,
.splash-nice-final,
.splash-wave {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

#splash-root.show-slogan .splash-slogan-final {
  opacity: 1;
  transform: translateY(0);
}

#splash-root.show-nice .splash-nice-final,
#splash-root.show-nice .splash-wave {
  opacity: 1;
  transform: translateY(0);
}

.splash-slogan-final {
  font-size: clamp(14px, 3.6vw, 16px);
  line-height: 1.6;
  color: var(--meechu-muted);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.splash-nice-final {
  font-size: clamp(22px, 5.8vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--meechu-blue), var(--meechu-mint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.splash-wave {
  width: min(140px, 40vw);
  height: auto;
  margin-top: 2px;
}

/* Phase-specific stage emphasis */
#splash-root[data-phase="6"] .splash-cinematic-stage,
#splash-root[data-phase="7"] .splash-cinematic-stage,
#splash-root[data-phase="8"] .splash-cinematic-stage {
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.06),
    0 20px 56px rgba(15, 23, 42, 0.1),
    0 0 80px rgba(56, 189, 248, 0.15);
}

@media (min-width: 768px) {
  .splash-cinematic-shell {
    width: min(88vw, 780px);
  }

  .splash-cinematic-stage {
    border-radius: 22px;
  }

  .splash-copy-block {
    min-height: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash-cine,
  .splash-cine-glow,
  .splash-cine-parallax,
  .splash-cine-flash,
  .splash-ambient {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .splash-cine.is-active {
    transform: none;
  }
}

/* ===== HOME (P1 — bright global chat) ===== */
body.home-body {
  min-height: 100vh;
  min-height: 100dvh;
  color: #1e293b;
  background:
    radial-gradient(ellipse 90% 60% at 15% -5%, rgba(110, 179, 255, 0.22), transparent 55%),
    radial-gradient(ellipse 80% 50% at 90% 0%, rgba(80, 227, 194, 0.18), transparent 50%),
    radial-gradient(ellipse 70% 45% at 50% 100%, rgba(186, 230, 253, 0.35), transparent 55%),
    linear-gradient(165deg, #ffffff 0%, #f0f9ff 38%, #ecfeff 72%, #f8fafc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.home-card {
  width: min(440px, 100%);
  text-align: center;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  padding: 40px 26px 32px;
  box-shadow:
    0 20px 50px rgba(74, 144, 226, 0.1),
    0 8px 24px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.home-logo-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  filter: drop-shadow(0 6px 16px rgba(74, 144, 226, 0.2));
}

.home-brand {
  font-size: clamp(28px, 7vw, 34px);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #0f172a;
  margin-bottom: 6px;
}

.home-tagline {
  font-size: clamp(14px, 3.6vw, 16px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #4a90e2;
  margin-bottom: 22px;
}

.home-slogan {
  font-size: clamp(14px, 3.8vw, 16px);
  line-height: 1.75;
  font-weight: 600;
  color: #475569;
  margin-bottom: 18px;
}

.home-launch-note {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 20px;
}

.home-soon {
  display: inline-block;
  margin: 0 0 24px;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #4a90e2 0%, #50e3c2 100%);
  box-shadow: 0 10px 28px rgba(74, 144, 226, 0.28);
}

.home-regions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.home-chip {
  font-size: 12px;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(186, 230, 253, 0.9);
  color: #334155;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.08);
}

.home-nice {
  font-size: clamp(18px, 5vw, 22px);
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #4a90e2, #50e3c2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (max-width: 380px) {
  .home-card {
    padding: 32px 20px 28px;
    border-radius: 24px;
  }

  .home-chip {
    font-size: 11px;
    padding: 8px 12px;
  }
}
