/* ==========================================================================
   Rewake Design System — Warm Mineral & Pine
   Tokens mirrored from Android theme (Color.kt, Type.kt, RewakePrimitives.kt)
   ========================================================================== */

:root {
  color-scheme: dark light;

  /* Dark Appearance (Default) */
  --canvas: #0C0E0D;
  --surface-1: #151816;
  --surface-2: #1E2320;
  --surface-3: #252B28;
  --frosted-glass: rgba(12, 14, 13, 0.78);
  --backdrop-scrim: rgba(0, 0, 0, 0.68);
  --feed-scrim: rgba(12, 14, 13, 0.78);

  --accent: #1F6343;
  --accent-hover: #287551;
  --on-accent: #F5F6F4;
  --accent-fg: #4EA87E;
  --accent-subtle: rgba(31, 99, 67, 0.22);

  --warning: #D97E68;
  --warning-solid: #A64B37;
  --warning-subtle: rgba(217, 126, 104, 0.17);

  --text-primary: #F3F4F1;
  --text-secondary: #A6AFA9;
  --text-tertiary: #828C86;

  --border-highlight: rgba(255, 255, 255, 0.10);
  --border-standard: rgba(255, 255, 255, 0.055);
  --divider: rgba(255, 255, 255, 0.065);

  --neutral-bar: #282E2B;
  --switch-thumb-on: #F5F6F4;
  --platform-bar-1: #4EA87E;
  --platform-bar-2: #7B9387;

  --phone-rim: rgba(255, 255, 255, 0.14);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-phone: 0 24px 60px rgba(0, 0, 0, 0.48);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.56);

  /* Layout & Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --container-max: 1120px;
  --header-height: 60px;
  --section-gap: clamp(72px, 9vw, 112px);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --canvas: #F5F4F0;
    --surface-1: #FFFFFF;
    --surface-2: #ECEAE3;
    --surface-3: #E2DFD6;
    --frosted-glass: rgba(245, 244, 240, 0.84);
    --backdrop-scrim: rgba(16, 21, 18, 0.36);
    --feed-scrim: rgba(16, 21, 18, 0.44);

    --accent: #1A5338;
    --accent-hover: #226847;
    --on-accent: #FFFFFF;
    --accent-fg: #174C33;
    --accent-subtle: rgba(26, 83, 56, 0.10);

    --warning: #AE4A36;
    --warning-solid: #AE4A36;
    --warning-subtle: rgba(174, 74, 54, 0.10);

    --text-primary: #141715;
    --text-secondary: #4F5852;
    --text-tertiary: #5F6862;

    --border-highlight: rgba(20, 26, 22, 0.10);
    --border-standard: rgba(20, 26, 22, 0.065);
    --divider: rgba(20, 26, 22, 0.075);

    --neutral-bar: #DAD8D0;
    --switch-thumb-on: #FFFFFF;
    --platform-bar-1: #1A5338;
    --platform-bar-2: #5B7366;

    --phone-rim: rgba(20, 26, 22, 0.16);
    --shadow-card: 0 1px 3px rgba(20, 26, 22, 0.04), 0 6px 20px rgba(20, 26, 22, 0.03);
    --shadow-phone: 0 22px 54px rgba(20, 26, 22, 0.14);
    --shadow-modal: 0 22px 56px rgba(20, 26, 22, 0.18);
  }
}

[data-theme="light"] {
  color-scheme: light;
  --canvas: #F5F4F0;
  --surface-1: #FFFFFF;
  --surface-2: #ECEAE3;
  --surface-3: #E2DFD6;
  --frosted-glass: rgba(245, 244, 240, 0.84);
  --backdrop-scrim: rgba(16, 21, 18, 0.36);
  --feed-scrim: rgba(16, 21, 18, 0.44);

  --accent: #1A5338;
  --accent-hover: #226847;
  --on-accent: #FFFFFF;
  --accent-fg: #174C33;
  --accent-subtle: rgba(26, 83, 56, 0.10);

  --warning: #AE4A36;
  --warning-solid: #AE4A36;
  --warning-subtle: rgba(174, 74, 54, 0.10);

  --text-primary: #141715;
  --text-secondary: #4F5852;
  --text-tertiary: #5F6862;

  --border-highlight: rgba(20, 26, 22, 0.10);
  --border-standard: rgba(20, 26, 22, 0.065);
  --divider: rgba(20, 26, 22, 0.075);

  --neutral-bar: #DAD8D0;
  --switch-thumb-on: #FFFFFF;
  --platform-bar-1: #1A5338;
  --platform-bar-2: #5B7366;

  --phone-rim: rgba(20, 26, 22, 0.16);
  --shadow-card: 0 1px 3px rgba(20, 26, 22, 0.04), 0 6px 20px rgba(20, 26, 22, 0.03);
  --shadow-phone: 0 22px 54px rgba(20, 26, 22, 0.14);
  --shadow-modal: 0 22px 56px rgba(20, 26, 22, 0.18);
}

[data-theme="dark"] {
  color-scheme: dark;
}

@media (prefers-contrast: more) {
  :root {
    --text-secondary: #C4CCC7;
    --text-tertiary: #A6AFA9;
    --border-standard: rgba(255, 255, 255, 0.22);
    --border-highlight: rgba(255, 255, 255, 0.34);
    --divider: rgba(255, 255, 255, 0.22);
  }

  [data-theme="light"] {
    --text-secondary: #363D38;
    --text-tertiary: #424B45;
    --border-standard: rgba(20, 26, 22, 0.22);
    --border-highlight: rgba(20, 26, 22, 0.34);
    --divider: rgba(20, 26, 22, 0.22);
  }
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 28px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-primary);
  background-color: var(--canvas);
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

h1, h2, h3, h4, p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--accent-fg);
  outline-offset: 3px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

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

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 999;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 14px;
}

.skip-link:focus {
  top: 16px;
}

/* ==========================================================================
   Shared Primitives (Architectural Surfaces, Badges, Buttons)
   ========================================================================== */

