:root {
  color-scheme: dark;
  --ink: #071521;
  --ink-soft: #102535;
  --ink-raised: #173344;
  --parchment: #f1dfb8;
  --parchment-light: #fff4d7;
  --cream: #f7ecd1;
  --brass: #c69a48;
  --brass-light: #e1bd73;
  --oxblood: #792c25;
  --oxblood-light: #a94832;
  --pine: #254d40;
  --pine-light: #39705e;
  --charcoal: #261f1a;
  --warm-gray: #a99d8b;
  --line: rgba(198, 154, 72, 0.42);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  font-family: Avenir Next, Avenir, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--ink);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--cream);
  background:
    linear-gradient(rgba(7, 21, 33, 0.94), rgba(7, 21, 33, 0.98)),
    url("/images/period-ancient.webp") center / cover fixed;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea,
a {
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

a {
  color: var(--brass-light);
}

:focus-visible {
  outline: 3px solid #ffda8b;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 1000;
  padding: 12px 16px;
  color: var(--ink);
  background: var(--parchment-light);
  border-radius: 4px;
}

.skip-link:focus {
  top: 16px;
}

.loading-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--parchment);
}

.loading-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border: 2px solid var(--line);
  border-top-color: var(--brass-light);
  border-radius: 50%;
  animation: turn 1s linear infinite;
}

@keyframes turn {
  to { transform: rotate(360deg); }
}

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  overflow: auto;
  background: #06131e;
}

.onboarding-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 55%;
  filter: brightness(0.72) saturate(0.9);
}

.onboarding::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 11, 18, 0.2), rgba(4, 11, 18, 0.35) 48%, rgba(4, 11, 18, 0.88));
}

.onboarding-content {
  position: relative;
  z-index: 1;
  width: min(92%, 570px);
  padding: 56px 28px 44px;
  text-align: center;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.84);
}

.onboarding-logo {
  width: 88px;
  height: 88px;
  margin-bottom: 24px;
  border: 1px solid var(--brass);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.display-title,
.section-title,
.story-title,
.figure-title,
h1,
h2,
h3 {
  margin-top: 0;
  font-family: Iowan Old Style, Palatino Linotype, Palatino, Georgia, serif;
  font-weight: 600;
  letter-spacing: 0;
}

.display-title {
  margin-bottom: 18px;
  color: var(--parchment-light);
  font-size: 4.8rem;
  line-height: 0.98;
}

.onboarding-slogan {
  max-width: 420px;
  margin: 0 auto 38px;
  color: var(--parchment);
  font-family: Iowan Old Style, Palatino, Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.5;
}

.primary-button,
.secondary-button,
.danger-button,
.quiet-button,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.primary-button {
  padding: 12px 20px;
  border: 1px solid #f0c777;
  color: #1e160c;
  background: var(--brass-light);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.26);
  font-weight: 700;
}

.primary-button:hover:not(:disabled) {
  background: #f0cf8f;
  transform: translateY(-1px);
}

.secondary-button,
.quiet-button {
  padding: 11px 16px;
  border: 1px solid var(--line);
  color: var(--cream);
  background: rgba(16, 37, 53, 0.82);
}

.secondary-button:hover:not(:disabled),
.quiet-button:hover:not(:disabled) {
  border-color: var(--brass-light);
  background: var(--ink-raised);
}

.quiet-button {
  background: transparent;
}

.danger-button {
  padding: 11px 16px;
  border: 1px solid #c7655c;
  color: #ffe9e4;
  background: #66251f;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  min-width: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--brass-light);
  background: rgba(7, 21, 33, 0.72);
  font-size: 1.15rem;
}

.app-shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  padding: 24px 14px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(5, 16, 25, 0.94);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: flex;
  min-width: 0;
  margin: 0 6px 34px;
  align-items: center;
  gap: 12px;
}

.brand-lockup img {
  width: 42px;
  height: 42px;
  border: 1px solid var(--brass);
  border-radius: 8px;
}

