:root {
  --bg: #f4ead9;
  --bg-deep: #d8c3a1;
  --panel: rgba(42, 28, 14, 0.88);
  --panel-soft: rgba(255, 248, 237, 0.76);
  --text: #20150d;
  --text-inverse: #f8f1e7;
  --accent: #c58f2d;
  --accent-strong: #8f5a08;
  --border: rgba(59, 41, 21, 0.18);
  --shadow: 0 24px 80px rgba(55, 32, 9, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 227, 165, 0.8), transparent 34%),
    radial-gradient(circle at top right, rgba(125, 75, 21, 0.18), transparent 26%),
    linear-gradient(145deg, #f7f0e2 0%, var(--bg) 48%, var(--bg-deep) 100%);
}

.page-shell {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

.auth-area {
  position: absolute;
  top: 10px;
  right: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.auth-user {
  max-width: min(42vw, 280px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 700;
  color: rgba(32, 21, 13, 0.76);
}

.auth-btn {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 66, 28, 0.18);
  background: rgba(255, 252, 246, 0.95);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(74, 52, 31, 0.08);
}

.auth-btn:hover,
.auth-btn:focus-visible {
  background: rgba(248, 239, 221, 0.98);
}

.auth-dialog {
  width: min(92vw, 460px);
  padding: 1.5rem 1.25rem 1.25rem;
  border: none;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(242, 228, 202, 0.94));
  box-shadow: 0 28px 90px rgba(34, 21, 8, 0.28);
}

.auth-dialog::backdrop {
  background: rgba(27, 17, 8, 0.42);
  backdrop-filter: blur(4px);
}

.auth-dialog-close-form {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.auth-dialog-close {
  border: none;
  background: transparent;
  color: rgba(32, 21, 13, 0.72);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

#auth-dialog-slot {
  min-height: 240px;
}

.hero {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy,
.hero-card,
.panel {
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 32px;
  background: linear-gradient(145deg, rgba(255, 251, 243, 0.9), rgba(242, 225, 196, 0.82));
}

.eyebrow,
.section-kicker,
.hero-card-label {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.hero-copy h1,
.section-heading h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  line-height: 0.94;
}

.hero-copy h1 {
  font-size: clamp(3.5rem, 7vw, 6rem);
  max-width: 10ch;
}

.hero-text {
  max-width: 62ch;
  margin: 18px 0 0;
  font-size: 1.02rem;
  line-height: 1.75;
}

.hero-card {
  padding: 28px;
  color: var(--text-inverse);
  background:
    linear-gradient(180deg, rgba(217, 162, 62, 0.24), transparent 30%),
    linear-gradient(150deg, #19110d, #352115 70%, #533111 100%);
}

.hero-steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 18px;
  font-size: 1rem;
  line-height: 1.6;
}

.launch-ops-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  background: linear-gradient(145deg, rgba(255, 251, 243, 0.95), rgba(244, 227, 194, 0.9));
}

.auth-status-banner {
  margin-bottom: 28px;
  background: linear-gradient(145deg, rgba(255, 246, 228, 0.95), rgba(232, 209, 171, 0.9));
}

.launch-ops-banner .section-heading h2,
.launch-ops-banner h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.launch-ops-link {
  flex-shrink: 0;
  text-decoration: none;
}

.workspace {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr);
}

body.project-active .workspace {
  grid-template-columns: 1fr;
}

@media (max-width: 800px) {
  .launch-ops-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

.results-column {
  display: grid;
  gap: 24px;
}

.panel {
  padding: 28px;
  background: var(--panel-soft);
  backdrop-filter: blur(14px);
}

.controls-panel {
  position: sticky;
  top: 24px;
  align-self: start;
}

body.project-active .controls-panel {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 8;
  width: min(360px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.controls-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.controls-panel-compact {
  padding: 20px;
}

body.workbench-collapsed .controls-panel {
  display: none;
}

body.workbench-collapsed .results-column {
  min-width: 0;
}

.workbench-fab {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid rgba(85, 55, 21, 0.24);
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(255, 251, 243, 0.96), rgba(242, 225, 196, 0.92));
  color: var(--text);
  font: inherit;
  font-weight: 800;
  box-shadow: 0 18px 42px rgba(55, 32, 9, 0.16);
  cursor: pointer;
}

.workbench-fab:hover,
.workbench-fab:focus-visible {
  transform: translateY(-1px);
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.tool-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tool-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(85, 55, 21, 0.24);
  background: rgba(255, 250, 241, 0.7);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.tool-tab:hover,
.tool-tab:focus-visible {
  transform: translateY(-1px);
}

.tool-tab.is-active {
  background: linear-gradient(135deg, var(--accent), #f6c96d);
  color: #25170d;
}

.tool-tab-icon,
.tool-guide-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-inverse);
  background: linear-gradient(135deg, #7f5318, #c58f2d);
}

.tool-tab.is-active .tool-tab-icon {
  background: linear-gradient(135deg, #5d3505, #a86f14);
}

.tool-guide {
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: rgba(255, 251, 244, 0.86);
}

.launch-guide {
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: rgba(255, 248, 236, 0.82);
}

.launch-guide-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: rgba(32, 21, 13, 0.78);
  line-height: 1.55;
}

.tool-guide-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.tool-guide-label {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-strong);
}

.tool-guide-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.tool-guide-description {
  margin: 0;
  color: rgba(32, 21, 13, 0.74);
  line-height: 1.6;
}

.forge-form,
.form-fields {
  display: grid;
  gap: 16px;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-group label {
  font-size: 0.92rem;
  font-weight: 700;
}

.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  border: 1px solid rgba(86, 59, 25, 0.18);
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  color: inherit;
  background: rgba(255, 252, 246, 0.95);
}

.field-group textarea {
  min-height: 150px;
  resize: vertical;
}

.field-hint {
  margin: 0;
  color: rgba(32, 21, 13, 0.72);
  font-size: 0.88rem;
}

.form-actions {
  display: grid;
  gap: 10px;
  align-items: center;
}

.submit-button {
  border: 0;
  border-radius: 18px;
  padding: 15px 18px;
  font: inherit;
  font-weight: 800;
  color: var(--text-inverse);
  background: linear-gradient(135deg, var(--accent-strong), #d4982f);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.submit-button:hover,
.submit-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(143, 90, 8, 0.26);
}

.submit-button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.submit-button.is-busy {
  position: relative;
  overflow: hidden;
}

.submit-button.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.16) 45%, transparent 100%);
  animation: button-sheen 1.35s linear infinite;
}

.status-text {
  margin: 0;
  min-height: 1.4em;
  color: rgba(32, 21, 13, 0.76);
  font-size: 0.92rem;
}

.output-panel {
  background:
    linear-gradient(180deg, rgba(255, 248, 238, 0.96), rgba(246, 231, 205, 0.84));
}

.export-actions {
  margin-bottom: 16px;
}

.loading-state {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: linear-gradient(135deg, rgba(255, 251, 243, 0.98), rgba(246, 232, 205, 0.92));
}

.loading-orb {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #f7d88c, #c58f2d 58%, #8f5a08 100%);
  box-shadow: 0 0 0 0 rgba(197, 143, 45, 0.28);
  animation: forge-pulse 1.4s ease-in-out infinite;
  flex: 0 0 auto;
}

.loading-copy {
  display: grid;
  gap: 8px;
  width: 100%;
}

.loading-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.loading-label,
.loading-detail {
  margin: 0;
}

.loading-label {
  font-weight: 800;
  color: var(--accent-strong);
}

.loading-detail {
  color: rgba(32, 21, 13, 0.72);
  line-height: 1.6;
}

.loading-progress-label {
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 800;
}

.loading-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(96, 66, 28, 0.1);
}

