/* ============================================================
   RETRODEX CODEC — 3-Column Terminal Interface
   ============================================================
   Layout: BAZ (left) | TEXT (center) | USER (right)
   Ref: MGS Codec 3-column, Game Boy palette, CRT effects

   States applied on #rdx-codec:
     .codec-idle         — BAZ cursor blinks, user idle
     .codec-talk         — BAZ talk bars animate, user listens
     .codec-content      — BAZ checkmark visible, user nods
     .codec-user-waiting — pulsing dot, input disabled
   Visibility:
     .codec-open    — slide up into view
     .codec-closing — slide down / hidden
     (no class)     — hidden below viewport
   ============================================================ */

/* ----------------------------------------------------------
   0. CUSTOM PROPERTIES — Game Boy palette tokens
   ---------------------------------------------------------- */

#rdx-codec {
  /* Game Boy 4-shade palette */
  --codec-bg: #0F380F;
  --codec-bg-alpha: rgba(15, 56, 15, 0.96);
  --codec-surface: rgba(15, 56, 15, 0.6);

  /* Accent: GB lightest green */
  --codec-accent: #8BAC0F;
  --codec-accent-40: rgba(139, 172, 15, 0.4);
  --codec-accent-15: rgba(139, 172, 15, 0.15);
  --codec-accent-08: rgba(139, 172, 15, 0.08);
  --codec-accent-dim: #306230;

  /* Typography */
  --codec-font-display: var(--font-display, 'DepartureMono', monospace);
  --codec-font-ui: var(--font-ui, 'BigBlueTerminal', monospace);
  --codec-text: #8BAC0F;
  --codec-text-muted: #4a8a54;

  /* Geometry */
  --codec-bracket-size: 10px;
  --codec-border-radius: 2px;
}

/* ----------------------------------------------------------
   1. KEYFRAMES
   ---------------------------------------------------------- */

/* Cursor blink — 1 Hz square wave */
@keyframes codec-blink {
  0%, 49.9%  { opacity: 1; }
  50%, 100%  { opacity: 0; }
}

/* Talk-bar height oscillation — 5 variations */
@keyframes codec-bar-1 {
  0%, 100% { height: 4px; }
  25%      { height: 20px; }
  50%      { height: 8px; }
  75%      { height: 16px; }
}
@keyframes codec-bar-2 {
  0%, 100% { height: 6px; }
  30%      { height: 22px; }
  60%      { height: 10px; }
  80%      { height: 18px; }
}
@keyframes codec-bar-3 {
  0%, 100% { height: 8px; }
  20%      { height: 14px; }
  55%      { height: 24px; }
  85%      { height: 6px; }
}
@keyframes codec-bar-4 {
  0%, 100% { height: 5px; }
  35%      { height: 18px; }
  65%      { height: 12px; }
  90%      { height: 22px; }
}
@keyframes codec-bar-5 {
  0%, 100% { height: 10px; }
  15%      { height: 24px; }
  45%      { height: 6px; }
  70%      { height: 16px; }
}

/* User nod — subtle vertical shift every 3s */
@keyframes codec-nod {
  0%, 93.3%  { transform: translateY(0); }
  95%        { transform: translateY(-1px); }
  96.7%      { transform: translateY(0); }
}