.brand-name {
  color: var(--parchment-light);
  font-family: Iowan Old Style, Palatino, Georgia, serif;
  font-size: 1rem;
  line-height: 1.1;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  min-height: 46px;
  padding: 10px 12px;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #c9c2b5;
  background: transparent;
  text-align: left;
}

.nav-button:hover:not(:disabled) {
  color: var(--cream);
  background: rgba(198, 154, 72, 0.08);
}

.nav-button.active {
  border-color: var(--line);
  color: var(--brass-light);
  background: rgba(198, 154, 72, 0.13);
}

.nav-glyph {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: currentColor;
  font-size: 1.08rem;
}

.side-footer {
  margin-top: auto;
  padding: 14px 10px 4px;
  color: var(--warm-gray);
  font-size: 0.78rem;
  line-height: 1.45;
}

.app-column {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 48px);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(198, 154, 72, 0.22);
  background: rgba(7, 21, 33, 0.9);
  backdrop-filter: blur(18px);
}

.topbar-title {
  margin: 0;
  color: var(--parchment-light);
  font-size: 1.4rem;
}

.topbar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.profile-select {
  width: min(230px, 38vw);
  min-height: 44px;
  padding: 8px 34px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: var(--ink-soft);
}

.main-content {
  width: min(100%, 1320px);
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 32px clamp(18px, 4vw, 52px) 80px;
}

.view-heading {
  display: flex;
  margin-bottom: 24px;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.view-heading h1 {
  margin-bottom: 6px;
  color: var(--parchment-light);
  font-size: 3.2rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brass-light);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.muted {
  color: var(--warm-gray);
}

.section-band {
  margin: 0 0 36px;
}

.section-header {
  display: flex;
  margin-bottom: 14px;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.section-header h2 {
  margin: 0;
  color: var(--parchment-light);
  font-size: 1.45rem;
}

.text-action {
  min-height: 40px;
  padding: 7px 2px;
  border: 0;
  color: var(--brass-light);
  background: transparent;
  font-weight: 700;
}

.feature-band {
  position: relative;
  display: grid;
  min-height: 390px;
  margin-bottom: 36px;
  overflow: hidden;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--charcoal);
  box-shadow: var(--shadow);
}

.feature-image {
  width: 100%;
  height: clamp(390px, 38vw, 460px);
  min-height: 390px;
  object-fit: cover;
  object-position: center 42%;
}

.feature-copy {
  display: flex;
  padding: clamp(26px, 5vw, 52px);
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(rgba(7, 21, 33, 0.94), rgba(17, 37, 49, 0.98)),
    url("/images/parchment.webp") center / cover;
}

.feature-copy h1,
.feature-copy h2 {
  margin-bottom: 8px;
  color: var(--parchment-light);
  font-size: 3.55rem;
  line-height: 1.03;
}

.feature-subtitle {
  margin: 0 0 18px;
  color: var(--brass-light);
  font-family: Iowan Old Style, Palatino, Georgia, serif;
  font-size: 1.18rem;
}

.feature-description {
  max-width: 54ch;
  margin: 0 0 22px;
  color: #ddd3c1;
  line-height: 1.65;
}

.feature-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.focus-grid {
  display: grid;
  margin-top: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.focus-button {
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--parchment);
  background: rgba(37, 77, 64, 0.48);
  text-align: left;
}

.horizontal-grid {
  display: grid;
  grid-auto-columns: minmax(190px, 1fr);
  grid-auto-flow: column;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 14px;
  scroll-snap-type: x proximity;
}

.story-grid,
.figure-grid,
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.period-card,
.collection-card,
.story-card,
.figure-card,
.result-card,
.journey-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: var(--ink-soft);
  text-align: left;
}

button.period-card,
button.collection-card,
button.story-card,
button.figure-card,
button.result-card,
button.journey-card {
  padding: 0;
}

.period-card {
  min-height: 246px;
  scroll-snap-align: start;
}

.period-card img,
.collection-card img,
.story-card img,
.figure-card img {
  width: 100%;
  object-fit: cover;
  transition: transform 220ms ease;
}

.period-card img {
  height: 246px;
}

