/* Guided editor. Loaded after styles.css; the existing paper and green tokens stay in use. */
html { scroll-behavior: smooth; }
body { font-size: 17px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, .file-label { min-height: 48px; }
button:disabled { cursor: not-allowed; }
button:focus-visible, a:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 4px;
}
input, select, textarea {
  min-height: 48px;
  padding: 11px 13px;
  border-color: #8d9c8c;
  font-size: 17px;
}
input[type="checkbox"], input[type="radio"] {
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  flex: 0 0 22px;
  accent-color: var(--green);
}
input[type="range"] { min-height: 48px; accent-color: var(--green); }
textarea { min-height: 100px; }
label { font-size: 16px; line-height: 1.45; margin: 18px 0 8px; }
.hint { font-size: 16px; line-height: 1.55; }
.primary-button, .secondary-button, .small-button {
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.35;
  white-space: normal;
  text-align: center;
}
.primary-button { background: var(--green); color: white; }
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #8d9c8c;
  color: var(--green);
  background: var(--paper);
  font-weight: 700;
}
.secondary-button:hover { background: var(--soft); }
.small-button { border-color: #8d9c8c; }
.text-button { min-height: 48px; font-size: 16px; line-height: 1.4; }
.site-header {
  max-width: 1164px;
  min-height: 84px;
  padding: 16px 32px;
}
.brand { font-size: 28px; letter-spacing: -.8px; }
.site-header #helpButton { padding: 8px 0 8px 16px; }
.header-note { font-size: 16px; }

#wizard {
  width: 100%;
  max-width: 1164px;
  margin: 0 auto;
  padding: 32px 32px 48px;
}
#wizard > *, .wizard-step, .setup-layout > *, .print-layout > * { min-width: 0; }
.wizard-top { max-width: 850px; margin-bottom: 26px; }
#wizardCounter { margin: 0 0 9px; color: var(--green); font-size: 16px; font-weight: 700; }
#wizardTitle {
  font-size: clamp(30px, 3.3vw, 42px);
  line-height: 1.18;
  letter-spacing: -1px;
  margin-bottom: 12px;
}
#wizardHelp { max-width: 780px; font-size: 18px; margin: 0; color: var(--muted); }
.wizard-progress {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 32px;
  padding: 0;
}
.wizard-progress li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 12px;
  border: 1px solid #aab7a4;
  border-radius: 9px;
  background: var(--paper);
  color: var(--muted);
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.wizard-progress .progress-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid #8d9c8c;
  border-radius: 50%;
  color: var(--green);
  font-weight: 700;
}
.wizard-progress li.is-current { border-color: var(--green); background: var(--green); color: white; font-weight: 700; }
.wizard-progress li.is-current .progress-number { background: var(--paper); border-color: var(--paper); }
.wizard-progress li.is-complete { border-color: #8d9c8c; background: var(--soft); color: var(--green); }
.wizard-step { scroll-margin-top: 24px; }
#wizard .eyebrow { display: none; }
#wizard h2 { font-size: 25px; line-height: 1.25; letter-spacing: -.4px; }
#wizard h3 { font-size: 20px; line-height: 1.35; }
#wizard .section-heading { align-items: center; gap: 18px; }
#wizard .section-heading > span { font-size: 16px; }
#wizard .field-row { gap: 20px; }
.start-form {
  padding: 26px 28px 28px;
  border: 1px solid #aab7a4;
  border-radius: 14px;
  background: var(--paper);
  margin-bottom: 30px;
}
.start-form > label:first-child { margin-top: 0; }
.start-form #topic { font-size: 20px; }
.start-form .field-row { max-width: 800px; }
.start-form #newProject { margin-top: 24px; }
.start-form .hint { margin-bottom: 0; max-width: 780px; }
#wizard .examples-section { max-width: none; padding: 0; margin: 32px 0; }
#wizard .preset-grid { gap: 18px; }
#wizard .preset-card { padding: 18px; text-align: left; border-color: #aab7a4; }
#wizard .preset-card .preview-thumb { height: 180px; margin-bottom: 16px; }
#wizard .preset-card h3 { font-size: 22px; }
#wizard .preset-card p { font-size: 16px; line-height: 1.5; }
#wizard .preset-bottom { gap: 10px; flex-wrap: wrap; font-size: 15px !important; }
#wizard .preset-number { font-size: 16px; top: 26px; left: 27px; }
#wizard .example-downloads { font-size: 16px; line-height: 1.6; gap: 12px 24px; }
#projectTools, .advanced-settings, .figure-extra {
  border: 1px solid #aab7a4;
  background: var(--paper);
  border-radius: 9px;
}
#projectTools { margin: 24px 0 0; padding: 0 20px 16px; }
#projectTools:not([open]) { padding-bottom: 0; }
#projectTools > summary, .advanced-settings > summary, .figure-extra > summary {
  min-height: 52px;
  padding: 13px 0;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
}
#projectTools .project-tools { margin-top: 12px; }
#projectTools .project-tools > * { flex-grow: 1; }
#projectTools #saveStatus { margin-bottom: 0; }

