:root {
  /* Brand Colors - Refined for "Story & Existence" Theme */
  --ygs-primary: #BC3B3B; /* Cinnabar Red - The seal of life */
  --ygs-primary-hover: #A62F2F;
  --ygs-primary-gradient: linear-gradient(135deg, #BC3B3B 0%, #D65A5A 100%);
  
  /* Backgrounds - Warm Paper Texture vibe */
  --ygs-bg: #FDFCF8; /* Warm Rice Paper White */
  --ygs-bg-alt: #F7F5F0; /* Slightly darker warm gray for alternating sections */
  --ygs-bg-card: #FFFFFF;
  
  /* Text Colors - softer blacks */
  --ygs-text: #2C2C2C; /* Soft Black */
  --ygs-text-muted: #666666; /* Warm Gray */
  --ygs-text-light: #999999;
  
  /* Accents */
  --ygs-secondary: #4A6B8A; /* Muted Slate Blue - Intellect/AI */
  --ygs-gold: #C5A059; /* Muted Gold - Lineage/Legacy */
  --ygs-dna-gold: #E5C079;
  --ygs-dna-blue: #6AB5F6;
  
  /* Borders & Shadows */
  --ygs-border: #EBE8E0;
  --ygs-shadow-sm: 0 4px 12px rgba(188, 59, 59, 0.06); /* Tinted subtle shadow */
  --ygs-shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.08);
  --ygs-shadow: var(--ygs-shadow-sm);
  
  /* Layout */
  --container-max: 1100px;
  --section-spacing: 140px; /* More breathing room */
  --header-safe-top: env(safe-area-inset-top, 0px);
  --header-height: 72px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ygs-bg: #121212;
    --ygs-bg-alt: #1A1A1A;
    --ygs-bg-card: #222222;
    --ygs-text: #E0E0E0;
    --ygs-text-muted: #AAAAAA;
    --ygs-text-light: #666666;
    --ygs-border: #333333;
    --ygs-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    --ygs-shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
  }
}

@font-face {
  font-family: "Noto Serif SC";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/noto-serif-sc-700-subset.woff2") format("woff2");
}

/* Global Reset & Typography */
* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  overscroll-behavior-x: none;
  max-width: 100vw;
  width: 100%; /* Ensure width constraint */
}

@supports (overflow: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--ygs-bg);
  color: var(--ygs-text);
  line-height: 1.8; /* Increased for better reading experience */
  touch-action: pan-y;
  overflow-x: hidden;
}

main {
  overflow-x: hidden;
}

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

section[id] {
  scroll-margin-top: calc(var(--header-height) + var(--header-safe-top) + 16px);
}

/* Typography Hierarchy */
h1, h2, h3, .serif {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Source Han Serif", serif;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.3s ease;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 32px;
}

/* Header - Glassmorphism */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding-top: var(--header-safe-top);
  background: rgba(253, 252, 248, 0.85); /* Matches --ygs-bg with opacity */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0,0,0,0.03);
  transition: box-shadow 0.3s, transform 0.25s ease, opacity 0.2s ease;
  will-change: transform;
}

@media (prefers-color-scheme: dark) {
  .header {
    background: rgba(18, 18, 18, 0.85);
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
}

.header.is-hidden {
  /* Use percentage to avoid relying on CSS env()/vars support across WebViews. */
  transform: translate3d(0, -100%, 0);
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .header {
    transition: box-shadow 0.3s;
  }
}

.header-inner {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header.is-scrolled {
  box-shadow: var(--ygs-shadow-sm);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-group img {
  width: 28px;
  height: 28px;
}

.logo-group .brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--ygs-text);
}

.nav {
  display: flex;
  gap: 40px;
  align-items: center;
}

.nav a {
  font-size: 15px;
  font-weight: 500;
  color: var(--ygs-text-muted);
  position: relative;
}

.nav a:hover {
  color: var(--ygs-primary);
}

/* Nav underline effect */
.nav a:not(.btn-download)::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background-color: var(--ygs-primary);
  transition: width 0.3s;
}

.nav a:not(.btn-download):hover::after {
  width: 100%;
}

