.shell-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-hero {
  background: linear-gradient(135deg, #2a1e0e, #3d2a12);
  color: #f5f2ed; padding: 48px 28px 40px; text-align: center;
}
.page-hero h1 { font-family: 'Playfair Display', serif; font-size: 32px; margin: 0 0 10px; }
.page-hero p { font-size: 15px; color: #c4a97a; margin: 0 auto; max-width: 520px; line-height: 1.6; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
}

.app-header {
  gap: 18px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.brand-link:hover .logo {
  color: var(--warm-dark);
}

.brand-link:hover .logo span {
  color: var(--accent);
}

.topbar-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(200, 169, 110, 0.28);
  background: rgba(200, 169, 110, 0.1);
  color: var(--warm-dark);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.topbar-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(226, 221, 214, 0.92);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(47, 32, 13, 0.06);
}

.topbar-link {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s, color .18s, transform .18s;
}

.topbar-link:hover {
  background: rgba(200, 169, 110, 0.14);
  color: var(--ink);
}

.topbar-link.is-active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 10px 22px rgba(14, 14, 15, 0.14);
}

.app-main {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

body.has-flip-fullscreen .app-header,
body.has-spread-fullscreen .app-header,
body.has-flip-fullscreen .mob-report-bar,
body.has-spread-fullscreen .mob-report-bar {
  display: none !important;
}

body.has-flip-fullscreen .app-main,
body.has-spread-fullscreen .app-main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

body.has-spread-fullscreen {
  overflow: hidden;
}

.landing {
  display: grid;
  gap: 20px;
  margin-bottom: 28px;
}

.landing.is-hidden,
.workspace-shell,
.stage-full.is-hidden,
.aux-panel.is-hidden {
  display: none;
}

.workspace-shell.is-open {
  display: block;
}

.workspace-shell.report-focus .workspace-frame {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.workspace-shell.report-focus .workspace-header,
.workspace-shell.report-focus .workspace-panel {
  display: none;
}

.workspace-shell.report-focus .workspace-grid {
  display: block;
}

.hero-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 28px;
  padding: 34px;
  border-radius: 34px;
  border: 1px solid rgba(226, 221, 214, 0.92);
  box-shadow: 0 18px 48px rgba(47, 32, 13, 0.08);
  background:
    radial-gradient(circle at top left, rgba(200, 169, 110, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(212, 88, 58, 0.12), transparent 26%),
    linear-gradient(145deg, rgba(255,255,255,0.96), rgba(247,244,239,0.96));
  overflow: hidden;
  position: relative;
}

.hero-copy,
.entry-card,
.panel-section,
.report-wrap {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 221, 214, 0.92);
  box-shadow: 0 18px 48px rgba(47, 32, 13, 0.08);
}

.hero-copy {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  max-width: none;
}

.hero-kicker {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--warm-dark);
  margin-bottom: 10px;
}

.hero-copy h1,
.workspace-header h2,
.results-intro h3,
.panel-head h3,
.entry-card h2 {
  font-family: "Playfair Display", serif;
  letter-spacing: -0.03em;
}

.hero-copy h1 {
  font-size: clamp(2.45rem, 4.5vw, 4.8rem);
  line-height: 0.97;
  margin-bottom: 18px;
}

.hero-lead,
.workspace-note,
.results-intro p,
.entry-card p,
.hero-status-copy span {
  color: #61594f;
  line-height: 1.7;
}

.hero-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions {
  align-items: center;
  margin-top: 24px;
}

.hero-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 999px;
  text-decoration: none;
}

.hero-actions .hero-action-primary {
  box-shadow: 0 12px 26px rgba(28, 24, 19, 0.16);
}

.hero-actions .btn-link {
  color: var(--warm-dark);
  background: transparent;
}

.hero-actions .btn-link:hover {
  color: var(--ink);
}

.hero-free-note {
  max-width: 720px;
  margin: 14px 0 0;
  color: #61594f;
  font-size: 13px;
  line-height: 1.65;
}

.hero-free-note strong {
  color: #2f6f49;
}

.entry-cards {
  display: grid;
  gap: 18px;
}

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 24px;
}