#wizard .images-section { padding-top: 0; }
#wizard .figure-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
#wizard .figure-card { padding: 18px; border-color: #aab7a4; border-radius: 12px; }
#wizard .figure-image { height: 190px; margin: 0 0 16px; }
#wizard .figure-image img { height: 180px; max-height: 100%; width: 100%; object-fit: contain; }
#wizard .figure-card label { font-size: 16px; margin: 16px 0 8px; }
#wizard .figure-card input, #wizard .figure-card select, #wizard .figure-card textarea { font-size: 17px; padding: 10px 12px; }
#wizard .figure-card input[type="range"] { padding: 0; }
#wizard .figure-controls { gap: 10px; margin: 16px 0 0; }
#wizard .figure-controls button { font-size: 16px; min-height: 48px; padding: 10px; }
#wizard .figure-controls [data-action="change-image"] { border: 1px solid #8d9c8c; border-radius: 7px; background: var(--soft); }
#wizard .order-buttons { gap: 4px; flex-wrap: wrap; }
#wizard .order-buttons button { min-width: 44px; }
#wizard .figure-extra { padding: 0 12px 12px; margin-top: 16px; }
#wizard .figure-extra:not([open]) { padding-bottom: 0; }
#wizard .figure-extra > summary { font-weight: 400; }
#wizard .source-note { font-size: 14px; line-height: 1.5; }

.setup-layout, .print-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.book-settings, .print-guide {
  padding: 22px;
  border: 1px solid #aab7a4;
  border-radius: 12px;
  background: var(--paper);
}
.book-settings > label:first-child { margin-top: 0; }
.book-settings .label-row { align-items: center; }
.book-settings .label-row .text-button { font-size: 15px; }
.book-settings .field-row { grid-template-columns: 1fr; gap: 0; }
.advanced-settings { padding: 0 14px 14px; margin-top: 22px; }
.advanced-settings:not([open]) { padding-bottom: 0; }
#wizard .composition-section { padding: 0; margin: 0; background: none; border: 0; border-radius: 0; }
#wizard .composition-section .section-heading { align-items: center; }
#wizard .composition-section .section-heading button { max-width: 210px; font-size: 16px; }
#wizard .composition-section > .hint { margin-bottom: 20px; }
#wizard .module-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
#wizard .module-card { border-color: #aab7a4; border-radius: 10px; }
#wizard .module-card summary { min-height: 104px; padding: 14px; gap: 12px; }
#wizard .module-mini { width: 64px; height: 72px; background: var(--soft); }
#wizard .module-mini svg { width: 60px; height: 66px; }
#wizard .module-card summary strong { font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
#wizard .module-card summary small { font-size: 15px; }
#wizard .module-card summary::after { font-size: 22px; flex-shrink: 0; }
#wizard .module-details { padding: 16px; }
#wizard .module-details label, #wizard .module-details .hint { font-size: 16px; }
#wizard .module-details input, #wizard .module-details select, #wizard .module-details textarea { font-size: 16px; padding: 10px; }
#wizard .module-images { display: grid; grid-template-columns: 1fr; gap: 6px; }
#wizard .module-images label { min-height: 46px; margin: 0; padding: 9px 10px; gap: 10px; }
#wizard .module-images input { width: 22px; height: 22px; min-height: 22px; margin: 0; padding: 0; }
#wizard .module-actions { flex-wrap: wrap; gap: 6px; margin-top: 14px; }
#wizard .module-actions button { min-width: 44px; min-height: 46px; font-size: 16px; padding: 9px; }
#wizard #moduleCount { margin: 16px 0 10px; }
#activityChoice { padding: 14px 16px; border-left: 3px solid var(--green); background: var(--soft); font-size: 16px; margin: 18px 0; }

