/* --------------------------------------------------------------
   StoryMint � White-Green Theme (with Dark Mode)
   (c) Ervin Ezzati Jivan

   Global styles with light and dark mode support.
   Uses CSS variables for all colour values.
   -------------------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  /* Fluid base: scales from 14px at 320px to 16px at 1200px */
  font-size: clamp(14px, 0.25vw + 13.2px, 16px);
}

:root {
  --bg: #f0f6ef;
  --bg-soft: #e6f0e5;
  --bg-elevated: rgba(255, 255, 255, 0.84);
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-input: rgba(255, 255, 255, 0.92);
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --border: rgba(20, 60, 35, 0.12);
  --border-strong: rgba(20, 60, 35, 0.22);
  --text: #0a1a0f;
  --text-soft: #1e3a27;
  --text-muted: #3d5e47;
  --brand: #145c32;
  --brand-deep: #0e3d1f;
  --brand-soft: #d4edda;
  --accent: #145c32;
  --danger: #a82020;
  --warning: #a86a00;
  /* 3-tier shadow system with colored tint */
  --shadow-sm: 0 1px 2px rgba(10, 40, 20, 0.04), 0 2px 6px rgba(10, 40, 20, 0.03);
  --shadow: 0 2px 4px rgba(10, 40, 20, 0.05), 0 8px 24px rgba(10, 40, 20, 0.07);
  --shadow-lg: 0 4px 8px rgba(10, 40, 20, 0.06), 0 16px 48px rgba(10, 40, 20, 0.10);
  --shadow-soft: var(--shadow-sm);
  --shadow-glow: 0 0 0 1px rgba(20, 92, 50, 0.08), 0 4px 16px rgba(20, 92, 50, 0.12);
  /* Gradients */
  --brand-gradient: linear-gradient(135deg, #145c32 0%, #1a7a42 50%, #22874a 100%);
  --bg-mesh: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(20, 92, 50, 0.06), transparent),
             radial-gradient(ellipse 60% 50% at 80% 50%, rgba(16, 185, 129, 0.04), transparent);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --font-body: "Space Grotesk", "Space Mono", "Segoe UI", sans-serif;
  --font-heading: "Space Grotesk", "Space Mono", monospace;
  --font-head: var(--font-heading);
  /* Easing */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a100c;
  --bg-soft: #111a14;
  --bg-elevated: rgba(14, 24, 17, 0.92);
  --bg-card: rgba(12, 22, 15, 0.95);
  --bg-input: rgba(8, 16, 10, 0.96);
  --surface: #131e16;
  --surface-strong: #131e16;
  --border: rgba(100, 180, 130, 0.12);
  --border-strong: rgba(100, 180, 130, 0.22);
  --text: #e8f2ea;
  --text-soft: #a3bfa8;
  --text-muted: #7a9a80;
  --brand: #3aad5e;
  --brand-deep: #5ec97a;
  --brand-soft: rgba(58, 173, 94, 0.14);
  --accent: #3aad5e;
  --danger: #ff7070;
  --warning: #ffc44d;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.10);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.16), 0 8px 24px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.20), 0 16px 48px rgba(0, 0, 0, 0.24);
  --shadow-soft: var(--shadow-sm);
  --shadow-glow: 0 0 0 1px rgba(58, 173, 94, 0.12), 0 4px 16px rgba(58, 173, 94, 0.14);
  --brand-gradient: linear-gradient(135deg, #3aad5e 0%, #5ec97a 50%, #86efac 100%);
  --bg-mesh: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(58, 173, 94, 0.06), transparent),
             radial-gradient(ellipse 60% 50% at 80% 50%, rgba(16, 185, 129, 0.04), transparent);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  background-image: var(--bg-mesh);
  background-attachment: fixed;
}

/* Global typography polish */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

/* Global focus-visible ring */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

html[data-theme="dark"] body {
  background: var(--bg);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  min-width: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.85rem 0;
  backdrop-filter: blur(16px) saturate(1.4);
  background: rgba(240, 246, 239, 0.8);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s ease;
}

html[data-theme="dark"] .site-header {
  background: rgba(10, 16, 12, 0.82);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: nowrap;
}

.header-inner > * {
  min-width: 0;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 1rem;
  font-size: 1.5rem;
  line-height: 1;
  background: none;
}

.logo-copy {
  display: flex;
  flex-direction: column;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.logo-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.nav-links,
.header-right,
.user-area,
.footer-links,
.preview-actions,
.toolbar-group,
.theme-pills,
.chat-actions,
.stack-actions,
.suggestion-chips,
.billing-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* -- Hamburger menu button (mobile only) -- */
.nav-toggle {
  display: none;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  color: var(--text);
  line-height: 0;
}
.nav-toggle svg { display: block; }

.nav-links {
  flex: 1 1 auto;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 0.15rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  align-items: center;
}
.nav-links::-webkit-scrollbar {
  display: none;
}

.user-area {
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.header-right {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
  min-width: 0;
}

.user-email {
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
}

.usage-badge,
.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  padding: 0.45rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.usage-badge {
  background: rgba(20, 92, 50, 0.08);
  color: var(--brand-deep);
  border: 1px solid rgba(20, 92, 50, 0.12);
}

.tier-badge {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border: 1px solid var(--border);
}

html[data-theme="dark"] .tier-badge {
  background: rgba(255, 255, 255, 0.04);
}

.tier-badge.plus {
  color: var(--brand-deep);
}

.tier-badge.max {
  color: #aa7b1c;
}

.nav-link {
  font-size: clamp(0.85rem, 1.2vw, 0.92rem);
  font-weight: 500;
  text-decoration: none;
  color: var(--text-soft);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(20, 92, 50, 0.08);
  color: var(--text);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(20, 92, 50, 0.08);
}

.nav-external {
  color: var(--text-muted);
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.text-action,
.billing-pill,
.chip-btn,
.theme-pill {
  font: inherit;
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn-primary {
  border: none;
  color: #fff;
  background: var(--brand-gradient);
  padding: 0.85rem 1.4rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover,
.chip-btn:hover,
.theme-pill:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.btn-secondary {
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  padding: 0.9rem 1.25rem;
}

html[data-theme="dark"] .btn-secondary {
  background: rgba(255, 255, 255, 0.02);
}

.btn-ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-soft);
  padding: 0.75rem 1rem;
}

.current-label {
  width: 100%;
}

.btn-inline {
  padding: 0.72rem 1.1rem;
  font-size: clamp(0.8rem, 1.5vw, 0.95rem);
}

.btn-launch {
  min-width: 9.75rem;
  white-space: nowrap;
  background: var(--brand-gradient);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.15s ease;
}
.btn-launch:hover {
  background: var(--brand-gradient);
  filter: brightness(1.08);
  box-shadow: var(--shadow-glow);
}
.btn-launch:active {
  transform: translateY(0) scale(0.97);
}
html[data-theme="dark"] .btn-launch {
  background: var(--brand-gradient);
  box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .btn-launch:hover {
  background: var(--brand-gradient);
  filter: brightness(1.1);
  box-shadow: var(--shadow-glow);
}

.text-action {
  border: none;
  background: none;
  color: var(--brand-deep);
  padding: 0;
  cursor: pointer;
  font-weight: 600;
}

.hero,
.page-hero {
  text-align: center;
}

.home-main,
.pricing-main,
.account-main,
.settings-main {
  padding: 2rem 0 3rem;
}

.workspace-main {
  padding: 0.85rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: min(1480px, calc(100% - 1rem));
}

.hero-home {
  padding-top: 2.5rem;
  max-width: 52rem;
  margin: 0 auto 2rem;
}

/* Heading colour */
.hero-home h1 {
  color: var(--text);
}
html[data-theme="dark"] .hero-home h1 {
  color: var(--text);
}

.hero-badge,
.status-chip,
.editor-model-pill,
.billing-pill,
.mini-plan-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(20, 92, 50, 0.16);
  color: var(--brand-deep);
  font-size: 0.86rem;
  padding: 0.45rem 0.9rem;
}

html[data-theme="dark"] .hero-badge,
html[data-theme="dark"] .status-chip,
html[data-theme="dark"] .editor-model-pill,
html[data-theme="dark"] .billing-pill,
html[data-theme="dark"] .mini-plan-note {
  background: rgba(255, 255, 255, 0.04);
}

.status-chip.danger {
  color: var(--danger);
  border-color: rgba(200, 68, 68, 0.18);
}

.hero h1,
.page-hero h1,
.progress-card h1,
.status-card h1,
.error-card h1 {
  margin: 0.75rem 0 0.8rem;
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.page-hero h1,
.progress-card h1,
.status-card h1,
.error-card h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.hero-sub,
.progress-copy,
.block-copy,
.workspace-note,
.mini-plan-note,
.helper-note {
  color: var(--text-soft);
  font-size: 1.02rem;
  line-height: 1.7;
}

.page-hero {
  max-width: 50rem;
  margin: 0 auto 2rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.composer-card,
.discount-card,
.settings-confirm {
  padding: 1.5rem;
}

/* Base44 composer card glow */
.composer-card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px);
}
.composer-card:hover {
  transform: none;
  border-color: rgba(20, 92, 50, 0.2);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
html[data-theme="dark"] .composer-card {
  border-color: var(--border);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
html[data-theme="dark"] .composer-card:hover {
  transform: none;
  border-color: var(--border-strong);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.composer-topline,
.workspace-panel-head,
.preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.price-card-top {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.eyebrow,
.price-tier,
.message-role {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand-deep);
}

/* Eyebrow label */
.composer-card .eyebrow {
  color: var(--brand);
}
html[data-theme="dark"] .composer-card .eyebrow {
  color: var(--accent);
}

.composer-topline h2,
.workspace-panel-head h2,
.settings-card h2,
.price-card h2,
.account-block h2,
.discount-card h2,
.signed-out-card h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  letter-spacing: -0.04em;
}

.prompt-form {
  margin-top: 1.5rem;
}

.prompt-stage {
  position: relative;
  padding: 1.2rem 1.2rem 0.6rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: none;
  transition: border-color 0.2s ease;
}

.prompt-stage:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 92, 50, 0.08);
}

html[data-theme="dark"] .prompt-stage {
  background: var(--surface);
  border-color: var(--border);
}
html[data-theme="dark"] .prompt-stage:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(58, 173, 94, 0.1);
}

.prompt-stage textarea {
  border: none;
  background: transparent;
  padding: 0;
  min-height: 7rem;
  line-height: 1.65;
  font-size: 1.05rem;
  resize: none;
}
.prompt-stage textarea:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

textarea,
input[type="text"],
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text);
  padding: 1rem 1.1rem;
  font: inherit;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

textarea {
  min-height: 8.5rem;
  line-height: 1.6;
}

textarea:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 92, 50, 0.1);
}

