.v9-featured { padding-top: 8px; }
.v9-feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.v9-feature { display: grid; align-content: start; gap: 8px; min-height: 190px; border-left: 4px solid var(--accent); }
.v9-feature h3 { margin: 0; font-size: 22px; }
.v9-feature p { margin: 0; }
.v9-index { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.v9-link { margin-top: 8px; color: var(--accent); font-weight: 750; }
.v8-secondary { padding-top: 8px; }

.tool-page { max-width: 1160px; }
.tool-page .nav { margin-bottom: 0; }
.tool-page .hero { padding-bottom: 18px; }
.tool-page main { padding-bottom: 8px; }
.tool-page .card h2 { color: var(--ink); }
.tool-page .hint { margin: 0; }

/* Screenshot tool */
.image-tool-shell { display: grid; gap: 18px; }
.upload-zone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 170px;
  padding: 24px;
  overflow: hidden;
  border: 2px dashed #91aa98;
  border-radius: 15px;
  background: color-mix(in srgb, var(--soft) 68%, var(--panel));
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.upload-zone:hover, .upload-zone.is-dragging, .upload-zone:focus-within { border-color: var(--accent); background: var(--soft); }
.upload-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 3px; border-radius: 50%; background: var(--accent); color: white; font-size: 25px; line-height: 1; }
.upload-title { font-size: 17px; font-weight: 750; }
.upload-caption { color: var(--muted); font-size: 13px; font-weight: 400; }
.upload-input { position: absolute; inset: 0; width: 100% !important; height: 100%; padding: 0 !important; opacity: 0; cursor: pointer; }
.upload-help { margin-top: 10px !important; }
.image-selection { display: grid; gap: 12px; }
.image-selection-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.image-selection-heading h2 { font-size: 20px; }
.image-list { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.image-item { display: grid; grid-template-columns: 92px minmax(0,1fr) auto; gap: 13px; align-items: center; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.image-thumb { display: block; width: 92px; height: 78px; object-fit: contain; background: var(--soft); border-radius: 8px; }
.image-name { overflow-wrap: anywhere; font-size: 14px; font-weight: 650; }
.image-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.image-actions .btn { min-height: 40px; padding: 6px 10px; font-size: 13px; }
.export-settings { display: grid; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: color-mix(in srgb, var(--soft) 38%, var(--panel)); }
.export-settings h2 { font-size: 20px; }
.export-settings label { display: block; margin: 8px 0 5px; font-size: 14px; }
.export-settings .hint { margin-top: 6px; }
.image-actions-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.image-actions-row .btn.primary { min-height: 50px; padding-inline: 22px; }
.image-secondary-note { margin-top: 14px !important; }
.image-result { margin-top: 18px; }
.image-result .sectionhead { margin-bottom: 8px; }
.result-image { display: block; max-width: 100%; max-height: 70vh; margin: 14px auto 0; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: white; }

/* Study workbench: editor on the left, TOC and rendered material on the right. */
.study-workbench { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 16px; align-items: start; }
.study-editor { display: grid; gap: 13px; }
.study-editor label { display: block; }
.study-input { width: 100%; min-height: 540px !important; resize: vertical; padding: 14px !important; border-color: var(--line) !important; border-radius: 11px !important; background: var(--panel) !important; color: var(--ink) !important; font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important; font-size: 13px !important; line-height: 1.65 !important; }
.study-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.study-actions .btn.primary { min-height: 48px; padding-inline: 20px; }
.study-output { display: grid; grid-template-columns: minmax(145px, .42fr) minmax(0, 1fr); gap: 13px; align-items: start; min-width: 0; }
.study-toc { position: sticky; top: 12px; max-height: 72vh; overflow: auto; padding: 16px; }
.study-toc h2 { font-size: 18px; }
.study-toc .sectionhead { margin-bottom: 10px; }
.study-toc ol { margin: 0; padding-left: 19px; }
.study-toc li { margin: 6px 0; font-size: 13px; line-height: 1.45; }
.study-toc a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 38%, transparent); text-underline-offset: 3px; overflow-wrap: anywhere; }
.study-toc .toc-level-3, .study-toc .toc-level-4, .study-toc .toc-level-5, .study-toc .toc-level-6 { margin-left: 10px; }
.study-preview { min-width: 0; min-height: 540px; overflow-wrap: anywhere; }
.study-preview > :first-child { margin-top: 0; }
.study-preview h1, .study-preview h2, .study-preview h3, .study-preview h4, .study-preview h5, .study-preview h6 { color: var(--ink); letter-spacing: normal; line-height: 1.3; scroll-margin-top: 18px; }
.study-preview h1 { margin: .7em 0 .45em; font-size: 30px; }
.study-preview h2 { margin: 1.05em 0 .5em; font-size: 24px; }
.study-preview h3 { margin: .9em 0 .45em; font-size: 19px; }
.study-preview p, .study-preview li { color: var(--ink); }
.study-preview pre { overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); color: var(--ink); }
.study-preview code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.study-preview :not(pre) > code { padding: .08em .3em; border-radius: 4px; background: var(--soft); }
.study-preview a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.study-preview blockquote { margin: 1em 0; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.study-table-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.study-preview table { width: 100%; min-width: 0; border-collapse: collapse; font-size: 14px; }
.study-preview th, .study-preview td { padding: 8px; border: 1px solid var(--line); text-align: left; }
.study-preview th { background: var(--soft); color: var(--ink); }
.study-preview td { color: var(--ink); }
.study-preview img { max-width: 100%; }
.print-only { display: none; }

@media (max-width: 960px) {
  .study-workbench { grid-template-columns: minmax(0,1fr); }
  .study-input { min-height: 340px !important; }
  .study-output { grid-template-columns: minmax(145px,.42fr) minmax(0,1fr); }
  .study-preview { min-height: 300px; }
}
@media (max-width: 720px) {
  .v9-feature-grid { grid-template-columns: minmax(0,1fr); }
  .v9-feature { min-height: 0; }
  .tool-page .hero { padding-top: 22px; }
  .upload-zone { min-height: 148px; padding: 20px 14px; }
  .image-item { grid-template-columns: 72px minmax(0,1fr); gap: 10px; }
  .image-thumb { width: 72px; height: 66px; }
  .image-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .image-actions .btn { flex: 1 1 auto; }
  .export-settings { padding: 14px; }
  .image-actions-row { align-items: stretch; }
  .image-actions-row .btn.primary { width: 100%; }
  .study-output { grid-template-columns: minmax(0,1fr); }
  .study-toc { position: static; max-height: none; }
  .study-input { min-height: 280px !important; }
  .study-preview { min-height: 220px; }
}
@media (max-width: 390px) {
  .image-actions .btn { padding-inline: 7px; font-size: 12px; }
}

@page { size: A4; margin: 16mm; }
@media print {
  :root { color-scheme: light; --bg:#fff; --panel:#fff; --line:#bbb; --ink:#111; --muted:#333; --accent:#111; --soft:#f2f2f2; --shadow:none; }
  html, body { width:auto; min-width:0; background:#fff !important; color:#111 !important; font-size:10.5pt; }
  .wrap { width:auto; max-width:none; margin:0; padding:0; }
  .nav, .hero, .screen-controls, .study-editor, .study-toc, .no-print, footer, .skip-link { display:none !important; }
  .tool-page main { margin:0; padding:0; }
  .study-workbench, .study-output { display:block; }
  .print-only { display:block; margin:0 0 8mm; color:#444; font-size:9pt; }
  .study-preview { display:block; width:auto; min-height:0; margin:0; padding:0; border:0; border-radius:0; background:#fff; box-shadow:none; overflow:visible; }
  .study-preview h1, .study-preview h2, .study-preview h3, .study-preview h4 { break-after:avoid; }
  .study-preview p, .study-preview li, .study-preview blockquote { orphans:3; widows:3; }
  .study-preview pre, .study-preview table, .study-preview blockquote { break-inside:avoid; }
  .study-table-wrap { overflow:visible; border:0; }
  .study-preview table { font-size:9pt; }
  .study-preview th, .study-preview td { padding:4px; }
  a { color:#111 !important; text-decoration:none !important; }
}
