/* ============================================================
   Cover maker — KDP cover-dimension calculator inside the
   editor's Resources tab. Reskinned port of the standalone
   tool's styles.css to use Pendrilo's design tokens
   (--bg-paper, --ink-1, --accent, etc.) so it picks up the
   light/dark theme automatically.

   Every rule is scoped under .cover-view so the cover maker's
   generic class names (.form-group, .tip, .help-icon, etc.)
   can't leak into the rest of the editor.
   ============================================================ */

/* `.editor-view.is-active { display: flex }` would otherwise lay the
   sub-tab strip and the cover-shell side by side. Matching its
   specificity (0,2,0) with .editor-view.cover-view and switching to
   grid mirrors the trick .bible-view / .resources-view use. */
.editor-view.cover-view {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg-page);
  overflow: hidden;
}
.cover-view[hidden] { display: none !important; }
.cover-view > .cover-shell {
  overflow-y: auto;
  padding: 24px 28px 60px;
  max-width: 1000px;
  width: 100%;
  justify-self: center;
  margin: 0;
}

/* ---- Cover head ----------------------------------------- */
.cover-view .cover-head {
  text-align: center;
  padding: 22px 24px;
  margin-bottom: 18px;
  background: var(--bg-topbar);
  color: #f5f1e6;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}

/* ---- Top-level cover tabs (Calculator / Pages / Reference) ----
   Distinct from the Workshop sub-tabs above (which are pills) and
   the inner spec-tabs in the KDP Reference section (smaller
   underline). These sit at the "page" level for the cover maker. */
.cover-view .cover-tabs {
  display: flex;
  gap: 2px;
  margin: 0 0 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.cover-view .cover-tab {
  padding: 12px 22px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: -1px;  /* overlap the parent's 1px border */
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.cover-view .cover-tab:hover {
  color: var(--ink-1);
  background: var(--bg-rail);
}
.cover-view .cover-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.cover-view .cover-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Tab panes — only the active one renders. The hidden attribute
   handles older fallback; .is-active is the live toggle. */
.cover-view .cover-tab-pane[hidden],
.cover-view .cover-tab-pane:not(.is-active) {
  display: none;
}
.cover-view .cover-tab-pane {
  display: block;
}
.cover-view .cover-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: .01em;
}
.cover-view .cover-sub {
  margin: 0;
  font-size: 14px;
  opacity: .82;
  font-family: var(--font-serif);
}

/* ---- Shared section card -------------------------------- */
.cover-view .page-counter-section,
.cover-view .presets-section,
.cover-view .specs-section,
.cover-view .calculator-section,
.cover-view .coverage-area {
  background: var(--bg-card);
  padding: 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  margin-bottom: 24px;
}
.cover-view .page-counter-section h2,
.cover-view .presets-section h2,
.cover-view .specs-section h2,
.cover-view .calculator-section h2,
.cover-view .coverage-area h3,
.cover-view .results-section h2 {
  font-family: var(--font-display);
  color: var(--accent);
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}
.cover-view .results-section h2 { font-size: 24px; margin-bottom: 22px; }
.cover-view .section-description {
  color: var(--ink-3);
  margin: 0 0 22px;
  font-size: 14px;
}

.cover-view .section-divider {
  height: 1px;
  border: none;
  background: var(--line);
  margin: 28px 0;
}

/* ---- PDF page counter ----------------------------------- */
.cover-view .page-counter-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.cover-view .pdf-input { display: none; }
.cover-view .pdf-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px;
  border: 2px dashed var(--accent-soft);
  border-radius: var(--radius);
  background: var(--accent-bg);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.cover-view .pdf-label:hover,
.cover-view .pdf-label.is-drag {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-bg) 70%, var(--accent) 8%);
}
.cover-view .pdf-label p {
  margin: 10px 0 4px;
  color: var(--ink-1);
  font-weight: 600;
  font-size: 14px;
}
.cover-view .pdf-label small {
  color: var(--ink-3);
  font-size: 12px;
}
.cover-view .upload-icon { font-size: 30px; }

.cover-view .pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px;
}
.cover-view .pdf-loading p {
  color: var(--ink-3);
  font-weight: 500;
  margin: 0;
}
.cover-view .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: cover-spin 1s linear infinite;
  margin-bottom: 12px;
}
@keyframes cover-spin { to { transform: rotate(360deg); } }