.nav .btn-download {
  background: var(--ygs-primary);
  color: white;
  padding: 10px 24px;
  border-radius: 24px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 15px rgba(188, 59, 59, 0.2);
}

.nav .btn-download:hover {
  background: var(--ygs-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(188, 59, 59, 0.3);
}

/* Hero Section */
.hero {
  min-height: 100vh; /* Fallback */
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: var(--header-height);
  padding-bottom: 60px;
  text-align: center;
  position: relative;
  /* Subtle warm radial glow - enhanced for transition */
  background: radial-gradient(circle at 50% 40%, rgba(188, 59, 59, 0.05) 0%, transparent 70%);
  overflow: hidden;
}

.hero > .container {
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero h1 {
  font-size: clamp(36px, 8vw, 72px);
  line-height: 1.2;
  margin-bottom: 24px;
  color: var(--ygs-text);
}

.hero p {
  font-size: clamp(16px, 4vw, 22px);
  color: var(--ygs-text-muted);
  max-width: 680px;
  margin: 0 auto 48px;
  font-weight: 400;
  padding: 0 20px;
}

/* Home hero: slightly more breathing room between title/subtitle/CTA */
.hero--home h1 {
  margin-bottom: 32px;
}

.hero--home p {
  margin: 0 auto 80px;
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 40px;
  border-radius: 40px;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
}

.btn-primary {
  background: var(--ygs-primary-gradient);
  color: white;
  box-shadow: 0 10px 25px rgba(188, 59, 59, 0.3);
  border: 1px solid transparent;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(188, 59, 59, 0.4);
  filter: brightness(1.05);
}

.btn-outline {
  border: 1px solid var(--ygs-border);
  background: transparent;
  color: var(--ygs-text);
}

.btn-outline:hover {
  border-color: var(--ygs-text);
  background: rgba(0,0,0,0.02);
}

/* Scroll Indicator Styles */
.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 10;
  opacity: 0.6;
  transition: opacity 0.5s ease;
}

.mouse {
  width: 24px;
  height: 38px;
  border: 2px solid var(--ygs-text-muted);
  border-radius: 12px;
  position: relative;
}

.wheel {
  width: 2px;
  height: 6px;
  background: var(--ygs-primary);
  border-radius: 1px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  animation: scroll-wheel 2s infinite;
}

@keyframes scroll-wheel {
  0% { transform: translateX(-50%) translateY(0); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateX(-50%) translateY(12px); opacity: 0; }
}

.arrow span {
  display: block;
  width: 10px;
  height: 10px;
  border-bottom: 2px solid var(--ygs-text-muted);
  border-right: 2px solid var(--ygs-text-muted);
  transform: rotate(45deg);
  margin: -4px;
  animation: scroll-arrow 2s infinite;
}

.arrow span:nth-child(2) {
  animation-delay: -0.2s;
}

@keyframes scroll-arrow {
  0% { opacity: 0; transform: rotate(45deg) translate(-5px, -5px); }
  50% { opacity: 1; }
  100% { opacity: 0; transform: rotate(45deg) translate(5px, 5px); }
}

/* Sections */
.section {
  padding: var(--section-spacing) 0;
  position: relative;
}

/* Enhanced transition between Hero and Story */
#story {
  padding-top: calc(var(--section-spacing) + 40px);
  /* Create a smooth bleed from Hero to Story */
  background: linear-gradient(to bottom, transparent, var(--ygs-bg-alt) 200px);
}

/* Alternating background color for sections */
.section:nth-child(even) {
  background-color: var(--ygs-bg-alt);
}

.section-header {
  text-align: center;
  margin-bottom: 80px;
}

.section-header h2 {
  font-size: 40px;
  margin-bottom: 24px;
  color: var(--ygs-text);
}

.section-header p {
  color: var(--ygs-text-muted);
  font-size: 18px;
  max-width: 600px;
  margin: 0 auto;
}

/* Split Layout */
.split-section {
  display: flex;
  align-items: center;
  gap: 100px;
}

.split-section.reverse {
  flex-direction: row-reverse;
}