.loading-progress-fill {
  width: 12%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, #8f5a08, #d9a23e);
  transition: width 500ms ease;
}

.loading-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.loading-stage {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: rgba(255, 251, 243, 0.72);
  color: rgba(32, 21, 13, 0.66);
  font-size: 0.8rem;
  font-weight: 700;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.loading-stage.is-active {
  transform: translateY(-1px);
  border-color: rgba(143, 90, 8, 0.26);
  background: rgba(255, 243, 216, 0.94);
  color: var(--accent-strong);
}

.result-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.continuation-callout {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(143, 90, 8, 0.18);
  background: linear-gradient(135deg, rgba(255, 247, 230, 0.96), rgba(247, 231, 199, 0.94));
  color: rgba(32, 21, 13, 0.84);
}

.continuation-callout strong {
  color: var(--accent-strong);
}

.continuation-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: rgba(255, 251, 243, 0.92);
}

.continuation-panel-highlight {
  border-color: rgba(143, 90, 8, 0.34);
  box-shadow: 0 0 0 4px rgba(197, 143, 45, 0.12);
}

.continuation-label {
  font-size: 0.92rem;
  font-weight: 800;
}

.continuation-textarea,
.continuation-number {
  width: 100%;
  border: 1px solid rgba(86, 59, 25, 0.18);
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  color: inherit;
  background: rgba(255, 252, 246, 0.95);
}