.cover-view .pdf-error {
  padding: 14px 16px;
  background: color-mix(in srgb, var(--danger) 10%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: var(--radius-sm);
  color: var(--danger);
}
.cover-view .pdf-error p { margin: 0; }

.cover-view .pdf-results {
  padding: 18px;
  background: var(--bg-paper);
  border-radius: var(--radius);
  border-left: 4px solid var(--success);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cover-view .pdf-results .result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.cover-view .pdf-results .result-item:last-of-type { border-bottom: none; }
.cover-view .pdf-results .result-item .label {
  font-weight: 600;
  color: var(--ink-1);
  font-size: 13.5px;
}
.cover-view .pdf-results .result-item .value {
  font-size: 16px;
  font-weight: 700;
  color: var(--success);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
}

.cover-view .binding-warning {
  padding: 14px;
  background: var(--accent-bg);
  border-radius: var(--radius-sm);
  margin: 4px 0;
}
.cover-view .binding-select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  background: var(--bg-card);
  color: var(--ink-1);
}
.cover-view .adjustment-text { font-weight: 600; }
.cover-view .adjustment-text.is-ok   { color: var(--success); }
.cover-view .adjustment-text.is-warn { color: var(--accent); }

/* ---- Presets grid --------------------------------------- */
.cover-view .presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.cover-view .preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--ink-1);
  cursor: pointer;
  font: inherit;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.cover-view .preset-btn:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  transform: translateY(-1px);
}
.cover-view .preset-btn:active { transform: translateY(0); }
.cover-view .preset-icon { font-size: 26px; margin-bottom: 6px; }
.cover-view .preset-name {
  font-weight: 600;
  color: var(--ink-1);
  margin-bottom: 2px;
  font-size: 13.5px;
}
.cover-view .preset-btn small {
  color: var(--ink-3);
  font-size: 11.5px;
}

/* ---- Specs tabs ----------------------------------------- */
.cover-view .specs-tabs {
  display: flex;
  gap: 4px;
  margin: 18px 0 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.cover-view .spec-tab-btn {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-3);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease;
}
.cover-view .spec-tab-btn:hover { color: var(--ink-1); }
.cover-view .spec-tab-btn.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.cover-view .spec-tab-content { display: none; }
.cover-view .spec-tab-content.is-active { display: block; }

.cover-view .spec-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 13.5px;
}
.cover-view .spec-table thead {
  background: var(--bg-rail);
}
.cover-view .spec-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--ink-1);
  border-bottom: 1px solid var(--line);
}
.cover-view .spec-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
}
.cover-view .spec-table tbody tr:hover { background: var(--bg-rail); }
.cover-view .spec-table tbody tr:last-child td { border-bottom: none; }

/* ---- Calculator form ------------------------------------ */
.cover-view .form-group { margin-bottom: 16px; }
.cover-view .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.cover-view label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--ink-1);
  font-size: 13.5px;
}
.cover-view .help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: bold;
  cursor: help;
  position: relative;
  transition: transform .12s ease;
}
.cover-view .help-icon:hover { transform: scale(1.12); }

.cover-view input[type="number"],
.cover-view select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--ink-1);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.cover-view input[type="number"]:focus,
.cover-view select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.cover-view input[type="number"].is-flash {
  border-color: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
}

/* Manuscript-pull button — secondary action, lives under the page
   count input. Outline style so it doesn't compete visually with
   the primary Reset button on the bottom row. */
