/* Worksheet generator shell (layouts/worksheet-gen). Screen: the sheet looks
   like a sheet of paper on the dark page. Print: only the sheet; the question
   page, then the answer key on its own page. */
.ws-bar {
  display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end; justify-content: space-between;
  padding: 16px; background: var(--mtp-raised); border: 1px solid var(--mtp-line); border-radius: 2px;
}
.ws-opts { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.ws-opt { display: flex; flex-direction: column; gap: 4px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--mtp-muted); }
.ws-opt select {
  min-height: 40px; padding: 6px 10px; background: var(--mtp-night); color: var(--mtp-paper);
  border: 1px solid var(--mtp-line); border-radius: 2px; font: inherit; font-size: 15px; text-transform: none; letter-spacing: 0;
}
.ws-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ws-btn { min-height: 44px; padding: 0 18px; font: inherit; font-size: 13px; cursor: pointer; }
.ws-btn-alt { background: transparent; color: var(--mtp-paper); border: 1px solid var(--mtp-brass); border-radius: 1px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ws-btn-alt:hover { background: var(--mtp-raised-2); }
.ws-btn-alt[aria-pressed="true"] { background: var(--mtp-raised-2); color: var(--mtp-brass-bright); }
.ws-bar button:focus-visible, .ws-bar select:focus-visible { outline: 2px solid var(--mtp-brass-bright); outline-offset: 2px; }
.ws-status { min-height: 1.4em; margin: 10px 0 0; color: var(--mtp-muted); font-size: 14px; }
.ws-status.ws-error { color: #ffb4a0; }

.ws-sheet {
  margin: 14px 0 34px; padding: clamp(16px, 3vw, 32px); box-sizing: border-box;
  background: #fffdf8; color: #151515; border-radius: 2px; box-shadow: 0 2px 18px rgba(0, 0, 0, .45);
  font-family: "Source Sans 3", system-ui, sans-serif;
}
.ws-head { border-bottom: 2px solid #151515; padding-bottom: 10px; margin-bottom: 18px; }
.ws-head-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 18px; }
.ws-title { margin: 0; font-size: 24px; line-height: 1.1; color: #151515; font-family: "Cormorant Garamond", Georgia, serif; }
.ws-sheetno { margin: 0; font-size: 13px; color: #555; font-variant-numeric: tabular-nums; }
.ws-fields { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 14px 0 0; font-size: 14px; }
.ws-fields span { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.ws-fields i { display: inline-block; width: 190px; max-width: 40vw; border-bottom: 1px solid #151515; height: 1em; }
.ws-fields i.ws-short { width: 44px; }
.ws-fields b { font-weight: 600; }

.ws-items { list-style: none; counter-reset: ws; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 6px 28px; }
@media (min-width: 760px) { .ws-items { grid-template-columns: 1fr 1fr; } }
.ws-item { counter-increment: ws; position: relative; padding: 10px 0 12px 34px; break-inside: avoid; border-bottom: 1px solid #e6dfcc; min-width: 0; }
.ws-item::before { content: counter(ws) "."; position: absolute; left: 0; top: 10px; font-weight: 700; color: #151515; }
.ws-prompt, .ws-ans-text, .ws-explain { white-space: pre-line; overflow-wrap: anywhere; }
.ws-prompt { font-size: 16px; line-height: 1.35; margin-bottom: 4px; }
.ws-staff { margin: 6px 0; line-height: 0; background: #fff; color: #111; border-radius: 3px; padding: 4px 2px; color-scheme: light; }
.ws-staff svg { display: block; }
.ws-staff-fail { color: #a33; font-size: 13px; line-height: 1.4; }
.ws-line { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; font-size: 14px; color: #555; }
.ws-blank { flex: 1; border-bottom: 1px solid #151515; height: 1.2em; }
.ws-ans { display: none; margin-top: 8px; padding: 8px 10px; background: #eaf3e4; border-left: 3px solid #3d7a2a; }
.ws-show .ws-ans { display: block; }
.ws-ans-text { font-weight: 700; color: #1d4a10; }
@media print { .ws-ans-text { color: #000; } }
.ws-explain { font-size: 14px; color: #333; margin-top: 2px; }
.ws-key { display: none; }
.ws-key-item { padding-bottom: 8px; }

@media (max-width: 560px) {
  .ws-fields { flex-direction: column; gap: 14px; }
  .ws-fields span { display: flex; width: 100%; }
  .ws-fields i { flex: 1; width: auto; max-width: none; }
  .ws-fields i.ws-short { flex: 0 0 60px; }
}
@media (max-width: 480px) {
  .ws-item { padding-left: 26px; }
  .ws-actions { width: 100%; }
  .ws-actions .ws-btn { flex: 1 1 auto; padding: 0 10px; }
  .ws-opt select { min-width: 110px; }
}

@page { size: auto; margin: 12mm; }
@media print {
  .ws-fields { flex-direction: row; gap: 8px 28px; }
  .ws-fields span { display: inline-flex; width: auto; }
  .ws-fields i { flex: none; width: 190px; }
  .ws-fields i.ws-short { flex: none; width: 44px; }
  html, body { background: #fff !important; color: #000 !important; }
  .mtp-topnav, .mtp-site-footer, footer, .book-footer, .mtp-breadcrumb, .mtp-toc, .book-toc, .ws-noprint, .mtp-eyebrow, .mtp-ws > h1, .mtp-ws > .lede,
  .mtp-tool-block, .mtp-tool-body, .mtp-tool-related, .mtp-tool-noscript, .mtp-ws > .mtp-leaf-nav, aside, .book-menu { display: none !important; }
  .mtp-shell, .mtp-page, .mtp-ws, .markdown { display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; width: auto !important; }
  .ws-sheet { margin: 0; padding: 0; box-shadow: none; background: #fff; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body, .mtp-shell { min-width: 0 !important; width: auto !important; overflow: visible !important; }
  .ws-sheet, .ws-items { width: 100%; box-sizing: border-box; }
  .ws-ans { display: none !important; }
  .ws-key { display: block !important; break-before: page; page-break-before: always; }
  .ws-items { grid-template-columns: 1fr 1fr; gap: 0 8mm; }
  .ws-item { border-bottom-color: #ccc; }
  .ws-key-item { padding-bottom: 4px; }
  .ws-item, .ws-head { break-inside: avoid; }
}

/* single wide item (e.g. the circle of fifths) spans the whole sheet */
.ws-item-wide { grid-column: 1 / -1; }
.ws-circle { background: transparent; padding: 0; }
.ws-ans .ws-circle { margin-top: 6px; }
/* never let long option labels or staves widen the page */
.ws-opt, .ws-opts, .ws-bar { min-width: 0; max-width: 100%; }
.ws-opt select { max-width: 100%; min-width: 0; }
.ws-ans, .ws-item, .ws-prompt { min-width: 0; max-width: 100%; }