.continuation-textarea {
  min-height: 110px;
  resize: vertical;
}

.continuation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.continuation-number {
  max-width: 180px;
}

.continuation-button {
  padding-inline: 18px;
}

.toolbar-button {
  border: 1px solid rgba(96, 66, 28, 0.18);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 251, 243, 0.9);
  font: inherit;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 18px;
  text-decoration: none;
  font-weight: 800;
  color: var(--text-inverse);
  background: linear-gradient(135deg, #6e430d, #c58f2d);
  box-shadow: 0 16px 36px rgba(143, 90, 8, 0.18);
}

.history-panel {
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(239, 223, 194, 0.9));
}

.history-disclosure[open] .history-summary-toggle {
  margin-bottom: 14px;
}

.history-summary-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
}

.history-summary-toggle::-webkit-details-marker {
  display: none;
}

.history-heading {
  margin-bottom: 0;
}

.history-toggle-meta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 251, 243, 0.84);
  border: 1px solid rgba(96, 66, 28, 0.12);
  color: rgba(32, 21, 13, 0.7);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.history-helper {
  margin-top: 0;
}

.projects-panel {
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.96), rgba(240, 228, 204, 0.9));
}

.workspace-nav-panel {
  position: static;
  padding: 16px 20px;
  background:
     linear-gradient(180deg, rgba(255, 250, 244, 0.97), rgba(242, 229, 205, 0.92));
}

.workspace-nav-heading {
  margin-bottom: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.workspace-nav-heading h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.1rem);
  line-height: 0.98;
}

.workspace-nav-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.workspace-nav-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.workspace-nav-button strong,
.workspace-nav-button span {
  display: block;
}

.workspace-nav-button strong {
  font-size: 0.92rem;
}

.workspace-nav-button span {
  font-size: 0.78rem;
  color: rgba(32, 21, 13, 0.68);
}

.workspace-nav-button-primary span {
  color: rgba(255, 245, 229, 0.84);
}

.projects-list {
  display: grid;
  gap: 12px;
}

.project-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(96, 66, 28, 0.12);
  border-radius: 22px;
  padding: 16px 18px;
  background: rgba(255, 252, 247, 0.94);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}

.project-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
}

.project-item:hover,
.project-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(143, 90, 8, 0.45);
}

.project-archive-button {
  align-self: center;
  border-radius: 999px;
  border: 1px solid rgba(96, 72, 44, 0.18);
  background: rgba(255, 248, 238, 0.96);
  color: #6a4b2c;
  padding: 0.65rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.project-archive-button:hover,
.project-archive-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(126, 92, 56, 0.34);
  box-shadow: 0 10px 24px rgba(74, 52, 31, 0.12);
}

.project-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.project-item-title,
.project-item-subtitle,
.project-item-meta {
  display: block;
}

.project-item-title {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.65rem;
  line-height: 1;
  color: var(--accent-strong);
}

.project-item-subtitle {
  margin-top: 4px;
  color: rgba(32, 21, 13, 0.72);
  line-height: 1.5;
}

.project-item-meta {
  margin-top: 10px;
  color: rgba(32, 21, 13, 0.68);
  font-size: 0.9rem;
  line-height: 1.6;
}

.history-empty {
  color: rgba(32, 21, 13, 0.66);
  font-size: 0.94rem;
}

.history-list {
  display: grid;
  gap: 12px;
}

.book-panel {
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.96), rgba(242, 228, 202, 0.88));
}

.book-summary {
  display: grid;
  gap: 14px;
}

.illustration-library {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(96, 66, 28, 0.12);
}

.illustration-library-heading {
  margin-bottom: 12px;
}

.illustration-asset-form {
  display: grid;
  gap: 12px;
}

