/* ═══════════════════════════════════════════════════════════════════
   Sunday — Landing Page Stylesheet
   Design System derived from the iOS app.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ─────────────────────────────────────── */
:root {
  --bg-color: #000000;
  --accent-color: #FFFFFF;
  --accent-rgb: 255, 255, 255;
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.4);
  --surface-1: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.08);
  --surface-3: rgba(255, 255, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.12);
  --btn-text: #000000;
  --user-bubble-text: #000000;
}

/* ─── Background Themes ─────────────────────────────────────────── */
[data-bg="black"]  { --bg-color: #000000; }
[data-bg="slate"]  { --bg-color: rgb(28, 28, 36); }
[data-bg="navy"]   { --bg-color: rgb(13, 20, 38); }
[data-bg="plum"]   { --bg-color: rgb(31, 15, 38); }
[data-bg="pink"]   { --bg-color: rgb(64, 20, 41); }

/* ─── Accent Colors ─────────────────────────────────────────────── */
[data-accent="mono"] {
  --accent-color: #FFFFFF;
  --accent-rgb: 255, 255, 255;
  --btn-text: #000;
  --user-bubble-text: #000;
}
[data-accent="blue"] {
  --accent-color: #007AFF;
  --accent-rgb: 0, 122, 255;
  --btn-text: #fff;
  --user-bubble-text: #fff;
}
[data-accent="pink"] {
  --accent-color: #FF2D55;
  --accent-rgb: 255, 45, 85;
  --btn-text: #fff;
  --user-bubble-text: #fff;
}
[data-accent="purple"] {
  --accent-color: #AF52DE;
  --accent-rgb: 175, 82, 222;
  --btn-text: #fff;
  --user-bubble-text: #fff;
}
[data-accent="green"] {
  --accent-color: #34C759;
  --accent-rgb: 52, 199, 89;
  --btn-text: #000;
  --user-bubble-text: #000;
}
[data-accent="orange"] {
  --accent-color: #FF9500;
  --accent-rgb: 255, 149, 0;
  --btn-text: #000;
  --user-bubble-text: #000;
}

/* ═══════════════════════════════════════════════════════════════════
   1. GLOBAL RESET & BASE
   ═══════════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: -apple-system-body, BlinkMacSystemFont, "SF Pro Rounded", "SF Pro Text", "Inter", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.6s ease;
}

/* Ambient background — theme-aware accent glow over the black, with a faint blurred app image
   for depth. Sits behind all content. */
.bg-ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 55% at 50% -8%, rgba(var(--accent-rgb), 0.14), transparent 65%),
    radial-gradient(ellipse 70% 45% at 85% 12%, rgba(var(--accent-rgb), 0.06), transparent 70%);
  transition: background 0.6s ease;
}
.bg-ambient::after {
  content: "";
  position: absolute;
  inset: -10%;
  background: url("screenshots/7.png") center 22% / cover no-repeat;
  filter: blur(130px) saturate(1.6) brightness(0.6);
  opacity: 0.18;
}

section {
  padding: 100px 0;
  position: relative;
  z-index: 0;
}

.section-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

.section-title {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 48px;
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════
   2. THEME SWITCHER
   ═══════════════════════════════════════════════════════════════════ */
#theme-switcher {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle-btn:hover {
  background: var(--surface-3);
}

.theme-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 240px;
  background: var(--surface-1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.theme-panel.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.theme-section {
  margin-bottom: 14px;
}

.theme-section:last-child {
  margin-bottom: 0;
}

.theme-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.theme-colors {
  display: flex;
  gap: 6px;
}

.color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
  padding: 0;
  outline: none;
}

.color-dot:hover {
  transform: scale(1.08);
}

