@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Chakra+Petch:ital,wght@0,600;0,700;1,700&family=Orbitron:wght@600;800;900&family=Rajdhani:wght@600;700&display=swap');

:root {
  /* Color Palette - Sleek Modern Racing Telemetry Theme */
  --bg-dark: #090d16;
  --bg-dashboard: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #26334d;
  --bg-input: #0f172a;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.12);
  --border-active: #38bdf8;
  
  --primary-cyan: #38bdf8;
  --primary-red: #f43f5e;
  --primary-yellow: #eab308;
  --primary-green: #22c55e;
  --accent-purple: #a855f7;
  --accent-indigo: #6366f1;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  /* Fonts */
  --font-hud: 'Orbitron', sans-serif;
  --font-sub: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-data: 'Rajdhani', sans-serif;
  
  /* Radii & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --glow-cyan: 0 4px 20px rgba(56, 189, 248, 0.25);
  --glow-red: 0 4px 20px rgba(244, 63, 94, 0.25);
  --glow-yellow: 0 4px 20px rgba(234, 179, 8, 0.25);
  --glow-green: 0 4px 20px rgba(34, 197, 94, 0.25);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--font-sub);
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Drag and Drop Active State in Editor Preview */
.is-dragging {
  z-index: 99999 !important;
  opacity: 0.92 !important;
  cursor: grabbing !important;
  box-shadow: 0 0 35px var(--primary-cyan) !important;
}

/* Live Resize Handle for Chat Box in Editor Mode */
body:not(.obs-mode) .chat-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 22px;
  height: 22px;
  cursor: se-resize;
  z-index: 1000;
  background: linear-gradient(135deg, transparent 50%, var(--primary-cyan) 50%);
  border-bottom-right-radius: 4px;
}

body.obs-mode .chat-resize-handle {
  display: none !important;
}

body:not(.obs-mode) .chat-box-widget,
body:not(.obs-mode) .cam-frame-container,
body:not(.obs-mode) .ticker-widget-container,
body:not(.obs-mode) .alert-widget-container,
body:not(.obs-mode) .minimal-text-widget {
  z-index: 1000 !important;
}

/* -------------------------------------------------------------
   OBS CANVAS MODE - 100% ALPHA TRANSPARENT FOR OBS STUDIO
   Ensure NO solid background, grid, or wrapper covers gameplay
------------------------------------------------------------- */
body.obs-mode,
body.obs-mode.carbon-bg,
body.obs-mode .app-container,
body.obs-mode .stage-preview-wrapper,
body.obs-mode .obs-stage {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  overflow: hidden;
}

body.obs-mode .preview-grid-overlay,
body.obs-mode .dashboard-container {
  display: none !important;
}

