:root {
  /* Light theme */
  --background: oklch(0.98 0.01 280);
  --foreground: oklch(0.15 0.02 280);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.15 0.02 280);
  --muted: oklch(0.94 0.01 280);
  --muted-foreground: oklch(0.45 0.02 280);
  --border: oklch(0.88 0.02 280);
  --primary: oklch(0.5 0.2 280);
  --primary-foreground: oklch(0.98 0 0);
  --accent: oklch(0.55 0.22 290);
  --accent-foreground: oklch(0.98 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(0.98 0 0);
  --radius: 0.75rem;
  --radius-full: 999px;
  color-scheme: light dark;
}

.dark {
  /* Dark theme */
  --background: oklch(0.08 0 0);
  --foreground: oklch(0.95 0 0);
  --card: oklch(0.12 0.02 280);
  --card-foreground: oklch(0.95 0 0);
  --muted: oklch(0.25 0.03 0);
  --muted-foreground: oklch(0.65 0 0);
  --border: oklch(0.2 0.02 280);
  --primary: oklch(0.55 0.2 280);
  --primary-foreground: oklch(0.95 0 0);
  --accent: oklch(0.6 0.22 290);
  --accent-foreground: oklch(0.95 0 0);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--foreground);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
  background: color-mix(in oklch, var(--background) 92%, transparent);
  backdrop-filter: blur(10px);
}

.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.logo-text {
  font-size: 19px;
  background: linear-gradient(90deg, color-mix(in oklch, var(--accent) 90%, white), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-icon {
  display: inline-flex;
  color: var(--accent);
}

.nav {
  display: none;
  align-items: center;
  gap: 22px;
}

.nav-link {
  font-size: 15px;
  color: var(--muted-foreground);
  position: relative;
}
.nav-link:hover {
  color: var(--foreground);
}
.nav-link.active {
  color: var(--foreground);
  font-weight: 800;
}
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 2px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent), var(--primary));
  opacity: 0.85;
}

@media (min-width: 768px) {
  .nav {
    display: flex;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu {
  position: relative;
  display: inline-flex;
}
.mobile-menu > summary {
  list-style: none;
}
.mobile-menu > summary::-webkit-details-marker {
  display: none;
}
.mobile-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: 240px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
  background: var(--card);
  box-shadow: 0 18px 60px color-mix(in oklch, black 40%, transparent);
}
.mobile-menu-link {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 15px;
  color: var(--foreground);
}
.mobile-menu-link:hover {
  background: color-mix(in oklch, var(--muted) 60%, transparent);
}
.mobile-menu-link.active {
  background: color-mix(in oklch, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent) 22%, var(--border));
}

.mobile-menu[open] > summary {
  border-color: color-mix(in oklch, var(--accent) 60%, var(--border));
}

@media (min-width: 768px) {
  .mobile-menu {
    display: none;
  }
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
  background: color-mix(in oklch, var(--muted) 60%, transparent);
  color: var(--foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-button:hover {
  border-color: color-mix(in oklch, var(--accent) 60%, var(--border));
}

.icon-sun {
  display: none;
}
.dark .icon-sun {
  display: inline-flex;
}
.dark .icon-moon {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-full);
  padding: 9px 14px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, filter 160ms ease, color 160ms ease;
}

.btn-icon {
  display: inline-flex;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
}
.btn-primary:hover {
  filter: brightness(0.95);
}

.btn-outline {
  background: transparent;
  border-color: color-mix(in oklch, var(--border) 85%, var(--foreground));
  color: var(--foreground);
}
.btn-outline:hover {
  border-color: color-mix(in oklch, var(--accent) 55%, var(--border));
  background: color-mix(in oklch, var(--accent) 12%, transparent);
}

.btn-ghost {
  background: transparent;
  color: var(--foreground);
}
.btn-ghost:hover {
  background: color-mix(in oklch, var(--muted) 45%, transparent);
}

.btn:disabled,
button.btn[disabled],
button.btn-outline[disabled],
button.btn-primary[disabled],
button.btn-ghost[disabled] {
  cursor: not-allowed;
}

/* --- Form controls (reusable) --- */
.form-label {
  display: block;
  font-size: 13px;
  margin: 10px 0 6px;
  color: var(--muted-foreground);
}
.form-input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
  background: color-mix(in oklch, var(--card) 85%, transparent);
  color: var(--foreground);
  outline: none;
}
.form-input:focus {
  border-color: color-mix(in oklch, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}
.form-help {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted-foreground);
}
.form-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.site-main {
  padding: 24px 0 0;
  flex: 1 0 auto;
}

