/* chat-pulse.css — bubble beats with the stream. Consumer of window.__avEngine.
   Snap law: NO transition on transform — JS sets --beat per frame, jumps are instant. */
#chat-toggle.chat-toggle-btn {
  transform: scale(var(--beat, 1));
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  #chat-toggle.chat-toggle-btn { transform: none; }
}
@media (max-width: 768px) {
  #chat-toggle.chat-toggle-btn { transform: scale(calc(var(--beat, 1) * 0.6 + 0.4)); }
}

/* APPENDED 2026-11-14: chat.css owns .chat-toggle-btn with
   transition:transform .25s — that fights the snap law (Rule 45:
   ours is higher specificity + later load, so this wins cleanly). */
#chat-toggle.chat-toggle-btn {
  transition: box-shadow 0.25s ease;
}
/* Hover stacks WITH the beat instead of freezing it. */
#chat-toggle.chat-toggle-btn:hover {
  transform: scale(calc(1.08 * var(--beat, 1))) !important;
}

/* APPENDED 2026-11-14: glow couples to the beat — button flares, not just scales. */
#chat-toggle.chat-toggle-btn {
  box-shadow: 0 0 calc(15px + (var(--beat, 1) - 1) * 120px)
              rgba(var(--site-accent-rgb), calc(0.6 + (var(--beat, 1) - 1) * 2));
}

/* APPENDED 2026-11-14: on hard bass peaks the bubble flares hot.
   --flare snaps 0/1 in JS — color jumps instantly, bamboo law holds. */
#chat-toggle.chat-toggle-btn {
  background: rgb(calc(109 + (var(--flare, 0)) * 146),
                  calc(74  + (var(--flare, 0)) * 111),
                  calc(255 - (var(--flare, 0)) * 150));
  border-color: rgb(calc(109 + (var(--flare, 0)) * 146),
                    calc(74  + (var(--flare, 0)) * 111),
                    calc(255 - (var(--flare, 0)) * 150)) !important;
}

/* APPENDED 2026-11-14: OPERATOR ORDERS — green default, hue rides the music,
   peaks snap to a new color and hold. Size change RETIRED (frozen). */
#chat-toggle.chat-toggle-btn {
  transform: none !important;
  background: hsl(var(--hue, 120) 100% 50%) !important;
  border-color: hsl(var(--hue, 120) 100% 50%) !important;
}

/* APPENDED 2026-11-14: THE POOL - next color blooms from center outward.
   --wash 0..100 = radius of the new color's flood; beyond it, settled color. */
#chat-toggle.chat-toggle-btn {
  background: radial-gradient(circle,
    hsl(var(--hue-next, 120) 100% 50%) calc(var(--wash, 100) * 1%),
    hsl(var(--hue, 120) 100% 50%) calc(var(--wash, 100) * 1% + 1%)) !important;
  border-color: hsl(var(--hue, 120) 100% 50%) !important;
}

/* APPENDED 2026-11-14: THE POOL v4.
   Feathered edge: wash line blends over a 16% band - ink in water, not a lid.
   Brightness pulse: --lum rides the bass, hue stays locked between hits. */
#chat-toggle.chat-toggle-btn {
  background: radial-gradient(circle,
    hsl(var(--hue-next, 120) 100% var(--lum, 50%))
      calc((var(--wash, 120) - 18) * 1%),
    hsl(var(--hue, 120) 100% var(--lum, 50%))
      calc((var(--wash, 120) - 2) * 1%)) !important;
  border-color: hsl(var(--hue, 120) 100% var(--lum, 50%)) !important;
}

/* APPENDED 2026-11-14: THE HEARTBEAT - bubble pops on every kickdrum.
   --kick fires to ~1 on the beat, decays 14% per frame in JS.
   NO transition - attack is instant, decay is frame-stepped. Rhythm visible. */
#chat-toggle.chat-toggle-btn {
  transform: scale(calc(1 + var(--kick, 0) * 0.20)) !important;
}

/* APPENDED 2026-11-14: amplitude honesty - adaptive kicks land full force. */
#chat-toggle.chat-toggle-btn {
  transform: scale(calc(1 + var(--kick, 0) * 0.30)) !important;
}

/* APPENDED 2026-11-14: THE VU ORB. --env 0..1 = current bass energy.
   Size pumps, glow flares, brightness rides - all one needle. Green house. */