.period-card::after,
.collection-card::after {
  content: "";
  position: absolute;
  inset: 35% 0 0;
  background: linear-gradient(transparent, rgba(5, 14, 22, 0.96));
}

.period-card-copy,
.collection-card-copy {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 16px;
}

.period-card strong,
.collection-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--parchment-light);
  font-family: Iowan Old Style, Palatino, Georgia, serif;
  font-size: 1.17rem;
}

.period-card span,
.collection-card span {
  color: #c8bda9;
  font-size: 0.82rem;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.collection-card {
  min-height: 220px;
}

.collection-card img {
  height: 220px;
}

.period-card:hover img,
.collection-card:hover img,
.story-card:hover img,
.figure-card:hover img {
  transform: scale(1.025);
}

.story-card,
.figure-card,
.result-card,
.journey-card {
  min-height: 100%;
}

.story-card img,
.figure-card img {
  height: 180px;
  background: var(--charcoal);
}

.card-copy {
  padding: 16px;
}

.card-copy h3 {
  margin: 0 0 7px;
  color: var(--parchment-light);
  font-size: 1.22rem;
  line-height: 1.2;
}

.card-copy p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #c9c0b0;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.metadata-row,
.badge-row {
  display: flex;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  min-height: 27px;
  padding: 4px 8px;
  align-items: center;
  border: 1px solid rgba(198, 154, 72, 0.34);
  border-radius: 999px;
  color: #dfc99d;
  background: rgba(198, 154, 72, 0.09);
  font-size: 0.72rem;
  font-weight: 700;
}

.badge.trust {
  border-color: rgba(71, 139, 116, 0.7);
  color: #a9d5c6;
  background: rgba(37, 77, 64, 0.45);
}

.badge.warning {
  border-color: rgba(188, 89, 66, 0.7);
  color: #ffd1c7;
  background: rgba(121, 44, 37, 0.5);
}

.empty-state,
.notice,
.account-panel,
.form-surface,
.search-surface,
.trust-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 37, 53, 0.88);
}

.empty-state,
.notice,
.trust-band {
  padding: 22px;
}

.notice.success {
  border-color: rgba(71, 139, 116, 0.75);
  background: rgba(37, 77, 64, 0.54);
}

.notice.warning {
  border-color: rgba(188, 89, 66, 0.72);
  background: rgba(121, 44, 37, 0.43);
}

.chat-promo {
  display: grid;
  padding: 28px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border: 1px solid rgba(74, 128, 109, 0.8);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(17, 45, 38, 0.95), rgba(7, 21, 33, 0.96)),
    url("/images/collection-hidden-heroes.webp") center / cover;
}

.chat-promo h2 {
  margin-bottom: 6px;
  color: var(--parchment-light);
}

.chat-promo p {
  margin: 0;
  color: #cbd8d1;
}

.form-surface,
.account-panel,
.search-surface {
  padding: clamp(20px, 4vw, 34px);
}

.account-status-panel {
  margin-top: 18px;
}

.guided-form,
.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.field.full,
.form-actions,
.settings-section {
  grid-column: 1 / -1;
}

.field label,
.field legend {
  color: #e3d8c4;
  font-weight: 700;
}

.field small {
  color: var(--warm-gray);
  line-height: 1.4;
}

.field input,
.field select,
.field textarea,
.search-box {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid rgba(198, 154, 72, 0.46);
  border-radius: 8px;
  color: var(--cream);
  background: rgba(5, 16, 25, 0.78);
}

.field textarea {
  min-height: 108px;
  resize: vertical;
}

.toggle-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.toggle-row {
  display: grid;
  min-height: 58px;
  padding: 10px 12px;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border: 1px solid rgba(198, 154, 72, 0.25);
  border-radius: 8px;
  background: rgba(7, 21, 33, 0.46);
}

.toggle-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--pine-light);
}

.toggle-row strong {
  display: block;
  margin-bottom: 2px;
}

.toggle-row small {
  color: var(--warm-gray);
}

.search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 10px;
}

.search-summary {
  margin: 18px 0 12px;
  color: var(--warm-gray);
}

