/* Sweet Dreams — standalone design (no Tailwind) */

/* Dreamy nighttime theme: deep indigo, violet, warm gold accents */

@font-face {
  font-family: "Mouldy Cheese";
  src: url("/fonts/mouldy-cheese.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ── Variables ──────────────────────────────────────────────── */
:root {
  /* ─────────────────────────────────────────────────────────────
     Moonlight Calm re-skin (duerme.now + magictales.now)
     Calm/wind-down palette: desaturated slate, single periwinkle
     accent, flat surfaces. Mouldy Cheese display retained.
     Light-section tokens (--sd-bg-light / -section / -dark) are left
     as-is — they back light surfaces, not the dark app shell.
     ───────────────────────────────────────────────────────────── */

  /* Brand palette */
  --sd-bg:            #131320;
  --sd-bg-soft:       #181826;
  --sd-bg-header:     rgb(19 19 32 / 88%);
  --sd-bg-card:       #1c1c2b;
  --sd-bg-card-hover: #20202f;
  --sd-bg-light:      #f5f3ff;
  --sd-bg-section:    #ede9fe;
  --sd-accent:        #9aa6e8;
  --sd-accent-dark:   #7e8bd6;
  --sd-accent-hover:  #8b97e0;
  --sd-accent-muted:  rgb(154 166 232 / 13%);
  --sd-gold:          #d8c9a8;
  --sd-gold-muted:    rgb(216 201 168 / 16%);
  --sd-rose:          #d9a6b0;
  --sd-rose-muted:    rgb(217 166 176 / 20%);
  --sd-text:          #e9eaf2;
  --sd-text-soft:     #b4b8cf;
  --sd-text-muted:    #75799a;
  --sd-text-dark:     #1e1b4b;
  --sd-border:        rgb(255 255 255 / 7%);
  --sd-border-strong: rgb(255 255 255 / 12%);
  --sd-danger:        #d98a8a;
  --sd-danger-light:  #e0a3a3;
  --sd-success:       #8fcfa6;
  --sd-bg-card-deep:  #16161f;
  --sd-bg-card-night: #121220;

  /* Gradients — flattened for the calm direction (kept as vars so every
     consumer flattens at once; --sd-grad-accent resolves to a solid). */
  --sd-grad-hero:     linear-gradient(170deg, #131320 0%, #171726 100%);
  --sd-grad-accent:   #9aa6e8;
  --sd-grad-card:     #1c1c2b;
  --sd-grad-cover:    linear-gradient(170deg, #1c2236 0%, #232a40 100%);

  /* Typography */
  --sd-font:          "Quicksand", system-ui, sans-serif;
  --sd-font-heading:  "Mouldy Cheese", system-ui, sans-serif;

  /* Radii */
  --sd-radius-sm:     0.375rem;
  --sd-radius-md:     0.625rem;
  --sd-radius-lg:     1rem;
  --sd-radius-xl:     1.5rem;
  --sd-radius-pill:   9999px;

  /* Spacing */
  --sd-space-xs:      0.5rem;
  --sd-space-sm:      0.75rem;
  --sd-space-md:      1rem;
  --sd-space-lg:      1.5rem;
  --sd-space-xl:      2rem;
  --sd-space-2xl:     3rem;
  --sd-space-3xl:     4rem;
  --sd-space-4xl:     6rem;

  /* Shadows — Moonlight Calm has no projected shadows; depth comes from
     a 1px border + a slightly lighter surface. Kept as vars (= none). */
  --sd-shadow:        none;
  --sd-shadow-card:   none;
  --sd-shadow-glow:   none;

  /* Transitions */
  --sd-transition:    0.2s ease;

  /* App layout */
  --sd-sidebar-width:   220px;
  --sd-topbar-height:   56px;
  --sd-bottom-nav-h:    58px;

  /* Elevated surfaces (used in menus, banners, story-type buttons) */
  --sd-surface-raised:  #1c1c2b;
  --sd-surface-2:       #20202f;
  --sd-surface-3:       #262636;

  /* V1 Landing Page */
  --sd-bg-v1-deep: #08061d;
}

/* ── @property animated nebula ──────────────────────────────── */
@property --sd-nebula-a {
  syntax: '<color>';
  inherits: false;
  initial-value: #131320;
}

@property --sd-nebula-b {
  syntax: '<color>';
  inherits: false;
  initial-value: #1c2236;
}

@property --sd-nebula-c {
  syntax: '<color>';
  inherits: false;
  initial-value: #17182a;
}

/* ── Base reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* `hidden` is honoured only by the user-agent rule `[hidden] { display: none }`,
   which loses to *any* author `display` declaration regardless of specificity —
   an author `display` such as `grid` or `inline-flex` otherwise keeps a
   hidden element visible.
   This is the rule the three per-selector repairs further down were each
   reaching for one element at a time; they are now redundant but harmless.
   !important rather than a more specific selector: a specificity ladder only
   moves the next rung. */
[hidden] { display: none !important; }

.sd-public {
  margin: 0;
  font-family: var(--sd-font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--sd-text);
  background: var(--sd-bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sd-public > main { flex: 1; }

/* ── Heading font (Mouldy Cheese) ───────────────────────────── */
.sd-section-heading,
.sd-page-title,
.sd-plan-card h2,
.sd-plan-card h3 {
  font-family: var(--sd-font-heading);
  font-weight: normal;
}

/* ── Skip link ──────────────────────────────────────────────── */
.sd-skip-link {
  position: absolute;
  top: -100px;
  left: var(--sd-space-md);
  z-index: 9999;
  padding: 0.6rem 1.2rem;
  background: var(--sd-accent);
  color: #fff;
  font-weight: 700;
  font-family: var(--sd-font);
  border-radius: var(--sd-radius-md);
  text-decoration: none;
  transition: top 0.1s;
}
.sd-skip-link:focus-visible { top: var(--sd-space-md); }

/* ── Focus rings (accessibility) ───────────────────────────── */

/* Form inputs use box-shadow for focus — exclude them from the global rule */
.sd-public :focus-visible:not(.sd-input, .sd-select) {
  outline: 2px solid var(--sd-accent);
  outline-offset: 2px;
}

/* ── Container ──────────────────────────────────────────────── */
.sd-container {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--sd-space-lg);
}

/* ── Typography helpers ─────────────────────────────────────── */
.sd-muted     { color: var(--sd-text-muted); font-size: 0.9rem; }
.hidden       { display: none !important; }
.sd-sr-only   { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Buttons ────────────────────────────────────────────────── */
.sd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--sd-radius-pill);
  font-family: var(--sd-font);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background var(--sd-transition), border-color var(--sd-transition), color var(--sd-transition), transform var(--sd-transition);
}

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

.sd-btn-primary {
  background: var(--sd-grad-accent);
  color: #fff;
  border-color: transparent;
}
.sd-btn-primary:hover { background: var(--sd-accent-dark); color: #fff; }

.sd-btn-secondary {
  background: transparent;
  color: var(--sd-accent);
  border-color: var(--sd-accent);
}
.sd-btn-secondary:hover { background: var(--sd-accent-muted); }

.sd-btn-ghost {
  background: transparent;
  color: var(--sd-text-soft);
  border-color: var(--sd-border-strong);
}
.sd-btn-ghost:hover { color: var(--sd-text); border-color: var(--sd-accent); }

.sd-btn-danger {
  background: transparent;
  color: var(--sd-danger);
  border-color: var(--sd-danger);
}
.sd-btn-danger:hover { background: rgb(248 113 113 / 15%); }

.sd-btn-lg { padding: 0.85rem 1.75rem; font-size: 1.05rem; }
.sd-btn-sm { padding: 0.35rem 0.85rem; font-size: 0.82rem; }
.sd-btn-full { width: 100%; }

/* ── Badges ─────────────────────────────────────────────────── */

/* Tags */
.sd-tag {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: var(--sd-radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--sd-accent-muted);
  color: var(--sd-accent);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--sd-transition), border-color var(--sd-transition), color var(--sd-transition);
  font-family: var(--sd-font);
  line-height: 1.4;
}

.sd-tag:hover {
  background: rgb(167 139 250 / 25%);
  border-color: var(--sd-accent);
}

.sd-tag.selected {
  background: var(--sd-accent);
  color: #fff;
  border-color: var(--sd-accent);
  box-shadow: 0 0 0 2px rgb(167 139 250 / 35%), 0 2px 8px rgb(167 139 250 / 25%);
}

.sd-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem;
  min-height: 48px;
  border: 1px solid var(--sd-border-strong);
  border-radius: var(--sd-radius-md);
  background: var(--sd-bg-soft);
}

/* Divider hidden — no preset chips rendered so the line serves no purpose */
.sd-tags-divider { display: none; }

.sd-tags-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
}

.sd-input--tag-custom {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  padding: 0.35rem 0.65rem;
}

.sd-tag-custom { display: inline-flex; align-items: center; gap: 0.25rem; }

.sd-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 0 0 0 0.15rem;
  font-size: 0.68rem;
  line-height: 1;
  opacity: 0.75;
}
.sd-tag-remove:hover { opacity: 1; }

/* ── Cards (generic) ────────────────────────────────────────── */
.sd-card {
  background: var(--sd-grad-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-xl);
  padding: var(--sd-space-lg);
}

/* Nighttime starfield card — same dreamy background as the onboarding hero */
.sd-card--night {
  background: linear-gradient(145deg, var(--sd-bg-card-night) 0%, var(--sd-bg-card-deep) 100%);
  border-color: var(--sd-accent-muted);
  position: relative;
  z-index: 0;
}

/* Lift the card above siblings when one of its dropdowns is open */
.sd-card--night:has(.sd-select-dropdown--open) {
  z-index: 10;
}

/* Lift a direct-child field above its siblings when its dropdown is open */
.sd-card--night > .sd-field:has(.sd-select-dropdown--open) {
  z-index: 5;
}

/* Same lift for any plain card (e.g. the profile Identity card) so its open
   dropdown paints above the card below it. Plain .sd-card has no positioning
   of its own, so position: relative must be set here (only while a dropdown is
   open) — otherwise the z-index has nothing to act on and the fix silently
   no-ops. Scoped to the open state to avoid making every card a stacking
   context. Night cards already have their own rules; this is harmless overlap. */
.sd-card:has(.sd-select-dropdown--open) {
  position: relative;
  z-index: 10;
}

.sd-card > .sd-field:has(.sd-select-dropdown--open) {
  position: relative;
  z-index: 5;
}

/* Lift all direct content above the decorative layers */
.sd-card--night > *:not(.sd-onboarding-stars, .sd-onboarding-dots) {
  position: relative;
  z-index: 1;
}

/* Constellation dots layer */
.sd-onboarding-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

.sd-deco-dot {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--sd-text);
  box-shadow: 0 0 4px 2px rgb(241 240 255 / 55%);
  animation: sd-twinkle 2.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .sd-deco-dot { animation: none; opacity: 0.12; }
}

