/* Worksheet Generator: uses the Workbook Builder's layout and paper styles
   (workbooks.css); these are the skill picker and the extra bits on paper. */
.ws-pick-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ws-pick-head .sm-h2 { margin-bottom: 4px; }
.ws-skills { display: grid; gap: 6px; margin: 8px 0 14px; max-height: 52vh; overflow: auto; padding-right: 2px; }
.ws-skill { border: 2px solid var(--line); border-radius: 12px; background: #fafbff; }
.ws-skill.on { border-color: var(--accent); background: #f3f4ff; }
.ws-skill-sum { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 0 6px; padding: 8px 12px; cursor: pointer; list-style: none; }
.ws-skill-sum::-webkit-details-marker { display: none; }
.ws-skill-sum::before { content: '▸'; color: var(--muted); grid-row: 1 / 3; }
.ws-skill[open] > .ws-skill-sum::before { content: '▾'; }
.ws-skill-name { font-weight: 800; }
.ws-skill-count { font-size: 13px; color: var(--muted); }
.ws-skill.on .ws-skill-count { color: var(--accent); font-weight: 700; }
.ws-levels { display: grid; gap: 2px; padding: 0 12px 10px 30px; }
.ws-level { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; cursor: pointer; font-size: 15px; }
.ws-level input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.ws-all { font-weight: 700; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 2px; }
.ws-order { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 15px; }
.ws-order legend { font-weight: 700; margin-bottom: 4px; padding: 0; }
.ws-order label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.ws-order input { width: 18px; height: 18px; margin: 0; flex: none; }

/* On paper */
.ws-tag { text-align: left; font-size: 11px; color: #718096; margin: 1px 0 0 22px; }
.ws-key-h { margin: 18px 0 6px; font-size: 16px; color: #4c51bf; }
.ws-skill-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ws-skill-table th, .ws-skill-table td { border: 1px solid #cbd5e0; padding: 5px 8px; text-align: left; vertical-align: top; }
.ws-skill-table th { background: #edf2f7; }

@media print { .ws-skills { max-height: none; } }

/* Write-in math: four small problems to a row; everything else takes two. */
.ws-sheet .wb-items { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ws-sheet .wb-item { grid-column: span 2; }
.ws-sheet .wb-item.ws-small { grid-column: span 1; }
.ws-write { text-align: left; }
.ws-note { margin: 4px 0 0; text-align: center; font-size: 11px; color: #718096; }
.ws-story { font-size: 16px; line-height: 1.4; }
.ws-pics { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin: 8px 0 4px; }
.ws-pic-group { font-size: 19px; letter-spacing: 2px; border: 1.5px solid #cbd5e0; border-radius: 8px; padding: 2px 6px; max-width: 100%; overflow-wrap: anywhere; }
.ws-pics .ws-op { font-size: 24px; font-weight: 700; }
.ws-work { margin: 6px 0 0; min-height: 58px; font-size: 12px; color: #a0aec0; }
.ws-answer-line { margin-top: 8px; font-weight: 700; font-size: 15px; }
@media (max-width: 560px) {
  .ws-sheet .wb-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.ws-small .ws-tag { margin: 1px 0 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Your worksheet: each ticked level with − n ＋ ✕ */
.ws-chosen { list-style: none; padding: 0; margin: 6px 0 4px; display: grid; gap: 6px; }
.ws-chosen-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 12px; background: #fafbff; }
.ws-chosen-label { flex: 1; display: grid; gap: 1px; min-width: 0; }
.ws-chosen-label .hint { font-size: 13px; }
.ws-step { display: flex; align-items: center; gap: 2px; flex: none; }
.ws-step .btn { min-width: 34px; padding-left: 6px; padding-right: 6px; }
.ws-step-n { min-width: 24px; text-align: center; font-weight: 800; font-size: 17px; }
.ws-chosen-tip { margin: 2px 0 12px; font-size: 13px; }
.ws-order { margin: 10px 0 12px; }

/* On the sheet: buttons on each question (screen only) */
.ws-sheet .wb-item { position: relative; }
.ws-tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; opacity: 0; transition: opacity .15s; }
.ws-sheet .wb-item:hover .ws-tools, .ws-sheet .wb-item:focus-within .ws-tools { opacity: 1; }
@media (hover: none) { .ws-tools { opacity: 1; } }
.ws-tool { width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid #cbd5e0; background: #fff; color: #4a5568; font-size: 15px; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.ws-tool:hover, .ws-tool:focus-visible { border-color: var(--accent); color: var(--accent); }
.ws-tool[data-act="remove"]:hover { border-color: #c53030; color: #c53030; }
@media print { .ws-tools { display: none !important; } }
.ws-sheet .ws-small .ws-tool { width: 24px; height: 24px; font-size: 12px; border-radius: 6px; }
.ws-sheet .ws-small .ws-tools { top: 3px; right: 3px; gap: 2px; }

/* Graph-paper math (like Step Up Math): one digit per square. */
.ws-grid { --cell: 27px; display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); grid-auto-rows: var(--cell); width: max-content; margin: 8px auto 2px; border-top: 1px solid #cbd5e0; border-left: 1px solid #cbd5e0; }
.ws-grid.tight { --cell: 23px; }
.ws-cell { border-right: 1px solid #cbd5e0; border-bottom: 1px solid #cbd5e0; display: grid; place-items: center; font: 700 18px/1 Arial, Helvetica, sans-serif; color: #1a202c; box-sizing: border-box; }
.ws-grid.tight .ws-cell { font-size: 16px; }
.ws-cell.sign { font-size: 19px; }
.ws-cell.carry { background: #f7f9fc; }
.ws-cell.ans { background: #fffdf0; }
.ws-cell.lb { border-bottom: 2.5px solid #1a202c; }
.ws-cell.lt { border-top: 2.5px solid #1a202c; }
.ws-cell.ll { border-left: 2.5px solid #1a202c; }
.ws-grid-wrap { margin: 0 auto; }

#ws-shuffle { justify-self: start; margin-top: 6px; }

/* Save as PDF: an off-screen copy of the pages at print width (7.5 in). */
.ws-pdf { position: fixed; left: -10000px; top: 0; width: 720px; background: #fff; }
.ws-pdf .wb-paper { display: block; }
.ws-pdf .wb-page { width: 720px; max-width: none; margin: 0 0 40px; padding: 0; box-shadow: none; border-radius: 0; }
.ws-pdf .ws-tools { display: none !important; }
.ws-pdf .ws-sheet .wb-items { grid-template-columns: repeat(4, minmax(0, 1fr)); }