.print-guide h2 { margin-bottom: 12px; }
#printSummary { font-size: 17px; overflow-wrap: anywhere; }
.print-steps { padding-left: 24px; font-size: 16px; }
.print-steps li { padding-left: 4px; margin-bottom: 14px; }
#wizard .print-guide .download-strip { display: block; padding: 0 0 20px; margin-bottom: 20px; }
#wizard .download-strip strong { font-size: 18px; }
#wizard .download-strip p { font-size: 16px; line-height: 1.55; }
#wizard #downloadPdf { width: 100%; min-height: 56px; margin-top: 16px; font-size: 18px; }
#wizard .preview-tabs { gap: 8px; margin-top: 0; }
#wizard .preview-tabs button { flex: 1; padding: 12px 8px; min-height: 56px; font-size: 16px; line-height: 1.35; }
#wizard .preview-tabs button:not([aria-selected="true"]) { color: var(--muted); }
#wizard .preview-stage { min-height: 380px; margin-top: 18px; padding: 16px; border-color: #aab7a4; }
#wizard .preview-stage .render-preview { min-width: 0; }
#wizard .preview-stage svg { max-width: 100%; height: auto; }
#wizard .preview-stage .render-preview svg { max-height: 700px; }
#wizard .render-caption, #wizard .module-preview-label, #wizard .module-source-note { font-size: 16px; }
#wizard #changeHero { text-align: left; }
#wizard .empty-figures { font-size: 17px; line-height: 1.6; border-color: #8d9c8c; background: var(--paper); }
#wizardMessageWrap { scroll-margin-top: 20px; }
#wizardMessageWrap .status, #wizardMessageWrap .error { font-size: 16px; line-height: 1.5; padding: 14px 18px; border: 1px solid #aab7a4; margin: 0 0 22px; }
#wizardMessageWrap .error { border-color: var(--orange); }

.wizard-nav {
  position: sticky;
  bottom: 0;
  z-index: 20;
  width: 100%;
  display: block;
  margin: 0;
  padding: 0;
  border-top: 1px solid #8d9c8c;
  background: var(--paper);
  box-shadow: 0 -4px 18px #263e350a;
}
.wizard-nav-inner {
  max-width: 1164px;
  width: 100%;
  margin: auto;
  padding: 16px 32px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
}
#wizardBack { grid-column: 1; grid-row: 1; min-width: 130px; }
#wizardNavHint { grid-column: 2; grid-row: 1; font-size: 16px; line-height: 1.4; color: var(--muted); text-align: center; }
#wizardNext { grid-column: 3; grid-row: 1; min-width: 175px; }