.sd-star-deco {
  position: absolute;
  font-size: 10px;
  color: var(--sd-gold);
}

.sd-star-deco:nth-child(even)   { color: #fcd34d; }
.sd-star-deco:nth-child(3n)     { color: var(--sd-gold); }

/* ── Feature list ────────────────────────────────────────────── */
.sd-feature-list {
  list-style: none;
  margin: var(--sd-space-md) 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.sd-feature-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}
.sd-feature-list .fa-check { color: var(--sd-success); }
.sd-feature-list .fa-xmark { color: var(--sd-text-muted); }

/* ── Forms ──────────────────────────────────────────────────── */
.sd-field { margin-bottom: var(--sd-space-lg); }

/* Note: do NOT set margin here — spacing comes from .sd-field */
.sd-fieldset {
  border: none;
  padding: 0;
  min-width: 0;
}

/* Legend flows as a normal block label in modern browsers (no float needed) */
.sd-fieldset > legend {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 0.4rem;
}

/* When a hint immediately follows the label, tighten the gap —
   the hint's own margin-bottom takes over separation from the content */
.sd-fieldset > legend:has(+ .sd-field-hint),
.sd-label:has(+ .sd-field-hint) {
  margin-bottom: 0.1rem;
}

.sd-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--sd-text-soft);
  margin-bottom: 0.4rem;
}

.sd-input,
.sd-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--sd-bg-soft);
  border: 1px solid var(--sd-border-strong);
  border-radius: var(--sd-radius-md);
  color: var(--sd-text);
  font-family: var(--sd-font);
  font-size: 0.95rem;
  transition: border-color var(--sd-transition);
}

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

.sd-input:focus,
.sd-select:focus {
  outline: none;
  border-color: var(--sd-accent);
  box-shadow: 0 0 0 3px var(--sd-accent-muted);
}

/* Prevent iOS Safari from zooming on input focus (requires 16px minimum) */
@media (width <= 768px) {
  .sd-input,
  .sd-select { font-size: 1rem; }
}

/* ── Custom select dropdown ──────────────────────────────────── */
.sd-custom-select {
  position: relative;
  width: 100%;
}

.sd-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: var(--sd-bg-soft);
  border: 1px solid var(--sd-border-strong);
  border-radius: var(--sd-radius-md);
  color: var(--sd-text);
  font-family: var(--sd-font);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--sd-transition), box-shadow var(--sd-transition);
}

.sd-select-trigger:focus,
.sd-select-trigger--open {
  outline: none;
  border-color: var(--sd-accent);
  box-shadow: 0 0 0 3px var(--sd-accent-muted);
}

.sd-select-trigger--placeholder span { color: var(--sd-text-muted); }

.sd-select-trigger i {
  font-size: 0.75rem;
  color: var(--sd-text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sd-select-trigger--open i { transform: rotate(180deg); }

.sd-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--sd-bg-card);
  border: 1px solid var(--sd-border-strong);
  border-radius: var(--sd-radius-md);
  box-shadow: var(--sd-shadow);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.sd-select-dropdown--open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.sd-select-option {
  display: block;
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: none;
  border: none;
  color: var(--sd-text);
  font-family: var(--sd-font);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: background var(--sd-transition), color var(--sd-transition);
}

.sd-select-option:hover,
.sd-select-option:focus {
  background: var(--sd-bg-card-hover);
  outline: none;
}

.sd-select-option--active {
  color: var(--sd-accent);
  background: var(--sd-accent-muted);
}

@media (prefers-reduced-motion: reduce) {
  .sd-select-dropdown { transition: none; }
}

.sd-field-hint {
  font-size: 0.78rem;
  color: var(--sd-text-muted);
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.sd-form-actions {
  display: flex;
  gap: var(--sd-space-sm);
  flex-wrap: wrap;
  padding-top: var(--sd-space-md);
}

.sd-form-actions--stacked { flex-direction: column; }

.sd-btn-centered { justify-content: center; }

/* Mood / theme / voice grid selectors */

.sd-voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
}

.sd-voice-option { cursor: pointer; }

/* Visually hidden but kept in accessibility tree for keyboard/SR navigation */
.sd-voice-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sd-voice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.75rem 0.5rem;
  border-radius: var(--sd-radius-lg);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid var(--sd-border-strong);
  color: var(--sd-text-soft);
  text-align: center;
  transition: background var(--sd-transition), border-color var(--sd-transition),
              color var(--sd-transition), box-shadow var(--sd-transition);
}

.sd-voice-btn i { font-size: 1.1rem; }
.sd-voice-btn strong { font-size: 0.85rem; line-height: 1.2; }

.sd-voice-btn small {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--sd-text-muted);
  line-height: 1.2;
}

.sd-voice-option input:checked ~ .sd-voice-btn {
  background: var(--sd-accent);
  border-color: var(--sd-accent);
  color: #fff;
  box-shadow: 0 0 0 2px rgb(167 139 250 / 35%), 0 2px 8px rgb(167 139 250 / 25%);
}

.sd-voice-option input:checked ~ .sd-voice-btn small { color: rgb(255 255 255 / 70%); }

/* Maintain white text when hovering an already-selected option */
.sd-voice-option input:checked ~ .sd-voice-btn:hover { color: #fff; }

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

.sd-voice-option:active .sd-voice-btn { transform: scale(0.96); }

/* Keyboard focus indicator for hidden radio inputs */
.sd-voice-option:focus-within .sd-voice-btn {
  outline: 2px solid var(--sd-accent);
  outline-offset: 2px;
}

/* Length selector cards */

.sd-voice-preview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 1.5px solid var(--sd-border-strong);
  background: transparent;
  color: var(--sd-text-soft);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--sd-transition), border-color var(--sd-transition),
              color var(--sd-transition);
  flex-shrink: 0;

  /* Expand tap area to ~44px without changing visual size */
  position: relative;
}

.sd-voice-preview-btn::before {
  content: "";
  position: absolute;
  inset: -0.5rem;
}

.sd-voice-preview-btn:hover {
  border-color: var(--sd-accent);
  color: var(--sd-accent);
}

.sd-voice-preview-btn.playing {
  background: var(--sd-accent);
  border-color: var(--sd-accent);
  color: #fff;
}

/* Keep preview button visible but dimmed inside a selected card */
.sd-voice-option input:checked ~ .sd-voice-btn .sd-voice-preview-btn {
  border-color: rgb(255 255 255 / 50%);
  color: rgb(255 255 255 / 80%);
}

.sd-voice-option input:checked ~ .sd-voice-btn .sd-voice-preview-btn:hover,
.sd-voice-option input:checked ~ .sd-voice-btn .sd-voice-preview-btn.playing {
  border-color: #fff;
  color: #fff;
}

/* ── Locked (premium) voice option ──────────────────────────── */
.sd-voice-locked { opacity: 0.55; cursor: default; }
.sd-voice-locked .sd-voice-btn { cursor: default; }
.sd-voice-locked:active .sd-voice-btn { transform: none; }
.sd-voice-locked .sd-voice-btn:hover { border-color: rgb(255 255 255 / 10%); color: inherit; }

.sd-voice-premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fbbf24;
  background: rgb(251 191 36 / 12%);
  border: 1px solid rgb(251 191 36 / 30%);
  border-radius: 20px;
  padding: 2px 7px;
  line-height: 1.4;
  white-space: nowrap;
}

/* ── Empty state ────────────────────────────────────────────── */

/* ── Page structure (app) ───────────────────────────────────── */
.sd-page {
  padding: var(--sd-space-xl);
  max-width: 1000px;
  margin-inline: auto;
}

.sd-page-narrow {
  max-width: 640px;
}

.sd-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
  color: var(--sd-text);
}

/* ── Public header ──────────────────────────────────────────── */
.sd-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--sd-bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sd-border);

  /* Needed for mobile nav dropdown positioning */
  isolation: isolate;
}

/* Match the logo's deep indigo-to-navy gradient — fades to transparent on the right */
.sd-public .sd-header {
  background: linear-gradient(
    to right,
    rgb(22 12 65 / 97%) 0%,
    rgb(15 10 45 / 93%) 40%,
    rgb(15 12 41 / 0%) 100%
  );
  border-bottom-color: transparent;
}

.sd-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.5rem;
}

.sd-header-right {
  display: flex;
  align-items: center;
  gap: var(--sd-space-lg);
}

/* Mobile nav burger — hidden on desktop */
.sd-nav-burger {
  display: none;
  background: none;
  border: none;
  color: var(--sd-text-soft);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.4rem;
  line-height: 1;
}

.sd-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.sd-brand-logo {
  height: 24px;
  width: auto;
}

/* Larger logo on the public landing page */
.sd-public .sd-brand-logo {
  height: 72px;
  width: auto;
}

@media (width <= 768px) {
  .sd-brand-logo { height: 20px; }
  .sd-public .sd-brand-logo { height: 48px; }
}

.sd-header-nav {
  display: flex;
  align-items: center;
  gap: var(--sd-space-lg);
}

.sd-nav-link {
  color: var(--sd-text-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color var(--sd-transition);
}
.sd-nav-link:hover { color: var(--sd-accent); }

/* ── Public footer ──────────────────────────────────────────── */
.sd-footer {
  background: var(--sd-bg-soft);
  border-top: 1px solid var(--sd-border);
  padding: var(--sd-space-xl) 0;
}

.sd-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sd-space-md);
  flex-wrap: wrap;
}

.sd-footer-copy {
  color: var(--sd-text-muted);
  font-size: 0.85rem;
  margin: 0;
  overflow-wrap: break-word;
}

.sd-footer-legal {
  display: flex;
  gap: var(--sd-space-md);
  flex-wrap: wrap;
  justify-content: center;
}

