/**
 * OfferPulse Design System & Toolset Stylesheet
 * Cyber-SaaS Aesthetic: Obsidian Dark / Crisp Light, Neon Pulse Accents, Glassmorphism
 */

:root {
  /* Dark Mode Palette (Default) */
  --bg-primary: #0a0d14;
  --bg-secondary: #111622;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 34, 52, 0.85);
  --bg-input: #0e131f;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(6, 182, 212, 0.4);
  --chip-bg: rgba(255, 255, 255, 0.08);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Brand Accents */
  --pulse-cyan: #06b6d4;
  --pulse-blue: #3b82f6;
  --pulse-indigo: #6366f1;
  --pulse-emerald: #10b981;
  --pulse-amber: #f59e0b;
  --pulse-rose: #f43f5e;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #6366f1 100%);
  --grad-pulse: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --grad-warning: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --grad-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --glow-cyan: 0 0 20px rgba(6, 182, 212, 0.35);
  --glow-emerald: 0 0 20px rgba(16, 185, 129, 0.35);
  --glow-rose: 0 0 20px rgba(244, 63, 94, 0.35);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Cascadia Code', 'SF Mono', 'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: #ffffff;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-highlight: rgba(6, 182, 212, 0.6);
  --chip-bg: rgba(15, 23, 42, 0.07);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.08);
  --glow-cyan: 0 0 16px rgba(6, 182, 212, 0.2);
  --glow-emerald: 0 0 16px rgba(16, 185, 129, 0.2);
  --glow-rose: 0 0 16px rgba(244, 63, 94, 0.2);
  --grad-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 250, 252, 0.8) 100%);
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background: var(--bg-primary);
}

/* Background Atmospheric Radial Mesh */
body::before {
  content: '';
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, rgba(59, 130, 246, 0.06) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* App Container */
.app-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px 24px 60px;
  position: relative;
  z-index: 1;
}

/* Header & Nav */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(59, 130, 246, 0.2));
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.brand-pulse-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--pulse-cyan);
  border-radius: 50%;
  box-shadow: var(--glow-cyan);
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7); }
  70% { transform: scale(1.3); box-shadow: 0 0 0 8px rgba(6, 182, 212, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--pulse-cyan);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Nav Tabs */
.tabs-container {
  display: flex;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.tab-btn.active svg {
  color: var(--pulse-cyan);
}

/* Action Icon Buttons */
.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

/* Hero Section */
.hero-banner {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  max-width: 820px;
}

.hero-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(16, 185, 129, 0.12);
  color: var(--pulse-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.away {
  background: rgba(244, 63, 94, 0.15);
  color: var(--pulse-rose);
  border-color: rgba(244, 63, 94, 0.4);
}

.status-pill.away .pulse-led {
  background: var(--pulse-rose);
  box-shadow: var(--glow-rose);
}

.pulse-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pulse-emerald);
  box-shadow: var(--glow-emerald);
  animation: led-blink 1.5s ease-in-out infinite alternate;
}

@keyframes led-blink {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--grad-primary);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(6, 182, 212, 0.45);
}

.btn-secondary {
  background: var(--bg-input);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--pulse-rose);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.25);
  box-shadow: var(--glow-rose);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Tool Grid / Cards */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-highlight);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--pulse-cyan);
}

.card-icon-wrap.video {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.25);
  color: var(--pulse-indigo);
}

.card-icon-wrap.keyboard {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--pulse-emerald);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.card-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.card-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.card-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.card-features li svg {
  color: var(--pulse-emerald);
  flex-shrink: 0;
}

/* Tool Content Panel */
.panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.panel.active {
  display: block;
}

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

/* Stats Metric Cards */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s ease;
}

.metric-card:hover {
  border-color: var(--border-highlight);
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.metric-value.highlight-cyan { color: var(--pulse-cyan); }
.metric-value.highlight-emerald { color: var(--pulse-emerald); }
.metric-value.highlight-rose { color: var(--pulse-rose); }
.metric-value.highlight-amber { color: var(--pulse-amber); }

/* Control Strip */
.control-strip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* Settings Toggle Checkbox Grid */
.settings-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  align-items: center;
}

.custom-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.custom-checkbox input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.custom-checkbox input[type="checkbox"]:checked {
  background: var(--pulse-cyan);
  border-color: var(--pulse-cyan);
}

.custom-checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 11px;
  font-weight: bold;
}

