/* ═══════════════════════════════════════════════════════
   Pills Mixer — flat-screen layout (v2, matches reference
   pills_mixer_final_flat_screen_full.html).
   Three columns inside a cream-paper window: STOCK palette
   on the left, PHARMACOLOGY mixture log in the center,
   MIXTURE ANALYSIS on the right. RX stamp on top-right.
   ═══════════════════════════════════════════════════════ */

/* ── Window shell ─────────────────────────────── */
/* Outer fills the viewport with the game's dark backdrop;
   sheet sits centered inside as a capped document — same
   pattern the inventory uses. */
.pmx-window {
    position: fixed; inset: 0;
    z-index: 3000;
    background: #3A3238;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    overflow: auto;
    font-family: 'Courier New', Courier, monospace;
    color: #3a3128;
}
.pmx-close {
    position: absolute;
    top: 18px; right: 18px;
    width: 32px; height: 32px;
    background: transparent;
    border: 2px solid #8E7F7F;
    color: #EBE6D8;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    transition: background .15s ease, border-color .15s ease;
}
.pmx-close:hover {
    background: rgba(235, 230, 216, .12);
    border-color: #EBE6D8;
}

/* ── Paper sheet — FIXED dimensions, scrolls internally ──
   Sheet height is locked: it never resizes when the mixture
   changes. All overflow lives inside the columns. Two grid
   rows: main 3-column row + sheet-spanning footer. */
.pmx-paper {
    position: relative;
    /* the page runs at zoom 1.25 — raw vh/vw overshoot, and the sheet
       hung its title, its scene banner and its footer off the top and
       bottom of the screen. Size off the pre-divided vars. */
    width: min(1180px, calc(var(--vw100, 100vw) * .96));
    height: min(820px, calc(var(--vh100, 100vh) - 48px));
    background: #EBE6D8;
    border: 2px solid #8E7F7F;
    box-shadow:
        0 0 24px rgba(0, 0, 0, .55),
        inset 0 0 120px rgba(210, 180, 140, .10);
    display: grid;
    grid-template-columns: 240px 1fr 260px;
    grid-template-rows: 1fr auto;
    overflow: hidden;
}
/* Each main column lives in row 1 explicitly so the footer
   (row 2) lands beneath all three. Columns scroll their own
   content (min-height:0 unlocks the overflow inside grid). */
.pmx-stock    { grid-row: 1; grid-column: 1; min-height: 0; overflow-y: auto; }
.pmx-center   { grid-row: 1; grid-column: 2; min-height: 0; overflow-y: auto; }
.pmx-analysis { grid-row: 1; grid-column: 3; min-height: 0; overflow-y: auto; }
.pmx-paper-noise {
    position: absolute; inset: 0;
    background: url('data:image/svg+xml,%3Csvg viewBox=%220 0 100 100%22 xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cfilter id=%22n%22%3E%3CfeTurbulence type=%22fractalNoise%22 baseFrequency=%220.8%22/%3E%3C/filter%3E%3Crect width=%22100%22 height=%22100%22 filter=%22url(%23n)%22 opacity=%220.1%22/%3E%3C/svg%3E');
    opacity: .25;
    pointer-events: none;
    z-index: 0;
}

/* ── Section title (used in STOCK + ANALYSIS) ── */
.pmx-section-title {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: 3px;
    color: #5F5449;
    border-bottom: 2px solid #8E7F7F;
    padding-bottom: 8px;
    margin-bottom: 14px;
    text-align: center;
}

/* ═══ LEFT — STOCK palette ═══ */
.pmx-stock {
    position: relative;
    border-right: 2px solid #8E7F7F;
    padding: 20px 16px 22px;
    z-index: 1;
}
.pmx-class-label {
    font-size: 8px;
    letter-spacing: 1.5px;
    color: #8E7F7F;
    margin-bottom: 8px;
}
.pmx-class-label.enh {
    color: #8b2f47;
    border-top: 1px dashed #8E7F7F;
    padding-top: 10px;
    margin-top: 4px;
}

/* BOOST pills — round beads in 3-col grid */
.pmx-stock-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}
.pmx-pill-tile {
    position: relative;
    text-align: center;
    cursor: pointer;
    padding: 2px;
    transition: transform .15s ease;
}
.pmx-pill-tile:hover { transform: translateY(-2px); }
.pmx-pill-tile:active { transform: translateY(0); }
/* When a slot is armed, compatible stock tiles lift + glow. */
.pmx-pill-tile.compatible {
    transform: translateY(-3px) scale(1.05);
    filter: drop-shadow(0 0 6px rgba(139, 47, 71, .85));
    animation: pmxCompatPulse 1.2s ease-in-out infinite;
}
@keyframes pmxCompatPulse {
    0%, 100% { filter: drop-shadow(0 0 6px  rgba(139, 47, 71, .85)); }
    50%      { filter: drop-shadow(0 0 14px rgba(139, 47, 71, 1)); }
}
/* Incompatible stock tiles dim out so the eye reads them as off-limits. */
.pmx-pill-tile.incompatible {
    opacity: .25;
    filter: grayscale(.6);
    pointer-events: auto; /* still clickable — the shake-reject teaches the rule */
}
/* Shake animation triggered when a player tries to drop an
   incompatible pill into an armed slot. */
.pmx-pill-tile.pmx-shake {
    animation: pmxShake .4s linear;
}
@keyframes pmxShake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-4px); }
    40%      { transform: translateX(4px);  }
    60%      { transform: translateX(-3px); }
    80%      { transform: translateX(3px);  }
}
.pmx-pill-bead {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 2px solid #5F5449;
    margin: 0 auto;
    box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .22);
}
.pmx-pill-count {
    position: absolute;
    top: -3px; right: 6px;
    font-size: 9px;
    background: #8b0000;
    color: #EBE6D8;
    padding: 0 4px;
    line-height: 14px;
    border-radius: 2px;
}
.pmx-pill-count.empty {
    background: #8E7F7F;
    color: #3A3238;
}

/* ENHANCER capsules — pill-shaped */
.pmx-enh-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 14px;
}
.pmx-pill-tile.pmx-enh {
    flex: 0 0 auto;
}
.pmx-pill-capsule {
    width: 24px; height: 40px;
    border-radius: 12px;
    border: 2px dashed #8b2f47;
    margin: 0 auto;
    box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .25);
}
.pmx-pill-count.enh {
    position: absolute;
    top: -3px; right: 0;
    font-size: 8px;
    background: #8b2f47;
    color: #EBE6D8;
    padding: 0 3px;
    line-height: 12px;
}
.pmx-pill-tag {
    font-size: 7px;
    letter-spacing: .5px;
    color: #8b2f47;
    margin-top: 3px;
    text-transform: lowercase;
}

.pmx-tap-hint {
    position: absolute;
    bottom: 12px; left: 12px; right: 12px;
    font-size: 9px;
    color: #8E7F7F;
    border-top: 1px dashed #8E7F7F;
    padding-top: 6px;
    text-align: center;
    font-style: italic;
}

/* ═══ CENTER — Mixture log ═══
   Stack TIGHT under the header. Don't push the beaker to the
   bottom — the recipe + arrow + beaker + type label are one
   visual unit and read as one. Whatever space is left below
   belongs to saved recipes / warnings / footer, not to a void. */
.pmx-center {
    position: relative;
    padding: 22px 28px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.pmx-head-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 22px;
}