.draft-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.version-sheet,
.story-sheet {
  min-width: 0;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid #d4b474;
  border-radius: 8px;
  color: #2b2117;
  background:
    linear-gradient(rgba(255, 247, 221, 0.88), rgba(240, 220, 179, 0.92)),
    url("/images/parchment.webp") center / cover;
  box-shadow: var(--shadow);
}

.version-sheet h2,
.version-sheet h3,
.story-sheet h1,
.story-sheet h2,
.story-sheet h3 {
  color: #3d2514;
}

.version-body,
.story-body {
  white-space: pre-wrap;
  font-family: Iowan Old Style, Palatino, Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.75;
}

.version-footer {
  padding-top: 18px;
  border-top: 1px solid rgba(80, 48, 22, 0.28);
}

.source-list,
.discussion-list,
.truth-list {
  padding-left: 22px;
  line-height: 1.6;
}

.source-list a {
  color: #693c18;
  font-weight: 700;
}

.reader-toolbar {
  position: sticky;
  top: 88px;
  z-index: 20;
  display: flex;
  margin-bottom: 14px;
  padding: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 21, 33, 0.94);
  backdrop-filter: blur(12px);
}

.figure-hero {
  position: relative;
  display: grid;
  min-height: 430px;
  margin-bottom: 22px;
  overflow: hidden;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.22fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--charcoal);
}

.figure-portrait {
  width: 100%;
  height: clamp(430px, 38vw, 520px);
  min-height: 430px;
  object-fit: cover;
  object-position: center 34%;
  background: var(--ink-raised);
}

.figure-hero-copy {
  display: flex;
  padding: clamp(24px, 5vw, 50px);
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(135deg, rgba(7, 21, 33, 0.98), rgba(37, 77, 64, 0.9));
}

.figure-title {
  margin-bottom: 7px;
  color: var(--parchment-light);
  font-size: 4rem;
  line-height: 1;
}

.figure-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
}

.conversation-surface {
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(7, 21, 33, 0.86), rgba(7, 21, 33, 0.94)),
    url("/images/collection-faith.webp") center / cover;
}

.conversation-header {
  display: flex;
  padding: 18px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(198, 154, 72, 0.28);
}

.conversation-header img,
.message-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  object-fit: cover;
  border: 1px solid var(--brass);
  border-radius: 50%;
  background: var(--ink-raised);
}

.message-list {
  display: grid;
  min-height: 350px;
  max-height: 58vh;
  padding: 20px;
  align-content: start;
  gap: 16px;
  overflow-y: auto;
}

.message-row {
  display: flex;
  max-width: 82%;
  align-items: end;
  gap: 8px;
}

.message-row.user {
  margin-left: auto;
  justify-content: flex-end;
}

.message-bubble {
  padding: 12px 14px;
  border: 1px solid rgba(198, 154, 72, 0.4);
  border-radius: 8px;
  color: #2a2015;
  background: var(--parchment-light);
  line-height: 1.5;
}

.message-row.user .message-bubble {
  color: #fff1d0;
  background: var(--oxblood);
}

.historian-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(82, 54, 29, 0.26);
  color: #593d27;
  font-size: 0.86rem;
}

.conversation-compose {
  display: grid;
  padding: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border-top: 1px solid rgba(198, 154, 72, 0.28);
}

.conversation-compose input {
  min-width: 0;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: rgba(5, 16, 25, 0.9);
}

.suggested-questions {
  display: flex;
  padding: 0 14px 14px;
  gap: 8px;
  overflow-x: auto;
}

.suggested-questions button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brass-light);
  background: rgba(7, 21, 33, 0.82);
}

.figure-aside {
  display: grid;
  align-content: start;
  gap: 14px;
}

.source-panel,
.scope-panel,
.credit-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 37, 53, 0.9);
}

.source-panel h2,
.scope-panel h2,
.credit-panel h2 {
  margin-bottom: 9px;
  color: var(--parchment-light);
  font-size: 1.16rem;
}

.source-panel ul,
.scope-panel ul {
  margin: 0;
  padding-left: 20px;
  color: #c8c0b1;
  line-height: 1.55;
}

