:root {
  --coral: #e85a4f;
  --coral-punch: #e63946;
  --brand-purple: #7b2cbf;
  --blush: #fff5f3;
  --ink: #1c1412;
  --sand: #f2c6a0;
  --soft-shadow: rgba(232, 90, 79, 0.16);
  --paper: #f7f3ef;
  --line: rgba(28, 20, 18, 0.1);
  --muted: rgba(28, 20, 18, 0.58);
  --radius: 12px;
  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "DM Sans", system-ui, sans-serif;
  --cloud-glow: rgba(255, 255, 255, 0.85);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(232, 90, 79, 0.14), transparent 55%),
    radial-gradient(800px 420px at 96% 4%, rgba(123, 44, 191, 0.08), transparent 48%),
    linear-gradient(180deg, #fff8f5 0%, var(--paper) 42%, #fff 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

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

.wrap {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

/* -------- Logo cloud -------- */
.logo-cloud {
  position: relative;
  display: inline-grid;
  place-items: center;
  isolation: isolate;
}

.logo-cloud-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 0;
  filter: drop-shadow(0 10px 28px rgba(255, 255, 255, 0.55));
  animation: cloudDrift 7s ease-in-out infinite;
}

.logo-cloud .brand-logo,
.logo-cloud .hero-wordmark {
  position: relative;
  z-index: 1;
}

.logo-cloud--nav {
  width: clamp(168px, 30vw, 230px);
  aspect-ratio: 900 / 320;
  padding: 0.15rem 0.35rem;
}

.logo-cloud--nav .brand-logo {
  width: 78%;
  height: auto;
  filter: drop-shadow(0 3px 8px var(--soft-shadow));
  animation: breathe 4.5s ease-in-out infinite;
}

.logo-cloud--hero {
  width: clamp(300px, 78vw, 640px);
  aspect-ratio: 900 / 340;
  padding: 0.4rem 0.6rem 0.8rem;
}

.logo-cloud--hero .hero-wordmark {
  width: 82%;
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 12px 28px var(--soft-shadow));
  animation: breathe 4.5s ease-in-out infinite;
}