.landing-section-head {
  max-width: 720px;
  padding: 18px 4px 0;
}

.landing-section-head h2 {
  margin: 0 0 8px;
  font-family: "Playfair Display", serif;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  letter-spacing: -0.03em;
}

.landing-section-head p {
  margin: 0;
  color: #61594f;
  line-height: 1.7;
}

.hero-proof span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(200, 169, 110, 0.2);
  color: var(--warm-dark);
  font-size: 12px;
}

.mini-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-start;
}

.mini-actions.is-hidden {
  display: none;
}

.analysis-overlay {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(18, 16, 13, 0.42);
  backdrop-filter: blur(10px);
}

.analysis-overlay.on {
  display: flex;
}

.analysis-dialog {
  width: min(440px, 100%);
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(226, 221, 214, 0.92);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 28px 60px rgba(20, 18, 14, 0.18);
}

.analysis-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(200, 150, 10, 0.18);
  border-top-color: var(--warm, #c8960a);
  border-radius: 50%;
  margin-bottom: 14px;
  animation: analysis-spin 0.75s linear infinite;
}

@keyframes analysis-spin {
  to { transform: rotate(360deg); }
}

.analysis-dialog h3 {
  margin: 6px 0 8px;
  font-family: "Playfair Display", serif;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}

.analysis-dialog p {
  color: #61594f;
  line-height: 1.7;
}

.analysis-progress {
  height: 8px;
  margin-top: 18px;
  border-radius: 999px;
  background: rgba(226, 221, 214, 0.92);
  overflow: hidden;
}

.analysis-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--warm), var(--accent));
  transition: width .28s ease;
}

.docx-cleanup-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(18, 16, 13, 0.46);
  backdrop-filter: blur(8px);
}

.docx-cleanup-overlay.on {
  display: flex;
}

.docx-cleanup-dialog {
  width: min(820px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(226, 221, 214, 0.92);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 28px 60px rgba(20, 18, 14, 0.18);
}

.docx-cleanup-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.docx-cleanup-head h3 {
  margin: 6px 0 8px;
}

.docx-cleanup-head p,
.docx-cleanup-note {
  color: var(--muted);
  line-height: 1.6;
}

.docx-cleanup-note {
  margin-top: 10px;
}

.docx-cleanup-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.docx-cleanup-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(226, 221, 214, 0.92);
  background: rgba(247, 244, 239, 0.92);
}

.docx-cleanup-item.review-only {
  background: rgba(244, 239, 231, 0.86);
}

.docx-cleanup-check {
  margin-top: 2px;
}

.docx-cleanup-copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.docx-cleanup-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--warm-dark);
}

.docx-cleanup-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(200, 169, 110, 0.14);
  border: 1px solid rgba(200, 169, 110, 0.22);
}

.docx-cleanup-preview {
  margin-top: 8px;
  font: 12px/1.6 'DM Mono', monospace;
  color: var(--warm-dark);
}

.docx-cleanup-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.hero-visual {
  position: relative;
  min-height: 360px;
}

.hero-book {
  position: absolute;
  inset: 34px auto auto 34px;
  width: 240px;
  height: 320px;
  transform: rotate(-8deg);
  filter: drop-shadow(0 22px 34px rgba(32, 22, 9, 0.18));
}

.hero-book-front {
  width: 100%;
  height: 100%;
  border-radius: 18px 10px 10px 18px;
  padding: 30px 24px;
  background:
    linear-gradient(180deg, rgba(20, 20, 28, 0.94), rgba(34, 28, 24, 0.98)),
    linear-gradient(135deg, rgba(212, 88, 58, 0.14), transparent 38%);
  color: #f6e7c7;
  border: 1px solid rgba(255,255,255,0.06);
}

