/* ════════════════════════════════════════════════════════════════════
   theory-lessons.css — SymposiON "Theory Reimagined" lesson views
   ────────────────────────────────────────────────────────────────────
   Ported from the design handoff (theory.css) into the live design
   system. Per INTEGRATION.md §0, every literal surface/ink/accent colour
   is mapped to a --sym-* token so theme switching (Hearth / Obsidian /
   Alabaster / the reimagined palettes) keeps working.

   Rather than redefine 5 new tokens across all ~24 palette blocks, the
   theory-local vars (--bg, --panel, --bone, --fog, …) are DERIVED here
   from the canonical --sym-* tokens. They therefore adapt automatically
   to any current or future palette. Only --sym-wine (a genuinely new
   brand accent) is added to identity.css + theme-obsidian.css.

   Parsing-category hues (voice/tense/mood/person/form) stay literal per
   INTEGRATION.md §0 — they are a stable grammar taxonomy, not surfaces.

   Fonts are already loaded by identity.css — NO @import here.
   ════════════════════════════════════════════════════════════════════ */

/* ─── token bridge: theory-local vars → --sym-* (theme-safe) ──────────
   Scoped to .tr so it never leaks. Surfaces/ink are mixed toward the
   active theme's text/bg so they invert correctly on light palettes. */
