/* ==========================================================================
   Animal Picker Wheel — Pop-out Habitat (kids)
   Page chrome is theme-aware (var(--theme-*)); the savanna scene keeps fixed
   "physical" colours (grass and sky shouldn't invert in dark mode).
   ========================================================================== */
.page-animal-picker-wheel {
    --apw-primary: #15803d;
    /* B18: the READABLE weight of the same green, for TEXT only. --apw-primary
       stays exactly as it was for every decoration use on the page. Same shape
       as B13's --theme-accent / --theme-accent-ink split and hogwarts'
       --hw-gold / --hw-gold-ink. */
    --apw-primary-ink: #0f5f2d;
}

/* ⚠️ ONE INK CANNOT SERVE BOTH GROUNDS — and the first attempt at B18 proved it.
   Darkening the kicker to #0f5f2d took the LIGHT theme from 3.99:1 to 6.19:1 and
   the DARK theme from 3.12:1 to **2.01:1** — better and worse in the same edit,
   which only showed up because both themes were re-measured rather than one.
   The dark theme paints a near-black ground (27,38,31), so the text there needs
   a LIGHT green. Same shape as the site-wide accent/ink split (B13). */
/* ⚠️ NO SPACE — .page-animal-picker-wheel IS the body, not a descendant of it.
   The first version wrote `body[data-theme="dark"] .page-animal-picker-wheel`,
   which matched NOTHING, and the dark theme kept reporting the old 2.01:1. A
   selector that matches nothing fails silently (SKILLS rule 21). */
