/* ── Design tokens ──────────────────────────────────────────────────────────── */
:root {
  --wine:       #7B1D1D;
  --wine-deep:  #5F1414;
  --wine-soft:  #F4E8E8;
  --cream:      #F6F1E8;
  --cream-soft: #FAF6EC;
  --paper:      #FFFFFF;
  --ink:        #1F1A17;
  --ink-soft:   #3A302A;
  --muted:      #6B6058;
  --rule:       #E8DFD2;
}

/* ── Reset & base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-y: scroll; }

html, body {
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  overflow-x: hidden; /* safety net: no stray horizontal scroll on mobile */
}

button, input, textarea, select { font-family: inherit; }
a { text-decoration: none; }
button { cursor: pointer; }

/* ── Utility buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px;
  font-weight: 600; font-size: 14px;
  padding: 0.6rem 1.25rem;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
  cursor: pointer; white-space: nowrap;
}
.btn-wine {
  background: var(--wine); color: var(--paper);
}
.btn-wine:hover { background: var(--wine-deep); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--rule);
  color: var(--ink-soft);
}
.btn-outline:hover { border-color: var(--wine); color: var(--wine); }
.btn-ai {
  background: transparent;
  border: 1.5px solid var(--wine);
  color: var(--wine); font-weight: 700;
}
.btn-ai:hover:not(:disabled) { background: var(--wine-soft); }
.btn-ai:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-sm { font-size: 12px; padding: 0.3rem 0.75rem; }

/* ── Toast ──────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 2rem; right: 2rem;
  z-index: 9000; display: flex; flex-direction: column; gap: 0.75rem;
}
.toast {
  background: var(--wine); color: var(--paper);
  padding: 0.875rem 1.25rem; border-radius: 8px;
  box-shadow: 0 4px 20px rgba(123,29,29,0.3);
  display: flex; align-items: center; gap: 1rem;
  animation: slideIn 0.25s ease-out; min-width: 280px; max-width: 380px;
}
.toast.success { background: #2D6A4F; }
.toast.error   { background: #9B1C1C; }
.toast.info    { background: var(--wine); }
.toast-close {
  background: none; border: none; color: var(--paper);
  font-size: 20px; line-height: 1; margin-left: auto; cursor: pointer; opacity: 0.8;
}
.toast-close:hover { opacity: 1; }
@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Tags / role badges ─────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  background: var(--wine-soft); color: var(--wine);
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  padding: 0.2rem 0.6rem; border-radius: 20px;
}
.role-badge {
  display: inline-block;
  background: var(--wine-soft); color: var(--wine);
  font-size: 12px; font-weight: 700;
  padding: 0.2rem 0.65rem; border-radius: 20px;
}
.char-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }

/* ── Marketing header ───────────────────────────────────────────────────────── */
.mkt-header {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 500;
}
.mkt-header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 2.5rem;
  padding: 0.75rem 2rem;
}
.mkt-logo {
  display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0;
}
.mkt-logo-img { height: 88px; width: auto; display: block; }
.logo-text {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px; color: var(--ink); white-space: nowrap;
}
.logo-text em { font-style: normal; color: var(--wine); }
.mkt-nav { display: flex; align-items: center; gap: 2rem; }
.nav-link { color: var(--ink-soft); font-size: 15px; font-weight: 500; transition: color 0.15s; }
.nav-link:hover { color: var(--wine); }
.mkt-header-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.login-btn {
  background: none; border: none; color: var(--ink-soft);
  font-size: 15px; font-weight: 500; cursor: pointer; transition: color 0.15s;
}
.login-btn:hover { color: var(--wine); }
.cta-btn {
  background: var(--wine); color: var(--paper);
  border: none; padding: 0.6rem 1.25rem; border-radius: 24px;
  font-weight: 700; font-size: 14px; cursor: pointer; transition: background 0.18s;
}
.cta-btn:hover { background: var(--wine-deep); }

/* ── Product dropdown ───────────────────────────────────────────────────────── */
.dropdown-wrapper { position: relative; }
.dropdown-toggle {
  background: none; border: none; color: var(--ink-soft);
  font-size: 15px; font-weight: 500;
  display: flex; align-items: center; gap: 0.35rem;
  cursor: pointer; padding: 0.4rem 0;
  border-bottom: 2px solid transparent; transition: color 0.15s;
}
.dropdown-toggle:hover,
.dropdown-toggle.active { color: var(--wine); }
.dropdown-toggle.active { border-bottom-color: var(--wine); }
.dropdown-arrow { font-size: 10px; transition: transform 0.2s; display: inline-block; }
.dropdown-arrow.up { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute; top: calc(100% + 0.625rem); left: 0;
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 10px; box-shadow: 0 8px 30px rgba(31,26,23,0.13);
  min-width: 310px; overflow: hidden;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
  z-index: 600;
}
.dropdown-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
  padding: 0.875rem 1rem; border-bottom: 1px solid var(--rule);
  cursor: pointer; transition: background 0.12s;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--cream); }