.card {
  background: color-mix(in oklch, var(--card) 70%, transparent);
  border: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px color-mix(in oklch, black 18%, transparent);
}

/* Prevent <details> cards in grids from stretching to the tallest sibling */
#types details.card {
  align-self: start;
}

/* --- Types (details cards) layout --- */
#types .types-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 900px) {
  #types .types-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

#types details.details-card {
  position: relative;
  padding: 18px 18px 44px;
}
#types details.details-card > summary::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: 10px;
  height: 10px;
  border-right: 2px solid color-mix(in oklch, var(--muted-foreground) 60%, transparent);
  border-bottom: 2px solid color-mix(in oklch, var(--muted-foreground) 60%, transparent);
  transform: translateX(-50%) rotate(45deg);
  opacity: 0.65;
}
#types details.details-card[open] > summary::after {
  transform: translateX(-50%) rotate(-135deg);
  opacity: 0.45;
}

.site-footer {
  margin-top: 64px;
  border-top: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
  background: color-mix(in oklch, var(--background) 96%, transparent);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  padding: 40px 16px 22px;
}

@media (min-width: 900px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
    gap: 28px;
  }
}

.footer-title {
  margin: 0 0 10px;
  font-size: 19px;
}

.footer-subtitle {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--foreground);
}

.footer-text {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 15px;
  line-height: 1.5;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  color: var(--muted-foreground);
  font-size: 15px;
}

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

.footer-bottom {
  padding: 18px 16px 34px;
  border-top: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
}

.footer-copy {
  margin: 0;
  font-size: 14px;
  color: var(--muted-foreground);
}

/* --- Animations --- */
@keyframes soft-glow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.animate-soft-glow {
  animation: soft-glow 3s ease-in-out infinite;
}

.hidden {
  display: none !important;
}

/* --- Background --- */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -10;
  overflow: hidden;
}
.page-bg-gradient {
  position: absolute;
  inset: 0;
  background: radial-gradient(1200px 800px at 30% 20%, color-mix(in oklch, var(--primary) 18%, transparent), transparent 60%),
    radial-gradient(1200px 800px at 70% 30%, color-mix(in oklch, var(--accent) 18%, transparent), transparent 60%),
    linear-gradient(135deg, var(--background), color-mix(in oklch, var(--background) 88%, var(--primary)));
}
.stars {
  position: absolute;
  inset: 0;
}
.moon {
  position: absolute;
  right: clamp(-36px, 4vw, 54px);
  top: clamp(58px, 7vh, 120px);
  width: clamp(160px, 18vw, 260px);
  height: clamp(160px, 18vw, 260px);
  border-radius: var(--radius-full);
  pointer-events: none;
  user-select: none;
  opacity: 0.18;
  mix-blend-mode: screen;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.90), rgba(210, 220, 255, 0.52) 46%, rgba(140, 150, 235, 0.12) 68%, rgba(140, 150, 235, 0.00) 72%);
  animation: moon-drift 18s ease-in-out infinite alternate, moon-flicker 7.5s ease-in-out infinite;
}
.moon::before {
  content: "";
  position: absolute;
  inset: -28%;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(180, 190, 255, 0.22), rgba(180, 190, 255, 0) 62%);
  filter: blur(18px);
  opacity: 0.9;
}
.moon::after {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: inherit;
  background:
    radial-gradient(circle at 28% 34%, rgba(30, 30, 55, 0.14), rgba(30, 30, 55, 0) 44%),
    radial-gradient(circle at 64% 58%, rgba(30, 30, 55, 0.10), rgba(30, 30, 55, 0) 42%),
    radial-gradient(circle at 50% 28%, rgba(30, 30, 55, 0.08), rgba(30, 30, 55, 0) 40%);
  opacity: 0.5;
}
html:not(.dark) .moon {
  display: none;
}

@keyframes moon-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(-18px, 10px, 0) scale(1.02);
  }
}
@keyframes moon-flicker {
  0%,
  100% {
    opacity: 0.16;
  }
  36% {
    opacity: 0.20;
  }
  55% {
    opacity: 0.18;
  }
  74% {
    opacity: 0.22;
  }
}

