/* ===========================================================================
   halloween.css: styles for halloween.js (the Haunted Reef event).
   Flat colours only, no gradients. Every animation stops under
   prefers-reduced-motion. Remove this file with halloween.js after the event.
   =========================================================================== */
:root {
  --hw-night: #2a1a47;
  --hw-night-2: #3b2466;
  --hw-night-3: #4b3080;
  --hw-pumpkin: #ff8a1f;
  --hw-pumpkin-d: #d96a00;
  --hw-bone: #f3ead7;
  --hw-slime: #8be04f;
  --hw-ink: #24183b;
}

/* ---------- currency chip, nav tab ---------- */
.stat.bones { cursor: pointer; border: 0; background: none; font: inherit; }
.stat.bones .stat-value { color: #8a6d3b; }
.stat.bones.nope, .hw-shop-bal.nope { animation: hwNope 0.4s ease; }
@keyframes hwNope { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.hw-bone { display: inline-block; vertical-align: -3px; flex: none; }
.navbtn.hw-navbtn { position: relative; }
.navbtn.hw-navbtn .icon { color: var(--hw-pumpkin); }
.navbtn.hw-navbtn.active { color: var(--hw-pumpkin-d); }
/* "new" dot pinned to the pumpkin icon; it disappears once the tab is opened */
.navbtn.hw-navbtn .icon { position: relative; }
.hw-nav-dot { position: absolute; top: -2px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: #ff5b3a; box-shadow: 0 0 0 2px #fff; }

/* ---------- hub ---------- */
.hw-hub { background: #f6f3fb; padding-bottom: 32px; }
.hw-hero { position: relative; overflow: hidden; margin: 14px 14px 0; border-radius: 20px; background: var(--hw-night); color: #fff; padding: 22px 22px 18px; display: grid; grid-template-columns: 118px 1fr; grid-template-areas: "fish text" "bank bank"; gap: 14px 16px; align-items: center; }
.hw-hero-sky { position: absolute; inset: 0; pointer-events: none; }
.hw-hero-sky .hw-moon { position: absolute; width: 64px; top: 12px; right: 18px; opacity: 0.95; }
.hw-hero-sky .hw-bat { position: absolute; width: 62px; }
.hw-hero-sky .b1 { top: 26px; right: 104px; animation: hwHover 4.2s cubic-bezier(.45,0,.55,1) infinite; }
.hw-hero-sky .hw-bat > path, .hw-hero-sky .hw-bat ellipse, .hw-hero-sky .hw-bat .wl path, .hw-hero-sky .hw-bat .wr path { fill: #120a24; }
.hw-hero-fish { grid-area: fish; position: relative; z-index: 1; background: var(--hw-night-2); border-radius: 18px; padding: 8px; }
.hw-hero-fish svg { width: 100%; height: auto; display: block; }
.hw-hero-text { grid-area: text; position: relative; z-index: 1; padding-right: 70px; }
.hw-eyebrow { font-family: var(--font-display); font-weight: 800; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--hw-pumpkin); }
.hw-hero h2 { margin: 2px 0 6px; font-family: var(--font-display); font-size: 28px; line-height: 1.05; color: #fff; }
.hw-hero p { margin: 0; font-size: 14px; font-weight: 600; color: #d9cdef; line-height: 1.45; }
.hw-hero p b { color: #fff; }
.hw-bank { grid-area: bank; position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; background: var(--hw-night-2); border-radius: 14px; padding: 10px 12px 10px 14px; }
.hw-bank-n { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-display); font-weight: 800; font-size: 26px; color: var(--hw-bone); }
.hw-bank-l { font-size: 13px; font-weight: 700; color: #cbbde6; }
.hw-shop-btn { margin-left: auto; background: var(--hw-pumpkin); color: #3a1a00; border: 0; box-shadow: 0 3px 0 var(--hw-pumpkin-d); font-weight: 800; }
.hw-shop-btn:hover { filter: brightness(1.05); }

.hw-gift { display: flex; align-items: center; gap: 12px; width: calc(100% - 28px); margin: 12px 14px 0; padding: 12px 14px; border: 2px solid #ffc98f; border-radius: 16px; background: #fff4e6; cursor: pointer; text-align: left; font: inherit; }
.hw-gift b { display: block; font-family: var(--font-display); font-size: 16px; color: #5a2d00; }
.hw-gift small { font-size: 13px; font-weight: 700; color: #9a5a16; }
.hw-gift-cta { margin-left: auto; background: var(--hw-pumpkin); color: #3a1a00; font-weight: 800; font-size: 14px; padding: 8px 14px; border-radius: 10px; box-shadow: 0 3px 0 var(--hw-pumpkin-d); }

.hw-sec { margin: 14px 14px 0; background: #fff; border: 2px solid #e8e0f4; border-radius: 18px; padding: 16px 16px 14px; }
.hw-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hw-sec-head h3 { margin: 0; display: flex; align-items: center; gap: 7px; font-family: var(--font-display); font-size: 19px; color: var(--hw-ink); }
.hw-sec-head h3 svg { color: var(--hw-pumpkin); }
.hw-sec-head span { font-size: 12.5px; font-weight: 800; color: #8a7aa6; white-space: nowrap; }
.hw-sec-sub { margin: 6px 0 12px; font-size: 14px; line-height: 1.5; color: #5c5070; }
.hw-sec-sub b { color: var(--hw-ink); }

.hw-quests { display: grid; gap: 9px; margin-top: 12px; }
.hw-quest { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 4px 12px; width: 100%; padding: 11px 12px; border: 2px solid #ece6f6; border-radius: 14px; background: #fff; font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s ease, transform 0.1s ease; }
.hw-quest:not(:disabled):hover { border-color: #ffc98f; }
.hw-quest:not(:disabled):active { transform: translateY(1px); }
.hw-quest:disabled { cursor: default; }
.hw-q-go { grid-column: 2 / -1; font-size: 12.5px; font-weight: 800; color: var(--hw-pumpkin-d); }
.hw-quest.done { background: #f2fbea; border-color: #c8ecb0; }
.hw-q-ico { width: 36px; height: 36px; border-radius: 10px; background: #f4f0fa; display: grid; place-items: center; }
.hw-q-title { font-weight: 800; font-size: 14.5px; color: var(--hw-ink); margin-bottom: 6px; }
.hw-q-bar { height: 8px; border-radius: 6px; background: #ece6f6; overflow: hidden; }
.hw-q-bar b { display: block; height: 100%; border-radius: 6px; background: var(--hw-pumpkin); }
.hw-quest.done .hw-q-bar b { background: #58cc02; }
.hw-q-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-weight: 800; }
.hw-q-count { font-size: 13px; color: #8a7aa6; }
.hw-q-check { width: 22px; height: 22px; border-radius: 50%; background: #58cc02; color: #fff; font-size: 13px; display: grid; place-items: center; }
.hw-q-reward { display: inline-flex; align-items: center; gap: 3px; font-size: 13.5px; color: #8a6d3b; }

.hw-path { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; position: relative; }
.hw-path li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 9px 4px; position: relative; }
.hw-path li:not(:last-child)::after { content: ""; position: absolute; left: 20px; top: 38px; bottom: -14px; width: 2px; background: #e3daf0; }
.hw-stone { width: 32px; height: 36px; border-radius: 16px 16px 6px 6px; background: #c9cfdb; color: #4e5668; font-family: var(--font-display); font-weight: 800; font-size: 15px; display: grid; place-items: center; position: relative; z-index: 1; }
.hw-path li.done .hw-stone { background: #58cc02; color: #fff; }
.hw-step-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hw-step-main b { font-size: 14.5px; color: var(--hw-ink); }
.hw-step-main small { font-size: 13px; font-weight: 600; color: #6f6386; }
.hw-step-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; font-weight: 800; color: #8a7aa6; }
.hw-step-side small { display: inline-flex; align-items: center; gap: 3px; color: #8a6d3b; font-size: 12.5px; }
.hw-path li.hw-prize { grid-template-columns: 60px 1fr; margin-top: 6px; padding: 10px 12px; border-radius: 14px; background: var(--hw-night); }
.hw-path li.hw-prize b { color: #fff; font-family: var(--font-display); font-size: 17px; }
.hw-path li.hw-prize small { color: #cbbde6; }
.hw-prize-fish { width: 60px; }
.hw-prize-fish svg { width: 100%; height: auto; display: block; }
.hw-path li.hw-prize:not(.done) .hw-prize-fish { opacity: 0.55; filter: grayscale(0.4); }

.hw-mash-list { display: grid; gap: 10px; }
.hw-mash-row { display: grid; gap: 6px; }
.hw-mash-name { font-weight: 800; font-size: 14.5px; color: var(--hw-ink); }
.hw-mash-meter { display: grid; gap: 6px; }
.hw-mash-meter span { font-size: 13px; font-weight: 700; color: #6f6386; }
.hw-mash-meter span b { color: var(--hw-ink); }
.hw-mash-meter.big .hw-q-bar { height: 14px; border-radius: 8px; }
.hw-mash-meter .hw-q-bar b { background: #8b5cf6; }
.hw-mash-meter.done .hw-q-bar b { background: #58cc02; }
.hw-mash-you { margin: 10px 0 0; font-size: 14px; color: #5c5070; }
.hw-mash-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; font-size: 13px; }
.hw-mash-top span { font-weight: 800; color: #8a7aa6; text-transform: uppercase; letter-spacing: 0.06em; font-size: 11.5px; }
.hw-mash-top b { color: var(--hw-ink); }
.hw-mash-teacher { margin: 14px 0 10px; background: #fff; border: 2px solid #e8e0f4; border-radius: 18px; padding: 16px 18px 14px; }
.hw-fine { margin: 14px 18px 0; font-size: 12.5px; line-height: 1.5; color: #7d7192; }

/* ---------- shop ---------- */
.shop-subtab.hw-subtab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.shop-subtab.hw-subtab svg { width: 17px; height: 17px; color: var(--hw-pumpkin); }
.shop-subtab.hw-subtab.active { color: var(--hw-pumpkin-d); }
.hw-shop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; padding: 12px 14px; border-radius: 14px; background: var(--hw-night); color: #fff; }
.hw-shop-head b { display: block; font-family: var(--font-display); font-size: 16px; }
.hw-shop-head small { font-size: 12.5px; font-weight: 600; color: #cbbde6; }
.hw-shop-bal { display: inline-flex; align-items: center; gap: 6px; background: var(--hw-night-2); padding: 6px 11px; border-radius: 10px; font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--hw-bone); }
.shop-card.hw-card { position: relative; }
.hw-ribbon { position: absolute; top: 6px; left: 6px; z-index: 2; background: var(--hw-night); color: #ffd7a8; font-family: var(--font-display); font-weight: 800; font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; }
.shop-price.hw { display: inline-flex; align-items: center; gap: 4px; color: #8a6d3b; }
.shop-price.hw.cant { opacity: 0.55; }
.shop-tag.hw-reward { background: #efe7fb; color: #6b45b8; }
.hw-sel-tag { margin-left: 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--hw-pumpkin-d); vertical-align: 2px; }
.shop-commit.hw-buy:not(.cant) { background: var(--hw-pumpkin); border-color: var(--hw-pumpkin-d); color: #3a1a00; }

/* ---------- new fish parts ---------- */
.fish-mascot.sp-ghost .fish-body { opacity: 0.9; }
.fish-mascot.sp-ghost { animation: hwFloat 3.6s ease-in-out infinite; }
.fish-mascot .hw-glow { animation: hwGlow 2.4s ease-in-out infinite; }
@keyframes hwGlow { 50% { opacity: 0.45; } }
@keyframes hwFloat { 50% { transform: translateY(-3px); } }
.x-bats .xb { transform-origin: 20px 10px; animation: hwFlap 0.42s ease-in-out infinite alternate; }
.x-bats .xb2 { animation-delay: -0.2s; }
.x-bats .xb3 { animation-delay: -0.1s; }
@keyframes hwFlap { to { transform: scaleY(0.55); } }

/* Haunted Reef background: the deep-sea scene re-lit purple, with a moon and graveyard */
.fish-bg.bg-haunted .fish-bg-img { filter: hue-rotate(48deg) saturate(1.15) brightness(0.72); }
.hw-haunt-layer { position: absolute; inset: 0; pointer-events: none; }
.hw-haunt-layer .hw-moon { position: absolute; top: 8%; right: 9%; width: 18%; max-width: 58px; }
.hw-haunt-floor { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 26%; }
.fx-haunted i { background: #ffb052; box-shadow: 0 0 6px #ff8a1f; }
.hw-haunt-tint { position: absolute; inset: 0; z-index: 0; pointer-events: none; background: rgba(76, 30, 128, 0.42); mix-blend-mode: multiply; }

/* ---------- decorations (only with spooky mode on) ---------- */
.hw-path-decor { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.hw-prop { position: absolute; display: flex; align-items: flex-end; gap: 2px; filter: drop-shadow(0 3px 2px rgba(0,0,0,0.18)); }
.hw-prop.grave svg { width: 34px; height: 38px; }
.hw-jack { display: block; }
.hw-ghost { position: absolute; left: -80px; width: 64px; opacity: 0.82; animation: hwDrift 26s linear infinite; }
.hw-ghost.g2 { width: 48px; animation-duration: 34s; animation-delay: -14s; }
.hw-ghost svg, .hw-sleeper svg { width: 100%; height: auto; display: block; }
@keyframes hwDrift { 0% { transform: translateX(0) translateY(0); } 50% { transform: translateX(calc(50vw + 40px)) translateY(-14px); } 100% { transform: translateX(calc(100vw + 160px)) translateY(0); } }
.hw-sleeper { position: absolute; right: 6%; width: 66px; transform: rotate(-6deg); }
.hw-sleeper i { position: absolute; top: -6px; right: 4px; font-style: normal; font-family: var(--font-display); font-weight: 800; font-size: 14px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.4); animation: hwZ 2.6s ease-out infinite; }
.hw-sleeper i + i { right: -8px; font-size: 11px; animation-delay: 1.3s; }
@keyframes hwZ { 0% { opacity: 0; transform: translate(0, 4px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(8px, -16px); } }

.unit-bar { position: relative; }
.hw-bar-web { position: absolute; top: 0; right: 0; width: 64px; height: 64px; color: rgba(255,255,255,0.55); pointer-events: none; }
.hw-bar-web svg { width: 100%; height: 100%; display: block; }
.hw-bar-spider { position: absolute; top: 0; right: 46px; width: 18px; height: 34px; pointer-events: none; transform-origin: top center; animation: hwDangle 3.8s ease-in-out infinite; }
.hw-bar-spider svg { width: 100%; height: 100%; display: block; }
@keyframes hwDangle { 0%, 100% { transform: translateY(-4px) rotate(-3deg); } 50% { transform: translateY(6px) rotate(3deg); } }

.hw-sky { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.hw-corner { position: absolute; width: 110px; height: 110px; color: rgba(255,255,255,0.7); display: none; }
.hw-corner.tl { left: 0; bottom: 0; transform: rotate(180deg) scaleX(-1); }
.hw-corner.tr { right: 0; bottom: 0; transform: rotate(90deg); }
.hw-corner svg { width: 100%; height: 100%; display: block; }
@media (min-width: 900px) { .hw-corner { display: block; } }

@keyframes hwHover { 50% { transform: translateY(-6px); } }

.complete-screen { position: relative; }
.hw-complete-line { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: center; max-width: 92%; padding: 9px 14px; border-radius: 12px; background: #f4f0fa; font-size: 14px; font-weight: 700; color: #5c5070; }
.hw-complete-line b { font-family: var(--font-display); font-size: 17px; color: #8a6d3b; }
.hw-cameo { position: absolute; top: calc(50% - 190px); left: calc(50% + 64px); width: 100px; pointer-events: none; }
.hw-cameo svg { width: 100%; height: auto; display: block; }
.hw-cameo.dance { animation: hwDance 0.9s ease-in-out infinite; }
.hw-cameo.wave { animation: hwWave 2s ease-in-out infinite; transform-origin: bottom center; }
@keyframes hwDance { 0%, 100% { transform: rotate(-10deg) translateY(0); } 50% { transform: rotate(10deg) translateY(-8px); } }
@keyframes hwWave { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(6deg); } }

/* ---------- update briefing ---------- */
.hw-brief { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(24, 12, 44, 0.62); animation: hwFade 0.2s ease; }
.hw-brief.out { opacity: 0; transition: opacity 0.2s ease; }
@keyframes hwFade { from { opacity: 0; } }
.hw-brief-card { width: min(440px, 100%); background: #fff; border-radius: 22px; overflow: hidden; box-shadow: 0 24px 60px rgba(10, 4, 24, 0.45); animation: hwCardIn 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes hwCardIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.hw-brief-art { position: relative; height: 200px; background: var(--hw-night); overflow: hidden; display: grid; place-items: center; }
.hw-brief-body { padding: 18px 22px 6px; min-height: 152px; }
.hw-brief-body h2 { margin: 4px 0 8px; font-family: var(--font-display); font-size: 24px; line-height: 1.1; color: var(--hw-ink); }
.hw-brief-body p { margin: 0; font-size: 15px; line-height: 1.55; color: #5c5070; }
.hw-brief-body p b { color: var(--hw-ink); }
.hw-brief-foot { display: flex; align-items: center; gap: 10px; padding: 16px 22px 20px; }
.hw-dots { display: flex; gap: 6px; margin-right: auto; }
.hw-dots i { width: 8px; height: 8px; border-radius: 50%; background: #e3daf0; }
.hw-dots i.past { background: #c9b6ea; }
.hw-dots i.on { width: 22px; border-radius: 6px; background: var(--hw-pumpkin); }
.hw-skip { border: 0; background: none; font: inherit; font-weight: 800; font-size: 14.5px; color: #8a7aa6; cursor: pointer; padding: 8px 6px; }
.hw-next { width: auto; min-width: 128px; margin: 0; }
.hw-brief .hw-bat { position: absolute; width: 66px; }
.hw-brief .hw-bat.b1 { top: 30px; left: 34px; animation: hwHover 4.2s cubic-bezier(.45,0,.55,1) infinite; }
.hw-b-scene { position: absolute; inset: 0; }
.hw-b-scene .hw-haunt-layer .hw-moon { width: 64px; max-width: none; top: 16px; right: 26px; }
.hw-b-fish { position: absolute; left: 50%; top: 48%; width: 150px; transform: translate(-50%, -50%); }
.hw-b-fish svg { width: 100%; height: auto; display: block; }
.hw-b-quests { display: grid; gap: 8px; width: 82%; }
.hw-b-q { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--hw-night-2); color: #fff; font-weight: 700; font-size: 13.5px; }
.hw-b-q b { color: var(--hw-bone); font-family: var(--font-display); }
.hw-b-items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 88%; }
.hw-b-items span { background: var(--hw-night-2); border-radius: 14px; padding: 6px; }
.hw-b-items span.locked { outline: 2px dashed #8b6fc4; outline-offset: -4px; }
.hw-b-items svg { width: 100%; height: auto; display: block; }
.hw-b-gift { position: relative; width: 100%; height: 100%; }
.hw-b-gift .hw-b-fish { left: 42%; }
.hw-b-plus { position: absolute; right: 13%; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 800; font-size: 26px; color: var(--hw-bone); }
.hw-b-mash { display: flex; align-items: center; gap: 18px; width: 80%; }
.hw-b-meter { flex: 1; display: grid; gap: 8px; }
.hw-b-meter .hw-q-bar { height: 14px; background: var(--hw-night-3); }
.hw-b-meter .hw-q-bar b { background: var(--hw-slime); }
.hw-b-meter span { color: #d9cdef; font-weight: 800; font-size: 13px; }
.hw-b-switch { display: flex; align-items: center; gap: 14px; background: #fff; padding: 14px 18px; border-radius: 14px; font-weight: 800; color: var(--hw-ink); }

@media (prefers-reduced-motion: reduce) {
  .hw-hub *, .hw-brief *, .hw-sky *, .hw-path-decor *, .fish-mascot, .fish-mascot *, .hw-bar-spider, .hw-cameo { animation: none !important; }
  .hw-sky { display: none; }
}
@media (max-width: 520px) {
  .hw-hero { grid-template-columns: 86px 1fr; padding: 18px 16px 14px; }
  .hw-hero h2 { font-size: 23px; }
  .hw-hero-text { padding-right: 0; }
  .hw-hero-sky .hw-moon { width: 44px; }
  .hw-bank { flex-wrap: wrap; }
  .hw-shop-btn { margin-left: 0; width: 100%; }
}

/* ---------- spooky theme: the learning path at dusk ---------- */
.hw-dusk { position: absolute; inset: 0; z-index: 0; pointer-events: none; background: rgba(72, 34, 120, 0.28); mix-blend-mode: multiply; }
.hw-spooky .unit-bar { background: var(--hw-night) !important; border-color: var(--hw-night-2) !important; }
.hw-spooky .unit-bar .ub-eyebrow { color: var(--hw-pumpkin) !important; }
.hw-spooky .unit-bar .ub-title { color: #fff !important; }
.hw-spooky .unit-bar .ub-sub { color: #d9cdef !important; }
.hw-spooky .unit-bar .ub-prog { background: var(--hw-night-3) !important; }
.hw-spooky .unit-bar .ub-prog-fill { background: var(--hw-pumpkin) !important; }
.hw-prop.grave svg { width: 40px; height: 44px; }
.hw-spooky .unit-bar .hw-bar-spider ellipse, .hw-spooky .unit-bar .hw-bar-spider path { fill: none; }
.hw-spooky .unit-bar .hw-bar-spider ellipse { fill: #e9def9; }
.hw-spooky .unit-bar .hw-bar-spider g { stroke: #e9def9; }
.hw-spooky .unit-bar .hw-bar-spider line { stroke: #b9a8d6; }
.hw-spooky .unit-bar .hw-bar-spider circle { fill: var(--hw-night); }
.hw-bank-n b, .hw-shop-bal b { color: var(--hw-bone); font-weight: 800; }
.hw-shop-head > div > b { color: #fff; }

/* ---------- bats: real wing beats, rare smooth flights ---------- */
.hw-bat { display: block; overflow: visible; }
.hw-bat .wl { transform-origin: 29px 21px; animation: hwWingL 0.36s cubic-bezier(.45,0,.55,1) infinite; }
.hw-bat .wr { transform-origin: 35px 21px; animation: hwWingR 0.36s cubic-bezier(.45,0,.55,1) infinite; }
@keyframes hwWingL { 0%, 100% { transform: rotate(24deg); } 50% { transform: rotate(-16deg) scaleY(0.72); } }
@keyframes hwWingR { 0%, 100% { transform: rotate(-24deg); } 50% { transform: rotate(16deg) scaleY(0.72); } }
.hw-flyer { position: fixed; left: 0; top: 0; z-index: 70; width: 76px; pointer-events: none; will-change: transform; filter: drop-shadow(0 0 1.2px rgba(255, 255, 255, 0.85)) drop-shadow(0 6px 6px rgba(20, 8, 40, 0.25)); }
.hw-burst { position: fixed; left: 0; top: 0; z-index: 60; width: 56px; pointer-events: none; will-change: transform; }
@media (prefers-reduced-motion: reduce) { .hw-bat .wl, .hw-bat .wr { animation: none; } .hw-flyer, .hw-burst { display: none; } }

/* Bat Swarm extra: wings pivot at the shoulder of each mini bat */
.x-bats .mb-wl, .x-bats .mb-wr { transform-box: fill-box; animation-duration: 0.36s; animation-timing-function: cubic-bezier(.45,0,.55,1); animation-iteration-count: infinite; }
.x-bats .mb-wl { transform-origin: 100% 45%; animation-name: hwWingL; }
.x-bats .mb-wr { transform-origin: 0% 45%; animation-name: hwWingR; }
.x-bats g:nth-child(2) .mb-wl, .x-bats g:nth-child(2) .mb-wr { animation-delay: -0.17s; }
/* Ghost Fish: a soft cold glow */
.fish-mascot.sp-ghost .fish-body { opacity: 0.94; filter: drop-shadow(0 0 2.5px rgba(186, 200, 255, 0.95)); }
@media (prefers-reduced-motion: reduce) { .x-bats .mb-wl, .x-bats .mb-wr { animation: none; } }


/* ---------- spooky mode: twilight, not midnight ----------
   A middle ground: the page goes a soft dusky lavender, the nav stays white,
   the sidebar takes a light lavender tint, and the purple unit banner is the
   one strong Halloween accent. Game screens keep light, readable surfaces. */
body.hw-spooky, body.hw-spooky.has-biome-theme { background: #e6dff3; }
body.hw-spooky .page-sea .sea-ray, body.hw-spooky .page-sea .sea-caustics { display: none; }
body.hw-spooky .page-sea .sea-fish { color: rgba(88, 62, 140, 0.13); }
body.hw-spooky .hw-corner { color: rgba(88, 62, 140, 0.32); }
body.hw-spooky .quiz-screen, body.hw-spooky .quiz-top, body.hw-spooky .complete-screen { background: #fbf9ff; }
body.hw-spooky .quiz-footer:not(.has-result) { background: #fbf9ff; }
body.hw-spooky .hw-dusk { background: rgba(72, 34, 120, 0.24); }
@media (min-width: 900px) {
  body.hw-spooky .bottomnav { background: rgba(250, 247, 255, 0.92); border-right-color: #ddd2ef; }
  body.hw-spooky .navbtn:hover { background: #efe8fa; }
  body.hw-spooky .navbtn.active { background: #fff1e2; color: #c45f0c; box-shadow: inset 0 0 0 2px #ffc98f; }
  body.hw-spooky .navbtn.active .icon { color: #ff8a1f; }
  body.hw-spooky .rail-widget { background: #fff; }
  body.hw-spooky #app > *:not(.bottomnav):not(.ring-trans):not(.fab-new) { border-inline-color: #d9cdee; }
  body.hw-spooky #app > *:not(.bottomnav):not(.ring-trans):first-child { border-top-color: #d9cdee; }
  body.hw-spooky #app > *:not(.bottomnav):not(.ring-trans):not(.fab-new):not(:has(~ *:not(.bottomnav):not(.ring-trans):not(.fab-new))) { border-bottom-color: #d9cdee; }
}
