/* ============================================================
   CrossWord — explore.css
   @version 2.23.0  (E1: the Explore page; docs/EXPLORE-DELIVERY.md)
   Selection bar, vocabulary table, gloss sheet (+ print rules).
   Colours come from the existing tokens; the study-status lines reuse the S1 look (solid / dashed / dotted).
   ============================================================ */

.ex-wrap { padding: var(--sp-md); max-width: 1100px; margin: 0 auto; }
.ex-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-md); margin-bottom: var(--sp-sm); }
.ex-title { font-family: var(--font-display); font-size: 1.2rem; letter-spacing: 0.04em; margin: 0; }
.ex-h2 { font-family: var(--font-display); font-size: 0.95rem; letter-spacing: 0.04em; margin: 0 0 var(--sp-xs); }
.ex-sub { margin: 0 0 var(--sp-sm); color: var(--text-muted); font-size: 0.9rem; }
.ex-note { padding: var(--sp-sm) var(--sp-md); border: 1px solid var(--border-light); border-radius: var(--r-md); background: var(--surface); }
.ex-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ex-texts { display: flex; gap: 4px; }
.ex-text { padding: 3px 12px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text-primary); font-family: var(--font-display); font-size: 0.8rem; }
.ex-text.active { background: var(--navy); color: var(--text-on-navy, #EDE3CF); border-color: var(--navy); }

/* selection */
.ex-scope { border: 1px solid var(--border-light); border-radius: var(--r-md); padding: var(--sp-md); background: var(--surface); margin-bottom: var(--sp-md); }
.ex-chips { list-style: none; margin: 0 0 var(--sp-sm); padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ex-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 12px; border-radius: 999px; background: var(--navy); color: var(--text-on-navy, #EDE3CF); font-size: 0.85rem; }
.ex-chip-x { border: 0; background: rgba(255,255,255,0.18); color: inherit; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; line-height: 1; font-size: 1rem; }
.ex-chip-x:hover { background: rgba(255,255,255,0.32); }
.ex-chip-empty { color: var(--text-muted); font-size: 0.9rem; }
.ex-add { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.ex-add label, .ex-field, .ex-lo label { font-size: 0.8rem; color: var(--text-muted); }
.ex-add select, .ex-add input { padding: 5px 6px; max-width: 12rem; }
.ex-add input[type=number] { width: 4.5rem; }
.ex-quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: var(--sp-sm); }
.ex-lo { display: inline-flex; gap: 6px; align-items: center; }

/* tabs */
.ex-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-light); margin-bottom: var(--sp-sm); }
.ex-tab { padding: 8px 14px; border: 0; border-bottom: 3px solid transparent; background: none; font-family: var(--font-display); font-size: 0.85rem; cursor: pointer; color: var(--text-muted); }
.ex-tab.active { color: var(--text-primary); border-bottom-color: var(--gold-text, #8a6a00); }

/* vocabulary */
.ex-summary { margin: var(--sp-xs) 0 var(--sp-sm); }
.ex-tools { display: flex; flex-wrap: wrap; gap: var(--sp-sm) var(--sp-md); align-items: flex-end; margin-bottom: var(--sp-sm); }
.ex-field { display: flex; flex-direction: column; gap: 2px; }
.ex-field input, .ex-field select { padding: 5px 6px; }
.ex-check { display: inline-flex; gap: 6px; align-items: center; font-size: 0.85rem; }
.ex-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--sp-sm); }
.ex-tablewrap { overflow-x: auto; border: 1px solid var(--border-light); border-radius: var(--r-md); }
.ex-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.ex-table th, .ex-table td { padding: 6px 8px; text-align: start; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.ex-table thead th { position: sticky; top: 0; background: var(--surface); font-family: var(--font-display); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; }
.ex-table .ex-num, .ex-htable .ex-num { text-align: end; font-variant-numeric: tabular-nums; }
.ex-sort { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: 0; text-transform: inherit; letter-spacing: inherit; }
.ex-lem { font-weight: 600; }
.ex-lemma { border: 0; background: none; font-family: var(--font-greek); font-size: 1.1rem; color: var(--text-primary); cursor: pointer; padding: 0 0 1px; }
.ex-lemma[data-vocab="known"] { border-bottom: 2px solid var(--vocab-known, #2E7D4F); }
.ex-lemma[data-vocab="deck"]  { border-bottom: 2px dashed var(--vocab-deck, #A87B00); }
.ex-lemma[data-vocab="new"]   { border-bottom: 2px dotted var(--vocab-new, #B3261E); }
.ex-ref { border: 0; background: none; color: var(--navy-mid, #1B3A6B); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.ex-form { font-family: var(--font-greek); color: var(--text-muted); margin-inline-start: 4px; }
.ex-gloss { max-width: 22rem; }
.ex-status { padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 0.78rem; }
.ex-status-known { border-color: var(--vocab-known, #2E7D4F); }
.ex-status-deck  { border-color: var(--vocab-deck, #A87B00); border-style: dashed; }
.ex-status-new   { border-color: var(--vocab-new, #B3261E); border-style: dotted; }
.ex-new { font-size: 0.75rem; padding: 1px 6px; border-radius: 4px; background: var(--navy); color: var(--text-on-navy, #EDE3CF); white-space: nowrap; }
.ex-more { text-align: center; margin-top: var(--sp-sm); }
.ex-empty { padding: var(--sp-md); }

/* gloss sheet */
.ex-handout { background: #fff; color: #111; border: 1px solid var(--border-light); border-radius: var(--r-md); padding: var(--sp-md); }
.ex-handout .ex-h2 { font-size: 1.15rem; }
.ex-hgroup { margin-top: var(--sp-md); break-inside: avoid-page; }
.ex-hgroup h3 { font-family: var(--font-display); font-size: 0.95rem; margin: 0 0 4px; border-bottom: 2px solid #111; }
.ex-hgroup h3 small { font-weight: 400; color: #444; margin-inline-start: 6px; }
.ex-htable { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ex-htable th, .ex-htable td { padding: 3px 8px; text-align: start; border-bottom: 1px solid #ddd; vertical-align: top; }
.ex-htable thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: #444; }
.ex-htable tbody th { font-family: var(--font-greek); font-weight: 600; font-size: 1.05rem; white-space: nowrap; }
.ex-hv { color: #555; font-size: 0.78rem; }

@media (max-width: 600px) {
  .ex-wrap { padding: var(--sp-sm); }
  .ex-table th:nth-child(3), .ex-table td:nth-child(3) { display: none; }
}

@media print {
  #app-header, #app-nav, .ex-noprint, #toast-container, .view-panel:not(#view-explore), #sheet-overlay, #word-study-panel, #fc-overlay { display: none !important; }
  #view-explore { display: block !important; min-height: 0 !important; }
  body, #app, #app-content { background: #fff !important; box-shadow: none !important; overflow: visible !important; }
  #app-content { padding: 0 !important; }
  .ex-wrap { max-width: none; padding: 0; }
  .ex-handout { border: 0; padding: 0; }
  .ex-htable { font-size: 10pt; }
  .ex-hgroup { margin-top: 10pt; }
}
.ex-table td:nth-child(5) { white-space: nowrap; }

/* ── 2.24.0 (E2): the forms chart (drawer) ─────────────────────────────────────────────────────────── */
.ex-drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 290; }
.ex-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(960px, 100%); background: var(--surface); color: var(--text-primary); z-index: 300; overflow-y: auto; padding: var(--sp-md); box-shadow: -8px 0 32px rgba(0,0,0,0.35); outline: none; }
.ex-drawer[hidden], .ex-drawer-bg[hidden] { display: none; }
body.ex-drawer-open { overflow: hidden; }
.ex-d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-sm); }
.ex-d-title { margin: 0; font-family: var(--font-display); font-size: 1.1rem; }
.ex-d-lemma { font-family: var(--font-greek); font-size: 1.6rem; }
.ex-d-title small { color: var(--text-muted); font-size: 0.85rem; margin-inline-start: 6px; }
.ex-d-close { border: 1px solid var(--border); background: none; border-radius: 50%; width: 36px; height: 36px; font-size: 1.3rem; cursor: pointer; color: inherit; }
.ex-d-tools { display: flex; flex-wrap: wrap; gap: var(--sp-sm) var(--sp-md); align-items: flex-end; margin: var(--sp-sm) 0; }
.ex-d-extent { border: 1px solid var(--border-light); border-radius: var(--r-md); padding: 4px 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.85rem; }
.ex-d-extent legend { font-size: 0.75rem; color: var(--text-muted); padding: 0 4px; }
.ex-d-meter { margin: 0 0 var(--sp-sm); font-size: 0.9rem; }
.ex-d-meter meter { width: 8rem; vertical-align: middle; }
.ex-block { margin-bottom: var(--sp-md); overflow-x: auto; }
.ex-grid { border-collapse: collapse; font-size: 0.95rem; min-width: 60%; }
.ex-grid caption { text-align: start; font-family: var(--font-display); font-size: 0.85rem; letter-spacing: 0.03em; padding-bottom: 4px; }
.ex-grid th, .ex-grid td { border: 1px solid var(--border-light); padding: 5px 10px; text-align: center; vertical-align: top; }
.ex-grid thead th { background: rgba(0,0,0,0.04); font-size: 0.78rem; font-weight: 600; }
.ex-grid tbody th { text-align: start; font-size: 0.8rem; font-weight: 600; white-space: nowrap; background: rgba(0,0,0,0.03); }
.ex-grid-list td { text-align: start; }
.ex-d-parse { font-weight: 400 !important; }
.ex-fc-wrap { white-space: nowrap; }
.ex-fc { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 1px 7px; font-family: var(--font-greek); font-size: 1.1rem; color: var(--text-primary); cursor: pointer; }
.ex-fc:hover { border-color: var(--navy); }
.ex-fc.out { border-style: dashed; color: var(--text-muted); }
.ex-end { font-weight: 800; color: var(--crimson, #A50000); }
.ex-fc.out .ex-end { color: var(--text-muted); }
.ex-d-n { font-size: 0.75rem; color: var(--text-muted); margin-inline-start: 3px; font-variant-numeric: tabular-nums; }
.ex-fc-none { color: var(--text-muted); }
.ex-d-detail { border: 1px solid var(--border-light); border-radius: var(--r-md); padding: var(--sp-sm) var(--sp-md); margin-top: var(--sp-sm); min-height: 4rem; }
.ex-d-detail:focus { outline: 2px solid var(--navy); }
.ex-d-h3 { margin: 0 0 4px; font-size: 1rem; }
.ex-d-h3 small { color: var(--text-muted); }
.ex-d-detail p { margin: 2px 0; }
.ex-d-refs { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ex-d-legend { font-size: 0.8rem; color: var(--text-muted); margin-top: var(--sp-md); }
.ex-legend-out { cursor: default; font-size: 0.85rem; }
@media (max-width: 600px) { .ex-drawer { padding: var(--sp-sm); } .ex-grid th, .ex-grid td { padding: 4px 6px; } }
@media print { .ex-drawer, .ex-drawer-bg { display: none !important; } }

/* ── 2.25.0 (E3): morphology tab and parsing practice ───────────────────────────────────────────────── */
.ex-morph { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: var(--sp-md); align-items: start; }
.ex-facets { border: 1px solid var(--border-light); border-radius: var(--r-md); padding: var(--sp-sm); background: var(--surface); position: sticky; top: 4rem; max-height: calc(100vh - 6rem); overflow-y: auto; }
.ex-facets-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-xs); }
.ex-facets-head h3 { margin: 0; font-family: var(--font-display); font-size: 0.9rem; }
.ex-fset { border: 0; border-top: 1px solid var(--border-light); margin: 0; padding: 6px 0; }
.ex-fset legend { font-family: var(--font-display); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; padding: 0; color: var(--text-muted); }
.ex-fv { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; padding: 2px 0; cursor: pointer; }
.ex-fv.off { color: var(--text-muted); cursor: default; }
.ex-fn { margin-inline-start: auto; font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ex-pill .ex-fn { margin-inline-start: 4px; color: inherit; opacity: 1; }
.ex-poslist { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--sp-sm); }
.ex-pill { border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); border-radius: 999px; padding: 3px 12px; font-size: 0.85rem; cursor: pointer; }
.ex-pill[aria-pressed="true"] { background: var(--navy); color: var(--text-on-navy, #EDE3CF); border-color: var(--navy); }
.ex-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.ex-segbtn { border: 0; background: var(--surface); color: var(--text-primary); padding: 5px 12px; font-size: 0.85rem; cursor: pointer; }
.ex-segbtn[aria-pressed="true"] { background: var(--navy); color: var(--text-on-navy, #EDE3CF); }
.ex-facets-toggle { display: none; margin-bottom: var(--sp-xs); }
.ex-lemlist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-light); border-radius: var(--r-md); }
.ex-lemrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border-bottom: 1px solid var(--border-light); padding: 4px 8px; }
.ex-lemrow:last-child { border-bottom: 0; }
.ex-lm-btn { flex: 1 1 18rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; text-align: start; border: 0; background: none; color: var(--text-primary); cursor: pointer; padding: 4px 0; font: inherit; }
.ex-chev { width: 1rem; color: var(--text-muted); }
.ex-lm-lemma { font-family: var(--font-greek); font-size: 1.15rem; }
.ex-lm-gloss { color: var(--text-muted); font-size: 0.88rem; }
.ex-lm-meta { margin-inline-start: auto; font-size: 0.8rem; color: var(--text-muted); }
.ex-lm-forms { flex-basis: 100%; padding: 0 0 8px 1.4rem; }
.ex-subtable { font-size: 0.85rem; }
.ex-mform { font-family: var(--font-greek); font-size: 1.05rem; }
@media (max-width: 760px) {
  .ex-morph { grid-template-columns: minmax(0, 1fr); }
  .ex-facets-toggle { display: inline-block; }
  .ex-facets { display: none; position: static; max-height: none; }
  .ex-facets.open { display: block; }
}

/* parsing practice */
.ex-quiz { width: min(560px, 100%); }
.ex-q-form { font-family: var(--font-greek); font-size: 2.2rem; margin: var(--sp-sm) 0 0; }
.ex-q-fields { display: flex; flex-wrap: wrap; gap: var(--sp-sm); align-items: flex-end; margin: var(--sp-sm) 0; }
.ex-q-fields select { padding: 6px; min-width: 9rem; }
.ex-right { outline: 2px solid var(--vocab-known, #2E7D4F); }
.ex-wrong { outline: 2px dashed var(--vocab-new, #B3261E); }
.ex-ok { color: var(--vocab-known, #2E7D4F); }
.ex-bad { color: var(--vocab-new, #B3261E); }
.ex-q-score { font-size: 1.2rem; }
