/* Multipage worksheet UI ported from the user-supplied 2026-09-20 build.
   Character controls/assets are intentionally not part of this stylesheet. */

.add-page-btn {
  width: 100%;
  margin-top: 14px;
  background: var(--theme-primary, var(--accent));
  color: #ffffff;
}

body[data-color-theme="basic"] .add-page-btn {
  background: linear-gradient(135deg, var(--basic-button-gold-dark), var(--basic-gold)) !important;
  color: var(--basic-button-text) !important;
}

.add-page-btn:disabled {
  cursor: default;
  opacity: .45;
  transform: none;
  filter: none;
}

/* Keep the preview surface flat. Older theme layers add large shadows/blur. */
.preview-wrap,
body[data-theme="bw"] .preview-wrap {
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.preview-shell {
  min-width: 960px;
}

/* Reserve a real column for page navigation instead of overlapping the A4 sheet.
   Both page-name reset and page tiles share the same vertical center line. */
.preview-content {
  position: relative;
  display: grid;
  grid-template-columns: minmax(max(794px, calc(794px * var(--preview-zoom, 1))), 1fr) 122px;
  align-items: start;
  column-gap: 24px;
}

.page-stage {
  grid-area: 1 / 1;
  min-width: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* Preview-only anti-copy overlay. It is intentionally excluded from print/PDF output. */
.preview-wrap .page {
  position: relative;
  overflow: hidden;
  box-shadow: none !important;
}

.preview-wrap .page::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='84' viewBox='0 0 180 84'%3E%3Cg transform='translate(90 42) rotate(-34)'%3E%3Ctext x='0' y='8' text-anchor='middle' font-family='Arial%2C sans-serif' font-size='28' font-weight='800' letter-spacing='1' fill='%23000000' fill-opacity='0.20'%3ELocrian%3C/text%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 150px 70px;
}

body.print-question .preview-wrap .page::after,
body.print-answer .preview-wrap .page::after,
body.print-both .preview-wrap .page::after {
  display: none;
}

.page-list {
  grid-area: 1 / 2;
  justify-self: stretch;
  position: sticky;
  top: 72px;
  z-index: 3;
  align-self: start;
  width: 122px;
  min-width: 122px;
  max-width: 122px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  gap: 10px;
  max-height: calc(100vh - 132px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 4px 10px;
  scrollbar-width: thin;
}

.page-list:empty {
  display: none;
}

.page-list::-webkit-scrollbar { width: 7px; }
.page-list::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}

.page-thumb {
  position: relative;
  width: 68px;
  min-width: 68px;
  max-width: 68px;
  height: 68px;
  min-height: 68px;
  flex: 0 0 68px;
  padding: 0;
  border: 2px solid var(--page-group-border, var(--line));
  border-radius: 12px;
  background: var(--page-group-bg, #ffffff);
  color: var(--page-group-ink, var(--ink));
  box-shadow: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  outline: none;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}

.page-thumb:hover {
  transform: none;
  filter: none;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--page-group-border, #aaa) 70%, #111 30%);
}

.page-list.is-reordering,
.page-list.is-reordering .page-thumb {
  cursor: grabbing;
  user-select: none;
}

.page-thumb.is-dragging {
  opacity: .36;
  cursor: grabbing;
}

.page-thumb:focus-visible {
  box-shadow: 0 0 0 3px rgba(17,17,17,.20);
}

.page-thumb.is-active,
body[data-color-theme="basic"] .page-thumb.is-active {
  border-style: solid;
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(17,17,17,.20), inset 0 0 0 1px #111;
  color: #111;
}

.page-thumb.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 999px;
  background: #111;
}

.page-thumb-delete {
  position: absolute;
  top: -5px;
  right: -5px;
  z-index: 3;
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #555;
  box-shadow: 0 1px 5px rgba(0,0,0,.12);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.page-thumb-delete:hover {
  transform: none;
  filter: none;
  background: #f4f4f4;
  color: #111;
}

.page-thumb-label {
  width: 58px;
  min-width: 0;
  height: 28px;
  box-sizing: border-box;
  padding: 4px 8px;
  border: 1px solid rgba(17,17,17,.10);
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  color: inherit;
  font: inherit;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: -.02em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  outline: none;
  cursor: text;
  box-shadow: 0 1px 2px rgba(17,17,17,.06), inset 0 1px 0 rgba(255,255,255,.65);
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}

.page-thumb-label:hover {
  border-color: rgba(17,17,17,.22);
  background: rgba(255,255,255,.92);
  box-shadow: 0 2px 5px rgba(17,17,17,.08);
}

.page-thumb-label:focus {
  border-color: #111;
  background: #fff;
  color: #111;
  box-shadow: 0 0 0 3px rgba(17,17,17,.10), 0 2px 6px rgba(17,17,17,.08);
}

.page-add-tile {
  width: 68px;
  min-width: 68px;
  max-width: 68px;
  height: 68px;
  min-height: 68px;
  flex: 0 0 68px;
  padding: 7px 5px;
  border: 1px dashed #a9a9a9;
  border-radius: 12px;
  background: #fff;
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  box-shadow: none;
}

.page-add-tile:hover:not(:disabled) {
  border-color: #111;
  background: #f7f7f7;
  color: #111;
}

.page-add-tile:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(17,17,17,.16);
}

.page-add-tile:disabled {
  opacity: .38;
  cursor: default;
}

.page-add-plus {
  font-size: 24px;
  font-weight: 500;
  line-height: .9;
}

.page-add-label {
  font-size: 9px;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .preview-shell { min-width: 920px; }
  .page-list { max-height: 760px; }
}

@media print {
  /* The three-line rights notice belongs to the screen preview only. */
  [data-copyright-watermark="1"] {
    display: none !important;
  }

  .generator-runtime-error { display: none !important; }
  .preview-wrap .page::after {
    display: none !important;
  }

  .page-list,
  .add-page-btn {
    display: none !important;
  }

  .preview-content,
  .page-stage {
    display: block !important;
    width: 210mm !important;
    min-width: 0 !important;
    max-width: 210mm !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* ===== Locrian editorial generator UI =====
   Presentation-only layer: control IDs/values and worksheet SVG stay unchanged. */

:root {
  --editorial-bg: #f5f5f3;
  --editorial-panel: #ffffff;
  --editorial-ink: #111111;
  --editorial-muted: #6d6d6d;
  --editorial-line: #dedede;
  --editorial-soft: #f2f2f0;
}

body,
body[data-theme="pastel"],
body[data-theme="bw"],
body[data-color-theme="basic"],
body[data-color-theme="pastelPink"],
body[data-color-theme="pastelBlue"],
body[data-color-theme="pastelPurple"] {
  color: var(--editorial-ink) !important;
  background: var(--editorial-bg) !important;
}

.app {
  width: min(1720px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 460px) minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  align-items: start;
}

body .app .controls,
body[data-theme="bw"] .app .controls,
body[data-color-theme="basic"] .app .controls {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  overflow: auto;
  padding: 24px;
  background: var(--editorial-panel) !important;
  border: 1px solid var(--editorial-line) !important;
  border-radius: 18px;
  box-shadow: none !important;
  backdrop-filter: none !important;
  color: var(--editorial-ink) !important;
}

.controls::-webkit-scrollbar,
.preview-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.controls::-webkit-scrollbar-thumb,
.preview-wrap::-webkit-scrollbar-thumb,
body[data-color-theme="basic"] .controls::-webkit-scrollbar-thumb,
body[data-color-theme="basic"] .preview-wrap::-webkit-scrollbar-thumb {
  background: #bdbdbd !important;
  border-radius: 999px;
}

body .app .controls .brand,
body[data-theme="bw"] .app .controls .brand,
body[data-color-theme="basic"] .app .controls .brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 0 0 22px;
  overflow: visible;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1px solid var(--editorial-line) !important;
  border-radius: 0;
  box-shadow: none !important;
}

.app .controls .brand::before {
  content: "CREATE WORKSHEET";
  grid-column: 1 / -1;
  order: -1;
  margin-bottom: -2px;
  color: #8a8a8a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2em;
}
.app .controls .brand::after { display: none !important; }

body .app .controls .brand-logo,
body[data-color-theme="basic"] .app .controls .brand-logo {
  width: 48px !important;
  height: 48px !important;
  flex: 0 0 48px !important;
  display: block;
  object-fit: contain;
  transform: none !important;
  filter: grayscale(1) contrast(1.04);
}

body .app .controls .brand h1,
body[data-theme="bw"] .app .controls .brand h1,
body[data-color-theme="basic"] .app .controls .brand h1 {
  margin: 0;
  color: var(--editorial-ink) !important;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.055em;
}

body .app .controls .setting-group,
body[data-theme="bw"] .app .controls .setting-group,
body[data-color-theme="basic"] .app .controls .setting-group {
  margin: 0;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1px solid var(--editorial-line) !important;
  border-radius: 0;
  box-shadow: none !important;
  overflow: visible;
}

.app .controls .setting-group > summary {
  min-height: 58px;
  padding: 19px 0 17px;
  color: var(--editorial-ink) !important;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.025em;
}

.app .controls .setting-group > summary::after,
body[data-theme="bw"] .app .controls .setting-group > summary::after,
body[data-color-theme="basic"] .app .controls .setting-group > summary::after {
  width: 25px;
  height: 25px;
  background: transparent !important;
  border: 1px solid #cfcfcf;
  color: #555 !important;
  font-weight: 500;
}
.app .controls .setting-group > summary:hover,
.app .controls .setting-group > summary:hover::after { color: #111 !important; }

.app .controls .setting-group-body {
  padding: 0 0 18px;
  border: 0;
}

body .app .controls .field,
body[data-theme="bw"] .app .controls .field {
  margin: 0;
  padding: 13px 0;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
}

.app .controls label.title,
body[data-color-theme="basic"] .app .controls label.title {
  margin-bottom: 8px;
  color: #242424 !important;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.015em;
}

.app .controls .hint,
body[data-color-theme="basic"] .app .controls .hint,
.app .controls .row-range-label {
  color: var(--editorial-muted) !important;
  font-size: 11px;
  line-height: 1.5;
}

body .app .controls select,
body .app .controls input[type="text"],
body .app .controls input[type="number"],
body[data-theme="bw"] .app .controls select,
body[data-theme="bw"] .app .controls input[type="text"],
body[data-theme="bw"] .app .controls input[type="number"],
body[data-color-theme="basic"] .app .controls select,
body[data-color-theme="basic"] .app .controls input[type="text"],
body[data-color-theme="basic"] .app .controls input[type="number"] {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--editorial-ink) !important;
  background: #fff !important;
  border: 1px solid #cfcfcf !important;
  border-radius: 9px;
  box-shadow: none !important;
  font-size: 13px;
}

body .app .controls select:hover,
body .app .controls input[type="text"]:hover,
body .app .controls input[type="number"]:hover { border-color: #8e8e8e !important; }
body .app .controls select:focus,
body .app .controls input:focus {
  border-color: #111 !important;
  box-shadow: 0 0 0 2px rgba(0,0,0,.08) !important;
  outline: none;
}

.app .controls .radio-list { gap: 6px; }
.app .controls .radio-list label {
  min-height: 40px;
  padding: 9px 10px;
  color: #262626;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 9px;
  box-shadow: none;
}

.app .controls input[type="radio"],
.app .controls input[type="checkbox"],
body[data-theme="bw"] .app .controls input[type="radio"],
body[data-theme="bw"] .app .controls input[type="checkbox"],
body[data-color-theme="basic"] .app .controls input[type="radio"],
body[data-color-theme="basic"] .app .controls input[type="checkbox"] { accent-color: #111 !important; }

.app .controls .check-list { gap: 4px; }
.app .controls .check-row,
body[data-theme="bw"] .app .controls .check-row,
body[data-color-theme="basic"] .app .controls .check-row {
  min-height: 36px;
  padding: 4px 0;
  color: #252525 !important;
  font-size: 12px;
  font-weight: 650;
}

.app .controls .row-range-list { gap: 7px; }
.app .controls .row-range-item {
  grid-template-columns: 112px minmax(0, 1fr) !important;
  gap: 9px;
}

.app .controls .account-license-card,
.app .controls .branding-item {
  background: #fafafa !important;
  border: 1px solid #dddddd !important;
  border-radius: 11px !important;
  box-shadow: none !important;
}
.app .controls .branding-preview-wrap {
  background: #fff !important;
  border-color: #dedede !important;
}
.app .controls .branding-preview { filter: grayscale(1); }

.app .controls .branding-button,
.app .controls .branding-reset,
.app .controls .ghost,
.app .controls .reset-settings-btn,
.app .controls .add-page-btn,
.app .controls .primary,
.app .controls .print-main,
.app .controls .print-option,
body[data-theme="bw"] .app .controls .primary,
body[data-color-theme="basic"] .app .controls .primary,
body[data-color-theme="basic"] .app .controls .print-main {
  min-height: 42px;
  border-radius: 9px;
  border: 1px solid #cfcfcf !important;
  background: #fff !important;
  color: #111 !important;
  box-shadow: none !important;
  font-weight: 750;
}

.app .controls .branding-button:hover,
.app .controls .ghost:hover,
.app .controls .reset-settings-btn:hover,
.app .controls .add-page-btn:hover,
.app .controls .print-main:hover,
.app .controls .print-option:hover { background: #f3f3f3 !important; }

.app .controls .add-page-btn { margin-top: 18px; }
.app .controls .compact-actions { gap: 8px; margin-top: 9px; }
.app .controls .primary,
body[data-theme="bw"] .app .controls .primary,
body[data-color-theme="basic"] .app .controls .primary {
  background: #111 !important;
  border-color: #111 !important;
  color: #fff !important;
}
.app .controls .primary:hover { background: #2a2a2a !important; }
.app .controls .reset-settings-btn { margin-top: 8px; color: #555 !important; }

.app .controls .print-menu,
body[data-theme="bw"] .app .controls .print-menu {
  padding: 6px;
  background: #fff !important;
  border: 1px solid #d6d6d6 !important;
  border-radius: 11px;
  box-shadow: 0 12px 30px rgba(0,0,0,.10) !important;
}

/* Preview shell only. The worksheet/answer SVG itself is deliberately untouched. */
body .app .preview-wrap,
body[data-theme="bw"] .app .preview-wrap,
body[data-color-theme="basic"] .app .preview-wrap {
  min-width: 0;
  height: calc(100vh - 36px);
  overflow: auto;
  background: #f0f0ee !important;
  border: 1px solid var(--editorial-line) !important;
  border-radius: 18px;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.app .preview-shell { min-width: 1010px; padding: 0 24px 30px; }
.app .generator-runtime-error {
  margin: -4px 0 14px;
  padding: 10px 12px;
  border: 1px solid #d8d8d8;
  border-radius: 10px;
  background: #ffffff;
  color: #111111;
  font: 600 12px/1.45 "SUIT Variable", "SUIT", Arial, sans-serif;
}
.app .generator-runtime-error[hidden] { display: none !important; }
.app .preview-toolbar {
  position: sticky;
  top: 0;
  z-index: 8;
  justify-content: flex-start;
  min-height: 66px;
  margin: 0 -18px 18px;
  padding: 12px 18px;
  background: rgba(255,255,255,.96) !important;
  border: 0;
  border-bottom: 1px solid #dedede;
  box-shadow: none !important;
  backdrop-filter: blur(8px);
}

/* The marketplace .locrian-category-rail is the sole preview-tab skin.
   Preserve worksheet dimensions only; no separate pill/selected plate paint. */
.app .view-tabs{gap:3px;padding:3px;border-radius:0}
.app .view-tab{min-width:92px;padding:9px 16px;border-radius:5px;font-size:12px;font-weight:var(--locrian-market-tab-weight,650)}

/* First paint: do not show the legacy gold/pink/teal active-tab theme before
   initLocrianWipeMenu mounts the ORIGINAL market physical selection plate.
   This pre-hydration guard owns no animation; site-header.css owns the rail. */
@media screen {
  html body .app .preview-toolbar .view-tabs > .view-tab {
    background:transparent!important;
    background-image:none!important;
    box-shadow:none!important;
    color:var(--market-ink,#1F2933)!important;
    -webkit-text-fill-color:currentColor!important;
  }
}

.app .preview-content { padding: 0; }
.app .page-list { width: 122px; min-width: 122px; max-width: 122px; }

@media (max-width: 1180px) {
  .app {
    grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
    padding: 12px;
    gap: 10px;
  }
  body .app .controls,
  body .app .preview-wrap {
    top: 12px;
    height: calc(100vh - 24px);
  }
}

@media (max-width: 900px) {
  .app { display: block; padding: 10px; }
  body .app .controls {
    position: relative;
    top: auto;
    height: auto;
    max-height: none;
    margin-bottom: 10px;
  }
  body .app .preview-wrap { height: auto; max-height: none; }
}

@media print {
  body,
  body[data-theme="pastel"],
  body[data-theme="bw"] { background: #fff !important; }
}

/* §247: the Market category rail supplies both worksheet preview tabs'
   background plate; the original legacy capsule must have no border. */
@media screen {
  html body .app .preview-toolbar .view-tabs,
  html body .app .preview-toolbar .view-tabs>.view-tab {
    border:0!important;border-color:transparent!important;
    outline-offset:3px;box-shadow:none!important;
  }
}

/* Locrian generated screen UI font-size uplift; do not edit. */
@media screen {
.page-thumb-delete{font-size:calc(13px + 2pt)}
.page-thumb-delete{font-weight:750}
.page-thumb-label{font-size:calc(11px + 2pt)}
.page-thumb-label{font-weight:800}
.page-add-plus{font-size:calc(24px + 2pt)}
.page-add-plus{font-weight:450}
.page-add-label{font-size:calc(9px + 2pt)}
.page-add-label{font-weight:700}
.app .controls .brand::before{font-size:calc(10px + 2pt)}
.app .controls .brand::before{font-weight:650}
body .app .controls .brand h1,
body[data-theme="bw"] .app .controls .brand h1,
body[data-color-theme="basic"] .app .controls .brand h1{font-size:calc(30px + 2pt)}
body .app .controls .brand h1,
body[data-theme="bw"] .app .controls .brand h1,
body[data-color-theme="basic"] .app .controls .brand h1{font-weight:750}
.app .controls .setting-group > summary{font-size:calc(15px + 2pt)}
.app .controls .setting-group > summary{font-weight:750}
.app .controls .setting-group > summary::after,
body[data-theme="bw"] .app .controls .setting-group > summary::after,
body[data-color-theme="basic"] .app .controls .setting-group > summary::after{font-weight:450}
.app .controls label.title,
body[data-color-theme="basic"] .app .controls label.title{font-size:calc(12px + 2pt)}
.app .controls label.title,
body[data-color-theme="basic"] .app .controls label.title{font-weight:750}
.app .controls .hint,
body[data-color-theme="basic"] .app .controls .hint,
.app .controls .row-range-label{font-size:calc(11px + 2pt)}
body .app .controls select,
body .app .controls input[type="text"],
body .app .controls input[type="number"],
body[data-theme="bw"] .app .controls select,
body[data-theme="bw"] .app .controls input[type="text"],
body[data-theme="bw"] .app .controls input[type="number"],
body[data-color-theme="basic"] .app .controls select,
body[data-color-theme="basic"] .app .controls input[type="text"],
body[data-color-theme="basic"] .app .controls input[type="number"]{font-size:calc(13px + 2pt)}
.app .controls .check-row,
body[data-theme="bw"] .app .controls .check-row,
body[data-color-theme="basic"] .app .controls .check-row{font-size:calc(12px + 2pt)}
.app .controls .check-row,
body[data-theme="bw"] .app .controls .check-row,
body[data-color-theme="basic"] .app .controls .check-row{font-weight:600}
.app .controls .branding-button,
.app .controls .branding-reset,
.app .controls .ghost,
.app .controls .reset-settings-btn,
.app .controls .add-page-btn,
.app .controls .primary,
.app .controls .print-main,
.app .controls .print-option,
body[data-theme="bw"] .app .controls .primary,
body[data-color-theme="basic"] .app .controls .primary,
body[data-color-theme="basic"] .app .controls .print-main{font-weight:700}
.app .view-tab{font-size:calc(12px + 2pt)}
}