.tr {
  /* surfaces */
  --bg:       var(--sym-bg-dark);
  --panel:    var(--sym-bg-panel);
  --panel-2:  color-mix(in srgb, var(--sym-bg-panel) 88%, var(--sym-cream));   /* raised / hover */
  --inset:    color-mix(in srgb, var(--sym-bg-dark) 78%, var(--sym-bg-panel)); /* recessed input/cell */
  --ink:      var(--sym-ink);

  /* text */
  --cream:    var(--sym-cream);
  --bone:     color-mix(in srgb, var(--sym-cream) 85%, var(--sym-gold));       /* warm heading ivory */
  --stone:    var(--sym-stone);
  --fog:      color-mix(in srgb, var(--sym-cream) 45%, transparent);           /* faded tertiary */

  /* accents */
  --terra:    var(--sym-terra);
  --terra-dk: var(--sym-terra-dk);
  --gold:     var(--sym-gold);
  --sage:     var(--sym-sage);
  --aegean:   var(--sym-aegean);
  --wine:     var(--sym-wine, #B06A92);

  /* hairlines — gold/cream based so they flip with theme */
  --line:      color-mix(in srgb, var(--sym-gold) 20%, transparent);
  --line-hi:   color-mix(in srgb, var(--sym-gold) 42%, transparent);
  --line-soft: color-mix(in srgb, var(--sym-cream) 10%, transparent);

  /* parsing-category hues (φωνή/χρόνος/έγκλιση/πρόσωπο/τύπος) — literal */
  --c-voice:  #8FB36B;
  --c-tense:  #D9B84A;
  --c-mood:   #6FB3C0;
  --c-person: #E08A66;
  --c-form:   #C98ABF;

  /* fonts — alias to the brand stack */
  --f-serif:   var(--sym-font-serif);
  --f-display: var(--sym-font-display);
  --f-sans:    var(--sym-font-sans);
  --f-mono:    var(--sym-font-mono);

  /* ─── base lesson shell ─────────────────────────────────────────── */
  width: 100%;
  min-height: 100%;
  background:
    radial-gradient(120% 80% at 50% -10%, color-mix(in srgb, var(--terra) 8%, transparent), transparent 60%),
    var(--bg);
  color: var(--cream);
  font-family: var(--f-sans);
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  position: relative;
}
.tr *, .tr *::before, .tr *::after { box-sizing: border-box; }

/* faint meander dot-texture */
.tr-grain {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: radial-gradient(color-mix(in srgb, var(--cream) 2.5%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
}

/* ─── type atoms ──────────────────────────────────────────────────── */
.tr-eyebrow {
  font-family: var(--f-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.34em; text-transform: uppercase; color: var(--stone);
}
.tr-lemma {
  font-family: var(--f-serif); font-weight: 500; line-height: 0.9;
  color: var(--bone); letter-spacing: -0.01em;
}
.tr-lemma em { color: var(--terra); font-style: normal; }
.tr-meaning { font-family: var(--f-serif); font-style: italic; color: var(--stone); }
.tr-h2 {
  font-family: var(--f-serif); font-weight: 600; color: var(--bone);
  letter-spacing: -0.01em;
}
.tr-kicker {
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold);
}
.tr-body {
  font-family: var(--f-serif); font-size: 19px; line-height: 1.6;
  color: color-mix(in srgb, var(--cream) 86%, transparent);
  text-wrap: pretty;
}
.tr-body b { color: var(--bone); font-weight: 600; }

/* gold hairline rule */
.tr-rule { height: 1px; border: 0; background: linear-gradient(90deg, transparent, var(--line-hi), transparent); }
.tr-rule--left { background: linear-gradient(90deg, var(--line-hi), transparent); }

/* ─── chips / parsing tags ────────────────────────────────────────── */
.tr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tr-chip {
  font-family: var(--f-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.08em; color: var(--bone);
  padding: 6px 11px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--cream) 3%, transparent); border-radius: 2px;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.tr-chip .dot { width: 6px; height: 6px; border-radius: 50%; }
.tr-chip--tense  { border-color: color-mix(in srgb, var(--c-tense) 40%, transparent); }
.tr-chip--mood   { border-color: color-mix(in srgb, var(--c-mood) 40%, transparent); }
.tr-chip--person { border-color: color-mix(in srgb, var(--c-person) 40%, transparent); }
.tr-chip--voice  { border-color: color-mix(in srgb, var(--c-voice) 40%, transparent); }
.tr-chip--form   { border-color: color-mix(in srgb, var(--c-form) 40%, transparent); }
.d-tense  { background: var(--c-tense); }
.d-mood   { background: var(--c-mood); }
.d-person { background: var(--c-person); }
.d-voice  { background: var(--c-voice); }
.d-form   { background: var(--c-form); }

/* ─── paradigm: the changing ending lights up ─────────────────────── */
.tr-form { font-family: var(--f-serif); color: var(--cream); }
.tr-form .end { color: var(--terra); }
.tr-pers { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--stone); }

/* a mood block used in reading layouts */
.tr-mood {
  border: 1px solid var(--line); background: color-mix(in srgb, var(--cream) 2%, transparent);
  border-radius: 3px; overflow: hidden;
}
.tr-mood-h {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--c-mood);
}
.tr-mood-h .bar { width: 14px; height: 2px; background: var(--c-mood); }
.tr-mood-row {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid color-mix(in srgb, var(--cream) 5%, transparent);
}
.tr-mood-row:last-child { border-bottom: 0; }
.tr-mood-row .tr-form { font-size: 21px; }

/* ─── buttons ─────────────────────────────────────────────────────── */
.tr-btn {
  font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  padding: 13px 22px; border-radius: 2px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px; border: 1px solid transparent;
  transition: all 0.18s ease;
}
.tr-btn--terra { background: var(--terra); color: #1b0f08; border-color: var(--terra); }
.tr-btn--terra:hover { background: var(--terra-dk); border-color: var(--terra-dk); }
.tr-btn--ghost { background: transparent; color: var(--bone); border-color: var(--line-hi); }
.tr-btn--ghost:hover { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 6%, transparent); }
.tr-btn[disabled] { opacity: 0.5; cursor: default; pointer-events: none; }

/* ─── small stat pills (overview row) ─────────────────────────────── */
.tr-stat {
  flex: 1; padding: 16px 18px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--cream) 2%, transparent); border-radius: 3px;
}
.tr-stat .k { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--stone); }
.tr-stat .v { font-family: var(--f-serif); font-size: 22px; color: var(--bone); margin-top: 5px; }

/* ════════════════════════════════════════════════════════════════════
   MATRIX explorer (Πίνακας)
   ════════════════════════════════════════════════════════════════════ */
.trm-tabs { display: flex; gap: 4px; }
.trm-tab {
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 11px 18px; cursor: pointer;
  color: var(--stone); border: 1px solid transparent; border-bottom: 2px solid transparent;
  background: none; transition: all 0.16s;
}
.trm-tab:hover { color: var(--bone); }
.trm-tab.on { color: var(--gold); border-bottom-color: var(--gold); background: color-mix(in srgb, var(--gold) 5%, transparent); }