.card {
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  border: 1px solid var(--border-standard);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-standard);
  flex-shrink: 0;
}

.icon-tile--accent {
  background: var(--accent-subtle);
  color: var(--accent-fg);
  border-color: transparent;
}

.micro-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  background: var(--surface-2);
  color: var(--text-secondary);
  white-space: nowrap;
}

.micro-badge--accent {
  background: var(--accent-subtle);
  color: var(--accent-fg);
}

.micro-badge--warning {
  background: var(--warning-subtle);
  color: var(--warning);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  transition: background-color 0.16s ease, transform 0.12s ease, border-color 0.16s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.985);
}

.btn--sm {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-highlight);
}

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

.btn--text {
  padding-left: 12px;
  padding-right: 12px;
  color: var(--text-secondary);
}

.btn--text:hover {
  color: var(--text-primary);
  background: var(--surface-2);
}

.inline-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-fg);
}

.inline-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ==========================================================================
   Sticky Translucent Navigation (Functional Layer Only)
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--frosted-glass);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid var(--divider);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #1A1A1A;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px;
  flex-shrink: 0;
}

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

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--text-primary);
  background: var(--surface-2);
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-moon {
    display: none;
  }

  :root:not([data-theme="dark"]) .theme-toggle .icon-sun {
    display: block;
  }
}

/* ==========================================================================
   Hero Section & Interactive Tap Demo
   ========================================================================== */

.hero {
  padding: clamp(38px, 6vw, 72px) 0 clamp(24px, 4vw, 44px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.early-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--accent-fg);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 18px;
}

.hero-title {
  font-size: clamp(2.1rem, 4.2vw, 3.2rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.032em;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: clamp(1rem, 1.35vw, 1.12rem);
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 48ch;
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.hero-meta {
  font-size: 13px;
  color: var(--text-tertiary);
}

.hero-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hero-phone {
  width: 100%;
  max-width: 262px;
  padding: 5px;
  border-radius: 32px;
  background: #121513;
  border: 1px solid var(--phone-rim);
  box-shadow: var(--shadow-phone);
}

.hero-phone-screen {
  width: 100%;
  aspect-ratio: 9 / 19;
  overflow: hidden;
  border-radius: 27px;
  background: var(--canvas);
  border: 1px solid var(--border-standard);
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
}

.phone-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 0 4px 10px;
}

.phone-camera {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #070807;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-fg);
  flex-shrink: 0;
}

/* Interactive Feed & Rewake Math Quest Demo (Tap-based, page-scroll safe) */
.feed-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 20px;
  background: var(--canvas);
  touch-action: pan-y;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.feed-stage.is-popup-open {
  cursor: default;
}

.feed-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
  will-change: transform;
}

.feed-track.is-animating {
  transition: transform 360ms cubic-bezier(0.16, 1.0, 0.30, 1.0);
}

.feed-track.is-snapping {
  transition: transform 220ms cubic-bezier(0.16, 1.0, 0.30, 1.0);
}

.feed-card {
  position: relative;
  height: 324px;
  flex-shrink: 0;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border-standard);
  overflow: hidden;
}

.feed-card-actions {
  position: absolute;
  right: 12px;
  bottom: 50px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-card-actions span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--neutral-bar);
}

