/* ═══════════════════════════════════════════════════════
   RBD ENHANCEMENTS: Glitch Effect, IF-Route Tode, Arc 6-7
   ═══════════════════════════════════════════════════════ */

/* Greed IF Glitch counter */
.rbd-glitch-wrap {
  position: relative;
  display: inline-block;
  cursor: pointer;
}
.rbd-glitch-wrap .rbd-num {
  position: relative;
}
.rbd-glitch-wrap.glitching .rbd-num {
  animation: glitchText .08s infinite alternate;
  text-shadow:
    3px 0 #f472b6,
    -3px 0 #60a5fa,
    0 0 40px rgba(220,38,38,.6);
}
.rbd-glitch-wrap.glitching .rbd-num::before,
.rbd-glitch-wrap.glitching .rbd-num::after {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  overflow: hidden;
}
.rbd-glitch-wrap.glitching .rbd-num::before {
  animation: glitchClip1 .1s infinite alternate;
  color: #f472b6;
  left: 2px;
  text-shadow: -2px 0 #60a5fa;
  clip-path: inset(20% 0 40% 0);
}
.rbd-glitch-wrap.glitching .rbd-num::after {
  animation: glitchClip2 .12s infinite alternate;
  color: #60a5fa;
  left: -2px;
  text-shadow: 2px 0 #f472b6;
  clip-path: inset(50% 0 10% 0);
}

@keyframes glitchText {
  0%   { transform: translate(0); }
  20%  { transform: translate(-2px, 1px); }
  40%  { transform: translate(2px, -1px); }
  60%  { transform: translate(-1px, -2px); }
  80%  { transform: translate(1px, 2px); }
  100% { transform: translate(0); }
}
@keyframes glitchClip1 {
  0%   { clip-path: inset(20% 0 40% 0); }
  50%  { clip-path: inset(60% 0 5% 0); }
  100% { clip-path: inset(10% 0 70% 0); }
}
@keyframes glitchClip2 {
  0%   { clip-path: inset(50% 0 10% 0); }
  50%  { clip-path: inset(5% 0 60% 0); }
  100% { clip-path: inset(30% 0 30% 0); }
}

.rbd-glitch-msg {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--accent3);
  text-align: center;
  margin-top: 6px;
  opacity: 0;
  transition: opacity .3s;
  text-shadow: 0 0 10px rgba(220,38,38,.4);
}
.rbd-glitch-msg.visible { opacity: 1; }

/* IF-Route section divider in table */
.rbd-table .if-route-header td {
  background: rgba(139,92,246,.08);
  border-bottom: 1px solid var(--accent1);
  padding: 10px 12px;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .05em;
  color: var(--accent1);
}
.rbd-table .if-route-header td .if-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  margin-left: 8px;
}

/* Arc 6-7 expandable */
.rbd-expand-block {
  margin-top: 20px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.rbd-expand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-card);
  cursor: pointer;
  user-select: none;
  transition: background .2s;
}
.rbd-expand-header:hover {
  background: var(--bg-card2);
}
.rbd-expand-title {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}
.rbd-expand-chevron {
  width: 12px; height: 12px; flex-shrink: 0;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(-45deg);
  transition: transform .3s, border-color .3s;
}
.rbd-expand-block.open .rbd-expand-chevron {
  transform: rotate(45deg);
  border-color: var(--accent3);
}
.rbd-expand-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s ease;
}
.rbd-expand-block.open .rbd-expand-body {
  max-height: 600px;
}
.rbd-expand-inner {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}
.rbd-expand-inner strong {
  color: var(--text-main);
}
.rbd-expand-inner .death-count-inf {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--accent3);
  display: inline-block;
  margin: 8px 0;
}