@keyframes cloudDrift {
  0%,
  100% {
    transform: scale(1) translateY(0);
    opacity: 0.95;
  }
  50% {
    transform: scale(1.03) translateY(-3px);
    opacity: 1;
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* -------- Nav -------- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0 0.4rem;
  gap: 1rem;
  position: relative;
  z-index: 40;
}

.brand {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.nav-burger {
  display: none;
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  padding: 0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  z-index: 45;
}

.nav-burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-burger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-backdrop {
  display: none;
}

@media (max-width: 860px) {
  .nav-burger {
    display: inline-flex;
    position: relative;
    z-index: 960;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 940;
    background: rgba(28, 20, 18, 0.4);
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }

  .nav-backdrop[hidden] {
    display: none !important;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(320px, 88vw);
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding: 4.5rem 1.1rem 1.5rem;
    background: #fffdfb;
    border-left: 1px solid var(--line);
    box-shadow: -18px 0 40px rgba(28, 20, 18, 0.16);
    transform: translateX(105%);
    transition: transform 0.28s ease;
    z-index: 950;
    overflow: auto;
    pointer-events: none;
    visibility: hidden;
  }

  .nav-links.open {
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
  }

  .nav-links .btn,
  .nav-links .nav-credits {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .nav-credits:empty {
    display: none;
  }
}

/* -------- Dashboard -------- */
.dashboard-view {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  min-height: min(70vh, 640px);
}

.dashboard-hero h2 {
  margin-bottom: 0.35rem;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin: 1.5rem 0 2rem;
  align-items: center;
}

.dash-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  position: relative;
  z-index: 1;
}

.dash-action:has(.tip-btn.is-open) {
  z-index: 80;
}

.dashboard-hints {
  display: grid;
  gap: 0.75rem;
  max-width: 42ch;
  color: var(--muted);
  line-height: 1.45;
}

.dashboard-hints p {
  margin: 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.dashboard-hints strong {
  color: var(--ink);
  font-family: var(--font-display);
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 10px;
  padding: 0.62rem 1.05rem;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-lg {
  padding: 0.85rem 1.4rem;
  font-size: 1rem;
}

.btn-primary {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 8px 20px var(--soft-shadow);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-soft {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* -------- Hero -------- */
.hero {
  padding: 1.5rem 0 3rem;
  min-height: min(86vh, 780px);
  display: grid;
  align-content: center;
  gap: 0.5rem;
}

.hero--landing {
  position: relative;
  min-height: min(92vh, 860px);
  grid-template-columns: minmax(0, 1.05fr) minmax(220px, 0.75fr);
  align-items: center;
  gap: 1.5rem 2rem;
  padding: 1.25rem 0 2.5rem;
  /* Keep floating phone fully visible (was clipping top/sides) */
  overflow: visible;
}

.hero-visual {
  position: absolute;
  inset: 0 0 0 38%;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.hero-visual-glow {
  position: absolute;
  inset: 8% 10% 18% 18%;
  background:
    radial-gradient(ellipse at 40% 35%, rgba(255, 183, 3, 0.35), transparent 55%),
    radial-gradient(ellipse at 70% 70%, rgba(232, 90, 79, 0.28), transparent 50%);
  filter: blur(8px);
  animation: glowPulse 6s ease-in-out infinite;
}

.hero-phone {
  position: absolute;
  right: max(0.5rem, 4%);
  top: 50%;
  transform: translateY(-50%) rotate(3deg);
  width: min(260px, 32vw, calc(min(72vh, 560px) * 9 / 16));
  aspect-ratio: 9 / 16;
  border-radius: 28px;
  padding: 10px;
  background: linear-gradient(160deg, #2a2220, #1a1412);
  box-shadow:
    0 30px 60px rgba(28, 20, 18, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  animation: phoneFloat 7s ease-in-out infinite;
  overflow: hidden;
}

.hero-phone canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 20px;
  background: #1c1412;
}

.hero-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
}

.hero-brand {
  margin: 0;
  line-height: 0;
}

.tagline {
  margin: 0;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  color: var(--muted);
  max-width: 28ch;
  padding-left: 0.35rem;
  animation: fadeUp 0.8s ease 0.15s both;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.35rem;
  padding-left: 0.35rem;
  animation: fadeUp 0.8s ease 0.28s both;
}

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

@keyframes phoneFloat {
  0%,
  100% {
    transform: translateY(-50%) rotate(3deg);
  }
  50% {
    transform: translateY(-54%) rotate(1.5deg);
  }
}

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

@media (max-width: 860px) {
  .hero--landing {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-bottom: 1rem;
  }

  .hero-visual {
    position: relative;
    inset: auto;
    height: 320px;
    margin: 0 0 0.5rem;
  }

  .hero-phone {
    right: 50%;
    top: 54%;
    transform: translate(50%, -50%) rotate(2deg);
    width: min(200px, 52vw);
    animation: none;
  }

  .hero-lockup {
    align-items: center;
    text-align: center;
  }

  .tagline,
  .hero-cta {
    padding-left: 0;
    justify-content: center;
    text-align: center;
  }

  .logo-cloud--hero {
    margin-inline: auto;
  }
}

/* -------- Landing sections -------- */
.landing-block {
  padding: 3.25rem 0 1rem;
  border-top: 1px solid var(--line);
}

.landing-block h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  animation: fadeUp 0.7s ease both;
}

.landing-lead {
  margin: 0 0 1.75rem;
  max-width: 52ch;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--muted);
}

.landing-lead em {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink);
}

.value-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.15rem;
  max-width: 64ch;
}

.value-points li {
  padding-bottom: 1.05rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.55;
  font-size: 1.02rem;
}

.value-points li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.value-points strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.usecase-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.35rem 1.75rem;
}

.usecase-list li {
  padding-top: 0.15rem;
}

.usecase-tag {
  display: inline-block;
  margin-bottom: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--coral);
}

.usecase-list strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 0.4rem;
}