.app-logo {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app-logo-glow {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 26px;
  background: var(--accent-color);
  opacity: 0.16;
  filter: blur(18px);
  animation: appIconGlowPulse 2s ease-in-out infinite alternate;
}

.app-logo-img {
  width: 120px;
  height: 120px;
  border-radius: 26px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  animation: appIconBreathe 2s ease-in-out infinite alternate;
}

.cta-logo {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cta-logo-glow {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 26px;
  background: var(--accent-color);
  opacity: 0.16;
  filter: blur(18px);
  animation: appIconGlowPulse 2s ease-in-out infinite alternate;
}

.cta-logo-img {
  width: 120px;
  height: 120px;
  border-radius: 26px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  animation: appIconBreathe 2s ease-in-out infinite alternate;
}

@keyframes appIconGlowPulse {
  0% { transform: scale(0.92); opacity: 0.12; }
  100% { transform: scale(1.14); opacity: 0.20; }
}

@keyframes appIconBreathe {
  0% { transform: scale(0.95); }
  100% { transform: scale(1.05); }
}

/* App-native Typography & Scaling (matching LoadingView/app scales) */
.hero-title {
  font-family: -apple-system-headline, BlinkMacSystemFont, "SF Pro Rounded", system-ui, sans-serif;
  font-size: 3.25rem; /* ~52px (exactly 2x scaled loading screen) */
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 2.4px; /* exact tracking scaled */
  text-transform: none;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-family: -apple-system-subheadline, BlinkMacSystemFont, "SF Pro Rounded", system-ui, sans-serif;
  font-size: 1.75rem; /* ~28px (exactly 2x scaled loading status) */
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55); /* loadingStatus default opacity */
  margin-bottom: 12px;
  max-width: 600px;
}

.hero-specs {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 36px;
}

.full-width-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 280px;
}
.color-dot.active {
  border-color: #ffffff;
  transform: scale(1.1);
}

.theme-backgrounds {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.bg-option {
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  font-family: inherit;
}

.bg-option:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.bg-option.active {
  background: rgba(var(--accent-rgb), 0.2);
  color: var(--accent-color);
  border-color: rgba(var(--accent-rgb), 0.3);
}

/* ═══════════════════════════════════════════════════════════════════
   3. HERO
   ═══════════════════════════════════════════════════════════════════ */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 0;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Sun Logo (based on LoadingView.swift) */
.sun-logo {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 32px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sun-logo.small {
  margin: 0 auto 16px;
  transform: scale(0.48);
  transform-origin: center center;
  width: 150px;
  height: 150px;
}

.sun-logo.mini {
  margin: 0;
  transform: scale(0.16);
  transform-origin: center center;
  width: 150px;
  height: 150px;
}

.sun-glow {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--accent-color);
  opacity: 0.14;
  filter: blur(18px);
  animation: sunGlowPulse 1.6s ease-in-out infinite alternate;
}

.sun-rays-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  animation: sunRayBreathe 1.6s ease-in-out infinite alternate;
}

.sun-rays {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  animation: sunRaySpin 3.5s linear infinite;
}

.ray {
  position: absolute;
  width: 4px;
  border-radius: 2px;
  background: var(--accent-color);
  left: calc(50% - 2px);
  transform-origin: center center;
}

.ray.even {
  height: 18px;
  top: calc(50% - 9px);
  opacity: 0.95;
}

.ray.odd {
  height: 11px;
  top: calc(50% - 5.5px);
  opacity: 0.4;
}

.sun-core {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-color) 0%, rgba(var(--accent-rgb), 0.6) 100%);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.55);
  animation: sunCoreBreathe 1.6s ease-in-out infinite alternate;
  top: calc(50% - 27px);
  left: calc(50% - 27px);
}

@keyframes sunGlowPulse {
  0% { transform: scale(0.9); opacity: 0.10; }
  100% { transform: scale(1.18); opacity: 0.18; }
}

@keyframes sunRayBreathe {
  0% { transform: scale(0.97); }
  100% { transform: scale(1.06); }
}