.sd-footer-legal-link {
  color: var(--sd-text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.2s;
}

.sd-footer-legal-link:hover {
  color: var(--sd-accent);
}

/* ── Legal pages ────────────────────────────────────────────── */
.sd-legal-page {
  padding: var(--sd-space-3xl) 0;
  min-height: 60vh;
}

.sd-legal-content {
  max-width: 720px;
  margin: 0 auto;
  color: var(--sd-text);
  line-height: 1.75;
}

.sd-legal-content h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: var(--sd-space-lg);
}

.sd-legal-content h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: var(--sd-space-xl);
  margin-bottom: var(--sd-space-sm);
}

.sd-legal-content p {
  margin-bottom: var(--sd-space-md);
  color: var(--sd-text-muted);
}

.sd-footer-social {
  display: flex;
  gap: var(--sd-space-md);
}

.sd-footer-social-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--sd-text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.2s;
}

.sd-footer-social-link:hover {
  color: var(--sd-accent);
}

@media (width <= 768px) {
  .sd-footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--sd-space-lg);
  }

  .sd-footer-legal {
    justify-content: center;
  }

  .sd-footer-social {
    justify-content: center;
  }
}

/* ── Section styles (public) ────────────────────────────────── */
.sd-section-heading {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  text-align: center;
  margin: 0 0 var(--sd-space-2xl);
  color: var(--sd-text);
  overflow-wrap: break-word;
  hyphens: auto;
}

/* ── Highlights: scroll-driven icon birth + heading parallax ─ */

/* Progressive enhancement — Chrome/Edge/Safari only (no Firefox) */

/* ── Delight — Landing page animations ─────────────────────── */

/* Keyframes */

@keyframes sd-fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes sd-twinkle {
  0%, 100% { opacity: 0.08; }
  50%       { opacity: 0.18; }
}

@keyframes sd-moon-breathe {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50%       { opacity: 0.55; transform: scale(1.08); }
}

/* Hero entrance — text left, phone right, staggered */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Dim starfield breathes slowly out of phase with bright layer */

  /* Bright twinkling layer — different period creates organic phase drift */

  /* Floating phone */

  /* Moon icon breathes */

  /* Scroll-reveal utility — applied by JS */

  /* Stagger children of a reveal container */

  /* Trust cards — deeper float-up with wider stagger for dreamy effect */

  /* Trust card hover lift */

  /* Step icon hover glow */

  /* Dream bubble hover lift */

  /* Highlight card hover lift */

  /* Primary CTA button — flat in Moonlight Calm (no shimmer sweep / no violet peak) */
  .sd-btn-primary {
    background: var(--sd-accent);
    animation: none;
  }

  /* Hero CTA — calm, no glow pulse */

  /* Ghost button subtle lift */
  .sd-btn-ghost:hover {
    transform: translateY(-1px);
  }

  /* Burger icon rotates when nav is open */
  .sd-nav-burger i {
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    display: inline-block;
  }

  .sd-nav-burger[aria-expanded="true"] i {
    transform: rotate(90deg);
  }
}

/* Mobile nav slide-down — only animate when motion is OK */
@media (prefers-reduced-motion: no-preference) and (width <= 768px) {
  .sd-header-nav {
    transition: opacity 0.2s ease,
                transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0s linear 0.25s;
  }

  .sd-header-nav--open {
    transition: opacity 0.25s ease,
                transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0s linear 0s;
  }
}

/* ── Delight — App dashboard ─────────────────────────────── */

/* Keyframes unique to the app surface */
@keyframes sd-twinkle-star {
  0%, 100% { opacity: 1;    transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.82); }
}

@media (prefers-reduced-motion: no-preference) {
  /* Sections float in on load — staggered so the page settles gently */

  /* Onboarding icon (moon) floats and breathes — the first screen feels enchanted */

  /* Starfield background dots twinkle with staggered delays */

  /* Sparkles float in and out with staggered timing */

  /* Gold stars twinkle with staggered delays */
  .sd-star-deco:nth-child(1) { animation: sd-twinkle-star 1.6s 0.0s ease-in-out infinite; }
  .sd-star-deco:nth-child(2) { animation: sd-twinkle-star 2.0s 0.5s ease-in-out infinite; }
  .sd-star-deco:nth-child(3) { animation: sd-twinkle-star 1.8s 0.9s ease-in-out infinite; }

  /* Hearts pulse with staggered heartbeat rhythm */

  /* CTA button inside onboarding shimmers like the hero button */

  /* Greeting moon in the welcome banner drifts slowly */

  /* Empty-state icon floats — a quiet invitation to begin */

  /* Credit badge star in the topbar — twinkles like a real star */

  /* Onboarding done-step checkmark — warm gold pop when the step completes */

  /* Profile card hover — violet glow elevates the selected child's card */

  /* Avatar gets a soft violet ring when the card is hovered */

  /* Story card hover + entrance — single rule to avoid duplicate specificity resolution */
  .sd-story-card {
    transition: border-color var(--sd-transition), transform var(--sd-transition),
                box-shadow var(--sd-transition);
  }

  /* Meditation cards hover: purple glow (dreamy, calm) */
  .sd-story-card--meditation:hover {
    box-shadow: 0 8px 28px rgb(167 139 250 / 22%);
  }

  /* Story cards hover: warm gold glow (sparkly, adventurous) */
  .sd-story-card:not(.sd-story-card--meditation):hover {
    box-shadow: 0 8px 28px rgb(251 191 36 / 18%);
  }

  /* Library grid — only first 9 cards stagger in (≈3 visible rows); the rest appear instantly
     to avoid running entrance animations on all off-screen cards simultaneously */
  .sd-story-card:nth-child(-n+9) {
    animation: sd-fade-up 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .sd-story-card:nth-child(1) { animation-delay:   0ms; }
  .sd-story-card:nth-child(2) { animation-delay:  55ms; }
  .sd-story-card:nth-child(3) { animation-delay: 110ms; }
  .sd-story-card:nth-child(4) { animation-delay: 165ms; }
  .sd-story-card:nth-child(5) { animation-delay: 220ms; }
  .sd-story-card:nth-child(6) { animation-delay: 275ms; }
}

/* ── Pricing ────────────────────────────────────────────────── */
.sd-pricing-page { padding: var(--sd-space-3xl) 0; }
.sd-pricing-header { text-align: center; margin-bottom: var(--sd-space-2xl); }

.sd-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sd-space-xl);
  max-width: 900px;
  margin-inline: auto;
}

.sd-plan-card {
  background: var(--sd-bg-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-xl);
  padding: var(--sd-space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--sd-space-md);
  position: relative;
}

.sd-plan-card h2,
.sd-plan-card h3 { font-size: 1.1rem; font-weight: 800; margin: 0; color: var(--sd-text); overflow-wrap: break-word; }

.sd-plan-cta { margin-top: auto; }

.sd-plan-card-featured {
  border-color: var(--sd-accent);
  background: linear-gradient(145deg, #1e1b4b, #2a1f5e);
  box-shadow: 0 0 0 2px var(--sd-accent), var(--sd-shadow-glow);
  z-index: 0;
}

.sd-plan-card-featured > *:not(.sd-onboarding-stars, .sd-onboarding-dots, .sd-plan-badge-top) {
  position: relative;
  z-index: 1;
}

.sd-plan-badge-top {
  position: absolute;
  top: -1px;
  right: var(--sd-space-lg);
  background: var(--sd-grad-accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 0 0 var(--sd-radius-md) var(--sd-radius-md);
  white-space: nowrap;
  max-width: calc(100% - var(--sd-space-xl));
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-plan-pricing { display: flex; flex-direction: column; gap: 0.15rem; }

.sd-plan-price {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0;
  color: var(--sd-text);
}
.sd-plan-period { font-size: 1rem; color: var(--sd-text-muted); font-weight: 400; }

/* ── Onboarding hero ─────────────────────────────────────────── */

/* Starfield background layer */
.sd-onboarding-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

/* Skip link — quiet, unobtrusive */

.sd-field-hint--onboarding {
  color: var(--sd-accent);
  font-size: 0.82rem;
  font-style: italic;
  margin-top: var(--sd-space-xs);
}

.sd-field-hint--onboarding-interests {
  margin-bottom: var(--sd-space-sm);
}

/* ── Profile form sections ──────────────────────────────────── */
.sd-form-section {
  margin-bottom: var(--sd-space-lg);
}

/* Strip trailing margin so it doesn't stack with card padding */
.sd-form-section > .sd-field:last-child { margin-bottom: 0; }

.sd-form-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--sd-text);
  margin: 0 0 var(--sd-space-lg);
  padding-bottom: var(--sd-space-sm);
  border-bottom: 1px solid var(--sd-border);
}

.sd-form-section-title i {
  color: var(--sd-accent);
  font-size: 1.1em;
}

/* ── Two-column field row ────────────────────────────────────── */
.sd-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sd-space-md);
  margin-bottom: var(--sd-space-lg);
}

/* Zero out child mb — the row itself owns the vertical rhythm */
.sd-field-row > .sd-field { margin-bottom: 0; }

/* Last row before card edge — no trailing margin */
.sd-field-row:last-child,
.sd-field-row:last-of-type { margin-bottom: 0; }

@media (width <= 480px) {
  /* Stack columns but restore field spacing between stacked items */
  .sd-field-row { grid-template-columns: 1fr; }
  .sd-field-row > .sd-field { margin-bottom: var(--sd-space-md); }
  .sd-field-row > .sd-field:last-child { margin-bottom: 0; }

  /* Profile identity card: always 2 columns even on narrow viewports */
  .sd-card .sd-field-row { grid-template-columns: 1fr 1fr; }
  .sd-card .sd-field-row > .sd-field { margin-bottom: 0; }
}

/* ── Tag picker label row ────────────────────────────────────── */
.sd-tag-picker-label-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.sd-tag-picker-label-row .sd-label { margin-bottom: 0; }