.credit-numbers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.credit-number {
  padding: 12px;
  border: 1px solid rgba(198, 154, 72, 0.24);
  border-radius: 8px;
  background: rgba(7, 21, 33, 0.5);
}

.credit-number strong {
  display: block;
  color: var(--brass-light);
  font-size: 1.45rem;
}

.journey-list {
  display: grid;
  gap: 10px;
}

.journey-card {
  display: grid;
  padding: 16px;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.journey-progress {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 2px solid var(--pine-light);
  border-radius: 50%;
  color: #bce2d4;
  font-size: 0.78rem;
  font-weight: 800;
}

.settings-section {
  padding-top: 10px;
  border-top: 1px solid rgba(198, 154, 72, 0.24);
}

.apple-signin-wrap {
  min-height: 48px;
  margin-top: 14px;
}

#appleid-signin {
  width: 260px;
  max-width: 100%;
  height: 48px;
}

.paused-lock {
  display: grid;
  min-height: calc(100vh - 180px);
  place-items: center;
}

.paused-lock .account-panel {
  width: min(100%, 650px);
  text-align: center;
}

.paused-lock h1 {
  color: var(--parchment-light);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  width: min(420px, calc(100% - 40px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: #102535;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: #ba5e53;
  background: #55241f;
}

.mobile-nav {
  display: none;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .side-nav {
    display: none;
  }

  .main-content {
    padding-bottom: 110px;
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    display: grid;
    min-height: 74px;
    padding: 7px max(7px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    background: rgba(5, 16, 25, 0.96);
    backdrop-filter: blur(18px);
  }

  .mobile-nav .nav-button {
    display: flex;
    min-width: 0;
    min-height: 56px;
    padding: 5px 3px;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    font-size: 0.7rem;
    text-align: center;
  }

  .feature-band,
  .figure-hero {
    grid-template-columns: 1fr;
  }

  .feature-image,
  .figure-portrait {
    min-height: 330px;
    max-height: 480px;
  }

  .story-grid,
  .figure-grid,
  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .figure-layout {
    grid-template-columns: 1fr;
  }

  .figure-aside {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .display-title {
    font-size: 2.65rem;
  }

  .topbar {
    min-height: 64px;
    padding: 9px 14px;
  }

  .topbar-title {
    font-size: 1.08rem;
  }

  .topbar-actions {
    max-width: 58%;
  }

  .profile-select {
    width: 100%;
    max-width: 170px;
  }

  .main-content {
    padding: 24px 14px 104px;
  }

  .view-heading {
    display: block;
  }

  .view-heading h1 {
    font-size: 2rem;
  }

  .view-heading .button-row {
    margin-top: 14px;
  }

  .feature-band {
    min-height: 0;
  }

  .feature-image {
    height: 220px;
    min-height: 220px;
    max-height: 220px;
  }

  .feature-copy {
    padding: 18px 20px;
  }

  .feature-copy h1,
  .feature-copy h2 {
    font-size: 2rem;
  }

  .feature-subtitle {
    margin-bottom: 10px;
  }

  .feature-description {
    margin-bottom: 14px;
    line-height: 1.5;
  }

  .figure-title {
    font-size: 2.25rem;
  }

  .focus-grid,
  .story-grid,
  .figure-grid,
  .result-grid,
  .collection-grid,
  .guided-form,
  .settings-form,
  .toggle-list,
  .draft-comparison,
  .search-controls,
  .figure-aside {
    grid-template-columns: 1fr;
  }

  .horizontal-grid {
    grid-auto-columns: minmax(168px, 72vw);
  }

  .chat-promo {
    grid-template-columns: 1fr;
  }

  .reader-toolbar {
    top: 74px;
  }

  .message-row {
    max-width: 92%;
  }

  .message-list {
    padding: 14px 10px;
  }

  .conversation-compose {
    grid-template-columns: minmax(0, 1fr) 48px;
    padding: 10px;
  }

  .journey-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .journey-card > :last-child {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(245, 210, 139, 0.88);
    --warm-gray: #d5ccbd;
  }

  .muted,
  .card-copy p,
  .field small {
    color: #e6decf;
  }
}