/* Slide in — heavier feel with slight overshoot */
@keyframes codec-slide-up {
  0%   { transform: translateX(-50%) translateY(100%); opacity: 0; }
  70%  { transform: translateX(-50%) translateY(-2%);  opacity: 1; }
  100% { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* Slide out to bottom */
@keyframes codec-slide-down {
  from { transform: translateX(-50%) translateY(0);    opacity: 1; }
  to   { transform: translateX(-50%) translateY(100%); opacity: 0; }
}

/* Typewriter cursor pulse */
@keyframes codec-type-cursor {
  0%, 49.9%  { border-right-color: var(--codec-accent); }
  50%, 100%  { border-right-color: transparent; }
}

/* Prompt blink when input is focused */
@keyframes codec-prompt-pulse {
  0%, 49.9%  { opacity: 1; }
  50%, 100%  { opacity: 0.4; }
}

/* Border pulse on open — one-time accent flash */
@keyframes codec-border-pulse {
  0%   { border-color: var(--codec-accent); box-shadow: inset 0 0 0 1px #306230, 0 0 12px var(--codec-accent-40); }
  100% { border-color: #8BAC0F; box-shadow: inset 0 0 0 1px #306230; }
}

/* CSS-only animated grain/static */
@keyframes codec-grain {
  0%, 100% { transform: translate(0, 0); }
  10%      { transform: translate(-1%, -1%); }
  20%      { transform: translate(1%, 0.5%); }
  30%      { transform: translate(-0.5%, 1%); }
  40%      { transform: translate(0.5%, -0.5%); }
  50%      { transform: translate(-1%, 0.5%); }
  60%      { transform: translate(1%, -1%); }
  70%      { transform: translate(0%, 1%); }
  80%      { transform: translate(-0.5%, -0.5%); }
  90%      { transform: translate(0.5%, 0%); }
}

/* Waiting state pulsing dot */
@keyframes codec-waiting-pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* Freq label pulse */
@keyframes codec-freq-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.85; }
}

/* Signal bar level animation */
@keyframes codec-signal-bar {
  0%, 100% { height: 3px; }
  33%      { height: 7px; }
  66%      { height: 5px; }
}

/* Rare transmission glitch */
@keyframes codec-glitch {
  0%, 99.78% {
    clip-path: none;
    transform: none;
  }
  99.78%, 99.89% {
    clip-path: inset(48% 0 50% 0);
    transform: translateX(2px);
  }
  99.89%, 100% {
    clip-path: none;
    transform: none;
  }
}

/* ----------------------------------------------------------
   2. CONTAINER — 3-column grid layout
   ---------------------------------------------------------- */

#rdx-codec {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 600px;
  height: 180px;
  z-index: 10000;

  /* Game Boy darkest green background */
  background: var(--codec-bg-alpha);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  /* GB-palette border with inner border effect */
  border: 2px solid #8BAC0F;
  border-radius: var(--codec-border-radius);
  box-shadow: inset 0 0 0 1px #306230;

  /* 3-column grid: BAZ | TEXT | USER */
  display: grid;
  grid-template-columns: 92px 1fr 92px;
  grid-template-rows: 24px 1fr auto;
  overflow: hidden;

  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

/* ----------------------------------------------------------
   3. FADE DISSOLVE — Top edge gradient
   ---------------------------------------------------------- */

#rdx-codec::before {
  content: '';
  position: absolute;
  top: -24px;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(to bottom, transparent, rgba(15, 56, 15, 0.6));
  pointer-events: none;
  z-index: 1;
}

/* ----------------------------------------------------------
   3b. VIGNETTING — CRT curvature simulation
   ---------------------------------------------------------- */

.codec-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(15, 56, 15, 0.8) 0%, transparent 60px),
    radial-gradient(ellipse at 100% 0%, rgba(15, 56, 15, 0.8) 0%, transparent 60px),
    radial-gradient(ellipse at 0% 100%, rgba(15, 56, 15, 0.8) 0%, transparent 60px),
    radial-gradient(ellipse at 100% 100%, rgba(15, 56, 15, 0.8) 0%, transparent 60px);
}

/* ----------------------------------------------------------
   4. SCANLINES + GRAIN OVERLAY
   ---------------------------------------------------------- */

/* Scanlines: 1px dark lines every 2px */
#rdx-codec::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 1px,
      rgba(15, 56, 15, 0.3) 1px,
      rgba(15, 56, 15, 0.3) 2px
    );
  opacity: 0.10;
  pointer-events: none;
  z-index: 10;
}

/* Animated grain texture */
.codec-grain-overlay {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(139,172,15,0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139,172,15,0.015) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(139,172,15,0.01) 0%, transparent 50%);
  background-size: 4px 4px, 6px 6px, 5px 5px;
  animation: codec-grain 0.8s steps(4) infinite;
  pointer-events: none;
  z-index: 9;
  opacity: 0.4;
}