/* ── Tag count badge ─────────────────────────────────────────── */
.sd-tag-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  border-radius: var(--sd-radius-pill);
  background: var(--sd-accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* ── Tag selection micro-animation ──────────────────────────── */

/* Use @keyframes (not transition) — innerHTML replacement creates fresh elements,
   so transitions can't detect a state change. Animations fire on class addition. */
@keyframes sd-tag-pop {
  0%   { transform: scale(1); }
  55%  { transform: scale(1.12); }
  100% { transform: scale(1.06); }
}

@media (prefers-reduced-motion: no-preference) {
  .sd-tag.selected {
    animation: sd-tag-pop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  }
  .sd-tag:active { transform: scale(0.94); }
}

/* ── Custom tag hint ─────────────────────────────────────────── */
.sd-tag-custom-hint {
  font-size: 0.8rem;
  color: var(--sd-text-muted);
  margin-top: 0.3rem;
  font-style: italic;
}

/* ── Profile form actions ────────────────────────────────────── */

/* Mobile: fixed bar that replaces the bottom nav */

/* ── Form section entrance animations ───────────────────────── */

/* Use adjacent sibling selector — reliable regardless of error alert presence */
@media (prefers-reduced-motion: no-preference) {
  .sd-form-section {
    animation: sd-fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .sd-form-section + .sd-form-section {
    animation-delay: 0.1s;
  }
}

/* ── Segmented control (story-type filter) ────────────────────── */

/* Compact “Crear para…” profile row (Home) */


.sd-story-card {
  background: var(--sd-bg-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  contain: layout style;
  transition: border-color var(--sd-transition), transform var(--sd-transition);
}
.sd-story-card:hover { transform: translateY(-2px); }
.sd-story-card--meditation:hover { border-color: var(--sd-accent); }
.sd-story-card:not(.sd-story-card--meditation):hover { border-color: rgb(154 166 232 / 35%); }

/* Favorited story cards get a soft rose border */
.sd-story-card--favorite { border-color: rgb(217 166 176 / 30%); }
.sd-story-card--favorite:not(.sd-story-card--meditation):hover { border-color: rgb(217 166 176 / 45%); }

.sd-story-cover {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
}
.sd-story-cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Gradient overlay at cover bottom — profile pill + favorite star */
.sd-story-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(0 0 0 / 65%) 0%, transparent 55%);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.4rem;
  padding: var(--sd-space-xs) var(--sd-space-sm);
}

/* Frosted glass pill — profile name */
.sd-story-cover-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgb(255 255 255 / 92%);
  background: rgb(0 0 0 / 30%);
  backdrop-filter: blur(6px);
  padding: 0.18rem 0.55rem;
  border-radius: var(--sd-radius-pill);
  max-width: 72%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-story-cover-pill i { font-size: 0.65rem; opacity: 0.85; }

/* Note: button_to puts class: on the <button> element, not the <form> */
.sd-story-fav-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.75rem;
  z-index: 2;
  appearance: none;
  background: none;
  border: none;
  outline: none;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgb(255 255 255 / 45%);
  font-size: 1.1rem;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgb(0 0 0 / 50%));
  transition: transform var(--sd-transition), color var(--sd-transition), filter var(--sd-transition);
}
.sd-story-fav-btn:hover { transform: scale(1.2); color: var(--sd-rose); filter: drop-shadow(0 1px 4px rgb(0 0 0 / 60%)); }
.sd-story-fav-btn--active { color: var(--sd-rose); filter: drop-shadow(0 1px 4px rgb(255 160 160 / 40%)); }
.sd-story-fav-btn:focus-visible { outline: 2px solid var(--sd-rose); outline-offset: 4px; border-radius: 50%; }

/* Heart pop — plays once when a story is just favorited via Turbo Stream */
@keyframes sd-heart-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.5); }
  65%  { transform: scale(0.85); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: no-preference) {
  .sd-story-fav-btn--just-favorited {
    animation: sd-heart-pop 0.45s cubic-bezier(0.25, 1, 0.5, 1) both;
  }
}

.sd-story-body {
  padding: var(--sd-space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sd-space-xs);
  min-width: 0;
}

.sd-story-title {
  font-family: var(--sd-font-heading);
  font-size: 1.12rem;
  font-weight: normal;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

.sd-story-date {
  font-size: 0.75rem;
  color: var(--sd-text-muted);
  margin: 0;
}

/* kept for story show page compatibility */

.sd-story-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sd-space-xs);
  margin-top: auto;
  padding-top: var(--sd-space-sm);
}

/* Story show */

.sd-story-heading-row {
  display: flex;
  align-items: center;
  gap: var(--sd-space-sm);
  margin-bottom: 0.4rem;
}

/* Fav heart inline in the heading row (not absolutely positioned) */
.sd-story-heading-row form {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin: 0;
}

.sd-story-heading-row .sd-story-fav-btn {
  position: static;
  flex-shrink: 0;
  font-size: 1.2rem;
  padding: 0.3rem;
}

/* ── Story title inline edit ─────────────────────────────────── */
.sd-title-edit-form { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }

.sd-title-edit-field { flex: 1; }

.sd-title-input {
  width: 100%;
  background: var(--sd-surface-raised);
  border: 1.5px solid var(--sd-border-strong);
  border-radius: var(--sd-radius-md);
  color: var(--sd-text);
  font-family: var(--sd-font);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.15;
  padding: 0.35rem 0.6rem;
  transition: border-color var(--sd-transition), box-shadow var(--sd-transition);
}

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

.sd-title-input:focus {
  outline: none;
  border-color: var(--sd-accent);
  box-shadow: 0 0 0 3px var(--sd-accent-muted);
}

.sd-title-input--error { border-color: var(--sd-danger); }
.sd-title-input--error:focus { box-shadow: 0 0 0 3px rgb(248 113 113 / 15%); }

.sd-title-error {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--sd-danger);
}

.sd-title-edit-actions {
  display: flex;
  gap: var(--sd-space-xs);
}

/* ── Generator loading state ────────────────────────────────── */
.sd-generator-loading {
  position: fixed;
  inset: calc(var(--sd-topbar-height) + env(safe-area-inset-top, 0px)) 0 calc(var(--sd-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sd-space-lg);
  padding: var(--sd-space-xl);
  text-align: center;
  overflow: hidden;
}

/* ── Characters: Nuno + Nube (calm) ─────────────────────────── */
@property --sd-gen-progress {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

.sd-generator-scene {
  position: relative;
  width: 260px;
  height: 300px;
  flex-shrink: 0;
}

.sd-generator-nuno {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 2;
  animation: sd-nuno-bob 5.5s ease-in-out infinite;
}
.sd-generator-nuno-img { width: auto; height: 210px; display: block; }

@keyframes sd-nuno-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-8px); }
}

/* Nube floats like a tethered balloon at Nuno's upper-right */
.sd-generator-nube-img {
  position: absolute;
  left: 64%;
  top: 12%;
  width: 58px;
  height: auto;
  transform-origin: 50% -40px;   /* pivot above the sheep = pendulum/balloon feel */
  z-index: 3;
  animation: sd-nube-sway 4.6s ease-in-out infinite;
}

@keyframes sd-nube-sway {
  0%, 100% { transform: translate(0, 0)      rotate(-5deg); }
  50%      { transform: translate(10px, -12px) rotate(5deg); }
}

.sd-generator-message { font-size: 1rem; color: var(--sd-text-soft); margin: 0; }

/* ── Constellation progress ─────────────────────────────────── */
.sd-generator-constel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(280px, 72%);
}

.sd-generator-constel-line {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 5px;
  transform: translateY(-50%);
  background: var(--sd-border-strong);
  border-radius: var(--sd-radius-pill);
  overflow: hidden;
}

.sd-generator-constel-line::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: calc(var(--sd-gen-progress) * 100%);
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--sd-accent) 60%, transparent),
    var(--sd-accent) 60%,
    color-mix(in srgb, white 70%, var(--sd-accent))
  );
  box-shadow: 0 0 10px color-mix(in srgb, var(--sd-accent) 65%, transparent);
  transition: width var(--sd-fill-dur, 6s) linear;
}

/* Each node lights continuously: lit amount = clamp(0, progress*4 - i, 1) */
.sd-generator-node {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--sd-border-strong);

  --lit: clamp(0, calc(var(--sd-gen-progress) * 4 - var(--i)), 1);

  background:
    radial-gradient(circle at 34% 28%, color-mix(in srgb, white calc(var(--lit) * 70%), transparent), transparent 58%),
    color-mix(in srgb, var(--sd-accent) calc(22% + var(--lit) * 78%), var(--sd-bg-card));
  box-shadow:
    0 0 7px color-mix(in srgb, var(--sd-accent) 26%, transparent),
    0 0 calc(9px + var(--lit) * 16px) color-mix(in srgb, var(--sd-accent) calc(var(--lit) * 85%), transparent),
    inset 0 0 calc(var(--lit) * 5px) color-mix(in srgb, white calc(var(--lit) * 45%), transparent);
  transform: scale(calc(1 + var(--lit) * 0.18));
  transition: background 0.5s ease, box-shadow 0.5s ease, transform 0.5s ease;
}

@media (prefers-reduced-motion: reduce) {
  .sd-generator-nuno,
  .sd-generator-nube-img { animation: none; }
}

/* ── Success page ───────────────────────────────────────────── */
.sd-success-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--sd-space-3xl) var(--sd-space-xl);
  gap: var(--sd-space-lg);
}