.trm-grid { display: grid; grid-template-columns: 92px repeat(4, 1fr); gap: 1px; background: var(--line-soft); border: 1px solid var(--line); }
.trm-cell { background: var(--panel); padding: 14px 12px; min-height: 58px; display: flex; align-items: center; }
.trm-colh { background: var(--inset); justify-content: center; flex-direction: column; gap: 3px; text-align: center; }
.trm-colh .m { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.trm-colh .bar { width: 20px; height: 2px; }
.trm-rowh { background: var(--inset); justify-content: flex-end; }
.trm-pers { font-family: var(--f-mono); font-size: 12px; color: var(--stone); letter-spacing: 0.04em; }
.trm-form { font-family: var(--f-serif); font-size: 22px; color: var(--cream); white-space: nowrap; }
.trm-form .end { color: var(--terra); }
.trm-cell.dim { color: var(--fog); }
.trm-cell.dim .trm-form { font-size: 15px; color: var(--fog); font-style: italic; }
.trm-cell:hover:not(.trm-colh):not(.trm-rowh) { background: var(--panel-2); }
/* reveal (study) mode: mask the forms until tapped */
.trm.study .trm-form { filter: blur(7px); opacity: 0.5; transition: all 0.2s; }
.trm.study .trm-cell.revealed .trm-form { filter: none; opacity: 1; }
.trm.study .trm-cell:not(.trm-colh):not(.trm-rowh) { cursor: pointer; }
.trm-legend { display: flex; flex-wrap: wrap; gap: 16px; }
.trm-legend span { font-family: var(--f-mono); font-size: 11px; color: var(--stone); display: inline-flex; align-items: center; gap: 7px; }
.trm-legend .sw { width: 11px; height: 11px; border-radius: 2px; }

/* ════════════════════════════════════════════════════════════════════
   SANCTUARY flip cards (Κάρτες preview / non-Mnemosyne static card)
   ════════════════════════════════════════════════════════════════════ */
.trc-stage { position: relative; }
.trc-spine { position: absolute; inset: 0; border: 1px solid var(--line-soft); border-radius: 4px; background: var(--panel); }
.trc-card {
  position: relative; border: 1px solid var(--line-hi); border-radius: 4px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--terra) 6%, transparent), transparent 36%),
    var(--panel);
  box-shadow: 0 28px 70px rgba(0,0,0,0.55);
  overflow: hidden;
}
.trc-card::before { content:""; position:absolute; inset:0 0 auto 0; height:2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: 0.55; }
.trc-face { padding: 40px; display: flex; flex-direction: column; height: 100%; }
.trc-prompt { font-family: var(--f-serif); color: var(--cream); }
.trc-answer { font-family: var(--f-serif); color: var(--bone); }
.trc-answer em { color: var(--terra); font-style: normal; }
.trc-flip-hint { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--stone); }

/* progress as a row of amphora pips */
.trc-pips { display: flex; gap: 6px; align-items: center; }
.trc-pip { width: 9px; height: 13px; border-radius: 0 0 4px 4px / 0 0 6px 6px; border: 1px solid var(--line-hi); background: transparent; position: relative; }
.trc-pip::before { content:""; position:absolute; top:-3px; left:1px; right:1px; height:3px; border:1px solid var(--line-hi); border-bottom:0; }
.trc-pip.full { background: var(--terra); border-color: var(--terra); }
.trc-pip.full::before { border-color: var(--terra); }

.trc-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.trc-seg button { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; padding: 8px 14px; background: none; border: 0; border-right: 1px solid var(--line-soft); color: var(--stone); cursor: pointer; }
.trc-seg button:last-child { border-right: 0; }
.trc-seg button.on { background: color-mix(in srgb, var(--gold) 10%, transparent); color: var(--gold); }

/* shared little caption */
.tr-cap { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--stone); }

/* ════════════════════════════════════════════════════════════════════
   RECITAL: text reader — verse + interlinear gloss + meter + commentary
   ════════════════════════════════════════════════════════════════════ */
.trr-verse { font-family: var(--f-serif); font-size: 38px; line-height: 1.9; color: var(--bone); }
.trr-w { position: relative; cursor: help; transition: color 0.15s; }
.trr-w.gloss { border-bottom: 1px dotted var(--terra); }
.trr-w .pop {
  position: absolute; left: 50%; top: -2px; transform: translate(-50%, -100%);
  background: var(--inset); border: 1px solid var(--line-hi); border-radius: 3px;
  padding: 6px 11px; font-family: var(--f-sans); font-size: 13px; font-style: normal;
  color: var(--cream); white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity 0.15s; box-shadow: 0 8px 24px rgba(0,0,0,0.5); z-index: 4;
}
.trr-w:hover .pop { opacity: 1; }
.trr-w:hover { color: var(--terra); }
.trr-meter { display: flex; gap: 10px; align-items: center; }
.trr-foot { display: flex; gap: 3px; align-items: center; }
.trr-foot .s { width: 13px; height: 5px; border-radius: 3px; background: var(--gold); opacity: 0.85; }
.trr-foot .s.short { width: 7px; opacity: 0.5; }
.trr-note {
  border-left: 2px solid var(--gold); padding: 4px 0 4px 18px;
  font-family: var(--f-serif); font-size: 17px; line-height: 1.55; color: color-mix(in srgb, var(--cream) 80%, transparent);
}
.trr-note b { color: var(--gold); font-weight: 600; }