.dropdown-item.highlighted { background: var(--wine-soft); }
.dropdown-item.highlighted:hover { background: #ead5d5; }
.dropdown-item-title { font-weight: 700; color: var(--wine); font-size: 14px; margin-bottom: 0.2rem; }
.dropdown-item-description { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  background: var(--cream); padding: 5rem 2rem;
  text-align: center; border-bottom: 1px solid var(--rule);
}
.hero-inner { max-width: 700px; margin: 0 auto; }
.hero h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 52px; font-weight: 700; line-height: 1.15;
  color: var(--ink); margin-bottom: 1.25rem;
}
.hero h1 em { font-style: italic; color: var(--wine); }
.hero p { font-size: 17px; color: var(--muted); line-height: 1.7; margin-bottom: 2rem; }
.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-cta {
  background: var(--wine); color: var(--paper);
  border: none; padding: 0.875rem 2rem; border-radius: 24px;
  font-weight: 700; font-size: 15px; cursor: pointer; transition: background 0.18s;
}
.hero-cta:hover { background: var(--wine-deep); }
.hero-secondary {
  background: transparent; border: 2px solid var(--rule);
  color: var(--ink-soft); padding: 0.875rem 2rem; border-radius: 24px;
  font-weight: 600; font-size: 15px; cursor: pointer; transition: border-color 0.18s, color 0.18s;
}
.hero-secondary:hover { border-color: var(--wine); color: var(--wine); }

/* ── Features section ───────────────────────────────────────────────────────── */
.features {
  background: var(--paper); padding: 5rem 2rem;
  border-bottom: 1px solid var(--rule);
}
.features-inner { max-width: 1100px; margin: 0 auto; }
.features-label {
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.75rem;
}
.features-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 34px; color: var(--ink); margin-bottom: 3rem;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
  gap: 1.5rem;
}
.feature-card {
  padding: 1.75rem; border: 1px solid var(--rule);
  border-radius: 10px; background: var(--cream-soft);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  cursor: pointer; user-select: none;
  display: flex; flex-direction: column;
}
.feature-card:hover { box-shadow: 0 4px 20px rgba(123,29,29,0.08); }
.feature-card:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }
.feature-card.active { background: var(--paper); border-color: var(--wine-soft); }
.feature-card.active:hover {
  border-color: var(--wine);
  box-shadow: 0 6px 24px rgba(123,29,29,0.12);
  transform: translateY(-1px);
}
.feature-card.stub { opacity: 0.78; }
.feature-card.stub:hover { opacity: 1; }
.feature-icon { font-size: 28px; margin-bottom: 0.875rem; }
.feature-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 19px; color: var(--ink); margin-bottom: 0.5rem;
}
.feature-desc { font-size: 14px; color: var(--muted); line-height: 1.6; flex: 1; }
.feature-cta {
  margin-top: 1rem;
  font-size: 13px; font-weight: 700; color: var(--wine);
  letter-spacing: 0.01em;
}
.feature-soon {
  margin-top: 1rem;
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase;
}

/* ── App shell header ───────────────────────────────────────────────────────── */
.shell-header {
  background: var(--paper); border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 500;
}
.shell-header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.75rem 2rem;
}
.shell-logo-btn {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 0.6rem; padding: 0;
}
.shell-logo-text {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 16px; color: var(--ink); white-space: nowrap;
}
.shell-logo-text em { font-style: normal; color: var(--wine); }
.shell-divider { width: 1px; height: 22px; background: var(--rule); flex-shrink: 0; }
.shell-crumb { font-size: 14px; color: var(--muted); }
.shell-back-btn {
  background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 13px; color: var(--muted); padding: 0.25rem 0.6rem;
  margin-left: 0.5rem;
  border-radius: 4px; transition: color 0.15s, background 0.15s;
}
.shell-back-btn:hover { color: var(--wine); background: rgba(0,0,0,0.04); }
.shell-back-arrow { font-size: 18px; line-height: 1; font-weight: 600; }
.shell-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.shell-email { font-size: 13px; color: var(--muted); }
.signout-btn {
  background: none; border: none; font-size: 13px; color: var(--muted);
  cursor: pointer; transition: color 0.15s;
}
.signout-btn:hover { color: var(--wine); }