.cover-view .btn-pull-manuscript {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-paper);
  color: var(--ink-1);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.cover-view .btn-pull-manuscript:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.cover-view .btn-pull-manuscript-meta {
  color: var(--ink-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Binding-pad hint — appears when the current page count isn't a
   multiple of 4. The whole chip is a button: clicking applies the
   recommended count. */
.cover-view .binding-hint {
  display: block;
  margin-top: 8px;
  padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  color: var(--ink-1);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.cover-view .binding-hint:hover {
  background: color-mix(in srgb, var(--accent-bg) 70%, var(--accent) 10%);
  border-color: var(--accent);
}
.cover-view .binding-hint::after {
  content: "Apply";
  float: right;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  font-size: 11px;
}

/* Note under the presets grid explaining that spine math uses KDP
   paper-thickness values across distributors. Small + italic so it
   reads as advisory copy, not core UI. */
.cover-view .preset-note {
  margin: 14px 0 0;
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-3);
  line-height: 1.5;
}

/* ---- Print Reference: distributor cards ---------------------- */
/* The reference tab shows one card per print-on-demand distributor
   so users can compare specs side-by-side. The grid auto-fits so
   adding a 4th or 5th card later (Lulu, BookBaby, etc.) needs no
   CSS changes — just a new <article> in the markup. */
.cover-view .distributors-overview {
  margin-bottom: 18px;
}
.cover-view .distributors-overview h2 {
  font-family: var(--font-display);
  color: var(--accent);
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}

.cover-view .distributors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.cover-view .distributor-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cover-view .distributor-card-head h3 {
  font-family: var(--font-display);
  color: var(--accent);
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.cover-view .distributor-card-head h3 small {
  color: var(--ink-3);
  font-size: 13.5px;
  font-weight: 400;
  margin-left: 4px;
}

/* Specs as a definition list — grid alignment so the label column
   and value column line up neatly across rows. */
.cover-view .distributor-specs {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  font-size: 13.5px;
  line-height: 1.45;
}
.cover-view .distributor-specs dt {
  color: var(--ink-3);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding-top: 2px;
  white-space: nowrap;
}
.cover-view .distributor-specs dd {
  margin: 0;
  color: var(--ink-1);
}

.cover-view .distributor-best-for {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}
.cover-view .distributor-best-for strong {
  color: var(--ink-1);
}

.cover-view .distributor-card .btn {
  align-self: flex-start;
  text-decoration: none;
}

/* ---- Cover-preview upload ------------------------------------ */
/* Sits below the diagram inside .coverage-area. Drag-drop area
   matches the PDF page-counter's visual register; the dimension
   status uses the same state-driven colors the save-status uses. */
/* Check Your Cover tab — the preview-upload section is now a
   top-level tab pane card (was a sub-block inside coverage-area). */
.cover-view .cover-preview-upload {
  background: var(--bg-card);
  padding: 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.cover-view .cover-preview-upload h2 {
  font-family: var(--font-display);
  color: var(--accent);
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}

/* "What we'll check" instructions block — a soft accent-tinted
   card inside the upload pane so the four checkpoints read as
   guidance, not page chrome. */
.cover-view .check-instructions {
  margin: 18px 0 22px;
  padding: 16px 20px;
  background: var(--accent-bg);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}
.cover-view .check-instructions h4 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink-1);
  font-weight: 600;
}
.cover-view .check-instructions ul {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cover-view .check-instructions li {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
}
.cover-view .check-instructions li strong {
  color: var(--ink-1);
}
.cover-view .cover-upload-area { position: relative; }
.cover-view .cover-image-input { display: none; }
.cover-view .cover-image-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  border: 2px dashed var(--accent-soft);
  border-radius: var(--radius);
  background: var(--accent-bg);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.cover-view .cover-upload-area.is-drag .cover-image-label,
.cover-view .cover-image-label:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-bg) 70%, var(--accent) 8%);
}
.cover-view .cover-image-label p {
  margin: 8px 0 4px;
  color: var(--ink-1);
  font-weight: 600;
  font-size: 14px;
}
.cover-view .cover-image-label small {
  color: var(--ink-3);
  font-size: 12px;
}

.cover-view .cover-image-loaded {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--bg-paper);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 14px;
  /* Border-left color is driven by the nested status's data-state via
     :has(), so the strip on the left matches the first line of text. */
  border-left: 4px solid var(--line-strong);
}
.cover-view .cover-image-loaded:has(.cover-image-status[data-state="ok"])   { border-left-color: var(--success); }
.cover-view .cover-image-loaded:has(.cover-image-status[data-state="warn"]) { border-left-color: var(--danger); }
.cover-view .cover-image-loaded:has(.cover-image-status[data-state="info"]) { border-left-color: var(--accent); }
.cover-view .cover-image-status {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-2);
}
.cover-view .cover-image-status span:first-child {
  font-weight: 600;
  color: var(--ink-1);
}
.cover-view .cover-image-status[data-state="ok"]   span:first-child { color: var(--success); }
.cover-view .cover-image-status[data-state="warn"] span:first-child { color: var(--danger); }
.cover-view .cover-image-status[data-state="info"] span:first-child { color: var(--accent); }