.illustration-asset-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 140px;
}

.illustration-asset-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.illustration-asset-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: rgba(255, 252, 247, 0.82);
}

.illustration-asset-preview {
  margin: -4px -6px 14px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(96, 66, 28, 0.08);
  background:
    linear-gradient(135deg, rgba(251, 244, 228, 0.92), rgba(238, 224, 194, 0.76));
  aspect-ratio: 16 / 10;
}

.illustration-asset-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.illustration-asset-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.illustration-asset-link {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.illustration-asset-copy,
.illustration-asset-notes,
.illustration-asset-meta {
  margin: 0;
}

.illustration-asset-copy {
  color: rgba(32, 21, 13, 0.86);
}

.illustration-asset-notes {
  margin-top: 8px;
  color: rgba(32, 21, 13, 0.72);
}

.illustration-asset-meta {
  display: block;
  margin-top: 10px;
  color: rgba(32, 21, 13, 0.62);
  font-size: 0.84rem;
}

.panel-helper {
  margin: -8px 0 14px;
  color: rgba(32, 21, 13, 0.72);
  line-height: 1.6;
}

.book-header {
  display: grid;
  gap: 8px;
  padding: 20px 22px;
  border-radius: 22px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: linear-gradient(135deg, rgba(113, 72, 15, 0.96), rgba(197, 143, 45, 0.86));
  color: var(--text-inverse);
}

.book-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  font-weight: 800;
  color: rgba(255, 243, 221, 0.9);
}

.book-title {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 0.95;
}

.book-subtitle {
  margin: 0;
  max-width: 38ch;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255, 245, 229, 0.88);
}

.book-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.book-progress-chip {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 246, 230, 0.16);
  font-size: 0.88rem;
  font-weight: 700;
}

.book-progress-chip-success {
  background: rgba(214, 245, 222, 0.18);
}

.book-progress-chip-warning {
  background: rgba(255, 244, 214, 0.18);
}

.book-chapter-list {
  display: grid;
  gap: 12px;
}

.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.book-action-button {
  border: 1px solid rgba(96, 66, 28, 0.18);
  border-radius: 999px;
  padding: 11px 15px;
  background: rgba(255, 251, 243, 0.9);
  font: inherit;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.book-action-button-primary {
  border: 0;
  color: var(--text-inverse);
  background: linear-gradient(135deg, var(--accent-strong), #d4982f);
}

.book-chapter-item {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: rgba(255, 252, 247, 0.92);
}

.book-chapter-item-current {
  border-color: rgba(143, 90, 8, 0.3);
  background: linear-gradient(180deg, rgba(255, 250, 243, 0.98), rgba(246, 233, 208, 0.9));
}

.book-chapter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.book-chapter-title {
  margin: 0;
  font-weight: 800;
  color: var(--accent-strong);
}

.book-status-badge {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.book-status-planned {
  background: rgba(103, 73, 33, 0.1);
  color: #6a4718;
}

.book-status-drafted {
  background: rgba(197, 143, 45, 0.18);
  color: #8f5a08;
}

.book-status-needs_revision {
  background: rgba(169, 96, 54, 0.16);
  color: #8a4622;
}

.book-status-approved {
  background: rgba(69, 126, 83, 0.16);
  color: #32613f;
}

.book-chapter-summary {
  margin: 0;
  color: rgba(32, 21, 13, 0.76);
  line-height: 1.6;
}

.book-chapter-goal {
  margin: 8px 0 0;
  color: rgba(32, 21, 13, 0.84);
  line-height: 1.6;
}

.book-chapter-controls {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(96, 66, 28, 0.1);
}

.book-control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.book-status-select,
.book-goal-input {
  border: 1px solid rgba(86, 59, 25, 0.18);
  border-radius: 14px;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: rgba(255, 252, 246, 0.95);
}

.book-status-select {
  min-width: 150px;
}

.book-goal-input {
  width: 100%;
  min-height: 84px;
  resize: vertical;
}

.book-empty {
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px dashed rgba(96, 66, 28, 0.22);
  color: rgba(32, 21, 13, 0.68);
  background: rgba(255, 253, 249, 0.56);
}

.chapter-workspace-panel {
  background:
    linear-gradient(180deg, rgba(255, 249, 240, 0.96), rgba(241, 225, 197, 0.88));
}

.panel-target-highlight {
  box-shadow:
    var(--shadow),
    0 0 0 5px rgba(197, 143, 45, 0.16);
  border-color: rgba(143, 90, 8, 0.34);
}

.chapter-editor {
  display: grid;
  gap: 12px;
}

.chapter-editor-title,
.chapter-editor-content,
.chapter-editor-summary {
  width: 100%;
  border: 1px solid rgba(86, 59, 25, 0.18);
  border-radius: 16px;
  padding: 12px 14px;
  font: inherit;
  color: inherit;
  background: rgba(255, 252, 246, 0.96);
}

.chapter-editor-content {
  min-height: 320px;
  resize: vertical;
}

.chapter-editor-summary {
  min-height: 90px;
  resize: vertical;
}

.chapter-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chapter-versions,
.chapter-compare {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.chapter-version-card,
.chapter-compare-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: rgba(255, 252, 247, 0.92);
}

.chapter-version-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.chapter-compare-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.chapter-compare-column {
  min-width: 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: rgba(255, 250, 243, 0.92);
}

.chapter-compare-column strong,
.chapter-compare-column p {
  display: block;
  margin: 0 0 10px;
}

.chapter-compare-column pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.72;
  font: inherit;
}

.outline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.outline-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(250, 244, 234, 0.72);
  border: 1px solid rgba(96, 66, 28, 0.1);
}

.outline-item-title {
  margin: 0 0 8px;
  font-weight: 800;
  color: var(--text);
}

.outline-item-summary {
  margin: 0;
  color: rgba(32, 21, 13, 0.74);
  line-height: 1.7;
}

.review-panel {
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.96), rgba(237, 222, 195, 0.88));
}