@keyframes sunRaySpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes sunCoreBreathe {
  0% { transform: scale(0.94); }
  100% { transform: scale(1.1); }
}

.hero-title {
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 16px;
  background: linear-gradient(
    180deg,
    var(--accent-color) 0%,
    rgba(var(--accent-rgb), 0.6) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.4rem;
  color: var(--text-secondary);
  font-weight: 300;
  margin-bottom: 8px;
  max-width: 500px;
}

.hero-specs {
  font-size: 0.8rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-color);
  color: var(--btn-text);
  padding: 12px 24px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

.btn-primary:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 32px rgba(var(--accent-rgb), 0.35);
}

.btn-primary.large {
  padding: 16px 32px;
  font-size: 1.05rem;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border-medium);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

/* Hero Screenshot */
.hero-screenshot {
  max-width: 300px;
  width: 100%;
  margin: 52px auto 0;
}

/* iPhone-style bezel around real device screenshots */
.phone-frame {
  position: relative;
  border-radius: 42px;
  background: #000;
  border: 2px solid rgba(255, 255, 255, 0.12);
  padding: 5px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.phone-frame img {
  display: block;
  width: 100%;
  border-radius: 37px;
}
.phone-frame:hover {
  transform: translateY(-6px);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.6);
}

/* Screenshot gallery — responsive grid of real device captures */
.screenshot-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 28px;
  max-width: 1040px;
  margin: 0 auto;
}
@media (max-width: 640px) {
  .screenshot-showcase { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

.screenshot-placeholder {
  border: 1.5px dashed var(--border-subtle);
  border-radius: 20px;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
  min-height: 200px;
}

/* ═══════════════════════════════════════════════════════════════════
   4. STORY FLOW — each screenshot becomes a full-bleed background
   The app's own pure-black canvas merges with the page, so each
   screenshot reads as the site background; copy floats in the empty space.
   ═══════════════════════════════════════════════════════════════════ */
.story-flow {
  position: relative;
}

.story {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 4vw, 80px);
  overflow: hidden;
}

/* Blurred full-bleed backdrop drawn from the SAME screenshot (via the --shot
   variable set per section). This fills the whole viewport so there's no dead
   space down the middle — the sharp screenshot then sits on top of it. */
.story::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--shot);
  background-size: cover;
  background-position: center;
  filter: blur(90px) saturate(1.6) brightness(0.5);
  transform: scale(1.3);
  z-index: 0;
}

/* Directional contrast scrim — darkest on the copy side, fading toward the
   screenshot, so text stays legible and the composition reads as one image. */
.story::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.62) 42%, rgba(0,0,0,0.15) 78%, rgba(0,0,0,0.35) 100%);
}

.story:nth-of-type(even)::after {
  background: linear-gradient(270deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.62) 42%, rgba(0,0,0,0.15) 78%, rgba(0,0,0,0.35) 100%);
}

/* The sharp screenshot and the copy sit together as a centred pair; the
   blurred backdrop fills everything around them, so there's no dead middle.
   They alternate order left/right as you scroll. */
.story-shot {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  order: 2;
  z-index: 2;
  pointer-events: none;
}

.story-shot img {
  height: 90vh;
  width: auto;
  display: block;
  border-radius: 34px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7);
}

/* A soft accent halo behind the screenshot so it feels lit into the page,
   not pasted onto it. */
.story-shot::before {
  content: "";
  position: absolute;
  inset: 6% -12%;
  background: radial-gradient(ellipse at center, rgba(var(--accent-rgb), 0.14), transparent 66%);
  filter: blur(44px);
  z-index: -1;
}

.story-copy {
  position: relative;
  flex: 0 1 420px;
  order: 1;
  z-index: 3;
  padding: 0 clamp(20px, 3vw, 48px);
}

/* Even sections flip the pair: copy on the right, screenshot on the left. */
.story:nth-of-type(even) .story-shot { order: 1; }
.story:nth-of-type(even) .story-copy { order: 2; }

