/* ============================================================================
   An Equation of Me — v8.32 — "the night draft"
   Theme: a poet's midnight writing desk. Deep indigo ink-wash field with
   gold-leaf accents; work happens on warm cream paper sheets. Variables are
   set in italic serif — the way mathematics actually typesets them — and each
   of the student's 5–7 words carries ONE of seven term colors everywhere it
   appears: in the equation, in the poem, in the checklist, and in print.
     term colors (ink, on paper)  --t1..--t7
     term colors (light, on dark) --t1L..--t7L  (scoped overrides below)
   Fonts: Cormorant Garamond (equation + poetry) · Work Sans (interface).
   ========================================================================= */

:root {
    --field:  #131024;
    --field2: #1b1633;
    --paper:  #f7f0df;
    --paper2: #efe5cd;
    --paperedge: #e0d3b2;
    --ink:  #262019;
    --ink2: #55493a;
    --gold:  #d9a441;
    --goldL: #e9c06b;
    --golddeep: #a87f24;
    --mut:  #aaa0c8;
    --mut2: #7d74a0;

    --t1: #b02f36;  --t1L: #ff9090;
    --t2: #c05c1d;  --t2L: #ffb066;
    --t3: #94720c;  --t3L: #eacd66;
    --t4: #2f7d4f;  --t4L: #7fd8a2;
    --t5: #20718b;  --t5L: #6fd0e8;
    --t6: #3a5da8;  --t6L: #97b1f7;
    --t7: #7d4ba0;  --t7L: #d0a0f0;

    --serif: 'Cormorant Garamond', 'Georgia', serif;
    --sans: 'Work Sans', 'Segoe UI', sans-serif;
}

/* the retheme trap: any id display rule would beat [hidden] without this */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font: 400 1rem/1.6 var(--sans);
    color: #efeafd;
    background-color: var(--field);
    background-image:
        linear-gradient(rgba(19, 16, 36, .78), rgba(19, 16, 36, .90)),
        url("img/ink-wash.jpg?v=1.0");
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
}