@media (prefers-reduced-motion: reduce) {
  .moon {
    animation: none;
  }
}
.star {
  position: absolute;
  width: 1px;
  height: 1px;
  background: white;
  border-radius: 50%;
  opacity: 0.6;
}

/* --- Sections --- */
.section {
  padding: 64px 0;
}
.section-border-top {
  border-top: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
}
.section-title {
  margin: 0 0 10px;
  font-size: 34px;
  letter-spacing: -0.02em;
}
.section-subtitle {
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.6;
}

/* --- Hero --- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 56px;
}
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 980px;
  margin: 0 auto;
  text-align: center;
}
.hero-title {
  margin: 0 0 14px;
  font-size: 46px;
  line-height: 1.12;
  letter-spacing: -0.03em;
}
@media (min-width: 768px) {
  .hero-title {
    font-size: 60px;
  }
}
.gradient-text {
  background: linear-gradient(90deg, color-mix(in oklch, var(--accent) 85%, white), var(--primary), color-mix(in oklch, var(--muted) 40%, var(--primary)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lead {
  margin: 0 auto 24px;
  max-width: 860px;
  color: var(--muted-foreground);
  font-size: 19px;
  line-height: 1.6;
}

/* PRO page hero CTA */
.pro-cta {
  max-width: 820px;
  margin: 18px auto 0;
  padding: 18px;
  background: color-mix(in oklch, var(--card) 72%, transparent);
  border-color: color-mix(in oklch, var(--border) 65%, transparent);
}
.pro-cta-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}
.pro-cta-subtitle {
  margin: 0;
  text-align: center;
  color: var(--muted-foreground);
  line-height: 1.6;
}
.pro-cta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}
.pro-cta-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted-foreground);
  line-height: 1.5;
}
.pro-cta-icon {
  width: 30px;
  height: 30px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: color-mix(in oklch, var(--accent) 85%, white);
  background: color-mix(in oklch, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent) 18%, var(--border));
}
.pro-cta-icon svg {
  display: block;
}
@media (min-width: 768px) {
  .pro-cta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .logo-text {
    font-size: 16px;
  }
  .header-inner {
    gap: 10px;
  }
  .header-actions .btn-text {
    display: none;
  }
  .header-actions .btn {
    padding: 9px 12px;
    gap: 8px;
  }

  .hero-title {
    font-size: 40px;
  }
  .hero-lead {
    font-size: 17px;
  }
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted-foreground);
}
.breadcrumbs-link {
  color: var(--muted-foreground);
}
.breadcrumbs-link:hover {
  color: var(--foreground);
  text-decoration: underline;
}
.breadcrumbs-sep {
  opacity: 0.55;
}
.breadcrumbs-current {
  opacity: 0.9;
}

/* --- PRO benefits: cards on desktop, list on mobile --- */
.benefits {
  margin-top: 18px;
}
.benefit {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 0;
  border-top: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
}
.benefit:first-child {
  border-top: 0;
}
.benefit-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: color-mix(in oklch, var(--accent) 85%, white);
  background: color-mix(in oklch, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent) 20%, var(--border));
  margin-top: 2px;
}
.benefit-icon svg {
  display: block;
}
.benefit-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 850;
}
.benefit-text {
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.6;
}

@media (min-width: 768px) {
  .benefits {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .benefit {
    padding: 18px;
    border-top: 0;
    border-radius: 18px;
    border: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
    background: color-mix(in oklch, var(--card) 65%, transparent);
    box-shadow: 0 18px 40px color-mix(in oklch, black 18%, transparent);
    flex-direction: column;
  }
  .benefit:first-child {
    border-top: 0;
  }
  .benefit-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    margin-top: 0;
  }
  .benefit-title {
    font-size: 18px;
    margin: 4px 0 8px;
  }
}