.hero-book-spine {
  position: absolute;
  top: 10px;
  right: -14px;
  width: 22px;
  height: 300px;
  border-radius: 5px;
  background: linear-gradient(180deg, #231a17, #111113);
}

.hero-book-kicker {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #d5b98a;
}

.hero-book-title {
  margin-top: 52px;
  font-family: "Playfair Display", serif;
  font-size: 36px;
  line-height: 0.95;
}

.hero-book-rule {
  width: 72px;
  height: 2px;
  margin: 18px 0 20px;
  background: linear-gradient(90deg, #d4a853, transparent);
}

.hero-book-author {
  font-size: 14px;
  color: #f0d6aa;
}

.hero-sheet {
  position: absolute;
  border-radius: 20px;
  border: 1px solid rgba(136, 128, 120, 0.18);
  background: rgba(255,255,255,0.88);
  box-shadow: 0 18px 40px rgba(48, 36, 20, 0.1);
}

.hero-sheet-report {
  top: 18px;
  right: 18px;
  width: 210px;
  padding: 18px;
  transform: rotate(7deg);
}

.hero-sheet-cover {
  left: 146px;
  bottom: 26px;
  width: 230px;
  padding: 18px;
  transform: rotate(5deg);
}

.hero-sheet-kicker {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.hero-sheet-title {
  font-family: "Playfair Display", serif;
  font-size: 22px;
  margin-bottom: 14px;
}

.hero-lines {
  display: grid;
  gap: 8px;
}

.hero-lines span {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(200, 169, 110, 0.26), rgba(226, 221, 214, 0.7));
}

.hero-safe-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.hero-safe-grid span {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 88px;
  border-radius: 14px;
  border: 1px solid rgba(136, 128, 120, 0.18);
  background: rgba(247,244,239,0.85);
  color: var(--warm-dark);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hero-status {
  position: absolute;
  right: 56px;
  bottom: 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(18, 18, 20, 0.92);
  color: #f8f3ea;
  box-shadow: 0 18px 40px rgba(29, 23, 15, 0.24);
}

.hero-status-score {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #d4a853, #f1d3a7);
  color: #1a1a1d;
  font-family: "DM Mono", monospace;
  font-size: 18px;
}

.hero-status-copy {
  display: grid;
  gap: 4px;
}

.hero-status-copy strong {
  font-size: 14px;
}

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

.hero-metric {
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(226, 221, 214, 0.92);
  background: rgba(255,255,255,0.76);
  box-shadow: 0 14px 32px rgba(47, 32, 13, 0.06);
}

.hero-metric strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 18px;
}

.hero-metric span {
  color: #61594f;
  font-size: 13px;
  line-height: 1.6;
}

.entry-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.entry-card {
  text-align: left;
  padding: 28px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.95), rgba(248,245,240,0.95)),
    radial-gradient(circle at top right, rgba(212, 88, 58, 0.11), transparent 34%);
}

.entry-card:hover {
  transform: translateY(-2px);
  border-color: rgba(200, 169, 110, 0.9);
  box-shadow: 0 24px 58px rgba(47, 32, 13, 0.12);
}

.entry-label,
.entry-cta {
  display: block;
  font-size: 12px;
  color: var(--warm-dark);
}

.entry-label {
  margin-bottom: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.entry-cta {
  margin-top: 16px;
  font-weight: 600;
}

.entry-card .entry-bridge {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 6px;
}

.entry-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding-left: 18px;
  color: #61594f;
}

.workspace-frame {
  border-radius: 32px;
  padding: 24px;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 22px;
}

.workspace-header h2 {
  font-size: clamp(1.6rem, 2.2vw, 2.5rem);
  margin-bottom: 8px;
}

.workspace-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: end;
}

.workspace-switches {
  display: flex;
  gap: 10px;
}

.workspace-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 11px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.workspace-toggle.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: start;
}

.workspace-panel {
  display: grid;
  gap: 18px;
  align-items: start;
}

.workspace-panel.mode-interior {
  grid-template-columns: minmax(260px, 0.92fr) minmax(320px, 1.08fr) minmax(360px, 1.4fr);
}

.workspace-panel.mode-cover {
  grid-template-columns: minmax(340px, 1fr) minmax(420px, 1.35fr);
}

#interiorSetupPanel {
  grid-column: 1;
}

#interiorWorkspace {
  grid-column: 2;
}

#interiorDiagnosticsPanel {
  grid-column: 3;
}

#coverWorkspace {
  grid-column: 1;
}

#coverDiagnosticsPanel {
  grid-column: 2;
}