#chat-toggle.chat-toggle-btn {
  transform: scale(calc(1 + var(--env, 0) * 0.45)) !important;
  background: hsl(120 100% var(--lum, 45%)) !important;
  border-color: hsl(120 100% var(--lum, 45%)) !important;
  box-shadow: 0 0 calc(15px + var(--env, 0) * 50px)
              rgba(0, 255, 90, calc(0.35 + var(--env, 0) * 0.55)) !important;
}

/* APPENDED 2026-11-14: THE TIDE. --env 0..1 slides the gradient smoothly
   green->teal->cyan as energy rises; envelope makes every move a fade.
   Two-tone radial = liquid depth. transform pinned: size is OUT of the show. */
#chat-toggle.chat-toggle-btn {
  transform: none !important;
  background: radial-gradient(circle at 35% 30%,
    hsl(calc(120 + var(--env, 0) * 110) 95% calc(52% + var(--env, 0) * 12%)) 0%,
    hsl(calc(120 + var(--env, 0) * 110 - 25) 90% calc(40% + var(--env, 0) * 10%)) 100%) !important;
  border-color: hsl(calc(120 + var(--env, 0) * 110) 90% 45%) !important;
  box-shadow: 0 0 calc(15px + var(--env, 0) * 45px)
              hsla(calc(120 + var(--env, 0) * 110), 100%, 55%, calc(0.35 + var(--env, 0) * 0.45)) !important;
}

/* APPENDED 2026-11-14: TIDE v2 - --hue-shift snaps on beat drops,
   then the gradient melts from the new family. Build = patience, drop = payoff. */
#chat-toggle.chat-toggle-btn {
  transform: none !important;
  background: radial-gradient(circle at 35% 30%,
    hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 110) 95% calc(52% + var(--env, 0) * 12%)) 0%,
    hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 110 - 25) 90% calc(40% + var(--env, 0) * 10%)) 100%) !important;
  border-color: hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 110) 90% 45%) !important;
  box-shadow: 0 0 calc(15px + var(--env, 0) * 45px)
              hsla(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 110), 100%, 55%, calc(0.35 + var(--env, 0) * 0.45)) !important;
}

/* APPENDED 2026-11-14: TIDE, TURNED UP. Hue travels 90deg farther,
   lightness swings wider, halo stronger. Same smooth law, bigger show. */
#chat-toggle.chat-toggle-btn {
  transform: none !important;
  background: radial-gradient(circle at 35% 30%,
    hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200) 100% 55%) 0%,
    hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200 - 30) 95% 38%) 100%) !important;
  border-color: hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200) 95% 48%) !important;
  box-shadow: 0 0 30px
              hsla(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200), 100%, 55%, 0.55) !important;
}

/* appended: hero title joins the band - same root vars as the bubble
   (one truth chain, Rule 43). Rests green, snaps with the bass peaks. */
h1.glitch-text,
h1.glitch-text::before,
h1.glitch-text::after {
  color: hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200)
             100% calc(58% + var(--env, 0) * 12%)) !important;
  text-shadow: 0 0 calc(10px + var(--env, 0) * 40px)
               hsla(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200),
                    100%, 55%, calc(0.3 + var(--env, 0) * 0.5)) !important;
}

/* appended: title dance v2 - the ORIGINAL triple-ring terminal glow
   (10/20/40px per style.css:384) rebuilt in band colors. Rings swell
   with --env, hue rides --hue-shift, snaps with the bubble (Rule 43).
   Flicker (opacity keyframes) is untouched and compatible. Outranks
   the earlier single-ring title block by load order. */
h1.glitch-text {
  color: hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200)
             100% calc(58% + var(--env, 0) * 12%)) !important;
  text-shadow:
    0 0 calc(10px + var(--env, 0) * 8px)
      hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200) 100% 55%),
    0 0 calc(20px + var(--env, 0) * 15px)
      hsla(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200),
           100%, 55%, calc(0.8 + var(--env, 0) * 0.2)),
    0 0 calc(40px + var(--env, 0) * 30px)
      hsla(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200),
           100%, 55%, calc(0.5 + var(--env, 0) * 0.4)) !important;
}

/* appended: notification FAB joins the band - color + glow ONLY.
   Law: NO transform/size/spacing (FAB spacing hunt is settled law).
   ID+class specificity outranks notifications.css despite its late
   dynamic load (Rule 45). One !important per declaration, at the end. */
