/* ==========================================================================
   MINIMAL CHICKEN NOVA MIND READER - STYLESHEET WITH CAMERA FLIP BUTTON
   ========================================================================== */

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;

  --bg-dark: #070a12;
  --bg-card: rgba(15, 23, 42, 0.85);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(168, 85, 247, 0.4);

  --accent-primary: #a855f7;
  --accent-primary-hover: #9333ea;
  --accent-secondary: #ec4899;
  --accent-success: #10b981;
  --accent-error: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --shadow-main: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 35px rgba(168, 85, 247, 0.35);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.4s ease;
}

/* Background Glows */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
}
.bg-glow-1 {
  width: 500px;
  height: 500px;
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.25), transparent 70%);
}
.bg-glow-2 {
  width: 500px;
  height: 500px;
  bottom: -100px;
  right: -100px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.2), transparent 70%);
}

/* RED FLASH BACKGROUND OVERLAY FOR WRONG CHOICE */
.wrong-bg-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(220, 38, 38, 0.85) 0%, rgba(153, 27, 27, 0.95) 100%);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
}

.wrong-bg-overlay.active {
  opacity: 1;
  animation: wrongBgPulse 0.8s infinite alternate;
}

@keyframes wrongBgPulse {
  0% { opacity: 0.85; }
  100% { opacity: 1; }
}

/* PULSING RED CROSSES OVERLAY */
.wrong-crosses-container {
  position: fixed;
  inset: 0;
  z-index: 105;
  pointer-events: none;
  display: none;
}

.wrong-crosses-container.active {
  display: block;
}

.pulsing-cross {
  position: absolute;
  font-size: 80px;
  filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.9));
  animation: pulseScaleCross 0.6s infinite alternate ease-in-out;
}

.cross-1 { top: 15%; left: 10%; animation-delay: 0s; font-size: 90px; }
.cross-2 { top: 20%; right: 12%; animation-delay: 0.15s; font-size: 110px; }
.cross-3 { bottom: 18%; left: 15%; animation-delay: 0.3s; font-size: 100px; }
.cross-4 { bottom: 15%; right: 10%; animation-delay: 0.45s; font-size: 120px; }

@keyframes pulseScaleCross {
  0% { transform: scale(0.7) rotate(-10deg); opacity: 0.6; }
  100% { transform: scale(1.4) rotate(10deg); opacity: 1; }
}

/* RGB RAINBOW DYNAMIC BACKGROUND OVERLAY FOR WIN */
.rgb-bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  background: linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3);
  background-size: 1200% 1200%;
  backdrop-filter: blur(4px);
}

.rgb-bg-overlay.active {
  opacity: 0.75;
  animation: rgbRainbowShift 3s ease infinite alternate;
}

@keyframes rgbRainbowShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* RAGEBAIT WIN MODAL POPUP */
.win-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.win-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.win-modal-card {
  background: linear-gradient(135deg, rgba(30, 15, 60, 0.95), rgba(70, 20, 90, 0.95));
  border: 3px solid #eab308;
  box-shadow: 0 0 50px rgba(234, 179, 8, 0.7);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transform: scale(0.7) rotate(-5deg);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.win-modal-overlay.active .win-modal-card {
  transform: scale(1) rotate(0deg);
}

.win-modal-chicken {
  font-size: 84px;
  animation: chickenDance 0.6s infinite alternate cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 20px #eab308);
}

@keyframes chickenDance {
  0% { transform: scale(1) rotate(-8deg); }
  100% { transform: scale(1.25) rotate(8deg); }
}

.win-modal-card h2 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  color: #fef08a;
  text-shadow: 0 0 15px rgba(234, 179, 8, 0.8);
  line-height: 1.2;
}

.modal-btn {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #000;
  border: none;
  padding: 14px 28px;
  border-radius: 30px;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(234, 179, 8, 0.6);
  transition: all 0.2s ease;
  margin-top: 8px;
}

.modal-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 30px rgba(234, 179, 8, 0.9);
}

.minimal-app-container {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 110;
  position: relative;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  flex-wrap: wrap;
  gap: 10px;
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 26px;
}

.logo-box h1 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
}