.review-form {
  display: grid;
  gap: 12px;
}

.review-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.review-output {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.review-summary-card,
.review-strengths-card,
.review-improvements-card {
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: rgba(255, 252, 247, 0.92);
}

.review-improvement-item {
  padding: 14px 0;
  border-top: 1px solid rgba(96, 66, 28, 0.1);
}

.review-improvement-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.history-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(96, 66, 28, 0.12);
  border-radius: 20px;
  padding: 14px 16px;
  background: rgba(255, 252, 247, 0.92);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}

.history-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
}

.history-item:hover,
.history-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(143, 90, 8, 0.45);
}

.history-archive-button {
  align-self: center;
  border-radius: 999px;
  border: 1px solid rgba(96, 72, 44, 0.18);
  background: rgba(255, 248, 238, 0.96);
  color: #6a4b2c;
  padding: 0.65rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.history-archive-button:hover,
.history-archive-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(126, 92, 56, 0.34);
  box-shadow: 0 10px 24px rgba(74, 52, 31, 0.12);
}

.history-item strong,
.history-item span {
  display: block;
}

.history-item strong {
  margin-bottom: 6px;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.history-item span {
  font-size: 0.92rem;
  line-height: 1.5;
}

.history-summary {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px dashed rgba(96, 66, 28, 0.25);
  border-radius: 24px;
  padding: 28px;
  text-align: center;
  color: rgba(32, 21, 13, 0.7);
  background: rgba(255, 253, 249, 0.5);
}

.empty-state[hidden],
.output-content[hidden],
.loading-state[hidden] {
  display: none;
}

.output-content {
  display: grid;
  gap: 16px;
}

.results-summary {
  padding: 20px 22px;
  border-radius: 24px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: linear-gradient(135deg, rgba(113, 72, 15, 0.96), rgba(197, 143, 45, 0.86));
  color: var(--text-inverse);
}

.results-summary-label {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  font-weight: 800;
  color: rgba(255, 243, 221, 0.9);
}

.results-summary-title {
  margin: 0 0 14px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.96;
}

.results-summary-subtitle {
  margin: -6px 0 16px;
  max-width: 34ch;
  font-size: 1.05rem;
  line-height: 1.55;
  color: rgba(255, 245, 229, 0.88);
}

.results-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.results-summary-chip {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 246, 230, 0.16);
  font-size: 0.88rem;
  font-weight: 700;
}

.result-card {
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 252, 247, 0.88);
  border: 1px solid rgba(96, 66, 28, 0.12);
}

.result-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.result-card-header h3 {
  margin: 0;
}

.result-card-featured {
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.98), rgba(247, 237, 218, 0.92));
  border-color: rgba(143, 90, 8, 0.2);
}