.split-section.align-start {
  align-items: flex-start;
}

/* AI module: split into two parts */
#ai .split-section + .split-section {
  margin-top: 120px;
}

/* Desktop: tighten transition into Story DNA */
@media (min-width: 901px) {
  #ai.section {
    padding-bottom: calc(var(--section-spacing) - 30px);
  }
}

.split-text {
  flex: 1;
}

.split-text h2 {
  font-size: 40px;
  margin-bottom: 48px;
  line-height: 1.25;
  position: relative;
}

/* Decorative line under H2 */
.split-text h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--ygs-primary);
  margin-top: 24px;
  border-radius: 2px;
  opacity: 0.3;
}

.split-visual {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* Feature Points */
.feature-point {
  margin-bottom: 48px;
  padding-left: 24px;
  border-left: 2px solid var(--ygs-border);
  transition: border-color 0.3s;
}

.feature-point:hover {
  border-left-color: var(--ygs-primary);
}

.feature-point h3 {
  font-size: 24px;
  margin-bottom: 12px;
  color: var(--ygs-text);
}

.feature-point p {
  font-size: 16px;
  color: var(--ygs-text-muted);
  margin: 0;
  line-height: 1.8;
}

/* Phone Mockup - Refined */
.phone-mockup {
  width: 320px;
  height: 640px;
  background: var(--ygs-bg-card);
  border-radius: 50px;
  border: 8px solid #F0F0F0; /* Softer border */
  box-shadow: 
    0 0 0 2px rgba(0,0,0,0.02), /* Outer crisp ring */
    0 30px 60px -10px rgba(0,0,0,0.15); /* Deep soft shadow */
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.phone-mockup:hover {
  transform: translateY(-15px) rotateY(-5deg);
}

@media (prefers-color-scheme: dark) {
  .phone-mockup {
    border-color: #333;
    background: #1e1e1e;
  }
}

.mockup-placeholder-content {
  text-align: center;
  color: var(--ygs-text-light);
  padding: 30px;
  font-family: sans-serif;
}

.mockup-placeholder-icon {
  font-size: 64px;
  margin-bottom: 24px;
  opacity: 0.2;
  filter: grayscale(1);
}

/* Scenario Section - Integrated into Universe */
.scenario-anchor {
  display: block;
  position: relative;
  top: -100px;
  visibility: hidden;
}

/* Enhanced Universe Background with Stardust */
.universe-section {
  background: radial-gradient(circle at center, #1B2028 0%, #0F1115 100%);
  position: relative;
  overflow: hidden;
  padding: 60px 0 160px;
  /* Add depth pattern */
  background-image: 
    radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 3px),
    radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 2px),
    radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 3px);
  background-size: 550px 550px, 350px 350px, 250px 250px;
  background-position: 0 0, 40px 60px, 130px 270px;
}

/* Cinematic Header for Theater - Refined "Data Timestamp" Style */
.theater-section-header {
  text-align: center;
  margin-bottom: 32px; /* Tighter spacing */
  position: relative;
  z-index: 10;
}

.theater-section-header h2 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; /* Tech feel */
  font-size: 24px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 4px; /* Wide spacing for "SCENE" feel */
  margin-bottom: 12px;
  text-transform: uppercase;
  display: inline-block;
  position: relative;
}

/* Decorative lines for the timestamp */
.theater-section-header h2::before,
.theater-section-header h2::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: rgba(255,255,255,0.3);
  vertical-align: middle;
  margin: 0 12px;
}

.theater-section-header p {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.5);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
  font-weight: 400;
}

/* Mobile Optimization for Header */
@media (max-width: 768px) {
  .theater-section-header {
    margin-bottom: 24px;
  }
  
  .theater-section-header h2 {
    font-size: 20px;
    letter-spacing: 2px;
  }
  
  .theater-section-header h2::before,
  .theater-section-header h2::after {
    width: 12px; /* Shorter lines on mobile */
    margin: 0 8px;
  }

  .theater-section-header p {
    font-size: 13px;
    padding: 0 20px; /* Prevent edge touching */
  }
}