.composer-toolbar {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

html[data-theme="dark"] .composer-toolbar {
  border-top-color: var(--border);
}

/* -- Model picker ------------------------------------------- */
.inline-select {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem 0.3rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
  cursor: pointer;
}
.inline-select:hover {
  border-color: var(--brand);
}

html[data-theme="dark"] .inline-select {
  background: var(--surface);
  border-color: var(--border);
}
html[data-theme="dark"] .inline-select:hover {
  border-color: var(--accent);
}

.inline-select .model-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0.7;
}

.inline-select span {
  font-family: "Inter", "Space Grotesk", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.inline-select select {
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.3rem 1.6rem 0.3rem 0;
  box-shadow: none;
  font-family: "Inter", "Space Grotesk", sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.3rem center;
  background-size: 10px 6px;
}
.inline-select select:focus {
  outline: none;
}

.form-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.9rem;
}

.char-count {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.beta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  vertical-align: middle;
  white-space: nowrap;
}

/* -- Page count selector --------------------------------------- */
.page-count-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.8rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(20, 92, 50, 0.04);
  border: 1px solid rgba(20, 92, 50, 0.1);
}
html[data-theme="dark"] .page-count-row {
  background: rgba(255,255,255, 0.02);
  border-color: rgba(255,255,255,0.06);
}
.page-count-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.page-count-slider {
  flex: 1;
  accent-color: var(--brand);
  height: 6px;
  cursor: pointer;
}
.page-count-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand);
  min-width: 2.2ch;
  text-align: center;
}
.page-count-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: auto;
  text-align: right;
}

.advanced-panel {
  margin-top: 1rem;
  padding: 1.2rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
}

html[data-theme="dark"] .advanced-panel {
  background: rgba(255, 255, 255, 0.02);
}

.options-grid,
.settings-grid,
.account-grid-page,
.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.options-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-soft);
}

.style-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.style-chip,
.chip-btn,
.theme-pill {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: 0.75rem 1rem;
  cursor: pointer;
}

html[data-theme="dark"] .style-chip,
html[data-theme="dark"] .chip-btn,
html[data-theme="dark"] .theme-pill {
  background: rgba(255, 255, 255, 0.03);
}

.style-chip input {
  display: none;
}

.style-chip.selected,
.theme-pill.active,
.billing-pill.active {
  background: var(--brand-soft);
  border-color: var(--brand);
}

html[data-theme="dark"] .style-chip.selected,
html[data-theme="dark"] .theme-pill.active,
html[data-theme="dark"] .billing-pill.active {
  background: rgba(120, 212, 143, 0.14);
}

.suggestions-block {
  margin: 2rem auto 0;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 0 1rem;
  box-shadow: none;
}
html[data-theme="dark"] .suggestions-block {
  border-color: transparent;
  box-shadow: none;
}

.suggestions-title {
  color: var(--brand-deep);
  font-weight: 800;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.chip-btn {
  box-shadow: var(--shadow-soft);
}

.feature-strip {
  margin-top: 2rem;
}

.feature-card,
.settings-card,
.account-block,
.signed-out-card,
.price-card,
.workspace-chat,
.workspace-preview,
.progress-card,
.status-card,
.error-card {
  padding: 1.5rem;
}

.feature-card {
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
}

html[data-theme="dark"] .feature-card {
  background: rgba(255, 255, 255, 0.03);
}

.feature-card h3 {
  margin: 0 0 0.65rem;
  font-family: var(--font-heading);
  font-size: 1.15rem;
}

.feature-card p,
.price-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.65;
}

.billing-pill[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.pricing-grid-wide {
  margin-top: 1.5rem;
}

.price-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(18px);
  padding: 1.5rem;
  transition: transform 0.28s var(--ease-out), box-shadow 0.28s var(--ease-out), border-color 0.2s ease;
}

.price-card.featured {
  background: var(--bg-card);
  border-color: var(--brand);
  border-width: 2px;
  box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: scale(1.02);
}

html[data-theme="dark"] .price-card.featured {
  background: var(--bg-card);
  border-color: var(--accent);
}

.price-amount {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 3.4vw, 3.3rem);
  letter-spacing: -0.06em;
}

.price-period {
  font-size: 1rem;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

.price-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0;
  margin: 0;
  color: var(--text-soft);
}

.price-features li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.price-features li::before {
  content: "";
  flex-shrink: 0;
  width: 1.1em;
  height: 1.1em;
  margin-top: 0.15em;
  background: var(--brand-deep);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
}
.price-features li.muted {
  color: var(--text-muted);
}
.price-features li.muted::before {
  background: var(--text-muted);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
}

.price-action {
  margin-top: auto;
}

/* Current-plan badge on pricing cards */
.current-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  text-align: center;
  margin: -1.5rem -1.5rem 1rem;
}

.current-label {
  opacity: 0.6;
  cursor: default;
}

/* Checkout overlay */
#checkout-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
#checkout-overlay[hidden] { display: none; }
.checkout-overlay-inner {
  text-align: center;
  color: #fff;
  font-size: 1.1rem;
}
.checkout-overlay-inner .spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: co-spin 0.7s linear infinite;
}
@keyframes co-spin { to { transform: rotate(360deg); } }

.discount-card {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.discount-form {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.discount-form input {
  min-width: 16rem;
}

.discount-msg,
.inline-message {
  margin-top: 1rem;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 0.94rem;
}

.discount-msg.success,
.inline-message.success {
  color: var(--brand-deep);
  background: rgba(20, 92, 50, 0.08);
  border: 1px solid rgba(20, 92, 50, 0.14);
}

.discount-msg.error,
.inline-message.error {
  color: var(--danger);
  background: rgba(200, 68, 68, 0.08);
  border: 1px solid rgba(200, 68, 68, 0.14);
}

.account-grid-page,
.settings-grid {
  margin-top: 1.5rem;
}

.settings-grid-modern {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-card-wide {
  grid-column: span 2;
}

.settings-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.account-plan-label {
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  margin: 0.3rem 0 0.8rem;
}

.usage-bar-wrap {
  width: 100%;
  height: 0.7rem;
  border-radius: var(--radius-pill);
  background: rgba(20, 92, 50, 0.12);
  overflow: hidden;
}

.usage-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(135deg, #145c32, #22874a);
  border-radius: var(--radius-pill);
}

.usage-bar.warn {
  background: linear-gradient(135deg, #d9a33e, #f2d474);
}

.usage-bar.full {
  background: linear-gradient(135deg, #d15a5a, #ff9d9d);
}

.account-usage-text,
.account-reset-text {
  color: var(--text-soft);
}

.stack-actions {
  margin-top: 1rem;
  flex-wrap: wrap;
}

.signed-out-card {
  max-width: 40rem;
  margin: 0 auto;
  text-align: center;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--border);
}

html[data-theme="dark"] .toggle-row {
  background: rgba(255, 255, 255, 0.03);
}

.toggle-row input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--brand);
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--border);
}

html[data-theme="dark"] .toggle-label {
  background: rgba(255, 255, 255, 0.03);
}

.toggle-label input[type="radio"] {
  accent-color: var(--brand);
}

.workspace-shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 1rem;
  /* fullscreen: fill viewport minus header */
  flex: 1;
  min-height: calc(100vh - 5.5rem);
  align-items: stretch;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------
   Animations � scroll-reveal, micro-interactions, transitions
   -------------------------------------------------------------- */

/* -- Scroll-reveal (driven by IntersectionObserver in JS) ---- */
.sm-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s var(--ease-out),
              transform 0.5s var(--ease-out);
  will-change: transform, opacity;
}
.sm-reveal.sm-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children � each child delays +80ms */
.sm-stagger > .sm-reveal:nth-child(1) { transition-delay: 0ms; }
.sm-stagger > .sm-reveal:nth-child(2) { transition-delay: 80ms; }
.sm-stagger > .sm-reveal:nth-child(3) { transition-delay: 160ms; }
.sm-stagger > .sm-reveal:nth-child(4) { transition-delay: 240ms; }
.sm-stagger > .sm-reveal:nth-child(5) { transition-delay: 320ms; }
.sm-stagger > .sm-reveal:nth-child(6) { transition-delay: 400ms; }
.sm-stagger > .sm-reveal:nth-child(7) { transition-delay: 480ms; }
.sm-stagger > .sm-reveal:nth-child(8) { transition-delay: 560ms; }