.logo-box h1 span {
  color: var(--accent-primary);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Language Switcher Box */
.lang-switch-box {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
}

.reset-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  padding: 8px 16px;
  border-radius: 20px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reset-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

/* Base Card */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-main);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card.card-wrong {
  border-color: var(--accent-error) !important;
  box-shadow: 0 0 35px rgba(239, 68, 68, 0.6) !important;
}

/* 1. Camera Feed Card */
.camera-card {
  padding: 12px;
}

.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border-light);
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

#webcam {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  transition: transform 0.3s ease;
}

/* Rear / Environment Camera mode (unmirrored) */
#webcam.environment-cam {
  transform: scaleX(1) !important;
}

.detection-overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  transform: scaleX(-1);
  transition: transform 0.3s ease;
}

.detection-overlay-canvas.environment-cam {
  transform: scaleX(1) !important;
}

/* Floating Mobile Camera Switch Button */
.flip-cam-overlay-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
  color: #fff;
  padding: 8px 14px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: all 0.25s ease;
}

.flip-cam-overlay-btn:hover {
  background: rgba(168, 85, 247, 0.8);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

.flip-cam-overlay-btn:active {
  transform: scale(0.95);
}

/* Touch Marker */
.touch-marker {
  position: absolute;
  width: 50px;
  height: 50px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
  display: none;
}

.touch-marker.active {
  display: block;
  animation: touchPop 0.3s ease-out;
}

@keyframes touchPop {
  0% { transform: translate(-50%, -50%) scale(1.6); opacity: 0.5; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.touch-ring {
  width: 100%;
  height: 100%;
  border: 2px solid var(--accent-primary);
  border-radius: 50%;
  box-shadow: 0 0 15px var(--accent-primary);
  animation: touchPulse 1s infinite alternate;
}

@keyframes touchPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 1; }
}

.touch-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.click-hint-overlay {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 6;
}

.hidden {
  display: none !important;
}

/* 2. Nova Character Card (Directly Below Camera) */
.character-card {
  background: linear-gradient(135deg, rgba(30, 20, 60, 0.9), rgba(45, 25, 80, 0.9));
  border: 1px solid rgba(168, 85, 247, 0.4);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s ease;
}

.character-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.character-avatar-wrapper {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.character-avatar {
  font-size: 30px;
  animation: floatAvatar 3s infinite ease-in-out;
}

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

.character-avatar-wrapper.speaking {
  animation: avatarPulse 0.4s infinite alternate;
}

@keyframes avatarPulse {
  0% { transform: scale(1); box-shadow: 0 0 15px rgba(168, 85, 247, 0.5); }
  100% { transform: scale(1.08); box-shadow: 0 0 30px rgba(236, 72, 153, 0.8); }
}

/* Speaking Sound Waves Animation */
.speaking-waves {
  position: absolute;
  bottom: -4px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.character-avatar-wrapper.speaking .speaking-waves {
  opacity: 1;
}

.speaking-waves span {
  width: 4px;
  height: 12px;
  background: #fff;
  border-radius: 2px;
  animation: waveBar 0.5s infinite alternate;
}
.speaking-waves span:nth-child(2) { animation-delay: 0.15s; }
.speaking-waves span:nth-child(3) { animation-delay: 0.3s; }

@keyframes waveBar {
  0% { height: 4px; }
  100% { height: 14px; }
}

.character-meta h3 {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 800;
  color: #fff;
}

.character-meta h3 span {
  font-size: 11px;
  color: var(--accent-secondary);
  font-weight: 600;
  margin-left: 6px;
  background: rgba(236, 72, 153, 0.15);
  padding: 2px 8px;
  border-radius: 12px;
}

.char-status {
  font-size: 12px;
  color: #d8b4fe;
  font-weight: 500;
}

/* Speech Bubble */
.speech-bubble {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  position: relative;
}

.speech-bubble p {
  font-size: 15px;
  line-height: 1.5;
  color: #fff;
  font-weight: 600;
}

/* WIN STATE CELEBRATION */
.character-card.verdict-found {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.3), rgba(168, 85, 247, 0.3));
  border-color: #eab308;
  box-shadow: 0 0 40px rgba(234, 179, 8, 0.5);
  animation: winPulse 1s infinite alternate;
}

@keyframes winPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.02); }
}