/* 0. Bridge Visualization - Enhanced */
.continuum-bridge {
  height: 100px; /* Slightly shorter for tighter connection */
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end; /* Align to bottom to connect */
  margin-top: -10px;
  margin-bottom: 0; /* Touch the theater */
  z-index: 5;
}

.bridge-line {
  width: 1px; /* Thinner, laser-like */
  height: 100%;
  background: linear-gradient(to bottom, 
    rgba(255, 255, 255, 0) 0%, 
    rgba(255, 255, 255, 0.4) 50%, 
    rgba(255, 255, 255, 0.8) 100%
  );
  position: relative;
  box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

/* Contact Point Glow (Where bridge hits theater) */
.bridge-line::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 1px;
  background: white;
  box-shadow: 0 0 20px 2px rgba(255,255,255,0.8);
  border-radius: 50%;
  opacity: 0.8;
}

/* Pulse energy packet */
.bridge-line::after {
  content: '';
  position: absolute;
  top: 0;
  left: -1px;
  width: 3px;
  height: 30px;
  background: white;
  border-radius: 4px;
  box-shadow: 0 0 15px white;
  /* Sync with 8s cycle: runs 0-3s, sleeps 3-8s */
  animation: bridge-flow 8s infinite ease-in;
}

@keyframes bridge-flow {
  0% { top: -30px; opacity: 0; }
  5% { opacity: 1; }
  35% { top: 100%; opacity: 1; }
  38%, 100% { top: 100%; opacity: 0; }
}

/* 1. Main Theater Container - Premium Dark Glass (Crystal & Letter) */
.time-theater {
  margin-top: 20px;
  position: relative;
  width: 100%;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  min-height: 640px;
  
  /* Deep Space Glass + Bottom Spotlight Glow */
  background-color: rgba(15, 18, 24, 0.8);
  background-image: 
    radial-gradient(circle at 50% 100%, var(--stage-color-glow) 0%, transparent 50%),
    linear-gradient(to bottom, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0.2) 100%);
    
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  
  border-radius: 24px;
  
  /* Crystal Edges */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.3); /* Top Edge Highlight */
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  
  box-shadow: 
    0 40px 100px -20px rgba(0, 0, 0, 0.9), /* Deep drop shadow */
    inset 0 1px 0 rgba(255, 255, 255, 0.1), /* Inner top crisp line */
    inset 0 0 40px rgba(0,0,0,0.5); /* Inner depth */
    
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.5s ease, background-image 0.5s ease;
}

/* Simulation Disclaimer */
.simulation-note {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 1px;
  pointer-events: none;
  text-transform: uppercase;
}

/* Theme Variables Scope - Enhanced for "Atmosphere" */
.time-theater[data-theme="heritage"] {
  --stage-color-primary: #FFD54F; 
  --stage-color-bg: rgba(255, 213, 79, 0.1);
  --stage-color-glow: rgba(255, 193, 7, 0.12); /* Warm Gold Mist */
}

.time-theater[data-theme="resonance"] {
  --stage-color-primary: #6AB5F6; 
  --stage-color-bg: rgba(106, 181, 246, 0.1);
  --stage-color-glow: rgba(33, 150, 243, 0.15); /* Cool Blue Aurora */
}

/* 2. Controls (Switcher) */
.theater-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 20;
}

.theater-tab {
  background: transparent;
  border: 1px solid transparent;
  padding: 10px 24px;
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6); /* Muted white */
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theater-tab:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.theater-tab.is-active {
  color: var(--stage-color-primary);
  background: var(--stage-color-bg);
  border-color: rgba(255, 255, 255, 0.05);
  text-shadow: 0 0 12px var(--stage-color-glow);
}

.theater-tab .tab-icon {
  font-size: 12px;
  opacity: 0.8;
}

/* 3. Stage & Scenes */
.theater-stage {
  flex: 1;
  position: relative;
  padding: 60px 40px; /* More breathing room */
  display: flex;
  justify-content: center;
}