/* Rare glitch overlay */
.codec-glitch-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 1px,
      rgba(15, 56, 15, 0.3) 1px,
      rgba(15, 56, 15, 0.3) 2px
    );
  opacity: 0.10;
  animation: codec-glitch 45s linear infinite;
  animation-delay: 20s;
}

/* ----------------------------------------------------------
   5. CORNER BRACKETS
   ---------------------------------------------------------- */

.codec-bracket {
  position: absolute;
  width: var(--codec-bracket-size);
  height: var(--codec-bracket-size);
  pointer-events: none;
  z-index: 11;
}

.codec-bracket--tl {
  top: 3px;
  left: 3px;
  border-top: 1px solid var(--codec-accent-40);
  border-left: 1px solid var(--codec-accent-40);
}
.codec-bracket--tr {
  top: 3px;
  right: 3px;
  border-top: 1px solid var(--codec-accent-40);
  border-right: 1px solid var(--codec-accent-40);
}
.codec-bracket--bl {
  bottom: 3px;
  left: 3px;
  border-bottom: 1px solid var(--codec-accent-40);
  border-left: 1px solid var(--codec-accent-40);
}
.codec-bracket--br {
  bottom: 3px;
  right: 3px;
  border-bottom: 1px solid var(--codec-accent-40);
  border-right: 1px solid var(--codec-accent-40);
}

/* ----------------------------------------------------------
   6. HEADER ROW — "CODEC" left, "FREQ 141.80" + signal right
   Spans all 3 columns (row 1)
   ---------------------------------------------------------- */

.codec-header {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  height: 24px;
  border-bottom: 1px solid #306230;
  position: relative;
  z-index: 5;
}

.codec-header-label {
  font-family: var(--codec-font-display);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  color: var(--codec-accent);
  text-transform: uppercase;
  line-height: 1;
  opacity: 0.85;
}

.codec-freq-label {
  font-family: var(--codec-font-display);
  font-size: 0.5rem;
  letter-spacing: 0.15em;
  color: var(--codec-text-muted);
  opacity: 0.5;
  text-transform: uppercase;
  pointer-events: none;
  line-height: 1;
  animation: codec-freq-pulse 4s ease-in-out infinite;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Signal strength bars next to freq label */
.codec-freq-label::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 7px;
  background:
    linear-gradient(to right,
      var(--codec-text-muted) 0px, var(--codec-text-muted) 1px,
      transparent 1px, transparent 2px,
      var(--codec-text-muted) 2px, var(--codec-text-muted) 3px,
      transparent 3px, transparent 4px,
      var(--codec-text-muted) 4px, var(--codec-text-muted) 5px
    );
  background-size: 5px 100%;
  animation: codec-signal-bar 3s steps(3) infinite;
  opacity: 0.8;
}

/* ----------------------------------------------------------
   7. OPEN / CLOSE STATES
   ---------------------------------------------------------- */

#rdx-codec.codec-open {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  animation:
    codec-slide-up 350ms cubic-bezier(0.22, 1, 0.36, 1) forwards,
    codec-border-pulse 500ms ease-out forwards;
  pointer-events: auto;
}

#rdx-codec.codec-closing {
  animation: codec-slide-down 300ms ease-in forwards;
  pointer-events: none;
}

/* ----------------------------------------------------------
   8. PORTRAIT COLUMNS — BAZ (left col), USER (right col)
   ---------------------------------------------------------- */

/* BAZ portrait — column 1, row 2 */
.codec-avatar-baz {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 6px;
}

/* USER portrait — column 3, row 2 */
.codec-avatar-user {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 6px;
}

/* Portrait images: 80x80 display, pixelated rendering */
.codec-avatar svg,
.codec-avatar img {
  width: 80px;
  height: 80px;
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  border: 1px solid var(--codec-accent-40);
  border-radius: 1px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
  transition: border-color 300ms ease, box-shadow 200ms ease;
}

/* Labels under portraits */
.codec-label {
  font-family: var(--codec-font-display);
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  color: var(--codec-text-muted);
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
  opacity: 0.7;
}