.story-kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-color);
  margin-bottom: 18px;
}

.story-copy h2 {
  font-size: 2.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 18px;
  color: var(--text-primary);
}

.story-copy p {
  font-size: 1.12rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* Scroll reveal — screenshot and copy ease in as the section enters view */
.story .story-shot,
.story .story-copy {
  opacity: 0;
  transform: translateY(42px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.story.in-view .story-shot {
  opacity: 1;
  transform: translateY(0);
}

.story.in-view .story-copy {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.12s;
}

/* ═══════════════════════════════════════════════════════════════════
   5. SANDBOX
   ═══════════════════════════════════════════════════════════════════ */
.sandbox-container {
  display: flex;
  gap: 24px;
}

/* ─── Settings Panel ────────────────────────────────────────────── */
.sandbox-settings {
  width: 320px;
  flex-shrink: 0;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px;
  max-height: 600px;
  overflow-y: auto;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-section {
  margin-bottom: 20px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section-header {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.settings-row-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.settings-row-value {
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 500;
}

.settings-row-caption {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 6px;
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-color);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* Select */
.settings-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 32px 8px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.4)' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.settings-select:focus {
  border-color: var(--accent-color);
}

.settings-select option {
  background: #1a1a1a;
  color: var(--text-primary);
}

/* Sliders */
.settings-slider-group {
  margin-top: 12px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.slider-value {
  font-size: 0.82rem;
  color: var(--accent-color);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-3);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.5);
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-color);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.5);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--surface-3);
  border-radius: 4px;
}

/* Search Mode */
.search-mode-group {
  display: flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
}

.search-mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.search-mode-btn:hover {
  color: var(--text-primary);
}

.search-mode-btn.active {
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent-color);
}

/* ═══════════════════════════════════════════════════════════════════
   6. CHAT PANEL
   ═══════════════════════════════════════════════════════════════════ */
.sandbox-chat {
  flex: 1;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  min-height: 550px;
  max-height: 600px;
}

.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-back-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  border: none;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.chat-back-btn:hover {
  background: var(--surface-3);
}

.chat-title-group {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: default;
  padding: 0 8px;
}

.chat-title-text {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.chat-title-group svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.chat-header-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-2);
  border-radius: 20px;
  padding: 4px;
  flex-shrink: 0;
}

.pill-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.pill-icon-btn {
  cursor: pointer;
  transition: color 0.2s ease;
}

.pill-icon-btn.active {
  color: var(--accent-color);
}

.stop-btn {
  color: rgba(255, 59, 48, 0.85);
}

.stop-btn[hidden] {
  display: none;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 60px;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
}

.welcome-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-icon-img {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.chat-welcome p {
  font-size: 0.88rem;
}

/* Message Bubbles */
/* Exact message bubbles from MessageBubbleView.swift */
.message-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  width: 100%;
  margin-bottom: 14px;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.assistant {
  justify-content: flex-start;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  margin-bottom: 18px; /* Offset spacing matching meta text height */
}

.message-avatar svg {
  width: 12px;
  height: 12px;
}

.message-container {
  display: flex;
  flex-direction: column;
  max-width: calc(100% - 48px - 28px);
}

.message-container.user {
  align-items: flex-end;
  max-width: calc(100% - 48px);
}

.message-container.assistant {
  align-items: flex-start;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 18px; /* cornerRadius: 18, style: .continuous */
  font-size: 15px; /* font size 15 */
  line-height: 1.45;
  word-wrap: break-word;
  word-break: break-word;
  animation: fadeInUp 0.3s ease forwards;
}

.message-bubble.user {
  background: var(--accent-color);
  color: var(--user-bubble-text);
}

.message-bubble.assistant {
  background: rgba(255, 255, 255, 0.08); /* white.opacity(0.08) */
  color: #ffffff; /* white */
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px; /* size: 10 */
  color: rgba(255, 255, 255, 0.3); /* white.opacity(0.3) */
  margin-top: 4px;
  padding: 0 4px;
}

.speak-btn {
  background: none;
  border: none;
  padding: 0;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 11px;
  transition: color 0.2s ease;
}

.speak-btn:hover {
  color: #ffffff;
}

/* Thinking Process View (SwiftUI exact) */
.thinking-container {
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}

.thinking-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08); /* white.opacity(0.08) */
  border: none;
  border-radius: 9999px; /* Capsule */
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5); /* white.opacity(0.5) */
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  outline: none;
}