.type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}
.type-wrap {
  position: relative;
}
.type-btn {
  border: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
  background: color-mix(in oklch, var(--card) 70%, transparent);
  color: var(--foreground);
  border-radius: var(--radius-full);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 150ms ease;
}
.type-btn:hover {
  border-color: color-mix(in oklch, var(--accent) 55%, var(--border));
}
.type-btn.active {
  background: var(--accent);
  color: var(--accent-foreground);
  border-color: transparent;
  box-shadow: 0 12px 28px color-mix(in oklch, var(--accent) 25%, transparent);
}
.type-btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tooltip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 10px);
  width: 290px;
  background: color-mix(in oklch, var(--card) 88%, transparent);
  border: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 18px 50px color-mix(in oklch, black 20%, transparent);
  text-align: left;
  backdrop-filter: blur(10px);
  z-index: 30;
  display: none;
}
.type-wrap:hover .tooltip {
  display: block;
}
.tooltip-title {
  margin: 0 0 8px;
  font-size: 14px;
}
.tooltip-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-foreground);
}
.tooltip-pro {
  margin-top: 10px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 650;
  display: flex;
  gap: 8px;
  align-items: center;
}
.tooltip-pro-text {
  min-width: 0;
}
.tooltip-pro a {
  color: inherit;
  text-decoration: underline;
  font-weight: 650;
}
.tooltip-arrow {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 100%;
  width: 0;
  height: 0;
  border: 10px solid transparent;
  border-top-color: color-mix(in oklch, var(--card) 88%, transparent);
}

.dream-box {
  max-width: 860px;
  margin: 0 auto;
  text-align: left;
}
.textarea-wrap {
  position: relative;
}
.dream-textarea {
  width: 100%;
  min-height: 140px;
  /* Big bottom padding: reserves a "free line" for counter + buttons (no overlap with user text) */
  padding: 18px 18px 96px 18px;
  border-radius: 16px;
  border: 2px solid color-mix(in oklch, var(--border) 60%, transparent);
  background: color-mix(in oklch, var(--card) 78%, transparent);
  color: var(--foreground);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  outline: none;
  box-shadow: inset 0 0 0 1px color-mix(in oklch, black 6%, transparent);
}
.dream-textarea::placeholder {
  color: color-mix(in oklch, var(--muted-foreground) 70%, transparent);
  font-style: italic;
}
.dream-textarea:focus {
  border-color: color-mix(in oklch, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 20%, transparent);
}

.textarea-actions {
  position: absolute;
  /* keep clear of the textarea scrollbar */
  right: 34px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.textarea-counter {
  position: absolute;
  left: 18px;
  bottom: 18px;
  pointer-events: none;
  user-select: none;
}
.btn-circle {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
  background: color-mix(in oklch, var(--muted) 55%, transparent);
  color: var(--muted-foreground);
  cursor: pointer;
}
.btn-circle svg {
  display: block;
}
.btn-circle > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-circle.primary {
  background: var(--accent);
  color: var(--accent-foreground);
  border-color: transparent;
  cursor: pointer;
}
.btn-circle.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-circle.not-supported {
  opacity: 0.5;
  cursor: pointer;
}

.btn-circle.voice-listening {
  background: #ef4444;
  color: white;
  border-color: transparent;
  box-shadow: 0 16px 40px rgba(239, 68, 68, 0.35);
  animation: soft-glow 1.4s ease-in-out infinite;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  border: 2px solid color-mix(in oklch, var(--accent-foreground) 30%, transparent);
  border-top-color: var(--accent-foreground);
  animation: spin 0.9s linear infinite;
}

.counter {
  font-size: 13px;
  color: var(--muted-foreground);
}
.counter.danger {
  color: var(--destructive);
}
.disclaimer {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted-foreground);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.5;
}

.hero-note {
  margin: 18px 0 0;
  text-align: center;
  font-size: 15px;
  color: var(--muted-foreground);
}
.hero-note a {
  color: color-mix(in oklch, var(--accent) 70%, white);
  font-weight: 700;
}
.hero-note a:hover {
  text-decoration: underline;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: color-mix(in oklch, black 70%, transparent);
  backdrop-filter: blur(10px);
}
.modal {
  width: 100%;
  max-width: 820px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid color-mix(in oklch, var(--border) 82%, transparent);
  background: var(--card);
  box-shadow: 0 30px 90px color-mix(in oklch, black 45%, transparent), 0 0 0 1px
    color-mix(in oklch, var(--border) 25%, transparent);
}
.modal.small {
  max-width: 520px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
}
.modal-header-simple {
  position: relative;
  justify-content: center;
}
.modal-header-simple .modal-badge {
  margin: 0 auto;
}
.modal-header-simple .modal-close {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}
.modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  border: 1px solid color-mix(in oklch, var(--accent) 35%, var(--border));
  background: color-mix(in oklch, var(--accent) 18%, transparent);
  color: color-mix(in oklch, var(--accent) 80%, white);
}
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
  background: color-mix(in oklch, var(--muted) 45%, transparent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
}
.modal-close:hover {
  background: color-mix(in oklch, var(--muted) 70%, transparent);
}
.modal-body {
  padding: 18px;
  overflow: auto;
  /* In flex modal: body takes the remaining height below header (no fixed header height assumptions) */
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 28px; /* ensure the last CTA button can fully scroll into view */
}
.modal-section-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted-foreground);
}
.modal-dream {
  margin: 0 0 16px;
  background: color-mix(in oklch, var(--muted) 30%, transparent);
  border-radius: 14px;
  padding: 14px;
  line-height: 1.6;
}
.modal-text p {
  margin: 0 0 10px;
  color: var(--muted-foreground);
  line-height: 1.65;
}
.modal-text h5 {
  margin: 16px 0 10px;
  color: var(--foreground);
  font-size: 17px;
}
.modal-text hr {
  border: 0;
  border-top: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
  margin: 14px 0;
}

