@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500;700&family=Outfit:wght@400;600;800&display=swap');

:root {
  --bg-color: #07070d;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --text-primary: #e8e6f0;
  --text-secondary: rgba(232, 230, 240, 0.55);
  --accent-primary: #a855f7;
  --accent-secondary: #06b6d4;
  --accent-glow: rgba(168, 85, 247, 0.4);
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --glass-filter: blur(20px);
}

/* Theme 2: 🔥 KYR SP33DY & Sidearms Crew Theme */
[data-theme="speedy-crew"] {
  --bg-color: #070c0e;
  --surface: rgba(34, 197, 94, 0.05);
  --surface-hover: rgba(34, 197, 94, 0.09);
  --border: rgba(34, 197, 94, 0.2);
  --text-primary: #f0fdf4;
  --text-secondary: rgba(240, 253, 244, 0.65);
  --accent-primary: #22c55e; /* Speedy Emerald Lime */
  --accent-secondary: #ef4444; /* Sidearms Crimson */
  --accent-glow: rgba(34, 197, 94, 0.5);
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
}

/* Theme 3: ⚡ Neon Cyberpunk */
[data-theme="neon-cyber"] {
  --bg-color: #0d021a;
  --surface: rgba(236, 72, 153, 0.05);
  --surface-hover: rgba(236, 72, 153, 0.1);
  --border: rgba(236, 72, 153, 0.25);
  --text-primary: #fdf2f8;
  --text-secondary: rgba(253, 242, 248, 0.65);
  --accent-primary: #ec4899; /* Hot Pink */
  --accent-secondary: #06b6d4; /* Electric Blue */
  --accent-glow: rgba(236, 72, 153, 0.5);
  --success: #06b6d4;
  --warning: #fbbf24;
  --danger: #ff0055;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--surface-hover);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
}

.text-gradient {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Background Animations */
.animated-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  background: 
    radial-gradient(circle at 15% 50%, rgba(168, 85, 247, 0.15), transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.15), transparent 50%);
  animation: pulse-bg 15s ease-in-out infinite alternate;
}

@keyframes pulse-bg {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 1; }
}

/* Glassmorphism Card */
.card {
  background: var(--surface);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

/* Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: 1fr 1fr; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* Buttons */
.btn {
  font-family: var(--font-body);
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1rem;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 0 15px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
  background: #b975f8;
  box-shadow: 0 0 25px var(--accent-glow);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.3);
}

/* Inputs */
.input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 1rem;
  transition: all 0.3s ease;
  width: 100%;
}
.input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.input.mono {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  letter-spacing: 2px;
  text-align: center;
}

/* Badges */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge.connected { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.badge.disconnected { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

/* Dashboard Layout */
.dashboard-header {
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 7, 13, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
}
@media (max-width: 992px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* Word Counter */
.word-counter-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}
.huge-number {
  font-family: var(--font-mono);
  font-size: 6rem;
  font-weight: 700;
  line-height: 1;
  margin: 24px 0;
  text-shadow: 0 0 40px var(--accent-glow);
  color: var(--text-primary);
  transition: color 0.3s ease;
}

/* Mic Button */
.mic-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}
.mic-btn svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}
.mic-btn.active {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  color: var(--danger);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}
.mic-btn.active::before {
  content: '';
  position: absolute;
  top: -10px; left: -10px; right: -10px; bottom: -10px;
  border-radius: 50%;
  border: 2px solid var(--danger);
  animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* Timer */
.timer-display {
  font-family: var(--font-mono);
  font-size: 4rem;
  font-weight: 700;
  text-align: center;
  margin: 16px 0;
  transition: color 0.3s ease;
}
.timer-display.color-green { color: var(--success); text-shadow: 0 0 20px rgba(34, 197, 94, 0.3); }
.timer-display.color-yellow { color: var(--warning); text-shadow: 0 0 20px rgba(234, 179, 8, 0.3); }
.timer-display.color-red { 
  color: var(--danger); 
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.5); 
  animation: pulse-text 1s infinite alternate;
}

@keyframes pulse-text {
  0% { opacity: 0.8; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1.02); }
}

.flash-time-add {
  animation: flash-green 0.5s ease-out;
}
@keyframes flash-green {
  0% { transform: scale(1.1); color: var(--success); text-shadow: 0 0 40px var(--success); }
  100% { transform: scale(1); }
}

/* Members List */
.member-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}
.member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.member-name { font-weight: 500; }
.member-count { font-family: var(--font-mono); color: var(--accent-secondary); font-weight: 700; }

/* Sub Feed */
.sub-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
  margin-top: 16px;
}
.sub-item {
  padding: 10px 14px;
  background: rgba(168, 85, 247, 0.1);
  border-left: 3px solid var(--accent-primary);
  border-radius: 4px;
  font-size: 0.9rem;
  animation: slide-in-right 0.3s ease-out forwards;
}

