/* Definitions worksheet pages (/<subject>/definitions/…). Loaded after
   worksheet-print.css, worksheet-night.css and print-names.css on those pages
   only. Two parts: the sheet (paper — screen and print, and the page boxes
   content/print-names.js lays copies into, A4 and half-A4) and the controls
   above it (screen, the night look). */

/* ── The sheet ──────────────────────────────────────────────────────────
   One row per term: number · prompt · ruled writing space. Ruled lines are
   8 mm apart (A4 and half sheets alike). A row is never
   split across pages (it is atomic to the page layout too: .dfn-row in
   print-names.js ATOMIC). */
/* The sheet runs across pages (a worksheet section otherwise avoids breaks,
   which left a header-only first page); only a row is kept whole. */
.ws-section.dfn-sheet { page-break-inside: auto; break-inside: auto; }
.ws-section-header { break-after: avoid; page-break-after: avoid; }
.dfn-rows { display: block; }
.dfn-row {
    display: grid;
    grid-template-columns: 7mm minmax(0, 32%) minmax(0, 1fr);
    column-gap: 3mm;
    align-items: start;
    padding: 2mm 0 0;
    break-inside: avoid;
    page-break-inside: avoid;
}
.dfn-row--d2t { grid-template-columns: 7mm minmax(0, 1fr) minmax(0, 36%); }
.dfn-num {
    font-size: 9pt;
    font-weight: 700;
    color: var(--ws-muted, #6b7280);
    padding-top: 1.2mm;
}
.dfn-prompt {
    font-size: 10.5pt;
    line-height: 1.35;
    padding-top: 1.2mm;
    overflow-wrap: anywhere;
    color: var(--ws-text, #111827);
}
.dfn-term { font-weight: 800; }
.dfn-write { display: block; }
.dfn-line {
    display: block;
    height: 8mm;
    border-bottom: 1px solid #9ca3af;
}
.ws-half .dfn-prompt { font-size: 10pt; }

/* ── The controls (screen) ────────────────────────────────────────────── */
@media screen {
.ws-night .dfn-controls {
    max-width: 900px;
    margin: 16px auto 0;
    padding: 14px 22px 16px;
    background: var(--cp-card);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    box-shadow: 0 20px 44px rgba(11,16,32,.35);
    font-family: var(--font-body);
    color: #E4D9FF;
}
.ws-night .dfn-controls[hidden],
.ws-night .dfn-term-panel[hidden] { display: none; }
.ws-night .dfn-controls-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}
.ws-night .dfn-controls-row + .dfn-controls-row { margin-top: 12px; }
.ws-night .dfn-label {
    min-width: 68px;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9B8AC4;
}
.ws-night .dfn-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.ws-night .dfn-pill {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(16,8,34,0.45);
    color: #E4D9FF;
    font: inherit;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
}
.ws-night .dfn-pill:hover { background: rgba(255,255,255,0.12); }
.ws-night .dfn-pill[aria-pressed="true"] {
    background: #FBBF24;
    border-color: #FBBF24;
    color: #1b1033;
}
.ws-night .dfn-pill:focus-visible { outline: 3px solid #FBBF24; outline-offset: 2px; }
.ws-night .dfn-count { font-weight: 700; color: #fff; }
.ws-night .dfn-term-panel { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.ws-night .dfn-term-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px;
    margin-bottom: 8px;
}
.ws-night .dfn-term-item span { white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 640px) {
    .ws-night .dfn-controls { margin: 12px 12px 0; padding: 14px 16px; }
    .ws-night .dfn-label { min-width: 100%; }
    .ws-night .dfn-term-list { grid-template-columns: 1fr; }
}
}