/* Dialogs keep the existing real drawings and original technical pattern previews. */
dialog { width: min(1060px, calc(100% - 48px)); max-height: calc(100dvh - 48px); padding: 28px; font-size: 16px; overscroll-behavior: contain; }
dialog h2 { font-size: 26px; line-height: 1.25; }
dialog .eyebrow { display: none; }
dialog .hint, dialog label, dialog input, dialog select, dialog textarea { font-size: 16px; }
dialog .icon-button { min-width: 48px; min-height: 48px; }
dialog .dialog-heading { margin-bottom: 16px; }
dialog .small-button, dialog .text-button { min-height: 44px; font-size: 16px; }
.template-dialog { width: min(1100px, calc(100% - 48px)); max-width: 1100px; max-height: calc(100dvh - 48px); padding: 28px; }
.library-tabs { gap: 18px; margin-bottom: 22px; }
.library-tabs button { min-height: 52px; font-size: 17px; line-height: 1.3; text-align: left; }
.template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.template-card { padding: 18px; border-color: #aab7a4; }
.template-art { min-height: 150px; height: auto; padding: 10px; }
.template-art svg { width: 100%; max-width: 100%; height: 140px; }
.template-card h3 { font-size: 20px; }
.template-card p, .template-card .hint, .template-card .template-reference { font-size: 16px; line-height: 1.45; }
.template-card .small-button { font-size: 16px; min-height: 48px; }
.native-library-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin: 20px 0 4px; }
.native-library-count { margin: 0; font-size: 16px; color: var(--muted); }
.native-library-toggle { min-height: 48px; font-size: 16px; }
.template-details { width: 100%; margin: 6px 0 14px; border-top: 1px solid var(--line); }
.template-details > summary { min-height: 48px; padding: 12px 0; color: var(--green); font-size: 16px; cursor: pointer; }
.template-details .template-reference { margin-bottom: 10px; }
#wizard .module-edit-label { display: block; margin-top: 7px; color: var(--green); font-size: 15px; font-weight: 700; }
#wizard .module-advanced, #wizard .module-mounting { padding: 0 12px 12px; margin: 14px 0; border: 1px solid #aab7a4; border-radius: 8px; }
#wizard .module-advanced:not([open]), #wizard .module-mounting:not([open]) { padding-bottom: 0; }
#wizard .module-advanced > summary, #wizard .module-mounting > summary { display: list-item; min-height: 50px; padding: 12px 0; color: var(--green); font-size: 16px; font-weight: 700; }
#wizard .module-advanced > summary::after, #wizard .module-mounting > summary::after { content: none; }
.module-difficulty { font-size: 14px; padding: 4px 8px; }
.source-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.source-card { padding: 17px; border-color: #aab7a4; }
.source-card h3 { font-size: 19px; line-height: 1.35; }
.source-card p, .source-card .hint, .source-card a { font-size: 16px; line-height: 1.45; }
.source-access { display: inline-block; font-size: 14px; line-height: 1.4; }
.source-native-button { font-size: 16px; min-height: 48px; }
.source-filters { gap: 20px; }
.catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; max-height: 52dvh; }
.catalog-card { padding: 14px; font-size: 17px; border-color: #aab7a4; }
.catalog-card img { height: 130px; }
.catalog-card small { font-size: 14px; line-height: 1.4; }
.upload-box { font-size: 17px; }
#helpDialog { max-width: 760px; }
#helpDialog li, #helpDialog p { font-size: 17px; line-height: 1.6; margin-bottom: 16px; }

@media (max-width: 1000px) {
  #wizard .figure-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-layout, .print-layout { grid-template-columns: 270px minmax(0, 1fr); gap: 20px; }
  #wizard .module-list { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #wizard .preset-card .preview-thumb { height: 150px; }
  #wizard .preset-card h3 { font-size: 20px; }
}

@media (max-width: 760px) {
  .site-header { min-height: 76px; padding: 12px 20px; gap: 12px; }
  .brand { font-size: 25px; }
  .site-header #helpButton { max-width: 145px; font-size: 16px; text-align: right; padding-left: 8px; }
  #wizard { padding: 24px 20px 32px; }
  .wizard-top { margin-bottom: 22px; }
  #wizardTitle { font-size: 31px; letter-spacing: -.6px; }
  #wizardHelp { font-size: 17px; }
  .wizard-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 26px; }
  .wizard-progress li { min-height: 62px; padding: 10px; gap: 8px; font-size: 16px; }
  .wizard-progress .progress-number { width: 28px; height: 28px; flex-basis: 28px; }
  #wizard h2 { font-size: 24px; }
  #wizard .section-heading { align-items: flex-start; flex-direction: column; }
  #wizard .section-heading > span { display: block; }
  .start-form { padding: 22px 18px; margin-bottom: 26px; }
  #wizard .field-row { grid-template-columns: 1fr; gap: 0; }
  .start-form #newProject { width: 100%; }
  #wizard .preset-grid { grid-template-columns: 1fr; gap: 16px; }
  #wizard .preset-card { padding: 18px; }
  #wizard .preset-card .preview-thumb { height: 195px; }
  #wizard .preset-card h3 { font-size: 23px; }
  #wizard .preset-bottom > span:last-child { display: inline; }
  #wizard .example-downloads { flex-direction: column; gap: 12px; }
  #projectTools { padding-right: 16px; padding-left: 16px; }
  #projectTools .project-tools { flex-direction: column; }
  #wizard .figure-grid { grid-template-columns: 1fr; gap: 18px; }
  #wizard .figure-image { height: 210px; }
  #wizard .figure-image img { height: 200px; }
  #wizard .figure-card { padding: 18px; }
  .setup-layout, .print-layout { grid-template-columns: 1fr; gap: 24px; }
  .book-settings, .print-guide { padding: 20px; }
  #wizard .composition-section .section-heading button { max-width: none; width: 100%; }
  #wizard .module-list { grid-template-columns: 1fr; }
  #wizard .module-card summary { min-height: 102px; }
  #wizard .preview-tabs { gap: 4px; }
  #wizard .preview-tabs button { padding: 12px 5px; font-size: 16px; }
  #wizard .preview-stage { padding: 10px; min-height: 260px; }
  #wizard .print-guide .download-strip { align-items: stretch; }
  .wizard-nav { text-align: left; }
  .wizard-nav-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; padding: 12px 20px max(12px, env(safe-area-inset-bottom)); }
  #wizardNavHint { grid-column: 1 / -1; grid-row: 1; font-size: 15px; }
  #wizardBack { grid-column: 1; grid-row: 2; min-width: 0; }
  #wizardNext { grid-column: 2; grid-row: 2; min-width: 0; }
  dialog, .template-dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); padding: 18px; border-radius: 12px; }
  dialog h2 { font-size: 24px; }
  .library-tabs { gap: 12px; }
  .library-tabs button { flex: 1; padding: 12px 0; font-size: 16px; }
  .template-grid, .source-grid { grid-template-columns: 1fr; gap: 16px; }
  .template-card { padding: 18px; }
  .native-library-controls { align-items: stretch; flex-direction: column; }
  .native-library-toggle { width: 100%; }
  .template-art { min-height: 170px; }
  .template-art svg { height: 160px; }
  .source-filters { grid-template-columns: 1fr; gap: 0; }
  .source-card { padding: 18px; }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 5px 2px; }
  .catalog-card { padding: 10px; }
  .catalog-card img { height: 110px; }
  .search-row { flex-wrap: wrap; }
  .search-row input { flex-basis: 100%; }
  .search-row .small-button { width: 100%; min-height: 48px; font-size: 16px; padding: 12px; }
  .upload-box { align-items: stretch; flex-direction: column; }
  .upload-box .file-label { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.resume-panel { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:20px; margin-bottom:24px; border:1px solid #8d9c8c; border-radius:10px; background:var(--soft); }
.resume-panel p { margin:0; }
.resume-panel button { flex-shrink:0; }
.lapbook-definition { max-width:850px; font-size:17px; line-height:1.65; }
.sample-downloads { margin-top:24px; }
.sample-downloads > summary { padding:12px 0; min-height:48px; cursor:pointer; color:var(--green); }
.answers-panel { margin-top:28px; padding:22px; border:1px solid #aab7a4; border-radius:12px; background:var(--paper); }
.answers-panel:empty { display:none; }
.answer-list { display:grid; gap:12px; }
.answer-row { display:flex; gap:14px; align-items:center; padding:12px 0; border-top:1px solid var(--line); flex-wrap:wrap; }
.answer-row img { width:58px; height:64px; object-fit:contain; }
.answer-row > span { flex:1; min-width:100px; overflow-wrap:anywhere; font-weight:700; }
.answer-choice { margin:0; width:210px; max-width:100%; }
.answer-choice select { margin-top:6px; }
.answer-order { display:flex; gap:8px; flex-wrap:wrap; }
.answer-order button { padding:10px 12px; border:1px solid #8d9c8c; background:var(--soft); color:var(--green); border-radius:7px; }
#downloadResult { color:var(--green); overflow-wrap:anywhere; }
@media(max-width:760px) { .resume-panel { flex-direction:column; align-items:stretch; } .answers-panel { padding:18px; } .answer-choice { width:100%; } .answer-order { width:100%; } }

/* Keep the hosting credit visible in the footer, away from the navigation. */
#nl-badge-frame { position:relative !important; bottom:auto !important; right:auto !important; display:block; margin:12px 16px 16px auto !important; max-width:calc(100% - 32px); }