.usecase-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.98rem;
  max-width: 40ch;
}

@media (max-width: 720px) {
  .usecase-list {
    grid-template-columns: 1fr;
  }
}

.catch-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.15rem;
}

.catch-steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.catch-steps li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.catch-num {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--coral);
  line-height: 1.2;
  min-width: 2.2rem;
}

.catch-steps strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.catch-steps p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  max-width: 48ch;
}

.catch-steps li:has(.tip-btn.is-open),
.feature-rail li:has(.tip-btn.is-open) {
  position: relative;
  z-index: 80;
}

.feature-rail {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.feature-rail li {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 0.35rem 1rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
  align-items: start;
}

.feature-rail li:last-child {
  border-bottom: 1px solid var(--line);
}

.feature-rail strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  padding-top: 0.15rem;
}

.feature-rail > li > span {
  color: var(--muted);
  line-height: 1.5;
}

.feature-rail .tip-btn {
  grid-column: 2;
  justify-self: start;
}

@media (max-width: 640px) {
  .feature-rail li {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .feature-rail .tip-btn {
    grid-column: 1;
  }
}

/* -------- Tip (?) tooltips -------- */
.tip-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--coral);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
  z-index: 1;
  isolation: isolate;
}

.tip-btn:hover,
.tip-btn:focus-visible,
.tip-btn.is-open {
  border-color: var(--coral);
  background: var(--blush);
  outline: none;
  z-index: 90;
}

.tip-icon {
  position: relative;
  z-index: 1;
  line-height: 1;
}

.tip-bubble {
  position: absolute;
  left: 0;
  top: calc(100% + 0.45rem);
  width: min(280px, 78vw);
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 14px 32px rgba(28, 20, 18, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  z-index: 100;
}

.tip-btn.is-open .tip-bubble,
.tip-btn:focus-visible .tip-bubble {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

@media (hover: hover) and (pointer: fine) {
  .tip-btn:hover .tip-bubble {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }
}

.dashboard-hints .tip-btn {
  margin-left: 0.35rem;
  vertical-align: middle;
}

.dashboard-hints p:has(.tip-btn.is-open) {
  position: relative;
  z-index: 80;
}

.landing-final-cta {
  margin-top: 1.75rem;
  padding-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.mood-showcase {
  display: grid;
  gap: 1.25rem;
}

.mood-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.mood-tab {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  max-width: 100%;
}

.mood-tab:hover {
  border-color: rgba(232, 90, 79, 0.45);
}

.mood-tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.mood-stage {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 1.75rem;
  align-items: center;
}

@media (max-width: 720px) {
  .mood-stage {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .mood-meta {
    text-align: center;
  }

  .mood-controls,
  .mood-meta .slide-dots {
    justify-content: center;
  }
}

.mood-phone {
  width: min(260px, 70vw);
  aspect-ratio: 9 / 16;
  border-radius: 26px;
  padding: 9px;
  background: linear-gradient(165deg, #2c2422, #15110f);
  box-shadow: 0 22px 48px rgba(28, 20, 18, 0.22);
}

.mood-phone canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 18px;
  background: #111;
}

.mood-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--coral);
  font-weight: 600;
}

.mood-meta h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 600;
}

.mood-desc {
  margin: 0 0 0.65rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 40ch;
}

.mood-hint {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--ink);
  opacity: 0.75;
}

.mood-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.iphone-screen canvas.iphone-slide {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* -------- Views -------- */
.section {
  padding: 2.25rem 0 3.5rem;
}

.section h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 3.5vw, 2.35rem);
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* -------- Gallery -------- */
.gallery {
  display: grid;
  grid-template-columns: minmax(0, 260px) 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 860px) {
  .gallery {
    grid-template-columns: 1fr;
  }
}