/* ── Novels page ────────────────────────────────────────────────────────────── */
.novels-page { min-height: 100vh; background: var(--cream); }
.page-container { max-width: 1100px; margin: 0 auto; padding: 2.5rem 2rem; }
.page-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 2.5rem;
}
.page-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 30px; color: var(--ink);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--wine);
  display: inline-block;
}
.novels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 1.5rem;
}
.novel-card {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 10px; padding: 1.75rem;
  cursor: pointer; transition: box-shadow 0.2s, border-color 0.2s;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.novel-card:hover {
  box-shadow: 0 4px 20px rgba(123,29,29,0.1);
  border-color: var(--wine);
}
.novel-badge {
  display: inline-block;
  background: var(--wine-soft); color: var(--wine);
  font-size: 11px; font-weight: 700;
  padding: 0.2rem 0.65rem; border-radius: 20px;
  width: fit-content; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.novel-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px; color: var(--ink); margin-top: 0.25rem;
}
.novel-meta { font-size: 13px; color: var(--muted); display: flex; gap: 0.5rem; }
.novel-footer {
  margin-top: 1rem; padding-top: 1rem;
  border-top: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: space-between;
}
.novel-open-link { font-size: 13px; color: var(--wine); font-weight: 600; }
/* Premise-style card: uppercase eyebrow, serif title, muted logline. */
.novel-eyebrow {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
}
.novel-logline {
  font-size: 14px; color: var(--muted); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.novel-count { color: var(--muted); font-weight: 400; }

/* ── Empty state ────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 5rem 2rem; }
.empty-state-icon { font-size: 52px; margin-bottom: 1rem; }
.empty-state h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px; color: var(--ink); margin-bottom: 0.5rem;
}
.empty-state p { font-size: 15px; color: var(--muted); }

/* ── New Novel modal ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(31,26,23,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 800;
}
.modal-box {
  background: var(--paper); border-radius: 12px;
  padding: 2rem; width: 100%; max-width: 460px;
  box-shadow: 0 16px 48px rgba(31,26,23,0.2);
}
.modal-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 24px; color: var(--ink);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--wine);
  display: inline-block; margin-bottom: 1.5rem;
}
.modal-body { display: flex; flex-direction: column; gap: 1.25rem; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ── Characters page ────────────────────────────────────────────────────────── */
.chars-page { min-height: 100vh; background: var(--cream); }
.chars-sub-header {
  background: var(--paper); border-bottom: 1px solid var(--rule);
  padding: 0 2rem;
}
.chars-sub-inner { max-width: 1200px; margin: 0 auto; }
.chars-breadcrumb {
  display: flex; align-items: center; gap: 0.4rem;
  padding-top: 1rem;
}
.breadcrumb-link {
  background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--muted); transition: color 0.15s;
}
.breadcrumb-link:hover { color: var(--wine); }
.breadcrumb-sep { font-size: 13px; color: var(--rule); }
.breadcrumb-current { font-size: 13px; color: var(--ink-soft); }
.chars-title-row {
  display: flex; align-items: center;
  justify-content: space-between; padding: 0.875rem 0;
}
.chars-novel-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 26px; color: var(--ink);
}
.chars-tabs { display: flex; gap: 0; }
.chars-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 0.75rem 1.25rem; font-size: 14px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: color 0.15s;
  margin-bottom: -1px;
}
.chars-tab:hover { color: var(--ink-soft); }
.chars-tab.active { color: var(--wine); border-bottom-color: var(--wine); }
.chars-tab.stub { opacity: 0.55; }
.chars-tab.stub:hover { opacity: 0.75; }
/* Spells out the active tab's 🚫 marker, which otherwise only has a tooltip. */
.chars-tab-note {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1.25rem 0.6rem; font-size: 12.5px; color: var(--muted);
}

.chars-content { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.chars-toolbar { display: flex; align-items: center; gap: 0.875rem; margin-bottom: 1.5rem; }
.chars-search {
  flex: 1; padding: 0.6rem 1rem;
  border: 1.5px solid var(--rule); border-radius: 6px;
  font-size: 14px; background: var(--cream-soft);
  color: var(--ink); outline: none; transition: border-color 0.15s, background 0.15s;
}
.chars-search:focus { border-color: var(--wine); background: var(--paper); }
.view-toggle {
  display: flex; border: 1.5px solid var(--rule);
  border-radius: 6px; overflow: hidden;
}
.view-toggle-btn {
  padding: 0.45rem 0.75rem; background: none; border: none;
  color: var(--muted); font-size: 16px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.view-toggle-btn.active { background: var(--wine); color: var(--paper); }

/* Characters table */
.table-wrapper { overflow-x: auto; border-radius: 10px; border: 1px solid var(--rule); }
.chars-table { width: 100%; border-collapse: collapse; background: var(--paper); }
.chars-table th {
  text-align: left; padding: 0.875rem 1rem;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); background: var(--cream);
  border-bottom: 1px solid var(--rule);
}
.chars-table td {
  padding: 1rem; font-size: 14px; color: var(--ink-soft);
  border-bottom: 1px solid var(--rule); vertical-align: middle;
}
.chars-table tbody tr:last-child td { border-bottom: none; }
.chars-table tbody tr:nth-child(even) td { background: var(--cream-soft); }
.table-row { cursor: pointer; transition: background 0.12s; }
.table-row:hover td { background: var(--wine-soft) !important; }
.char-name-cell {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 16px; color: var(--ink); font-weight: 400;
}
.age-cell { color: var(--muted); }
.action-cell { text-align: right; white-space: nowrap; display: flex; align-items: center; gap: 0.75rem; justify-content: flex-end; }
.edit-link {
  background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--wine);
  transition: opacity 0.15s;
}
.edit-link:hover { opacity: 0.75; }

/* Characters grid */
.chars-grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 1.25rem;
}
.char-grid-card {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 10px; padding: 1.5rem;
  cursor: pointer; transition: box-shadow 0.2s, border-color 0.2s;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.char-grid-card:hover {
  box-shadow: 0 4px 20px rgba(123,29,29,0.1);
  border-color: var(--wine);
}
.char-grid-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px; color: var(--ink);
}
.char-grid-sub { display: flex; align-items: center; gap: 0.5rem; }
.char-grid-age { font-size: 13px; color: var(--muted); }
.char-grid-summary {
  font-size: 13px; color: var(--ink-soft); line-height: 1.55;
  flex: 1; margin-top: 0.25rem;
}
.char-grid-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.75rem; padding-top: 0.875rem;
  border-top: 1px solid var(--rule);
}
.grid-card-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ── Character editor ───────────────────────────────────────────────────────── */
.editor-page { min-height: 100vh; background: var(--cream); padding-bottom: 5rem; }