/* --- Modal content helpers --- */

/* Контейнер для контента модалки с вертикальными отступами */
.modal-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Карточка внутри модалки (информация, форма) */
.modal-card {
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Строка с label: value */
.modal-card-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.modal-card-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
}
.modal-card-value {
  font-weight: 700;
  color: #fff;
  font-size: 15px;
}

/* Карточка с описанием */
.modal-card p {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  line-height: 1.6;
}
.modal-card p:last-child {
  margin-bottom: 0;
}

/* Уведомление (успех/ошибка) */
.modal-alert {
  padding: 14px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
}
.modal-alert.success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #22c55e;
}
.modal-alert.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

/* Блок с ценой */
.modal-price {
  padding: 20px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  text-align: center;
}
.modal-price-value {
  font-size: 36px;
  font-weight: 900;
  color: #f59e0b;
  line-height: 1;
}
.modal-price-desc {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
}

/* Чеклист (галочки) */
.modal-checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-checklist-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
}
.modal-checklist-icon {
  color: #22c55e;
  font-weight: 900;
  font-size: 16px;
  flex-shrink: 0;
}
.modal-checklist-item strong {
  color: #fff;
}

/* Приглушенный текст по центру */
.modal-hint {
  margin: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

/* Список тегов/браузеров */
.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 14px;
}
.modal-tag {
  padding: 6px 12px;
  background: color-mix(in oklch, var(--muted) 60%, transparent);
  border-radius: 8px;
  font-size: 14px;
}

/* Badge варианты */
.modal-badge.danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
}
.modal-badge.success {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #22c55e;
}
.modal-badge.info {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
  color: #3b82f6;
}

/* Сообщение в confirm */
.modal-message {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  line-height: 1.6;
  text-align: center;
}

/* Контейнер для кнопок внизу модалки */
.modal-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.modal-buttons .btn {
  min-width: 120px;
  justify-content: center;
}
/* Вертикальный режим: кнопки по центру, одинаковой ширины */
.modal-buttons.vertical {
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.modal-buttons.vertical .btn,
.modal-buttons.vertical form {
  width: 100%;
  max-width: 320px;
}
.modal-buttons.vertical form {
  display: flex;
}
.modal-buttons.vertical form .btn {
  flex: 1;
}

/* Кнопка подтверждения (красная) */
.btn.btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}
.btn.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* Кнопка успеха (зелёная) */
.btn.btn-success {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}
.btn.btn-success:hover {
  background: #16a34a;
  border-color: #16a34a;
}

/* Ссылка внутри модалки */
.modal-link {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 700;
}

/* Акцент (зелёный текст) */
.modal-accent {
  color: #34d399;
  font-weight: 700;
}

/* Sticky header для больших модалок (с прокруткой контента) */
.modal-header-sticky {
  position: sticky;
  top: 0;
  background: color-mix(in oklch, var(--card) 92%, transparent);
  backdrop-filter: blur(10px);
  z-index: 1;
}

/* Заголовок модалки (крупный, по центру) */
.modal-title {
  margin: 0 0 10px;
  text-align: center;
  font-size: 24px;
  color: var(--primary);
}

/* Мета-информация (теги, тип) */
.modal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.modal-meta-left {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Блок голосования */
.modal-vote-section {
  display: flex;
  justify-content: center;
  padding: 16px 0;
  border-top: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
  border-bottom: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
  margin: 18px 0;
}

.cta-wide {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}
.btn-gradient {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent), var(--primary));
  color: var(--accent-foreground);
  font-weight: 750;
  border: 0;
  text-align: center;
  line-height: 1.2;
  text-wrap: balance;
}
.btn-gradient:hover {
  opacity: 0.95;
}