/* ═══════════════════════════════════════════════════════
   FLASHBACK MODE (Ch54 — Sal teaches the craft)
   Applies sepia + hides all sections by default.
   Each .pmx-show-<stage> class added to .pmx-paper fades
   the matching section in.
   ═══════════════════════════════════════════════════════ */
.pmx-flashback {
    /* Age the ARTIFACT, not the screen: the old sepia() filter
       bleached the ink and left the paper unchanged — backwards.
       Aged document = deeper amber paper, darkened frame, foxing,
       grain — and DENSER, warmer ink. Must read as a different
       decade next to the normal #EBE6D8 sheet. */
    background:
        radial-gradient(ellipse 120% 90% at 50% 42%,
            transparent 52%,
            rgba(96, 66, 30, .14) 84%,
            rgba(70, 47, 20, .30) 100%),
        radial-gradient(circle at 17% 21%,
            rgba(138, 94, 38, .12) 0%, rgba(138, 94, 38, .05) 2.2%, transparent 3.2%),
        radial-gradient(circle at 84% 63%,
            rgba(138, 94, 38, .10) 0%, transparent 2.6%),
        radial-gradient(circle at 43% 89%,
            rgba(138, 94, 38, .08) 0%, transparent 2.2%),
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="140" height="140"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="2"/></filter><rect width="140" height="140" filter="url(%23n)" opacity="0.05"/></svg>'),
        #e2cf9f;
    color: #35270e;
    border-color: #7a6a4d;
}
/* Ink density on the typewriter text — darker + warmer. */
.pmx-flashback .pmx-section-title,
.pmx-flashback .pmx-hint,
.pmx-flashback .pmx-armed-hint {
    color: #3b2b10;
}
/* The flashback sheet keeps the SAME full-size centered
   geometry as the modern mixer — identical UI, different
   decade. The margins become SAL'S BACK ROOM: dark walnut
   (darker than Phil's), one lamp pool in the NIGHTMARE's lamp
   tone (rgba(206,178,96,…) — Sal's lighting signature, dream
   and memory must match), and warmth rising from the bottom
   edge where his voice lives. Amorphous matter only. */
.pmx-window:has(.pmx-flashback) {
    background:
        radial-gradient(ellipse 58% 42% at 50% 10%,
            rgba(206, 178, 96, .15) 0%, transparent 65%),
        radial-gradient(ellipse 85% 42% at 50% 100%,
            rgba(206, 150, 70, .13) 0%, transparent 65%),
        radial-gradient(ellipse 140% 110% at 50% 50%,
            transparent 38%,
            rgba(10, 7, 4, .68) 86%,
            rgba(7, 5, 3, 1) 100%),
        linear-gradient(180deg, #241509 0%, #120a04 100%) !important;
}

/* Cigar smoke + projector whisper — mounted by
   _applyFlashbackChrome, dies with the flashback dress. */
#pmxFbSmoke {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
#pmxFbSmoke .fbs-wisp {
    position: absolute;
    left: 6%; bottom: -12%;
    width: 160px; height: 300px;
    background:
        radial-gradient(ellipse 40% 55% at 52% 66%,
            rgba(150, 120, 80, .12) 0%,
            rgba(130, 104, 70, .05) 45%,
            transparent 75%);
    filter: blur(8px);
    opacity: 0;
    animation: fbsRise 18s ease-in-out infinite;
}
#pmxFbSmoke .fbs-wisp.b {
    left: 12%;
    animation-delay: 8s;
    animation-duration: 22s;
}
@keyframes fbsRise {
    0%   { transform: translateY(0) translateX(0) scale(.85);   opacity: 0; }
    15%  { opacity: .5; }
    55%  { transform: translateY(-42vh) translateX(14px) scale(1.1); opacity: .3; }
    100% { transform: translateY(-80vh) translateX(-6px) scale(1.35); opacity: 0; }
}
/* Whisper flicker: two co-prime cycles (1.7s / 2.9s) so the eye
   never finds a metronome. Peaks at 6% — alive, not noticed. */
#pmxFbSmoke .fbs-flicker-a,
#pmxFbSmoke .fbs-flicker-b {
    position: absolute;
    inset: 0;
    background: rgba(30, 20, 8, .5);
    opacity: 0;
}
#pmxFbSmoke .fbs-flicker-a { animation: fbsFlick 1.7s steps(2) infinite; }
#pmxFbSmoke .fbs-flicker-b { animation: fbsFlick 2.9s steps(2) infinite .8s; }
@keyframes fbsFlick {
    0%, 91%   { opacity: 0; }
    92%, 95%  { opacity: .06; }
    96%, 100% { opacity: 0; }
}

/* ── Tutorial highlight pulse ─────────────────────────
   Combat-tutorial idiom — gold halo + soft glow on the
   section Sal is currently pointing at. Auto-fades after
   the JS removes the class (~3.6s). Same hue + cadence as
   .cg-active in the combat training mode. */
.pmx-fb-pulse {
    position: relative;
    z-index: 4;
    animation:
        pmxFbHaloPulse 1.4s ease-in-out 0s infinite,
        pmxFbHaloFadeIn .55s ease-out 0s;
}
@keyframes pmxFbHaloFadeIn {
    from { filter: brightness(.95); }
    to   { filter: brightness(1.05); }
}
@keyframes pmxFbHaloPulse {
    0%, 100% {
        box-shadow:
            0 0 0 0 rgba(212, 175, 55, 0),
            0 0 0 0 rgba(212, 175, 55, 0);
    }
    50% {
        box-shadow:
            0 0 0 3px rgba(212, 175, 55, .55),
            0 0 24px 4px rgba(212, 175, 55, .45);
    }
}

/* Reduced motion — drop the pulse, just hold a static
   warm border so the highlight is still visible. */
@media (prefers-reduced-motion: reduce) {
    .pmx-fb-pulse {
        animation: none !important;
        box-shadow: 0 0 0 3px rgba(212, 175, 55, .55) !important;
    }
}
/* Subtle wood-grain stripes layered over the cream sheet
   to suggest Sal's wooden tray under the document. */
.pmx-flashback::after {
    content: '';
    position: absolute; inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(112deg,
        transparent 0px,
        rgba(86, 56, 28, .07) 2px,
        transparent 5px,
        rgba(86, 56, 28, .05) 7px);
    z-index: 0;
}

/* By default, hide everything inside the flashback paper
   except the chapter title bar. Each .pmx-show-<stage>
   class flips one section visible. */
/* Lesson sections sit as GHOSTS — the shape of the memory before
   it's recalled — and DEVELOP on reveal: blur→sharp, dark→normal
   (kin of paper-wake-rough). */
.pmx-flashback .pmx-stock-pills-section,
.pmx-flashback .pmx-stock-enh-section,
.pmx-flashback .pmx-stock,
.pmx-flashback .pmx-result-row,
.pmx-flashback .pmx-slots-row,
.pmx-flashback .pmx-arrow,
.pmx-flashback .pmx-analysis,
.pmx-flashback .pmx-footer {
    opacity: 0.07;
    filter: blur(2.5px) brightness(.82);
    pointer-events: none;
    transition:
        opacity .55s cubic-bezier(.22, 1, .36, 1),
        filter  .55s cubic-bezier(.22, 1, .36, 1);
}
/* Not part of the lesson — fully absent, not a ghost. */
.pmx-flashback .pmx-armed-hint {
    opacity: 0;
    pointer-events: none;
    transition: opacity .55s cubic-bezier(.22, 1, .36, 1);
}
/* RECIPES ghosts like the rest and develops at Sal's verdict
   ("write the ones that work down") — so the memory sheet ends
   structurally identical to the modern one. */