.sd-success-icon {
  font-size: 4rem;
  color: var(--sd-gold);
  animation: sd-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes sd-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.sd-success-title { font-size: 1.5rem; font-weight: 800; margin: 0; }

/* ── PWA standalone (Android): keep inner-scroll pattern        */

/* Android Chrome where document-scroll is unreliable in PWA.   */

/* ── Performance-lite mode (mid/low-end devices, set via JS)   */

/* detected — preserves full effects on capable hardware.       */

body.sd-perf-lite .sd-deco-dot,
body.sd-perf-lite [class*="sd-twinkle"],
body.sd-perf-lite [class*="sd-sparkle"],
body.sd-perf-lite [class*="sd-float"] {
  animation-play-state: paused !important;
}

body.sd-perf-lite .sd-story-card {
  contain: layout style;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (width <= 768px) {
  /* Sidebar hidden on mobile */

  /* Mobile nav */
  .sd-nav-burger { display: flex; }

  .sd-header-nav {
    display: flex;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--sd-bg-card);
    border-bottom: 1px solid var(--sd-border);
    padding: var(--sd-space-sm) 0;
    z-index: 99;
  }

  .sd-header-nav--open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .sd-header-nav .sd-nav-link,
  .sd-header-nav .sd-btn {
    padding: 0.85rem var(--sd-space-lg);
    border-radius: 0;
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    font-size: 1rem;
    border: none;
    background: none;
    color: var(--sd-text-soft);
  }

  .sd-header-nav .sd-btn-primary {
    background: var(--sd-grad-accent);
    color: #fff;
    margin: var(--sd-space-sm) var(--sd-space-lg);
    border-radius: var(--sd-radius-pill);
    width: calc(100% - var(--sd-space-lg) * 2);
    text-align: center;
    justify-content: center;
    animation: none; /* no shimmer in the dropdown — save battery on mobile */
  }

  .sd-header-nav .sd-lang-picker {
    padding: var(--sd-space-sm) var(--sd-space-lg);
    border-top: 1px solid var(--sd-border);
    margin-top: var(--sd-space-xs);
  }

  /* Hero on mobile: text at bottom, illustration owns upper 70% */

  /* Player section on mobile */

  /* Reduce section padding on mobile */

  /* Tighten section heading gap on mobile (3rem → 2rem) */
  .sd-section-heading { margin-bottom: var(--sd-space-xl); }

  /* Constellation → vertical list on mobile */

  /* Steps → single column */

  /* Trust quotes → single column */

  /* Plans → single column */
  .sd-plans-grid { grid-template-columns: 1fr; }

  /* Page padding reduced */
  .sd-page { padding: var(--sd-space-md); overflow-x: clip; }

  /* Profile grid */

  /* Story grid */
}

/* ── Small phones (≤480px) ──────────────────────────────────── */
@media (width <= 480px) {
  /* Tighter container on very narrow viewports */
  .sd-container { padding-inline: var(--sd-space-md); }

  /* Stack hero buttons full-width for maximum tap targets */

  /* Further reduce section padding on very small phones */
}

/* ── Landscape phones ───────────────────────────────────────── */

/* ── Tablet (769–1024px) ────────────────────────────────────── */

/* ── Touch devices: prevent sticky hover states ─────────────── */
@media (hover: none) {
  .sd-btn-ghost:hover { transform: none; }
}

@media (width >= 769px) {
  /* Hide mobile bottom nav on desktop */

  /* Make the layout a fixed-height viewport so sd-app-main is the scroll area */

  /* Generator loading: no bottom nav on desktop */
  .sd-generator-loading { bottom: 0; }
}

/* ── Immersive mode (story player) ──────────────────────────── */

/* Remove the topbar offset — no topbar means no dead space at top */

.sd-app--immersive .shell-list {
  padding-top: 0;
  padding-bottom: 0;
  min-height: 100dvh;
  overflow-y: auto;
}

/* ── Settings page ───────────────────────────────────────────── */
.sd-settings-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sd-text-muted);
  margin: var(--sd-space-lg) 0 var(--sd-space-xs) var(--sd-space-xs);
}

.sd-settings-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--sd-radius-md);
  flex-shrink: 0;
}

.sd-settings-nav-row-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.sd-settings-nav-row-text strong { font-size: 0.9rem; color: var(--sd-text); }
.sd-settings-nav-row-text small { font-size: 0.75rem; color: var(--sd-text-muted); }

/* ── Offline storage card (settings) ────────────────────────── */
.sd-offline-card-header {
  display: flex;
  align-items: center;
  gap: var(--sd-space-md);
  margin-bottom: var(--sd-space-md);
}

.sd-offline-card-icon {
  background: var(--sd-accent-muted);
  color: var(--sd-accent);
}

.sd-offline-empty {
  padding: 0 0 var(--sd-space-xs);
}

.sd-offline-empty-text {
  font-size: 0.85rem;
  color: var(--sd-text-muted);
  margin: 0;
  line-height: 1.5;
}

.sd-offline-ios-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: var(--sd-space-md) 0 0;
  padding: var(--sd-space-sm) var(--sd-space-md);
  background: rgb(167 139 250 / 8%);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-md);
  font-size: 0.78rem;
  color: var(--sd-text-muted);
  line-height: 1.5;
}

.sd-offline-ios-note i {
  flex-shrink: 0;
  margin-top: 0.15rem;
  color: var(--sd-accent);
  opacity: 0.7;
}

/* ── Offline item rows (manager list) ───────────────────────── */
.sd-offline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sd-space-sm);
  padding: var(--sd-space-sm) 0;
  border-top: 1px solid var(--sd-border);
}

.sd-offline-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.sd-offline-item-title {
  font-size: 0.88rem;
  color: var(--sd-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-offline-item-meta {
  font-size: 0.75rem;
  color: var(--sd-text-muted);
}

.sd-offline-item-remove {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: none;
  color: var(--sd-text-muted);
  cursor: pointer;
  border-radius: var(--sd-radius-sm);
  line-height: 1;
  transition: color var(--sd-transition), background var(--sd-transition);
}

.sd-offline-item-remove:hover {
  color: var(--sd-danger);
  background: var(--sd-rose-muted);
}

/* Error flash on save failure — base element transitions handle smooth entry/exit */
.sd-offline-save-error {
  color: var(--sd-danger) !important;
  border-color: var(--sd-danger) !important;
  opacity: 1 !important;
}

/* ── Referral invite banner (login page) ─────────────────────── */
.sd-referral-banner {
  /* Bleed to the card edges, then sit above the form */
  margin: calc(-1 * var(--sd-space-xl)) calc(-1 * var(--sd-space-xl)) var(--sd-space-xl);
  padding: var(--sd-space-xl) var(--sd-space-xl) var(--sd-space-lg);
  background: linear-gradient(160deg, rgb(124 58 237 / 18%) 0%, rgb(167 139 250 / 8%) 100%);
  border-bottom: 1px solid rgb(167 139 250 / 22%);
  border-radius: var(--sd-radius-lg) var(--sd-radius-lg) 0 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.sd-referral-banner-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sd-accent-muted);
  border: 1px solid rgb(167 139 250 / 35%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--sd-accent);
  margin-bottom: 0.35rem;
}

.sd-referral-banner-invite {
  font-size: 0.92rem;
  color: var(--sd-text-soft);
  margin: 0;
  line-height: 1.45;
}

.sd-referral-banner-invite strong {
  color: var(--sd-text);
  font-weight: 700;
}

.sd-referral-banner-reward {
  font-size: 0.88rem;
  color: var(--sd-accent);
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

/* When banner is present, the auth-header is just the subtitle */
.sd-referral-banner + .sd-auth-header {
  margin-bottom: var(--sd-space-md);
}

/* ── Auth / Registration ─────────────────────────────────────── */
.sd-auth-page {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sd-space-2xl) var(--sd-space-lg);
}

/* Auth card / form */
.sd-auth-card {
  background: var(--sd-bg-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-lg);
  padding: var(--sd-space-xl);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgb(88 28 235 / 8%);
}

.sd-auth-title {
  margin: 0 0 var(--sd-space-lg);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--sd-text);
  text-align: center;
}

.sd-auth-form { display: flex; flex-direction: column; gap: var(--sd-space-md); }

/* ── Passwordless auth: card inner structure ─────────────────── */
.sd-auth-header { text-align: center; margin-bottom: var(--sd-space-lg); }
.sd-auth-icon { font-size: 2.5rem; color: var(--sd-accent); margin-bottom: var(--sd-space-sm); }

/* Override margin when title is inside the centered header (passwordless flow) */
.sd-auth-header .sd-auth-title { font-size: 1.4rem; font-weight: 800; margin: 0 0 0.4rem; color: var(--sd-text); }
.sd-auth-subtitle { color: var(--sd-text-muted); font-size: 0.9rem; margin: 0; }

.sd-auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: var(--sd-space-md) 0;
  color: var(--sd-text-muted);
  font-size: 0.85rem;
}

.sd-auth-divider::before,
.sd-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--sd-border);
}

.sd-google-btn-wrapper { min-height: 44px; }

.sd-auth-note {
  color: var(--sd-text-muted);
  font-size: 0.78rem;
  text-align: center;
  margin-top: var(--sd-space-md);
  line-height: 1.5;
}

.sd-input--code {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5rem;
  text-align: center;
  font-family: monospace;
}

/* ── Language picker ─────────────────────────────────────────────── */
.sd-lang-picker {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.sd-lang-option {
  position: relative; /* needed for ::after tap expansion */
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--sd-text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.35rem;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

/* Expand tap area to 44px without affecting layout */
.sd-lang-option::after {
  content: '';
  position: absolute;
  inset: -10px -4px;
}
.sd-lang-option:hover { color: var(--sd-text); border-color: var(--sd-border); }
.sd-lang-option.active { color: var(--sd-accent); border-color: var(--sd-accent); }

/* ── Error Pages ─────────────────────────────────────────────── */

@keyframes sd-twinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.7); }
}

/* ── App update banner ───────────────────────────────────────────── */
#sd-update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: calc(env(safe-area-inset-top, 0px) + var(--sd-space-xs)) var(--sd-space-md) var(--sd-space-xs);
  background: var(--sd-accent);
  box-shadow: 0 2px 12px rgb(0 0 0 / 30%);
}

.sd-update-banner-inner {
  display: flex;
  align-items: center;
  gap: var(--sd-space-sm);
  max-width: 480px;
  margin: 0 auto;
  font-family: var(--sd-font);
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
}

.sd-update-banner-inner i { flex-shrink: 0; }

.sd-update-banner-inner span { flex: 1; }

.sd-update-banner-btn {
  background: rgb(255 255 255 / 20%);
  border: 1px solid rgb(255 255 255 / 40%);
  border-radius: var(--sd-radius-sm);
  color: #fff;
  cursor: pointer;
  font-family: var(--sd-font);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  white-space: nowrap;
}

.sd-update-banner-btn:hover { background: rgb(255 255 255 / 30%); }

/* ── Generation mode selector (text+audio vs text-only) ───── */

/* Credit cost pop — fires once when mode toggles */

/* ── Profile tab nav — Moonlight Calm pill segmented control ─ */

/* Tab container: transparent so pill and panels breathe */
.sd-profile-tabs-card {
  background: transparent;
  border: none;
  padding: 0;
}

/* Nav → pill segmented control */
.sd-profile-tab-nav {
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem;
  background: var(--sd-bg-soft);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-pill);
  margin-bottom: var(--sd-space-md);
}

.sd-profile-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--sd-radius-pill);
  padding: 0.7rem 0.5rem;
  min-height: 48px;
  background: transparent;
  color: var(--sd-text-muted);
  font-family: var(--sd-font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--sd-transition), color var(--sd-transition);
}

.sd-profile-tab-btn::after { content: none; }

.sd-profile-tab-btn i {
  font-size: 0.95em;
  opacity: 0.7;
  transition: opacity var(--sd-transition);
}

.sd-profile-tab-btn:hover { background: var(--sd-accent-muted); color: var(--sd-accent); border: none; }

.sd-profile-tab-btn:hover i,
.sd-profile-tab-btn.is-active i { opacity: 1; }