.example-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.example-card {
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.example-card.active,
.example-card:hover {
  border-color: var(--coral);
  background: rgba(255, 255, 255, 0.65);
}

.example-card strong {
  display: block;
  font-size: 0.98rem;
}

.example-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.phone-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.iphone {
  width: min(100%, 300px);
  background: linear-gradient(160deg, #2a2a2e 0%, #111114 55%, #0a0a0c 100%);
  border-radius: 42px;
  padding: 12px;
  box-shadow:
    0 0 0 2px #3a3a40,
    0 0 0 5px #1a1a1e,
    0 28px 50px rgba(28, 20, 18, 0.28);
  position: relative;
}

.iphone-speaker {
  width: 86px;
  height: 8px;
  border-radius: 99px;
  background: #0c0c0e;
  margin: 6px auto 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.iphone-screen {
  position: relative;
  aspect-ratio: 9 / 19.5;
  border-radius: 28px;
  overflow: hidden;
  background: #111;
}

.iphone-slide {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #1c1412;
}

.iphone-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  color: #f7ebe7;
  font-size: 0.9rem;
  background: linear-gradient(160deg, #e85a4f, #7b2cbf);
}

.iphone-home {
  width: 96px;
  height: 5px;
  border-radius: 99px;
  background: #3a3a40;
  margin: 12px auto 4px;
}

.stage-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

.slide-dots {
  display: flex;
  gap: 0.4rem;
}

.slide-dots button {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  background: rgba(28, 20, 18, 0.2);
  cursor: pointer;
  padding: 0;
}

.slide-dots button.active {
  background: var(--coral);
  transform: scale(1.25);
}

/* -------- Create workspace -------- */
.create-view {
  padding: 1rem 0 3.5rem;
}

.create-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.create-topbar-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.65rem 1rem;
  min-width: 0;
}

.create-topbar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.02em;
}

.project-title-field {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.project-title-field input {
  width: min(220px, 42vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}

.project-title-field input:focus {
  outline: 2px solid rgba(232, 90, 79, 0.35);
  border-color: rgba(232, 90, 79, 0.55);
}

.create-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.project-row.is-current {
  border-color: rgba(232, 90, 79, 0.45);
  background: rgba(255, 245, 243, 0.65);
}

.create-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.create-layout > .create-rail {
  grid-column: 1;
  grid-row: 1;
}

.create-layout > #sec-export-block {
  grid-column: 1;
  grid-row: 2;
}

.create-layout:has(#studio:not(.hidden)) {
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
}

.create-layout:has(#studio:not(.hidden)) > #studio {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
}

/* Mobile: form → preview → export (end of page) */
@media (max-width: 980px) {
  .create-layout,
  .create-layout:has(#studio:not(.hidden)) {
    grid-template-columns: 1fr;
  }

  .create-layout > .create-rail {
    grid-column: 1;
    grid-row: 1;
  }

  .create-layout:has(#studio:not(.hidden)) > #studio {
    grid-column: 1;
    grid-row: 2;
  }

  .create-layout > #sec-export-block {
    grid-column: 1;
    grid-row: 3;
  }

  .create-layout:not(:has(#studio:not(.hidden))) > #sec-export-block {
    grid-row: 2;
  }

  .studio-pane {
    position: static;
  }

  .tool-section--action {
    position: static;
    background: transparent;
  }
}

.create-rail {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tool-section {
  padding: 1.35rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
}

.tool-section:last-child {
  border-bottom: 0;
}

.tool-section--flat {
  border-bottom: 0;
  padding-top: 1rem;
}

.tool-section--action {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent, var(--paper) 18%);
  padding-bottom: 0.25rem;
  z-index: 2;
}

.tool-section h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.section-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  position: relative;
  z-index: 1;
}

.section-title:has(.tip-btn.is-open) {
  z-index: 80;
}

.tool-section:has(.tip-btn.is-open) {
  position: relative;
  z-index: 50;
}

.tabs {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.15rem;
  gap: 0.1rem;
}

.tabs button {
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 0.35rem 0.75rem;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--muted);
}

.tabs button.active {
  background: var(--ink);
  color: #fff;
}

.tab-panel[hidden],
.tab-panel.hidden {
  display: none !important;
}

.field-block {
  margin-top: 0.95rem;
}

.field-block:first-of-type {
  margin-top: 0;
}

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-top: 0.85rem;
}