.thinking-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.thinking-toggle-btn svg {
  width: 12px;
  height: 12px;
}

.thinking-content {
  display: none;
  width: 100%;
  max-width: 320px;
  background: rgba(255, 255, 255, 0.04); /* white.opacity(0.04) */
  border: 1px solid rgba(255, 255, 255, 0.08); /* white.opacity(0.08) */
  border-radius: 12px; /* cornerRadius: 12 */
  padding: 12px;
  margin-top: 6px;
  box-sizing: border-box;
}

.thinking-content.expanded {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.thinking-round {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.thinking-round-label {
  font-size: 9px; /* size: 9 */
  font-weight: 700;
  color: rgba(255, 255, 255, 0.3); /* white.opacity(0.3) */
  letter-spacing: 0.5px; /* tracking(0.5) */
  text-transform: uppercase;
}

.thinking-round-text {
  font-size: 13px; /* size: 13 */
  color: rgba(255, 255, 255, 0.7); /* white.opacity(0.7) */
  line-height: 1.4;
}

.thinking-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1); /* white.opacity(0.1) */
  margin: 2px 0;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px 16px;
  border-radius: 18px;
  width: fit-content;
  margin-bottom: 12px;
}

.typing-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* Status Messages */
.status-message {
  align-self: center;
  background: rgba(var(--accent-rgb), 0.08);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.72rem;
  color: var(--accent-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(var(--accent-rgb), 0.2);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── Chat Input ────────────────────────────────────────────────── */
.chat-input-area {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-subtle);
}

.suggestion-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 10px;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.suggestion-chips::-webkit-scrollbar {
  display: none;
}

.suggestion-chips.hidden {
  display: none;
}

.chip {
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.chip:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

/* Two-row input matching the app: attachment icons on top, message + send below */
.chat-attach-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.attach-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: default;
}

.chat-input-bar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-text-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 11px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-text-input::placeholder {
  color: var(--text-muted);
}

.chat-text-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-color);
  color: var(--btn-text);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.chat-send-btn:hover {
  transform: scale(1.05);
}

.chat-send-btn.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* While generating, the send button turns into a grey stop button (ChatView.swift) */
.chat-send-btn.generating {
  background: var(--surface-3);
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════
   7. PERSONAS
   ═══════════════════════════════════════════════════════════════════ */
.personas-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.persona-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.persona-card:hover {
  background: var(--surface-2);
  transform: translateY(-2px);
}

.persona-card.selected {
  border-color: var(--accent-color);
  background: rgba(var(--accent-rgb), 0.08);
}

.persona-emoji {
  font-size: 2rem;
  margin-bottom: 10px;
  line-height: 1;
}

.persona-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.persona-card p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════
   8. GALLERY
   ═══════════════════════════════════════════════════════════════════ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.gallery-slot {
  aspect-ratio: 9 / 19;
}

.gallery-slot .screenshot-placeholder {
  height: 100%;
  min-height: unset;
}

.video-slots {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

.video-slot {
  flex: 1;
}

.video-slot .screenshot-placeholder {
  height: 100%;
  min-height: unset;
}

/* ═══════════════════════════════════════════════════════════════════
   9. CTA
   ═══════════════════════════════════════════════════════════════════ */
.cta {
  padding: 120px 0;
}

.cta-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}



.cta-title {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.cta-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

/* ═══════════════════════════════════════════════════════════════════
   10. FOOTER
   ═══════════════════════════════════════════════════════════════════ */
.footer {
  padding: 24px 0;
  border-top: 1px solid var(--border-subtle);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-brand {
  font-weight: 700;
  color: var(--text-primary);
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-right {
  display: flex;
  gap: 24px;
}

.footer-right a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

.footer-right a:hover {
  color: var(--accent-color);
}

/* ═══════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════ */
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}

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

@keyframes breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.08); }
}

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

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ─── Scroll Fade-In ────────────────────────────────────────────── */
.fade-in-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Streaming Cursor ──────────────────────────────────────────── */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent-color);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--surface-2);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) var(--surface-2);
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