/* Activity / Telemetry Timeline */
.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.timeline-bar-wrap {
  position: relative;
  width: 100%;
  height: 24px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.timeline-segment {
  height: 100%;
  transition: width 0.3s ease;
}

.timeline-segment.active { background: var(--pulse-emerald); }
.timeline-segment.away { background: var(--pulse-rose); }
.timeline-segment.away.away-live {
  background: repeating-linear-gradient(45deg, var(--pulse-rose), var(--pulse-rose) 6px, rgba(244, 63, 94, 0.45) 6px, rgba(244, 63, 94, 0.45) 12px);
  animation: away-live-scroll 0.8s linear infinite;
}

@keyframes away-live-scroll {
  from { background-position: 0 0; }
  to { background-position: 24px 0; }
}

/* History Feed */
.history-feed {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
  transition: background 0.2s ease;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item:hover {
  background: var(--bg-card-hover);
}

.history-time {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.history-badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(244, 63, 94, 0.15);
  color: var(--pulse-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.history-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Screen Share Video Stream Layout */
.stream-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.stream-monitor {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.stream-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-color);
}

.stream-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.stream-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.stream-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stream-watermark {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--font-mono);
  pointer-events: none;
}

.stream-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.stream-placeholder svg {
  opacity: 0.4;
}

/* Keyboard Events Section */
.keystroke-input-wrap {
  margin-bottom: 20px;
}

.key-input {
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.1rem;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.key-input:focus {
  outline: none;
  border-color: var(--pulse-cyan);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.15);
}

.key-event-stream {
  height: 400px;
  overflow-y: auto;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.key-pill-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.key-pill-row:hover {
  border-color: var(--border-highlight);
  transform: translateX(3px);
}

.event-type-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.event-type-badge.keydown { background: rgba(16, 185, 129, 0.15); color: var(--pulse-emerald); }
.event-type-badge.keyup { background: rgba(244, 63, 94, 0.15); color: var(--pulse-rose); }
.event-type-badge.keypress { background: rgba(6, 182, 212, 0.15); color: var(--pulse-cyan); }

.key-name-val {
  font-weight: 700;
  color: var(--text-primary);
  background: var(--chip-bg);
  padding: 2px 8px;
  border-radius: 4px;
}

.modifier-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--pulse-amber);
}

/* Floating HUD Key Indicator */
.floating-hud {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  box-shadow: var(--shadow-lg), var(--glow-cyan);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 1000;
  transform: perspective(700px) rotateX(65deg) translateZ(-60px) scale(0.7);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.18, 1.4, 0.3, 1);
}

.floating-hud.visible {
  transform: perspective(700px) rotateX(0deg) translateZ(0) scale(1);
  opacity: 1;
}

.floating-hud-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.floating-hud-key {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--pulse-cyan);
}

/* Modal Alert */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--pulse-rose);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: var(--glow-rose);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.show .modal-box {
  transform: translateY(0);
}

.modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pulse-rose);
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Footer */
.footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--pulse-cyan);
}

/* ===== Shared UI Components (ui.js) ===== */

/* Toast notifications */
.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 360px;
  padding: 12px 18px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--pulse-cyan);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left-color: var(--pulse-emerald); }
.toast.warning { border-left-color: var(--pulse-amber); }
.toast.danger  { border-left-color: var(--pulse-rose); }

.toast.toast-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  to { transform: translateX(40px); opacity: 0; }
}

/* Confirm dialog (replaces native confirm()) */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.confirm-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.confirm-box {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  max-width: 400px;
  width: calc(100% - 48px);
  text-align: center;
  box-shadow: var(--shadow-lg), var(--glow-cyan);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-overlay.show .confirm-box {
  transform: translateY(0) scale(1);
}

.confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pulse-amber);
}

.confirm-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.confirm-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

.confirm-actions .btn {
  flex: 1;
}

/* FPS metric pulse animation */
.metric-value.fps-live {
  animation: fps-pulse 2s ease-in-out infinite;
}

@keyframes fps-pulse {
  0%, 100% { text-shadow: 0 0 0 rgba(16, 185, 129, 0); }
  50% { text-shadow: 0 0 12px rgba(16, 185, 129, 0.55); }
}

/* Live timeline cursor */
.timeline-cursor {
  position: absolute;
  top: -4px;
  width: 2px;
  height: calc(100% + 8px);
  background: var(--text-primary);
  opacity: 0.85;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 992px) {
  .stream-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 12px 14px 40px;
  }
  .navbar {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
  }
  .tabs-container {
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .hero-banner {
    padding: 24px 20px;
  }
  .hero-title {
    font-size: 1.75rem;
  }
  .tool-grid {
    grid-template-columns: 1fr;
  }
  .control-strip {
    flex-direction: column;
    align-items: stretch;
  }
  .button-row {
    flex-direction: column;
  }
  .button-row .btn {
    width: 100%;
  }
}
