/* Maths-specific controls; colours follow the site's light and dark themes. */
.wb-layout { grid-template-columns: minmax(300px, 370px) minmax(0, 1fr); }
#wb-sections { display: grid; gap: 14px; }
#wb-preset-control { min-width: 0; }
#wb-preset-control .builder-hint { margin-top: 8px; }
.wb-section { min-width: 0; margin: 6px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.wb-section summary { padding: 8px 0; color: var(--ink); font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; cursor: pointer; }
.wb-section summary::marker { color: var(--teal); }
.wb-section > div { min-width: 0; }
.wb-section label { margin-bottom: 6px; }
.wb-section :is(input, select, textarea) { margin-bottom: 6px; }
.wb-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wb-range > div { display: grid; grid-template-rows: 1fr auto; min-width: 0; }
.wb-range label { display: flex; align-items: end; min-height: 42px; }
.wb-rules { display: grid; gap: 2px; margin-block: 12px; padding-block: 6px; border-block: 1px solid var(--line); }
.builder-controls .wb-check { display: flex; align-items: center; gap: 10px; min-height: 46px; margin: 0; padding: 6px 0; font-weight: 400; cursor: pointer; }
.builder-controls .wb-check input { flex: 0 0 20px; width: 20px; min-height: 20px; height: 20px; margin: 0; accent-color: var(--teal); }
.wb-section-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.wb-section-actions button { min-width: 0; min-height: 44px; margin: 0; padding: 9px 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--text); font: 600 13px/1.4 var(--sans); cursor: pointer; }
.wb-section-actions button:not(:disabled):hover { background: var(--aqua); border-color: var(--teal); }
.wb-generation-actions { display: grid; gap: 10px; margin-top: 12px; }
.wb-generation-actions .button { width: 100%; margin: 0; }
.wb-pages { display: grid; width: 100%; min-width: 0; max-width: 620px; gap: 20px; margin: 0 auto; }
.wb-pages canvas { display: block; width: 100%; min-width: 0; max-width: 100%; height: auto; background: white; box-shadow: 0 8px 22px #123b421a; }
.wb-warn { padding: 10px 12px; border-left: 3px solid var(--teal); border-radius: 0 8px 8px 0; background: var(--paper); color: var(--text); font-size: 13px; line-height: 1.6; }
.builder-preview #wb-status.is-error { color: #a22b26; }
[data-theme="dark"] .builder-preview #wb-status.is-error { color: #ffaaa2; }
#wb-pages:empty { min-height: 260px; }
#wb-pages:empty::after { content: 'Your worksheet preview will appear here.'; padding: 48px 18px; color: var(--muted); text-align: center; }
.wb-layout [hidden] { display: none !important; }
@media (min-width: 640px) and (max-width: 960px) {
  .wb-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
  .wb-section-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wb-generation-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) { .wb-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) {
  .wb-section { padding: 12px; }
  .wb-range { gap: 10px; }
  .wb-pages { gap: 16px; }
}
@media (max-width: 380px) {
  .wb-range { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .wb-range label { min-height: 0; }
}