/* ─── ≤ 1024px ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .story {
    gap: clamp(16px, 3vw, 48px);
  }

  .story-shot img {
    height: 82vh;
  }

  .story-copy {
    flex-basis: 340px;
  }

  .story-copy h2 {
    font-size: 2.1rem;
  }

  .personas-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .sandbox-container {
    flex-direction: column;
  }

  .sandbox-settings {
    width: 100%;
    max-height: none;
  }

  .sandbox-chat {
    max-height: 600px;
  }
}

/* ─── ≤ 768px ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-title {
    font-size: 3.5rem;
  }

  .section-title {
    font-size: 2rem;
  }

  /* Screenshot fills the viewport as a real background; copy sits over the
     empty top area behind a downward scrim (keeps clear of the keyboards
     at the bottom of the chat shots). */
  .story {
    min-height: 100vh;
    display: block;
  }

  .story-shot,
  .story:nth-of-type(odd) .story-shot,
  .story:nth-of-type(even) .story-shot {
    left: 0;
    right: 0;
    justify-content: center;
  }

  .story-shot img {
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }

  .story-shot::before {
    display: none;
  }

  /* The desktop directional scrim would darken one side of the phone; on mobile
     the copy sits at the top with its own downward scrim instead. */
  .story::after {
    display: none;
  }

  .story-copy,
  .story:nth-of-type(odd) .story-copy,
  .story:nth-of-type(even) .story-copy {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    margin: 0;
    padding: calc(env(safe-area-inset-top, 0px) + 7vh) 22px 12vh;
    text-align: center;
  }

  .story-copy::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.92) 42%, rgba(0, 0, 0, 0.55) 68%, transparent);
  }

  .story-copy h2 {
    font-size: 1.85rem;
  }

  .story-copy p {
    font-size: 1rem;
    max-width: 420px;
    margin: 0 auto;
  }

  .personas-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  section {
    padding: 60px 0;
  }

  .section-container {
    padding: 0 20px;
  }

  .hero-cta {
    flex-direction: column;
    gap: 12px;
  }

  .hero-subtitle {
    font-size: 1.15rem;
  }

  .footer-content {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .footer-left {
    flex-direction: column;
    gap: 6px;
  }

  .video-slots {
    flex-direction: column;
  }

  .cta {
    padding: 80px 0;
  }

  .cta-title {
    font-size: 2rem;
  }
}

/* ─── ≤ 480px ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .hero-title {
    font-size: 2.8rem;
  }

  .personas-grid {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .sun-logo {
    transform: scale(0.68);
    transform-origin: center center;
    margin-bottom: 0px;
    height: 102px;
  }

  .hero-specs {
    font-size: 0.7rem;
  }

  .section-title {
    font-size: 1.7rem;
  }
}

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

  .sun-glow,
  .sun-rays-container,
  .sun-rays,
  .sun-core,
  .typing-dot,
  .status-spinner,
  .streaming-cursor {
    animation: none !important;
  }

  .fade-in-section {
    opacity: 1;
    transform: none;
  }

  .story .story-shot,
  .story .story-copy {
    opacity: 1;
    transform: none;
  }
}