/* --- Examples carousel --- */
.examples-header {
  text-align: center;
  margin-bottom: 22px;
}
.examples-kicker {
  margin: 8px 0 0;
  color: var(--muted-foreground);
}

.carousel-shell {
  position: relative;
  overflow: hidden;
  width: 100%;
  cursor: grab;
}
.carousel-shell.dragging {
  cursor: grabbing;
}

.carousel {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge legacy */
  padding: 4px 0 10px;
}
.carousel::-webkit-scrollbar {
  display: none;
}

.carousel-track {
  display: flex;
  gap: 14px;
  width: fit-content;
  padding: 0 16px;
}
.dream-card {
  width: 288px;
  height: 192px;
  flex: 0 0 auto;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
  background: color-mix(in oklch, var(--card) 65%, transparent);
  transition: 160ms ease;
  display: flex;
  flex-direction: column;
  user-select: none;
}
.dream-card:hover {
  border-color: color-mix(in oklch, var(--accent) 35%, var(--border));
  background: color-mix(in oklch, var(--card) 80%, transparent);
}
.dream-text {
  margin: 0;
  color: color-mix(in oklch, var(--foreground) 88%, transparent);
  font-size: 14px;
  line-height: 1.55;
  flex: 1;
}

.line-clamp-5 {
  display: -webkit-box;
  line-clamp: 5;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dream-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid color-mix(in oklch, var(--border) 45%, transparent);
  margin-top: 12px;
  padding-top: 10px;
}
.tag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: color-mix(in oklch, var(--accent) 12%, transparent);
  color: color-mix(in oklch, var(--accent) 80%, white);
}
.vote {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 750;
  border: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
  background: color-mix(in oklch, var(--muted) 25%, transparent);
  color: var(--foreground);
}
.type-badge.symbolic {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.24);
  color: rgba(192, 132, 252, 0.95);
}
.type-badge.jungian {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.24);
  color: rgba(96, 165, 250, 0.95);
}
.type-badge.cbt {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.24);
  color: rgba(74, 222, 128, 0.95);
}

.vote-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in oklch, var(--accent) 30%, var(--border));
  background: color-mix(in oklch, var(--accent) 14%, transparent);
  color: color-mix(in oklch, var(--accent) 80%, white);
  cursor: pointer;
}
.vote-btn:hover {
  background: color-mix(in oklch, var(--accent) 20%, transparent);
}
.vote-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in oklch, var(--accent) 30%, var(--border));
  background: color-mix(in oklch, var(--accent) 16%, transparent);
  color: color-mix(in oklch, var(--accent) 85%, white);
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
}
.vote-thanks {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: color-mix(in oklch, var(--accent) 80%, white);
  font-weight: 650;
}


/* ============================================================
   УТИЛИТАРНЫЕ КЛАССЫ
   ============================================================ */