@media (max-width: 720px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

label.field input,
label.field textarea,
label.field select {
  font: inherit;
  color: var(--ink);
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: rgba(255, 255, 255, 0.92);
  resize: vertical;
}

label.field input:focus,
label.field textarea:focus,
label.field select:focus {
  outline: 2px solid rgba(232, 90, 79, 0.35);
  outline-offset: 1px;
  border-color: rgba(232, 90, 79, 0.45);
}

label.field textarea {
  min-height: 88px;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin-top: 0.85rem;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.18rem;
  gap: 0.12rem;
}

.seg button {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 0.42rem 0.8rem;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--muted);
}

.seg button.active {
  background: var(--coral);
  color: #fff;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.45rem;
}

.swatch {
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  background: #fff;
  font-family: var(--font-ui);
}

.swatch.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--coral);
}

.swatch-chip {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.swatch-name {
  display: block;
  padding: 0.3rem 0.45rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
}

.font-grid,
.frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}

.font-card {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.85);
  text-align: left;
  font-family: var(--font-ui);
  transition: border-color 0.2s ease;
}

.font-card.active {
  border-color: var(--coral);
}

.font-card .sample {
  font-size: 1.2rem;
  line-height: 1.15;
  margin-bottom: 0.35rem;
  min-height: 2.4em;
}

.font-card .meta {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.mood-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.45rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.mood-card {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.85);
  text-align: left;
  font-family: var(--font-ui);
  transition: border-color 0.2s ease;
}

.mood-card:hover {
  border-color: rgba(232, 90, 79, 0.45);
}

.mood-card.active {
  border-color: var(--coral);
  background: #fff;
}

.mood-card strong {
  display: block;
  font-size: 0.84rem;
  margin-bottom: 0.2rem;
}

.mood-card span {
  display: block;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--muted);
}

.frame-card {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.85);
  text-align: center;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--ink);
  transition: border-color 0.2s ease;
}

.frame-card.active {
  border-color: var(--coral);
}

.frame-card .frame-preview {
  height: 40px;
  margin-bottom: 0.35rem;
  border-radius: 6px;
  position: relative;
  background: #f3ebe7;
}

.frame-card .frame-preview canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
}

.prompt-box {
  width: 100%;
  min-height: 160px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.45;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem;
  background: #1c1412;
  color: #f7ebe7;
  resize: vertical;
  margin-bottom: 0.75rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.generate-row {
  margin-top: 0.25rem;
}

.gen-action {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: min(100%, 220px);
}

.gen-cooldown {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.gen-cooldown.hidden {
  display: none;
}

.gen-cooldown-track {
  height: 5px;
  width: 100%;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 22%, transparent);
  overflow: hidden;
}

.gen-cooldown-track > i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), color-mix(in srgb, var(--coral) 65%, #fff));
  transform-origin: left center;
  transform: scaleX(1);
}

.gen-cooldown.active .gen-cooldown-track > i {
  animation: gen-cooldown-drain linear forwards;
  animation-duration: var(--gen-cd-ms, 60000ms);
}

@keyframes gen-cooldown-drain {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

#gen-cooldown-label {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.gen-speed-hint {
  margin: 0.45rem 0 0;
  max-width: 36rem;
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.15em;
}

.status.error {
  color: #b42318;
}

.status.ok {
  color: #067647;
}

/* -------- Studio pane -------- */
.studio-pane {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: sticky;
  top: 0.75rem;
}

.story-stage {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.preview-frame {
  position: relative;
  /* Fit full phone + Preview mark on desktop (avoid bottom/side crop) */
  width: min(100%, 300px, calc((100vh - 11rem) * 9 / 16));
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  /* Clip slide only; watermark sits in a matching overlay (see .preview-wm) */
  overflow: visible;
  background: transparent;
  box-shadow: none;
  transition: aspect-ratio 0.25s ease, width 0.25s ease;
}

.preview-frame.landscape {
  width: min(100%, 520px, calc((100vh - 11rem) * 16 / 9));
  aspect-ratio: 16 / 9;
}

.preview-frame.tiktok {
  width: min(100%, 320px, calc((100vh - 11rem) * 3 / 4));
  aspect-ratio: 3 / 4;
}

.preview-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 14px;
  background: #111;
  box-shadow: 0 16px 36px rgba(28, 20, 18, 0.12);
}