/* Layout Container for Dashboard & Overlay View */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Clean Matte Dark Background for Editor Dashboard (No AI Carbon Textures) */
.carbon-bg {
  background-color: #080a0e;
  background-image: radial-gradient(circle at 50% 0%, rgba(20, 28, 42, 0.5) 0%, #080a0e 80%);
}

/* -------------------------------------------------------------
   OBS OVERLAY STAGE (1920x1080 Viewport Canvas)
------------------------------------------------------------- */
.obs-stage {
  position: relative;
  width: 100%;
  max-width: 1920px;
  height: 1080px;
  margin: 0 auto;
  pointer-events: none;
  overflow: hidden;
}

.obs-stage * {
  pointer-events: auto;
}

/* Stage Preview Canvas in Dashboard */
.stage-preview-wrapper {
  background: #090c12;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  transform-origin: top left;
}

.preview-grid-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, rgba(255,255,255,0.02) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* -------------------------------------------------------------
   1. WEBCAM FRAME WIDGET (100% Transparent Cutout for OBS Cam)
------------------------------------------------------------- */
.cam-frame-widget {
  position: absolute;
  bottom: 80px;
  left: 60px;
  width: 420px;
  height: 250px;
  z-index: 10;
  transition: box-shadow 0.2s ease, transform 0.1s ease;
  user-select: none;
}

/* Draggable styling in Editor mode */
body:not(.obs-mode) .cam-frame-widget,
body:not(.obs-mode) .chat-box-widget,
body:not(.obs-mode) .alert-widget-container,
body:not(.obs-mode) .ticker-bar-widget {
  cursor: grab;
  position: absolute;
}

body:not(.obs-mode) .cam-frame-widget:hover,
body:not(.obs-mode) .chat-box-widget:hover,
body:not(.obs-mode) .ticker-bar-widget:hover {
  outline: 1px dashed var(--primary-cyan);
  outline-offset: 4px;
}

body:not(.obs-mode) .is-dragging {
  cursor: grabbing !important;
  opacity: 0.88;
  transform: scale(1.01);
  z-index: 100 !important;
  outline: 2px solid var(--primary-cyan) !important;
}

.drag-badge {
  display: none;
  position: absolute;
  top: -24px;
  right: 0;
  background: var(--primary-cyan);
  color: #000;
  font-family: var(--font-hud);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
}

body:not(.obs-mode) .cam-frame-widget:hover .drag-badge,
body:not(.obs-mode) .chat-box-widget:hover .drag-badge,
body:not(.obs-mode) .ticker-bar-widget:hover .drag-badge,
body:not(.obs-mode) .minimal-text-widget:hover .drag-badge {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cam-frame-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  border: 3px solid var(--primary-cyan);
  background: transparent !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Camera Cutout - Pure 100% Transparent Center */
.cam-placeholder {
  width: 100%;
  height: 100%;
  background: transparent !important;
  backdrop-filter: none !important;
  border-radius: calc(var(--radius-md) - 2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: none;
}

/* Faint Camera bounds indicator visible ONLY in editor dashboard mode */
body:not(.obs-mode) .cam-placeholder::before {
  content: 'WEBCAM CUTOUT (TRANSPARENT IN OBS)';
  font-family: var(--font-hud);
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 1.5px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  padding: 12px 20px;
  border-radius: 6px;
  pointer-events: none;
}

body.obs-mode .cam-placeholder::before {
  display: none !important;
}

.cam-placeholder-icon {
  font-size: 2.5rem;
  color: var(--primary-cyan);
  margin-bottom: 6px;
  opacity: 0.8;
  animation: pulseIcon 3s infinite alternate;
}

@keyframes pulseIcon {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 8px var(--primary-cyan)); }
}

/* RPM LED Bar Top Border */
.cam-rpm-bar {
  position: absolute;
  top: -16px;
  left: 10px;
  right: 10px;
  height: 12px;
  background: rgba(10, 14, 23, 0.9);
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  display: flex;
  padding: 2px;
  gap: 3px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.rpm-led {
  flex: 1;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.rpm-led.green.active {
  background: var(--primary-green);
  box-shadow: 0 0 8px var(--primary-green);
}
.rpm-led.yellow.active {
  background: var(--primary-yellow);
  box-shadow: 0 0 8px var(--primary-yellow);
}
.rpm-led.red.active {
  background: var(--primary-red);
  box-shadow: 0 0 10px var(--primary-red);
  animation: flashRed 0.4s infinite alternate;
}

@keyframes flashRed {
  0% { opacity: 0.7; }
  100% { opacity: 1; filter: brightness(1.4); }
}

/* Driver Tag Badge at Bottom */
.cam-driver-tag {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #131924 0%, #1e2838 50%, #131924 100%);
  border: 1px solid var(--primary-cyan);
  padding: 4px 18px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8), var(--glow-cyan);
  white-space: nowrap;
}

.driver-flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(to bottom, #000 33%, #dd0000 33%, #dd0000 66%, #ffce00 66%);
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
  display: inline-block;
  flex-shrink: 0;
}

.driver-flag.flag-de { background: linear-gradient(to bottom, #000 33%, #dd0000 33%, #dd0000 66%, #ffce00 66%); }
.driver-flag.flag-at { background: linear-gradient(to bottom, #ed2939 33%, #fff 33%, #fff 66%, #ed2939 66%); }
.driver-flag.flag-ch { background: #d52b1e; }
.driver-flag.flag-gb { background: linear-gradient(to bottom, #00247d 33%, #cf142b 33%, #cf142b 66%, #00247d 66%); }
.driver-flag.flag-us { background: linear-gradient(to bottom, #b22234 33%, #fff 33%, #fff 66%, #3c3b6e 66%); }
.driver-flag.flag-nl { background: linear-gradient(to bottom, #ae1c28 33%, #fff 33%, #fff 66%, #21468b 66%); }
.driver-flag.flag-fr { background: linear-gradient(to right, #002395 33%, #fff 33%, #fff 66%, #ed2939 66%); }
.driver-flag.flag-it { background: linear-gradient(to right, #009246 33%, #fff 33%, #fff 66%, #ce2b37 66%); }
.driver-flag.flag-es { background: linear-gradient(to bottom, #aa1523 25%, #f1bf00 25%, #f1bf00 75%, #aa1523 75%); }
.driver-flag.flag-racing { background: repeating-conic-gradient(#000 0% 25%, #fff 0% 50%) 50% / 8px 8px; }

.driver-name {
  font-family: var(--font-hud);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 1.5px;
  color: #ffffff;
  text-transform: uppercase;
}

.driver-pos {
  font-family: var(--font-hud);
  font-weight: 900;
  font-size: 0.8rem;
  color: var(--primary-yellow);
  background: rgba(255, 230, 0, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 230, 0, 0.4);
}

/* Frame Corner Tech Accents */
.cam-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--primary-cyan);
  border-style: solid;
  pointer-events: none;
}
.cam-corner.top-left { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.cam-corner.top-right { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.cam-corner.bottom-left { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.cam-corner.bottom-right { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }

/* -------------------------------------------------------------
   2. STREAM CHAT BOX WIDGET
------------------------------------------------------------- */
.chat-box-widget {
  position: absolute;
  bottom: 80px;
  right: 60px;
  width: 380px;
  height: 480px;
  z-index: 500 !important;
  display: flex;
  flex-direction: column;
}

.chat-box-header {
  background: rgba(13, 19, 29, 0.9);
  border: 1px solid var(--border-glass);
  border-bottom: none;
  padding: 8px 14px;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
}

.chat-title {
  font-family: var(--font-hud);
  font-size: 0.85rem;
  letter-spacing: 1px;
  color: var(--primary-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary-green);
  box-shadow: 0 0 8px var(--primary-green);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.chat-messages-container {
  flex: 1;
  background: rgba(8, 12, 19, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  padding: 10px;
  overflow-y: auto;
  overflow-x: hidden !important;
  display: flex;
  flex-direction: column;
  gap: var(--chat-msg-gap, 5px);
  scroll-behavior: smooth;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.chat-messages-container::-webkit-scrollbar {
  width: 4px;
  height: 0px;
}
.chat-messages-container::-webkit-scrollbar-thumb {
  background: var(--primary-cyan);
  border-radius: 4px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  background: rgba(18, 25, 38, 0.75);
  border-left: 3px solid var(--primary-cyan);
  padding: 5px 8px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.4s ease, margin 0.4s ease, padding 0.4s ease;
  max-height: 200px;
}

.chat-message.fade-out {
  opacity: 0 !important;
  transform: translateY(-8px) scale(0.95) !important;
  max-height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: -10px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border: none !important;
  overflow: hidden !important;
}

/* Selectable Entrance Animations */
.chat-message.anim-slide {
  animation: chatSlideIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.chat-message.anim-pop {
  animation: chatPopIn 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.chat-message.anim-fade {
  animation: chatFadeIn 0.4s ease-out forwards;
}

@keyframes chatPopIn {
  0% { opacity: 0; transform: scale(0.6) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes chatFadeIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Inline & Compact Message Formats ("Name: Message") */
.chat-message.fmt-inline,
.chat-message.fmt-compact {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-message.fmt-inline .chat-user-row,
.chat-message.fmt-compact .chat-user-row {
  margin-bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-message.fmt-inline .chat-text,
.chat-message.fmt-compact .chat-text {
  display: inline;
}

/* Minimal / Borderless Chat Style (ONLY messages with animation, NO header, NO box frame, NO background) */
.chat-box-widget.style-minimal .chat-box-header {
  display: none !important;
}

.chat-box-widget.style-minimal .chat-messages-container {
  background: transparent !important;
  backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.chat-box-widget.style-minimal .chat-message {
  background: transparent !important;
  border: none !important;
  border-left: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  padding: 4px 0 !important;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95), 0 2px 8px #000000;
}

/* Compact Bubble Chat Style */
.chat-box-widget.style-bubble .chat-box-header {
  display: none !important;
}

.chat-box-widget.style-bubble .chat-messages-container {
  background: transparent !important;
  backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.chat-box-widget.style-bubble .chat-message {
  background: rgba(18, 25, 38, 0.85) !important;
  border-left: none !important;
  border-radius: 16px !important;
  padding: 8px 14px !important;
  align-self: flex-start;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Dashboard Mode Visual Outlines for Transparent & Hidden Widgets */
body:not(.obs-mode) .chat-box-widget.style-minimal,
body:not(.obs-mode) .chat-box-widget.style-bubble {
  outline: 2px dashed rgba(0, 243, 255, 0.4);
  outline-offset: 2px;
  border-radius: 6px;
}

body:not(.obs-mode) .chat-box-widget.style-minimal::before {
  content: '💬 CHAT ZONE (TRANSPARENT)';
  position: absolute;
  top: 6px;
  right: 10px;
  font-family: var(--font-hud);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--primary-cyan);
  opacity: 0.7;
  pointer-events: none;
  background: rgba(0,0,0,0.6);
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 5;
}

body:not(.obs-mode) .alert-widget-container {
  outline: 2px dashed rgba(255, 42, 95, 0.4);
  outline-offset: 4px;
  border-radius: 8px;
  min-width: 340px;
  min-height: 120px;
}

body:not(.obs-mode) .alert-widget-container:not(.active)::after {
  content: '⚡ RACING ALERTS ZONE (CENTER)';
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  font-family: var(--font-hud);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary-red);
  opacity: 0.6;
  text-shadow: 0 1px 4px #000;
  padding: 20px;
  box-sizing: border-box;
}

body:not(.obs-mode) .minimal-text-widget.style-minimal {
  outline: 1px dashed rgba(0, 243, 255, 0.4);
  outline-offset: 2px;
  border-radius: 4px;
}

@keyframes chatSlideIn {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.chat-user-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.chat-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}
.chat-badge.mod { background: #00e676; color: #000; }
.chat-badge.vip { background: #e040fb; color: #fff; }
.chat-badge.sub { background: #ff9100; color: #000; }
.chat-badge.driver { background: var(--primary-cyan); color: #000; font-family: var(--font-hud); }

.chat-username {
  font-family: var(--font-sub);
  font-weight: var(--chat-font-weight, 800);
  font-size: 0.9rem;
  color: #ffffff;
}

.chat-text {
  font-family: var(--font-data);
  font-weight: var(--chat-font-weight, 700);
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: var(--chat-line-height, 1.15);
  word-break: break-word;
}

/* -------------------------------------------------------------
   3. RACING ALERTS WIDGET (CENTER STAGE)
------------------------------------------------------------- */
.alert-widget-container {
  position: absolute;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  width: 580px;
  z-index: 50;
  pointer-events: none;
}

.alert-card {
  background: linear-gradient(135deg, rgba(13, 19, 29, 0.95) 0%, rgba(20, 30, 48, 0.95) 100%);
  border: 2px solid var(--primary-cyan);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), var(--glow-cyan);
  text-align: center;
  backdrop-filter: blur(15px);
  position: relative;
  overflow: hidden;

  /* Alert Enter/Exit Animations */
  opacity: 0;
  transform: translateY(-40px) scale(0.9);
  transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.alert-card.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Alert Style Presets */

/* 1. Minimalist Banner Style */
.alert-card.style-banner {
  background: linear-gradient(90deg, rgba(13, 19, 29, 0.95) 0%, rgba(20, 30, 48, 0.95) 100%);
  border-radius: 50px;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  gap: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}

.alert-card.style-banner .alert-lights-bar {
  display: none !important;
}

.alert-card.style-banner .alert-title {
  font-size: 1.3rem;
  margin-bottom: 0;
}

.alert-card.style-banner .alert-type-badge {
  margin-bottom: 0;
  white-space: nowrap;
}

.alert-card.style-banner .alert-subtext {
  margin-top: 0;
}

/* 2. Pit Stop Popup Style */
.alert-card.style-popup {
  background: rgba(12, 16, 25, 0.92);
  border-radius: 12px;
  border-left-width: 8px !important;
  border-top-width: 1px;
  border-right-width: 1px;
  border-bottom-width: 1px;
  padding: 16px 20px;
  text-align: left;
  box-shadow: 0 12px 35px rgba(0,0,0,0.8);
}

.alert-card.style-popup .alert-lights-bar {
  display: none !important;
}

.alert-card.style-popup .alert-title {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

/* F1 Starting Lights Header */
.alert-lights-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: inline-flex;
}

.start-light {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2a2a2a;
  border: 2px solid #111;
  transition: all 0.1s ease;
}

.start-light.red {
  background: var(--primary-red);
  box-shadow: 0 0 12px var(--primary-red);
}

.start-light.green {
  background: var(--primary-green);
  box-shadow: 0 0 16px var(--primary-green);
}

.alert-type-badge {
  font-family: var(--font-hud);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--primary-yellow);
  margin-bottom: 6px;
}

.alert-title {
  font-family: var(--font-hud);
  font-size: 1.8rem;
  font-weight: 900;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(0,0,0,0.8);
  margin-bottom: 8px;
}

.alert-title span {
  color: var(--primary-cyan);
}

.alert-subtext {
  font-family: var(--font-sub);
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.alert-subtext .highlight {
  color: var(--primary-green);
  font-weight: 700;
}

/* Checkered Sweep Effect */
.alert-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transform: skewX(-25deg);
}

.alert-card.active::before {
  animation: shineSweep 1.5s ease infinite;
}

@keyframes shineSweep {
  0% { left: -100%; }
  100% { left: 200%; }
}

/* -------------------------------------------------------------
   4. TELEMETRY STREAM TICKER BAR (TOP / BOTTOM)
------------------------------------------------------------- */
.ticker-bar-widget {
  position: absolute;
  top: 20px;
  left: 60px;
  right: 60px;
  height: 48px;
  z-index: 10;
  background: rgba(10, 14, 23, 0.85);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  padding: 0 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

.ticker-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hud);
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--primary-cyan);
  padding-right: 20px;
  border-right: 2px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 1px;
}

.ticker-brand i {
  color: var(--primary-red);
}

.ticker-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-around;
  overflow: hidden;
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-data);
  font-weight: 700;
  font-size: 1rem;
}

.ticker-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ticker-val {
  color: #ffffff;
}

.ticker-item i {
  color: var(--primary-yellow);
}

/* -------------------------------------------------------------
   5. STREAMER CONTROL DASHBOARD PANEL (CLEAN MODERN UI)
------------------------------------------------------------- */
.dashboard-container {
  max-width: 1440px;
  margin: 24px auto 60px auto;
  padding: 0 20px;
  width: 100%;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.dash-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-title h1 {
  font-family: var(--font-sub);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.dash-badge {
  background: var(--primary-cyan);
  color: #090d16;
  font-family: var(--font-sub);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Main Dashboard Navigation Tab Bar */
.dash-nav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-dashboard);
  padding: 6px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow-x: auto;
}

.dash-nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-sub);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dash-nav-tab i {
  font-size: 1rem;
  color: var(--text-dim);
  transition: color 0.2s ease;
}

.dash-nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.dash-nav-tab.active {
  color: #ffffff;
  background: var(--bg-card);
  border-color: var(--border-card);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dash-nav-tab.active i {
  color: var(--primary-cyan);
}

/* Tab Panes */
.dash-tab-pane {
  display: none;
  animation: fadeInPane 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.dash-tab-pane.active {
  display: block;
}

@keyframes fadeInPane {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card System */
.dash-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dash-grid-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

@media (max-width: 1024px) {
  .dash-grid-2col, .dash-grid-3col {
    grid-template-columns: 1fr;
  }
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.2s ease;
}

.dash-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.card-title {
  font-family: var(--font-sub);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  margin-bottom: 4px;
}

.card-title-text {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title-text i {
  color: var(--primary-cyan);
  font-size: 1.1rem;
}

.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: -8px;
}

/* Modern Toggle Switch */
.toggle-switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-dashboard);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s ease;
}

.toggle-switch-container:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.toggle-switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary-cyan);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Button & Controls System */
.btn-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.btn {
  font-family: var(--font-sub);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-cyan {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--primary-cyan);
}
.btn-cyan:hover {
  background: var(--primary-cyan);
  color: #0f172a;
  box-shadow: var(--glow-cyan);
}

.btn-red {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: var(--primary-red);
}
.btn-red:hover {
  background: var(--primary-red);
  color: #fff;
  box-shadow: var(--glow-red);
}

.btn-yellow {
  background: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.4);
  color: var(--primary-yellow);
}
.btn-yellow:hover {
  background: var(--primary-yellow);
  color: #0f172a;
  box-shadow: var(--glow-yellow);
}

.btn-green {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--primary-green);
}
.btn-green:hover {
  background: var(--primary-green);
  color: #0f172a;
  box-shadow: var(--glow-green);
}

.btn-outline {
  background: var(--bg-dashboard);
  border-color: var(--border-card);
  color: var(--text-main);
}
.btn-outline:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-family: var(--font-sub);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label-val {
  color: var(--primary-cyan);
  font-weight: 700;
}

.form-input {
  font-family: var(--font-sub);
  background: var(--bg-dashboard);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 9px 13px;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* Custom Range Slider Inputs */
.form-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #334155;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-cyan);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Overlay Widgets Transform Scaling Origin Defaults */
.cam-frame-widget {
  transform-origin: top left;
}

.chat-box-widget {
  transform-origin: bottom right;
}

.ticker-bar-widget {
  transform-origin: top left;
}

.alert-widget-container {
  transform-origin: top center;
}

/* OBS URL Links Container */
.obs-link-box {
  background: rgba(8, 12, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.obs-link-text {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--primary-cyan);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sound indicator badge */
.sound-toggle-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-hud);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sound-toggle-indicator.active {
  color: var(--primary-green);
}

/* Minimal Standalone Text Widgets */
.minimal-text-widget {
  position: absolute;
  z-index: 10;
  cursor: grab;
  user-select: none;
  transform-origin: top left;
}

.minimal-widget-content {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 14, 23, 0.8);
  border: 1px solid var(--border-glass);
  padding: 6px 14px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.minimal-text-widget.style-minimal .minimal-widget-content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  padding: 0 !important;
  text-shadow: 0 1px 6px rgba(0,0,0,0.95), 0 2px 8px #000000;
}

.minimal-label {
  font-family: var(--font-hud);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.minimal-val {
  font-family: var(--font-sub);
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
}

/* -------------------------------------------------------------
   Full-Screen Stream Screens (Starting Soon, Pause, Ending)
------------------------------------------------------------- */
.stream-screen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  background: radial-gradient(circle at center, #0f172a 0%, #05080f 100%) !important;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

body.obs-mode .stream-screen-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 100 !important;
}

/* Ensure Chat, Ticker, Standalone Text Widgets & Alerts sit ON TOP of Stream Screens */
.chat-box-widget,
.ticker-widget-container,
.minimal-text-widget {
  z-index: 500 !important;
}

.alert-widget-container {
  z-index: 600 !important;
}

.cam-frame-widget {
  z-index: 50;
}

.stream-screen-overlay.active {
  display: flex !important;
  animation: chatFadeIn 0.4s ease-out forwards;
}

.screen-bg-effects {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.screen-glowing-grid {
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(0, 243, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridPulse 4s infinite alternate;
}

@keyframes gridPulse {
  0% { opacity: 0.3; transform: scale(1); }
  100% { opacity: 0.7; transform: scale(1.02); }
}

.screen-content-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 900px;
  padding: 40px;
}

.screen-badge {
  font-family: var(--font-hud);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--primary-cyan);
  background: rgba(0, 243, 255, 0.1);
  border: 1px solid var(--primary-cyan);
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 20px;
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
}

.screen-badge.yellow {
  color: var(--primary-yellow);
  border-color: var(--primary-yellow);
  background: rgba(255, 230, 0, 0.1);
  box-shadow: 0 0 15px rgba(255, 230, 0, 0.3);
}

.screen-badge.red {
  color: var(--primary-red);
  border-color: var(--primary-red);
  background: rgba(255, 42, 95, 0.1);
  box-shadow: 0 0 15px rgba(255, 42, 95, 0.3);
}

.screen-main-title {
  font-family: var(--font-hud);
  font-size: 3.5rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(0, 243, 255, 0.5), 0 4px 10px rgba(0,0,0,0.8);
  margin-bottom: 10px;
}

.screen-subtitle {
  font-family: var(--font-sub);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 30px;
}

.starting-timer-box {
  background: rgba(10, 15, 26, 0.9);
  border: 2px solid var(--primary-cyan);
  box-shadow: 0 0 30px rgba(0, 243, 255, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px 50px;
  margin-bottom: 35px;
}

.timer-display {
  font-family: var(--font-hud);
  font-size: 4.5rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 6px;
  text-shadow: 0 0 15px var(--primary-cyan);
}

.timer-sublabel {
  font-family: var(--font-hud);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-muted);
}

.screen-info-cards {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.screen-info-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(18, 25, 38, 0.85);
  border: 1px solid var(--border-glass);
  padding: 10px 18px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  text-align: left;
}

.screen-info-card i {
  font-size: 1.4rem;
}

.info-card-label {
  display: block;
  font-family: var(--font-hud);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.info-card-val {
  display: block;
  font-family: var(--font-sub);
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
}

/* Just Chatting Layout */
#screen-chatting {
  background: transparent !important;
  backdrop-filter: none !important;
}

.screen-chatting-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  background: #05080f !important;
  pointer-events: none;
  z-index: 1;
  /* Exact pixel cutout hole matching camera frame (left: 70px, top: 100px, width: 1140px, height: 880px) */
  clip-path: polygon(
    0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%,
    70px 100px, 70px 980px, 1210px 980px, 1210px 100px, 70px 100px
  );
}

body.obs-mode .screen-chatting-bg {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 1920px !important;
  height: 1080px !important;
  clip-path: polygon(
    0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%,
    70px 100px, 70px 980px, 1210px 980px, 1210px 100px, 70px 100px
  ) !important;
}

.chatting-screen-wrapper {
  position: absolute;
  top: 100px;
  left: 70px;
  width: 1780px;
  height: 880px;
  z-index: 10;
  display: flex;
  gap: 40px;
  align-items: stretch;
}

.chatting-cam-container {
  width: 1140px;
  height: 880px;
  flex: none;
  display: flex;
  flex-direction: column;
}

.chatting-cam-frame {
  position: relative;
  width: 1140px;
  height: 880px;
  background: transparent !important;
  border: 3px solid var(--primary-cyan);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 25px rgba(0, 243, 255, 0.6);
  display: flex;
  flex-direction: column;
}

.chatting-cam-cutout {
  width: 100%;
  flex: 1;
  background: transparent !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

body:not(.obs-mode) .chatting-cam-cutout::before {
  content: '📷 WEBCAM CUTOUT (TRANSPARENT IN OBS)';
  font-family: var(--font-hud);
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(0, 243, 255, 0.5);
  border: 2px dashed rgba(0, 243, 255, 0.3);
  padding: 16px 24px;
  border-radius: 8px;
}

.chatting-side-container {
  width: 600px;
  height: 880px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #0a0f1a;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.chatting-header-badge {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--primary-cyan);
  background: #0a0f1a;
  border: 1px solid var(--primary-cyan);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

/* -------------------------------------------------------------
   AUTH LOGIN MODAL OVERLAY (DASHBOARD SECURITY)
------------------------------------------------------------- */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 14, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-dashboard-card);
  border: 1px solid var(--primary-cyan);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 0 35px rgba(0, 243, 255, 0.25), 0 20px 40px rgba(0, 0, 0, 0.8);
  text-align: center;
  animation: authModalPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes authModalPop {
  0% { opacity: 0; transform: scale(0.85) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px auto;
  border-radius: 50%;
  background: rgba(0, 243, 255, 0.1);
  border: 2px solid var(--primary-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--primary-cyan);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
}