/* Scene Visibility Logic */
.theater-scene {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 60px 40px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.theater-scene.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* 4. The "Fate Thread" (Visual Spine) */
.fate-thread-container {
  position: absolute;
  top: 140px; 
  bottom: 140px; 
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  z-index: 10;
  pointer-events: none;
}

.fate-line-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(255,255,255,0.15); /* Slightly brighter base line */
  transform: translateX(-0.5px);
}

.fate-line-beam {
  position: absolute;
  top: -200px;
  left: 50%;
  width: 2px;
  height: 200px; /* Longer, softer energy tail */
  transform: translateX(-50%);
  background: linear-gradient(to bottom, 
    transparent 0%, 
    rgba(255, 255, 255, 0.8) 50%, 
    transparent 100%
  );
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.4), 0 0 20px var(--stage-color-primary);
  opacity: 0;
  will-change: top, opacity;
  /* Sync with 8s cycle: wait 3s for bridge, then run 5s scan */
  animation: beam-scan 8s infinite cubic-bezier(0.4, 0, 0.2, 1);
  animation-delay: 3s; 
}

@keyframes beam-scan {
  0% { top: -200px; opacity: 0; }
  10% { opacity: 1; }
  60% { opacity: 1; }
  65%, 100% { top: 100%; opacity: 0; }
}

/* Nodes - Reactive lighting synced within the 8s cycle */
.thread-node {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.1); 
  border: 1px solid var(--stage-color-primary);
  border-radius: 50%;
  pointer-events: none;
}

/* Sequence: 3s (wait for bridge) + internal delays for 3 nodes */
.thread-node:nth-child(1) { animation: node-reactive-light 8s infinite 4.2s; }
.thread-node:nth-child(2) { animation: node-reactive-light 8s infinite 5.5s; }
.thread-node:nth-child(3) { animation: node-reactive-light 8s infinite 6.8s; }

@keyframes node-reactive-light {
  0%, 10%, 25%, 100% { 
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 5px transparent;
  }
  18% { 
    background: white;
    transform: translate(-50%, -50%) scale(2.2);
    box-shadow: 0 0 30px var(--stage-color-primary), 0 0 60px var(--stage-color-primary);
  }
}

.thread-node::after {
  content: none !important;
  display: none !important;
}

/* 5. Actors & Dialogue - Crystal Details */
.actor-block {
  position: relative;
  z-index: 15;
  width: 100%;
  display: flex;
  justify-content: center;
}

.actor-content {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  max-width: 85%; /* Wider for better reading */
}

.actor-top .actor-content { flex-direction: row; }
.actor-bottom .actor-content { flex-direction: row-reverse; }

/* Avatar Styling */
.actor-avatar {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative; 
  background: transparent;
  /* Ensure container doesn't show any square bits */
  border-radius: 50%;
}

/* Force all avatar content (img or initial) to be round */
.actor-avatar > * {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50% !important;
  clip-path: circle(50% at 50% 50%);
  -webkit-clip-path: circle(50% at 50% 50%);
  box-sizing: border-box;
}

.actor-avatar img {
  object-fit: cover;
  background: #2C2C2C;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Styles specifically for text avatars */
.avatar-initial {
  background: rgba(255,255,255,0.1);
  display: flex; /* Override block from > * to center text */
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.15); /* Match img border */
  font-weight: 600;
}

/* AI Avatar - Living Signal */
.actor-avatar.is-ai {
  /* Container is purely structural */
}

/* Apply visuals to the IMAGE only */
.actor-avatar.is-ai img {
  border-color: var(--stage-color-primary);
  /* Circular glow on the image */
  box-shadow: 0 0 0 2px rgba(255,255,255,0.1), 0 0 20px var(--stage-color-glow);
  animation: pulse-ai-glow 3s infinite ease-in-out;
}

/* ... badge styles ... */

/* AI Badge - Themed */
.actor-avatar.is-ai::after {
  content: "AI";
  position: absolute;
  bottom: 0;
  right: -4px;
  background-color: var(--stage-color-primary); /* Adapts to Gold/Blue */
  color: white; 
  font-size: 9px;
  font-weight: 900; /* Extra bold */
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid white;
  line-height: 1;
  z-index: 20;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5), 0 0 15px var(--stage-color-glow);
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  letter-spacing: 0.5px;
}