/* Preview-only Catchyeting mark — never drawn into export canvas */
.preview-wm {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  place-items: center;
  gap: 0.4rem;
  pointer-events: none;
  border-radius: 14px;
  overflow: hidden;
}

.preview-wm-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(56%, 150px);
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.preview-wm-logo img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.38;
  filter:
    drop-shadow(0 0 0.6px rgba(255, 255, 255, 0.85))
    drop-shadow(0 0 0.6px rgba(0, 0, 0, 0.45));
}

.preview-wm span {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  text-shadow:
    0 0 1px rgba(0, 0, 0, 0.75),
    0 1px 2px rgba(0, 0, 0, 0.55),
    0 0 1px rgba(255, 255, 255, 0.35);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  opacity: 1;
  filter: none;
}

.preview-frame.landscape .preview-wm-logo {
  width: min(38%, 120px);
}

.preview-frame.landscape .preview-wm {
  gap: 0.28rem;
}

.preview-frame.landscape .preview-wm span {
  font-size: 0.58rem;
}

.thumb-strip {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  width: 100%;
}

.thumb {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: #111;
}

.thumb.active {
  border-color: var(--coral);
}

.thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.editor-tools {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.media-editor {
  margin-top: 1rem;
}

.slide-image-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

/* Legacy panel (if any leftover) */
.panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0;
}

.panel h3 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
}