/* ════════════════════════════════════════════════════════════════════
   DRAMATIS PERSONAE: character codex (Πρόσωπα)
   ════════════════════════════════════════════════════════════════════ */
.trp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.trp-card {
  border: 1px solid var(--line); border-radius: 3px; padding: 18px 20px;
  background: color-mix(in srgb, var(--cream) 2%, transparent); position: relative; overflow: hidden;
  display: flex; gap: 16px; align-items: flex-start;
}
.trp-card::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px; }
.trp-card.greek::before { background: var(--aegean); }
.trp-card.trojan::before { background: var(--terra); }
.trp-emblem {
  width: 50px; height: 50px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-serif); font-size: 26px; color: var(--bg);
}
.trp-card.greek .trp-emblem { background: var(--aegean); }
.trp-card.trojan .trp-emblem { background: var(--terra); }
.trp-name { font-family: var(--f-serif); font-size: 25px; color: var(--bone); line-height: 1.1; }
.trp-role { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--stone); margin-top: 4px; }
.trp-desc { font-family: var(--f-serif); font-size: 15.5px; line-height: 1.45; color: color-mix(in srgb, var(--cream) 78%, transparent); margin-top: 9px; }
.trp-faction { display: inline-flex; align-items: center; gap: 7px; font-family: var(--f-mono); font-size: 11px; color: var(--stone); }
.trp-faction .sw { width: 11px; height: 11px; border-radius: 2px; }