#notification-bubble.nb-fab {
  background: hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200)
                   100% calc(58% + var(--env, 0) * 12%)) !important;
  border-color: hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200)
                     100% 55%) !important;
  box-shadow: 0 0 calc(15px + var(--env, 0) * 45px)
              hsla(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200),
                   100%, 55%, calc(0.35 + var(--env, 0) * 0.45)) !important;
}

/* appended: title retires from the color ride - theme color only,
   triple-ring glow stays env-driven. Uses --site-accent so it follows
   whatever mix theme script.js paints. Tagline glows too, same law.
   Outranks the two earlier title blocks by load order (Rule 45). */
h1.glitch-text {
  color: var(--site-accent) !important;
  text-shadow:
    0 0 calc(10px + var(--env, 0) * 8px) rgba(var(--site-accent-rgb), 0.9),
    0 0 calc(20px + var(--env, 0) * 15px) rgba(var(--site-accent-rgb), 0.7),
    0 0 calc(40px + var(--env, 0) * 30px) rgba(var(--site-accent-rgb), 0.45) !important;
}
.tagline {
  color: var(--site-accent) !important;
  text-shadow:
    0 0 calc(8px + var(--env, 0) * 10px) rgba(var(--site-accent-rgb), 0.85),
    0 0 calc(24px + var(--env, 0) * 26px) rgba(var(--site-accent-rgb), 0.40) !important;
}

/* appended: bg-slideshow toggle melts color between pictures.
   Reads --slide-hue (bumped per slide by BackgroundSlideshow.nextSlide).
   2.5s transition = the slow fade. pulse-glow-orange retired here -
   animation would freeze the background and kill the melt (Rule 45). */
.bg-slideshow-toggle.active {
  background: hsl(var(--slide-hue, 35) 100% 50%) !important;
  border-color: hsl(var(--slide-hue, 35) 100% 50%) !important;
  color: #000 !important;
  transition: background 6s ease, border-color 6s ease,
              box-shadow 6s ease !important;
  animation: none !important;
  box-shadow: 0 0 calc(18px + var(--env, 0) * 30px)
              hsla(var(--slide-hue, 35), 100%, 50%,
                   calc(0.45 + var(--env, 0) * 0.35)) !important;
}

/* ===== chatmobile-20261115: small screens - pinned strip stacks, tabs scroll, input breathes ===== */
@media (max-width: 600px) {
  .pinned-strip {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
  }
  .pinned-item {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .tab-btn {
    flex: 0 0 auto !important;
    min-width: auto !important;
  }
  .chat-input-form {
    flex-wrap: wrap;
    gap: 6px;
  }
  .chat-input-form #chat-name-input {
    flex: 1 1 38%;
    min-width: 0;
  }
  .chat-input-form #public-msg-input {
    flex: 1 1 100%;
    min-width: 0;
  }
  .chat-input-form button {
    flex: 1 1 100%;
  }
}

/* ===== chatmobile2-20261115: pinned strip compact on mobile - messages get the room ===== */
@media (max-width: 600px) {
  .pinned-strip {
    max-height: 96px !important;
    overflow-y: auto !important;
    padding: 4px 0.75rem !important;
    gap: 4px !important;
  }
  .pinned-item {
    padding: 4px 8px !important;
    font-size: 0.8rem !important;
  }
}

/* ===== chatmobile3-20261115: taller panel on mobile, slim gaps all around ===== */
@media (max-width: 600px) {
  /* popmax-002 (2026-11-17): this block formerly capped the popup at
     92dvh + 12px margins (!important), outranking popmax-001 below 600px.
     Rehabilitated to full-bleed to match the <=768px popmax law. */
  .chat-container {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
  .chat-layer {
    padding: 0;
    box-sizing: border-box;
  }
}

/* ===== chatmobile4-20261115: header discipline on mobile - title one line, status group claimed, tabs slim ===== */
@media (max-width: 600px) {
  .chat-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
    padding: 0.75rem 3rem 0.75rem 1rem !important;
  }
  .chat-header h3 {
    white-space: nowrap !important;
    font-size: 1.15rem !important;
    letter-spacing: 1px !important;
  }
  .chat-status-group {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    white-space: nowrap !important;
  }
  .chat-status {
    font-size: 0.75rem !important;
  }
  .dj-online-chip {
    font-size: 0.75rem !important;
  }
  .tab-btn {
    padding: 0.5rem 0.6rem !important;
    font-size: 0.85rem !important;
    white-space: nowrap !important;
  }
}