/* Scale-up variant */
.sm-reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.sm-reveal-scale.sm-visible {
  opacity: 1;
  transform: scale(1);
}

/* Pointer-follow effect (disabled for clean look) */
.sm-pointer-card {
  position: relative;
}

.sm-pointer-card > * {
  position: relative;
  z-index: 1;
}

/* -- Hero entrance ------------------------------------------- */
@keyframes heroSlideUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes heroBadgePop {
  0%   { opacity: 0; transform: scale(0.8) translateY(12px); }
  60%  { transform: scale(1.04) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.mkt-hero .mkt-badge,
.hero-badge {
  animation: heroBadgePop 0.5s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.mkt-hero h1,
.hero h1 {
  animation: heroSlideUp 0.6s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.mkt-hero-sub,
.hero-sub {
  animation: heroSlideUp 0.6s 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.mkt-cta-row,
.mkt-hero-note {
  animation: heroSlideUp 0.6s 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* -- Card hover lift ----------------------------------------- */
.mkt-step,
.mkt-why-card,
.mkt-plan,
.composer-card,
.feature-card,
.price-card,
.page-card,
.workspace-chat,
.workspace-preview,
.progress-card,
.mkt-demo-card {
  transition: transform 0.28s var(--ease-out),
              box-shadow 0.28s var(--ease-out),
              border-color 0.28s ease;
}
.mkt-step:hover,
.mkt-why-card:hover,
.mkt-plan:hover,
.feature-card:hover,
.price-card:hover,
.page-card:hover,
.workspace-chat:hover,
.progress-card:hover,
.mkt-demo-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* -- Shared ripple host -------------------------------------- */
.sm-ripple-host {
  position: relative;
  overflow: hidden;
}

.sm-ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  background: rgba(255, 255, 255, 0.28);
  animation: smRipple 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes smRipple {
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

/* -- Button press feedback ----------------------------------- */
.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active,
.mkt-cta-primary:active,
.mkt-cta-secondary:active {
  transform: scale(0.97);
  transition-duration: 0.08s;
}

/* -- Skeleton shimmer for loading states --------------------- */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--surface) 37%, var(--bg-soft) 63%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* -- Chip / pill hover scale --------------------------------- */
.chip-btn,
.style-chip,
.mkt-badge,
.status-chip,
.tier-badge {
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.chip-btn:hover,
.style-chip:hover {
  transform: scale(1.04);
}

/* -- Progress bar glow pulse --------------------------------- */
@keyframes progressPulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}
@keyframes progressSweep {
  from { background-position: 0% 50%; }
  to   { background-position: 100% 50%; }
}
.progress-bar {
  background: linear-gradient(90deg, #145c32 0%, #1f7b43 35%, #5fd48a 52%, #1f7b43 70%, #145c32 100%);
  background-size: 220% 100%;
  animation: progressSweep 2.4s linear infinite;
  position: relative;
}
.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 18px rgba(20, 92, 50, 0.5);
  animation: progressPulse 2s ease-in-out infinite;
  will-change: opacity;
}

/* -- Step-list active indicator ------------------------------ */
@keyframes stepPing {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.step.active {
  animation: stepPing 1.8s ease-in-out infinite;
  will-change: transform;
}
.step {
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

/* -- Chat message entrance ----------------------------------- */
@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.message {
  animation: msgSlideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* -- Page card entrance in preview --------------------------- */
@keyframes pageCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.page-card {
  animation: pageCardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.preview-pages .page-card:nth-child(1) { animation-delay: 0ms; }
.preview-pages .page-card:nth-child(2) { animation-delay: 100ms; }
.preview-pages .page-card:nth-child(3) { animation-delay: 200ms; }
.preview-pages .page-card:nth-child(4) { animation-delay: 300ms; }
.preview-pages .page-card:nth-child(5) { animation-delay: 400ms; }
.preview-pages .page-card:nth-child(6) { animation-delay: 500ms; }
.preview-pages .page-card:nth-child(7) { animation-delay: 600ms; }
.preview-pages .page-card:nth-child(8) { animation-delay: 700ms; }

/* -- Page image hover zoom ----------------------------------- */
.page-image,
.cover-stage img {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.page-card:hover .page-image {
  transform: scale(1.04);
}
.cover-stage:hover img {
  transform: scale(1.03);
}

/* -- Auth modal entrance ------------------------------------- */
@keyframes modalBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalCardIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.auth-modal-overlay {
  animation: modalBackdropIn 0.25s ease-out both;
}
.auth-modal {
  animation: modalCardIn 0.35s 0.05s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* -- Floating dot decoration for hero ------------------------ */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.mkt-page-img {
  animation: float 3.5s ease-in-out infinite;
}
.mkt-page:nth-child(2) .mkt-page-img {
  animation-delay: 0.7s;
}

/* -- Mkt demo card slide-in ---------------------------------- */
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-32px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(32px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* -- Logo hover ---------------------------------------------- */
.logo-mark {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.logo-area:hover .logo-mark {
  transform: rotate(-8deg) scale(1.1);
}

/* -- Hero gradient shimmer (background text/badge accent) ---- */
@keyframes gradientShimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.mkt-hero h1 em {
  background: linear-gradient(90deg, var(--accent), #22874a, #10b981, var(--accent));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShimmer 4s linear infinite;
}
html[data-theme="dark"] .mkt-hero h1 em {
  background: linear-gradient(90deg, #3aad5e, #5ec97a, #86efac, #3aad5e);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* -- Demo card slide-in from sides on reveal --------------- */
.mkt-demo-card .mkt-demo-text {
  opacity: 0;
  transform: translateX(-36px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.mkt-demo-card .mkt-book {
  opacity: 0;
  transform: translateX(36px);
  transition: opacity 0.7s 0.15s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}
.sm-visible .mkt-demo-text,
.sm-visible .mkt-book {
  opacity: 1;
  transform: translateX(0);
}

/* -- Typing cursor blink for hero subtitle ----------------- */
@keyframes cursorBlink {
  0%, 100% { border-right-color: var(--accent); }
  50%      { border-right-color: transparent; }
}
.mkt-hero-sub.typing {
  display: inline-block;
  border-right: 2px solid var(--accent);
  padding-right: 4px;
  animation: cursorBlink 0.75s step-end infinite;
  white-space: nowrap;
  overflow: hidden;
  max-width: 560px;
}
.mkt-hero-sub.typing-done {
  border-right: none;
  white-space: normal;
  overflow: visible;
}

/* -- Section divider line draw ------------------------------ */
.sm-divider {
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 2px;
  margin: 0 auto 2.5rem;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.6s 0.2s var(--ease-out);
}
.sm-divider.sm-visible {
  transform: scaleX(1);
}

/* -- Step number pop-in ------------------------------------ */
@keyframes stepNumPop {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(3deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.sm-visible .mkt-step-num {
  animation: stepNumPop 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.sm-stagger .mkt-step:nth-child(1) .mkt-step-num { animation-delay: 0.1s; }
.sm-stagger .mkt-step:nth-child(2) .mkt-step-num { animation-delay: 0.2s; }
.sm-stagger .mkt-step:nth-child(3) .mkt-step-num { animation-delay: 0.3s; }
.sm-stagger .mkt-step:nth-child(4) .mkt-step-num { animation-delay: 0.4s; }

/* -- Why-card icon bounce on reveal ------------------------ */
@keyframes iconBounce {
  0%   { transform: translateY(16px) scale(0.5); opacity: 0; }
  50%  { transform: translateY(-4px) scale(1.1); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.sm-visible .mkt-why-icon {
  animation: iconBounce 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.sm-stagger .mkt-why-card:nth-child(1) .mkt-why-icon { animation-delay: 0.05s; }
.sm-stagger .mkt-why-card:nth-child(2) .mkt-why-icon { animation-delay: 0.12s; }
.sm-stagger .mkt-why-card:nth-child(3) .mkt-why-icon { animation-delay: 0.19s; }
.sm-stagger .mkt-why-card:nth-child(4) .mkt-why-icon { animation-delay: 0.26s; }
.sm-stagger .mkt-why-card:nth-child(5) .mkt-why-icon { animation-delay: 0.33s; }
.sm-stagger .mkt-why-card:nth-child(6) .mkt-why-icon { animation-delay: 0.40s; }
.sm-stagger .mkt-why-card:nth-child(7) .mkt-why-icon { animation-delay: 0.47s; }
.sm-stagger .mkt-why-card:nth-child(8) .mkt-why-icon { animation-delay: 0.54s; }

/* -- Pricing plan scale-up on reveal ----------------------- */
.mkt-plan {
  opacity: 0;
  transform: translateY(24px) scale(0.95);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.28s ease,
              box-shadow 0.28s ease;
}
.sm-stagger .mkt-plan:nth-child(1) { transition-delay: 0ms; }
.sm-stagger .mkt-plan:nth-child(2) { transition-delay: 100ms; }
.sm-stagger .mkt-plan:nth-child(3) { transition-delay: 200ms; }
.sm-stagger .mkt-plan:nth-child(4) { transition-delay: 300ms; }
.sm-visible .mkt-plan,
.mkt-plan.sm-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.mkt-plan:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-lg);
}
.mkt-plan.hi:hover {
  box-shadow: var(--shadow-glow), var(--shadow-lg);
}

/* -- Bottom CTA glow pulse --------------------------------- */
@keyframes bottomGlow {
  0%, 100% { box-shadow: 0 0 40px rgba(20, 92, 50, 0.06); }
  50%      { box-shadow: 0 0 60px rgba(20, 92, 50, 0.14); }
}
.mkt-bottom {
  animation: bottomGlow 4s ease-in-out infinite;
}

/* -- Smooth hover underline grow for nav ------------------- */
/* -- Nav link underline animation ---------------------------- */
.nav-link {
  position: relative;
}
.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transition: width 0.25s ease, left 0.25s ease;
}
.nav-link:hover::after,
.nav-link.active::after {
  width: 60%;
  left: 20%;
}

/* -- Textarea focus (use outline instead of animation) ------- */

/* -- Usage bar animated fill --------------------------------- */
.usage-bar {
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* -- Reduce motion for accessibility ------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .sm-reveal,
  .sm-reveal-scale,
  .sm-divider,
  .mkt-plan,
  .mkt-demo-card .mkt-demo-text,
  .mkt-demo-card .mkt-book {
    opacity: 1 !important;
    transform: none !important;
  }
  .mkt-hero h1 em {
    -webkit-text-fill-color: var(--accent) !important;
    background: none !important;
  }
}

.workspace-chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: calc(100vh - 8.25rem);
}
.workspace-preview {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 8.25rem);
}

.workspace-chat .chat-messages {
  flex: 1;
  min-height: 0;
}

.workspace-preview .preview-pages {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-top: 0;
}

.chat-messages {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.3rem;
  scroll-behavior: smooth;
}

.message {
  border-radius: 1.25rem;
  padding: 0.95rem 1rem;
  line-height: 1.65;
}

.message.assistant {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}

.message.user {
  background: rgba(20, 92, 50, 0.1);
  border: 1px solid rgba(20, 92, 50, 0.14);
}

html[data-theme="dark"] .message.assistant {
  background: rgba(255, 255, 255, 0.03);
}

.message p {
  margin: 0;
}

.message-role {
  margin-bottom: 0.35rem;
}

.chat-form {
  margin-top: auto;
  padding-top: 1rem;
  background: linear-gradient(180deg, rgba(245, 251, 244, 0), var(--bg-card) 18%);
}

html[data-theme="dark"] .chat-form {
  background: linear-gradient(180deg, rgba(15, 23, 17, 0), var(--bg-card) 18%);
}

.chat-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.preview-meta {
  color: var(--text-soft);
  margin-top: 0.3rem;
}

.cover-stage {
  margin-top: 1.4rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.cover-stage img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.locked-banner {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(215, 146, 41, 0.1);
  color: #8a641d;
  border: 1px solid rgba(215, 146, 41, 0.18);
}

html[data-theme="dark"] .locked-banner {
  color: #ffd27c;
}

.preview-pages {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.page-card {
  padding: 0.9rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
}

html[data-theme="dark"] .page-card {
  background: rgba(255, 255, 255, 0.03);
}

.page-card-locked {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 13rem;
  background: linear-gradient(135deg, rgba(215, 146, 41, 0.1), rgba(20, 92, 50, 0.08));
}

/* -- Comic panel grid ---------------------------------------- */
.comic-page { padding: 0.75rem; }
.comic-panel-grid {
  display: grid;
  gap: 10px;
  width: 100%;
  min-height: clamp(24rem, 72vh, 56rem);
  grid-auto-flow: dense;
}

.comic-layout-2x2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(180px, 1fr));
}
.comic-layout-2x3 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(135px, 1fr));
}
.comic-layout-3x1 {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(3, minmax(140px, 1fr));
}
.comic-layout-1x3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(320px, 1fr);
}
.comic-layout-cinematic {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(250px, 1.8fr) minmax(160px, 1fr);
}
.comic-layout-cinematic .comic-panel-1 { grid-column: 1 / -1; }
.comic-layout-splash {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(480px, 1fr);
}
.comic-layout-widescreen {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(220px, 1fr));
}
.comic-layout-focus {
  grid-template-columns: minmax(0, 0.68fr) minmax(0, 1.28fr) minmax(0, 0.68fr);
  grid-template-rows: minmax(360px, 1fr);
}
.comic-layout-diagonal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(180px, 1fr));
}
.comic-layout-Lshape {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.9fr);
  grid-template-rows: repeat(2, minmax(180px, 1fr));
}
.comic-layout-Lshape .comic-panel-1 { grid-row: 1 / span 2; }
.comic-layout-Tshape {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(220px, 1.1fr) minmax(160px, 1fr);
}
.comic-layout-Tshape .comic-panel-1 { grid-column: 1 / -1; }
.comic-layout-stagger {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(130px, 1fr));
}
.comic-layout-stagger .comic-panel-3 { grid-column: 1 / -1; }
.comic-layout-cross {
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.15fr) minmax(0, 0.72fr);
  grid-template-rows: minmax(120px, 0.7fr) minmax(190px, 1.1fr) minmax(120px, 0.7fr);
}
.comic-layout-cross .comic-panel-1 { grid-column: 1; grid-row: 1; }
.comic-layout-cross .comic-panel-2 { grid-column: 3; grid-row: 1; }
.comic-layout-cross .comic-panel-3 { grid-column: 2; grid-row: 2; }
.comic-layout-cross .comic-panel-4 { grid-column: 1; grid-row: 3; }
.comic-layout-cross .comic-panel-5 { grid-column: 3; grid-row: 3; }

/* New shaped layouts */
.comic-layout-hextrio {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(200px, 1fr));
}
.comic-layout-hextrio .comic-panel-1 { grid-column: 1 / 4; }
.comic-layout-trapezoid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(180px, 1fr));
}
.comic-layout-chevron {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(3, minmax(140px, 1fr));
}
.comic-layout-wedge {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(360px, 1fr);
}
.comic-layout-diamond {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(120px, 1fr));
}
.comic-layout-diamond .comic-panel-1 { grid-column: 2; grid-row: 1 / 4; }
.comic-layout-diamond .comic-panel-2 { grid-column: 1; grid-row: 1; }
.comic-layout-diamond .comic-panel-3 { grid-column: 3; grid-row: 1; }
.comic-layout-diamond .comic-panel-4 { grid-column: 1; grid-row: 3; }
.comic-layout-diamond .comic-panel-5 { grid-column: 3; grid-row: 3; }
.comic-layout-mangatall {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.6fr);
  grid-template-rows: minmax(360px, 1fr);
}
.comic-layout-mangaaction {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(260px, 1.4fr) minmax(180px, 1fr);
}
.comic-layout-mangaaction .comic-panel-1 { grid-column: 1 / -1; }

/* Manga RTL � reverse panel reading direction */
.comic-panel-grid.manga-rtl {
  direction: rtl;
}
.comic-panel-grid.manga-rtl .comic-panel {
  direction: ltr; /* reset text direction inside panels */
}

.comic-panel {
  border: 3px solid #18181b;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}
html[data-theme="dark"] .comic-panel {
  background: #161616;
  border-color: #52525b;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.comic-panel-img,
.comic-panel-placeholder {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: block;
  object-fit: cover;
}
.comic-layout-2x2 .comic-panel-img,
.comic-layout-2x2 .comic-panel-placeholder { aspect-ratio: 1 / 1.05; }
.comic-layout-2x3 .comic-panel-img,
.comic-layout-2x3 .comic-panel-placeholder { aspect-ratio: 1 / 1.28; }
.comic-layout-3x1 .comic-panel-img,
.comic-layout-3x1 .comic-panel-placeholder { aspect-ratio: 3.2 / 1; }
.comic-layout-1x3 .comic-panel-img,
.comic-layout-1x3 .comic-panel-placeholder { aspect-ratio: 0.72 / 1; }
.comic-layout-cinematic .comic-panel-img,
.comic-layout-cinematic .comic-panel-placeholder { aspect-ratio: 1.4 / 1; }
.comic-layout-cinematic .comic-panel-1 .comic-panel-img,
.comic-layout-cinematic .comic-panel-1 .comic-panel-placeholder { aspect-ratio: 2.35 / 1; }
.comic-layout-splash .comic-panel-img,
.comic-layout-splash .comic-panel-placeholder { aspect-ratio: 0.82 / 1; }
.comic-layout-widescreen .comic-panel-img,
.comic-layout-widescreen .comic-panel-placeholder { aspect-ratio: 2.4 / 1; }
.comic-layout-focus .comic-panel-img,
.comic-layout-focus .comic-panel-placeholder { aspect-ratio: 0.72 / 1; }
.comic-layout-focus .comic-panel-2 .comic-panel-img,
.comic-layout-focus .comic-panel-2 .comic-panel-placeholder { aspect-ratio: 1 / 1; }
.comic-layout-diagonal .comic-panel-img,
.comic-layout-diagonal .comic-panel-placeholder { aspect-ratio: 1 / 1; }
.comic-layout-Lshape .comic-panel-img,
.comic-layout-Lshape .comic-panel-placeholder { aspect-ratio: 1 / 1; }
.comic-layout-Lshape .comic-panel-1 .comic-panel-img,
.comic-layout-Lshape .comic-panel-1 .comic-panel-placeholder { aspect-ratio: 0.82 / 1; }
.comic-layout-Tshape .comic-panel-img,
.comic-layout-Tshape .comic-panel-placeholder { aspect-ratio: 1 / 1.05; }
.comic-layout-Tshape .comic-panel-1 .comic-panel-img,
.comic-layout-Tshape .comic-panel-1 .comic-panel-placeholder { aspect-ratio: 2.35 / 1; }
.comic-layout-stagger .comic-panel-img,
.comic-layout-stagger .comic-panel-placeholder { aspect-ratio: 1 / 1.1; }
.comic-layout-stagger .comic-panel-3 .comic-panel-img,
.comic-layout-stagger .comic-panel-3 .comic-panel-placeholder { aspect-ratio: 2.1 / 1; }
.comic-layout-cross .comic-panel-img,
.comic-layout-cross .comic-panel-placeholder { aspect-ratio: 1 / 1; }
.comic-layout-cross .comic-panel-3 .comic-panel-img,
.comic-layout-cross .comic-panel-3 .comic-panel-placeholder { aspect-ratio: 1 / 1.05; }

.comic-panel-placeholder {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
  color: #888;
  font-size: 0.8rem;
  font-weight: 600;
}
html[data-theme="dark"] .comic-panel-placeholder { background: linear-gradient(135deg, #2a2a2a, #333); color: #666; }

.comic-layout-diagonal .comic-panel-1 { clip-path: polygon(0 0, 100% 0, 84% 100%, 0 100%); }
.comic-layout-diagonal .comic-panel-2 { clip-path: polygon(16% 0, 100% 0, 100% 100%, 0 100%); }
.comic-layout-diagonal .comic-panel-3 { clip-path: polygon(0 0, 100% 0, 100% 100%, 18% 100%); }
.comic-layout-diagonal .comic-panel-4 { clip-path: polygon(0 0, 82% 0, 100% 100%, 0 100%); }

.comic-dialogue-wrap {
  position: absolute;
  inset: 0;
  padding: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
}
.comic-speech-bubble {
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid #18181b;
  border-radius: 18px 18px 18px 6px;
  padding: 0.38rem 0.72rem;
  font-size: 0.78rem;
  line-height: 1.35;
  position: relative;
  max-width: min(18rem, 76%);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}
.comic-speech-bubble::after {
  content: "";
  position: absolute;
  left: 14px;
  bottom: -10px;
  width: 14px;
  height: 14px;
  background: inherit;
  border-right: 2px solid #18181b;
  border-bottom: 2px solid #18181b;
  transform: rotate(38deg) skewX(8deg);
}
.comic-speech-bubble.pos-top-right,
.comic-speech-bubble.pos-bottom-right { align-self: flex-end; }
.comic-speech-bubble.pos-top-center,
.comic-speech-bubble.pos-bottom-center { align-self: center; }
.comic-speech-bubble.pos-bottom-left,
.comic-speech-bubble.pos-bottom-right,
.comic-speech-bubble.pos-bottom-center { margin-top: auto; }
.comic-speech-bubble.pos-top-right::after,
.comic-speech-bubble.pos-bottom-right::after {
  left: auto;
  right: 14px;
  transform: rotate(52deg) skewX(-8deg);
}
.comic-speech-bubble.pos-top-center::after,
.comic-speech-bubble.pos-bottom-center::after {
  left: calc(50% - 7px);
  right: auto;
}
html[data-theme="dark"] .comic-speech-bubble {
  background: rgba(24, 24, 27, 0.94);
  border-color: #d4d4d8;
  color: #f4f4f5;
}
html[data-theme="dark"] .comic-speech-bubble::after {
  border-right-color: #d4d4d8;
  border-bottom-color: #d4d4d8;
}
.comic-speaker { color: var(--accent); font-size: 0.72rem; }
.comic-narration {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: 0.55rem;
  background: rgba(255, 248, 220, 0.94);
  border: 1px solid rgba(200, 180, 100, 0.35);
  border-radius: 4px;
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  font-style: italic;
  color: #555;
  line-height: 1.3;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}
html[data-theme="dark"] .comic-narration {
  background: rgba(60, 50, 20, 0.68);
  border-color: rgba(100, 90, 50, 0.35);
  color: #e4e4e7;
}

@media (max-width: 720px) {
  .page-count-row {
    flex-wrap: wrap;
  }
  .page-count-hint {
    width: 100%;
    margin-left: 0;
    text-align: left;
  }
  .comic-panel-grid {
    min-height: 20rem;
    gap: 8px;
  }
  .comic-layout-1x3 {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(3, minmax(180px, 1fr));
  }
  .comic-layout-1x3 .comic-panel-img,
  .comic-layout-1x3 .comic-panel-placeholder { aspect-ratio: 1.25 / 1; }
  .comic-layout-focus,
  .comic-layout-cross {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
  }
  .comic-layout-cross .comic-panel-1,
  .comic-layout-cross .comic-panel-2,
  .comic-layout-cross .comic-panel-3,
  .comic-layout-cross .comic-panel-4,
  .comic-layout-cross .comic-panel-5,
  .comic-layout-focus .comic-panel-1,
  .comic-layout-focus .comic-panel-2,
  .comic-layout-focus .comic-panel-3 {
    grid-column: auto;
    grid-row: auto;
  }
  .comic-layout-focus .comic-panel-2,
  .comic-layout-cross .comic-panel-3 {
    grid-column: 1 / -1;
  }
}

/* -- 2-page realistic book spread ---------------------------- */
.book-spread-wrapper {
  perspective: 1800px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  padding: 0;
}

.page-spread {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  position: relative;
  transform-style: preserve-3d;
  background: linear-gradient(170deg, #fdfcf8 0%, #f5f2ec 100%);
  border-radius: 4px;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.06),
    0 12px 40px rgba(20,50,30,0.12),
    inset 0 0 60px rgba(0,0,0,0.03);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] .page-spread {
  background: linear-gradient(170deg, #1c211e 0%, #191e1b 100%);
}

/* Spine shadow � hidden for single-page view */
.page-spread::before { display: none; }

/* Page corner flip hint */
.page-spread::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 52px;
  height: 52px;
  background: linear-gradient(225deg, rgba(20,92,50,0.1) 0%, transparent 60%);
  pointer-events: none;
  z-index: 3;
  transition: width 0.25s ease, height 0.25s ease;
}
.page-spread:hover::after {
  width: 72px;
  height: 72px;
}

.page-spread .spread-page {
  flex: 1;
  min-height: 0;
  padding: 1.5rem 1.5rem;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  background: linear-gradient(170deg, #fdfcf8, #f5f2ec);
  overflow-y: auto;
}

html[data-theme="dark"] .page-spread .spread-page {
  background: linear-gradient(170deg, #1c211e, #191e1b);
}

.page-spread .spread-page .page-label {
  font-size: 0.72rem;
  opacity: 0.5;
  margin-bottom: 0.6rem;
}

.page-spread .spread-page .page-image {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.page-spread .spread-page .page-text {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-soft);
  padding-top: 0.2rem;
}

/* Page turn animation */
@keyframes pageFlipForward {
  0%   { transform: rotateY(0deg);   opacity: 1; }
  40%  { transform: rotateY(-90deg); opacity: 0.6; }
  60%  { transform: rotateY(-90deg); opacity: 0.6; }
  100% { transform: rotateY(0deg);   opacity: 1; }
}
@keyframes pageFlipBackward {
  0%   { transform: rotateY(0deg);   opacity: 1; }
  40%  { transform: rotateY(90deg);  opacity: 0.6; }
  60%  { transform: rotateY(90deg);  opacity: 0.6; }
  100% { transform: rotateY(0deg);   opacity: 1; }
}
.page-spread.flipping-forward {
  animation: pageFlipForward 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: left center;
}
.page-spread.flipping-backward {
  animation: pageFlipBackward 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: right center;
}

/* Spread navigation bar � pinned below the book */
.spread-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 0.6rem 1rem;
  width: 100%;
  max-width: none;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.spread-btn {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.5rem 1.2rem;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.spread-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.04);
}
.spread-btn:active { transform: scale(0.97); }
.spread-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}
.spread-download-btn {
  background: linear-gradient(135deg, #145c32, #22874a);
  color: #fff;
  border-color: #145c32;
}
.spread-download-btn:hover {
  background: linear-gradient(135deg, #0e3d1f, #145c32);
  color: #fff;
}
.spread-counter {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 5rem;
  text-align: center;
}
.spread-page-dots {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.spread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
}
.spread-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

/* Cover page special styling */
.spread-cover {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  text-align: center;
}
html[data-theme="dark"] .spread-cover {
  background: linear-gradient(135deg, rgba(20,60,35,0.3), rgba(30,80,50,0.2));
}
.spread-cover img {
  max-width: 60%;
  max-height: 16rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  margin-bottom: 1rem;
}
.spread-cover-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}
.spread-cover-author {
  font-size: 1rem;
  font-weight: 500;
  color: var(--brand-deep);
  margin-top: 0.35rem;
  font-style: italic;
}
.spread-cover-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Plus badge on cover */
.cover-plus-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #145c32, #22874a);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 640px) {
  .page-spread {
    min-height: 16rem;
  }
  .page-spread .spread-page { min-height: 14rem; }
  .spread-cover img { max-width: 80%; }
}

/* -- Gallery page -------------------------------------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
}
.gallery-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-md);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(20, 60, 30, 0.16);
}
.gallery-cover {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.gallery-cover-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--bg-soft), var(--brand-soft));
}
.gallery-info {
  padding: 1rem 1rem 0.5rem;
}
.gallery-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}
.gallery-author {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}
.gallery-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
}
.gallery-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 1rem 1rem;
  flex-wrap: wrap;
}

/* -- Publish popup ------------------------------------------- */
.publish-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.publish-popup-overlay[hidden] { display: none; }
.publish-popup {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2rem 1.8rem;
  max-width: 440px;
  width: 100%;
  position: relative;
}
.publish-popup h3 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}
.publish-popup p {
  color: var(--text-muted);
  margin: 0 0 1.2rem;
  font-size: 0.92rem;
}
.publish-option {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-card);
  margin-bottom: 0.8rem;
  transition: border-color 0.2s, background 0.2s;
}
.publish-option:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.publish-option strong { font-size: 1rem; }
.publish-option span { font-size: 0.85rem; color: var(--text-muted); }
.publish-popup-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.sm-action-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9050;
  background: rgba(5, 15, 9, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.sm-action-modal-overlay[hidden] {
  display: none;
}

.sm-action-modal {
  width: min(100%, 30rem);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  position: relative;
}

.sm-action-close {
  position: absolute;
  top: 0.8rem;
  right: 0.9rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.45rem;
  cursor: pointer;
}

.sm-action-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.7rem;
  border-radius: var(--radius-pill);
  background: rgba(20, 92, 50, 0.1);
  color: var(--brand-deep);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sm-action-modal h3 {
  margin: 1rem 0 0.45rem;
  font-family: var(--font-heading);
  font-size: 1.35rem;
}

.sm-action-modal p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.sm-action-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}

.sm-action-primary,
.sm-action-secondary {
  min-width: 8.5rem;
  text-align: center;
}

/* -- Coming Soon upgrade modal ------------------------------- */
.coming-soon-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  background: rgba(5, 15, 9, 0.55);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.coming-soon-overlay[hidden] { display: none; }
.coming-soon-modal {
  width: min(100%, 28rem);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem;
  position: relative;
  text-align: center;
}
.coming-soon-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}
.coming-soon-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, rgba(20,92,50,0.12), rgba(20,92,50,0.05));
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.coming-soon-modal h3 {
  margin: 1rem 0 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}
.coming-soon-modal p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 0.92rem;
}
.coming-soon-form {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
}
.coming-soon-form input[type="email"] {
  flex: 1;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.92rem;
  min-width: 0;
}
.coming-soon-form input[type="email"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20,92,50,0.12);
}
.coming-soon-form .btn-primary {
  white-space: nowrap;
  padding: 0.65rem 1.2rem;
}
.coming-soon-status {
  font-size: 0.88rem;
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}
.coming-soon-status.success {
  background: rgba(20,92,50,0.08);
  color: var(--brand);
}
.coming-soon-status.error {
  background: rgba(168,32,32,0.08);
  color: var(--danger);
}
.coming-soon-fine {
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.7;
  margin: 0.5rem 0 0;
}

/* -- Star rating --------------------------------------------- */
.star-rating {
  display: inline-flex;
  gap: 0.15rem;
  font-size: 1.3rem;
  cursor: pointer;
}
.star-rating .star {
  color: var(--border-strong);
  transition: color 0.15s;
  user-select: none;
}
.star-rating .star.filled { color: #f5b831; }
.star-rating .star:hover,
.star-rating .star:hover ~ .star { color: #f5b831; }
.star-rating-display {
  display: inline-flex;
  gap: 0.1rem;
  font-size: 1.1rem;
}
.star-rating-display .star { color: var(--border-strong); }
.star-rating-display .star.filled { color: #f5b831; }

/* -- Modern suggestion chips (replaces old circular pill look) */
.chip-btn-modern {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem;
  min-width: min(100%, 14rem);
  text-align: left;
  font-size: 0.88rem;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.chip-btn-modern:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
html[data-theme="dark"] .chip-btn-modern {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="dark"] .chip-btn-modern:hover {
  background: var(--surface-strong);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.chip-kicker {
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.chip-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.page-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.page-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 1rem;
  border: 1px solid var(--border);
  margin-bottom: 0.8rem;
}

.page-text {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.progress-card,
.status-card,
.error-card {
  max-width: 42rem;
  margin: 1rem auto 0;
  text-align: center;
  width: 100%;
}

/* -- Progress V2 � timeline design ------------------------------ */
.progress-section-v2 {
  max-width: 44rem;
  margin: 2rem auto 0;
  padding: 2.5rem 2rem 2rem;
  text-align: center;
}

.progress-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2.4rem;
}

.progress-icon-ring {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-spinner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  animation: spinRing 2.2s linear infinite;
}
.progress-spinner circle {
  stroke: var(--brand);
  stroke-dasharray: 90 35;
  stroke-linecap: round;
}
@keyframes spinRing { to { transform: rotate(360deg); } }

.progress-pct-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand);
  z-index: 1;
}

.progress-section-v2 h1 {
  font-size: 1.5rem;
  margin: 0;
}
.progress-sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
  min-height: 1.4em;
}
.progress-eta {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 1.2rem 0 0;
}

/* -- Horizontal timeline track --------------------------------- */
.timeline-track {
  position: relative;
  max-width: 36rem;
  margin: 0 auto;
}

.timeline-rail {
  position: absolute;
  top: 16px;
  left: 2rem;
  right: 2rem;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  z-index: 0;
  overflow: hidden;
}
.timeline-fill {
  height: 100%;
  width: 0%;
  background: var(--brand);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.timeline-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.tl-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
}

.tl-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-strong);
  border: 2.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

.tl-icon {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  transition: color 0.3s;
}

.tl-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color 0.3s;
}

/* Active step */
.tl-step.active .tl-dot {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 6px rgba(20, 92, 50, 0.1);
  animation: tlPulse 2s ease-in-out infinite;
}
.tl-step.active .tl-icon { color: var(--brand); }
.tl-step.active .tl-label { color: var(--brand); }

@keyframes tlPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(20, 92, 50, 0.08); }
  50%      { box-shadow: 0 0 0 10px rgba(20, 92, 50, 0.18); }
}

/* Done step */
.tl-step.done .tl-dot {
  border-color: var(--brand);
  background: var(--brand);
}
.tl-step.done .tl-icon { color: #fff; }
.tl-step.done .tl-label { color: var(--brand-deep); }

/* Error step */
.tl-step.error .tl-dot {
  border-color: var(--danger);
  background: var(--danger);
}
.tl-step.error .tl-icon { color: #fff; }
.tl-step.error .tl-label { color: var(--danger); }

/* Mobile stack */
@media (max-width: 480px) {
  .timeline-steps { gap: 0.2rem; }
  .tl-label { font-size: 0.62rem; }
  .tl-dot { width: 28px; height: 28px; }
  .tl-icon { font-size: 0.68rem; }
  .timeline-rail { top: 13px; }
  .progress-section-v2 { padding: 1.5rem 1rem; }
}

.progress-bar-wrap {
  margin: 1.4rem 0 1.2rem;
  height: 0.8rem;
  border-radius: var(--radius-pill);
  background: rgba(20, 92, 50, 0.12);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #145c32, #22874a);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

.step-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.75rem;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  justify-content: center;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
  color: var(--text-muted);
}

html[data-theme="dark"] .step {
  background: rgba(255, 255, 255, 0.03);
}

.step.active {
  color: var(--text);
  border: 1px solid rgba(20, 92, 50, 0.2);
}

.step.done {
  color: var(--brand-deep);
}

.step.error {
  color: var(--danger);
}

.site-footer {
  margin-top: auto;
  padding: 3.5rem 0;
  color: var(--text-muted);
  border-top: 1px solid transparent;
  background-image: linear-gradient(var(--border), var(--border)), linear-gradient(90deg, transparent, var(--brand), transparent);
  background-size: 100% 1px, 60% 1px;
  background-repeat: no-repeat;
  background-position: top center;
}

.site-footer .shell {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-inner {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 2rem;
}

.footer-inner p {
  margin: 0;
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.25rem;
  width: 100%;
}

.footer-links a {
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--text-soft);
  font-weight: 500;
  transition: color 0.15s ease, transform 0.15s ease;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  width: 100%;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.footer-legal a {
  text-decoration: none;
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.15s ease;
}

.footer-legal a:hover {
  color: var(--text);
}

@media (max-width: 1080px) {
  .workspace-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .workspace-chat,
  .workspace-preview {
    min-height: 50vh;
  }

  .feature-strip,
  .settings-grid,
  .account-grid-page {
    grid-template-columns: 1fr;
  }

  .settings-card-wide {
    grid-column: span 1;
  }

  .settings-rows {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .header-inner {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .pricing-grid,
  .preview-pages,
  .options-grid {
    grid-template-columns: 1fr;
  }

  .composer-toolbar,
  .preview-head,
  .workspace-panel-head,
  .discount-card,
  .composer-topline {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .toolbar-models,
  .preview-actions,
  .discount-form {
    width: 100%;
  }

  .inline-select,
  .btn-launch,
  .discount-form input {
    width: 100%;
  }

  .btn-inline {
    width: auto;
  }

  .inline-select select {
    min-width: 0;
    width: 100%;
  }

  .preview-actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .preview-actions .btn-inline {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    padding: 0.6rem 0.8rem;
    font-size: 0.88rem;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 1rem, 100%);
  }

  .workspace-main {
    padding: 0.5rem;
    width: min(100% - 0.5rem, 100%);
  }

  .hero h1,
  .page-hero h1 {
    font-size: 2rem;
  }

  .hero-home {
    padding-top: 1.5rem;
  }

  /* -- Mobile nav collapse -- */
  .nav-toggle {
    display: block;
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .nav-links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    order: 10;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.5rem;
    margin-top: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
  }

  html[data-theme="dark"] .nav-links {
    background: var(--surface-strong);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    font-size: 0.92rem;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    width: 100%;
    text-align: left;
  }

  .nav-link:hover,
  .nav-link.active {
    background: rgba(20, 92, 50, 0.06);
  }

  .nav-external {
    display: none;
  }

  .billing-toggle,
  .chat-actions {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .chat-actions {
    align-items: stretch;
  }

  /* Full-width buttons only for standalone forms, not header/nav/inline contexts */
  .home-main .btn-primary,
  .home-main .btn-secondary,
  .account-main .btn-primary,
  .account-main .btn-secondary,
  .pricing-main .btn-primary,
  .pricing-main .btn-secondary,
  .auth-modal .btn-primary,
  .auth-modal .btn-secondary,
  .btn-launch {
    width: 100%;
    text-align: center;
  }

  .header-right {
    width: 100%;
    justify-content: center;
  }

  .user-area {
    justify-content: center;
  }

  .logo-copy {
    display: none;
  }

  .workspace-chat,
  .workspace-preview {
    min-height: auto;
  }

  .chat-messages {
    max-height: none;
  }

  .chat-form textarea {
    min-height: 4rem;
    font-size: 0.9rem;
  }

  .page-card {
    padding: 0.7rem;
  }

  .feature-card,
  .settings-card,
  .price-card {
    padding: 1.2rem;
  }

  .composer-card {
    padding: 1rem;
  }

  .prompt-stage {
    padding: 0.8rem;
  }

  .suggestion-chips {
    flex-wrap: wrap;
    justify-content: center;
  }

  .chip-btn {
    font-size: 0.82rem;
    padding: 0.55rem 0.75rem;
  }

  .chip-btn-modern {
    width: 100%;
    min-width: 0;
  }

  .editor-model-pill {
    font-size: 0.78rem;
    padding: 0.35rem 0.7rem;
  }

  .progress-card h1,
  .error-card h1 {
    font-size: 1.6rem;
  }

  .step {
    font-size: 0.88rem;
    padding: 0.7rem 0.8rem;
  }
}

@media (max-width: 480px) {
  .shell {
    width: calc(100% - 1rem);
  }

  .site-header {
    padding: 0.6rem 0;
  }

  .header-inner {
    gap: 0.35rem;
  }

  .hero h1,
  .page-hero h1 {
    font-size: clamp(1.5rem, 8vw, 2rem);
    letter-spacing: -0.04em;
  }

  .hero-sub,
  .progress-copy {
    font-size: 0.92rem;
  }

  .composer-topline h2,
  .workspace-panel-head h2 {
    font-size: 1.2rem;
  }

  .price-amount {
    font-size: 2rem;
  }

  .account-plan-label {
    font-size: 1.4rem;
  }

  .usage-badge,
  .tier-badge {
    display: none;
  }

  .logo-mark {
    width: 2rem;
    height: 2rem;
  }

  .user-email {
    max-width: 9rem;
  }

  .spread-btn {
    padding: 0.4rem 0.7rem;
    font-size: 0.82rem;
  }

  .spread-counter {
    font-size: 0.78rem;
    min-width: 3.5rem;
  }

  .publish-popup {
    padding: 1.4rem 1.2rem;
  }

  .sm-action-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
}


/* --------------------------------------------------------------
   Auth Modal
   -------------------------------------------------------------- */

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.auth-modal-overlay[hidden] {
  display: none;
}

.auth-modal {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  position: relative;
  animation: fadeIn 0.2s ease-out;
}

.auth-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0.25rem;
}

.auth-modal-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.auth-modal h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin: 0 0 0.5rem;
}

.auth-modal p {
  color: var(--text-soft);
  font-size: 0.92rem;
  margin: 0 0 1.2rem;
  line-height: 1.5;
}

.auth-modal-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.auth-modal-btn:hover {
  opacity: 0.88;
}

.auth-modal-divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.auth-modal-divider::before,
.auth-modal-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-modal-note {
  font-size: 0.78rem !important;
  color: var(--text-muted) !important;
  margin-top: 0.5rem !important;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  text-align: left;
}

.auth-form .field {
  gap: 0.35rem;
}

.auth-form .field label {
  font-size: 0.82rem;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-input);
  color: var(--text);
  padding: 0.82rem 0.95rem;
  font: inherit;
}

.auth-form input[type="text"]:focus,
.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
  outline: none;
  border-color: rgba(20, 92, 50, 0.36);
  box-shadow: 0 0 0 4px rgba(20, 92, 50, 0.08);
}

.auth-form .btn-primary,
.auth-form .btn-secondary,
.auth-form .auth-google-btn,
.auth-form .auth-anon-btn {
  width: 100%;
}

.auth-form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.auth-helper-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.auth-helper {
  margin: -0.2rem 0 0.15rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}


/* --------------------------------------------------------------
   API Dashboard
   -------------------------------------------------------------- */

.devs-main {
  padding-top: 2rem;
  overflow-x: hidden;
}

.api-docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.api-endpoint {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.api-endpoint:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: rgba(20, 92, 50, 0.3);
}

.api-endpoint p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin: 0.75rem 0 0;
  line-height: 1.5;
}

.api-method {
  display: inline-block;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  vertical-align: middle;
}

.api-method.get {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.api-method.post {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

html[data-theme="dark"] .api-method.get {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

html[data-theme="dark"] .api-method.post {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}

.api-path {
  display: inline-block;
  font-family: 'Space Mono', monospace;
  font-size: 0.9rem;
  margin-left: 0.5rem;
  color: var(--text);
  word-break: break-all;
  vertical-align: middle;
  font-weight: 600;
}

.api-code {
  background: #111827;
  color: #e5e7eb;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 1rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.82rem;
  overflow-x: auto;
  margin-top: 0.75rem;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.api-endpoint details {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}

.api-endpoint summary {
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.api-endpoint summary::before {
  content: "?";
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.api-endpoint details[open] summary::before {
  transform: rotate(90deg);
}

.api-endpoint summary::-webkit-details-marker {
  display: none;
}

.api-auth-info {
  margin-top: 1.5rem;
  padding: 1.2rem;
}

.api-auth-info h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.api-auth-info ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.api-auth-info li {
  color: var(--text-soft);
  font-size: 0.88rem;
  margin-bottom: 0.3rem;
}

.api-auth-info code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--brand-deep);
  font-family: 'Space Mono', monospace;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.82rem;
}

.api-keys-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.api-create-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.api-label-input {
  flex: 1;
  min-width: 14rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.9rem;
}

.api-new-key-banner {
  background: linear-gradient(to right, rgba(20, 92, 50, 0.08), rgba(20, 92, 50, 0.03));
  border: 1px solid rgba(20, 92, 50, 0.25);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.api-new-key-banner p {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 500;
}

.api-key-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #111827;
  color: #10b981;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.api-key-display code {
  font-family: 'Space Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  word-break: break-all;
  flex: 1;
}

.api-keys-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.api-keys-table th, .api-keys-table td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.api-keys-table th {
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.api-keys-table code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: 'Space Mono', monospace;
  color: var(--text-secondary);
}

.api-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 0 !important;
}

.api-status-active {
  color: var(--brand-deep);
  font-weight: 600;
}

.api-status-revoked {
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .api-docs-grid {
    grid-template-columns: 1fr;
  }

  .api-keys-table th:nth-child(4),
  .api-keys-table td:nth-child(4),
  .api-keys-table th:nth-child(3),
  .api-keys-table td:nth-child(3) {
    display: none;
  }

  .api-create-row {
    flex-direction: column;
  }

  .api-label-input {
    min-width: 0;
    width: 100%;
  }

  .api-auth-info {
    padding: 0.8rem;
  }

  .api-keys-header {
    flex-direction: column;
  }
}

/* -- Mobile modal & button polish -- */
@media (max-width: 640px) {
  .sm-action-modal {
    width: calc(100% - 1rem);
    padding: 1.25rem;
  }

  .sm-action-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .sm-action-primary,
  .sm-action-secondary {
    width: 100%;
  }

  .auth-modal {
    width: calc(100% - 1rem);
    padding: 1.5rem 1.25rem;
  }

  .auth-card {
    padding: 2rem 1.25rem;
  }

  .price-card {
    margin-bottom: 0.75rem;
  }

  /* Sticky create button on /app */
  .btn-launch {
    position: sticky;
    bottom: 0.75rem;
    z-index: 5;
  }
}

/* -- Org/School Chooser Modal ---------------------------- */
.sm-modal-overlay{position:fixed;inset:0;z-index:9500;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;animation:smFadeIn .2s ease}
html[data-theme="dark"] .sm-modal-overlay{background:rgba(0,0,0,.65)}
@keyframes smFadeIn{from{opacity:0}to{opacity:1}}
.sm-modal{position:relative;background:var(--surface);border:1px solid var(--border);border-radius:20px;padding:2rem;max-width:480px;width:90vw;box-shadow:0 16px 48px rgba(0,0,0,.18);animation:smSlideUp .25s ease}
@keyframes smSlideUp{from{transform:translateY(12px);opacity:0}to{transform:translateY(0);opacity:1}}
.sm-modal-close{position:absolute;top:.75rem;right:.75rem;background:none;border:none;font-size:1.5rem;cursor:pointer;color:var(--text-muted);line-height:1}
.sm-modal-close:hover{color:var(--text)}
.org-type-card{flex:1;min-width:180px;display:flex;flex-direction:column;align-items:center;gap:.5rem;padding:1.5rem 1rem;border-radius:16px;border:2px solid var(--border);background:var(--bg);cursor:pointer;transition:border-color .2s,box-shadow .2s,transform .15s}
.org-type-card:hover{border-color:var(--brand);box-shadow:0 4px 16px rgba(20,92,50,.12);transform:translateY(-2px)}
.org-type-icon{font-size:2.5rem}
.org-type-label{font-weight:700;font-size:1.05rem;color:var(--text)}
.org-type-desc{font-size:.82rem;color:var(--text-muted);text-align:center}

/* -- Abuse/HUD Detector Banner for Free Users ------------ */
.hud-abuse-banner{position:fixed;top:0;left:0;right:0;z-index:9600;padding:14px 20px;text-align:center;font-size:.9rem;font-weight:600;display:none;animation:smSlideDown .3s ease}
.hud-abuse-banner.visible{display:flex;align-items:center;justify-content:center;gap:1rem}
.hud-abuse-banner{background:#fef3c7;color:#92400e;border-bottom:2px solid #f59e0b}
html[data-theme="dark"] .hud-abuse-banner{background:#451a03;color:#fbbf24;border-bottom-color:#b45309}
.hud-abuse-banner .hud-dismiss{background:none;border:none;font-size:1.1rem;cursor:pointer;color:inherit;opacity:.7}
.hud-abuse-banner .hud-dismiss:hover{opacity:1}
@keyframes smSlideDown{from{transform:translateY(-100%)}to{transform:translateY(0)}}

/* -- Theme-Aware Toast Notification ------------------------ */
.upgrade-toast{background:var(--surface)!important;color:var(--text)!important;border:1px solid var(--border)!important;box-shadow:0 12px 40px rgba(0,0,0,.15)!important}
html[data-theme="dark"] .upgrade-toast{background:var(--surface)!important;border-color:var(--border)!important;box-shadow:0 12px 40px rgba(0,0,0,.4)!important}
.upgrade-toast-text strong{color:var(--text)!important}
.upgrade-toast-text span{color:var(--text-muted)!important}
.upgrade-toast-btn{background:var(--brand)!important;color:#fff!important}
html[data-theme="dark"] .upgrade-toast-btn{background:var(--accent)!important}

/* -- Modern Premium (Base44-inspired) Redesign -- */
body, .shell {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.composer-card {
  border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0,0,0,0.06);
  border-radius: 28px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  padding: 2rem;
  margin: 4rem auto;
  max-width: 800px;
}

html[data-theme="dark"] .composer-card {
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  border-color: var(--border-strong);
}

.prompt-stage {
  border-radius: 20px;
  background: var(--bg-soft);
  border: 1.5px solid transparent;
  box-shadow: 0 8px 32px rgba(0,0,0,0.03) inset;
  transition: all 0.25s ease;
}

html[data-theme="dark"] .prompt-stage {
  box-shadow: 0 8px 32px rgba(0,0,0,0.2) inset;
  background: #0d1410;
}

.prompt-stage:focus-within {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
  transform: translateY(-2px);
}

.prompt-stage textarea {
  font-size: 1.15rem;
  padding: 1.5rem;
  font-family: var(--font-body);
  color: var(--text);
}

.prompt-stage textarea::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.composer-toolbar {
  background: transparent;
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

.toolbar-submit {
  border-radius: 12px;
  padding: 0.6rem 1.4rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(20,92,50,0.2);
}

html[data-theme="dark"] .toolbar-submit {
  box-shadow: 0 4px 12px rgba(58,173,94,0.3);
}

.toolbar-pill {
  border-radius: 10px;
  padding: 0.4rem 0.8rem;
}

/* Chat Editor Redesign */
.sm-chat-wrapper {
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.chat-bubble.user {
  background: var(--brand);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
}

.chat-bubble.assistant {
  background: var(--bg-soft);
  border-radius: 18px 18px 18px 4px;
  border: 1px solid var(--border);
}

html[data-theme="dark"] .chat-bubble.assistant {
  background: #111a14;
}

.chat-input-row {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem;
}

.chat-input {
  border-radius: 16px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  padding: 0.8rem 1.2rem;
}

.chat-input:focus {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