/* ── shared mode switcher (sub-nav inside a lesson) ───────────────── */
.seg { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.seg-btn {
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 12px 20px; cursor: pointer; color: var(--stone);
  background: none; border: 0; border-bottom: 2px solid transparent; transition: all 0.16s;
}
.seg-btn:hover { color: var(--bone); }
.seg-btn.on { color: var(--gold); border-bottom-color: var(--gold); }

/* ── AI tutor components (shared with the standalone tool) ────────── */
.tt-note { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); background: color-mix(in srgb, var(--gold) 5%, transparent); border-radius: 3px; padding: 13px 16px; }
.tt-note .ic { color: var(--gold); font-size: 15px; line-height: 1.4; }
.tt-note p { margin: 0; font-family: var(--f-serif); font-size: 15.5px; line-height: 1.5; color: color-mix(in srgb, var(--cream) 82%, transparent); }
.tt-pane { border: 1px solid var(--line); border-radius: 4px; background: var(--panel); overflow: hidden; }
.tt-pane-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.tt-pane-h .lab { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--stone); }
.tt-src { padding: 24px 22px; }
.tt-srcline { display: flex; gap: 16px; padding: 7px 0; }
.tt-srcline .n { font-family: var(--f-mono); font-size: 12px; color: var(--fog); padding-top: 8px; min-width: 18px; }
.tt-srcline .g { font-family: var(--f-serif); font-size: 25px; line-height: 1.5; color: var(--bone); }
textarea.tt-input { width: 100%; box-sizing: border-box; min-height: 140px; resize: vertical; background: var(--inset); border: 1px solid var(--line); border-radius: 3px; color: var(--cream); font-family: var(--f-serif); font-size: 19px; line-height: 1.5; padding: 16px 18px; outline: none; transition: border-color 0.15s; }
textarea.tt-input:focus { border-color: var(--terra); }
textarea.tt-input::placeholder { color: var(--fog); font-style: italic; }
.tt-actions { display: flex; gap: 10px; margin-top: 14px; }
.tt-spin { width: 14px; height: 14px; border: 2px solid rgba(27,15,8,0.3); border-top-color: #1b0f08; border-radius: 50%; animation: tt-rot 0.7s linear infinite; display: inline-block; }
@keyframes tt-rot { to { transform: rotate(360deg); } }
.tt-fb { margin-top: 18px; border-top: 1px solid var(--line-soft); padding-top: 18px; }
.tt-verdict { display: inline-flex; align-items: center; gap: 9px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; padding: 7px 13px; border-radius: 2px; border: 1px solid; }
.v-σωστό { color: var(--sage); border-color: color-mix(in srgb, var(--sage) 50%, transparent); background: color-mix(in srgb, var(--sage) 12%, transparent); }
.v-κοντά { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, transparent); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.v-δουλειά { color: var(--terra); border-color: color-mix(in srgb, var(--terra) 50%, transparent); background: color-mix(in srgb, var(--terra) 12%, transparent); }
.tt-bar-score { height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; margin: 14px 0 4px; }
.tt-bar-score > div { height: 100%; background: linear-gradient(90deg, var(--terra), var(--gold)); transition: width 0.5s; }
.tt-summary { font-family: var(--f-serif); font-size: 18px; line-height: 1.5; color: var(--cream); margin: 14px 0 6px; }
.tt-list { margin: 6px 0 0; padding: 0; list-style: none; }
.tt-list li { display: flex; gap: 11px; padding: 7px 0; font-family: var(--f-serif); font-size: 16px; line-height: 1.45; color: color-mix(in srgb, var(--cream) 85%, transparent); }
.tt-list li .mk { flex-shrink: 0; font-size: 14px; margin-top: 2px; }
.tt-list li.s .mk { color: var(--sage); }
.tt-list li.i .mk { color: var(--terra); }
.tt-list li .ph { color: var(--bone); font-weight: 600; }
.tt-hint { display: flex; gap: 11px; border-left: 2px solid var(--gold); padding: 10px 0 10px 16px; margin-top: 12px; font-family: var(--f-serif); font-size: 16.5px; line-height: 1.5; color: color-mix(in srgb, var(--cream) 85%, transparent); }
.tt-hint .lvl { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.tt-ref summary { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--stone); cursor: pointer; margin-top: 16px; }
.tt-ref summary:hover { color: var(--bone); }
.tt-ref .body { font-family: var(--f-serif); font-style: italic; font-size: 17px; line-height: 1.5; color: var(--stone); margin-top: 10px; padding: 12px 16px; border: 1px dashed var(--line); border-radius: 3px; }
.tt-err { color: var(--terra); font-family: var(--f-mono); font-size: 12px; margin-top: 12px; }
.tt-empty { font-family: var(--f-serif); font-style: italic; font-size: 18px; color: var(--stone); padding: 40px 0; text-align: center; border: 1px dashed var(--line); border-radius: 4px; }

/* ── codex reference table (Αόριστος Β΄) ──────────────────────────── */
.cx-wrap { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--panel); }
.cx-grid { display: grid; gap: 1px; background: var(--line-soft); }
.cx-h { background: var(--inset); padding: 12px 14px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--stone); }
.cx-h.aor { color: var(--terra); }
.cx-c { background: var(--panel); padding: 11px 14px; font-family: var(--f-serif); font-size: 21px; color: var(--cream); display: flex; flex-direction: column; justify-content: center; min-height: 30px; }
.cx-c.pres { color: var(--bone); }
.cx-c.aor { color: var(--terra); font-weight: 500; }
.cx-c .cx-gloss { font-family: var(--f-sans); font-size: 11px; font-style: normal; color: var(--fog); margin-top: 3px; letter-spacing: 0.01em; }
.cx-c input { width: 100%; background: var(--inset); border: 1px solid var(--line); border-radius: 2px; color: var(--cream); font-family: var(--f-serif); font-size: 16px; padding: 7px 9px; outline: none; }
.cx-c input:focus { border-color: var(--terra); }
.cx-del { background: var(--inset); border: 0; color: var(--terra); cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.cx-del:hover { background: color-mix(in srgb, var(--terra) 14%, transparent); }
.cx-search { width: 100%; max-width: 320px; background: var(--inset); border: 1px solid var(--line); border-radius: 3px; color: var(--cream); font-family: var(--f-serif); font-size: 16px; padding: 10px 14px; outline: none; }
.cx-search:focus { border-color: var(--terra); }
.cx-search::placeholder { color: var(--fog); font-style: italic; }

/* ── parallel bilingual reader ────────────────────────────────────── */
.pl-wrap { border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.pl-head { display: grid; grid-template-columns: 1fr 1fr; padding-left: 34px; background: var(--inset); border-bottom: 1px solid var(--line); }
.pl-h-l, .pl-h-r { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--stone); padding: 12px 16px; }
.pl-h-r { border-left: 1px solid var(--line-soft); }
.pl-row { display: grid; grid-template-columns: 34px 1fr 1fr; border-bottom: 1px solid var(--line-soft); }
.pl-row:last-child { border-bottom: 0; }
.pl-n { font-family: var(--f-mono); font-size: 11px; color: var(--fog); padding: 14px 0 0 10px; }
.pl-a { font-family: var(--f-serif); font-size: 20px; line-height: 1.5; color: var(--bone); padding: 12px 16px; }
.pl-g { font-family: var(--f-serif); font-size: 18px; line-height: 1.5; color: color-mix(in srgb, var(--cream) 85%, transparent); padding: 12px 16px; border-left: 1px solid var(--line-soft); }
.pl-g.masked { cursor: pointer; background: color-mix(in srgb, var(--cream) 2%, transparent); }
.pl-g.masked:hover { background: color-mix(in srgb, var(--gold) 6%, transparent); }
.pl-tap { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--stone); }