/* Текст */
.text-center { text-align: center; }
.text-muted { color: var(--muted-foreground); }
.text-warning { color: #f59e0b; }
.text-free { color: #34d399; }
.font-bold { font-weight: 700; }

/* Кнопки — блочные/центрированные */
.btn-block { width: 100%; justify-content: center; }
.btn-center { justify-content: center; }

/* ============================================================
   КОМПОНЕНТНЫЕ КЛАССЫ: Страница логина
   ============================================================ */

.auth-card {
  max-width: 480px;
  margin: 24px auto 0;
  padding: 24px;
}
.auth-card h1 {
  margin: 0 0 10px;
  text-align: center;
}
.auth-card .auth-intro {
  margin: 0 0 18px;
  text-align: center;
  color: var(--muted-foreground);
  line-height: 1.6;
}

/* Алерты */
.alert {
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.alert-error {
  border-color: color-mix(in oklch, var(--destructive) 50%, var(--border));
  color: var(--destructive);
  font-size: 15px;
}
.alert-success {
  padding: 14px;
  border-color: color-mix(in oklch, #22c55e 40%, var(--border));
  background: color-mix(in oklch, #22c55e 8%, transparent);
  color: #22c55e;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}
.alert-success a {
  color: #22c55e;
  word-break: break-all;
  font-weight: 400;
}
.alert-success .hint {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
}

/* Разделитель внизу */
.auth-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
}
.auth-footer p {
  margin: 0;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 1.6;
}
.auth-back {
  margin-top: 14px;
  text-align: center;
}
.auth-back a {
  color: var(--muted-foreground);
  font-size: 15px;
}

/* ============================================================
   КОМПОНЕНТНЫЕ КЛАССЫ: Страница PRO
   ============================================================ */

.cta-wide-mt {
  margin-top: 16px;
}
.cta-wide-mt-sm {
  margin-top: 10px;
}
.btn-wide {
  justify-content: center;
  width: 100%;
  max-width: 360px;
}
.section-title-center {
  text-align: center;
  margin-bottom: 22px;
}
.section-footer-note {
  margin: 14px 0 0;
  color: var(--muted-foreground);
  font-size: 13px;
}
.section-center {
  text-align: center;
}
.section-subtitle-mb {
  margin-bottom: 18px;
}

/* ============================================================
   КОМПОНЕНТНЫЕ КЛАССЫ: "Как это работает" на главной
   ============================================================ */

.steps-section {
  text-align: center;
  margin-bottom: 38px;
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.step-card {
  padding: 22px;
  text-align: center;
}
.step-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in oklch, var(--accent) 18%, transparent);
  color: var(--accent);
}
.step-card h3 {
  margin: 0 0 8px;
  font-size: 19px;
}
.step-card p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 15px;
  line-height: 1.6;
}

/* ============================================================
   КОМПОНЕНТНЫЕ КЛАССЫ: FAQ accordion
   ============================================================ */

.faq-item summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 17px;
}
.faq-item summary .faq-subtitle {
  color: var(--muted-foreground);
  font-weight: 600;
  font-size: 14px;
}
.faq-item-content {
  margin-top: 12px;
  color: var(--muted-foreground);
  line-height: 1.7;
  white-space: pre-line;
}

/* ============================================================
   КОМПОНЕНТНЫЕ КЛАССЫ: Блок "Введите email" (freeUsedBlock)
   ============================================================ */

.free-used-block {
  padding: 22px;
  text-align: center;
}
.free-used-block p {
  margin: 0 0 14px;
  color: var(--muted-foreground);
}

/* Отступ для form-input перед кнопкой */
.auth-card .form-input {
  margin-bottom: 14px;
}
.auth-card .form-label {
  margin-top: 0;
}

/* ============================================================
   КОМПОНЕНТНЫЕ КЛАССЫ: Главная страница (index)
   ============================================================ */

/* Секция примеров */
.examples-section {
  overflow: hidden;
}
.examples-title {
  font-size: 30px;
  margin-bottom: 6px;
}

/* Широкий tooltip */
.tooltip-wide {
  width: 310px;
}

/* ============================================================
   КОМПОНЕНТНЫЕ КЛАССЫ: Толкование сна (interpretation)
   ============================================================ */

.interp-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

.interp-summary {
  color: var(--muted-foreground);
  font-style: italic;
  margin-bottom: 1rem;
}

.interp-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.interp-section-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 1rem 0 0.5rem;
}

.interp-section-content {
  color: var(--foreground);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.interp-advice {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--foreground);
}

/* Заголовки секций в модалке толкования */
.interp-section-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-align: center;
  margin: 1.5rem 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.interp-section-label:first-child {
  margin-top: 0;
}

.interp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.interp-tag {
  --tag-hue: 220;
  background: oklch(0.92 0.03 var(--tag-hue));
  border: 1px solid oklch(0.85 0.05 var(--tag-hue));
  color: oklch(0.35 0.1 var(--tag-hue));
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  transition: background 0.2s, border-color 0.2s;
}
.dark .interp-tag {
  background: oklch(0.25 0.03 var(--tag-hue));
  border-color: oklch(0.35 0.06 var(--tag-hue));
  color: oklch(0.85 0.08 var(--tag-hue));
}

/* ============================================================
   DREAM WAIT BLOCK (лимит на главной)
   ============================================================ */

.dream-wait-block {
  background: color-mix(in oklch, var(--card) 70%, transparent);
  border: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
}

.dream-wait-content {
  max-width: 400px;
  margin: 0 auto;
}

.dream-wait-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.dream-wait-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 12px 0;
}

.dream-wait-timer {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 20px 0;
}

.dream-wait-timer span {
  font-family: monospace;
}

.dream-wait-text {
  color: var(--muted-foreground);
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.dream-wait-hint {
  color: var(--muted-foreground);
  font-size: 0.9rem;
  margin: 0 0 16px 0;
}