.pmx-flashback .pmx-recipes {
    opacity: 0.07;
    filter: blur(2.5px) brightness(.82);
    pointer-events: none;
    transition:
        opacity .55s cubic-bezier(.22, 1, .36, 1),
        filter  .55s cubic-bezier(.22, 1, .36, 1);
}
/* STAGE: recipes — the paper remembers. */
.pmx-flashback.pmx-show-recipes .pmx-recipes {
    opacity: 1;
    filter: blur(0) brightness(1);
    pointer-events: auto;
}

/* STAGE: beaker — show the slots row + arrow + result row */
.pmx-flashback.pmx-show-beaker .pmx-slots-row,
.pmx-flashback.pmx-show-beaker .pmx-arrow,
.pmx-flashback.pmx-show-beaker .pmx-result-row {
    opacity: 1;
    filter: blur(0) brightness(1);
}

/* STAGE: boost — STOCK column boost pills appear */
.pmx-flashback.pmx-show-boost .pmx-stock {
    opacity: 1;
    filter: blur(0) brightness(1);
    pointer-events: auto;
}
.pmx-flashback.pmx-show-boost .pmx-stock .pmx-stock-enh-section { opacity: 0; }

/* STAGE: enhancers — also show enhancer row in STOCK */
.pmx-flashback.pmx-show-enhancers .pmx-stock .pmx-stock-enh-section {
    opacity: 1;
    filter: blur(0) brightness(1);
}

/* STAGE: forecast — right ANALYSIS column appears */
.pmx-flashback.pmx-show-forecast .pmx-analysis {
    opacity: 1;
    filter: blur(0) brightness(1);
    pointer-events: auto;
}

/* STAGE: practice — footer (CLEAR + commit) appears, armed hint */
.pmx-flashback.pmx-show-practice .pmx-footer,
.pmx-flashback.pmx-show-practice .pmx-armed-hint {
    opacity: 1;
    filter: blur(0) brightness(1);
    pointer-events: auto;
}

/* Empty STOCK column shell remains visible from the start
   (its border outlines where pills will appear). The
   inner sections fade in per stage. */
.pmx-flashback .pmx-stock {
    opacity: 1;
    filter: blur(0) brightness(1);
}
.pmx-flashback .pmx-stock > * {
    transition:
        opacity .55s cubic-bezier(.22, 1, .36, 1),
        filter  .55s cubic-bezier(.22, 1, .36, 1);
}
.pmx-flashback:not(.pmx-show-boost) .pmx-stock > *:not(.pmx-section-title) {
    opacity: 0.07;
    filter: blur(2.5px) brightness(.82);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .pmx-flashback .pmx-stock-pills-section,
    .pmx-flashback .pmx-stock-enh-section,
    .pmx-flashback .pmx-result-row,
    .pmx-flashback .pmx-slots-row,
    .pmx-flashback .pmx-arrow,
    .pmx-flashback .pmx-recipes,
    .pmx-flashback .pmx-analysis,
    .pmx-flashback .pmx-footer { transition: none !important; }
    #pmxFbSmoke .fbs-flicker-a,
    #pmxFbSmoke .fbs-flicker-b { animation: none !important; }
    #pmxFbSmoke .fbs-wisp {
        animation: none !important;
        opacity: .18;
        transform: translateY(-30vh);
    }
}

/* ── Present-day ch54 mixer sits in Alicia's MIGRAINE room —
   not her bright rose: lights off, only the stove light on
   (low-left warm pool), her presence dimmed to a bruise-mauve,
   and a dull red pressure closing in from the edges. Matches
   the chapter's margin atmosphere (key 53); the ::before layer
   adds the slow headache throb. Class rides the persistent
   container (render() rebuilds the window, not the container);
   it's added only at the return to present — never during the
   flashback — and stop() strips it. ── */
#pillsMixerContainer.pmx-room-2b .pmx-window {
    background:
        radial-gradient(ellipse 140% 100% at 50% 45%,
            transparent 38%,
            rgba(60, 10, 12, 0.30) 76%,
            rgba(36, 7, 9, 0.52) 100%),
        radial-gradient(ellipse 280px 210px at 10% 82%,
            rgba(255, 180, 96, 0.13) 0%,
            rgba(255, 160, 70, 0.05) 45%,
            transparent 75%),
        radial-gradient(ellipse 320px 400px at 6% 26%,
            rgba(172, 86, 106, 0.16) 0%,
            rgba(172, 86, 106, 0.06) 45%,
            transparent 80%),
        radial-gradient(ellipse 260px 320px at 93% 46%,
            rgba(150, 80, 96, 0.11) 0%,
            transparent 75%),
        linear-gradient(180deg, #201819 0%, #100c0d 100%) !important;
}
/* The headache made visible: a dull red pressure ring breathing
   at the edges — slow, out of rhythm with anything comfortable.
   Opacity-only; paints under the paper (positioned child). */
#pillsMixerContainer.pmx-room-2b .pmx-window::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 130% 110% at 50% 45%,
        transparent 48%,
        rgba(120, 16, 16, 0.18) 82%,
        rgba(88, 12, 12, 0.28) 100%);
    opacity: 0.3;
    animation: pmxThrob 4.6s ease-in-out infinite;
}
@keyframes pmxThrob {
    0%, 100% { opacity: 0.3; }
    55%      { opacity: 0.85; }
}
@media (prefers-reduced-motion: reduce) {
    #pillsMixerContainer.pmx-room-2b .pmx-window::before {
        animation: none;
        opacity: 0.45;
    }
}
/* ── Return-morph ghost: a full clone of the aged window laid
   over the swapped-to-modern real one, dissolving pixel-for-
   pixel (opacity only). Click-transparent from birth. ── */
.pmx-window.pmx-ghost {
    pointer-events: none !important;
    opacity: 1;
    transition: opacity 2.4s ease;
}
.pmx-window.pmx-ghost * {
    pointer-events: none !important;
}
.pmx-window.pmx-ghost.pmx-ghost-out {
    opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
    .pmx-window.pmx-ghost { transition: opacity 0.6s ease; }
}

/* Scene steps own the mixer's lifecycle — no manual ✕. */
#pillsMixerContainer.pmx-room-2b .pmx-close,
.pmx-window:has(.pmx-flashback) .pmx-close {
    display: none;
}

/* ── Present-day return: the inheritance beat. The preloaded
   slots hold the aged flashback tone for ~1s (class added on
   recipe load, removed by JS), then ease clean. ── */
.pmx-paper .pmx-slots-row { transition: filter 1s ease; }
.pmx-paper.pmx-inherit .pmx-slots-row {
    filter: sepia(.5) brightness(.93) saturate(.85);
}

/* Scene hint — chapter-scripted instruction line that sits
   between the header and the slots row. Used by Ch54's
   "doctor said drop one" gate. Quiet typewriter style. */
.pmx-scene-hint {
    text-align: center;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 1.5px;
    color: #8b2f47;
    margin: -10px 0 16px;
    padding: 7px 12px;
    border: 1px dashed #8b2f47;
    background: rgba(139, 47, 71, .04);
    font-style: italic;
}
.pmx-title {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 20px;
    letter-spacing: 2px;
    color: #3a3128;
}
.pmx-case {
    font-size: 9px;
    color: #8E7F7F;
    letter-spacing: 1px;
    margin-left: 6px;
}
/* RX classification stamp — rotated, red */
.pmx-rx-stamp {
    transform: rotate(-11deg);
    border: 2.5px solid #8b2f47;
    color: #8b2f47;
    font-size: 13px;
    letter-spacing: 2.5px;
    padding: 5px 12px;
    opacity: .80;
    font-family: 'Special Elite', 'Courier New', monospace;
    background: rgba(255, 248, 220, .45);
}