@keyframes slide-in-right {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Toasts */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toast {
  background: var(--surface);
  backdrop-filter: var(--glass-filter);
  border: 1px solid var(--border);
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  animation: slide-in-toast 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.toast.toast-error { border-left: 4px solid var(--danger); }
.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-info { border-left: 4px solid var(--accent-secondary); }

@keyframes slide-in-toast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast-fade-out {
  animation: fade-out 0.3s forwards;
}
@keyframes fade-out {
  to { opacity: 0; transform: translateY(-10px); }
}

/* Landing Page Specific */
.landing-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.landing-card {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

/* Word Budget Bar */
.budget-bar-container {
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
}
.budget-bar {
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  height: 48px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}
.budget-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  transition: width 0.5s ease;
  border-radius: 12px;
}
.budget-bar-fill.warning {
  background: linear-gradient(90deg, var(--warning), #f97316);
}
.budget-bar-fill.danger {
  background: linear-gradient(90deg, var(--danger), #dc2626);
}
.budget-bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Huge Remaining Words Countdown */
.huge-remaining-number {
  font-family: var(--font-mono);
  font-size: 6rem;
  font-weight: 800;
  line-height: 1;
  margin: 12px 0;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}
.huge-remaining-number.color-green {
  color: var(--success);
  text-shadow: 0 0 40px rgba(34, 197, 94, 0.4);
}
.huge-remaining-number.color-yellow {
  color: var(--warning);
  text-shadow: 0 0 40px rgba(234, 179, 8, 0.4);
}
.huge-remaining-number.color-red {
  color: var(--danger);
  text-shadow: 0 0 50px rgba(239, 68, 68, 0.6);
  animation: remaining-pulse 1.2s ease-in-out infinite alternate;
}
.huge-remaining-number.ended-text {
  font-family: var(--font-heading);
  font-size: 4rem;
  background: linear-gradient(135deg, var(--danger), #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(239, 68, 68, 0.6);
  animation: remaining-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes remaining-pulse {
  0% { transform: scale(0.98); opacity: 0.85; }
  100% { transform: scale(1.03); opacity: 1; }
}

@keyframes btn-glow-pulse {
  0% { transform: scale(1); box-shadow: 0 0 20px rgba(168, 85, 247, 0.4); }
  100% { transform: scale(1.04); box-shadow: 0 0 35px rgba(168, 85, 247, 0.8); }
}

/* Uniform Streamer Cards */
.streamers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
  padding: 0 24px 24px;
  max-width: 1600px;
  margin: 0 auto;
}
.streamer-card {
  text-align: center;
  padding: 32px 24px;
}
.streamer-name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--accent-secondary);
}
.streamer-word-count {
  font-family: var(--font-mono);
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
  margin: 16px 0;
  text-shadow: 0 0 40px var(--accent-glow);
}

/* Transcript area - Single Line Display */
.transcript-area {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 16px;
  height: 38px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 20px;
  text-align: center;
}
.transcript-area .new-word {
  color: var(--accent-secondary);
  animation: word-pop 0.3s ease;
}
@keyframes word-pop {
  0% { transform: scale(1.3); color: var(--accent-primary); }
  100% { transform: scale(1); }
}

/* Yapathon Ended Overlay */
.yapathon-ended-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(7, 7, 13, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.yapathon-ended-text {
  font-family: var(--font-heading);
  font-size: 5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  animation: ended-pulse 2s ease-in-out infinite alternate;
}
@keyframes ended-pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.05); opacity: 1; }
}

/* Removable Side Ad Widget (thefocusfuel.com) */
.side-ad-widget {
  position: fixed;
  right: 24px;
  top: 100px;
  width: 290px;
  background: var(--surface);
  backdrop-filter: var(--glass-filter);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  z-index: 90;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  transition: all 0.3s ease;
}
.side-ad-widget:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 30px var(--accent-glow);
}
.side-ad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.side-ad-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-primary);
  background: rgba(34, 197, 94, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.side-ad-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 3px 8px;
  border-radius: 6px;
}
.side-ad-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.12);
}
.side-ad-img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  transition: opacity 0.3s ease;
}
.ad-flavor-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 8px;
  cursor: pointer;
  flex: 1;
  text-align: center;
  transition: all 0.2s ease;
}
.ad-flavor-btn:hover, .ad-flavor-btn.active {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}
.side-ad-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.side-ad-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 6px 0 14px;
  line-height: 1.35;
}
.side-ad-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: transform 0.2s ease;
}
.side-ad-btn:hover {
  transform: translateY(-2px);
}

/* Toggle Switch */
.switch input:checked + .slider {
  background-color: var(--accent-primary) !important;
}
.switch input:checked + .slider:before {
  transform: translateX(20px);
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

/* Controls Panel */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 0 24px 24px;
  max-width: 1600px;
  margin: 0 auto;
  align-items: flex-end;
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.control-group label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.control-group .input {
  width: 140px;
}