.sd-profile-tab-btn.is-active {
  background: var(--sd-accent-muted);
  border: none;
  color: var(--sd-accent);
}

.sd-profile-tab-btn.is-active::after { content: none; }

/* Press feedback */
.sd-profile-tab-btn:active { transform: scale(0.96); }

.sd-profile-tab-panel[hidden] { display: none; }

/* Strip trailing margin from last field inside each panel */
.sd-profile-tab-panel > .sd-field:last-child,
.sd-profile-tab-panel > .sd-fieldset:last-child { margin-bottom: 0; }

/* Each panel becomes a calm card */
.sd-profile-tab-panel:not([hidden]) {
  display: block;
  background: var(--sd-bg-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-lg);
  padding: var(--sd-space-lg);
}

/* Spacing between fields inside panel */
.sd-profile-tab-panel > .sd-field + .sd-field {
  margin-top: var(--sd-space-lg);
}

/* Keep nav horizontal on all narrow widths — override any column rule */
@media (width <= 480px) {
  .sd-profile-tab-nav { flex-direction: row; }
}

/* ── Profile tab delight animations ─────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes sd-panel-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .sd-profile-tab-panel:not([hidden]) {
    animation: sd-panel-in 0.25s ease;
  }

  @keyframes sd-tab-icon-pop {
    0%   { transform: scale(0.6); opacity: 0.4; }
    65%  { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
  }

  .sd-profile-tab-btn.is-active i {
    animation: sd-tab-icon-pop 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  }
}

/* ── Profile form tag picker — Moonlight Calm style ─────── */

/* Tags: dark neutral pill, no purple */
.sd-profile-tab-panel .sd-tag {
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
}

.sd-profile-tab-panel .sd-tag.selected {
  background: var(--sd-bg-soft);
  color: var(--sd-text);
  border-color: var(--sd-border-strong);
  box-shadow: none;
}

/* Container: no box, tags float freely */
.sd-profile-tab-panel .sd-tags-container {
  border: none;
  background: transparent;
  padding: 0.25rem 0;
  min-height: auto;
  margin-bottom: 0.25rem;
}

/* Input: dashed border */
.sd-profile-tab-panel .sd-input--tag-custom {
  border-style: dashed;
  border-color: var(--sd-border);
  padding-right: 2.5rem;
}

/* ↵ icon: overlay on right of input, hide hint text */
.sd-profile-tab-panel .sd-tag-custom-hint {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-right: 0.85rem;
  margin-top: -2.75rem;
  height: 2.75rem;
  pointer-events: none;
  font-size: 0;
  font-style: normal;
  color: transparent;
}

.sd-profile-tab-panel .sd-tag-custom-hint::after {
  content: "↵";
  font-size: 1.1rem;
  color: var(--sd-text-muted);
}

/* ── Family member picker ────────────────────────────────── */
.sd-family-member-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.sd-family-member-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sd-family-member-name {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  padding: 0.45rem 0.75rem;
  height: 2.5rem;
  box-sizing: border-box;
}

.sd-family-member-rel {
  flex: 0 0 140px;
}

.sd-family-member-rel .sd-select-trigger {
  font-size: 0.85rem;
  padding: 0.45rem 0.65rem;
  height: 2.5rem;
}

.sd-family-member-remove {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--sd-radius-sm);
  border: 1.5px solid var(--sd-border-strong);
  background: transparent;
  color: var(--sd-text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  transition: background var(--sd-transition), color var(--sd-transition),
              border-color var(--sd-transition);
}

.sd-family-member-remove:hover {
  background: rgb(239 68 68 / 15%);
  border-color: rgb(239 68 68 / 50%);
  color: #f87171;
}

.sd-family-member-add {
  font-size: 0.8rem;
  padding: 0.3rem 0.85rem;
  height: auto;
}

/* ── Credits page ─────────────────────────────────────────── */

/* Credits page — delight (only when motion is OK) */

/* ── Family story pill on story cards ───────────────────────────── */

/* Extends the base sd-story-cover-pill with an accent tint to
   distinguish multi-kid stories from single-profile stories */
.sd-story-cover-pill--family {
  background: rgb(124 58 237 / 45%);
  color: rgb(233 213 255 / 95%);
}

/* ── Family stories delight ──────────────────────────────────────── */

/* Glow pulse plays once when the submit button transitions to enabled */

/* ── Install guide page ──────────────────────────────────────────── */
.sd-install-page {
  padding: var(--sd-space-3xl) 0;
}

.sd-install-page-header {
  text-align: center;
  margin-bottom: var(--sd-space-xl);
}

.sd-install-page-header .sd-section-heading {
  margin-bottom: var(--sd-space-xs);
}

.sd-install-subheading {
  font-family: var(--sd-font);
  font-size: 1.05rem;
  color: var(--sd-text-soft);
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.sd-install-tip {
  display: flex;
  align-items: center;
  gap: var(--sd-space-xs);
  padding: var(--sd-space-sm) var(--sd-space-md);
  background: var(--sd-accent-muted);
  border: 1px solid var(--sd-accent);
  border-radius: var(--sd-radius-md);
  font-family: var(--sd-font);
  font-size: 0.9rem;
  color: var(--sd-text);
  line-height: 1.5;
  margin-top: var(--sd-space-lg);
}

.sd-install-tip i {
  flex-shrink: 0;
  margin-top: 0.15rem;
  color: var(--sd-accent);
  font-size: 1rem;
}


.sd-install-tabs-wrapper {
  margin-top: var(--sd-space-xl);
}

.sd-install-panel {
  min-height: 60vh; /* prevents page reflow when switching between panels with different step counts */
}

.sd-install-tabs {
  display: flex;
  gap: var(--sd-space-xs);
  justify-content: center;
  margin-bottom: var(--sd-space-lg);
  flex-wrap: wrap;
}

.sd-install-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  border-radius: var(--sd-radius-pill);
  border: 1.5px solid var(--sd-border);
  background: transparent;
  color: var(--sd-text-soft);
  font-family: var(--sd-font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sd-install-tab:hover {
  border-color: var(--sd-accent);
  color: var(--sd-accent);
}

.sd-install-tab:active {
  opacity: 0.8;
  transform: scale(0.97);
}

.sd-install-tab:focus-visible {
  outline: 2px solid var(--sd-accent);
  outline-offset: 3px;
}

.sd-install-tab.active {
  background: var(--sd-accent);
  border-color: var(--sd-accent);
  color: var(--sd-text);
}


.sd-install-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sd-space-lg);
}

.sd-install-step {
  display: flex;
  gap: var(--sd-space-md);
  align-items: flex-start;
}