.feed-card-meta {
  position: absolute;
  left: 14px;
  right: 52px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.feed-skel-title {
  width: 58%;
  height: 9px;
  border-radius: 5px;
  background: var(--neutral-bar);
}

.feed-skel-sub {
  width: 34%;
  height: 7px;
  border-radius: 4px;
  background: var(--neutral-bar);
  opacity: 0.65;
}

.feed-card-progress {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 10px;
  height: 3px;
  border-radius: 999px;
  background: var(--divider);
  overflow: hidden;
}

.feed-card-progress::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent-fg);
  opacity: 0.55;
  transform-origin: left center;
  animation: feedPlayBar 3.6s linear infinite;
}

.feed-stage.is-popup-open .feed-card-progress::after {
  animation-play-state: paused;
}

@keyframes feedPlayBar {
  from { transform: scaleX(0.08); }
  to { transform: scaleX(1); }
}

.feed-timer-pill {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: none;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-1);
  border: 1px solid var(--border-highlight);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  white-space: nowrap;
}

.feed-timer-pill.is-visible {
  display: inline-flex;
}

.feed-reset-chip {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.feed-reset-chip:hover {
  color: var(--text-primary);
}

.feed-swipe-btn {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-card);
  white-space: nowrap;
  transition: opacity 180ms ease, transform 120ms ease, background-color 160ms ease;
}

.feed-swipe-btn:hover {
  background: var(--accent-hover);
}

.feed-swipe-btn:active {
  transform: translateX(-50%) scale(0.97);
}

.feed-stage.is-popup-open .feed-swipe-btn {
  opacity: 0;
  pointer-events: none;
}

.feed-swipe-btn.is-unlocked {
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border-highlight);
  min-height: 36px;
  padding: 7px 14px;
  font-size: 12px;
}

.feed-swipe-btn.is-unlocked:hover {
  background: var(--surface-2);
}

/* Rewake Overlay Scrim & Card (OverlayTransitions.kt timings) */
.feed-scrim {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: var(--feed-scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms cubic-bezier(0.40, 0.0, 0.20, 1.0);
}

.feed-stage.is-popup-open .feed-scrim {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 560ms cubic-bezier(0.22, 1.0, 0.36, 1.0);
}

.feed-popup {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 12px;
  z-index: 6;
  padding: 18px 16px 14px;
  border-radius: 24px;
  background: var(--surface-1);
  border: 1px solid var(--border-highlight);
  box-shadow: var(--shadow-modal);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 26px, 0) scale(0.95);
  transition:
    opacity 240ms cubic-bezier(0.40, 0.0, 1.0, 1.0),
    transform 240ms cubic-bezier(0.40, 0.0, 1.0, 1.0);
}

.feed-stage.is-popup-open .feed-popup {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
  transition:
    opacity 420ms cubic-bezier(0.16, 1.0, 0.30, 1.0) 60ms,
    transform 420ms cubic-bezier(0.16, 1.0, 0.30, 1.0) 60ms;
}

.popup-view {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.popup-view.is-active {
  display: flex;
}

.popup-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent-fg);
}

.popup-title {
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.popup-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.popup-task-box {
  width: 100%;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-standard);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.popup-task-box.is-error {
  border-color: var(--warning);
  background: var(--warning-subtle);
}

.popup-equation {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.popup-error {
  min-height: 16px;
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--warning);
}

.popup-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.choice-btn {
  min-height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-highlight);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  transition: background-color 140ms ease, border-color 140ms ease, transform 100ms ease;
}

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

.choice-btn:active {
  transform: scale(0.97);
}

.choice-btn.is-wrong {
  background: var(--warning-subtle);
  border-color: var(--warning);
  color: var(--warning);
}

.popup-link-btn {
  width: 100%;
  min-height: 38px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.popup-link-btn:hover {
  color: var(--text-primary);
  background: var(--surface-2);
}

.hero-stage-caption {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

/* Segmented Control (Shared between Hero Phone Switcher & Features) */
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-standard);
  gap: 2px;
}

.segmented--full {
  display: grid;
  width: 100%;
}