/* Sticky toolbar */
.editor-sticky-bar {
  position: sticky; top: 0; z-index: 400;
  background: var(--paper); border-bottom: 1px solid var(--rule);
  padding: 0 2rem;
}
.editor-bar-inner {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.875rem 0;
}
.editor-bar-title { min-width: 0; }
.editor-char-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 19px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.editor-novel-name { font-size: 12px; color: var(--muted); margin-top: 0.1rem; }
.editor-bar-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; margin-left: auto; }

/* AI spinner */
.ai-spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid var(--wine-soft); border-top-color: var(--wine);
  border-radius: 50%; animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Editor body */
.editor-body { max-width: 900px; margin: 0 auto; padding: 2rem; display: flex; flex-direction: column; gap: 1.5rem; }

/* ── Phase-based character editor (Concept B) ─────────────────────────────── */
.editor-body-phased {
  max-width: 1100px; margin: 0 auto; padding: 0;
  flex-direction: row; gap: 0; align-items: stretch;
  min-height: calc(100vh - 200px);
}
.phase-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--paper); border-right: 1px solid var(--rule);
  padding: 1.5rem 0.75rem 1rem;
  display: flex; flex-direction: column;
}
.phase-sidebar-header { padding: 0 0.75rem 1.25rem; border-bottom: 1px solid var(--rule); margin-bottom: 0.75rem; }
.phase-sidebar-name { font-family: 'Fraunces', Georgia, serif; font-size: 18px; color: var(--ink); line-height: 1.2; }
.phase-sidebar-role { font-size: 12px; color: var(--muted); margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.04em; }
.phase-nav { display: flex; flex-direction: column; gap: 0.125rem; flex: 1; }
.phase-nav-item {
  display: flex; align-items: center; gap: 0.625rem;
  text-align: left; background: transparent; border: 0;
  border-left: 2px solid transparent;
  padding: 0.625rem 0.875rem; cursor: pointer;
  color: var(--muted); font-size: 13px;
  border-radius: 0 4px 4px 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.phase-nav-item:hover { color: var(--ink); background: var(--cream-soft); }
.phase-nav-item.active {
  background: #f9f0f1;
  border-left-color: var(--wine);
  color: var(--wine);
  font-weight: 500;
}
.phase-nav-num { font-variant-numeric: tabular-nums; font-size: 12px; opacity: 0.7; flex-shrink: 0; }
.phase-nav-title { flex: 1; }
.phase-sidebar-footer { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.75rem 0 0; border-top: 1px solid var(--rule); margin-top: 0.5rem; }
.phase-nav-btn {
  background: transparent; border: 0; padding: 0.5rem 0.875rem;
  text-align: left; cursor: pointer;
  font-size: 12px; color: var(--muted);
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}
.phase-nav-btn:hover:not(:disabled) { color: var(--wine); background: var(--cream-soft); }
.phase-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.phase-panel { flex: 1; padding: 2rem 2.5rem; min-width: 0; }
.phase-panel-header { margin-bottom: 1.75rem; }
.phase-panel-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem; }
.phase-panel-title { font-family: 'Fraunces', Georgia, serif; font-size: 28px; color: var(--ink); margin: 0 0 0.5rem; font-weight: 500; line-height: 1.15; }
.phase-panel-subtitle { font-size: 14px; color: var(--muted); font-style: italic; }
.phase-panel-fields { display: flex; flex-direction: column; gap: 1.25rem; max-width: 720px; }
.phase-panel-actions {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 1.75rem 0 1rem; padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}
.btn-ai-seed { display: inline-flex; align-items: center; gap: 0.5rem; }
.phase-autosave { margin-left: auto; }
.autosave-text { font-size: 11px; font-weight: 700; color: var(--wine); }
.autosave-text.error { color: #9B1C1C; }

.phase-panel-footer {
  display: flex; justify-content: space-between; gap: 0.75rem;
  padding-top: 1.25rem; border-top: 1px solid var(--rule);
}

/* Research Lab import modal */
.research-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(31, 26, 23, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 8000; padding: 1.5rem;
}
.research-modal-card {
  background: var(--paper); border-radius: 10px;
  max-width: 560px; width: 100%; max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.research-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--rule);
}
.research-modal-title { font-family: 'Fraunces', Georgia, serif; font-size: 18px; color: var(--ink); }
.research-modal-close {
  background: transparent; border: 0; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--wine);
  width: 32px; height: 32px; border-radius: 6px;
}
.research-modal-close:hover { background: var(--wine-soft); }
.research-modal-body { padding: 1rem 1.25rem; overflow-y: auto; flex: 1; }
.research-modal-hint { font-size: 13px; color: var(--ink-soft); margin: 0 0 1rem; line-height: 1.5; }
.research-modal-note { color: var(--muted); font-size: 12px; }
.research-modal-empty { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: 14px; }
.research-modal-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.research-modal-item {
  border: 1px solid var(--rule); border-radius: 8px;
  transition: border-color 0.12s, background 0.12s;
}
.research-modal-item.selected { border-color: var(--wine); background: var(--wine-soft); }
.research-modal-item label {
  display: flex; gap: 0.75rem; padding: 0.75rem; cursor: pointer;
}
.research-modal-item input[type="checkbox"] { margin-top: 0.25rem; accent-color: var(--wine); }
.research-modal-item-body { flex: 1; min-width: 0; }
.research-modal-item-meta {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  font-size: 11px; color: var(--muted); margin-bottom: 0.375rem;
}
.research-modal-tool {
  background: var(--wine-soft); color: var(--wine);
  padding: 0.125rem 0.5rem; border-radius: 999px;
  font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
}
.research-modal-item-title { font-weight: 600; color: var(--ink-soft); }
.research-modal-date { margin-left: auto; }
.research-modal-snippet { font-size: 13px; color: var(--ink-soft); line-height: 1.45; white-space: pre-wrap; }
.research-modal-footer {
  display: flex; justify-content: flex-end; gap: 0.5rem;
  padding: 1rem 1.25rem; border-top: 1px solid var(--rule);
}
.btn-sm { padding: 0.4rem 0.875rem; font-size: 12px; }