/* Crop modal */
.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(28, 20, 18, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.crop-dialog {
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(28, 20, 18, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crop-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem 0.75rem;
}

.crop-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
}

.crop-stage {
  position: relative;
  margin: 0 1.15rem;
  height: min(58vh, 520px);
  background: #1c1412;
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.crop-stage img {
  position: absolute;
  max-width: none;
  pointer-events: none;
}

.crop-box {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  cursor: move;
  touch-action: none;
}

.crop-box span {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 2px;
}

.crop-box span[data-handle='nw'] { left: -6px; top: -6px; cursor: nwse-resize; }
.crop-box span[data-handle='n'] { left: 50%; top: -6px; margin-left: -6px; cursor: ns-resize; }
.crop-box span[data-handle='ne'] { right: -6px; top: -6px; cursor: nesw-resize; }
.crop-box span[data-handle='w'] { left: -6px; top: 50%; margin-top: -6px; cursor: ew-resize; }
.crop-box span[data-handle='e'] { right: -6px; top: 50%; margin-top: -6px; cursor: ew-resize; }
.crop-box span[data-handle='sw'] { left: -6px; bottom: -6px; cursor: nesw-resize; }
.crop-box span[data-handle='s'] { left: 50%; bottom: -6px; margin-left: -6px; cursor: ns-resize; }
.crop-box span[data-handle='se'] { right: -6px; bottom: -6px; cursor: nwse-resize; }

.crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.15rem 1.15rem;
}

.hint {
  display: none;
}

.hidden {
  display: none !important;
}

.footer {
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.footer a {
  color: var(--coral);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
}

.pack-card {
  position: relative;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font-family: var(--font-ui);
}

.pack-card strong {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.pack-card span:not(.pack-badge):not(.pack-perk) {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.pack-card .pack-perk {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--coral);
}

.pack-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 0.35rem;
}

.cookie-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 900;
  max-width: 520px;
  margin-inline: auto;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(28, 20, 18, 0.15);
}

.cookie-banner p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.projects-modal {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(28, 20, 18, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 960;
  background: rgba(28, 20, 18, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.auth-modal.hidden {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

.checkout-dialog {
  width: min(440px, 100%);
  max-height: min(92dvh, 920px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#paypal-checkout-modal {
  z-index: 980;
}

.checkout-summary {
  margin: 0 0 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(28, 20, 18, 0.03);
}

.checkout-pack-name {
  margin: 0;
  font-family: var(--font-display, var(--font-ui));
  font-size: clamp(1.15rem, 4.2vw, 1.35rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  word-break: break-word;
}

.checkout-pack-credits {
  margin: 0.35rem 0 0;
  font-size: clamp(0.9rem, 3.4vw, 0.98rem);
  color: var(--muted);
  line-height: 1.4;
}

.checkout-pack-price {
  margin: 0.55rem 0 0;
  font-size: clamp(1.35rem, 5vw, 1.55rem);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.checkout-perks {
  margin: 0.85rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: clamp(0.84rem, 3.2vw, 0.9rem);
  line-height: 1.5;
}

.checkout-perks li + li {
  margin-top: 0.3rem;
}

.paypal-buttons-host {
  min-height: 3rem;
  width: 100%;
  max-width: 100%;
}

.paypal-buttons-host:empty::before {
  content: 'Loading PayPal…';
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.checkout-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.85rem;
  position: sticky;
  bottom: 0;
  padding-top: 0.65rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 28%);
}

.checkout-actions .btn {
  min-height: 2.75rem;
  min-width: 6.5rem;
}

#paypal-checkout-lead,
#paypal-checkout-status,
#packs-modal-status {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.auth-dialog {
  position: relative;
  width: min(420px, 100%);
  max-width: 100%;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 1.15rem 1.25rem 1.35rem;
  box-shadow: 0 24px 48px rgba(28, 20, 18, 0.2);
  animation: fadeUp 0.35s ease both;
  margin: auto;
}

.auth-dialog-head {
  margin-bottom: 0.85rem;
  padding-right: 2.75rem;
}

.auth-dialog-head h3 {
  font-size: clamp(1.1rem, 4vw, 1.25rem);
  line-height: 1.3;
}

.modal-close-x {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: var(--font-ui);
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}

.modal-close-x:hover,
.modal-close-x:focus-visible {
  background: rgba(28, 20, 18, 0.08);
  color: var(--ink);
  outline: none;
}

@media (max-width: 640px) {
  .auth-modal {
    align-items: flex-start;
    padding: max(0.5rem, env(safe-area-inset-top)) 0.55rem
      max(0.75rem, env(safe-area-inset-bottom)) 0.55rem;
  }

  .auth-dialog,
  .checkout-dialog {
    width: 100%;
    border-radius: 12px;
    padding: 1rem 0.95rem 1.05rem;
    max-height: none;
  }

  .checkout-dialog {
    /* Keep dialog fully scrollable inside the overlay on short phones */
    max-height: none;
  }

  .checkout-summary {
    padding: 0.85rem 0.9rem;
  }

  .checkout-actions {
    justify-content: stretch;
  }

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

  #packs-modal .auth-dialog {
    max-height: none;
  }

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

.auth-dialog .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-dialog .field input {
  font-weight: 400;
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.auth-cookie-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-top: 0.9rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
  cursor: pointer;
}

.auth-cookie-check input {
  margin-top: 0.15rem;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  accent-color: var(--coral);
}

.auth-cookie-check a {
  color: var(--coral);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-cookie-check.hidden {
  display: none;
}

.projects-dialog {
  width: min(520px, 100%);
  max-height: min(80vh, 640px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 1rem 1.15rem 1.15rem;
}

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.project-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}

.project-row strong {
  display: block;
}

.nav-credits {
  font-weight: 600;
  margin-right: 0.25rem;
}

.privacy-page ul {
  color: var(--muted);
  line-height: 1.5;
}

.privacy-page h3 {
  margin-top: 2rem;
  scroll-margin-top: 1.25rem;
}

.privacy-page h4 {
  margin: 1.1rem 0 0.45rem;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
}

.privacy-page p,
.privacy-page li {
  max-width: 68ch;
}

.privacy-page .section-lead {
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.55;
}

.policy-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin: 1.25rem 0 0.5rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.policy-toc a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--coral);
  text-decoration: underline;
  text-underline-offset: 2px;
}