.segmented-btn {
  padding: 7px 12px;
  min-height: 36px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

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

.segmented-btn.is-active {
  background: var(--surface-1);
  color: var(--text-primary);
  font-weight: 600;
  border: 1px solid var(--border-standard);
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  padding: var(--section-gap) 0 0;
}

.section-head {
  max-width: 560px;
  margin-bottom: 32px;
}

.section-title {
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.028em;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   2. Core Pillars (3-Column Row)
   ========================================================================== */

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.pillar-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pillar-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.pillar-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ==========================================================================
   3. Interactive Popup Types Showcase (6 Real Android Overlays + Video Slots)
   ========================================================================== */

.popups-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 36px;
  align-items: center;
}

.popups-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.popup-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.popup-tab {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-standard);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.popup-tab:hover {
  color: var(--text-primary);
}

.popup-tab.is-active {
  background: var(--surface-1);
  color: var(--text-primary);
  font-weight: 600;
  border-color: var(--border-highlight);
}

.popup-info-card {
  padding: 24px;
}

.popup-info-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.popup-info-panel.is-active {
  display: flex;
}

.popup-info-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.popup-info-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.popup-info-desc {
  font-size: 14.5px;
  line-height: 1.58;
  color: var(--text-secondary);
  max-width: 52ch;
}

.popup-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.popup-meta-pill {
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-primary);
}

.popup-phone-wrap {
  display: flex;
  justify-content: center;
}

.popup-phone {
  width: 100%;
  max-width: 256px;
  padding: 5px;
  border-radius: 32px;
  background: #121513;
  border: 1px solid var(--phone-rim);
  box-shadow: var(--shadow-phone);
}

.popup-phone-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 19;
  border-radius: 27px;
  overflow: hidden;
  background: var(--canvas);
  border: 1px solid var(--border-standard);
}

.popup-phone-panel {
  position: relative;
  display: none;
  width: 100%;
  height: 100%;
}

.popup-phone-panel.is-active {
  display: block;
}

.popup-video {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.popup-mock-stage {
  position: absolute;
  inset: 0;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--canvas);
}

.popup-mock-stage--veil {
  background: linear-gradient(180deg, #050706 0%, #050706 76%, var(--surface-2) 100%);
  color: #F3F4F1;
}

.popup-mock-feed {
  position: absolute;
  inset: 12px;
  border-radius: 16px;
  background: var(--surface-2);
  opacity: 0.4;
}

.popup-mock-overlay {
  position: relative;
  z-index: 2;
  margin: auto 0;
  padding: 16px 14px;
  border-radius: 20px;
  background: var(--surface-1);
  border: 1px solid var(--border-highlight);
  box-shadow: var(--shadow-modal);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.popup-mock-overlay--bottom {
  margin: auto 0 10px;
}

.popup-mock-btn {
  width: 100%;
  padding: 8px 10px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11.5px;
  font-weight: 600;
}

.popup-mock-btn--warn {
  background: var(--warning-solid);
  color: #F5F6F4;
}

.popup-mock-btn--subtle {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-standard);
}

.popup-progress-bar {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--warning-subtle);
  overflow: hidden;
}

.popup-progress-bar span {
  display: block;
  width: 65%;
  height: 100%;
  background: var(--warning);
}

.popup-slot-tag {
  position: relative;
  z-index: 2;
  align-self: center;
  font-size: 10.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border-standard);
}

/* ==========================================================================
   4. Competitor Comparison Table
   ========================================================================== */

.compare-card {
  padding: 0;
}

.compare-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.compare-table th,
.compare-table td {
  padding: 15px 22px;
  font-size: 14px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}

.compare-table thead th {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-2);
}

.compare-table thead th.is-pro {
  color: var(--accent-fg);
}

.compare-table tbody th {
  font-weight: 600;
  color: var(--text-primary);
}

.compare-table tbody td {
  color: var(--text-secondary);
}

.compare-table tbody td.is-pro {
  color: var(--text-primary);
  font-weight: 500;
}

.compare-table tbody tr:last-child th,
.compare-table tbody tr:last-child td {
  border-bottom: none;
}

/* ==========================================================================
   5. Additional Features Bento Grid + Screenshot Slots
   ========================================================================== */

.features-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.feature-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature-card--span6 {
  grid-column: span 6;
}

.feature-card--span12 {
  grid-column: span 12;
}

.feature-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.feature-title {
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 5px;
}

.feature-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 56ch;
}

.dot-progress {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 4px;
}

.dot-progress span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neutral-bar);
}

.dot-progress span.is-lit {
  background: var(--accent-fg);
}

.shot-slot {
  position: relative;
  margin-top: auto;
  min-height: 108px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-highlight);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  overflow: hidden;
}

.shot-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

.shot-file {
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-secondary);
}

.insights-box {
  position: relative;
  padding: 14px 12px 10px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border-standard);
}

.insights-goal {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 40px;
  border-top: 1px dashed var(--accent-fg);
  opacity: 0.6;
}

.insights-goal-text {
  position: absolute;
  right: 12px;
  top: 22px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-fg);
}