@keyframes pulse-ai-glow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255,255,255,0.1), 0 0 15px var(--stage-color-glow); }
  50% { box-shadow: 0 0 0 4px rgba(255,255,255,0.2), 0 0 30px var(--stage-color-primary); }
}

.avatar-initial {
  background: rgba(255,255,255,0.05);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
}

/* Dialogue Script Styling */
.dialogue-script {
  background: transparent;
  padding: 0;
  margin-top: 4px; 
  text-align: left; 
  /* Fix alignment: Don't stretch */
  flex: none; 
  width: fit-content;
  max-width: 60%; /* Limit width to avoid spanning too far */
}

.script-meta {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.actor-top .script-meta { justify-content: flex-start; }
/* For bottom actor (AI), we want meta to align with the text block which is pushed right */
.actor-bottom .script-meta { justify-content: flex-start; } 

.actor-bottom .dialogue-script { 
  margin-left: auto; /* Push block to right */
  margin-right: 24px; /* Space from avatar */
}
.actor-top .dialogue-script {
  margin-right: auto;
  margin-left: 24px; /* Space from avatar */
}

.dialogue-script p {
  margin: 0;
  line-height: 1.7;
}

/* Top: Modern, Cool, Questioning */
.dialogue-script.modern p {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  font-weight: 400;
  max-width: 380px; /* Slightly narrower for more side space */
  margin-left: 0;
  margin-right: auto;
}

/* Bottom: Timeless, Warm, Answering (Letter Style) */
.dialogue-script.serif p {
  font-family: "Noto Serif SC", serif;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 0 10px rgba(255,255,255,0.1);
  letter-spacing: 0.05em;
  max-width: 380px;
  margin-left: 0; /* Align left */
  margin-right: auto;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .time-theater {
    border-radius: 20px;
    min-height: 640px; 
    /* Less intense blur on mobile for performance */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .theater-stage {
    padding: 24px 16px;
  }

  .actor-content {
    max-width: 100%;
    gap: 16px;
  }

  .dialogue-script p {
    font-size: 16px;
  }
  
  .dialogue-script.serif {
    font-size: 18px;
  }

  .thread-node::after {
    display: none; 
  }
}
.universe-section {
  background: radial-gradient(circle at center, #1B2028 0%, #0F1115 100%); /* Deep Navy/Black */
  color: white;
  position: relative;
  overflow: visible; /* Allow content (Theater) to flow naturally */
  min-height: 750px; 
  height: auto;
  /* Prevent first-child margin from collapsing outside the section (desktop-only issue) */
  padding: 1px 0 0;
}

.universe-container {
  width: 100%;
  height: 750px; /* Locked to the top section, shorter for better visibility of text */
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  margin-bottom: 0;
  pointer-events: none; /* Let clicks pass through */
  /* Strong start (0%) + Early fade-out (40-85%) to clear text area */
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 40%, transparent 85%);
  mask-image: linear-gradient(to bottom, black 0%, black 40%, transparent 85%);
}

.universe-container::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(15, 17, 21, 0) 0%,
    rgba(15, 17, 21, 0) 40%,
    rgba(15, 17, 21, 1) 85%
  );
}

@supports (-webkit-mask-image: linear-gradient(to bottom, black, transparent)) {
  .universe-container::after {
    content: none;
  }
}

@supports (mask-image: linear-gradient(to bottom, black, transparent)) {
  .universe-container::after {
    content: none;
  }
}

.universe-container canvas {
  display: block;
  outline: none;
}

.concept-text {

  text-align: center;

  max-width: 900px;

  margin: 0 auto;

  /* Lowered for better visual balance */

  margin-top: 440px; 

  position: relative;

  z-index: 20;

}

@media (min-width: 901px) {
  .concept-text {
    margin-top: 400px;
  }
}