.panel-section {
  border-radius: 24px;
  padding: 22px;
}

.action-row {
  margin-top: 16px;
}

.panel-head,
.results-intro {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.panel-mini-note {
  font-size: 11px;
  color: var(--muted);
  max-width: 150px;
  line-height: 1.5;
  text-align: right;
}

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

.field-grid-wide {
  grid-template-columns: 1fr;
}

.manual-dim-wrap {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(247, 244, 239, 0.8);
  margin-bottom: 12px;
}

.manual-dim-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--muted);
}

.manual-dim-wrap.is-hidden {
  display: none;
}

.bleed-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(247, 244, 239, 0.9);
  margin-bottom: 10px;
}

.bleed-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.bleed-title {
  font-size: 13px;
  font-weight: 600;
}

.bleed-copy {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.bleed-opts {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.bleed-opt {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.bleed-opt:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.bleed-opt.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.bleed-required-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  background: #ffecd2;
  color: #b85c00;
  border-radius: 8px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.bleed-required-badge.hidden {
  display: none;
}

.support-note,
.file-meta {
  font-size: 12px;
  color: var(--muted);
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(200, 169, 110, 0.1);
  border: 1px solid rgba(200, 169, 110, 0.18);
}

.file-meta strong {
  color: var(--ink);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.stacked-cards {
  display: grid;
  gap: 16px;
}

.mini-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(247, 244, 239, 0.65);
  border: 1px solid var(--border);
}

.workspace-mode-section {
  display: none;
}

.workspace-mode-section.is-active {
  display: block;
}

.diagnostics-panel {
  align-self: start;
}

.diagnostics-panel .issues-list {
  max-height: 360px;
}

.diagnostics-stack {
  margin-top: 16px;
}

.diagnostics-report-action {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(226, 221, 214, 0.92);
}

.diagnostics-report-action.is-hidden {
  display: none;
}

.diagnostics-report-action .btn {
  width: 100%;
}

.stage-full.is-visible,
.aux-panel.is-visible {
  display: block;
}

.action-row-stack {
  flex-direction: column;
}

.stage-full {
  min-height: 920px;
  width: 100%;
  border-radius: 28px;
  padding: 26px;
  align-items: stretch;
}

.workspace-shell.report-focus .stage-full {
  min-height: calc(100vh - 120px);
}

.spell-action-btn {
  min-width: 66px;
  padding: 5px 10px;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.workspace-panel > .panel-section:first-child {
  grid-column: 1 / -1;
}

.results-intro {
  position: relative;
  z-index: 1;
  margin-bottom: 20px;
}

.results-actions {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 12px;
}

.results-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.results-pill {
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.84);
  border: 1px solid var(--border);
  color: var(--warm-dark);
}

.report-wrap {
  max-width: 100%;
  padding: 24px;
  border-radius: 24px;
}

.report-head {
  font-family: "Playfair Display", serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 18px;
}

.fr-tab-bar {
  display: flex;
  gap: 0;
  margin: 0 0 20px;
  border-bottom: 1px solid var(--border);
}
.fr-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  border-radius: 0;
}
.fr-tab:hover { color: var(--ink); }
.fr-tab.on {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.fr-pane { display: none; }
.fr-pane.on { display: block; }

#confirmDimsBtn,
#dimConfirmedBadge {
  display: none !important;
}

.share-strip {
  z-index: 1;
}

.watermark {
  z-index: 1;
}

@media (max-width: 1100px) {
  .hero-stage,
  .hero-statbar {
    grid-template-columns: 1fr;
  }

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

  .entry-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-visual {
    min-height: 420px;
  }

  .workspace-panel,
  .workspace-panel.mode-interior,
  .workspace-panel.mode-cover {
    grid-template-columns: 1fr;
  }

  #interiorSetupPanel,
  #interiorWorkspace,
  #interiorDiagnosticsPanel,
  #coverWorkspace,
  #coverDiagnosticsPanel {
    grid-column: auto;
  }

  .workspace-header,
  .results-intro,
  .panel-head,
  .workspace-actions,
  .results-actions {
    flex-direction: column;
    align-items: start;
  }

  .panel-mini-note {
    text-align: left;
    max-width: none;
  }

  .results-pills {
    justify-content: start;
  }
}

@media (max-width: 720px) {
  header {
    padding: 14px 16px;
  }

  .app-header {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
  }

  .brand-link {
    flex: 0 1 auto;
    min-width: 0;
    max-width: calc(100% - 92px);
    justify-content: flex-start;
    align-items: center;
  }

  .topbar-tools {
    flex: 0 0 auto;
    align-items: flex-end;
    gap: 8px;
  }

  .topbar-nav {
    width: 100%;
    justify-content: center;
  }

  .topbar-link {
    flex: 1 1 0;
    text-align: center;
    padding: 11px 10px;
  }

  .app-main {
    width: min(100%, calc(100% - 16px));
    padding-top: 16px;
  }

  .hero-copy,
  .entry-card,
  .workspace-frame,
  .panel-section,
  .stage-full,
  .report-wrap {
    border-radius: 22px;
  }

  .hero-stage,
  .hero-copy,
  .workspace-frame,
  .panel-section,
  .stage-full {
    padding: 18px;
  }

  .hero-book {
    inset: 20px auto auto 14px;
    width: 200px;
    height: 276px;
  }

  .hero-sheet-cover {
    left: 92px;
    bottom: 18px;
    width: 200px;
  }

  .hero-status {
    right: 12px;
    left: 12px;
    bottom: 8px;
  }

  .workspace-switches {
    width: 100%;
  }

  .workspace-toggle {
    flex: 1;
    text-align: center;
  }

  .vtabs {
    flex-wrap: wrap;
  }

  .vtab {
    flex: 1 1 calc(50% - 1px);
    text-align: center;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE REPORT FAB  (floating sticky "Open Full Report" bar)
═══════════════════════════════════════════════════════════ */
.mob-report-bar {
  display: none; /* revealed by JS on mobile when report is ready */
}

@media (max-width: 900px) {
  .spell-action-btn {
    min-width: 48px;
    padding: 4px 7px;
    font-size: 10px;
  }

  .mob-report-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 400;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(247, 244, 239, 0.97);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
    box-shadow: 0 -4px 24px rgba(47, 32, 13, 0.1);
    display: none; /* still hidden until .is-ready added */
    gap: 10px;
    align-items: center;
  }

  .mob-report-bar.is-ready {
    display: flex;
    transform: translateY(110%);
    transition: transform 0.28s ease;
  }

  .mob-report-bar.is-ready.scroll-visible {
    transform: translateY(0);
  }

  .mob-report-bar .mob-report-label {
    flex: 1;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
  }

  .mob-report-bar .mob-report-label strong {
    display: block;
    color: var(--ink);
    font-size: 13px;
  }

  .mob-report-bar .btn {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Push page content up so the FAB doesn't cover it */
  body.has-report-fab {
    padding-bottom: 80px;
  }
}

/* ═══════════════════════════════════════════════════════════
   FEEDBACK BUTTON & MODAL
═══════════════════════════════════════════════════════════ */
.feedback-trigger-wrap {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #ede8e0;
  text-align: center;
}

.feedback-trigger-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--warm-mid, #9a8a72);
  cursor: pointer;
  padding: 4px 8px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.feedback-trigger-btn:hover {
  color: var(--warm-dark, #3a2a18);
}

.feedback-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}

.feedback-modal-overlay.open {
  display: flex;
}

.feedback-modal {
  background: #fff;
  border-radius: 14px;
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 420px;
  margin: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  position: relative;
}

.feedback-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #9a8a72;
  cursor: pointer;
  padding: 2px 6px;
}

.feedback-modal-close:hover { color: #3a2a18; }

.feedback-modal h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #1a1610;
}

.feedback-modal p {
  margin: 0 0 14px;
  font-size: 13px;
  color: #7a6a52;
  line-height: 1.5;
}

.feedback-modal textarea {
  width: 100%;
  box-sizing: border-box;
  height: 110px;
  resize: vertical;
  border: 1px solid #d6cbbf;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #1a1610;
  background: #faf8f4;
  outline: none;
}

.feedback-modal textarea:focus {
  border-color: #8b5e2a;
}

.feedback-modal-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.feedback-modal-send {
  background: linear-gradient(135deg,#8b5e2a,#c48a3f);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 22px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.feedback-modal-send:disabled {
  opacity: 0.6;
  cursor: default;
}

.feedback-thankyou {
  text-align: center;
  padding: 12px 0 4px;
}

.feedback-thankyou p {
  margin: 0;
  font-size: 14px;
  color: #3a8a5a;
  font-weight: 600;
}

.feedback-thankyou small {
  font-size: 12px;
  color: #9a8a72;
}

/* ═══════════════════════════════════════════════════════════
   DESKTOP-MODE WARNING MODAL
═══════════════════════════════════════════════════════════ */
.desktop-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(18, 16, 13, 0.52);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.desktop-modal-overlay.on {
  display: flex;
}

.desktop-modal-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 8px 48px rgba(20, 18, 14, 0.22);
  border: 1px solid var(--border);
}

.desktop-modal-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.desktop-modal-title {
  font-family: "Playfair Display", serif;
  font-size: 1.35rem;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.desktop-modal-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 20px;
}

.desktop-modal-steps {
  display: grid;
  gap: 8px;
  margin: 14px 0 22px;
}

.desktop-modal-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
}

.desktop-modal-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.desktop-modal-actions {
  display: grid;
  gap: 10px;
}

.desktop-modal-actions .btn {
  width: 100%;
  justify-content: center;
  padding: 13px 18px;
  font-size: 14px;
  border-radius: 14px;
}

/* ═══════════════════════════════════════════════════════════
   LANDING — MOBILE POLISH
═══════════════════════════════════════════════════════════ */

/* Hide the decorative book/sheet visual on phones — copy is what matters */
@media (max-width: 640px) {
  .hero-visual {
    display: none;
  }

  .hero-stage {
    grid-template-columns: 1fr;
    padding: 22px 18px;
    border-radius: 24px;
  }

  .hero-copy h1 {
    font-size: clamp(1.9rem, 8vw, 2.8rem);
    margin-bottom: 14px;
  }

  .hero-kicker {
    font-size: 10px;
  }

  .hero-proof {
    margin: 14px 0 18px;
    gap: 8px;
  }

  .hero-proof span {
    font-size: 11px;
    padding: 6px 10px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 13px 18px;
    border-radius: 12px;
    font-size: 14px;
  }

  .hero-statbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hero-metric {
    padding: 14px 16px;
    border-radius: 16px;
  }

  .entry-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .entry-card {
    padding: 20px;
    border-radius: 20px;
  }

  .entry-card h2 {
    font-size: 1.2rem;
    margin: 6px 0 8px;
  }
}

/* ═══════════════════════════════════════════════════════════
   WORKSPACE — MOBILE POLISH
═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Workspace header: collapse layout */
  .workspace-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .workspace-header h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
  }

  .workspace-note {
    font-size: 13px;
  }

  .workspace-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .workspace-switches {
    flex: 1;
    gap: 8px;
  }

  .workspace-toggle {
    flex: 1;
    text-align: center;
    padding: 9px 12px;
    font-size: 12px;
  }

  /* Panel section: add collapsible feel via a visible "section divider" look */
  .panel-section {
    padding: 16px;
    border-radius: 18px;
  }

  .panel-head {
    cursor: pointer;
    user-select: none;
    gap: 10px;
  }

  /* Collapsible panels on mobile */
  .panel-section.mob-collapsed > *:not(.panel-head) {
    display: none;
  }

  .panel-head::after {
    content: '▾';
    font-size: 14px;
    color: var(--muted);
    flex-shrink: 0;
    transition: transform 0.2s;
    margin-left: auto;
  }

  .panel-section.mob-collapsed .panel-head::after {
    transform: rotate(-90deg);
  }

  /* Keep the mobile flow natural: setup, upload, then diagnostics */
  #interiorSetupPanel       { order: 1; }
  #interiorWorkspace        { order: 2; }
  #interiorDiagnosticsPanel { order: 3; }
  #coverWorkspace           { order: 1; }
  #coverDiagnosticsPanel    { order: 2; }

  /* Hide the per-panel report action on mobile — we use the FAB instead */
  .diagnostics-report-action {
    display: none;
  }

  /* Vtabs wrap properly */
  .vtabs {
    gap: 0;
  }

  .vtab {
    flex: 1 1 calc(33.333% - 1px);
    font-size: 11px;
    padding: 8px 6px;
  }

  /* Stage full height reduction on mobile */
  .stage-full {
    min-height: auto;
    padding: 16px;
  }

  /* Results intro compact */
  .results-intro {
    flex-direction: column;
    gap: 10px;
  }

  .results-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .results-pills {
    display: none; /* hide decorative pills on mobile */
  }

  #fullreportBody .page-hero {
    padding-bottom: 12px;
  }

  #fullreportBody .page-hero h1 {
    font-size: clamp(1.7rem, 8vw, 2.25rem);
  }

  #fullreportBody .page-hero p {
    max-width: 34rem;
    font-size: 13px;
    line-height: 1.55;
  }

  #fullreportBody .app-main {
    width: 100%;
    padding: 8px 8px 28px;
  }

  #fullreportBody .workspace-frame,
  #fullreportBody .stage-full {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #fullreportBody .stage-full {
    min-height: 0;
  }

  #fullreportBody .results-intro {
    margin: 0 0 10px;
    padding: 0 4px;
  }

  #fullreportBody .vtabs {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 0 -8px 12px;
    padding: 8px;
    overflow: visible;
    background: rgba(247, 244, 239, 0.96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
  }

  #fullreportBody .vtab {
    width: 100%;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    white-space: normal;
  }

  #fullreportBody .vtab.on {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
  }

  #fullreportBody .vtab.vtab-cta {
    background: linear-gradient(135deg, #8b5e2a, #c48a3f);
    color: #fff;
    border-color: transparent;
  }

  #fullreportBody .vtab.vtab-cta:hover,
  #fullreportBody .vtab.vtab-cta.on {
    background: linear-gradient(135deg, #6f491f, #a56f2f);
    color: #fff;
  }

  #fullreportBody #tab3d,
  #fullreportBody #tabFlip,
  #fullreportBody #shareReportBtn {
    display: none !important;
  }

  #fullreportBody .report-wrap {
    padding: 16px 12px;
    border-radius: 18px;
    overflow: hidden;
  }

  #fullreportBody .report-head {
    font-size: 21px;
    margin-bottom: 12px;
  }

  #fullreportBody .fr-tab {
    flex: 1;
    padding: 10px 12px;
  }

  #fullreportBody #reportBody,
  #fullreportBody #coverReportBody {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #fullreportBody #reportBody > div[style*="grid-template-columns:repeat(4"],
  #fullreportBody #coverReportBody > div[style*="grid-template-columns:repeat(4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #fullreportBody #reportBody table,
  #fullreportBody #coverReportBody table {
    display: block;
    width: 100% !important;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #fullreportBody #reportBody td,
  #fullreportBody #reportBody th,
  #fullreportBody #coverReportBody td,
  #fullreportBody #coverReportBody th {
    min-width: 92px;
    overflow-wrap: anywhere;
  }

  #fullreportBody #reportBody td:nth-child(2),
  #fullreportBody #coverReportBody td:nth-child(2) {
    min-width: 190px;
  }

  #fullreportBody #spellWordsTable td,
  #fullreportBody #spellWordsTable th {
    min-width: 72px;
  }

  #fullreportBody .share-strip,
  #fullreportBody .watermark {
    margin-left: 4px;
    margin-right: 4px;
  }
}

@media (max-width: 480px) {
  .app-main {
    width: 100%;
    padding: 12px 10px 32px;
  }

  .topbar-tag {
    padding: 5px 8px;
    font-size: 9px;
  }

  .workspace-frame {
    padding: 14px;
    border-radius: 20px;
  }

  .topbar-tools .api-pill {
    display: none; /* too cluttered on very small screens */
  }

  .vtab {
    flex: 1 1 calc(50% - 1px);
  }
}

/* Inline Author Proof tab hidden — fullscreen Open Author Proof is the entry point */
#tabFlip { display: none !important; }