/* Recipe row — 5 round slots side-by-side with role labels */
.pmx-slots-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-top: 8px;
}
.pmx-slot-wrap {
    text-align: center;
}
.pmx-slot {
    width: 78px; height: 78px;
    border: 2.5px solid #5F5449;
    border-radius: 50%;
    background: transparent;
    color: #8E7F7F;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
    box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .15);
}
.pmx-slot.empty {
    background: #f4eed8;
    color: #8E7F7F;
    border-style: dashed;
    border-color: #8E7F7F;
    font-size: 26px;
}
.pmx-slot.empty:hover {
    border-color: #5F5449;
    color: #5F5449;
    background: #ebe2c4;
}
.pmx-slot.filled {
    color: #EBE6D8;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
}
.pmx-slot.filled:hover {
    transform: scale(1.05);
    box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .15), 0 0 8px rgba(91, 47, 47, .35);
}
.pmx-slot.tert {
    border-style: dashed;
    border-color: #8b2f47;
}
.pmx-slot.tert.empty {
    color: #8b2f47;
}
.pmx-slot.extra.empty {
    border-color: #8E7F7F;
    font-size: 26px;
}

/* Armed slot — pulsing red ring + saturated + sign. Tells the
   player THIS is where the next stock click will land. */
.pmx-slot.armed {
    border-style: solid;
    border-color: #8b2f47;
    background: #fce6d8;
    color: #8b2f47;
    box-shadow:
        inset -3px -3px 0 rgba(0, 0, 0, .15),
        0 0 0 3px rgba(139, 47, 71, .25);
    animation: pmxArmedPulse 1.1s ease-in-out infinite;
}
@keyframes pmxArmedPulse {
    0%, 100% { box-shadow: inset -3px -3px 0 rgba(0,0,0,.15), 0 0 0 3px rgba(139, 47, 71, .25); }
    50%      { box-shadow: inset -3px -3px 0 rgba(0,0,0,.15), 0 0 0 6px rgba(139, 47, 71, .45); }
}

/* Hint line below the slot row — calls out what the next click does. */
.pmx-armed-hint {
    text-align: center;
    margin-top: 14px;
    font-size: 11px;
    letter-spacing: 2px;
    color: #8b2f47;
    text-transform: uppercase;
    font-family: 'Special Elite', 'Courier New', monospace;
}
.pmx-armed-hint.quiet {
    color: #8E7F7F;
    text-transform: none;
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 1px;
    font-style: italic;
}
.pmx-slot-enh-mark {
    font-size: 11px;
    letter-spacing: 1.5px;
}
.pmx-slot-label {
    font-size: 10px;
    color: #5F5449;
    margin-top: 8px;
    letter-spacing: 2.5px;
}
.pmx-slot-label.tert {
    color: #8b2f47;
}

.pmx-arrow {
    text-align: center;
    color: #8E7F7F;
    font-size: 22px;
    margin: 20px 0 14px;
}

/* Beaker result row — sits right under the arrow, no
   flex-grow padding. Stack reads as one continuous block. */
.pmx-result-row {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 36px;
    margin-top: 10px;
}
.pmx-beaker {
    position: relative;
    width: 130px;
    height: 200px;
}
.pmx-beaker-rim {
    position: absolute;
    left: -3px; right: -3px;
    top: 0;
    height: 3px;
    background: #8b7355;
}
.pmx-beaker-body {
    position: absolute;
    inset: 0;
    border: 2px solid #8b7355;
    border-top: none;
    border-radius: 0 0 10px 10px;
}
/* ── PAPER-INK LIQUID ──────────────────────────────────
   Flat color block, no gradient by height, no gloss, no
   bubbles, no inner shadow. Height changes step in with
   overshoot ease (~330ms); color change is a fast snap
   (~140ms) so dominant-domain swaps read as a stamp, not
   a morph. Feathered top edge faked via blurred sibling
   below (.pmx-beaker-feather). */
.pmx-beaker-liquid {
    position: absolute;
    left: 6px; right: 6px;
    bottom: 3px;
    background: #b8434f;
    /* Smoother growth — longer duration with only a subtle
       overshoot (~6% past the target) so the ink reads as
       seeping up to its mark instead of snapping into place.
       Color change stays a fast snap so dominant-domain swaps
       still read as a stamp, not a hue morph. */
    transition: height .52s cubic-bezier(.32, 1.12, .35, 1),
                background .14s linear;
}
/* Restamp flash — brief brightness pop, marks dominant change */
.pmx-beaker-liquid.restamp {
    animation: pmxRestamp .16s ease-out;
}
@keyframes pmxRestamp {
    0%   { filter: brightness(1); }
    50%  { filter: brightness(1.45); }
    100% { filter: brightness(1); }
}
/* Drain — slower ease-in instead of overshoot when the
   level falls to empty on clear / final unequip. Slightly
   longer to match the new growth feel. */
.pmx-beaker-liquid.draining {
    transition: height .5s cubic-bezier(.45, 0, .55, 1),
                background .14s linear;
}

/* Feathered top edge — sits ON TOP of the liquid's surface,
   blurred so the ink reads as soaked into paper instead of
   ending at a hard meniscus line. Sibling div positioned via
   the liquid's height in JS (handled by render) — but cheaper
   to layer via the liquid element itself: a thin same-color
   strip with heavy blur protruding above. */