/* BAZ label — machine identity: bolder, brighter */
.codec-avatar-baz .codec-label {
  font-weight: bold;
  letter-spacing: 0.14em;
  font-size: 0.6rem;
  opacity: 0.85;
  color: var(--codec-accent);
}

/* USER label — human identity: lighter, dimmer */
.codec-avatar-user .codec-label {
  font-weight: normal;
  letter-spacing: 0.08em;
  font-size: 0.55rem;
  color: var(--codec-text-muted);
  opacity: 0.55;
}

/* When BAZ talks, brighten the BAZ frame */
.codec-talk .codec-avatar-baz svg,
.codec-talk .codec-avatar-baz img {
  border-color: var(--codec-accent);
  box-shadow:
    inset 0 0 6px rgba(0, 0, 0, 0.4),
    0 0 4px var(--codec-accent-40);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

/* BAZ idle state — dim border returns */
#rdx-codec:not(.codec-talk) .codec-avatar-baz svg,
#rdx-codec:not(.codec-talk) .codec-avatar-baz img {
  border-color: var(--codec-accent-40);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

/* BAZ portrait glow when talking */
.codec-talk .codec-avatar-baz img,
.codec-talk .codec-avatar-baz svg {
  filter: drop-shadow(0 0 2px #8BAC0F);
}

/* ----------------------------------------------------------
   9. TEXT ZONE — Center column, row 2
   ---------------------------------------------------------- */

.codec-text-zone {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid #306230;
  border-right: 1px solid #306230;
}

.codec-text {
  flex: 1;
  padding: 8px 12px;
  font-family: var(--codec-font-ui);
  font-size: 13px;
  line-height: 1.6;
  color: var(--codec-text);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--codec-accent-dim) transparent;
}

/* Typewriter cursor on active text span */
.codec-text .codec-typewriter {
  border-right: 2px solid var(--codec-accent);
  padding-right: 2px;
  animation: codec-type-cursor 1s steps(1) infinite;
}

/* Hide cursor when typing is complete */
.codec-text .codec-typewriter.done {
  border-right-color: transparent;
  animation: none;
}

/* ----------------------------------------------------------
   10. INPUT ROW — Spans all 3 columns (row 3)
   ---------------------------------------------------------- */

.codec-input-row {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 32px;
  min-height: 32px;
  gap: 8px;
  position: relative;
  background: var(--codec-accent-08);
  border-top: 1px solid #306230;
}

/* The > prompt */
.codec-input-prompt {
  font-family: var(--codec-font-ui);
  font-size: 13px;
  color: var(--codec-accent);
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
  opacity: 0.8;
}

/* Prompt pulses when focused */
.codec-input-row:focus-within .codec-input-prompt {
  opacity: 1;
  animation: codec-prompt-pulse 1s steps(1) infinite;
}

/* Input field */
.codec-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--codec-font-ui);
  font-size: 12px;
  line-height: 1;
  color: var(--codec-text);
  caret-color: var(--codec-accent);
  padding: 0;
  margin: 0;
  min-width: 0;
}

.codec-input::placeholder {
  color: var(--codec-text-muted);
  opacity: 0.5;
  font-style: normal;
}

/* Focus state — warm inset glow */
.codec-input-row:focus-within {
  background: rgba(139, 172, 15, 0.04);
  box-shadow:
    inset 0 0 20px var(--codec-accent-08),
    inset 0 1px 0 var(--codec-accent-15);
}

/* ----------------------------------------------------------
   11. SEPARATOR (kept for backward compatibility)
   ---------------------------------------------------------- */

.codec-separator {
  width: 100%;
  height: 1px;
  border: none;
  margin: 0;
  background: linear-gradient(
    to right,
    transparent 0%,
    #306230 20%,
    #306230 80%,
    transparent 100%
  );
}

.codec-separator-input {
  opacity: 0.15;
}

/* ----------------------------------------------------------
   12. PORTRAITS ROW (legacy compat — hidden in new layout)
   If the HTML still has .codec-portraits wrapper, adapt it
   ---------------------------------------------------------- */

.codec-portraits {
  display: contents;
}