/* ── Q&A lesson (reveal cards + exam) ─────────────────────────────── */
.qa-src { border: 1px solid var(--line); border-radius: 3px; margin-top: 20px; background: color-mix(in srgb, var(--cream) 2%, transparent); }
.qa-src > summary { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); cursor: pointer; padding: 12px 16px; }
.qa-src-body { padding: 0 16px 14px; }
.qa-src-line { display: flex; gap: 14px; padding: 5px 0; }
.qa-src-line .n { font-family: var(--f-mono); font-size: 12px; color: var(--fog); min-width: 18px; }
.qa-src-line .g { font-family: var(--f-serif); font-size: 20px; color: var(--bone); }
.qa-card { border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.qa-card.open { border-color: var(--line-hi); }
.qa-q { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: none; border: 0; cursor: pointer; padding: 14px 16px; color: var(--cream); }
.qa-q:hover { background: color-mix(in srgb, var(--cream) 3%, transparent); }
.qa-num { font-family: var(--f-mono); font-size: 12px; color: var(--terra); flex-shrink: 0; }
.qa-qtext { flex: 1; font-family: var(--f-serif); font-size: 19px; }
.qa-chev { color: var(--stone); }
.qa-a { padding: 0 16px 16px; border-top: 1px solid var(--line-soft); }
.qa-a-lab { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--terra); margin: 12px 0 6px; }
.qa-a-body { font-family: var(--f-serif); font-size: 18px; line-height: 1.5; color: var(--bone); }
.qa-note { font-family: var(--f-serif); font-style: italic; font-size: 15px; color: var(--stone); margin-top: 8px; border-left: 2px solid var(--line-hi); padding-left: 12px; }
.qa-exam-q { display: flex; gap: 14px; align-items: baseline; font-family: var(--f-serif); font-size: 24px; color: var(--bone); }

/* ── lesson layout scaffold (overlay body) ────────────────────────── */
.tr-inner { max-width: 1060px; margin: 0 auto; padding: 40px 48px 80px; }
.tr-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.tr-edited { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--line); border-radius: 2px; padding: 3px 8px; }

/* ── full-screen lesson overlay (created by theory-lesson.js) ─────── */
.tr-overlay {
  position: fixed; inset: 0; z-index: 1200;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: none; background: var(--sym-bg-dark);
}
.tr-overlay.active { display: block; }
.tr-overlay > .tr { min-height: 100vh; }
.tr-overlay-close {
  position: fixed; top: 18px; right: 20px; z-index: 2;
  width: 40px; height: 40px; border-radius: 2px;
  border: 1px solid color-mix(in srgb, var(--sym-gold) 42%, transparent);
  background: color-mix(in srgb, var(--sym-bg-panel) 80%, transparent);
  color: var(--sym-cream); font-family: var(--sym-font-mono); font-size: 15px;
  cursor: pointer; transition: all 0.18s ease;
}
.tr-overlay-close:hover { border-color: var(--sym-terra); color: var(--sym-terra); }

@media (max-width: 880px) {
  .tr-inner { padding: 28px 18px 60px; }
  .trp-grid { grid-template-columns: 1fr; }
  .trd-grid { grid-template-columns: 1fr; }
  .trm-grid { font-size: 0.9em; }
  .trc-face { padding: 26px; }
  .tr-overlay-close { top: 12px; right: 12px; }
}