.concept-text h2 {

  font-size: 42px;

  margin-bottom: 24px;

  background: linear-gradient(to right, #FFD54F, #FFF, #81D4FA);

  -webkit-background-clip: text;

  -webkit-text-fill-color: transparent;

  color: white;

}



.text-gold { color: #FFE082; }

.text-blue { color: #90CAF9; }



/* 0. Bridge Visualization - Balanced */

.continuum-bridge {

  height: 100px; /* Slightly shorter to compensate for lowered text */

  position: relative;

  display: flex;

  justify-content: center;

  align-items: flex-end;

  margin-top: 40px;

  margin-bottom: 0;

  z-index: 5;

}



.bridge-line {

  width: 1px;

  height: 100%;

  /* Simple elegant beam from text to theater */

  background: linear-gradient(to bottom, 

    rgba(255, 255, 255, 0) 0%, 

    rgba(255, 255, 255, 0.5) 40%, 

    rgba(255, 255, 255, 0.9) 100%

  );

  position: relative;

  box-shadow: 0 0 15px rgba(255,255,255,0.3);

}

/* Future Section */
.future-section {
  text-align: center;
  padding: 160px 0 120px;
  background: var(--ygs-bg); /* Clean finish */
}

.future-slogan {
  font-size: 28px;
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
  color: var(--ygs-primary);
  margin-top: 32px;
  /* font-style: italic; */
  opacity: 0.9;
}

/* Footer */
.footer {
  padding: 100px 0 60px;
  border-top: 1px solid var(--ygs-border);
  background-color: white;
}

@media (prefers-color-scheme: dark) {
  .footer {
    background-color: #1A1A1A;
  }
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 60px;
}

.footer-brand {
  flex: 1;
  min-width: 200px;
}

.footer-brand p {
  color: var(--ygs-text-muted);
  margin-top: 20px;
  font-size: 14px;
}

.footer-links {
  display: flex;
  gap: 80px;
}

.footer-column h4 {
  color: var(--ygs-text);
  margin-bottom: 24px;
  font-weight: 700;
  font-size: 16px;
}

.footer-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-column li {
  margin-bottom: 16px;
}

.footer-column a {
  color: var(--ygs-text-muted);
  font-size: 14px;
}

.footer-column a:hover {
  color: var(--ygs-primary);
}

/* Real Element Tooltip for selectable Email */
.contact-item {
  position: relative;
}

.email-tooltip {
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(44, 44, 44, 0.95);
  backdrop-filter: blur(10px);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, transform 0.5s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 100;
  pointer-events: auto; /* ALLOW INTERACTION */
  user-select: all; /* HELP USER SELECT TEXT EASILY */
}

.email-tooltip::before {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(44, 44, 44, 0.95);
}

.contact-item.show-tooltip .email-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.footer-bottom {
  margin-top: 80px;
  padding-top: 30px;
  border-top: 1px solid var(--ygs-border);
  text-align: center;
  font-size: 13px;
  color: var(--ygs-text-light);
}

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(253, 252, 248, 0.98);
  z-index: 999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(10px);
}

@media (prefers-color-scheme: dark) {
  .mobile-nav-overlay {
    background: rgba(18, 18, 18, 0.98);
  }
}

.mobile-nav-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 32px;
  text-align: center;
}

.mobile-nav-links a {
  font-size: 20px;
  font-weight: 600;
  color: var(--ygs-text);
  text-decoration: none;
}

.mobile-nav-links a.btn-download {
  color: white;
  margin-top: 16px;
  padding: 14px 32px;
}

/* Hamburger Toggle Button */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  z-index: 1001;
  padding: 10px;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--ygs-text);
  transition: all 0.3s ease;
}

/* Mobile Controls */
.mobile-controls {
  display: none; /* Hidden on desktop */
  align-items: center;
  gap: 16px;
}

.mobile-btn-download {
  background: var(--ygs-primary-gradient);
  color: white;
  padding: 4px 14px; /* Slimmer padding */
  border-radius: 20px;
  font-size: 12px; /* Slightly smaller text to fit more */
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(188, 59, 59, 0.2);
  white-space: nowrap;
}