/* ── Topbar ────────────────────────────────────────────────────────────── */
.eom-topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 8px 18px;
    background: rgba(19, 16, 36, .86);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    border-bottom: 1px solid rgba(217, 164, 65, .28);
}
.eom-owl img { display: block; }
.eom-wordmark {
    font: 500 1.5rem/1 var(--serif);
    color: #f2ecdb; text-decoration: none; letter-spacing: .01em;
    white-space: nowrap;
}
.eom-wordmark b { font-style: italic; font-weight: 600; color: var(--gold); }
.eom-ver {
    font: 600 .62rem/1 var(--sans); font-style: normal;
    color: var(--mut2); margin-left: 7px; letter-spacing: .08em;
    vertical-align: 2px;
}
.eom-modes {
    display: flex; margin-left: 14px; overflow: hidden;
    border: 1px solid rgba(217, 164, 65, .40); border-radius: 999px;
}
.eom-mode {
    padding: 7px 15px; text-decoration: none;
    font: 600 .72rem/1 var(--sans); letter-spacing: .14em; color: var(--mut);
    transition: background .18s ease, color .18s ease;
}
.eom-mode:hover { color: #f2ecdb; }
.eom-mode.is-on { background: rgba(217, 164, 65, .18); color: #f2ecdb; }
/* paper mode: the digital step rail and Save make no sense — hide them */
body.eom-paper .eom-steps, body.eom-paper #SaveButton { display: none; }
.eom-steps { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.eom-step {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 12px; border-radius: 8px;
    font: 600 .78rem/1 var(--sans); letter-spacing: .12em;
    color: var(--mut); text-decoration: none;
    border: 1px solid transparent;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.eom-step:hover { color: #f2ecdb; background: rgba(255, 255, 255, .05); }
.eom-step.is-active {
    color: #f2ecdb; border-color: rgba(217, 164, 65, .55);
    background: rgba(217, 164, 65, .10);
}
.eom-step.is-locked { opacity: .42; }
.eom-step.is-locked::after { content: "🔒"; font-size: .7rem; }
.eom-stepnum {
    display: inline-grid; place-items: center;
    width: 19px; height: 19px; border-radius: 50%;
    font: 700 .68rem/1 var(--sans); color: #171126;
}
.eom-stepnum.n1 { background: var(--gold); }
.eom-stepnum.n2 { background: var(--t5L); }
.eom-stepnum.n3 { background: var(--t7L); }
.eom-sep { width: 1px; height: 20px; background: rgba(217, 164, 65, .35); margin: 0 5px; }
.eom-actions { display: flex; align-items: center; gap: 10px; }
.eom-login {
    font: 600 .74rem/1 var(--sans); letter-spacing: .1em;
    color: var(--mut); text-decoration: none;
}
.eom-login:hover { color: #f2ecdb; }
/* signed in: the slot holds a NAME, not a link — the label letter-spacing
   that suits "LOG IN" reads as an air-gapped mess on a real name, and there
   is nowhere to click through to. Italic serif, because this name is the
   SUBJECT of their equation. owlet.js sits its owl in front of it. */
.eom-login.is-signedin {
    display: inline-flex; align-items: center;
    font: 600 1.02rem/1 var(--serif); font-style: italic; letter-spacing: .01em;
    color: #f2ecdb; cursor: default; white-space: nowrap;
}
.eom-login.is-signedin:hover { color: #f2ecdb; }
/* signed OUT: the page is open to everyone, so LOG IN is an invitation, not a
   gate — give it a gold outline so it's findable without shouting. */
.eom-login.is-signedout {
    padding: 6px 12px; border-radius: 999px;
    border: 1px solid rgba(217, 164, 65, .5); color: var(--gold);
}
.eom-login.is-signedout:hover { background: rgba(217, 164, 65, .12); color: #f2ecdb; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.eom-btn {
    display: inline-block; cursor: pointer;
    padding: 9px 18px; border-radius: 9px; border: 1px solid rgba(217, 164, 65, .5);
    font: 600 .8rem/1 var(--sans); letter-spacing: .09em;
    color: #f2ecdb; background: transparent; text-decoration: none;
    transition: background .18s ease, transform .12s ease;
}
.eom-btn:hover { background: rgba(217, 164, 65, .12); }
.eom-btn--primary {
    background: linear-gradient(160deg, var(--goldL, #e9c06b), var(--gold) 55%, var(--golddeep));
    border-color: transparent; color: #221a0a;
}
.eom-btn--primary:hover { background: linear-gradient(160deg, #f0cd85, var(--gold) 60%, var(--golddeep)); transform: translateY(-1px); }
.eom-btn:active { transform: translateY(0) scale(.98); }

/* ── Main / parts ──────────────────────────────────────────────────────── */
.eom-main { max-width: 1080px; margin: 0 auto; padding: 34px 20px 70px; }
.eom-part { margin-bottom: 26px; }
.eom-parthead { max-width: 760px; margin: 6px auto 26px; text-align: center; }
.eom-eyebrow {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 0 0 6px; font: 600 .72rem/1 var(--sans);
    letter-spacing: .22em; text-transform: uppercase; color: var(--gold);
}
.eom-eyebrow svg { flex: 0 0 auto; }
.eom-parthead h2 {
    margin: 0 0 12px; font: 600 2.5rem/1.12 var(--serif);
    color: #f5efe0; letter-spacing: .005em;
}
.eom-guide { margin: 0; color: var(--mut); font-size: .95rem; }
.eom-guide b, .eom-guide a { color: #e8e1f6; }
.eom-guide a { color: var(--gold); }

/* ── The equation panel (the centerpiece) ──────────────────────────────── */
.eom-eqpanel {
    position: relative; overflow: hidden;
    margin: 0 0 26px; padding: 44px 28px 30px;
    border: 1px solid rgba(217, 164, 65, .30); border-radius: 16px;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(217, 164, 65, .10), transparent 55%),
        linear-gradient(170deg, rgba(38, 30, 64, .92), rgba(21, 17, 40, .94));
    text-align: center;
}
.eom-eq {
    margin: 0; font: 500 clamp(1.7rem, 4.4vw, 2.7rem)/1.55 var(--serif);
    font-style: italic; color: #efe8d6;
    display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
    column-gap: .45em; row-gap: .25em;
}
.eom-eq .eom-me { color: var(--gold); }
.eom-eq .eom-op { font-style: normal; color: var(--mut2); font-size: .78em; }
.eom-term { text-shadow: 0 0 22px rgba(255, 255, 255, .12); }
.eom-term.is-new { animation: eomTermIn .7s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes eomTermIn {
    from { opacity: 0; transform: translateY(16px) scale(.85); filter: blur(5px); }
    to   { opacity: 1; transform: none; filter: blur(0); }
}
.eom-ghost {
    display: inline-block; width: 3.2em; height: .05em;
    border-bottom: 2px dashed rgba(217, 164, 65, .45);
    animation: eomGhost 2.6s ease-in-out infinite;
}
@keyframes eomGhost { 0%, 100% { opacity: .45; } 50% { opacity: .95; } }
.eom-eqcap {
    max-width: 640px; margin: 22px auto 0;
    font-size: .8rem; color: var(--mut2); line-height: 1.65;
}
.eom-eqcap b { color: var(--mut); }

/* dark-context term colors (equation panel + poem-side checklist) */
.eom-eqpanel .t1, .eom-eqside .t1 { color: var(--t1L); }
.eom-eqpanel .t2, .eom-eqside .t2 { color: var(--t2L); }
.eom-eqpanel .t3, .eom-eqside .t3 { color: var(--t3L); }
.eom-eqpanel .t4, .eom-eqside .t4 { color: var(--t4L); }
.eom-eqpanel .t5, .eom-eqside .t5 { color: var(--t5L); }
.eom-eqpanel .t6, .eom-eqside .t6 { color: var(--t6L); }
.eom-eqpanel .t7, .eom-eqside .t7 { color: var(--t7L); }

/* paper-context term colors (chips, poem highlight, print) */
.t1 { color: var(--t1); } .t2 { color: var(--t2); } .t3 { color: var(--t3); }
.t4 { color: var(--t4); } .t5 { color: var(--t5); } .t6 { color: var(--t6); }
.t7 { color: var(--t7); }

/* ── Part 1 entry card (paper) ─────────────────────────────────────────── */
.eom-entry {
    max-width: 720px; margin: 0 auto;
    background: linear-gradient(178deg, var(--paper), var(--paper2));
    border: 1px solid var(--paperedge); border-radius: 14px;
    padding: 22px 26px 20px; color: var(--ink);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
}
.eom-entry label {
    display: flex; align-items: center; gap: 8px;
    font: 600 .72rem/1 var(--sans); letter-spacing: .18em; text-transform: uppercase;
    color: var(--ink2); margin-bottom: 9px;
}
.eom-entry label + .eom-entryrow, .eom-entry label + .eom-cats { margin-bottom: 18px; }
.eom-stepdot {
    display: inline-grid; place-items: center; flex: 0 0 auto;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--ink); color: var(--paper);
    font: 700 .66rem/1 var(--sans); letter-spacing: 0;
}
/* pressing ADD with no category picked lights up step 1 */
.eom-entry label.needs-pick { color: var(--t1); }
.eom-entry label.needs-pick .eom-stepdot { background: var(--t1); }
.eom-cats.needs-pick .eom-cat {
    border-color: var(--t1); color: var(--t1);
    animation: eomPick .5s ease 2;
}
@keyframes eomPick {
    0%, 100% { transform: none; }
    30% { transform: translateY(-3px); }
    60% { transform: none; }
}
.eom-entryrow { display: flex; gap: 10px; }
#WordInput, #FutureInput {
    flex: 1 1 auto; min-width: 0;
    font: 500 1.25rem/1.3 var(--serif); font-style: italic; color: var(--ink);
    background: rgba(255, 255, 255, .55);
    border: none; border-bottom: 2px solid var(--golddeep); border-radius: 6px 6px 0 0;
    padding: 8px 12px; outline: none;
}
#WordInput:focus, #FutureInput:focus { background: rgba(255, 255, 255, .85); }
#WordInput::placeholder, #FutureInput::placeholder { color: #a4977f; font-size: 1.05rem; }
.eom-cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 4px; }
.eom-cat {
    cursor: pointer; padding: 6px 13px; border-radius: 999px;
    border: 1px solid #cbbc98; background: transparent;
    font: 600 .7rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink2);
    transition: background .15s ease, border-color .15s ease;
}
.eom-cat:hover { border-color: var(--golddeep); }
.eom-cat.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.eom-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.eom-chip {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 7px 10px 7px 13px; border-radius: 10px;
    background: rgba(255, 255, 255, .5); border: 1px solid #d8cba8;
    border-left: 4px solid currentColor;
    animation: eomChipIn .35s ease both;
}
@keyframes eomChipIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.eom-chip .w { font: 600 1.12rem/1.1 var(--serif); font-style: italic; }
/* the reason is a button — click it to cycle to the next one */
.eom-chip .c {
    cursor: pointer; display: inline-block; margin-top: 3px;
    border: none; background: transparent; padding: 1px 3px; border-radius: 4px;
    font: 600 .6rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink2); border-bottom: 1px dotted #b3a888;
    transition: color .15s ease, background .15s ease;
}
.eom-chip .c:hover { color: var(--ink); background: rgba(217, 164, 65, .18); border-bottom-color: var(--golddeep); }
.eom-chip .x {
    cursor: pointer; border: none; background: transparent; color: var(--ink2);
    font: 600 .9rem/1 var(--sans); padding: 2px 4px; border-radius: 5px;
}
.eom-chip .x:hover { color: var(--t1); background: rgba(176, 47, 54, .12); }
/* the word itself is a button — click to retype it */
.eom-chip .w {
    cursor: text; border: none; background: transparent; padding: 0;
    font: 600 1.12rem/1.1 var(--serif); font-style: italic; color: inherit;
    text-align: left; border-radius: 4px;
}
.eom-chip .w:hover { background: rgba(217, 164, 65, .16); }
.eom-chip .wedit {
    width: 6.5em; font: 600 1.12rem/1.1 var(--serif); font-style: italic; color: var(--ink);
    background: #fffdf4; border: none; border-bottom: 2px solid var(--golddeep);
    border-radius: 4px 4px 0 0; padding: 1px 4px; outline: none;
}

/* ── misspelled terms: the same wavy red a browser uses ────────────────── */
.eom-chip .w.is-bad, .eom-spellrow b.is-bad {
    text-decoration: underline wavy #c0392b; text-underline-offset: 3px;
}
.eom-eq .eom-term.is-bad {
    text-decoration: underline wavy #ff9090; text-underline-offset: 7px;
    text-decoration-thickness: 1.5px;
}
.eom-spellhint {
    margin-top: 14px; padding: 12px 14px; border-radius: 10px;
    background: rgba(176, 47, 54, .07); border: 1px solid rgba(176, 47, 54, .22);
}
.eom-spellcap { margin: 0 0 8px; font: 500 .78rem/1.5 var(--sans); color: var(--ink2); }
.eom-spellrow {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin: 0 0 6px; font: 500 .8rem/1.5 var(--sans); color: var(--ink2);
}
.eom-spellrow:last-child { margin-bottom: 0; }
.eom-spellrow b { font: 600 1.05rem/1.2 var(--serif); font-style: italic; color: var(--ink); margin-right: 4px; }
.eom-spellsug, .eom-spellkeep {
    cursor: pointer; padding: 4px 10px; border-radius: 999px;
    border: 1px solid #cbbc98; background: rgba(255, 255, 255, .6); color: var(--ink);
    font: 600 .74rem/1.2 var(--serif); font-style: italic;
}
.eom-spellsug:hover { border-color: var(--golddeep); background: rgba(217, 164, 65, .18); }
/* IGNORE — the escape for names and other languages. Dashed and set apart
   from the suggestions so it reads as "none of these", not a correction. */
.eom-spellkeep {
    margin-left: auto; font: 700 .64rem/1.2 var(--sans); font-style: normal;
    letter-spacing: .1em; text-transform: uppercase; color: var(--ink2);
    background: transparent; border-style: dashed; padding: 5px 12px;
}
.eom-spellkeep:hover { color: var(--t4); border-color: var(--t4); background: rgba(47, 125, 79, .10); }
.eom-spellnone { font-style: italic; color: #9a8c6f; font-size: .74rem; }
/* which term the flagged word sits in — "Furio" in "Boris and Furio" */
.eom-spellctx { font: 500 .72rem/1.4 var(--sans); color: #9a8c6f; margin-right: 2px; }

/* ── CHECK: the end of Part 1, and the sign to Part 2 ──────────────────── */
.eom-checkbar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 18px; padding-top: 16px; border-top: 1px dashed #d8cba8;
}
.eom-checkbar .eom-btn { flex: 0 0 auto; }
.eom-checknote { flex: 1 1 220px; font: 500 .76rem/1.5 var(--sans); color: var(--ink2); }
.eom-verdict {
    margin: 12px 0 0; padding: 11px 14px; border-radius: 10px;
    font: 500 .85rem/1.5 var(--sans);
}
.eom-verdict.is-warn { background: rgba(192, 92, 29, .10); border: 1px solid rgba(192, 92, 29, .3); color: #8a4413; }
.eom-verdict.is-good { background: rgba(47, 125, 79, .10); border: 1px solid rgba(47, 125, 79, .35); color: #1e5c38; font-weight: 600; }
.eom-verdict.is-busy, .eom-verdict.is-info { background: rgba(85, 73, 58, .07); border: 1px solid #d8cba8; color: var(--ink2); }
.eom-btn--go {
    display: block; width: 100%; margin-top: 12px; padding: 13px 18px;
    background: linear-gradient(160deg, var(--goldL), var(--gold) 55%, var(--golddeep));
    border-color: transparent; color: #221a0a; font-size: .86rem;
    animation: eomGo .45s ease both;
}
.eom-btn--go:hover { background: linear-gradient(160deg, #f0cd85, var(--gold) 60%, var(--golddeep)); }
@keyframes eomGo {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
/* the step tab glows briefly so "what's next" has a place, not just a name */
.eom-step.is-next {
    color: #f2ecdb; border-color: var(--gold);
    animation: eomNext 1.1s ease-in-out 4;
}
@keyframes eomNext {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217, 164, 65, 0); }
    50%      { box-shadow: 0 0 0 5px rgba(217, 164, 65, .22); }
}
@media (prefers-reduced-motion: reduce) {
    .eom-step.is-next { animation: none; box-shadow: 0 0 0 3px rgba(217, 164, 65, .28); }
}
.eom-count { margin: 14px 0 0; font-size: .82rem; color: var(--ink2); }
.eom-count.is-good { color: var(--t4); font-weight: 600; }
.eom-future { margin-top: 18px; padding-top: 16px; border-top: 1px dashed #d8cba8; }
.eom-futurenote { margin: 10px 0 0; font-size: .78rem; color: var(--ink2); line-height: 1.6; }

/* ── the future term: gold, held in muted parentheses ──────────────────── */
.tf { color: var(--golddeep); }
.eom-eqpanel .tf, .eom-eqside .tf { color: var(--goldL); }
.eom-term .par, .eom-sheet .par { font-style: normal; font-size: .82em; opacity: .55; }
.eom-ghost.is-fut { width: 2.6em; margin: 0 .1em; }
#TermChecklist .ftag {
    font: 600 .56rem/1 var(--sans); font-style: normal;
    letter-spacing: .12em; text-transform: uppercase; color: var(--gold);
    border: 1px solid rgba(217, 164, 65, .45); border-radius: 999px;
    padding: 2px 7px; margin-left: 8px;
}

/* ── coefficients: upright, snug against their italic term ─────────────── */
.eom-eq .coef, .eom-sheet .eq .coef {
    font-style: normal; font-size: .72em; margin-right: .1em;
    opacity: .92; letter-spacing: 0;
}

/* ── Part 2: rank the terms ────────────────────────────────────────────── */
.eom-eqpanel--tight { padding: 30px 24px 26px; }
.eom-orderlist { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.eom-orow {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border-radius: 10px;
    background: rgba(255, 255, 255, .5); border: 1px solid #d8cba8;
    transition: transform .18s ease;
}
.eom-orow.is-dragging {
    transition: none; position: relative; z-index: 5;
    background: #fffdf4; box-shadow: 0 12px 28px rgba(0, 0, 0, .30);
}
.eom-orow .grip {
    cursor: grab; touch-action: none; user-select: none;
    color: #b3a888; font: 700 1.05rem/1 var(--sans); letter-spacing: -2px;
    padding: 4px 6px 4px 2px;
}
.eom-orow.is-dragging .grip { cursor: grabbing; }
.eom-orow .rcoef {
    min-width: 1.3em; text-align: center;
    font: 600 1.5rem/1 var(--serif); color: var(--golddeep);
}
.eom-orow .rcoef.is-one { opacity: .32; text-decoration: line-through; }
.eom-orow .rword { font: 600 1.25rem/1.2 var(--serif); font-style: italic; }
.eom-orow .rcat {
    margin-left: auto; font: 600 .62rem/1 var(--sans);
    letter-spacing: .1em; text-transform: uppercase; color: var(--ink2);
}
.eom-orow .rbtns { display: flex; gap: 4px; }
.eom-orow .rbtns button {
    cursor: pointer; border: 1px solid #cbbc98; background: transparent;
    border-radius: 6px; padding: 3px 8px; color: var(--ink2); font-size: .72rem;
}
.eom-orow .rbtns button:hover:not(:disabled) { border-color: var(--golddeep); color: var(--ink); }
.eom-orow .rbtns button:disabled { opacity: .3; cursor: default; }
.eom-ordernote { margin: 12px 0 0; font-size: .8rem; color: var(--ink2); }
.eom-ordernote i { font-family: var(--serif); font-weight: 600; }
.eom-orderbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }

/* ── Part 3: poem sheet + equation checklist ───────────────────────────── */
.eom-poemgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.eom-poemsheet {
    background: linear-gradient(178deg, var(--paper), var(--paper2));
    border: 1px solid var(--paperedge); border-radius: 14px;
    padding: 30px 34px 34px; color: var(--ink);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
    min-height: 460px;
}
#PoemTitle {
    display: block; width: 100%;
    font: 700 1.7rem/1.25 var(--serif); font-style: italic; color: var(--ink);
    background: transparent; border: none; outline: none;
    border-bottom: 1px solid #d8cba8; padding: 2px 2px 8px; margin-bottom: 10px;
}
#PoemTitle::placeholder { color: #b3a888; }
.eom-poemwrap { position: relative; }
.eom-poemhl, #PoemText {
    font: 500 1.22rem/1.85 var(--serif);
    letter-spacing: .002em;
    padding: 14px 2px 40px;
    width: 100%;
    white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word;
}
.eom-poemhl {
    position: absolute; inset: 0; color: var(--ink);
    pointer-events: none; z-index: 0;
}
.eom-poemhl i { font-style: inherit; font-weight: 600; }
#PoemText {
    position: relative; z-index: 1; display: block;
    background: transparent; color: transparent; caret-color: var(--ink);
    border: none; outline: none; resize: none; overflow: hidden; min-height: 300px;
}
#PoemText::placeholder { color: #b3a888; }
#PoemText::selection { background: rgba(217, 164, 65, .32); }
.eom-eqside {
    position: sticky; top: 84px;
    border: 1px solid rgba(217, 164, 65, .30); border-radius: 14px;
    background: linear-gradient(170deg, rgba(38, 30, 64, .92), rgba(21, 17, 40, .94));
    padding: 18px 20px 20px;
}
.eom-eqside .eom-eyebrow { justify-content: flex-start; margin-bottom: 12px; }
#TermChecklist { list-style: none; margin: 0 0 14px; padding: 0; }
#TermChecklist li {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 2px; border-bottom: 1px dashed rgba(217, 164, 65, .16);
    font: 600 1.15rem/1.2 var(--serif); font-style: italic;
    opacity: .5; transition: opacity .3s ease;
}
#TermChecklist li.is-used { opacity: 1; }
#TermChecklist .dot {
    flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%;
    border: 2px solid currentColor; background: transparent;
    transition: background .3s ease, box-shadow .3s ease;
}
#TermChecklist li.is-used .dot { background: currentColor; box-shadow: 0 0 10px currentColor; }
#TermChecklist .st { margin-left: auto; font: 600 .72rem/1 var(--sans); letter-spacing: .1em; color: var(--mut2); font-style: normal; }
/* "you wrote mom ?" — an offer under an unmatched term, never an assumption */
#TermChecklist .eom-kinrow {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    border-bottom: none; padding: 0 2px 8px 20px; opacity: 1;
}
.eom-kinrow .kinq {
    font: 500 .66rem/1.2 var(--sans); font-style: italic; color: var(--mut2);
}
.eom-kinbtn {
    cursor: pointer; padding: 3px 9px; border-radius: 999px;
    border: 1px dashed rgba(217, 164, 65, .45); background: transparent;
    color: var(--goldL); font: 500 .8rem/1.2 var(--serif); font-style: italic;
}
.eom-kinbtn:hover { background: rgba(217, 164, 65, .14); border-style: solid; color: #f2ecdb; }
/* an unmatched term's status invites the student to name the word they used */
#TermChecklist .st.is-link { cursor: pointer; }
#TermChecklist .st.is-link b { color: var(--gold); font-size: .9rem; }
#TermChecklist .st.is-link:hover { color: var(--gold); }
#TermChecklist .kinedit {
    width: 7.5em; font: 500 .9rem/1.2 var(--serif); font-style: italic; color: #f2ecdb;
    background: rgba(255, 255, 255, .1); border: none;
    border-bottom: 1px solid var(--gold); border-radius: 4px 4px 0 0;
    padding: 2px 5px; outline: none;
}
#TermChecklist .kinedit::placeholder { color: var(--mut2); font-size: .72rem; }
#TermChecklist li.is-used .st { color: var(--t4L); }
.eom-progress { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
#TermProgressBar {
    height: 100%; width: 0; border-radius: 999px;
    background: linear-gradient(90deg, var(--golddeep), var(--gold), #f0d489);
    transition: width .45s cubic-bezier(.3, .8, .3, 1);
}
#TermProgressText { margin: 9px 0 0; font-size: .78rem; color: var(--mut); }
#TermProgressText.is-done { color: var(--gold); font-weight: 600; }
.eom-eqside.is-done { border-color: rgba(217, 164, 65, .65); box-shadow: 0 0 34px rgba(217, 164, 65, .18); }
#TermChecklist li { cursor: pointer; }

/* ── the poet's toolbox (below the woven-in chart) ─────────────────────── */
.eom-wordhelp { margin-top: 16px; padding-top: 14px; border-top: 1px dashed rgba(217, 164, 65, .25); }
.eom-whcap { font-size: .73rem; color: var(--mut2); line-height: 1.6; margin: 0 0 10px; }
.eom-whcap b { color: var(--mut); }
#WHInput {
    width: 100%; display: block;
    font: 500 1.05rem/1.3 var(--serif); font-style: italic; color: #f2ecdb;
    background: rgba(255, 255, 255, .07);
    border: none; border-bottom: 2px solid var(--golddeep); border-radius: 6px 6px 0 0;
    padding: 7px 10px; outline: none;
}
#WHInput:focus { background: rgba(255, 255, 255, .12); }
#WHInput::placeholder { color: var(--mut2); font-size: .95rem; }
.eom-whbtns { display: flex; gap: 8px; margin-top: 10px; }
.eom-whbtns .eom-btn { flex: 1; padding: 8px 6px; font-size: .68rem; letter-spacing: .08em; text-align: center; }
.eom-whstatus { font-size: .74rem; color: var(--mut); margin: 10px 0 8px; min-height: 1em; }
.eom-whresults { display: flex; flex-wrap: wrap; gap: 6px; max-height: 190px; overflow-y: auto; }
.eom-whchip {
    cursor: pointer; padding: 5px 11px; border-radius: 999px;
    border: 1px solid rgba(217, 164, 65, .35); background: rgba(255, 255, 255, .05);
    color: #efe8d6; font: 500 .88rem/1.2 var(--serif); font-style: italic;
    transition: border-color .15s ease, background .15s ease;
}
.eom-whchip:hover { border-color: var(--gold); background: rgba(217, 164, 65, .15); }
.eom-whspell { width: 100%; margin-top: 8px; padding: 8px 6px; font-size: .68rem; letter-spacing: .08em; }
/* a flagged word wears the same wavy underline the browser uses */
.eom-whchip--bad {
    border-color: rgba(255, 144, 144, .45); color: #ffc9c9;
    text-decoration: underline wavy #ff9090; text-underline-offset: 3px;
}
.eom-whchip--bad:hover { border-color: var(--t1L); background: rgba(255, 144, 144, .14); }
.eom-whchip--back { font-style: normal; font-family: var(--sans); font-size: .7rem; color: var(--mut2); }

/* ── Print preview ─────────────────────────────────────────────────────── */
.eom-toolrow { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.eom-hint { font-size: .82rem; color: var(--mut); max-width: 480px; }
.eom-hint.is-warn { color: #ffb066; }
.eom-hint.is-done { color: var(--gold); font-weight: 600; }
.eom-sheets { display: flex; flex-direction: column; align-items: center; gap: 26px; }
/* WHITE, not the theme's cream (v8.30, Tan): the preview should show the
   paper the student actually has. A tinted sheet would flood a colour print
   with ink and fight coloured paper — the page's only colour should be the
   equation's terms. print-color-adjust stays on so those term colours and
   the gold rules print exactly; the sheet itself simply has nothing to paint. */
.eom-sheet {
    width: min(100%, 8.3in); min-height: 10.6in;
    background: #fff; color: var(--ink);
    border: 1px solid var(--paperedge); border-radius: 4px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
    padding: .85in .9in; position: relative;
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.eom-sheet .mast { text-align: center; margin-bottom: 34px; }
.eom-sheet .mast h1 { margin: 0; font: 600 2.5rem/1.1 var(--serif); color: var(--ink); }
.eom-sheet .mast h1 i { color: var(--golddeep); }
.eom-rule { display: flex; align-items: center; gap: 10px; margin: 16px auto 0; max-width: 4.6in; color: var(--golddeep); }
.eom-rule::before, .eom-rule::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--golddeep)); }
.eom-rule::after { background: linear-gradient(90deg, var(--golddeep), transparent); }
/* the author line reads as one phrase — a small muted italic "by" snug
   against the name, the pair centered as a unit. field-sizing lets the
   input hug its text (Chrome 123+); the fallback keeps it modest and
   left-aligned so "by" still sits beside the name's first letter. */
.eom-byline {
    display: flex; justify-content: center; align-items: baseline; gap: 9px;
    margin: 0 0 26px; font: italic 500 .92rem/1.3 var(--serif); color: #9a8c6f;
}
.eom-sheetname {
    font: 600 1.35rem/1.3 var(--serif); font-style: italic; color: var(--ink);
    background: transparent; border: none; outline: none; padding: 0;
    text-align: left; min-width: .8in;
    field-sizing: content;
}
.eom-sheet .eq {
    font: 500 1.6rem/1.7 var(--serif); font-style: italic; text-align: center;
    margin: 0 0 36px;
}
.eom-sheet .eq .eom-me { color: var(--golddeep); }
.eom-sheet .eq .eom-op { font-style: normal; color: #9a8c6f; font-size: .8em; }
.eom-sheet .ptitle { font: 700 1.55rem/1.3 var(--serif); font-style: italic; text-align: center; margin: 0 0 6px; }
.eom-sheet .poem {
    font: 500 1.08rem/1.9 var(--serif); white-space: pre-wrap; overflow-wrap: break-word;
    max-width: 5.6in; margin: 0 auto;
}
.eom-sheet .poem i { font-style: inherit; font-weight: 600; }
.eom-sheet .sfoot {
    position: absolute; left: .9in; right: .9in; bottom: .55in;
    text-align: center; font: 500 .68rem/1.5 var(--sans); color: #9a8c6f;
    border-top: 1px solid #e6dcc2; padding-top: 8px;
}
/* ── PAPER worksheets ──────────────────────────────────────────────────── */
.eom-wsheet { min-height: 10.6in; }
.ws-mast {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
    border-bottom: 2px solid var(--ink); padding-bottom: 9px; margin-bottom: 8px;
}
.ws-title { font: 600 1.35rem/1 var(--serif); white-space: nowrap; }
.ws-title i { color: var(--golddeep); }
.ws-id { display: flex; align-items: baseline; gap: 7px; font: 500 .8rem/1.4 var(--sans); color: var(--ink2); flex: 1; justify-content: flex-end; }
.ws-fill { display: inline-block; width: 2.1in; border-bottom: 1.5px solid #b9ab8a; height: 1em; }
.ws-fill--s { width: .55in; }
.ws-h { display: flex; align-items: center; gap: 9px; font: 600 1.15rem/1.2 var(--serif); margin: 18px 0 5px; }
/* Outlined rings, not filled discs (v8.30, Tan): the worksheets go out on
   coloured paper, so a printed sheet should lay down ink only where there
   is writing — a ring plus a coloured numeral says the same thing with a
   fraction of the ink and lets the paper show through. */
.ws-num {
    display: inline-grid; place-items: center; border-radius: 50%;
    /* flex:0 0 keeps it a true circle — the heading is a flex row and would
       otherwise squash it to an oval (unnoticeable when filled, glaring as a ring) */
    flex: 0 0 22px; width: 22px; height: 22px;
    font: 700 .8rem/1 var(--sans); font-style: normal;
    background: transparent; border: 1.5px solid currentColor;
}
.ws-num.n1 { color: var(--golddeep); }
.ws-num.n2 { color: var(--t5); }
.ws-num.n3 { color: var(--t7); }
.ws-dir { font: 500 .82rem/1.5 var(--sans); color: var(--ink2); margin: 0 0 12px; }
.ws-line { flex: 1; border-bottom: 1.5px solid #b9ab8a; height: .3in; }
.ws-row { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.ws-n { font: 600 .8rem/1.6 var(--sans); color: var(--ink2); width: 1em; text-align: right; }
.ws-circ { font: 500 .68rem/1.4 var(--sans); color: var(--ink2); white-space: nowrap; }
.ws-fut { margin: 14px 0 0; font: 500 .82rem/1.5 var(--sans); color: var(--ink2); }
.ws-fut p { margin: 0 0 2px; }
.ws-line--full { display: block; height: .34in; }
.ws-ranks {
    display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, auto);
    grid-auto-flow: column; gap: 10px 30px; margin: 2px 0 12px;
}
.ws-rank { display: flex; align-items: flex-end; gap: 8px; }
.ws-coef { font: 600 1.05rem/1.35 var(--serif); color: var(--golddeep); width: 1.1em; text-align: right; }
.ws-rank .ws-line { height: .28in; }
.ws-eqlabel { font: 500 .82rem/1.5 var(--sans); color: var(--ink2); margin: 6px 0 4px; }
.ws-eqlines .ws-line--big { display: block; height: .48in; }
.ws-ptitle { display: flex; align-items: flex-end; gap: 10px; font: 500 .85rem/1.5 var(--sans); color: var(--ink2); margin: 4px 0 6px; }
.ws-ptitle .ws-line { height: .34in; }
.ws-poemlines .ws-line--poem { display: block; height: .45in; }

/* ── Footer / toast ────────────────────────────────────────────────────── */
.eom-foot {
    max-width: 1080px; margin: 0 auto; padding: 22px 20px 40px;
    border-top: 1px solid rgba(217, 164, 65, .18);
    font-size: .78rem; color: var(--mut2); text-align: center;
}
.eom-foot b { color: var(--mut); }
.eom-foot a { color: var(--gold); text-decoration: none; }
.eom-foot a:hover { text-decoration: underline; }
.eom-toast {
    position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
    background: rgba(38, 30, 64, .96); color: #f2ecdb;
    border: 1px solid rgba(217, 164, 65, .5); border-radius: 10px;
    padding: 11px 20px; font: 500 .85rem/1.4 var(--sans);
    opacity: 0; pointer-events: none; z-index: 60;
    transition: opacity .25s ease, transform .25s ease;
    max-width: min(92vw, 480px); text-align: center;
}
.eom-toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.eom-toast.is-err { border-color: var(--t1L); }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .eom-poemgrid { grid-template-columns: 1fr; }
    .eom-eqside { position: static; order: -1; }
    .eom-sheet { padding: .55in .5in; min-height: 0; }
    .eom-sheet .sfoot { position: static; margin-top: 30px; }
    .eom-parthead h2 { font-size: 2rem; }
}

/* ── Reduced motion: everything lands in its resting pose ──────────────── */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
    .eom-ghost { opacity: .6; }
}

/* ── Print: only the sheets, one per page ──────────────────────────────── */
@media print {
    @page { size: letter; margin: 0.45in; }
    body { background: #fff !important; color: var(--ink); }
    /* the teacher's fixed "viewing"/"printing N projects" banner would otherwise
       print on every page (v8.33) */
    #viewBanner { display: none !important; }
    body { padding-top: 0 !important; }
    .eom-topbar, .eom-foot, .eom-toast, #Part1, #Part2, #Part3,
    #PrintContainer .eom-parthead, #PrintContainer .eom-toolrow,
    #PaperContainer .eom-parthead, #PaperContainer .eom-toolrow { display: none !important; }
    /* DIGITAL prints the finished-project sheet (even via Ctrl+P from any
       part); PAPER mode (body.eom-paper) prints the worksheets instead */
    #PrintContainer, #PrintContainer[hidden] { display: block !important; }
    #PaperContainer { display: none !important; }
    body.eom-paper #PrintContainer, body.eom-paper #PrintContainer[hidden] { display: none !important; }
    body.eom-paper #PaperContainer, body.eom-paper #PaperContainer[hidden] { display: block !important; }
    .eom-wsheet { min-height: 0; }
    .eom-main { max-width: none; padding: 0; }
    .eom-part { margin: 0; }
    .eom-sheets { display: block; }
    .eom-sheet {
        width: 100%; min-height: 0; border: none; border-radius: 0;
        box-shadow: none; padding: 0.2in 0.25in; margin: 0;
        break-after: page;
        /* paint NOTHING behind the words: on coloured paper the sheet's own
           colour would print as a rectangle over it */
        background: transparent !important;
    }
    .eom-sheet:last-child { break-after: auto; }
    .eom-sheet .sfoot { position: static; margin-top: 36px; }
}

/* ============================================================================
   THE GALLERY (Gallery.html) — v8.32
   The finished projects, hung as pages. A card is a small sheet of the same
   cream paper the print document uses, so a term keeps the ink colour it has
   carried since Part 1 — no dark-context override applies here, which is the
   point: the gallery shows the poem as it will actually be printed and read.
   Clicking a card opens the whole page; nothing here is editable.
   ========================================================================= */
.eom-galhead { max-width: 760px; margin: 6px auto 30px; text-align: center; }
.eom-galstatus {
    margin: 12px 0 0; font: 500 .82rem/1.5 var(--sans); color: var(--mut2);
    letter-spacing: .04em;
}
.eom-galwrap { max-width: 1180px; margin: 0 auto; padding: 0 20px 20px; }

/* the year, set as a rule across the field — the same gold rule the printed
   sheet uses under its masthead, so the gallery reads as a run of pages */
.eom-galyear {
    display: flex; align-items: center; gap: 16px;
    margin: 34px 0 20px; font: 600 1.25rem/1.2 var(--serif);
    color: var(--goldL); letter-spacing: .06em; text-transform: none;
}
.eom-galyear::before, .eom-galyear::after {
    content: ""; height: 1px; background: linear-gradient(90deg, transparent, rgba(217, 164, 65, .55));
}
.eom-galyear::before { flex: 0 0 26px; }
.eom-galyear::after { flex: 1; background: linear-gradient(90deg, rgba(217, 164, 65, .55), transparent); }
.eom-galyear .n { font: 500 .72rem/1 var(--sans); color: var(--mut2); letter-spacing: .12em; }

.eom-galgrid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
    gap: 24px; align-items: start;
}

.eom-galcard {
    display: flex; flex-direction: column; gap: 10px;
    margin: 0; padding: 22px 22px 18px; cursor: zoom-in; text-align: left;
    font: inherit; color: var(--ink);
    background: linear-gradient(178deg, #fffdf7, var(--paper));
    border: 1px solid var(--paperedge); border-radius: 5px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, .45);
    transition: transform .22s ease, box-shadow .22s ease;
}
.eom-galcard:hover, .eom-galcard:focus-visible {
    transform: translateY(-4px); box-shadow: 0 22px 46px rgba(0, 0, 0, .58);
    outline: none;
}
.eom-galcard:focus-visible { border-color: var(--gold); }

/* the equation, at card scale. It wraps the same way the live panel does —
   flex with a baseline, so a coefficient never drifts off its term. */
.eom-galcard .eq {
    display: flex; flex-wrap: wrap; align-items: baseline;
    column-gap: .38em; row-gap: .18em;
    margin: 0; font: 500 .96rem/1.6 var(--serif); font-style: italic;
}
.eom-galcard .eq .eom-me { color: var(--golddeep); }
.eom-galcard .eq .eom-op { font-style: normal; color: #9a8c6f; font-size: .8em; }
.eom-galcard .eq .coef { font-style: normal; font-size: .72em; margin-right: .1em; }

.eom-galrule { height: 1px; margin: 2px 0; background: linear-gradient(90deg, var(--golddeep), transparent); opacity: .5; }
.eom-galtitle { margin: 0; font: 700 1.18rem/1.3 var(--serif); font-style: italic; color: var(--ink); }
/* An untitled poem still gets a line here, so every card has the same shape —
   the words just stand in for a title the poet did not give. */
.eom-galtitle.is-untitled { color: #9a8c6f; font-weight: 500; }

/* Four lines of the poem, then the paper runs out. The fade is a mask rather
   than a gradient laid over the text, so it works on the card's own paper
   whatever shade that is. */
.eom-galpoem {
    margin: 0; font: 500 .88rem/1.72 var(--serif); white-space: pre-wrap;
    overflow-wrap: break-word; max-height: 6.9em; overflow: hidden;
    -webkit-mask-image: linear-gradient(#000 72%, transparent);
    mask-image: linear-gradient(#000 72%, transparent);
}
.eom-galpoem i { font-style: inherit; font-weight: 600; }

.eom-galby {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    margin: auto 0 0; padding-top: 8px; border-top: 1px solid #e6dcc2;
    font: italic 500 .82rem/1.4 var(--serif); color: #9a8c6f;
}
.eom-galby b { font: 600 1rem/1.3 var(--serif); font-style: italic; color: var(--ink); }
.eom-galby .more { font: 600 .6rem/1 var(--sans); font-style: normal; letter-spacing: .12em;
    text-transform: uppercase; color: var(--golddeep); white-space: nowrap; }

/* ── the opened page ───────────────────────────────────────────────────── */
.eom-gallight {
    position: fixed; inset: 0; z-index: 80; display: none;
    align-items: flex-start; justify-content: center;
    padding: 40px 20px; overflow: auto;
    background: rgba(11, 9, 22, .90); cursor: zoom-out;
}
.eom-gallight.is-open { display: flex; }
.eom-gallight .page {
    width: min(100%, 7.2in); cursor: auto; color: var(--ink);
    background: linear-gradient(178deg, #fffdf7, var(--paper));
    border: 1px solid var(--paperedge); border-radius: 5px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, .65);
    padding: .7in .8in .6in;
}
.eom-gallight .page .eq {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
    column-gap: .42em; row-gap: .2em;
    margin: 0 0 30px; font: 500 1.35rem/1.65 var(--serif); font-style: italic;
}
.eom-gallight .page .eq .eom-me { color: var(--golddeep); }
.eom-gallight .page .eq .eom-op { font-style: normal; color: #9a8c6f; font-size: .8em; }
.eom-gallight .page .eq .coef { font-style: normal; font-size: .72em; margin-right: .1em; }
.eom-gallight .page .ptitle { font: 700 1.5rem/1.3 var(--serif); font-style: italic; text-align: center; margin: 0 0 4px; }
.eom-gallight .page .pby { font: italic 500 .88rem/1.4 var(--serif); color: #9a8c6f; text-align: center; margin: 0 0 22px; }
.eom-gallight .page .poem {
    font: 500 1.05rem/1.9 var(--serif); white-space: pre-wrap; overflow-wrap: break-word;
    max-width: 5.4in; margin: 0 auto;
}
.eom-gallight .page .poem i { font-style: inherit; font-weight: 600; }
.eom-gallight .close {
    position: fixed; top: 16px; right: 24px; z-index: 81;
    background: none; border: none; cursor: pointer;
    font: 300 2.6rem/1 var(--sans); color: #e8e1f6; opacity: .8;
}
.eom-gallight .close:hover { opacity: 1; }

@media (max-width: 620px) {
    .eom-galgrid { grid-template-columns: 1fr; }
    .eom-gallight { padding: 20px 12px; }
    .eom-gallight .page { padding: .5in .45in; }
}
@media (prefers-reduced-motion: reduce) {
    .eom-galcard { transition: none; }
    .eom-galcard:hover, .eom-galcard:focus-visible { transform: none; }
}
