/* ============================================================
   STREAM GUARDIAN — OBS Overlay
   ============================================================ */

:root {
  --neon-cyan: #00ffd5;
  --neon-blue: #00e5ff;
  --text-dim: #5a6a7a;
  --font-mono: 'Share Tech Mono', monospace;
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  background: transparent;
  font-family: var(--font-mono);
}

.hidden { display: none !important; }

/* ============================================================
   OAK — two-layer crossfade (idle ↔ talking)
   ============================================================ */

.robot-container {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 700px;
  height: 455px;
  z-index: 50;
  animation: idleFloat 3s ease-in-out infinite;
}

@keyframes idleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Both layers fill the container, stacked on top of each other */
.robot-layer {
  position: absolute;
  inset: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom right;
  transition: none;
}

/* Idle layer — image set dynamically via JS from /api/settings */
.robot-idle {
  /* background-image set by app.js */
  opacity: 1;
}

/* Talk layer — image set dynamically via JS, hidden by default */
.robot-talk {
  /* background-image set by app.js */
  opacity: 0;
}

/* When talking: crossfade — idle fades out, talk fades in */
.robot-container.talking .robot-idle {
  opacity: 0;
}
.robot-container.talking .robot-talk {
  opacity: 1;
}

/* Bounce on talk start */
@keyframes talkBounce {
  0% { transform: translateY(0); }
  40% { transform: translateY(-12px); }
  70% { transform: translateY(2px); }
  100% { transform: translateY(0); }
}

.robot-container.bouncing {
  animation: talkBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================
   SPEECH BUBBLE — Ancient parchment scroll
   ============================================================ */

.speech-bubble {
  position: absolute;
  bottom: 340px;
  right: 480px;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  flex-direction: row;
  gap: 0;
  animation: scrollUnfurl 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes scrollUnfurl {
  0% { opacity: 0; transform: translateY(20px) scaleY(0.3); }
  60% { opacity: 1; transform: translateY(-4px) scaleY(1.02); }
  100% { opacity: 1; transform: translateY(0) scaleY(1); }
}

/* Tail — pointed vine/branch toward the tree */
.bubble-tail {
  width: 0;
  height: 0;
  margin-top: 24px;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 14px solid #d4b896;
  flex-shrink: 0;
  filter: drop-shadow(1px 0 2px rgba(61, 43, 31, 0.2));
}

/* Body — aged parchment scroll */
.bubble-body {
  background:
    linear-gradient(135deg,
      #e8d5b7 0%,
      #f0e2c8 15%,
      #e6d1a9 30%,
      #f2e4c6 50%,
      #e4cea5 70%,
      #eedcbc 85%,
      #e2c99f 100%
    );
  color: #1a0e06;
  font-family: 'MedievalSharp', cursive;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.5;
  padding: 24px 32px;
  border-radius: 6px;
  max-width: 560px;
  min-width: 160px;
  border: 3px solid #a07a4a;
  border-image: none;
  box-shadow:
    0 2px 8px rgba(61, 43, 31, 0.25),
    0 8px 24px rgba(61, 43, 31, 0.15),
    inset 0 0 30px rgba(139, 101, 58, 0.12);
  position: relative;
}

/* Aged edges — subtle dark corners */
.bubble-body::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background:
    radial-gradient(ellipse at top left, rgba(101, 67, 33, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(101, 67, 33, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at top right, rgba(101, 67, 33, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at bottom left, rgba(101, 67, 33, 0.08) 0%, transparent 40%);
  pointer-events: none;
}

/* Top/bottom scroll roll decorations */
.bubble-body::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: -3px;
  height: 6px;
  background: linear-gradient(to right, #c9a97a, #d4b896, #c9a97a);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 -1px 3px rgba(61, 43, 31, 0.2);
}

.robot-message-text {
  color: #1a0e06;
  text-shadow:
    0 1px 0 rgba(255, 245, 230, 0.5),
    0 0 6px rgba(255, 240, 210, 0.3);
  position: relative;
  z-index: 1;
  letter-spacing: 0.3px;
}

.cursor-blink {
  color: #5a3a1a;
  font-weight: 600;
  animation: blink 0.6s step-end infinite;
  position: relative;
  z-index: 1;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Exit — scroll rolls back up */
.speech-bubble.popping-out {
  animation: scrollFurl 0.35s ease-in forwards;
}

@keyframes scrollFurl {
  0% { opacity: 1; transform: translateY(0) scaleY(1); }
  100% { opacity: 0; transform: translateY(15px) scaleY(0.3); }
}

/* ============================================================
   IDLE HUD — below robot
   ============================================================ */

.idle-hud {
  display: none;
}

.idle-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 255, 213, 0.5);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan), 0 0 12px var(--neon-cyan);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.idle-text {
  animation: textFlicker 4s ease-in-out infinite;
}

@keyframes textFlicker {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.3; }
  97% { opacity: 1; }
  98% { opacity: 0.5; }
}

.idle-stats {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
  padding-left: 16px;
}

.stat-divider {
  margin: 0 6px;
  color: var(--neon-blue);
  opacity: 0.4;
}

/* ============================================================
   RAID SHIELD
   ============================================================ */

.raid-shield {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(0, 229, 255, 0.05), rgba(0, 0, 0, 0.7));
}

.shield-hex {
  width: 300px;
  height: 300px;
  border: 3px solid var(--neon-cyan);
  border-radius: 50%;
  position: absolute;
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.3);
  animation: shieldPulse 2s ease-in-out infinite;
}

@keyframes shieldPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
}

.shield-text {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 900;
  color: var(--neon-cyan);
  z-index: 201;
}

.shield-subtext {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--neon-cyan);
  margin-top: 20px;
  opacity: 0.7;
  z-index: 201;
}

/* ============================================================
   AUDIO UNLOCK
   ============================================================ */

.audio-unlock {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 9999;
  cursor: pointer;
  background: transparent;
}

.audio-unlock.dismissed { display: none; }

.audio-unlock-btn { display: none; }