/* Mobile Adjustments */
@media (max-width: 900px) {
  :root {
    --header-height: 56px;
    --section-spacing: clamp(60px, 8vw, 80px);
  }

  .container {
    padding: 0 16px;
  }

  .nav { display: none; }
  
  .mobile-controls {
    display: flex; /* Show on mobile */
  }
  
  .menu-toggle {
    display: flex; 
    padding: 0; /* Reset padding for alignment */
  }
  
  /* Animate Hamburger to X */
  .menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }
  
  .split-section, 
  .split-section.reverse {
    flex-direction: column;
    gap: 48px;
    text-align: center;
  }

  .split-section.align-start {
    align-items: center;
  }

  #ai .split-section + .split-section {
    margin-top: 64px;
  }

  .section-header {
    margin-bottom: 56px;
  }
  
  .split-text h2 {
    margin-bottom: 32px;
  }
  
  .split-text h2::after {
    margin: 20px auto; /* Center the underline */
  }
  
  .feature-point {
    padding-left: 0;
    border-left: none;
    border-top: 2px solid var(--ygs-border);
    padding-top: 20px;
    margin-bottom: 32px;
  }

  .feature-point:last-child {
    margin-bottom: 0;
  }
  
  .feature-point:hover {
    border-top-color: var(--ygs-primary);
  }
  
  .feature-point h3 {
    justify-content: center;
  }
  
  .concept-grid {
    grid-template-columns: 1fr;
    margin-top: 48px;
  }
  
  .hero {
    padding-top: 140px;
    padding-bottom: 96px;
  }

  .hero h1 {
    margin-bottom: 24px;
  }

  .hero p {
    margin: 0 auto 44px;
  }

  .hero--home h1 {
    margin-bottom: 28px;
  }

  .hero--home p {
    margin: 0 auto 64px;
  }

  .scenario-section {
    padding: 24px 0;
  }

  .future-section {
    padding: calc(var(--section-spacing) + 24px) 0 calc(var(--section-spacing) + 8px);
  }

  .future-section .section-header {
    margin-bottom: 0;
  }

  .future-slogan {
    margin-top: 24px;
  }

  .footer {
    padding: calc(var(--section-spacing) + 12px) 0 40px;
  }

  .footer-inner {
    gap: 40px;
  }

  .footer-bottom {
    margin-top: 48px;
    padding-top: 24px;
  }
  
  .footer-links {
    gap: 40px;
    width: 100%;
    justify-content: space-around;
  }

  /* MOBILE VIDEO OPTIMIZATION */
  .video-placeholder {
    aspect-ratio: 16 / 9; /* More height on mobile */
    margin-top: 32px;
  }
  
  .play-icon {
    width: 56px;
    height: 56px;
  }

  /* MOBILE UNIVERSE OPTIMIZATION */
  .universe-section {
    padding: 32px 0 80px;
  }
  
    .universe-container {
      height: 1100px; /* Taller on mobile for Stardust Waterfall */
      margin-bottom: 0;
    }
  .concept-text h2 {
    font-size: 28px;
  }
  
  .concept-text p {
    font-size: 15px; /* Smaller on mobile to prevent bad breaks */
    line-height: 1.6;
    padding: 0 20px; /* Ensure padding doesn't squeeze text too much */
  }

/* Animation utilities */
.reveal {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity 650ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 650ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform, opacity;
}

.reveal.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

}

/* Reduced motion: avoid scroll-based entrance animations. */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
    will-change: auto;
  }
}

/* 3D Overlay Labels */
.node-label-3d {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  transition: opacity 0.3s;
  white-space: nowrap;
}

.node-label-3d .main {
  display: block;
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
  font-size: 14px;
}

.node-label-3d .sub {
  display: block;
  font-size: 10px;
  margin-top: 2px;
  opacity: 0.8;
}

.node-label-core .main { font-size: 20px; color: white; }
.node-label-vertical .main { color: #FFD54F; }
.node-label-horizontal .main { color: #81D4FA; }

/* Special prominence for 'Me' */
.node-me-active .main {
  font-size: 18px;
  color: #FFD54F; /* Force Gold color */
}
.node-me-active .sub {
  font-size: 12px;
  color: #FFD54F;
}