/* Single-column on narrow viewports */
@media (max-width: 800px) {
  .editor-body-phased { flex-direction: column; }
  .phase-sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--rule); }
  .phase-panel { padding: 1.25rem; }
}

/* Section cards */
.section-card {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 10px; padding: 1.75rem;
}
.section-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 19px; color: var(--ink);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--wine);
  display: inline-block; margin-bottom: 1.5rem;
}
.section-body { display: flex; flex-direction: column; gap: 1.25rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.two-x-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 1.25rem;
}

/* Fields */
.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
}
.field-input {
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--rule); border-radius: 6px;
  font-size: 14px; color: var(--ink);
  background: var(--cream-soft); outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.field-input:focus { border-color: var(--wine); background: var(--paper); }
.field-textarea { resize: vertical; min-height: 80px; }
.field-textarea.tall { min-height: 110px; }

/* Per-field AI action row (Regenerate / Copy / Reset) - matches the
   Story Structure Builder's EditableField pattern. */
.field-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.field-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 12px; font-weight: 600;
  padding: 0.35rem 0.75rem; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink-soft); cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.field-btn:hover:not(:disabled) { border-color: var(--wine); color: var(--wine); }
.field-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.field-btn-regen { border-color: var(--wine); color: var(--wine); }
.field-btn-regen:hover:not(:disabled) { background: var(--wine-soft); }

/* Mannerisms rendered list */
.mannerisms-list { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.5rem; }
.mannerism-item {
  display: flex; align-items: baseline; gap: 0.5rem;
  font-size: 13px; color: var(--ink-soft);
  padding: 0.4rem 0.75rem;
  background: var(--cream-soft); border-radius: 4px;
  border: 1px solid var(--rule);
}
.mannerism-dash { color: var(--wine); flex-shrink: 0; }

/* Dialogue preview */
.dialogue-preview {
  background: var(--cream); border: 1px solid var(--rule);
  border-left: 3px solid var(--wine); border-radius: 6px;
  padding: 1rem 1.25rem; margin-top: 0.75rem;
}
.dialogue-preview-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.75rem;
}
.dialogue-preview-line {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic; font-size: 16px;
  color: var(--ink-soft); line-height: 1.65;
  margin-bottom: 0.5rem;
}
.dialogue-preview-line:last-child { margin-bottom: 0; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .two-col, .two-x-two { grid-template-columns: 1fr; }
  .editor-bar-actions { gap: 0.5rem; }
  .btn-ai { display: none; }
}
@media (max-width: 768px) {
  .mkt-nav { display: none; }
  .hero h1 { font-size: 38px; }
  .novels-grid, .chars-grid-view { grid-template-columns: 1fr; }
  .chars-toolbar { flex-wrap: wrap; }
  .chars-search { min-width: 100%; }
  .mkt-header-inner { gap: 1rem; padding: 0.75rem 1rem; }
  .mkt-logo-img { height: 56px; }
  .page-container { padding: 1.5rem 1rem; }
  .chars-content { padding: 1.5rem 1rem; }
  .editor-body { padding: 1.5rem 1rem; }
  .features-title { font-size: 26px; margin-bottom: 2rem; }
  /* iOS Safari auto-zooms when a focused input has font-size < 16px and then
     STAYS zoomed after navigating — which is why the page looked too large
     right after login (the 14px login fields triggered it). Keep all form
     controls >= 16px on touch viewports to prevent the zoom entirely. */
  input, textarea, select, .field-input, .field-textarea { font-size: 16px; }
}
@media (max-width: 400px) {
  .mkt-logo-img { height: 48px; }
}
@media (max-width: 480px) {
  .hero h1 { font-size: 28px; }
  .hero { padding: 3rem 1rem; }
  .features { padding: 3rem 1rem; }
  .shell-email { display: none; }
  .chars-tabs { overflow-x: auto; }
  .chars-tab { padding: 0.75rem 0.875rem; font-size: 13px; }
}

/* ── Mobile header menu ───────────────────────────────────────────────────────
   The desktop .mkt-nav is hidden at ≤768px; this hamburger + drop panel give
   phones a way to reach Research/Analysis/Resources/Pricing. Hidden at >768px. */