/* ----------------------------------------------------------
   13. BAZ IDLE STATE — Cursor blink
   ---------------------------------------------------------- */

.codec-idle .baz-cursor,
#rdx-codec:not(.codec-talk):not(.codec-content) .baz-cursor {
  animation: codec-blink 1s steps(1) infinite;
}

/* ----------------------------------------------------------
   14. BAZ TALK STATE — Equalizer bars animate
   ---------------------------------------------------------- */

.baz-bars rect {
  fill: var(--codec-accent);
  transform-origin: bottom center;
  transition: height 80ms ease;
}

/* Bars are static by default */
.baz-bars rect:nth-child(1) { height: 4px; }
.baz-bars rect:nth-child(2) { height: 6px; }
.baz-bars rect:nth-child(3) { height: 8px; }
.baz-bars rect:nth-child(4) { height: 5px; }
.baz-bars rect:nth-child(5) { height: 10px; }

/* Animate bars when talking */
.codec-talk .baz-bars rect:nth-child(1) {
  animation: codec-bar-1 400ms ease-in-out infinite;
  animation-delay: 0ms;
}
.codec-talk .baz-bars rect:nth-child(2) {
  animation: codec-bar-2 350ms ease-in-out infinite;
  animation-delay: 50ms;
}
.codec-talk .baz-bars rect:nth-child(3) {
  animation: codec-bar-3 450ms ease-in-out infinite;
  animation-delay: 100ms;
}
.codec-talk .baz-bars rect:nth-child(4) {
  animation: codec-bar-4 380ms ease-in-out infinite;
  animation-delay: 75ms;
}
.codec-talk .baz-bars rect:nth-child(5) {
  animation: codec-bar-5 420ms ease-in-out infinite;
  animation-delay: 30ms;
}

/* Hide cursor while talking */
.codec-talk .baz-cursor {
  opacity: 0;
  animation: none;
}

/* ----------------------------------------------------------
   15. BAZ CONTENT STATE — Checkmark visible
   ---------------------------------------------------------- */

.baz-checkmark {
  display: none;
  fill: var(--codec-accent);
}

.codec-content .baz-checkmark {
  display: block;
}

.codec-content .baz-cursor {
  opacity: 0;
  animation: none;
}

.codec-content .baz-bars rect {
  animation: none;
}

/* ----------------------------------------------------------
   16. USER STATES — Nod during active conversation
   ---------------------------------------------------------- */

.codec-talk .codec-avatar-user svg,
.codec-talk .codec-avatar-user img,
.codec-content .codec-avatar-user svg,
.codec-content .codec-avatar-user img {
  animation: codec-nod 3s ease-in-out infinite;
}

.user-listen {
  animation: codec-nod 3s ease-in-out infinite;
}

/* ----------------------------------------------------------
   17. THINKING INDICATOR
   ---------------------------------------------------------- */

.codec-thinking {
  font-family: var(--codec-font-ui);
  font-size: 12px;
  color: var(--codec-accent);
  opacity: 0;
  pointer-events: none;
  flex-shrink: 0;
  transition: opacity 150ms ease;
  min-width: 20px;
  text-align: right;
}

/* ----------------------------------------------------------
   18. USER-WAITING STATE — Pulsing dot + disabled input
   ---------------------------------------------------------- */

#rdx-codec.codec-user-waiting .codec-thinking {
  opacity: 1;
  animation: codec-blink 1s steps(1) infinite;
}

#rdx-codec.codec-user-waiting .codec-input-row::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--codec-accent);
  animation: codec-waiting-pulse 1.5s ease-in-out infinite;
}

#rdx-codec.codec-user-waiting .codec-input {
  pointer-events: none;
  opacity: 0.25;
}

#rdx-codec.codec-user-waiting .codec-input-prompt {
  opacity: 0.25;
  animation: none;
}

/* ----------------------------------------------------------
   19. RESPONSIVE — Mobile-first adjustments
   ---------------------------------------------------------- */