.pmx-beaker-liquid::before {
    content: '';
    position: absolute;
    top: -5px; left: 0; right: 0;
    height: 10px;
    background: inherit;
    filter: blur(7px);
    opacity: .85;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   INK STEP — paper-language fill animation.
   Per pill added: liquid height jumps in via the overshoot
   transition above + a horizontal BLOT spreads at the new
   surface. No streams / droplets / rings / spray / waves.
   ═══════════════════════════════════════════════════════ */
.pmx-ink-blot {
    position: absolute;
    left: 50%;
    transform: translate(-50%, 50%) scaleX(.3);
    width: 36px;
    height: 8px;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    filter: blur(4px);
}
.pmx-ink-blot.active {
    animation: pmxInkBlot .26s ease-out forwards;
}
@keyframes pmxInkBlot {
    0%   { opacity: 0;  transform: translate(-50%, 50%) scaleX(.3); }
    35%  { opacity: 1;  transform: translate(-50%, 50%) scaleX(1);  }
    100% { opacity: 0;  transform: translate(-50%, 50%) scaleX(1.35); }
}

/* Reduced motion — no overshoot, no blot, no restamp flash,
   no creation-popup choreography. Level jumps, color swaps,
   and popup contents are revealed instantly. */
@media (prefers-reduced-motion: reduce) {
    .pmx-beaker-liquid,
    .pmx-beaker-liquid.draining {
        transition: none !important;
        animation: none !important;
    }
    .pmx-beaker-liquid.restamp { animation: none !important; }
    .pmx-ink-blot,
    .pmx-ink-fx { display: none !important; }
    /* Creation popup — kill the staged reveal */
    .pmx-create-stamp,
    .pmx-create-title,
    .pmx-create-titlestrip,
    .pmx-create-pillwrap,
    .pmx-create-pillblot,
    .pmx-create-pillchip,
    .pmx-create-effblock,
    .pmx-create-deprow,
    .pmx-create-actions {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }
    /* Blot stays invisible without animation (it's purely an effect). */
    .pmx-create-pillblot { display: none !important; }
}
.pmx-beaker-marks {
    position: absolute;
    right: -3px; top: 0; bottom: 0;
    pointer-events: none;
}
.pmx-beaker-marks::before,
.pmx-beaker-marks::after,
.pmx-beaker::after {
    content: '';
    position: absolute;
    width: 9px; height: 1px;
}
/* Topmost mark = "danger" — magenta-red per spec. Two lower
   marks stay in the standard scale-mark sand color. */
.pmx-beaker-marks::before { top: 22%; right: 0; background: #8b2f47; }
.pmx-beaker-marks::after  { top: 44%; right: 0; background: #8b7355; }
.pmx-beaker::after        { top: 66%; right: -3px; background: #8b7355; }

.pmx-type-block {
    text-align: left;
    padding-bottom: 8px;
}
.pmx-type-chip {
    display: inline-block;
    border: 2px solid #b8434f;
    color: #8b3030;
    font-size: 18px;
    letter-spacing: 3px;
    padding: 8px 18px;
    font-family: 'Special Elite', 'Courier New', monospace;
    background: rgba(255, 248, 220, .55);
}
.pmx-type-flavor {
    font-size: 11px;
    color: #8E7F7F;
    margin-top: 12px;
    font-style: italic;
    max-width: 260px;
    line-height: 1.5;
}

/* ── Sheet footer — spans all 3 columns at the bottom of
   the sheet. Holds the CLEAR / MIX & TAKE actions as the
   document's action row. Bounded, intentional space. */
.pmx-footer {
    grid-row: 2;
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding: 14px 28px;
    border-top: 2px solid #8E7F7F;
    background: rgba(94, 84, 73, .05);
    z-index: 1;
}
.pmx-btn-mix,
.pmx-btn-clear {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 14px;
    letter-spacing: 3px;
    padding: 10px 26px;
    cursor: pointer;
    transition: background .15s ease, transform .12s ease, color .15s ease;
    background: rgba(255, 248, 220, .55);
    color: #5F5449;
    border: 2px solid #5F5449;
    text-transform: uppercase;
}
.pmx-btn-mix {
    background: rgba(255, 248, 220, .55);
    color: #5F5449;
    border-color: #5F5449;
    /* Inline style overrides border + color with the dominant-domain
       accent when something is loaded — pulls the button into the
       same color rhythm as the TYPE chip. */
}
.pmx-btn-mix:hover:not(:disabled),
.pmx-btn-clear:hover:not(:disabled) {
    background: rgba(196, 168, 122, .35);
    transform: translateY(-1px);
}
.pmx-btn-mix:active:not(:disabled),
.pmx-btn-clear:active:not(:disabled) {
    transform: translateY(0);
}
.pmx-btn-mix:disabled,
.pmx-btn-clear:disabled {
    cursor: not-allowed;
    opacity: .35;
    border-color: #8E7F7F !important;
    color: #8E7F7F !important;
    background: rgba(255, 248, 220, .25);
}
.pmx-btn-clear {
    font-size: 12px;
    letter-spacing: 2.5px;
    padding: 8px 18px;
}

/* ── Saved recipes panel ────────────────────────────
   Lives in the center column, below the beaker + type. */
.pmx-recipes {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed #8E7F7F;
}
.pmx-recipes-head {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 3px;
    color: #5F5449;
    text-align: center;
    margin-bottom: 10px;
}
.pmx-recipes-save {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}
.pmx-recipes-input {
    flex: 0 1 220px;
    padding: 5px 10px;
    background: rgba(255, 248, 220, .55);
    border: 1px solid #8E7F7F;
    color: #3a3128;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    letter-spacing: 1px;
}
.pmx-recipes-input:focus {
    outline: none;
    border-color: #5F5449;
    background: rgba(255, 248, 220, .85);
}
.pmx-recipes-input:disabled {
    opacity: .4;
    cursor: not-allowed;
}
.pmx-recipes-save-btn {
    padding: 5px 12px;
    background: rgba(255, 248, 220, .55);
    border: 1.5px solid #5F5449;
    color: #5F5449;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: background .15s ease;
}
.pmx-recipes-save-btn:hover:not(:disabled) { background: rgba(196, 168, 122, .35); }
.pmx-recipes-save-btn:disabled { opacity: .35; cursor: not-allowed; }
.pmx-recipes-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 110px;
    overflow-y: auto;
}
.pmx-recipe {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    background: rgba(255, 248, 220, .35);
    border: 1px solid rgba(94, 84, 73, .30);
    cursor: pointer;
    font-size: 11px;
    color: #3a3128;
    transition: background .15s ease;
}
.pmx-recipe:hover {
    background: rgba(196, 168, 122, .25);
    border-color: #5F5449;
}
.pmx-recipe-swatch {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1px solid #5F5449;
    flex: 0 0 auto;
}
.pmx-recipe-name {
    flex: 1 1 auto;
    letter-spacing: .5px;
    text-transform: lowercase;
}
.pmx-recipe-del {
    width: 18px; height: 18px;
    background: transparent;
    border: 1px solid #8E7F7F;
    color: #8b2f47;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    opacity: .55;
    transition: opacity .15s ease;
}
.pmx-recipe:hover .pmx-recipe-del { opacity: 1; }
.pmx-recipes-empty {
    text-align: center;
    font-size: 10px;
    color: #8E7F7F;
    font-style: italic;
    letter-spacing: 1px;
    padding: 8px 0;
    line-height: 1.5;
}

/* Slip-style row for registry recipes (cards / purchases /
   partial reveals). Stained-paper card with the recipe's
   positions rendered as colored chips for known, "?" for
   unknown. Hovering offers a faint pickup. */
.pmx-recipe.slip {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
    background: #EBE6D8;
    border: 1px solid #8E7F7F;
    box-shadow: 1px 1px 0 rgba(94, 84, 73, .15);
}
.pmx-recipe.slip.partial {
    background:
        radial-gradient(circle at 30% 80%, rgba(139, 47, 71, .08) 0%, transparent 60%),
        #EBE6D8;
    border-style: dashed;
    border-color: rgba(94, 84, 73, .55);
}
.pmx-recipe.slip:hover {
    background:
        radial-gradient(circle at 30% 80%, rgba(196, 168, 122, .25) 0%, transparent 60%),
        #f0eada;
}
.pmx-recipe-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pmx-recipe-icon {
    font-size: 12px;
    color: #8b7355;
    flex: 0 0 auto;
    line-height: 1;
}
/* Skill-revealed entries have no icon — render a small bullet
   so the row still has a leading visual anchor. */
.pmx-recipe-icon.skill::before {
    content: '◦';
    color: #8b7355;
    font-size: 14px;
}
.pmx-recipe-icon.skill { width: 14px; display: inline-block; text-align: center; }
.pmx-recipe-state {
    font-size: 8px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #8b2f47;
    margin-left: auto;
    padding: 1px 5px;
    border: 1px solid #8b2f47;
}
.pmx-slip-slots {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 2px 0;
}
.pmx-slip-slot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 9px;
    letter-spacing: 1px;
    color: #EBE6D8;
    border: 1.5px solid #5F5449;
    flex: 0 0 auto;
}
.pmx-slip-slot.blank {
    background: rgba(94, 84, 73, .08);
    color: rgba(94, 84, 73, .55);
    border-style: dashed;
    border-color: rgba(94, 84, 73, .45);
    font-size: 14px;
    font-weight: bold;
}
.pmx-slip-slot.empty {
    background: transparent;
    color: rgba(94, 84, 73, .35);
    border-style: dotted;
    border-color: rgba(94, 84, 73, .25);
    font-size: 11px;
}
.pmx-slip-slot.known {
    box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .18);
}
.pmx-slip-hint {
    font-size: 9px;
    color: #8E7F7F;
    font-style: italic;
    text-align: center;
    letter-spacing: .5px;
    padding-top: 2px;
}

/* Divider between registry list and player-saved list */
.pmx-recipes-divider {
    text-align: center;
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #8E7F7F;
    padding: 6px 0 4px;
    border-top: 1px dashed rgba(94, 84, 73, .35);
    margin-top: 2px;
}

/* ── ADVERSE INTERACTION banner — composition conflicts only
   (overdose or cross-domain clash). Never restates dependency.
   Names each conflict; if there are no conflicts it doesn't
   render at all (see _renderConflictWarning() in JS). */
.pmx-conflict {
    margin-top: 14px;
    padding: 9px 14px;
    border: 2px solid #8b2f47;
    background: repeating-linear-gradient(45deg,
        transparent, transparent 6px,
        rgba(139, 47, 71, .12) 6px, rgba(139, 47, 71, .12) 12px);
    color: #8b2f47;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.pmx-conflict-head {
    font-weight: bold;
    letter-spacing: 3px;
    flex: 0 0 auto;
    text-transform: uppercase;
}
.pmx-conflict-lines {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: lowercase;
    color: #6b1d24;
}

/* ── FORECAST subtitle (right panel) — softer than the section
   title; tells the player the panel updates as they build. */
.pmx-forecast-sub {
    text-align: center;
    font-size: 9px;
    letter-spacing: 1.5px;
    color: #8E7F7F;
    text-transform: lowercase;
    font-style: italic;
    margin-top: -8px;
    margin-bottom: 12px;
}

/* ── Shared ranked effect rows (right panel + popup) ──
   Strongest first, descending visual weight. Same engine
   the popup uses → forecast and result read identically. */
.pmx-rank-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}
.pmx-rank-row.top  { color: #3a3128; font-size: 13px; font-weight: bold; }
.pmx-rank-row.high { color: #3a3128; font-size: 12px; font-weight: bold; }
.pmx-rank-row.mid  { color: #5F5449; font-size: 10px; }
.pmx-rank-row.low  { color: #9a9082; font-size: 9px; }
/* Right-panel POSITIVE/NEGATIVE box bodies — strip the line-
   spacing override so the ranked rows breathe. */
.pmx-box.positive .pmx-box-body,
.pmx-box.negative .pmx-box-body {
    padding: 6px 8px 8px;
    line-height: 1.45;
}

/* ── Responsive — narrow viewports stack columns ─── */
@media (max-width: 880px) {
    .pmx-paper {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        max-height: none;
    }
    .pmx-stock    { grid-row: 1; grid-column: 1; border-right: none; border-bottom: 2px solid #8E7F7F; }
    .pmx-center   { grid-row: 2; grid-column: 1; }
    .pmx-analysis { grid-row: 3; grid-column: 1; border-left: none; border-top: 2px solid #8E7F7F; }
    .pmx-footer   { grid-row: 4; grid-column: 1; }
    /* The center stack (slots → arrow → beaker → recipes) must
       stay together — it already does, the flex column doesn't
       break apart even at narrow widths. */
}

/* ═══════════════════════════════════════════════════════
   CREATION POPUP — paper card that confirms what was made
   and offers ADD TO INVENTORY vs TAKE NOW. Cancellable.
   ═══════════════════════════════════════════════════════ */
.pmx-create-popup {
    position: absolute;
    inset: 0;
    z-index: 4500;
    background: rgba(58, 50, 56, .78);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: pmxCreateFadeIn .18s ease;
}
@keyframes pmxCreateFadeIn { from { opacity: 0 } to { opacity: 1 } }

.pmx-create-card {
    position: relative;
    width: min(480px, 96%);
    background: #EBE6D8;
    border: 2px solid #8E7F7F;
    box-shadow:
        0 12px 32px rgba(0, 0, 0, .65),
        inset 0 0 80px rgba(210, 180, 140, .12);
    padding: 18px 22px 16px;
    font-family: 'Courier New', Courier, monospace;
    color: #3a3128;
    animation: pmxCreateRise .22s cubic-bezier(.2, .8, .25, 1);
}
@keyframes pmxCreateRise {
    from { transform: translateY(10px) scale(.98); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

/* ── REVEAL CHOREOGRAPHY ─────────────────────────────
   Order (matches the reference HTML):
     1) ingredient pills stamp onto paper, one by one,
        each with its own expanding/fading ink blot
     2) MIXTURE CREATED stamp drops onto the card's
        top-left edge (protrudes above the card)
     3) Title (recipe name) reveals
     4) Class line (CHARACTER · TYPE) reveals
     5) Positive then negative effect blocks reveal
     6) Dependency stamp slams in as the final beat
   Total runtime ~2.2s.
*/
.pmx-create-stamp {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 2px;
    color: #8b2f47;
    border: 2px solid #8b2f47;
    padding: 3px 10px;
    background: #EBE6D8;          /* opaque so the card edge below is masked */
    /* Protrudes from the card's top-left edge, like a sticker
       slapped onto an envelope. */
    position: absolute;
    top: -12px;
    left: 18px;
    transform: rotate(-3deg) scale(1.5);
    opacity: 0;
    /* Sequence: hidden through pill stamps, then drops in. */
    animation: pmxStampDrop .42s cubic-bezier(.34, 1.4, .5, 1) .80s forwards;
}
@keyframes pmxStampDrop {
    0%   { opacity: 0;  transform: rotate(-3deg) scale(1.5); }
    55%  { opacity: 1;  transform: rotate(-3deg) scale(.94); }
    78%  { opacity: .9; transform: rotate(-3deg) scale(1.04); }
    100% { opacity: .85; transform: rotate(-3deg) scale(1); }
}
/* Title — single line, "<NAME>" or "<CHARACTER> · <TYPE> MIXTURE". */
.pmx-create-title {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 19px;
    letter-spacing: 1.5px;
    color: #3a3128;
    text-transform: uppercase;
    margin-top: 14px;   /* leaves room for the protruding top stamp */
    opacity: 0;
    transform: translateY(-4px);
    animation: pmxLineReveal .32s cubic-bezier(.22, 1, .36, 1) 1.25s forwards;
}
/* TYPE strip — dashed-top, dashed-bottom band that combines the
   class label ("TYPE · MIXED") with the pill chips inline.
   Replaces the separate class line + chip row from the old layout. */
.pmx-create-titlestrip {
    display: flex;
    align-items: center;
    gap: 14px;
    border-top: 1px dashed #8E7F7F;
    border-bottom: 1px dashed #8E7F7F;
    margin: 10px 0;
    padding: 7px 0;
    opacity: 0;
    transform: translateY(-4px);
    animation: pmxLineReveal .30s cubic-bezier(.22, 1, .36, 1) 1.42s forwards;
}
.pmx-create-type-label {
    font-size: 11px;
    color: #8E7F7F;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
@keyframes pmxLineReveal {
    to { opacity: 1; transform: translateY(0); }
}
.pmx-create-dot { color: #8E7F7F; }

.pmx-create-pills {
    display: flex;
    gap: 6px;
    /* Inline inside the TYPE strip — no external borders/margins. */
}
/* Each pill rides in as a chip + a blot. The blot is a darker
   blurred disc anchored behind the chip — when the chip stamps
   down, the blot expands and fades like ink hitting paper. */
.pmx-create-pillwrap {
    position: relative;
    display: inline-block;
    /* Stamp-in: scale 1.6 → .92 → 1 with a small bounce. */
    opacity: 0;
    transform: scale(1.6);
    animation: pmxPillStamp .40s cubic-bezier(.34, 1.4, .5, 1) forwards;
}
.pmx-create-pillwrap:nth-child(1) { animation-delay: .00s; }
.pmx-create-pillwrap:nth-child(2) { animation-delay: .12s; }
.pmx-create-pillwrap:nth-child(3) { animation-delay: .24s; }
.pmx-create-pillwrap:nth-child(4) { animation-delay: .36s; }
.pmx-create-pillwrap:nth-child(5) { animation-delay: .48s; }
@keyframes pmxPillStamp {
    0%   { opacity: 0; transform: scale(1.6); }
    50%  { opacity: 1; transform: scale(.92); }
    72%  { opacity: 1; transform: scale(1.04); }
    100% { opacity: 1; transform: scale(1); }
}
.pmx-create-pillchip {
    position: relative;
    width: 28px; height: 28px;     /* compact, fits the strip */
    border-radius: 50%;
    border: 1.5px solid #5F5449;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #EBE6D8;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 9px;
    letter-spacing: 1px;
    box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .18);
    z-index: 1;
}
.pmx-create-pillblot {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    filter: blur(3px);
    opacity: 0;
    transform: scale(.3);
    z-index: 0;
    animation: pmxPillBlot .38s ease-out forwards;
}
.pmx-create-pillwrap:nth-child(1) .pmx-create-pillblot { animation-delay: .02s; }
.pmx-create-pillwrap:nth-child(2) .pmx-create-pillblot { animation-delay: .14s; }
.pmx-create-pillwrap:nth-child(3) .pmx-create-pillblot { animation-delay: .26s; }
.pmx-create-pillwrap:nth-child(4) .pmx-create-pillblot { animation-delay: .38s; }
.pmx-create-pillwrap:nth-child(5) .pmx-create-pillblot { animation-delay: .50s; }
@keyframes pmxPillBlot {
    0%   { opacity: 0;  transform: scale(.3); }
    45%  { opacity: .55; transform: scale(1.6); }
    78%  { opacity: 0;  transform: scale(1.9); }
    100% { opacity: 0;  transform: scale(1.9); }
}

.pmx-create-effects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 6px;
}
.pmx-create-effblock {
    border: 1px solid #5F5449;
    padding: 9px 10px;
    opacity: 0;
    transform: translateY(-4px);
    animation: pmxLineReveal .30s cubic-bezier(.22, 1, .36, 1) forwards;
}
.pmx-create-effblock.positive { border-color: #5a7a3a; animation-delay: 1.65s; }
.pmx-create-effblock.negative { border-color: #8b3030; animation-delay: 1.80s; }
.pmx-create-effhead {
    font-size: 9px;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.pmx-create-effblock.positive .pmx-create-effhead { color: #5a7a3a; }
.pmx-create-effblock.negative .pmx-create-effhead { color: #8b3030; }

/* Ranked effect rows — name on left, percentage on right.
   4-tier visual weight encodes strength without a verdict. */
.pmx-create-effrow {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}
.pmx-create-effrow.top  { color: #3a3128; font-size: 14px; font-weight: bold; margin-bottom: 5px; }
.pmx-create-effrow.high { color: #3a3128; font-size: 13px; font-weight: bold; margin-bottom: 6px; }
.pmx-create-effrow.mid  { color: #5F5449; font-size: 11px; margin-bottom: 5px; }
.pmx-create-effrow.low  { color: #9a9082; font-size: 10px; }

.pmx-create-empty {
    color: #8E7F7F;
    font-style: italic;
    font-size: 11px;
}

/* DEPENDENCY row — separate axis, weighted, no verdict.
   Hatched bar + filled portion + cold "NN% · TIER" readout.
   Stamps in last as the final beat of the popup. */
.pmx-create-deprow {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    border: 1.5px solid #8b2f47;
    padding: 9px 12px;
    opacity: 0;
    transform: scale(1.5);
    animation: pmxDepStamp .38s cubic-bezier(.34, 1.4, .5, 1) 2.00s forwards;
}
.pmx-create-dep-label {
    font-size: 10px;
    letter-spacing: 1px;
    color: #8b2f47;
    white-space: nowrap;
}
.pmx-create-dep-bar {
    flex: 1 1 auto;
    position: relative;
    height: 13px;
    border: 1px solid #8b2f47;
    background: repeating-linear-gradient(45deg,
        transparent 0, transparent 4px,
        rgba(139, 47, 71, .35) 4px, rgba(139, 47, 71, .35) 8px);
}
.pmx-create-dep-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: rgba(139, 47, 71, .55);
    transition: width .35s ease;
}
.pmx-create-dep-read {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 15px;
    color: #8b2f47;
    letter-spacing: 1px;
    white-space: nowrap;
}
@keyframes pmxDepStamp {
    0%   { opacity: 0; transform: scale(1.5); }
    55%  { opacity: 1; transform: scale(.93); }
    78%  { opacity: 1; transform: scale(1.03); }
    100% { opacity: 1; transform: scale(1); }
}

.pmx-create-actions {
    display: flex;
    gap: 12px;
    justify-content: stretch;
    margin-top: 16px;
    opacity: 0;
    transform: translateY(-4px);
    animation: pmxLineReveal .30s cubic-bezier(.22, 1, .36, 1) 2.30s forwards;
}
.pmx-create-btn {
    flex: 1 1 0;
    text-align: center;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 11px;
    cursor: pointer;
    background: rgba(255, 248, 220, .55);
    transition: background .15s ease, transform .12s ease;
}
.pmx-create-btn:hover { background: rgba(196, 168, 122, .25); transform: translateY(-1px); }
.pmx-create-btn:active { transform: translateY(0); }
/* ADD TO INVENTORY — neutral ink (the safe, paper-archive choice). */
.pmx-create-btn.add  {
    border: 1.5px solid #8E7F7F;
    color: #5F5449;
}
.pmx-create-btn.add:hover { border-color: #5F5449; }
/* TAKE NOW — red ink (the body choice, danger signal). */
.pmx-create-btn.take {
    border: 1.5px solid #8b2f47;
    color: #8b2f47;
}
.pmx-create-btn.take:hover {
    background: rgba(139, 47, 71, .12);
    border-color: #6e1d24;
    color: #6e1d24;
}

.pmx-create-cancel {
    position: absolute;
    top: 8px; right: 8px;
    width: 26px; height: 26px;
    background: transparent;
    border: 1.5px solid #8E7F7F;
    color: #5F5449;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s ease;
}
.pmx-create-cancel:hover {
    background: rgba(94, 84, 73, .15);
    border-color: #5F5449;
}

/* ── Toast (post-mix confirmation, post-mix warnings) ── */
.pmx-toast {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translate(-50%, 12px);
    background: rgba(58, 49, 40, .94);
    color: #ece6da;
    border: 1px solid #5F5449;
    padding: 8px 18px;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 12px;
    letter-spacing: 2px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .22s ease, transform .22s ease;
    z-index: 20;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .55);
}
.pmx-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
.pmx-toast.warn {
    border-color: #c0532a;
    color: #f3c8a8;
    background: rgba(60, 24, 12, .94);
}

/* ═══ RIGHT — Mixture analysis ═══ */
.pmx-analysis {
    position: relative;
    border-left: 2px solid #8E7F7F;
    padding: 20px 16px;
    font-size: 11px;
    color: #3a3128;
    z-index: 1;
    overflow-y: auto;
}
.pmx-box {
    border: 2px solid #5F5449;
    margin-bottom: 12px;
    background: rgba(255, 248, 220, .35);
}
.pmx-box-head {
    border-bottom: 1px dashed #5F5449;
    padding: 6px 10px;
    font-size: 10px;
    letter-spacing: 2px;
    color: #5F5449;
}
.pmx-box-body {
    padding: 8px 10px;
    line-height: 1.6;
    font-size: 12px;
}
.pmx-empty {
    color: #8E7F7F;
    font-style: italic;
}

.pmx-box.character {
    text-align: center;
    border-color: #8b6914;
}
.pmx-character-name {
    padding: 12px;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 18px;
    letter-spacing: 3px;
}
.pmx-character-blurb {
    font-size: 10px;
    color: #8E7F7F;
    padding-bottom: 10px;
    letter-spacing: 1px;
    text-transform: lowercase;
    font-style: italic;
}

.pmx-box.positive { border-color: #5a7a3a; }
.pmx-box.positive .pmx-box-head { border-color: #5a7a3a; color: #5a7a3a; }
.pmx-box.negative { border-color: #8b3030; }
.pmx-box.negative .pmx-box-head { border-color: #8b3030; color: #8b3030; }
.pmx-box.dependency { border-color: #8b2f47; }
.pmx-box.dependency .pmx-box-head { border-color: #8b2f47; color: #8b2f47; }

.pmx-dep-bar {
    position: relative;
    height: 16px;
    border: 1.5px solid #8b2f47;
    background: repeating-linear-gradient(45deg,
        transparent, transparent 4px,
        rgba(139, 47, 71, .35) 4px, rgba(139, 47, 71, .35) 8px);
    margin-bottom: 6px;
}
.pmx-dep-fill {
    height: 100%;
    background: rgba(139, 47, 71, .55);
    transition: width .35s ease;
}
/* Read-out always shows BOTH the % and the tier word — never
   just the tier on its own. Bar = data, read-out = the same
   data spelled out. */
.pmx-dep-read {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 12px;
    letter-spacing: 1px;
    color: #8b2f47;
    text-align: right;
}

.pmx-box.tolerance {
    border-color: #8E7F7F;
    padding: 10px;
    font-size: 11px;
    color: #5F5449;
}
.pmx-tol-label {
    letter-spacing: 2px;
    color: #8E7F7F;
    font-size: 10px;
    margin-bottom: 5px;
}
.pmx-tol-val {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 14px;
    letter-spacing: 1.5px;
    color: #3a3128;
}
.pmx-tol-hint {
    font-size: 10px;
    color: #8E7F7F;
    font-style: italic;
    margin-top: 6px;
    line-height: 1.4;
}


/* ── INPUT LOCK (Ch54: after GIVE IT TO MARCO, through Sal's verdict).
   The flashback reveal classes give the footer and the stock their own
   pointer-events:auto, which a parent's `none` does not override — this
   does. Lifted by the present-day mixer. ── */
#pillsMixerContainer.pmx-input-locked,
#pillsMixerContainer.pmx-input-locked * {
    pointer-events: none !important;
}

/* ── THE BRIEF — the scene's case card, top of the ANALYSIS column.
      What the glass is for, one line per rule, ticking as pills land
      (js/pills-mixer.js _renderSceneBrief; the Ch54 lessons fill it). */
.pmx-brief {
    border: 1px solid rgba(90, 75, 55, .45);
    background: rgba(255, 252, 240, .55);
    padding: 6px 9px 7px;
    margin-bottom: 9px;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, .07);
}
.pmx-brief-head {
    font-family: 'Special Elite', 'Courier New', cursive;
    font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
    color: #8b2020; margin-bottom: 2px;
}
.pmx-brief-sub {
    font-size: 9.5px; font-style: italic; color: #6a5e52;
    margin-bottom: 7px; line-height: 1.3;
}
.pmx-brief-row { display: flex; gap: 6px; align-items: flex-start; padding: 1px 0; font-size: 10px; line-height: 1.25; }
.pmx-brief-mark { flex: 0 0 10px; text-align: center; font-weight: 700; }
.pmx-brief-label i { display: block; font-size: 9px; font-style: italic; opacity: .75; }
.pmx-brief-row.ok   { color: #3a6a2a; }
.pmx-brief-row.bad  { color: #8b2020; }
.pmx-brief-row.todo { color: #3a3128; }
.pmx-brief-row.opt  { color: #8e8070; }
.pmx-brief-foot {
    margin-top: 7px; padding-top: 6px; border-top: 1px dashed rgba(90, 75, 55, .35);
    font-size: 9px; font-style: italic; color: #6a5e52; line-height: 1.35;
}
/* In the memory the card is part of the lesson: it develops when Sal
   says "Go on. Build it." — not before. */
.pmx-flashback .pmx-brief {
    opacity: .07; filter: blur(2.5px) brightness(.82);
    transition: opacity .55s cubic-bezier(.22, 1, .36, 1), filter .55s cubic-bezier(.22, 1, .36, 1);
}
.pmx-flashback.pmx-show-practice .pmx-brief { opacity: 1; filter: blur(0) brightness(1); }

/* ── The strip and the sheet share the screen ──
   A scene holds the dialogue strip at the bottom while the player
   works the glass (Ch54: Sal's lesson, Alicia's kitchen). The sheet
   is sized off the viewport, so its footer — CLEAR and the commit
   button — sat UNDER the strip: a hand could not reach the one
   button the scene was waiting for. With a strip up, the sheet is
   shorter by its height and the footer clears it. */
body:has(#overlayDialogue) .pmx-window { padding-bottom: 176px; }
body:has(#overlayDialogue) .pmx-paper { height: min(820px, calc(var(--vh100, 100vh) - 240px)); }

/* ── THE MEMORY AND THE PRESENT SIT ON THE SAME LINES (2026-09-26) ──
   The result row was a centred flex pair, so the beaker slid left
   when the TYPE chip grew ("TYPE · —" → "TYPE · MIND" + a flavor
   line), and the scene hint's second line pushed the whole column
   down. Fixed columns for the row, a fixed height for the hint:
   Sal's sheet and Alicia's sheet now match drawing for drawing. */
.pmx-result-row {
    display: grid;
    grid-template-columns: 130px 300px;
    justify-content: center;
    align-items: end;
    column-gap: 36px;
}
.pmx-type-block { width: 300px; box-sizing: border-box; }
.pmx-type-flavor { overflow-wrap: anywhere; }
.pmx-scene-hint { min-height: 3.4em; box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
/* …and the sheet itself does not slide: with the mixer up the PAGE
   behind it must not scroll — Alicia's kitchen dress made the document
   21 px taller, the page grew a scrollbar, the fixed window lost 15 px
   and the whole sheet sat 8 px left of where the memory had it. */
html.pmx-open { overflow: hidden; }   /* set/cleared by js/pills-mixer-page-lock.js */