.cover-view .cover-image-error {
  margin-top: 12px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--danger) 10%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
}
.cover-view .cover-image-error p { margin: 0; }

.cover-view .fieldset-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 6px;
  margin-bottom: 18px;
}
.cover-view .fieldset-group legend {
  padding: 0 8px;
  font-weight: 600;
  color: var(--ink-2);
  font-size: 13px;
  letter-spacing: .02em;
}
.cover-view small {
  display: block;
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 12px;
}

.cover-view .form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}
.cover-view .form-actions .btn { padding: 10px 22px; }
.cover-view .cover-save-status {
  margin-left: auto;
  font-size: 12.5px;
  letter-spacing: .02em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 6em;
  text-align: right;
}
.cover-view .cover-save-status[data-state="saving"] { color: var(--accent-soft); }
.cover-view .cover-save-status[data-state="saved"]  { color: var(--success); }
.cover-view .cover-save-status[data-state="error"]  { color: var(--danger); }

.cover-view .form-error {
  margin-top: 14px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--danger) 10%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 500;
}

/* ---- Results grid --------------------------------------- */
.cover-view .results-section { margin-top: 8px; }
.cover-view .results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.cover-view .result-card {
  background: var(--bg-card);
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-1);
}
.cover-view .result-card h3 {
  color: var(--accent);
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.cover-view .result-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cover-view .result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-paper);
  border-radius: var(--radius-sm);
}
.cover-view .result-item .label {
  margin: 0;
  font-weight: 600;
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.cover-view .result-item .value {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-1);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
}
.cover-view .info-text {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--accent-bg);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 12px;
}

/* ---- Diagram canvas area -------------------------------- */
.cover-view .diagram-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 14px;
}
.cover-view .diagram-header h3 { margin: 0; }
.cover-view .canvas-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
  overflow-x: auto;
  background: #fff; /* the canvas draws with literal colors — keep white */
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px;
}
.cover-view #coverCanvas {
  max-width: 100%;
  height: auto;
  display: block;
  image-rendering: crisp-edges;
}
.cover-view .diagram-legend {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 14px;
  background: var(--bg-paper);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink-2);
}
.cover-view .legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cover-view .legend-color {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* ---- Info + tips ---------------------------------------- */
.cover-view .info-box {
  background: var(--accent-bg);
  border-left: 4px solid var(--accent);
  padding: 18px 20px;
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.cover-view .info-box h3 {
  color: var(--accent);
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}
.cover-view .info-box p {
  color: var(--ink-2);
  margin: 0;
  font-family: var(--font-serif);
  line-height: 1.55;
}

.cover-view .tips-section {
  background: var(--bg-paper);
  padding: 28px 22px;
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.cover-view .tips-section h3 {
  text-align: center;
  color: var(--accent);
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}
.cover-view .tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  max-width: 1000px;
  margin: 0 auto;
}
.cover-view .tip {
  background: var(--bg-card);
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.cover-view .tip strong {
  color: var(--ink-1);
  display: block;
  margin-bottom: 4px;
}

/* ---- Responsive ----------------------------------------- */
@media (max-width: 768px) {
  .cover-view { padding: 16px 16px 48px; }
  .cover-view .form-row,
  .cover-view .results-grid { grid-template-columns: 1fr; }
  .cover-view .form-actions { flex-direction: column; }
  .cover-view .form-actions .btn { width: 100%; }
  .cover-view .diagram-header { flex-direction: column; align-items: stretch; }
}

/* ---- Dark theme tweaks ---------------------------------- */
/* Most rules pick up dark mode for free via the design tokens.
   The canvas-container stays white on purpose (the canvas's
   drawing colors are literal and assume a light backdrop). */
:root[data-theme="dark"] .cover-view .canvas-container {
  background: #fff;
  border-color: var(--line-strong);
}
:root[data-theme="dark"] .cover-view .help-icon {
  color: var(--bg-card);
}
:root[data-theme="dark"] .cover-view .pdf-results .result-item .value {
  color: var(--success);
}