.mkt-menu-btn { display: none; }
.mkt-mobile-menu { display: none; }
@media (max-width: 768px) {
  .mkt-menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    font-size: 20px; line-height: 1; color: var(--ink);
    padding: 0.3rem 0.45rem; border-radius: 6px;
  }
  .mkt-menu-btn:hover { color: var(--wine); }
  .mkt-mobile-menu {
    display: flex; flex-direction: column;
    background: var(--paper); border-top: 1px solid var(--rule);
    padding: 0.5rem 1rem 1rem;
  }
  .mkt-mobile-group-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--muted);
    padding: 0.75rem 0 0.25rem;
  }
  .mkt-mobile-item {
    display: block; width: 100%; text-align: left;
    background: none; border: none; cursor: pointer;
    font-size: 15px; color: var(--ink); text-decoration: none;
    padding: 0.65rem 0.25rem; border-radius: 6px;
  }
  .mkt-mobile-item:hover { color: var(--wine); }
}

/* ── In-app sub-bar (back link + AI model picker + AI Settings) ───────────────── */
.page-subbar-row {
  max-width: 1200px; margin: 0 auto;
  padding: 0.625rem 2rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.page-subbar-spacer { flex: 1; }
@media (max-width: 768px) {
  .page-subbar-row { padding: 0.625rem 1rem; flex-wrap: wrap; }
  .page-subbar-spacer { display: none; }   /* pack items left so they wrap cleanly */
  .mp-label-text { display: none; }          /* drop "Choose AI Model:" to save width */
  .mp-select { max-width: 100%; }            /* model dropdown never overflows the row */
}

/* ── Delete button & inline confirmation ────────────────────────────────────── */
.btn-delete-text {
  background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 0; transition: color 0.15s;
}
.btn-delete-text:hover { color: #9B1C1C; }

.delete-confirm {
  display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap;
}
.delete-confirm-label { font-size: 12px; color: var(--muted); }
.btn-confirm-yes {
  background: #9B1C1C; color: var(--paper); border: none;
  padding: 0.2rem 0.55rem; border-radius: 4px;
  font-size: 12px; font-weight: 700; cursor: pointer; transition: background 0.15s;
}
.btn-confirm-yes:hover { background: #7F1D1D; }
.btn-confirm-no {
  background: none; border: 1.5px solid var(--rule); color: var(--muted);
  padding: 0.2rem 0.55rem; border-radius: 4px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: border-color 0.15s;
}
.btn-confirm-no:hover { border-color: var(--muted); }

/* ── Spinner ────────────────────────────────────────────────────────────────── */
.spinner-wrap { display: flex; justify-content: center; align-items: center; padding: 5rem 2rem; }
.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--rule);
  border-top-color: var(--wine);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Auth page ──────────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; background: var(--cream);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem;
}
.auth-box {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 14px; padding: 2.5rem;
  width: 100%; max-width: 420px;
  box-shadow: 0 8px 40px rgba(31,26,23,0.1);
}
/* Site-wide footer. Sits at the end of every page root (see SiteFooter in
   js/app.jsx). Deliberately quiet — it is a legal notice, not navigation. */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  flex-wrap: wrap;
}
/* Height is fixed in CSS as well as on the element so the footer does not jump
   when the image loads. */
.site-footer-mark {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.auth-logo { display: flex; justify-content: center; margin-bottom: 1rem; }

/* "Forgot password?" under the login form — a link, not a button, so it never
   competes with Sign in for attention. */
.auth-link-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  color: var(--wine);
  text-decoration: underline;
  cursor: pointer;
}
.auth-link-btn:hover { color: var(--wine-deep); }
.auth-link-btn:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }
.auth-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px; color: var(--ink); text-align: center;
  margin-bottom: 1.75rem;
}
.auth-title em { font-style: normal; color: var(--wine); }
.auth-tabs {
  display: flex; border: 1.5px solid var(--rule);
  border-radius: 8px; overflow: hidden; margin-bottom: 1.5rem;
}
.auth-tab {
  flex: 1; padding: 0.6rem; background: none; border: none;
  font-size: 14px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.auth-tab.active { background: var(--wine); color: var(--paper); }
.auth-error {
  background: #FEF2F2; border: 1px solid #FCA5A5;
  color: #991B1B; font-size: 13px; border-radius: 6px;
  padding: 0.65rem 0.875rem; margin-bottom: 1.25rem;
}
.auth-submit {
  width: 100%; margin-top: 1.5rem;
  background: var(--wine); color: var(--paper);
  border: none; border-radius: 8px;
  padding: 0.8rem; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: background 0.18s;
}
.auth-submit:hover:not(:disabled) { background: var(--wine-deep); }
.auth-submit:disabled { opacity: 0.65; cursor: not-allowed; }

/* ── Settings page ──────────────────────────────────────────────────────────── */
.settings-page { min-height: 100vh; background: var(--cream); }
.settings-body { display: flex; flex-direction: column; gap: 1.5rem; }

/* Settings tab strip. Scrolls sideways rather than wrapping on narrow screens,
   so the row never becomes two ragged lines. */
.settings-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.settings-tab {
  flex: 0 0 auto;
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;              /* sit the underline on the container rule */
  padding: 0.6rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.settings-tab:hover { color: var(--ink); }
.settings-tab.active { color: var(--wine); border-bottom-color: var(--wine); }
.settings-tab:focus-visible { outline: 2px solid var(--wine); outline-offset: -2px; }

/* Pending change-of-email notice: message plus a cancel action. */
.settings-pending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--wine);
  border-radius: 8px;
  background: var(--wine-soft);
  font-size: 14px;
  color: var(--ink);
}

/* Label/value rows on the Account tab. */
.settings-kv {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  font-size: 14px;
  border-bottom: 1px solid var(--rule);
}
.settings-kv:last-child { border-bottom: none; }
.settings-kv > span { color: var(--muted); }

