/* =============================================================================
   ms-practice.css — shared styles for the five mass-spec pages (engine A + B).
   Page conventions per CLAUDE.md: no frameshift (reserved zones, fixed-size
   panels present from load), verdict only on the morphing button + flash,
   game stack fits one laptop viewport.
   ============================================================================= */

/* --- Sub-nav strips (injected by ms-mass.js into #ms-subnav): two labeled
   rows — Molecular ion (GC–MS), then Exact mass (HRMS) — so the two-track
   learning order is visible on every page. Plain text links, deliberately
   not pill-shaped (the difficulty pills sit right below). --- */
.ms-subnav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0.25em auto 0.75em;
    font-size: 0.85rem;
}

.ms-subnav-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 10px;
}

.ms-subnav-label { color: #666; font-weight: 600; }

.ms-subnav-link {
    color: #6153cc;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ms-subnav-link:hover { color: #4a3fa3; }

.ms-subnav-current { color: #222; font-weight: 700; }

.ms-subnav-sep { color: #999; }

/* --- Difficulty pills --- */
.pill-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.6em;
}

.pill-row-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    margin-right: 4px;
}

.filter-pill {
    padding: 5px 14px;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    background: #fff;
    color: #555;
    transition: all 0.15s;
}

.filter-pill:hover { border-color: #6153cc; }

.filter-pill.active {
    background: #6153cc;
    border-color: #6153cc;
    color: #fff;
}

/* The compound-name line must stay in the DOM (it feeds bookmarks) but
   never show pre-answer — on MS pages the name leaks the answer
   ("...dibromo..."). Same recipe as nmr-practice.css. */
.visually-hidden-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* --- Prompt --- */
#prompt-text {
    text-align: center;
    font-size: 1.08rem;
    margin: 0.4em auto 0.7em;
    max-width: 640px;
    min-height: 2.6em;   /* two lines reserved: prompts vary, layout must not */
}

/* --- Answer inputs: one reserved zone that fits the tallest input (the
   choice grid), so switching problem/subtype never moves the page. --- */
#answer-zone {
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

#choice-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 620px;
}

#choice-buttons.input-hidden, #numeric-input-wrap.input-hidden, #check-btn.input-hidden { display: none; }

.choice-btn {
    padding: 10px 18px;
    font-size: 1rem;
    min-width: 96px;
}

.choice-btn sub { font-size: 0.72em; }

/* Formula choices on the exact-mass page carry their neutral exact mass:
   the game is handle the adduct, then compare (the mass line makes the mDa
   comparison doable in-page). */
.choice-mass {
    display: block;
    font-size: 0.78em;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 2px;
}

/* Ghosted pill row: keeps its space (no reflow on mode switch), loses its
   interactivity. Used for the difficulty row in adduct mode. */
.row-ghost { visibility: hidden; pointer-events: none; }

.choice-btn.correct-choice { background-color: #2a9d8f; color: #fff; }
.choice-btn.incorrect-choice { background-color: #d32f2f; color: #fff; }
.choice-btn:disabled { opacity: 0.75; cursor: default; }

#numeric-input-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

#answer-input {
    width: 130px;
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    font-size: 1.1rem;
    text-align: center;
}

#answer-input:focus { outline: none; border-color: #6153cc; }

/* Check/skip/save on one row (space discipline; no text input pages put the
   skip control beside the choices' reserved zone). */
#guess-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 0.4em;
}

#reveal-link {
    display: block;
    text-align: center;
    margin: 0.5em 0;
    color: #888;
    font-size: 0.9rem;
}

#reveal-link.disabled { pointer-events: none; opacity: 0.4; }

/* --- Unknown-compound card: part of the problem statement, not the
   feedback. It sits with the prompt from page load showing a "?" (the
   question is about this hidden compound), and the verdict reveals its
   structure + name in place. Fixed size (no frameshift). The explanation
   zone below is full column width like every other page. --- */
/* Zone floor: the adaptive growth (floor -> 24vh -> 2x floor) is site-wide
   in feedback-zone.css as of 2026-08-22; families set only the floor. */
#explanation-area { --zone-height: 9em; margin-top: 0.4em; }

#ms-compound-panel {
    width: 230px;
    max-width: 100%;
    height: 150px;
    margin: 0 auto 0.5em;
    border: 1px solid #e3e3ea;
    border-radius: 8px;
    background: #fafafc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 6px;
    box-sizing: border-box;
}

.ms-panel-ghost {
    color: #b6b6c2;
    font-size: 0.8rem;
    text-align: center;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ms-panel-qmark {
    font-size: 2.1rem;
    line-height: 1.1;
    color: #cfcfda;
    font-weight: 600;
}

/* Enlarged card (DoU page): sized so a drawn structure is countable in the
   structure ask-mode. The class sits statically on the page's panel div —
   BOTH modes share it, so switching pills never resizes the card. */
#ms-compound-panel.structure-ask {
    width: 400px;
    height: 260px;
}

#ms-structure { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#ms-structure svg { max-width: 100%; max-height: 100%; height: auto; }

#ms-compound-name {
    font-size: 0.78rem;
    color: #444;
    text-align: center;
    line-height: 1.3;
    max-height: 2.6em;   /* exactly two lines; longer names scroll */
    overflow-y: auto;
    padding: 2px 4px 0;
}

.ms-citation { font-size: 0.8rem; color: #777; }

/* --- Compaction: keep the game stack inside one laptop viewport. --- */
@media (max-height: 940px) {
    #prompt-text { margin: 0.2em auto 0.4em; font-size: 1.02rem; }
    #answer-zone { min-height: 100px; }
    .choice-btn { padding: 8px 14px; }
    #explanation-area { --zone-height: 7.5em; }
    #ms-compound-panel { height: 128px; }
    #ms-compound-panel.structure-ask { height: 225px; }
}