/* ===== chatmax-001 (2026-11-17): desktop fullscreen toggle for the chat window ===== */
.chat-max-btn {
  position: absolute;
  top: 12px;
  right: 52px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--site-accent, #35ff6e);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  padding: 0;
}
.chat-max-btn:hover { opacity: 1; }
@media (min-width: 769px) {
  .chat-max-btn { display: flex; }
}
.chat-container.chat-max {
  width: 100vw !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

/* ===== popupmax-001b + btnflow-002 (2026-11-17): chat header reserves room for the button strip ===== */
@media (min-width: 769px) {
  .chat-header {
    padding-right: 116px;
  }
}

/* ===== fabsunify-002 / chatbtn-001: chat-max wears the nb crew uniform ===== */
/* same stature as .nb-max-btn/.nb-big-btn (btnsize-001 recipe): 28x28, 2px cyan border */
#chat-max {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 2px solid var(--nb-cyan);
  border-radius: 4px;
  color: var(--nb-cyan);
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  padding: 0;
}
#chat-max:hover { opacity: 1; }
@media (max-width: 768px) {
  #chat-max { display: none !important; }
}

/* ===== fabsunify-002 / chatbtn-002: chat-max measured against its sibling ===== */
/* .chat-close-btn stature (style.css:1343): 32x32, 1px border, 1.1rem, --site-accent */
/* stacked beside it: right 14px + 32px + 8px gap = 54px */
#chat-max {
  top: 12px;
  right: 54px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--site-accent);
  color: var(--site-accent);
  font-size: 1.1rem;
  z-index: 5;
  transition: all 0.25s;
}


/* VIZDANCE-04 (2026-11-23): legacy VIZBTN-01 drift law amputated whole.
   The 6s ease fade was the "slow color cycling" ghost. One choreography
   remains: the VIZDANCE-02/03 tide law. */



/* ==================== VIZDANCE-02 (2026-11-23) ====================
   The REAL bubble heartbeat, verbatim: --env tide + --hue-shift snap,
   published globally to <html> by chat-pulse.js. NO transitions --
   attack is instant, the envelope IS the smoothing. Supersedes
   VIZDANCE-01 (whose 6s ease smoothed the rhythm into mush). */
#viz-toggle-btn {
  transition: none !important;
  background: radial-gradient(circle at 35% 30%,
    hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200) 100% 55%) 0%,
    hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200 - 30) 95% 38%) 100%) !important;
  border-color: hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200) 95% 48%) !important;
  box-shadow: 0 0 30px
    hsla(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200), 100%, 55%, 0.55) !important;
}
#viz-toggle-btn:hover {
  filter: brightness(1.15) !important;
}
@media (prefers-reduced-motion: reduce) {
  #viz-toggle-btn {
    background: var(--site-accent, #00ff00) !important;
    box-shadow: none !important;
    transition: none !important;
  }
}


/* ==================== VIZDANCE-03 (2026-11-23) ====================
   The lang bar VIZ joins the band. Same tide law as VIZDANCE-02 /
   the chat bubble: --env energy + --hue-shift snap, published to <html>
   by chat-pulse.js. NO transitions - attack instant, envelope is the
   smoothing. id+class specificity outranks the legacy .viz-dance-btn
   6s drift law outright; cascade duel unnecessary. */
#viz-dock-btn.viz-dance-btn {
  transition: none !important;
  background: radial-gradient(circle at 35% 30%,
    hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200) 100% 55%) 0%,
    hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200 - 30) 95% 38%) 100%) !important;
  border-color: hsl(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200) 95% 48%) !important;
  box-shadow: 0 0 30px
    hsla(calc(120 + var(--hue-shift, 0) + var(--env, 0) * 200), 100%, 55%, 0.55) !important;
  color: #000 !important;
}
#viz-dock-btn.viz-dance-btn:hover {
  filter: brightness(1.15) !important;
}
@media (prefers-reduced-motion: reduce) {
  #viz-dock-btn.viz-dance-btn {
    background: var(--site-accent, #00ff00) !important;
    box-shadow: none !important;
    transition: none !important;
  }
}
