/* Shellby — bug battles (bugdex-battle.js). A little handheld screen under
   the sea: each habitat paints its own water, the two of them on their rocks,
   the HUDs, the text box, and every hit, flash and jar as an effect on top.
   Pixel art throughout, crisp edges, with scanlines over the lot. Tokens come
   from panel.css. */

/* ---------------------------------------------------------------- the chip under the tabs */
.bb-chip {
  display: inline-flex; align-items: center; gap: 5px; position: relative;
  flex: none; height: 22px; padding: 0 7px 0 3px; margin-left: 2px; border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--coral) 50%, var(--line)); background: color-mix(in srgb, var(--coral) 10%, var(--reef));
  color: var(--sand); font: 600 var(--fs-10-5) var(--font-pixel); cursor: pointer;
}
.bb-chip:hover, .bb-chip:focus-visible { background: color-mix(in srgb, var(--coral) 20%, var(--reef)); }
.bb-chip.rank-boss, .bb-chip.rank-elite { border-color: color-mix(in srgb, var(--amber) 65%, var(--line)); }
.bb-chip.rank-champion { border-color: #ffd23f; box-shadow: 0 0 8px rgba(255, 210, 63, .35); }
.bb-chip.over-caught { border-color: color-mix(in srgb, #57cc99 60%, var(--line)); background: color-mix(in srgb, #57cc99 12%, var(--reef)); }
.bb-chip-art { display: grid; place-items: center; width: 18px; height: 18px; }
.bb-chip-art svg { image-rendering: pixelated; animation: bb-bob 1.6s steps(2, end) infinite; }
.bb-chip-hp { width: 34px; height: 5px; border-radius: 2px; background: #0b1416; box-shadow: inset 0 0 0 1px #2b4650; overflow: hidden; }
.bb-chip-hp i { display: block; height: 100%; background: var(--hp, #57cc99); transition: width .5s steps(10, end); }
.bb-chip-hp.mid { --hp: #ffc15e; }
.bb-chip-hp.low { --hp: #ff5c5c; }
.bb-chip-alert {
  position: absolute; top: -9px; right: -3px; width: 13px; height: 13px; display: grid; place-items: center;
  border-radius: 3px; background: #ff5c5c; color: #fff; font: 700 9px/1 var(--font-pixel);
  animation: bb-alert .9s steps(2, end) infinite;
}
@keyframes bb-alert { 50% { transform: translateY(-2px); } }
@keyframes bb-bob { 50% { transform: translateY(-1px); } }

/* ---------------------------------------------------------------- the overlay and its bezel */
.bb-overlay {
  position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 12px;
  background: radial-gradient(80% 60% at 50% 40%, rgba(7, 16, 18, .72), rgba(3, 7, 8, .92));
  animation: fadein .18s var(--ease-out);
}
.bb-frame {
  width: min(100%, 560px); max-height: 100%; overflow-y: auto; display: grid; gap: 8px; padding: 10px 12px 12px;
  border-radius: 18px 18px 26px 18px;
  background: linear-gradient(160deg, #24414b, #132a31 55%, #0e2026);
  box-shadow: 0 0 0 2px #0a1518, inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 -3px 0 rgba(0, 0, 0, .35), 0 18px 40px rgba(0, 0, 0, .5);
}
.bb-head { display: flex; align-items: center; gap: 10px; padding: 0 2px; }
.bb-title { font: 700 var(--fs-12) var(--font-pixel); letter-spacing: .14em; color: #7fd6c2; text-shadow: 0 0 6px rgba(127, 214, 194, .45); }
.bb-where { flex: 1; min-width: 0; font-size: var(--fs-11-5); color: var(--sand-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-close { margin-left: auto; }
.bb-foot { display: flex; gap: 6px; justify-content: flex-end; }
.bb-log-box summary { cursor: pointer; font-size: var(--fs-11-5); color: var(--sand-faint); }
.bb-log { margin: 6px 0 0; padding: 0 0 0 18px; max-height: 140px; overflow-y: auto; font-size: var(--fs-12); color: var(--sand-dim); display: grid; gap: 2px; }

/* ---------------------------------------------------------------- the screen */
.bb-screen {
  --w1: #0d4a63; --w2: #062433; --pad1: #c9b38a; --pad2: #8d7656; --glow: rgba(142, 202, 230, .35); --decor: rgba(255, 255, 255, .12);
  position: relative; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 6px;
  box-shadow: 0 0 0 3px #050b0c, inset 0 0 30px rgba(0, 0, 0, .55);
  font-family: var(--font-pixel); image-rendering: pixelated; isolation: isolate;
}
.bb-screen svg { image-rendering: pixelated; shape-rendering: crispEdges; }
.bb-water { position: absolute; inset: 0; z-index: -3; background: linear-gradient(var(--w1), var(--w2)); }
.bb-water::after { /* light from above */
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(70% 45% at 35% -5%, var(--glow), transparent 70%);
}
.bb-caustics {
  position: absolute; inset: -20%; z-index: -2; opacity: .18; mix-blend-mode: screen;
  background:
    radial-gradient(closest-side, rgba(255, 255, 255, .7), transparent) 0 0 / 46px 30px,
    radial-gradient(closest-side, rgba(255, 255, 255, .5), transparent) 23px 15px / 46px 30px;
  animation: bb-caustics 14s linear infinite;
}
@keyframes bb-caustics { to { transform: translate(46px, 30px) rotate(.5deg); } }
.bb-scan {
  position: absolute; inset: 0; z-index: 20; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .14) 0 1px, transparent 1px 3px);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .35);
}

/* bubbles going up */
.bb-bubbles { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.bb-bubbles i {
  position: absolute; bottom: -10px; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .08);
  animation: bb-bubble calc(5s + var(--i) * .7s) linear calc(var(--i) * -1.3s) infinite;
}
@keyframes bb-bubble { 50% { transform: translate(5px, -200px); } to { transform: translate(-3px, -420px); opacity: 0; } }

/* the seabed they share, and a rock under each */
.bb-water::before { content: ''; position: absolute; left: 0; right: 0; bottom: 22%; height: 16%; background: linear-gradient(transparent, color-mix(in srgb, var(--pad2) 55%, transparent) 40%, var(--pad2)); }
.bb-pad { position: absolute; z-index: 0; border-radius: 50%; background: radial-gradient(closest-side, var(--pad1), var(--pad2) 75%, transparent 76%); }
.bb-pad::after { content: ''; position: absolute; inset: 18% 12% auto; height: 22%; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.foe-pad { right: 5%; bottom: 25%; width: 38%; height: 11%; }
.me-pad { left: 5%; bottom: 25%; width: 38%; height: 11%; }

/* the two of them */
.bb-foe { position: absolute; z-index: 2; right: 10%; bottom: 29%; width: 28%; height: 34%; display: grid; place-items: end center; }
.bb-foe-art { display: grid; place-items: center; animation: bb-idle 2.2s steps(2, end) infinite; }
.bb-foe-art svg { width: 100%; height: auto; max-width: 128px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .3)); }
.bb-foe.low .bb-foe-art { animation-duration: .7s; }
.bb-me { position: absolute; z-index: 3; left: 10%; bottom: 28%; width: 26%; height: 36%; display: grid; place-items: end center; }
.bb-me-art { width: 100%; display: grid; place-items: end center; }
.bb-crab { width: 100%; height: auto; max-height: 100%; animation: bb-breathe 2.6s steps(2, end) infinite; }
.bb-shadow { position: absolute; bottom: -3%; left: 22%; right: 22%; height: 10%; border-radius: 50%; background: rgba(0, 0, 0, .28); }
@keyframes bb-idle { 50% { transform: translateY(-3px); } }
@keyframes bb-breathe { 50% { transform: translateY(1px) scaleY(.98); } }

/* ---------------------------------------------------------------- HUDs */
.bb-hud {
  position: absolute; z-index: 5; top: 4%; display: grid; gap: 2px; padding: 5px 9px 6px; width: 44%; box-sizing: border-box;
  background: linear-gradient(#f8f1de, #e7dcc2); color: #26323a;
  border: 2px solid #26323a; box-shadow: 3px 3px 0 rgba(0, 0, 0, .35);
}
.bb-hud.foe { right: 4%; border-radius: 3px; }
.bb-hud.me { left: 4%; border-radius: 3px; }
.bb-hud-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bb-name { font-size: var(--fs-12-5); letter-spacing: .04em; }
.bb-lv { font-size: var(--fs-11); }
.bb-no { font-size: var(--fs-10); opacity: .6; }
.bb-trainer { font-size: var(--fs-10); opacity: .75; }
.bb-type {
  font: 700 var(--fs-9-5)/14px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; padding: 0 6px; border-radius: 3px;
  color: #fff; background: var(--type, #888); text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
}
.bb-rank {
  position: absolute; top: -9px; right: 8px; padding: 0 6px; border-radius: 3px; font: 700 var(--fs-9-5)/14px var(--font-pixel); letter-spacing: .1em;
  color: #26323a; background: var(--amber); border: 2px solid #26323a;
}
.bb-rank.champion { background: linear-gradient(90deg, #ffd23f, #fff1a8, #ffd23f); background-size: 200% 100%; animation: bb-shine 2s linear infinite; }
@keyframes bb-shine { to { background-position: -200% 0; } }
.bb-hp { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.bb-hp-label { font: 700 var(--fs-9-5) var(--font-pixel); color: #e9a23b; background: #26323a; padding: 0 3px; border-radius: 2px; }
.bb-hp-track { flex: 1; height: 7px; border-radius: 3px; background: #46525a; box-shadow: inset 0 0 0 1px #26323a; overflow: hidden; }
.bb-hp-fill { display: block; height: 100%; width: 100%; background: var(--hp); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35); }
.bb-hp-fill.high { --hp: #3ccf6e; }
.bb-hp-fill.mid { --hp: #f5b82e; }
.bb-hp-fill.low { --hp: #ef4b4b; animation: bb-low .5s steps(2, end) infinite; }
@keyframes bb-low { 50% { filter: brightness(1.4); } }
.bb-party { display: flex; gap: 3px; margin-top: 2px; }
.bb-hud.me .bb-trainer { align-self: center; }
.bb-slot { width: 16px; height: 13px; display: grid; place-items: center; }
.bb-slot svg { width: 16px; height: auto; }
.bb-slot.empty { border-radius: 50%; width: 9px; height: 9px; margin: 2px 3px; border: 1.5px solid rgba(38, 50, 58, .35); }

/* ---------------------------------------------------------------- the text box */
.bb-text {
  position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; height: 24%; padding: 8px 14px;
  background: linear-gradient(#24414b, #17303a); border-top: 3px solid #050b0c;
  box-shadow: inset 0 0 0 2px #7fd6c2, inset 0 0 0 4px #17303a, inset 0 0 0 5px #e7dcc2;
  color: #fdfaf2; font-size: clamp(11px, 3.1cqw, 15px); line-height: 1.35; text-shadow: 1px 1px 0 #050b0c;
}
.bb-screen { container-type: inline-size; }
.bb-text-line { margin: 0; padding-right: 14px; }
.bb-caret { position: absolute; right: 12px; bottom: 8px; font-size: 9px; color: var(--coral); animation: bb-caret .8s steps(2, end) infinite; }
@keyframes bb-caret { 50% { transform: translateY(2px); } }

/* ---------------------------------------------------------------- the intro */
.bb-blinds { position: absolute; inset: 0; z-index: 30; display: grid; grid-template-columns: repeat(8, 1fr); pointer-events: none; overflow: hidden; }
.bb-blinds i { display: block; background: #050b0c; border-radius: 40% 40% 0 0; transform: translateY(101%); }
.rank-boss .bb-blinds i, .rank-elite .bb-blinds i { background: #3b0d0d; }
.rank-champion .bb-blinds i { background: #3b2d05; }
.bb-warning {
  position: absolute; left: 0; right: 0; top: 38%; height: 20%; display: grid; place-items: center; z-index: 15;
  background: repeating-linear-gradient(-45deg, #26323a 0 10px, #ffc15e 10px 20px); border-block: 3px solid #050b0c;
}
.bb-warning span { padding: 2px 12px; background: #050b0c; color: #ffc15e; font: 700 clamp(12px, 4cqw, 18px) var(--font-pixel); letter-spacing: .14em; }
.bb-warning.champion { background: repeating-linear-gradient(-45deg, #3b2d05 0 10px, #ffd23f 10px 20px); }
.bb-warning.champion span { color: #ffd23f; }

/* ---------------------------------------------------------------- effects */
.bb-fx { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.bb-fx .bb-reg, .bb-fx .bb-reg * { pointer-events: auto; }
.bb-bit { position: absolute; display: block; }
.bb-flash { position: absolute; inset: 0; mix-blend-mode: screen; }
.bb-spark { width: 4px; height: 4px; box-shadow: 0 0 4px currentColor; }
.bb-spark.heal { background: #80ed99; width: 3px; height: 6px; }
.bb-shot { width: 5px; height: 5px; border-radius: 1px; }
.bb-slash { width: 46px; height: 3px; background: #fff; box-shadow: 0 0 6px #fff, 0 0 12px rgba(255, 255, 255, .6); }
.bb-lens svg { filter: drop-shadow(0 0 4px rgba(191, 233, 255, .8)); }
.bb-shield {
  border: 2px solid #9fd3ff; background: radial-gradient(closest-side, rgba(159, 211, 255, .05), rgba(159, 211, 255, .3));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.bb-dust { width: 10px; height: 10px; border-radius: 50%; background: rgba(243, 230, 204, .55); }
.bb-float { font: 700 clamp(11px, 3.4cqw, 16px) var(--font-pixel); color: #fff; text-shadow: 1px 1px 0 #050b0c, -1px -1px 0 #050b0c, 1px -1px 0 #050b0c, -1px 1px 0 #050b0c; white-space: nowrap; transform: translate(-50%, 0); }
.bb-float.dmg { color: #ffe066; }
.bb-float.dmg.big { color: #ff7a5c; font-size: clamp(14px, 4.6cqw, 22px); }
.bb-float.miss { color: #cfd8dc; }
.bb-float.heal { color: #80ed99; }
.bb-float.resist { color: #9fd3ff; }
.bb-float.scout { color: #8ecae6; font-size: clamp(16px, 5cqw, 24px); }
.bb-float.think { color: #bfe9ff; }
.bb-star { color: #ffd23f; font-size: 14px; text-shadow: 0 0 6px #ffd23f; }
.bb-line { width: 1px; top: 0; background: linear-gradient(rgba(255, 255, 255, .25), rgba(255, 255, 255, .7)); transform: translateX(-50%); }
.bb-confetti { width: 4px; height: 6px; }
.bb-jar { position: absolute; transform: translate(-50%, -50%); filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)); }
.bb-jar.sealed svg { animation: bb-glint 1.2s steps(3, end) 2; }
@keyframes bb-glint { 50% { filter: brightness(1.6); } }

/* a crew member, in to help */
.bb-helper { position: absolute; z-index: 4; left: 33%; bottom: 29%; width: 16%; display: grid; justify-items: center; gap: 2px; }
.bb-helper svg { width: 100%; height: auto; }
.bb-helper-tag { padding: 0 5px; border-radius: 3px; background: #26323a; color: #fdfaf2; font-size: var(--fs-9-5); white-space: nowrap; }

/* the page entry / badge card */
.bb-reg {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 12;
  width: min(78%, 300px); display: grid; justify-items: center; gap: 4px; padding: 12px 14px 10px; text-align: center;
  background: linear-gradient(#f8f1de, #e7dcc2); color: #26323a; border: 3px solid #26323a; border-radius: 6px; box-shadow: 4px 4px 0 rgba(0, 0, 0, .4);
}
.bb-reg p { margin: 0; }
.bb-reg-eyebrow { font-size: var(--fs-10); letter-spacing: .16em; color: #b5651d; }
.bb-reg.badge .bb-reg-eyebrow, .bb-reg.fame .bb-reg-eyebrow { color: #a07800; }
.bb-reg-art, .bb-reg-badge { display: grid; place-items: center; min-height: 64px; perspective: 300px; }
.bb-reg-badge svg { filter: drop-shadow(0 0 8px rgba(255, 210, 63, .7)); }
.bb-reg-name { font-size: var(--fs-14); }
.bb-reg-sub { font: 400 var(--fs-11-5) var(--font-body, inherit); color: #4b5961; }
.bb-reg-forms { font-size: var(--fs-11); }
.bb-reg-actions { display: flex; gap: 6px; margin-top: 4px; }
.bb-reg .btn.ghost { color: #26323a; border-color: rgba(38, 50, 58, .45); background: rgba(255, 255, 255, .4); }
.bb-reg .btn.ghost:hover, .bb-reg .btn.ghost:focus-visible { background: rgba(255, 255, 255, .75); }
.bb-reg.fame { background: linear-gradient(#fff6d6, #f1dc93); }

/* ---------------------------------------------------------------- habitats: each paints its own water */
.hab-shallows { --w1: #2a9fc4; --w2: #0f5672; --pad1: #f3e6cc; --pad2: #cdb68c; --glow: rgba(255, 244, 214, .55); }
.hab-shallows .bb-caustics { opacity: .3; }
.hab-burrows { --w1: #4d3a2c; --w2: #1f160f; --pad1: #a1887f; --pad2: #6d4c41; --glow: rgba(255, 210, 160, .22); }
.hab-burrows .bb-decor i { width: 14%; height: 9%; border-radius: 50%; background: #120c08; box-shadow: inset 0 3px 0 rgba(0, 0, 0, .5); top: calc(12% + var(--i) * 11%); left: mod(calc(4% + var(--i) * 29%), 88%); }
.hab-currents { --w1: #1b5e9a; --w2: #0a2647; --pad1: #b8c2d1; --pad2: #6b7a90; }
.hab-currents .bb-decor i { height: 2px; width: 30%; background: linear-gradient(90deg, transparent, rgba(202, 240, 248, .5), transparent); top: calc(8% + var(--i) * 11%); animation: bb-current calc(2.4s + var(--i) * .3s) linear calc(var(--i) * -.6s) infinite; }
@keyframes bb-current { from { left: -35%; } to { left: 105%; } }
.hab-nets { --w1: #2c5f6e; --w2: #10303a; --pad1: #d4a373; --pad2: #8c6239; }
.hab-nets .bb-decor { background: repeating-linear-gradient(45deg, transparent 0 13px, rgba(255, 214, 165, .16) 13px 15px), repeating-linear-gradient(-45deg, transparent 0 13px, rgba(255, 214, 165, .16) 13px 15px); animation: bb-sway 6s ease-in-out infinite; }
.hab-lighthouse { --w1: #0b1d3a; --w2: #040b18; --pad1: #6b7a90; --pad2: #2f3b4c; --glow: rgba(255, 230, 109, .15); }
.hab-lighthouse .bb-decor::before { content: ''; position: absolute; left: 6%; top: -40%; width: 160%; height: 70%; transform-origin: 0 50%; background: conic-gradient(from 75deg at 0 50%, transparent 0deg, rgba(255, 230, 109, .34) 14deg, transparent 32deg); animation: bb-beam 6s linear infinite; }
.hab-lighthouse .bb-decor i { width: 2px; height: 2px; background: #fff; top: calc(4% + (var(--i) * 7%)); left: mod(calc(3% + var(--i) * 37%), 95%); animation: bb-twinkle 1.6s steps(2, end) calc(var(--i) * .3s) infinite; }
@keyframes bb-beam { from { transform: rotate(-30deg); } 50% { transform: rotate(30deg); } to { transform: rotate(-30deg); } }
@keyframes bb-twinkle { 50% { opacity: .2; } }
.hab-workshop { --w1: #7a3e14; --w2: #2c1505; --pad1: #adb5bd; --pad2: #5c6670; --glow: rgba(255, 159, 28, .35); }
.hab-workshop .bb-decor i:nth-child(-n+3) { width: 22%; aspect-ratio: 1; border-radius: 50%; border: 3px dashed rgba(255, 196, 120, .18); top: calc(var(--i) * 18%); left: calc(10% + var(--i) * 28%); animation: bb-gear 9s linear infinite; }
@keyframes bb-gear { to { transform: rotate(360deg); } }
.hab-kelp { --w1: #1d5e4a; --w2: #082b20; --pad1: #6a994e; --pad2: #386641; --glow: rgba(128, 237, 153, .25); }
.hab-kelp .bb-decor i { bottom: 20%; width: 4%; height: calc(40% + var(--i) * 6%); left: calc(2% + var(--i) * 14%); border-radius: 40% 40% 0 0; background: linear-gradient(#80ed99, #2a9d8f); opacity: .35; transform-origin: bottom; animation: bb-kelp calc(3s + var(--i) * .4s) ease-in-out calc(var(--i) * -.5s) infinite; }
@keyframes bb-kelp { 50% { transform: rotate(6deg) skewX(4deg); } }
.hab-pypool { --w1: #3f7d3a; --w2: #1a3a17; --pad1: #e9d985; --pad2: #b5a642; --glow: rgba(255, 212, 59, .3); }
.hab-pypool .bb-decor i:nth-child(-n+3) { width: 20%; aspect-ratio: 2; border-radius: 50%; border: 2px solid rgba(255, 212, 59, .35); top: calc(10% + var(--i) * 12%); left: calc(8% + var(--i) * 22%); animation: bb-ripple 3s ease-out calc(var(--i) * 1s) infinite; }
@keyframes bb-ripple { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.hab-trench { --w1: #10071f; --w2: #020006; --pad1: #3c2a5a; --pad2: #1a1030; --glow: rgba(157, 78, 221, .2); }
.hab-trench .bb-caustics { opacity: .04; }
.hab-trench .bb-decor i { width: 3px; height: 3px; border-radius: 50%; background: #c77dff; box-shadow: 0 0 6px #c77dff; top: calc(10% + var(--i) * 10%); left: mod(calc(5% + var(--i) * 41%), 92%); animation: bb-mote calc(4s + var(--i) * .6s) ease-in-out calc(var(--i) * -.7s) infinite; }
@keyframes bb-mote { 50% { transform: translate(8px, -10px); opacity: .3; } }
.hab-proving { --w1: #2b2350; --w2: #120d26; --pad1: #90be6d; --pad2: #4f772d; --glow: rgba(144, 190, 109, .25); }
.hab-proving .bb-decor i:nth-child(-n+4) { bottom: 22%; width: 6%; height: 34%; left: calc(4% + var(--i) * 9%); border: 2px solid rgba(216, 243, 220, .3); border-top: 0; border-radius: 0 0 8px 8px; background: linear-gradient(transparent 40%, rgba(144, 190, 109, .35) 40%); }
.hab-vault { --w1: #1d3b44; --w2: #0a1a1f; --pad1: #8d99ae; --pad2: #4a5568; --glow: rgba(255, 193, 94, .18); }
.hab-vault .bb-decor { background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(0, 0, 0, .25) 22px 26px); }
.hab-vault .bb-decor::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 40%, rgba(255, 241, 168, .12) 50%, transparent 60%); background-size: 300% 100%; animation: bb-shine 5s linear infinite; }
.hab-wreck { --w1: #12302a; --w2: #050f0d; --pad1: #4a5e57; --pad2: #22302c; --glow: rgba(184, 255, 217, .2); }
.hab-wreck .bb-decor i { width: 45%; height: 18%; border-radius: 50%; background: rgba(184, 255, 217, .08); filter: blur(6px); top: calc(var(--i) * 13%); animation: bb-fog calc(9s + var(--i) * 1.2s) linear calc(var(--i) * -2s) infinite; }
.hab-wreck .bb-foe-art { animation: bb-idle 2.2s steps(2, end) infinite, bb-flicker 3.2s steps(1, end) infinite; }
@keyframes bb-fog { from { left: -50%; } to { left: 105%; } }
@keyframes bb-flicker { 0%, 92%, 100% { opacity: 1; } 94% { opacity: .4; } 96% { opacity: .9; } 98% { opacity: .3; } }
.hab-none { --w1: #1a1a1a; --w2: #000; --pad1: #777; --pad2: #333; }
.hab-none .bb-water { animation: bb-glitch 1.4s steps(1, end) infinite; }
@keyframes bb-glitch { 0% { filter: hue-rotate(0); } 33% { filter: hue-rotate(120deg); transform: translateX(2px); } 66% { filter: hue-rotate(240deg) invert(.1); transform: translateX(-1px); } }
.bb-decor { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.bb-decor i { position: absolute; display: block; }
@keyframes bb-sway { 50% { transform: translateX(6px) skewX(1deg); } }

/* ---------------------------------------------------------------- the Bugdex page's own pieces */
.bd-loose-hp { display: inline-flex; align-items: center; gap: 5px; font: 600 var(--fs-10) var(--font-pixel); color: var(--sand-faint); }
.bd-loose-hp .bb-chip-hp { width: 54px; }

@media (prefers-reduced-motion: reduce) {
  .bb-overlay, .bb-caustics, .bb-bubbles i, .bb-decor, .bb-decor *, .bb-decor::before, .bb-decor::after, .bb-foe-art, .bb-crab,
  .bb-caret, .bb-chip-art svg, .bb-chip-alert, .bb-hp-fill.low, .bb-rank.champion, .hab-none .bb-water { animation: none !important; }
}