.sd-install-step-number {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: var(--sd-radius-pill);
  background: var(--sd-accent);
  color: var(--sd-text);
  font-family: var(--sd-font);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sd-install-step-body {
  flex: 1;
  min-width: 0;
}

.sd-install-step-title {
  display: block;
  font-family: var(--sd-font);
  font-size: 1rem;
  font-weight: 700;
  line-height: 2rem; /* matches circle height — centers text and circle on the same axis */
  color: var(--sd-text);
  margin-bottom: 0;
  overflow-wrap: break-word;
}

.sd-install-step-desc {
  font-family: var(--sd-font);
  font-size: 0.9rem;
  color: var(--sd-text-soft);
  margin: 0 0 var(--sd-space-sm);
  line-height: 1.5;
}

/* ── Tablet: screenshot beside step text ── */
@media (width >= 640px) {
  .sd-install-step-body {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: var(--sd-space-xl);
    align-items: start;
  }

  /* Explicit placement keeps title/desc in col 1 even when screenshot is absent */
  .sd-install-step-title {
    grid-column: 1;
    grid-row: 1;
  }

  .sd-install-step-desc {
    grid-column: 1;
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sd-install-tab {
    transition: none;
  }

  .sd-install-tab:active {
    transform: none;
  }
}

/* ── Mobile ── */
@media (width <= 639px) {
  .sd-install-page {
    padding: var(--sd-space-md) 0 var(--sd-space-xl);
  }

  .sd-install-page-header {
    margin-bottom: var(--sd-space-md);
  }

  .sd-install-subheading {
    font-size: 0.9rem;
  }

  .sd-install-tip {
    font-size: 0.82rem;
    padding: var(--sd-space-sm) var(--sd-space-md);
    margin-top: var(--sd-space-md);
  }

  .sd-install-tabs-wrapper {
    margin-top: var(--sd-space-md);
  }

  .sd-install-tabs {
    gap: 0.35rem;
    margin-bottom: var(--sd-space-md);
    flex-wrap: nowrap;
  }

  .sd-install-tab {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.78rem;
    gap: 0.3rem;
  }

  .sd-install-steps {
    gap: var(--sd-space-md);
  }
}

/* ── Star picker ────────────────────────────────────────────── */
.sd-star-picker {
  display: flex;
  gap: 0.125rem;
  align-items: center;
  padding: 0.25rem 0;
}

.sd-star-picker--error {
  outline: 2px solid rgb(239 68 68 / 60%);
  outline-offset: 4px;
  border-radius: var(--sd-radius-sm);
}

/* Color set on the button cascades to the FA SVG inside via fill:currentColor.
   We never target <i> or <svg> directly — FA SVG+JS replaces <i> tags. */
.sd-star-btn {
  all: unset;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--sd-radius-sm);
  color: rgb(255 255 255 / 18%);
  transition: color 0.2s ease, transform 0.15s ease;
}

/* Selected: gold. data-selected is set server-side and updated by Stimulus. */
.sd-star-btn[data-selected="true"] {
  color: var(--sd-gold);
}

.sd-star-btn:focus-visible {
  outline: 2px solid var(--sd-accent);
  outline-offset: 2px;
}

/* Size the icon child — works for both <i> (CSS FA) and <svg> (SVG+JS FA) */
.sd-star-btn > * {
  font-size: 1.8rem;
  width: 1.8rem;
  height: 1.8rem;
  pointer-events: none;
}

@media (hover: hover) {
  .sd-star-btn:hover {
    transform: scale(1.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sd-star-btn { transition: none; }
  .sd-star-btn:hover { transform: none; }
}

/* ── Star hint label (e.g. "Excelente") ─────────────────────── */
.sd-star-hint {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sd-gold);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.sd-star-hint--visible {
  opacity: 1;
  transform: translateY(0);
}

.sd-star-hint--preview {
  opacity: 0.65;
}

@media (prefers-reduced-motion: reduce) {
  .sd-star-hint { transition: none; }
}

/* ── Word counter ────────────────────────────────────────────── */
.sd-word-count {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.35rem;
  color: var(--sd-text-muted);
  transition: color 0.25s ease;
}

.sd-word-count--ok {
  color: var(--sd-success);
}

/* ── Mobile adaptations for review views (≤768px) ───────────── */
@media (width <= 768px) {
  /* Reduce star icon on narrow screens to keep all 5 in one row */
  .sd-star-btn > * {
    font-size: 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
  }

  /* Disclaimer stacks icon + text naturally; reduce padding */

  /* Status badge wraps text on very narrow phones */

  /* Reduce textarea height on mobile to save scroll */
}

/* ── Parental consent checkbox ───────────────────────────────── */
.sd-consent-section {
  padding: var(--sd-space-md) 0;
  border-top: 1px solid rgba(255 255 255 / 8%);
}

/* Disable submit until consent is checked */

.sd-consent-label {
  display: flex;
  align-items: flex-start;
  gap: var(--sd-space-sm);
  cursor: pointer;
}

.sd-consent-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.sd-consent-checkmark {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 2px solid rgba(255 255 255 / 40%);
  border-radius: 4px;
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}

.sd-consent-checkbox:checked + .sd-consent-checkmark {
  background: var(--sd-color-accent, #a78bfa);
  border-color: var(--sd-color-accent, #a78bfa);
}

.sd-consent-checkbox:checked + .sd-consent-checkmark::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.sd-consent-checkbox:focus-visible + .sd-consent-checkmark {
  outline: 2px solid var(--sd-color-accent, #a78bfa);
  outline-offset: 2px;
}

.sd-consent-text {
  font-size: 0.875rem;
  line-height: 1.5;
  color: rgba(255 255 255 / 75%);
}

.sd-consent-text a {
  color: var(--sd-color-accent, #a78bfa);
  text-decoration: underline;
}

/* ── Very small phones (≤480px) ─────────────────────────────── */
@media (width <= 480px) {
  /* 5 × 40px + 4 × gap fits 320px-wide viewport (card has ~1rem padding each side) */
  .sd-star-btn {
    min-width: 40px;
  }

  .sd-star-btn > * {
    font-size: 1.4rem;
    width: 1.4rem;
    height: 1.4rem;
  }

  /* On very small screens, wrap hint to its own line */
}

/* ── Utility: accent text (used in locale html_safe spans) ── */
.sd-accent-text { color: var(--sd-accent); }

/* ── Utility: gold text (used in locale html_safe spans) ─────── */
.sd-gold-text { color: var(--sd-gold); }

/* ── Stars background (pure CSS, no JS) ─────────────────────── */
.sd-v1-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.sd-v1-stars::before,
.sd-v1-stars::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgb(255 255 255 / 70%) 0%, transparent 100%),
    radial-gradient(1px 1px at 25% 40%, rgb(255 255 255 / 50%) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 10%, rgb(255 255 255 / 60%) 0%, transparent 100%),
    radial-gradient(1px 1px at 55% 60%, rgb(255 255 255 / 40%) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 25%, rgb(255 255 255 / 70%) 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 50%, rgb(255 255 255 / 50%) 0%, transparent 100%),
    radial-gradient(1px 1px at 15% 70%, rgb(255 255 255 / 40%) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 85%, rgb(255 255 255 / 60%) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 60% 80%, rgb(255 255 255 / 50%) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 75% 75%, rgb(255 255 255 / 40%) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 90%, rgb(255 255 255 / 60%) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 45%, rgb(255 255 255 / 30%) 0%, transparent 100%),
    radial-gradient(2px 2px at 5%  30%, rgb(255 255 255 / 30%) 0%, transparent 100%),
    radial-gradient(1px 1px at 95% 20%, rgb(255 255 255 / 50%) 0%, transparent 100%),
    radial-gradient(1px 1px at 20% 55%, rgb(255 255 255 / 40%) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 5%,  rgb(255 255 255 / 60%) 0%, transparent 100%);
}

/* ── Pill badges ─────────────────────────────────────────────── */
.sd-v1-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--sd-radius-pill);
  font-family: var(--sd-font);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.sd-v1-pill--gold {
  background: rgb(251 191 36 / 15%);
  color: var(--sd-gold);
}

.sd-v1-pill--accent {
  background: rgb(167 139 250 / 15%);
  color: var(--sd-accent);
}

/* ── Section layout ─────────────────────────────────────────── */
.sd-v1-section {
  position: relative;
  padding: 100px 64px;
  background: var(--sd-bg);
}

.sd-v1-section--deep {
  background: var(--sd-bg-v1-deep);
}

.sd-v1-section-header {
  text-align: center;
  margin-bottom: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.sd-v1-section-title {
  font-family: var(--sd-font-heading);
  font-size: 3.375rem;
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--sd-text);
  margin: 0;
}

.sd-v1-section-title--center {
  text-align: center;
  margin-bottom: 48px;
}

/* ── Hero section ────────────────────────────────────────────── */
.sd-v1-hero {
  position: relative;
  overflow: hidden;
  padding: 32px 64px 72px;
  background: var(--sd-bg);
}

.sd-v1-moon-deco {
  position: absolute;
  top: 16px;
  right: 48px;
  width: 96px;
  height: 96px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
}

.sd-v1-hero-glow {
  position: absolute;
  bottom: -120px;
  left: -80px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgb(124 58 237 / 18%) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.sd-v1-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 64px;
  align-items: center;
}

/* Hero copy column */
.sd-v1-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sd-v1-hero-title {
  font-family: var(--sd-font-heading);
  font-size: 4rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--sd-text);
  margin: 0;
}

.sd-v1-hero-subtitle {
  font-size: 1.1875rem;
  line-height: 1.55;
  color: rgb(244 241 255 / 70%);
  margin: 0;
  max-width: 520px;
}

/* Email signup form */
.sd-v1-signup-form {
  display: flex;
  align-items: center;
  background: rgb(255 255 255 / 5%);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-pill);
  padding: 6px;
  backdrop-filter: blur(10px);
  gap: 0;
  max-width: 520px;
}

.sd-v1-signup-form--centered {
  margin: 0 auto;
}

.sd-v1-signup-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--sd-text);
  font-family: var(--sd-font);
  font-size: 0.9375rem;
  padding: 10px 18px;
  min-width: 0;
}

.sd-v1-signup-input::placeholder {
  color: rgb(244 241 255 / 40%);
}

.sd-v1-signup-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--sd-accent-dark);
  color: #fff;
  font-family: var(--sd-font);
  font-size: 0.9375rem;
  font-weight: 700;
  border: none;
  border-radius: var(--sd-radius-pill);
  padding: 14px 24px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 28px rgb(124 58 237 / 50%);
  transition: transform 0.2s, box-shadow 0.2s;
}

.sd-v1-signup-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgb(124 58 237 / 60%);
}

/* Check row */
.sd-v1-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.sd-v1-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: rgb(244 241 255 / 70%);
}

.sd-v1-check .fa-check {
  color: var(--sd-accent);
  font-size: 0.75rem;
}

/* Proof row */
.sd-v1-proof-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--sd-border);
  flex-wrap: wrap;
}

.sd-v1-avatars {
  display: flex;
}

.sd-v1-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--sd-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  margin-right: -8px;
}

.sd-v1-proof-stars {
  display: flex;
  gap: 2px;
  color: var(--sd-gold);
  font-size: 0.875rem;
}

.sd-v1-proof-caption {
  font-size: 0.8125rem;
  color: rgb(244 241 255 / 70%);
  margin: 0;
}

/* Hero visual column */
.sd-v1-hero-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Mascots */
.sd-v1-mascots {
  position: relative;
  height: 420px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sd-v1-mascots-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgb(124 58 237 / 25%) 0%, transparent 70%);
  pointer-events: none;
}

.sd-v1-mascot-nuno {
  height: 380px;
  width: auto;
  margin-right: -40px;
  filter: drop-shadow(0 24px 40px rgb(124 58 237 / 45%));
  position: relative;
  z-index: 1;
}

.sd-v1-mascot-nube {
  height: 220px;
  width: auto;
  margin-bottom: -10px;
  filter: drop-shadow(0 18px 30px rgb(124 58 237 / 40%));
  position: relative;
  z-index: 2;
}

/* Audio player */
.sd-v1-audio-player {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgb(255 255 255 / 4%);
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 24px;
  padding: 24px;
  backdrop-filter: blur(20px);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 30px 80px rgb(0 0 0 / 40%);
}

.sd-v1-play-btn {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--sd-accent-dark);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 0 0 8px rgb(124 58 237 / 13%), 0 8px 24px rgb(124 58 237 / 40%);
  transition: transform 0.2s;
}

.sd-v1-play-btn:hover {
  transform: scale(1.06);
}

.sd-v1-player-track {
  flex: 1;
  min-width: 0;
}

.sd-v1-player-title {
  font-family: var(--sd-font-heading);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--sd-text);
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-v1-player-subtitle {
  font-size: 0.75rem;
  color: rgb(244 241 255 / 50%);
  letter-spacing: 0.02em;
  margin: 0 0 12px;
}

/* Waveform bars */
.sd-v1-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  margin-bottom: 8px;
}

.sd-v1-bar {
  display: block;
  width: 3px;
  border-radius: 9999px;
  background: var(--sd-accent);
  opacity: 0.7;
  transition: height 0.1s ease;
  min-height: 4px;
}

.sd-v1-player-time {
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.6875rem;
  color: rgb(244 241 255 / 50%);
}

.sd-v1-audio-caption {
  font-size: 0.8125rem;
  color: rgb(244 241 255 / 50%);
  text-align: center;
  margin: 0;
}

/* ── How it works ────────────────────────────────────────────── */
.sd-v1-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.sd-v1-step-card {
  background: rgb(124 58 237 / 6%);
  border: 1px solid var(--sd-border);
  border-radius: 24px;
  padding: 36px;
  position: relative;
}

.sd-v1-step-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sd-v1-step-number {
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--sd-accent);
  letter-spacing: -0.02em;
}

.sd-v1-step-icon {
  font-size: 1.5rem;
  color: rgb(167 139 250 / 25%);
}

.sd-v1-step-title {
  font-family: var(--sd-font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--sd-text);
  margin: 0 0 12px;
  line-height: 1.2;
}

.sd-v1-step-desc {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: rgb(244 241 255 / 70%);
  margin: 0;
}