.provider-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem; margin-top: 0.5rem;
}
.provider-card {
  border: 2px solid var(--rule); border-radius: 10px;
  padding: 1.25rem; cursor: pointer; transition: border-color 0.18s, background 0.18s;
  text-align: center;
}
.provider-card:hover { border-color: var(--wine); }
.provider-card.selected {
  border-color: var(--wine); background: var(--wine-soft);
}
.provider-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px; color: var(--ink); margin-bottom: 0.2rem;
}
.provider-company { font-size: 12px; color: var(--muted); }
.provider-status {
  font-size: 12px; font-weight: 700; color: var(--wine);
  margin-top: 0.5rem;
}
.field-hint { font-size: 12px; color: var(--muted); margin-top: 0.3rem; }
.link-wine { color: var(--wine); text-decoration: underline; }
.link-wine:hover { color: var(--wine-deep); }

/* ── Connect CTA + connection status ────────────────────────────────────────── */
.connect-cta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.25rem;
  background: var(--cream-soft); border: 1px solid var(--rule);
  border-left: 3px solid var(--wine); border-radius: 8px;
  margin-bottom: 0.5rem;
}
.connect-cta-text { font-size: 14px; color: var(--ink-soft); flex: 1; }
.connect-cta-text strong { color: var(--wine); font-weight: 700; }
.connect-btn { white-space: nowrap; flex-shrink: 0; text-decoration: none; }

.connection-status {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 13px; font-weight: 600;
  padding: 0.5rem 0.875rem; border-radius: 6px;
  margin-bottom: 0.25rem; width: fit-content;
}
.connection-status.connected {
  background: #DCFCE7; color: #14532D; border: 1px solid #86EFAC;
}
.connection-status.testing {
  background: var(--cream); color: var(--ink-soft); border: 1px solid var(--rule);
}
.connection-status.error {
  background: #FEF2F2; color: #991B1B; border: 1px solid #FCA5A5;
}

@media (max-width: 600px) {
  .connect-cta { flex-direction: column; align-items: stretch; text-align: center; }
}

/* ── Tooltip ────────────────────────────────────────────────────────────────── */
.tooltip-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--wine-soft); color: var(--wine);
  font-size: 10px; font-weight: 800; cursor: default;
  margin-left: 0.4rem; position: relative;
  border: 1px solid var(--wine);
  vertical-align: middle;
}
.tooltip-trigger .tooltip-box {
  display: none;
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  font-size: 12px; font-weight: 400; line-height: 1.5;
  padding: 0.6rem 0.875rem; border-radius: 7px;
  width: 240px; text-align: left; white-space: normal;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 1000;
  text-transform: none; letter-spacing: 0;
}
.tooltip-trigger .tooltip-box::after {
  content: '';
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink);
}
.tooltip-trigger:hover .tooltip-box { display: block; }

/* ── 2FA method options ─────────────────────────────────────────────────────── */
.twofa-options {
  display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.375rem;
}
.twofa-option {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--rule); border-radius: 7px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
  font-size: 14px; color: var(--ink-soft);
}
.twofa-option:hover { border-color: var(--wine); }
.twofa-option.selected { border-color: var(--wine); background: var(--wine-soft); color: var(--wine); font-weight: 600; }
.twofa-option input[type="radio"] { accent-color: var(--wine); width: 15px; height: 15px; flex-shrink: 0; }
.twofa-sms-note {
  font-size: 12px; color: var(--muted); margin-top: 0.5rem;
  padding: 0.5rem 0.75rem; background: var(--cream-soft);
  border-radius: 5px; border: 1px solid var(--rule);
}
.twofa-sms-note code { font-family: monospace; font-size: 11px; }

/* ── 2FA verify step ────────────────────────────────────────────────────────── */
.verify-icon { font-size: 36px; text-align: center; margin-bottom: 0.5rem; }
.verify-hint {
  font-size: 14px; color: var(--muted); text-align: center;
  margin-bottom: 0.5rem; line-height: 1.5;
}
.verify-hint strong { color: var(--ink); }
.code-input {
  font-size: 28px !important; font-family: 'Fraunces', Georgia, serif !important;
  text-align: center; letter-spacing: 0.4em;
  padding: 0.75rem 1rem !important;
}
.auth-resend {
  text-align: center; font-size: 13px; color: var(--muted); margin-top: 1rem;
}
.link-btn {
  background: none; border: none; color: var(--wine);
  font-size: inherit; font-weight: 600; cursor: pointer;
  text-decoration: underline; padding: 0;
}
.link-btn:hover { color: var(--wine-deep); }
.link-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Shell settings button ──────────────────────────────────────────────────── */
.shell-settings-btn {
  background: none; border: 1.5px solid var(--wine);
  color: var(--wine); border-radius: 6px;
  font-size: 12px; font-weight: 700; padding: 0.3rem 0.75rem;
  cursor: pointer; transition: background 0.15s;
}
.shell-settings-btn:hover { background: var(--wine-soft); }

@media (max-width: 600px) {
  .provider-grid { grid-template-columns: 1fr; }
}

