/* ==========================================================================
   HP Creature Picker — the rattling case (Harry Potter category)
   Only page on creature-crate-engine.js. A stout wooden case on a bench rattles
   harder and harder, a blur of creatures flashes behind its slats, the lid bursts
   open and one creature rises out and names itself.
   ⚠️ It is a single hero-object reveal + a LINEAR glimpse montage, NOT a pointer
   on a loop — that is what keeps it from being a wheel in disguise (hp-spell).
   Page chrome is theme-aware (var(--theme-*)); the wood, the iron and the glow
   stay fixed — they are physical objects, not themed surfaces.
   ⚖️ Original artwork only: a generic case, a generic bench, and one plain
   stylised silhouette per creature. No likenesses.
   ========================================================================== */
.page-hp-creature-picker {
    --ccr-primary: #8a5a2a;
    --ccr-accent: #d9a441;
    --ccr-grad: linear-gradient(135deg, #e6b64a, #8a5a2a);
    --ccr-ink: var(--theme-text, #1f2430);
    /* ⚠️ --theme-muted, NOT --theme-text-muted — the latter is undefined and
       silently falls back to its literal on every theme. */
    --ccr-muted: var(--theme-muted, #6b7280);
    --ccr-surface: var(--theme-surface, #ffffff);
    --ccr-border: var(--theme-border, #e5e7eb);
    --ccr-display: 'Harry P', 'Cinzel Decorative', Georgia, serif;
    /* the emblems ship with no background of their own, so each surface supplies
       a parchment plate — swapped-in art stays legible on a dark theme */
    --ccr-plate: #efe6d0;
}

/* ---- Ambient backdrop --------------------------------------------------- */
.page-hp-creature-picker::before {
    content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background:
        radial-gradient(1040px 560px at 8% -6%, rgba(217, 164, 65, 0.15), transparent 60%),
        radial-gradient(920px 520px at 94% 2%, rgba(138, 90, 42, 0.14), transparent 62%),
        radial-gradient(880px 620px at 50% 108%, rgba(36, 26, 18, 0.16), transparent 60%);
}

/* ---- Stage -------------------------------------------------------------- */
.page-hp-creature-picker .ccr-stage { position: relative; max-width: 600px; margin: 0 auto; }
.page-hp-creature-picker .ccr-stage-wrap { position: relative; }
.page-hp-creature-picker #ccrStage { display: block; }
.page-hp-creature-picker .ccr-svg {
    width: 100%; height: auto; display: block; max-height: 72vh; border-radius: 16px;
    filter: drop-shadow(0 14px 34px rgba(18, 11, 6, .55));
}
.page-hp-creature-picker .ccr-fx,
.page-hp-creature-picker .ccr-plate { pointer-events: none; }

/* ---- Rising winner ------------------------------------------------------ */
.page-hp-creature-picker .ccr-fx-bit { mix-blend-mode: screen; }

/* ---- Hanging name tag --------------------------------------------------- */
.page-hp-creature-picker .ccr-plate-bg { fill: #b8892f; stroke: #3a2810; stroke-width: 2; }
.page-hp-creature-picker .ccr-plate-hole { fill: #3a2810; }
.page-hp-creature-picker .ccr-plate-str { stroke: #3a2810; stroke-width: 2.4; }
.page-hp-creature-picker .ccr-plate-t {
    text-anchor: middle; fill: #2c1a08; font-weight: 400;
    font-family: var(--ccr-display); letter-spacing: .03em;
}

/* ---- Start overlay ------------------------------------------------------ */
.page-hp-creature-picker .ccr-start-overlay {
    position: absolute; left: 50%; top: 50%; z-index: 3;
    display: inline-flex; align-items: center; gap: .5rem; border: 0; border-radius: 999px;
    padding: .8rem 1.9rem; font-size: 1.02rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
    color: #2c1a08; background: var(--ccr-grad); cursor: pointer; box-shadow: 0 12px 30px -8px rgba(40, 25, 8, .95);
    animation: ccrStartPulse 1.8s ease-in-out infinite;
}
.page-hp-creature-picker .ccr-start-overlay:hover { filter: brightness(1.08); }
.page-hp-creature-picker .ccr-start-overlay[hidden] { display: none; }
@keyframes ccrStartPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

.page-hp-creature-picker .ccr-count { text-align: center; font-size: .9rem; color: var(--ccr-muted); margin: .7rem 0 .25rem; }
.page-hp-creature-picker .ccr-count.is-warn { color: var(--ccr-primary); font-weight: 700; }
.page-hp-creature-picker .ccr-effects { display: flex; gap: 1.2rem; justify-content: center; margin-top: .5rem; flex-wrap: wrap; }
.page-hp-creature-picker .ccr-effects label { font-size: .85rem; color: var(--ccr-muted); display: inline-flex; align-items: center; gap: .35rem; }

/* ---- Result bar --------------------------------------------------------- */
.page-hp-creature-picker .wsp-result {
    --wsp-result-accent: var(--ccr-primary);
    --wsp-result-grad: var(--ccr-grad);
    --wsp-result-btn-ink: #2c1a08;
    --wsp-result-plate: var(--ccr-plate);
    --wsp-result-display: var(--ccr-display);
    --wsp-result-tint: linear-gradient(135deg, rgba(217, 164, 65, .15), rgba(138, 90, 42, .10));
}

/* ---- Speed slider ------------------------------------------------------- */
.page-hp-creature-picker .ccr-speed { margin: .9rem auto .2rem; max-width: 420px; }
.page-hp-creature-picker .ccr-speed > label {
    display: flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 600;
    color: var(--ccr-muted); margin-bottom: .4rem;
}
.page-hp-creature-picker .ccr-speed-val { margin-left: auto; font-weight: 800; color: var(--ccr-primary); font-variant-numeric: tabular-nums; }
.page-hp-creature-picker .ccr-range {
    -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px;
    background: rgba(120, 120, 120, .25); outline: none; cursor: pointer;
}
.page-hp-creature-picker .ccr-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
    background: var(--ccr-grad); border: 2px solid #fff; box-shadow: 0 2px 6px -1px rgba(40, 25, 8, .8);
}
.page-hp-creature-picker .ccr-range::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%; background: #8a5a2a; border: 2px solid #fff;
}
.page-hp-creature-picker .ccr-range-ends {
    display: flex; justify-content: space-between; font-size: .72rem; color: var(--ccr-muted);
    opacity: .75; margin-top: .25rem;
}

/* ---- Winner reveal ------------------------------------------------------ */
.page-hp-creature-picker .ccr-modal-img,
.ccr-modal-img {
    width: 168px; height: 168px; display: inline-block; object-fit: contain;
    background: #efe6d0; border-radius: 50%; padding: 14px;
    box-shadow: inset 0 0 0 3px rgba(138, 90, 42, .5);
}
.ccr-modal-ink {
    width: 168px; height: 168px; display: inline-block;
    background: #efe6d0; border-radius: 50%; padding: 26px;
    box-shadow: inset 0 0 0 3px rgba(138, 90, 42, .5);
}
.ccr-modal-ink svg { width: 100%; height: 100%; display: block; }
.page-hp-creature-picker #winnerName {
    font-family: var(--ccr-display); font-weight: 400; letter-spacing: .02em; font-size: 2.1rem;
}
.page-hp-creature-picker h1,
.page-hp-creature-picker .ccr-kicker { font-family: var(--ccr-display); letter-spacing: .03em; }

/* ---- Creature chooser grid (settings) ----------------------------------- */
.page-hp-creature-picker .ccr-item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.page-hp-creature-picker .ccr-chip {
    --chip-c: #8a5a2a; position: relative;
    border: 2px solid var(--ccr-border); background: var(--ccr-surface); border-radius: 10px; padding: .5rem .3rem .4rem;
    cursor: pointer; text-align: center; transition: transform .1s ease, border-color .1s ease, box-shadow .1s ease; opacity: .55;
}
.page-hp-creature-picker .ccr-chip img,
.page-hp-creature-picker .ccr-chip-ink {
    width: 54px; height: 54px; display: block; margin: 0 auto .25rem; object-fit: contain;
    background: var(--ccr-plate); border-radius: 50%; padding: 5px;
    box-shadow: inset 0 0 0 1.5px rgba(138, 90, 42, .45);
}
.page-hp-creature-picker .ccr-chip-ink svg { width: 100%; height: 100%; display: block; }
.page-hp-creature-picker .ccr-chip-t { font-size: .66rem; font-weight: 700; color: var(--ccr-ink); display: block; line-height: 1.15; }
.page-hp-creature-picker .ccr-chip:hover { transform: translateY(-2px); border-color: var(--chip-c); }
.page-hp-creature-picker .ccr-chip.is-on { opacity: 1; border-color: var(--chip-c); box-shadow: 0 6px 16px -10px var(--chip-c); }
.page-hp-creature-picker .ccr-chip.is-custom { opacity: 1; border-style: dashed; border-color: var(--chip-c); }
.page-hp-creature-picker .ccr-chip-x {
    position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
    background: var(--ccr-primary); color: #fff; font-size: 13px; font-weight: 700; line-height: 18px; text-align: center;
    box-shadow: 0 2px 5px -1px rgba(0, 0, 0, .4);
}
.page-hp-creature-picker .ccr-custom-row { display: flex; gap: .4rem; margin-top: .6rem; }
.page-hp-creature-picker .ccr-custom-row input {
    flex: 1 1 auto; border: 1px solid var(--ccr-border); border-radius: 10px; padding: .5rem .7rem; font-size: .9rem;
    background: var(--ccr-surface); color: var(--ccr-ink);
}
.page-hp-creature-picker .ccr-custom-row button { border: 0; border-radius: 10px; padding: .5rem .9rem; font-weight: 700; color: #2c1a08; background: var(--ccr-grad); cursor: pointer; }

/* ---- SEO content section ------------------------------------------------
   Colour + accents ONLY. The type scale comes from the shared .content-guide
   class on the wrapper — never re-declare heading font sizes here. */
.page-hp-creature-picker .ccr-content {
    color: var(--ccr-ink);
    background: linear-gradient(180deg, #ffffff 0%, #faf4e8 100%);
    padding: 3.5rem 0 3.75rem; margin-top: 1rem;
    border-top: 1px solid var(--ccr-border);
}
body[data-theme].page-hp-creature-picker .ccr-content { background: var(--theme-bg); }
.page-hp-creature-picker .ccr-inner { max-width: 860px; margin: 0 auto; padding: 0 1rem; }
.page-hp-creature-picker .ccr-content h2,
.page-hp-creature-picker .ccr-content h3 { color: var(--ccr-ink); }
.page-hp-creature-picker .ccr-content p,
.page-hp-creature-picker .ccr-content li { color: var(--ccr-muted); }
.page-hp-creature-picker .ccr-content strong { color: var(--ccr-ink); }
.page-hp-creature-picker .ccr-content em { color: var(--ccr-ink); font-style: italic; }
.page-hp-creature-picker .ccr-content a { color: var(--ccr-primary); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.page-hp-creature-picker .ccr-content a:hover { color: #6a4218; }

.page-hp-creature-picker .ccr-kicker {
    display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
    color: #2c1a08; background: var(--ccr-grad); border-radius: 999px; padding: .3rem .85rem; margin-bottom: .85rem;
}
.page-hp-creature-picker .ccr-lead { font-size: 1.2rem; line-height: 1.7; color: var(--ccr-ink); }
.page-hp-creature-picker .ccr-section { margin-top: 3rem; }
.page-hp-creature-picker .ccr-list { margin: .4rem 0 0; padding-left: 1.15rem; }

/* ---- Signature section shape: a "field guide" of tagged cards, distinct
   from the spell ledger, professor deck, location map-stops and book shelf. -- */
.page-hp-creature-picker .ccr-guide {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .9rem; margin-top: 1.4rem;
}
.page-hp-creature-picker .ccr-entry {
    background: var(--ccr-surface); border: 1px solid var(--ccr-border); border-radius: 12px;
    padding: .9rem 1rem 1rem; position: relative; border-top: 3px solid var(--ccr-accent);
}
.page-hp-creature-picker .ccr-entry-tag {
    display: inline-block; font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
    color: #2c1a08; background: var(--ccr-accent); border-radius: 999px; padding: .12rem .55rem; margin-bottom: .4rem;
}
.page-hp-creature-picker .ccr-entry h3 { margin: 0 0 .3rem !important; font-size: 1.02rem !important; }
.page-hp-creature-picker .ccr-entry p { margin: 0; font-size: .9rem; }

/* signature asset — the 16-row bestiary table */
.page-hp-creature-picker .ccr-table-wrap { overflow-x: auto; margin-top: 1.4rem; }
.page-hp-creature-picker .ccr-ctab { width: 100%; border-collapse: collapse; min-width: 640px; font-size: .95rem; }
.page-hp-creature-picker .ccr-ctab thead th {
    text-align: left; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; font-weight: 800;
    color: #2c1a08; background: var(--ccr-accent); padding: .7rem 1rem;
}
.page-hp-creature-picker .ccr-ctab tbody td { padding: .7rem 1rem; border-bottom: 1px solid var(--ccr-border); vertical-align: top; }
.page-hp-creature-picker .ccr-ctab tbody tr:nth-child(even) { background: rgba(138, 90, 42, .05); }
.page-hp-creature-picker .ccr-ctab tbody td:first-child { font-weight: 700; color: var(--ccr-ink); white-space: nowrap; }

.page-hp-creature-picker .ccr-callout {
    margin-top: 1.4rem; border-left: 4px solid var(--ccr-primary); border-radius: 0 12px 12px 0;
    background: rgba(138, 90, 42, .08); padding: 1rem 1.15rem;
}
.page-hp-creature-picker .ccr-callout p { margin: 0; }

.page-hp-creature-picker .ccr-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.4rem; }
.page-hp-creature-picker .ccr-pair-card {
    background: var(--ccr-surface); border: 1px solid var(--ccr-border); border-radius: 12px;
    padding: 1rem 1.1rem; border-top: 3px solid var(--ccr-accent);
}
.page-hp-creature-picker .ccr-pair-card h3 { margin-top: 0 !important; font-size: 1.02rem !important; }
.page-hp-creature-picker .ccr-pair-card p:last-child { margin-bottom: 0; font-size: .9rem; }

@media (max-width: 767.98px) {
    .page-hp-creature-picker .ccr-pair { grid-template-columns: 1fr; }
    .page-hp-creature-picker .ccr-content { padding: 2.5rem 0 2.75rem; }
}