.result-card-manuscript {
  background: rgba(255, 253, 249, 0.98);
}

.result-card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
}

.copy-button {
  border: 1px solid rgba(96, 66, 28, 0.18);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 250, 241, 0.9);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent-strong);
  cursor: pointer;
}

.result-card pre,
.result-card p,
.result-card li {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.75;
}

.result-card ul {
  margin: 0;
  padding-left: 20px;
}

.manuscript-text {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.28rem;
  line-height: 1.72;
  color: rgba(32, 21, 13, 0.92);
}

.featured-blurb {
  font-size: 1.04rem;
  line-height: 1.9;
  color: rgba(32, 21, 13, 0.82);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.toc-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(250, 244, 234, 0.72);
  border: 1px solid rgba(96, 66, 28, 0.1);
}

.toc-item-title {
  margin: 0 0 6px;
  font-weight: 800;
  color: var(--text);
}

.toc-item-summary {
  margin: 0;
  color: rgba(32, 21, 13, 0.72);
}

.result-disclosure {
  border: 1px solid rgba(96, 66, 28, 0.12);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.92);
  overflow: hidden;
}

.result-disclosure summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 800;
  color: var(--accent-strong);
}

.result-disclosure summary::-webkit-details-marker {
  display: none;
}

.result-disclosure-body {
  padding: 0 18px 18px;
}

.result-disclosure-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-disclosure-title {
  flex: 1;
}

.workflow-grid {
  display: grid;
  gap: 16px;
}

.workflow-card {
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(96, 66, 28, 0.12);
  background: rgba(255, 252, 247, 0.9);
  min-width: 0;
  overflow: hidden;
}

.workflow-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
}

.workflow-card p {
  margin: 0 0 14px;
  color: rgba(32, 21, 13, 0.72);
}

.workflow-card-manuscript {
  background: rgba(255, 251, 245, 0.96);
  border-color: rgba(143, 90, 8, 0.18);
}

.workflow-card-supporting {
  background: rgba(250, 244, 234, 0.88);
}

.midjourney-card {
  background:
    linear-gradient(135deg, rgba(255, 249, 239, 0.98), rgba(246, 236, 214, 0.92));
  border-color: rgba(143, 90, 8, 0.2);
}

.midjourney-intro {
  margin: 0 0 18px;
  color: rgba(32, 21, 13, 0.76);
}

.midjourney-section + .midjourney-section {
  margin-top: 18px;
}

.midjourney-section h4 {
  margin: 0 0 10px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
}

.midjourney-prompt-list,
.midjourney-notes {
  margin: 0;
  padding-left: 18px;
}

.midjourney-prompt-item {
  margin-bottom: 12px;
  padding: 14px 14px 12px;
  border: 1px solid rgba(96, 66, 28, 0.1);
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.82);
}

.midjourney-prompt-item p {
  margin: 0 0 10px;
  color: rgba(32, 21, 13, 0.86);
}

.midjourney-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.midjourney-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.midjourney-token-list li {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(143, 90, 8, 0.1);
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 700;
}

.error-card {
  background: rgba(119, 21, 21, 0.08);
  border-color: rgba(119, 21, 21, 0.18);
}

@media (max-width: 920px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    position: static;
  }

  .workspace-nav-panel {
    position: static;
  }

  .hero-copy h1 {
    max-width: 12ch;
  }

  .history-summary-toggle {
    flex-direction: column;
  }

  .history-toggle-meta {
    white-space: normal;
  }

  .auth-area {
    position: static;
    justify-content: flex-end;
    margin-bottom: 16px;
  }
}

@media (max-width: 480px) {
  .chapter-compare-grid {
    grid-template-columns: 1fr;
  }

  .loading-state {
    align-items: flex-start;
  }
}

@keyframes forge-pulse {
  0% {
    transform: scale(0.94);
    box-shadow: 0 0 0 0 rgba(197, 143, 45, 0.34);
  }

  60% {
    transform: scale(1);
    box-shadow: 0 0 0 14px rgba(197, 143, 45, 0);
  }

  100% {
    transform: scale(0.94);
    box-shadow: 0 0 0 0 rgba(197, 143, 45, 0);
  }
}

@keyframes button-sheen {
  0% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(120%);
  }
}