/* ── Pricing page ────────────────────────────────────────────────────────────── */
.pricing-intro {
  background: var(--cream-soft); padding: 5rem 2rem;
  border-bottom: 1px solid var(--rule);
}
.pricing-intro-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center;
}
.pricing-intro-heading {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 34px; color: var(--ink); line-height: 1.2; margin-bottom: 1rem;
}
.pricing-intro-body { font-size: 16px; color: var(--muted); line-height: 1.7; }
.pricing-intro-img {
  background: var(--rule); border-radius: 16px;
  min-height: 340px; overflow: hidden;
}
.pricing-intro-img img {
  width: 100%; border-radius: 16px;
  box-shadow: 0 16px 48px rgba(31,26,23,0.16); display: block;
}
.pricing-section { background: var(--cream); padding: 5rem 2rem; }
.pricing-section-inner { max-width: 1100px; margin: 0 auto; }
.pricing-section-heading {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 40px; color: var(--ink); margin-bottom: 0.5rem;
}
.pricing-section-sub { font-size: 16px; color: var(--muted); margin-bottom: 3rem; }
.pricing-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem; align-items: start;
}
.pricing-card {
  background: var(--paper); border: 1.5px solid var(--rule);
  border-radius: 16px; padding: 2rem; position: relative;
}
.pricing-card--featured {
  border-color: var(--wine); border-width: 2px;
  box-shadow: 0 8px 40px rgba(123,29,29,0.13);
}
.pricing-card--dim { opacity: 0.72; }
.pricing-popular {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: var(--wine); color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em;
  padding: 0.3rem 1rem; border-radius: 20px; white-space: nowrap;
}
.pricing-badge-row { height: 18px; margin-bottom: 0.35rem; }
.pricing-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  padding: 0.25rem 0.6rem; border-radius: 6px;
}
.pricing-badge--trial { background: var(--wine-soft); color: var(--wine); }
.pricing-badge--soon { background: #f0ede8; color: var(--muted); }
.pricing-tier {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 26px; font-weight: 700; color: var(--ink); margin-bottom: 0.4rem;
}
.pricing-amount-row { display: flex; align-items: baseline; gap: 2px; margin-bottom: 0.1rem; }
.pricing-amount {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 52px; font-weight: 800; line-height: 1; color: var(--wine);
}
.pricing-amount--lg { font-size: 60px; }
.pricing-per { font-size: 15px; color: var(--muted); margin-left: 3px; }
.pricing-note { font-size: 13px; color: var(--muted); margin-bottom: 0.75rem; }
.pricing-hr { border: none; border-top: 1px solid var(--rule); margin: 1rem 0; }
.pricing-feats {
  list-style: none; margin: 0 0 1.75rem;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.pricing-feats li {
  font-size: 14px; color: var(--ink-soft);
  display: flex; align-items: flex-start; gap: 0.5rem;
}
.pricing-feats li::before {
  content: '✓'; color: var(--wine); font-weight: 700;
  font-size: 13px; flex-shrink: 0; margin-top: 1px;
}
.pricing-btn {
  width: 100%; padding: 0.85rem; border-radius: 8px;
  font-size: 15px; font-weight: 700;
  border: none; cursor: pointer; transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.pricing-btn--wine { background: var(--wine); color: #fff; }
.pricing-btn--wine:hover { background: var(--wine-deep); }
.pricing-btn--outline {
  background: transparent; color: var(--ink-soft); border: 2px solid var(--rule);
}
.pricing-btn--outline:hover:not(:disabled) { border-color: var(--wine); color: var(--wine); }
.pricing-btn--outline:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Pricing feature strip ───────────────────────────────────────────────────── */
.pricing-strip { background: var(--paper); padding: 5rem 2rem; border-top: 1px solid var(--rule); }
.pricing-strip-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center;
}
.pricing-strip-img {
  background: var(--rule); border-radius: 16px;
  min-height: 380px; overflow: hidden;
}
.pricing-strip-img img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 16px; box-shadow: 0 16px 48px rgba(31,26,23,0.16);
}
.pricing-strip-heading {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 40px; color: var(--ink); line-height: 1.15; margin-bottom: 1rem;
}
.pricing-strip-heading em { font-style: italic; color: var(--wine); }
.pricing-strip-text p { font-size: 16px; color: var(--muted); line-height: 1.7; }

@media (max-width: 960px) {
  .pricing-intro-inner, .pricing-strip-inner { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 420px; }
  .pricing-section-heading, .pricing-strip-heading { font-size: 30px; }
  .pricing-intro-heading { font-size: 26px; }
}

/* ── Logged-out lock ────────────────────────────────────────────────────────────
   Applied to in-app page bodies (PageShell <main> and .storylab-root) when no
   user is signed in. pointer-events:none on the container blocks every click,
   tap, drag, and key-activation inside it - buttons, links, cards, inputs - so
   no action can fire. The header/breadcrumb sit outside the locked container and
   stay interactive so the visitor can still log in and navigate. Interactive
   controls are dimmed so the read-only state reads clearly. */
.loggedout-lock { pointer-events: none; user-select: none; }
.loggedout-lock button,
.loggedout-lock a,
.loggedout-lock input,
.loggedout-lock select,
.loggedout-lock textarea,
.loggedout-lock [role="button"],
.loggedout-lock .novel-card {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Accessibility ──────────────────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }

/* ── Print ──────────────────────────────────────────────────────────────────── */
@media print {
  .mkt-header, .shell-header, .editor-sticky-bar { position: static; }
  .dropdown-menu, .toast-container { display: none; }
}