/* ── Today hook ──────────────────────────────────────────────── */
.sd-v1-today-hook {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

.sd-v1-today-copy {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sd-v1-today-p {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: rgb(244 241 255 / 70%);
  margin: 0;
}

.sd-v1-today-privacy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8125rem;
  color: rgb(244 241 255 / 50%);
  margin: 0;
  border-top: 1px solid var(--sd-border);
  padding-top: 16px;
}

.sd-v1-today-privacy .fa-lock {
  color: var(--sd-accent);
  margin-top: 2px;
  flex-shrink: 0;
}

/* Story preview cards */
.sd-v1-today-cards {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sd-v1-story-card {
  border-radius: 20px;
  padding: 28px;
}

.sd-v1-story-card--input {
  background: rgb(124 58 237 / 6%);
  border: 1px solid var(--sd-border);
  transform: rotate(-2deg);
  position: relative;
  z-index: 1;
  box-shadow: 0 30px 70px rgb(124 58 237 / 30%);
}

.sd-v1-story-card--output {
  background: linear-gradient(135deg, rgb(124 58 237 / 25%), rgb(167 139 250 / 10%));
  border: 1px solid rgb(167 139 250 / 40%);
  transform: rotate(1deg);
  position: relative;
  z-index: 2;
  margin-top: -20px;
  box-shadow: 0 30px 70px rgb(124 58 237 / 30%);
}

.sd-v1-story-card-eyebrow {
  display: block;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sd-accent);
  margin-bottom: 12px;
}

.sd-v1-story-card-title {
  font-family: var(--sd-font-heading);
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--sd-text);
  margin: 0 0 10px;
}

.sd-v1-story-card-body {
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgb(244 241 255 / 70%);
  margin: 0;
}

.sd-v1-story-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--sd-border);
}

.sd-v1-story-card-voice {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: rgb(244 241 255 / 60%);
}

.sd-v1-story-card-play {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--sd-accent);
  font-weight: 600;
}

/* ── Features grid ───────────────────────────────────────────── */
.sd-v1-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.sd-v1-feature-card {
  background: rgb(124 58 237 / 6%);
  border: 1px solid var(--sd-border);
  border-radius: 20px;
  padding: 28px;
  transition: transform 0.2s, border-color 0.2s;
}

.sd-v1-feature-card:hover {
  transform: translateY(-2px);
  border-color: rgb(167 139 250 / 35%);
}

.sd-v1-feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgb(167 139 250 / 15%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sd-accent);
  font-size: 1.125rem;
  margin-bottom: 16px;
}

.sd-v1-feature-title {
  font-family: var(--sd-font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--sd-text);
  margin: 0 0 8px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.sd-v1-feature-desc {
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgb(244 241 255 / 70%);
  margin: 0;
}

/* ── Testimonials ────────────────────────────────────────────── */
.sd-v1-testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.sd-v1-testimonial-card {
  background: rgb(124 58 237 / 6%);
  border: 1px solid var(--sd-border);
  border-radius: 20px;
  padding: 28px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sd-v1-testimonial-stars {
  display: flex;
  gap: 3px;
  color: var(--sd-gold);
}

.sd-v1-testimonial-quote {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: rgb(244 241 255 / 85%);
  font-style: italic;
  font-weight: 500;
  margin: 0;
  flex: 1;
}

.sd-v1-testimonial-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--sd-border);
}

.sd-v1-testimonial-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sd-accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
  flex-shrink: 0;
}

.sd-v1-testimonial-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sd-text);
  margin: 0;
}

/* ── Pricing ─────────────────────────────────────────────────── */
.sd-v1-plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: stretch;
}

/* When basic_plan is nil, only 2 columns show — auto-center them */
.sd-v1-plans-grid:has(.sd-v1-plan-card:nth-child(2):last-child) {
  grid-template-columns: repeat(2, 1fr);
  max-width: 700px;
  margin: 0 auto;
}

.sd-v1-plan-card {
  background: rgb(124 58 237 / 6%);
  border: 1px solid var(--sd-border);
  border-radius: 24px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  margin-top: 20px;
}

.sd-v1-plan-card--featured {
  background: linear-gradient(180deg, rgb(124 58 237 / 20%), rgb(124 58 237 / 5%));
  border-color: var(--sd-accent);
  box-shadow: 0 30px 60px rgb(124 58 237 / 25%);
}

.sd-v1-plan-name {
  font-family: var(--sd-font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--sd-text);
  margin: 0;
  line-height: 1.2;
}

.sd-v1-plan-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 4px 14px;
  border-radius: var(--sd-radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
}

.sd-v1-plan-badge--gold {
  background: var(--sd-gold);
  color: #1a1040;
}

.sd-v1-plan-badge--accent {
  background: rgb(167 139 250 / 15%);
  color: var(--sd-accent);
  border: 1px solid rgb(167 139 250 / 40%);
}

.sd-v1-plan-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.sd-v1-plan-price {
  font-family: var(--sd-font-heading);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--sd-text);
}

.sd-v1-plan-period {
  font-size: 0.875rem;
  color: rgb(244 241 255 / 50%);
}

.sd-v1-plan-credits {
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--sd-accent);
  margin: 0;
}

.sd-v1-plan-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.sd-v1-plan-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: rgb(244 241 255 / 70%);
}

.sd-v1-plan-features li .fa-check {
  color: var(--sd-accent);
  font-size: 0.75rem;
  margin-top: 3px;
  flex-shrink: 0;
}

.sd-v1-plan-btn {
  display: block;
  text-align: center;
  padding: 14px 24px;
  border-radius: var(--sd-radius-pill);
  font-family: var(--sd-font);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: auto;
  cursor: pointer;
}

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

.sd-v1-plan-btn--outline:hover {
  border-color: var(--sd-accent);
  color: var(--sd-accent);
  transform: translateY(-1px);
}

.sd-v1-plan-btn--primary {
  background: var(--sd-accent-dark);
  color: #fff;
  border: none;
  box-shadow: 0 8px 28px rgb(124 58 237 / 50%);
}

.sd-v1-plan-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgb(124 58 237 / 60%);
}

/* ── FAQ ─────────────────────────────────────────────────────── */
.sd-v1-faq-list {
  max-width: 880px;
  margin: 0 auto;
}

.sd-v1-faq-item {
  border-bottom: 1px solid var(--sd-border);
}

.sd-v1-faq-item:first-child {
  border-top: 1px solid var(--sd-border);
}

.sd-v1-faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--sd-text);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.sd-v1-faq-question::-webkit-details-marker { display: none; }

.sd-v1-faq-chevron {
  color: var(--sd-accent);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.sd-v1-faq-item[open] .sd-v1-faq-chevron {
  transform: rotate(180deg);
}

.sd-v1-faq-answer {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: rgb(244 241 255 / 70%);
  margin: 0;
  padding-bottom: 20px;
  max-width: 720px;
}

/* ── Final CTA ───────────────────────────────────────────────── */
.sd-v1-final-cta {
  position: relative;
  overflow: hidden;
  padding: 120px 64px;
  text-align: center;
  background: var(--sd-bg);
}

.sd-v1-stars--cta {
  opacity: 0.6;
}

.sd-v1-cta-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgb(124 58 237 / 20%) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.sd-v1-final-cta-inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.sd-v1-cta-moon {
  width: 72px;
  height: 72px;
}

.sd-v1-cta-title {
  font-family: var(--sd-font-heading);
  font-size: 4rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--sd-text);
  margin: 0;
}

.sd-v1-cta-desc {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: rgb(244 241 255 / 70%);
  margin: 0;
  max-width: 520px;
}

/* ── Tablet / 1024px ─────────────────────────────────────────── */
@media (width <= 1024px) {
  .sd-v1-hero {
    padding: 40px 32px 80px;
  }

  .sd-v1-section {
    padding: 80px 32px;
  }

  .sd-v1-final-cta {
    padding: 80px 32px;
  }

  .sd-v1-hero-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .sd-v1-hero-visual {
    order: -1;
  }

  .sd-v1-hero-title {
    font-size: 3.5rem;
  }

  .sd-v1-mascots {
    height: 260px;
  }

  .sd-v1-mascot-nuno {
    height: 240px;
  }

  .sd-v1-mascot-nube {
    height: 140px;
  }

  .sd-v1-section-title {
    font-size: 2.5rem;
  }

  .sd-v1-steps-grid {
    gap: 16px;
  }

  .sd-v1-today-hook {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .sd-v1-cta-title {
    font-size: 3rem;
  }
}

/* ── Mobile / 768px ─────────────────────────────────────────── */
@media (width <= 768px) {
  .sd-v1-hero {
    padding: 32px 20px 64px;
  }

  .sd-v1-section {
    padding: 64px 20px;
  }

  .sd-v1-final-cta {
    padding: 64px 20px;
  }

  .sd-v1-hero-title {
    font-size: 2.75rem;
  }

  .sd-v1-signup-form {
    flex-direction: column;
    border-radius: 16px;
    gap: 8px;
    padding: 12px;
    align-items: stretch;
    max-width: 100%;
    width: 100%;
  }

  .sd-v1-signup-input {
    padding: 12px 16px;
  }

  .sd-v1-signup-btn {
    justify-content: center;
    border-radius: 12px;
    padding: 14px 20px;
  }

  .sd-v1-steps-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sd-v1-features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .sd-v1-testimonials-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sd-v1-plans-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sd-v1-plan-card--featured {
    transform: none;
    order: -1;
  }

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

  .sd-v1-cta-title {
    font-size: 2.5rem;
  }

  .sd-v1-moon-deco {
    display: none;
  }

  .sd-v1-hero-visual {
    width: 100%;
    overflow: hidden;
  }

  .sd-v1-audio-player {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  .sd-v1-waveform {
    overflow: hidden;
  }
}

/* ── Small phone / 480px ────────────────────────────────────── */
@media (width <= 480px) {
  .sd-v1-hero-title {
    font-size: 2.25rem;
  }

  .sd-v1-mascot-nuno {
    height: 190px;
  }

  .sd-v1-mascot-nube {
    height: 115px;
  }

  .sd-v1-mascots {
    height: 200px;
  }

  .sd-v1-features-grid {
    grid-template-columns: 1fr;
  }

  .sd-v1-section-title {
    font-size: 1.75rem;
  }

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

  .sd-v1-checks {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .sd-v1-proof-row {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
  }

  .sd-v1-play-btn {
    width: 52px;
    height: 52px;
    font-size: 1rem;
  }
}