.insights-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  height: 76px;
}

.bar-col {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.bar-fill {
  width: 100%;
  max-width: 20px;
  border-radius: 5px 5px 2px 2px;
  background: var(--platform-bar-1);
}

.bar-fill--over {
  background: var(--warning);
}

.bar-fill--muted {
  background: var(--platform-bar-2);
}

.bar-day {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.offline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.offline-copy {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 68ch;
}

/* ==========================================================================
   6. Indie Dev Story
   ========================================================================== */

.story-card {
  padding: clamp(24px, 4vw, 34px);
}

.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: 28px;
  align-items: center;
}

.story-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.story-body p {
  font-size: 15px;
  line-height: 1.62;
  color: var(--text-secondary);
}

.story-aside {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border-standard);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.story-aside-title {
  font-size: 14px;
  font-weight: 600;
}

.story-aside-sub {
  font-size: 13px;
  color: var(--text-secondary);
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.social-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--surface-1);
  border: 1px solid var(--border-standard);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

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

/* ==========================================================================
   7. FAQ Accordion (Native Details/Summary)
   ========================================================================== */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 820px;
}

.faq-item {
  padding: 0;
}

.faq-trigger {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 16px 22px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.faq-trigger::-webkit-details-marker {
  display: none;
}

.faq-icon {
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.faq-item[open] .faq-icon {
  transform: rotate(45deg);
  color: var(--accent-fg);
}

.faq-body {
  padding: 0 22px 18px;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--text-secondary);
  max-width: 68ch;
}

.faq-body code {
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--accent-fg);
}

/* ==========================================================================
   8. Final CTA Card
   ========================================================================== */

.final-cta {
  padding: clamp(32px, 5vw, 48px) 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.final-cta-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.15;
}

.final-cta-sub {
  font-size: 15.5px;
  color: var(--text-secondary);
  max-width: 46ch;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: var(--section-gap);
  padding: 32px 0 40px;
  border-top: 1px solid var(--divider);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-meta {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ==========================================================================
   Privacy Policy Page
   ========================================================================== */

.legal-wrap {
  padding: clamp(40px, 6vw, 68px) 0 24px;
  max-width: 780px;
}

.legal-header {
  margin-bottom: 28px;
}

.legal-title {
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin-bottom: 10px;
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 14px;
  color: var(--text-secondary);
}

.legal-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.legal-summary-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  border: 1px solid var(--border-standard);
  font-size: 13.5px;
  font-weight: 600;
}

.legal-summary-item svg {
  color: var(--accent-fg);
  flex-shrink: 0;
}

.legal-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.legal-card {
  padding: 24px 26px;
}

.legal-card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}

.legal-card p {
  font-size: 15px;
  line-height: 1.62;
  color: var(--text-secondary);
}

.legal-card p + p {
  margin-top: 10px;
}

.legal-card strong {
  color: var(--text-primary);
  font-weight: 600;
}

.legal-card code {
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--accent-fg);
}

.perm-list {
  margin-top: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border-standard);
  overflow: hidden;
}

.perm-row {
  padding: 14px 16px;
}

.perm-row + .perm-row {
  border-top: 1px solid var(--divider);
}

.perm-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.perm-head h3 {
  font-size: 14.5px;
  font-weight: 600;
}

.perm-row p {
  font-size: 14px;
  line-height: 1.52;
}

/* ==========================================================================
   Modal Dialog (Functional Layer Only)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--backdrop-scrim);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-backdrop.is-open {
  display: flex;
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--surface-1);
  border: 1px solid var(--border-highlight);
  box-shadow: var(--shadow-modal);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-actions .btn {
  width: 100%;
}

.copy-feedback {
  min-height: 20px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--accent-fg);
  text-align: center;
}

/* ==========================================================================
   Responsive & Accessibility Media Queries
   ========================================================================== */

@media (max-width: 960px) {
  .hero-grid,
  .popups-layout,
  .story-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    text-align: center;
  }

  .hero-subtitle {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions {
    justify-content: center;
  }

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

  .feature-card--span6 {
    grid-column: span 12;
  }
}

@media (max-width: 680px) {
  .popup-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .legal-summary {
    grid-template-columns: 1fr;
  }

  .compare-table th,
  .compare-table td {
    padding: 13px 16px;
    font-size: 13.5px;
  }
}

@media (max-width: 520px) {
  .container {
    padding: 0 18px;
  }

  .hero-phone,
  .popup-phone {
    max-width: 246px;
  }

  .feed-card {
    height: 296px;
  }

  .hero-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header {
    background: var(--canvas);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .modal-backdrop {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