@media (max-width: 480px) {
  #rdx-codec {
    max-width: 100%;
    height: 160px;
    bottom: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-radius: var(--codec-border-radius) var(--codec-border-radius) 0 0;
    grid-template-columns: 68px 1fr 68px;
    grid-template-rows: 20px 1fr auto;
  }

  /* Sprites shrink to 56x56 on mobile */
  .codec-avatar svg,
  .codec-avatar img {
    width: 56px;
    height: 56px;
  }

  .codec-text {
    font-size: 11px;
    padding: 6px 8px;
  }

  .codec-input-row {
    padding: 0 8px;
    height: 36px;
    min-height: 36px;
  }

  .codec-input,
  .codec-input-prompt,
  .codec-thinking {
    font-size: 11px;
  }

  .codec-label {
    font-size: 0.45rem;
  }

  .codec-header {
    padding: 0 8px;
    height: 20px;
  }

  .codec-header-label {
    font-size: 0.5rem;
  }

  .codec-freq-label {
    font-size: 0.4rem;
  }

  /* Brackets tighten on mobile */
  .codec-bracket {
    --codec-bracket-size: 7px;
  }
}

/* Larger mobile — ensure full width */
@media (max-width: 600px) and (min-width: 481px) {
  #rdx-codec {
    max-width: 100%;
    bottom: 0;
    border-radius: var(--codec-border-radius) var(--codec-border-radius) 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
}

/* ----------------------------------------------------------
   20. ACCESSIBILITY — Respect reduced motion preference
   ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  #rdx-codec,
  #rdx-codec.codec-open,
  #rdx-codec.codec-closing {
    animation-duration: 0.01ms !important;
  }

  .codec-grain-overlay {
    animation: none !important;
    display: none;
  }

  .codec-talk .baz-bars rect {
    animation: none !important;
  }

  .codec-freq-label {
    animation: none !important;
    opacity: 0.5 !important;
  }

  .codec-freq-label::after {
    animation: none !important;
  }

  .codec-glitch-overlay {
    animation: none !important;
    display: none;
  }
}

/* ============================================================
   ERUDIT CHARACTER VARIANT — Amber palette
   Applied via .codec-char-erudit on #rdx-codec
   ============================================================ */

#rdx-codec.codec-char-erudit {
  --codec-bg: #1a1200;
  --codec-bg-alpha: rgba(26, 18, 0, 0.96);
  --codec-accent: #e0aa00;
  --codec-accent-40: rgba(224, 170, 0, 0.4);
  --codec-accent-15: rgba(224, 170, 0, 0.15);
  --codec-accent-08: rgba(224, 170, 0, 0.08);
  border-color: #e0aa00;
}

#rdx-codec.codec-char-erudit .codec-label-baz {
  color: #e0aa00;
  opacity: 0.6;
}

#rdx-codec.codec-char-erudit .codec-text,
#rdx-codec.codec-char-erudit .codec-typewriter {
  color: #e0aa00;
}

#rdx-codec.codec-char-erudit .codec-input {
  color: #e0aa00;
}

#rdx-codec.codec-char-erudit .codec-input-prompt {
  color: #9a7a00;
}

/* ── Erudit Mode — Cyan override ── */

#rdx-codec.erudit-mode {
  border-color: #4A9ACA;
  background: #0F1A2A;
}

#rdx-codec.erudit-mode .codec-header {
  border-bottom-color: #2a5a7a;
  background: #0a1420;
}

#rdx-codec.erudit-mode .codec-title,
#rdx-codec.erudit-mode .codec-freq-label {
  color: #4A9ACA;
}

#rdx-codec.erudit-mode .codec-text,
#rdx-codec.erudit-mode .codec-typewriter {
  color: #7abada;
}

#rdx-codec.erudit-mode .codec-input {
  color: #7abada;
  border-color: #2a5a7a;
}

#rdx-codec.erudit-mode .codec-input-prompt {
  color: #3a7a9a;
}

#rdx-codec.erudit-mode .codec-label-baz {
  color: #4A9ACA;
  opacity: 0.7;
}

#rdx-codec.erudit-mode .sprite-gauge-fill {
  background: linear-gradient(90deg, #1a3a5a, #5aaadd);
}