body[data-theme="dark"].page-animal-picker-wheel,
body[data-theme="high-contrast"].page-animal-picker-wheel {
    --apw-primary-ink: #6ee7a0;
    --apw-accent: #f59e0b;
    --apw-grad: linear-gradient(135deg, #22c55e, #15803d);
    --apw-ink: var(--theme-text, #1f2430);
    /* ⚠️ --theme-muted, NOT --theme-text-muted: the latter is not defined
       anywhere in themes.css, so it silently fell back to the literal on every
       theme and this copy never adapted. */
    --apw-muted: var(--theme-muted, #6b7280);
    --apw-surface: var(--theme-surface, #ffffff);
    --apw-border: var(--theme-border, #e5e7eb);
}

/* ---- Ambient backdrop --------------------------------------------------- */
.page-animal-picker-wheel::before {
    content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background:
        radial-gradient(1100px 560px at 6% -6%, rgba(34, 197, 94, 0.10), transparent 60%),
        radial-gradient(950px 520px at 96% 2%, rgba(245, 158, 11, 0.08), transparent 62%),
        radial-gradient(880px 640px at 50% 108%, rgba(21, 128, 61, 0.06), transparent 60%);
}

/* ---- Stage + scene ------------------------------------------------------ */
.page-animal-picker-wheel .apw-stage { position: relative; max-width: 560px; margin: 0 auto; }
.page-animal-picker-wheel .apw-stage-wrap { position: relative; }
.page-animal-picker-wheel #apwStage { display: block; }
.page-animal-picker-wheel .apw-svg { width: 100%; height: auto; display: block; max-height: 72vh; filter: drop-shadow(0 14px 30px rgba(20, 60, 30, 0.25)); border-radius: 18px; }

.page-animal-picker-wheel .apw-shadow { fill: rgba(30, 60, 20, 0.22); }
.page-animal-picker-wheel .apw-lbl {
    text-anchor: middle; fill: #fff; font-family: var(--bs-body-font-family, sans-serif); font-weight: 700;
    paint-order: stroke; stroke: rgba(25, 55, 20, 0.6); stroke-width: 2.2px; stroke-linejoin: round;
}
.page-animal-picker-wheel .apw-cre-e { text-anchor: middle; dominant-baseline: central; }
.page-animal-picker-wheel .apw-fringe { pointer-events: none; }

/* creature motion — bob while idle, dart as the lens sweeps past */
.page-animal-picker-wheel .apw-creature { transform-box: fill-box; transform-origin: center bottom; }
.page-animal-picker-wheel .apw-creature.is-peek { animation: apwPeek 1s ease-in-out 1; }
@keyframes apwPeek { 0%,100% { transform: translateY(0); } 45% { transform: translateY(-7px); } }
.page-animal-picker-wheel .apw-creature.is-dart { animation: apwDart .5s ease-in-out 1; }
@keyframes apwDart {
    0%,100% { transform: translateY(0) rotate(0); }
    30%     { transform: translateY(9px) rotate(-5deg); }   /* duck */
    65%     { transform: translateY(-10px) rotate(4deg); }  /* pop back up */
}
.page-animal-picker-wheel .apw-spot.is-target .apw-creature { filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }

/* ---- Viewfinder chrome -------------------------------------------------- */
.page-animal-picker-wheel .apw-vf-edge { fill: none; stroke: rgba(255,255,255,.5); stroke-width: 2; stroke-dasharray: 3 5; }
.page-animal-picker-wheel .apw-ret-c { fill: none; stroke: rgba(255,255,255,.55); stroke-width: 1.6; }
.page-animal-picker-wheel .apw-ret-l { stroke: rgba(255,255,255,.75); stroke-width: 2; stroke-linecap: round; }
.page-animal-picker-wheel .apw-ret.is-hunting .apw-ret-c { animation: apwHunt .55s ease-in-out infinite; }
@keyframes apwHunt { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
.page-animal-picker-wheel .apw-ret.is-locking .apw-ret-c,
.page-animal-picker-wheel .apw-ret.is-locking .apw-ret-l { stroke: #fde047; }
.page-animal-picker-wheel .apw-ret.is-locked .apw-ret-c,
.page-animal-picker-wheel .apw-ret.is-locked .apw-ret-l { stroke: #4ade80; }
.page-animal-picker-wheel .apw-brk { stroke: rgba(255,255,255,.9); stroke-width: 2.6; stroke-linecap: round; transition: stroke .2s ease; }
.page-animal-picker-wheel .apw-ret.is-locked ~ #apwBrk .apw-brk { stroke: #4ade80; }
.page-animal-picker-wheel .apw-hud {
    fill: rgba(255,255,255,.9); font: 700 10px var(--bs-body-font-family, sans-serif); letter-spacing: 1.6px;
    paint-order: stroke; stroke: rgba(20,40,15,.4); stroke-width: 2px;
}
.page-animal-picker-wheel .apw-hud-r { text-anchor: end; }
.page-animal-picker-wheel .apw-rec { fill: #ef4444; animation: apwRec 1.4s ease-in-out infinite; }
@keyframes apwRec { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ---- Shutter + flash ---------------------------------------------------- */
.page-animal-picker-wheel .apw-shutter { fill: #0b1207; }
.page-animal-picker-wheel .apw-flash { fill: #ffffff; pointer-events: none; }

/* ---- Developing photo --------------------------------------------------- */
.page-animal-picker-wheel .apw-photo-card { fill: #fdfdf8; stroke: rgba(0,0,0,.18); stroke-width: 1; filter: drop-shadow(0 8px 18px rgba(0,0,0,.4)); }
.page-animal-picker-wheel .apw-photo-win { fill: #dfe6da; }
.page-animal-picker-wheel .apw-photo-veil { fill: #8b9186; }
.page-animal-picker-wheel .apw-photo-name {
    text-anchor: middle; fill: #2b3326; font: 700 12px var(--bs-body-font-family, sans-serif);
}
.page-animal-picker-wheel .apw-photo.is-developed .apw-photo-card { stroke: rgba(74,222,128,.85); stroke-width: 2; }

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

/* ---- Winner result bar (shared layout — identity only here) ------------- */
.page-animal-picker-wheel .wsp-result {
    /* ⚠️ CARRYOVER B18 — the kicker was sub-AA in BOTH themes (3.12:1 dark,
       3.99:1 light) because the accent was --apw-primary (#15803d), the page's
       DECORATION green. That is the same trap B13 fixed site-wide: one token
       doing decoration and text. A darker ink is used for the text only; the
       decoration green is untouched everywhere else on the page. */
    --wsp-result-accent: var(--apw-primary-ink);
    /* ⚠️ CARRYOVER C7 — white ink scored only 2.28:1 against this gradient's
       LIGHT stop (#22c55e). The range was the problem, not the ink.
       ⚠️ First attempt lifted the light stop to #17914a and got 4.05:1 — BETTER,
       STILL FAILING. Measured, not assumed, which is the only reason it was
       caught. The gradient now runs DOWNWARD from #15803d, which already scores
       5.02:1, so both stops are provably at or below that luminance. */
    --wsp-result-grad: linear-gradient(135deg, #15803d, #0f5f2d);
    --wsp-result-btn-ink: #ffffff;
    --wsp-result-plate: #e3f0e8;
    --wsp-result-tint: rgba(21, 128, 61, .08);
}

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

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

/* ---- Winner reveal ------------------------------------------------------ */
.page-animal-picker-wheel .apw-modal-img { width: 148px; height: 148px; display: inline-block; object-fit: contain; }
.apw-modal-img { width: 148px; height: 148px; display: inline-block; object-fit: contain; }
.apw-modal-emoji { font-size: 72px; line-height: 1; }

/* ---- Animal chooser grid (settings) ------------------------------------- */
.page-animal-picker-wheel .apw-item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .5rem; }
.page-animal-picker-wheel .apw-chip {
    --chip-c: #22c55e; position: relative;
    border: 2px solid var(--apw-border); background: var(--apw-surface); border-radius: 12px; padding: .5rem .2rem .35rem;
    cursor: pointer; text-align: center; transition: transform .1s ease, border-color .1s ease, box-shadow .1s ease; opacity: .5;
}
.page-animal-picker-wheel .apw-chip-e { display: block; font-size: 24px; line-height: 1; margin-bottom: .15rem; }
.page-animal-picker-wheel .apw-chip img { width: 58px; height: 58px; display: block; margin: 0 auto .2rem; object-fit: contain; }
.page-animal-picker-wheel .apw-chip-t { font-size: .66rem; font-weight: 700; color: var(--apw-ink); display: block; line-height: 1.1; }
.page-animal-picker-wheel .apw-chip:hover { transform: translateY(-2px); border-color: var(--chip-c); }
.page-animal-picker-wheel .apw-chip.is-on { opacity: 1; border-color: var(--chip-c); box-shadow: 0 6px 16px -10px var(--chip-c); }
.page-animal-picker-wheel .apw-chip.is-custom { opacity: 1; border-style: dashed; border-color: var(--chip-c); }
.page-animal-picker-wheel .apw-chip-x {
    position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
    background: var(--apw-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-animal-picker-wheel .apw-custom-row { display: flex; gap: .4rem; margin-top: .6rem; }
.page-animal-picker-wheel .apw-custom-row input {
    flex: 1 1 auto; border: 1px solid var(--apw-border); border-radius: 10px; padding: .5rem .7rem; font-size: .9rem;
    background: var(--apw-surface); color: var(--apw-ink);
}
.page-animal-picker-wheel .apw-custom-row button { border: 0; border-radius: 10px; padding: .5rem .9rem; font-weight: 700; color: #fff; background: var(--apw-grad); cursor: pointer; }

/* ---- SEO content section ------------------------------------------------ */
.page-animal-picker-wheel .apw-content {
    color: var(--apw-ink);
    background: linear-gradient(180deg, #ffffff 0%, #f0f8ee 100%);
    padding: 3.5rem 0 3.75rem; margin-top: 1rem;
    border-top: 1px solid var(--apw-border);
}
body[data-theme].page-animal-picker-wheel .apw-content { background: var(--theme-bg); }
.page-animal-picker-wheel .apw-inner { max-width: 860px; margin: 0 auto; padding: 0 1rem; }
.page-animal-picker-wheel .apw-content h2,
.page-animal-picker-wheel .apw-content h3 { color: var(--apw-ink); }
.page-animal-picker-wheel .apw-content p,
.page-animal-picker-wheel .apw-content li { color: var(--apw-muted); }
.page-animal-picker-wheel .apw-content strong { color: var(--apw-ink); }
.page-animal-picker-wheel .apw-content em { color: var(--apw-ink); font-style: italic; }
.page-animal-picker-wheel .apw-content a { color: var(--apw-primary); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.page-animal-picker-wheel .apw-content a:hover { color: #166534; }

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

.page-animal-picker-wheel .apw-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; margin-top: 1.4rem; }
.page-animal-picker-wheel .apw-step {
    display: flex; gap: .75rem; align-items: flex-start;
    background: var(--apw-surface); border: 1px solid var(--apw-border); border-radius: 14px; padding: 1rem 1.05rem;
    box-shadow: 0 10px 24px -18px rgba(21,128,61,.6);
}
.page-animal-picker-wheel .apw-step-num {
    flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
    font-weight: 800; color: #fff; background: var(--apw-grad);
}
.page-animal-picker-wheel .apw-step-body { min-width: 0; }
.page-animal-picker-wheel .apw-step-title { font-weight: 800; color: var(--apw-ink); margin-bottom: .15rem; }
.page-animal-picker-wheel .apw-step-body p { font-size: .9rem; margin: 0; }

.page-animal-picker-wheel .apw-table-wrap { overflow-x: auto; margin-top: 1.4rem; }
.page-animal-picker-wheel .apw-ctab { width: 100%; border-collapse: collapse; min-width: 520px; font-size: .95rem; }
.page-animal-picker-wheel .apw-ctab thead th {
    text-align: left; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; font-weight: 800;
    color: #fff; background: var(--apw-primary); padding: .7rem 1rem;
}
.page-animal-picker-wheel .apw-ctab tbody td { padding: .65rem 1rem; border-bottom: 1px solid var(--apw-border); color: var(--apw-muted); }
.page-animal-picker-wheel .apw-ctab tbody td:first-child { font-weight: 800; color: var(--apw-ink); white-space: nowrap; }
.page-animal-picker-wheel .apw-ctab tbody tr:last-child td { border-bottom: 0; }

.page-animal-picker-wheel .apw-callout {
    background: var(--apw-surface); border: 1px solid var(--apw-border); border-left: 4px solid var(--apw-primary);
    border-radius: 14px; padding: 1.4rem 1.5rem;
}
.page-animal-picker-wheel .apw-callout p { margin-bottom: 0; }

.page-animal-picker-wheel .apw-content .accordion { margin-top: 1rem; border-radius: 14px; overflow: hidden; border: 1px solid var(--apw-border); }
.page-animal-picker-wheel .apw-content .accordion-item { border: 0; border-bottom: 1px solid var(--apw-border); background: var(--apw-surface); }
.page-animal-picker-wheel .apw-content .accordion-item:last-child { border-bottom: 0; }
.page-animal-picker-wheel .apw-content .accordion-button { font-weight: 700; color: var(--apw-ink); background: var(--apw-surface); }
.page-animal-picker-wheel .apw-content .accordion-button:not(.collapsed) { color: var(--apw-primary); background: var(--apw-surface); box-shadow: none; }
.page-animal-picker-wheel .apw-content .accordion-body { color: var(--apw-muted); }

@media (max-width: 767.98px) {
    .page-animal-picker-wheel .apw-steps { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .page-animal-picker-wheel .apw-start-overlay,
    .page-animal-picker-wheel .apw-creature.is-peek,
    .page-animal-picker-wheel .apw-creature.is-dart,
    .page-animal-picker-wheel .apw-ret.is-hunting .apw-ret-c,
    .page-animal-picker-wheel .apw-rec { animation: none; }
}


/* ---- High-contrast -------------------------------------------------------
   HC sets --theme-muted: #1f2937, which is right on its WHITE cards and
   unreadable on its BLACK body (measured 1.43:1). So the content section's
   copy goes light, and every white-surfaced component inside it is restored
   to dark with a more specific selector. Must stay LAST in the file:
   equal-specificity declarations are resolved by source order. */
body[data-theme="high-contrast"].page-animal-picker-wheel .apw-content p,
body[data-theme="high-contrast"].page-animal-picker-wheel .apw-content li,
body[data-theme="high-contrast"].page-animal-picker-wheel .apw-ctab tbody td {
    color: rgba(255, 255, 255, .84);
}
body[data-theme="high-contrast"].page-animal-picker-wheel .apw-step-body p,
body[data-theme="high-contrast"].page-animal-picker-wheel .apw-step-title,
body[data-theme="high-contrast"].page-animal-picker-wheel .apw-step strong,
body[data-theme="high-contrast"].page-animal-picker-wheel .apw-callout p,
body[data-theme="high-contrast"].page-animal-picker-wheel .apw-callout li,
body[data-theme="high-contrast"].page-animal-picker-wheel .apw-callout strong {
    color: #1f2937;
}
