/* ==========================================================================
   HUAWEI HR BROADCAST - SPORTS-TECH DARK DESIGN SYSTEM & OBS OVERLAY STYLES
   ========================================================================== */

:root {
  /* Color Palette: Cyber Sports Dark */
  --bg-primary: #0a0d14;
  --bg-secondary: #0f1422;
  --bg-tertiary: #161c2e;
  --bg-card: rgba(18, 24, 38, 0.82);
  --bg-card-hover: rgba(25, 34, 54, 0.9);
  --bg-glass: rgba(15, 20, 34, 0.7);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(6, 182, 212, 0.5);

  /* Typography & Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Accent Colors */
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.35);
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;

  /* Standard Heart Rate Zones (5-Zone Sports Model) */
  --zone-rest: #64748b;
  --zone-1: #38bdf8; /* Warm Up (50-60%) - Sky Blue */
  --zone-2: #10b981; /* Fat Burn (60-70%) - Emerald Green */
  --zone-3: #f59e0b; /* Aerobic (70-80%) - Amber Gold */
  --zone-4: #f97316; /* Anaerobic (80-90%) - Vibrant Orange */
  --zone-5: #ef4444; /* VO2 Max (90-100%) - Crimson Red */

  /* UI Status Accents */
  --status-connected: #10b981;
  --status-disconnected: #64748b;
  --status-connecting: #f59e0b;
  --status-simulator: #a855f7;
  --status-alert: #ef4444;

  /* Radii & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 9999px;
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 24px -4px var(--accent-cyan-glow);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(circle at 15% 10%, rgba(6, 182, 212, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(239, 68, 68, 0.04) 0%, transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
}

/* ==========================================================================
   Header & Top Bar
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(10, 13, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(239, 68, 68, 0.2));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--accent-cyan);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, #f8fafc 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Status & Telemetry Group */
.header-status-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill, .device-pill, .battery-pill, .contact-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  letter-spacing: 0.02em;
}

.status-dot, .contact-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-disconnected .status-dot { background-color: var(--status-disconnected); }
.status-connected .status-dot {
  background-color: var(--status-connected);
  box-shadow: 0 0 8px var(--status-connected);
}
.status-connecting .status-dot {
  background-color: var(--status-connecting);
  animation: livePulse 1s infinite alternate;
}
.status-simulator .status-dot {
  background-color: var(--status-simulator);
  box-shadow: 0 0 8px var(--status-simulator);
}

.contact-ok .contact-dot {
  background-color: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.contact-lost .contact-dot {
  background-color: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

.pill-icon {
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  outline: none;
  user-select: none;
  white-space: nowrap;
}

.btn-icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0891b2 100%);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.45);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

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

.btn-outline:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-icon-only:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.76rem;
}

/* ==========================================================================
   High HR Alert Banner
   ========================================================================== */
.alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(90deg, #b91c1c 0%, #ef4444 100%);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
  animation: alertFlash 1s infinite alternate;
}

@keyframes alertFlash {
  0% { opacity: 0.92; }
  100% { opacity: 1; filter: brightness(1.15); }
}

.alert-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.alert-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  padding: 0 6px;
}

.alert-close:hover {
  opacity: 1;
}

/* ==========================================================================
   Dashboard Container & Layout
   ========================================================================== */
.dashboard-container {
  flex: 1;
  padding: 24px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 24px;
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.dash-left-col, .dash-right-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* General Card Design */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-normal);
}

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

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

.card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.live-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-connected);
  box-shadow: 0 0 10px var(--status-connected);
  animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* ==========================================================================
   Heart Rate Hero Card
   ========================================================================== */
.hr-hero-card {
  position: relative;
  overflow: hidden;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(30, 41, 65, 0.7) 0%, rgba(18, 24, 38, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-top-meta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.hero-rr-tag {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.hero-center-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  margin: 14px 0 24px;
}

/* Heart Pulse Container & Animation */
.heart-pulse-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.heart-glow-halo {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--zone-3) 0%, transparent 70%);
  opacity: 0.35;
  filter: blur(12px);
  pointer-events: none;
  transition: background var(--transition-normal);
}

.heart-svg {
  width: 74px;
  height: 74px;
  color: var(--zone-3);
  filter: drop-shadow(0 0 16px rgba(245, 158, 11, 0.6));
  transform-origin: center center;
  animation: heartBeat 0.8s infinite ease-in-out;
  transition: color var(--transition-normal), filter var(--transition-normal);
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  14% { transform: scale(1.18); }
  28% { transform: scale(1.05); }
  42% { transform: scale(1.24); }
  70% { transform: scale(1); }
  100% { transform: scale(1); }
}

/* BPM Big Display */
.bpm-readout-group {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.bpm-digits {
  font-size: 6.5rem;
  font-weight: 900;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  background: linear-gradient(180deg, #ffffff 30%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.bpm-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bpm-unit {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.bpm-delta {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.bpm-delta.up { color: #ef4444; }
.bpm-delta.down { color: #10b981; }

/* Zone Badge and Percentage */
.hero-bottom-meta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.current-zone-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: all var(--transition-normal);
}

.zone-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.zone-badge-resting {
  background: rgba(100, 116, 139, 0.15);
  color: var(--zone-rest);
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.zone-badge-z1 {
  background: rgba(56, 189, 248, 0.15);
  color: var(--zone-1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.2);
}

.zone-badge-z2 {
  background: rgba(16, 185, 129, 0.15);
  color: var(--zone-2);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.2);
}

.zone-badge-z3 {
  background: rgba(245, 158, 11, 0.15);
  color: var(--zone-3);
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.25);
}

.zone-badge-z4 {
  background: rgba(249, 115, 22, 0.15);
  color: var(--zone-4);
  border: 1px solid rgba(249, 115, 22, 0.3);
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.25);
}

.zone-badge-z5 {
  background: rgba(239, 68, 68, 0.2);
  color: var(--zone-5);
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.4);
}

.max-hr-percent {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ==========================================================================
   Rolling Canvas Chart
   ========================================================================== */
.chart-card {
  display: flex;
  flex-direction: column;
}

.chart-header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.time-toggle-group {
  display: inline-flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-btn.active {
  background: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 1px 6px rgba(6, 182, 212, 0.4);
}

.chart-summary-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-pill {
  font-size: 0.74rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.chart-pill strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 240px;
  background: rgba(10, 13, 20, 0.6);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

#hrChartCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border-focus);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  z-index: 10;
  white-space: nowrap;
}

.chart-legend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.swatch-z5 { background-color: var(--zone-5); }
.swatch-z4 { background-color: var(--zone-4); }
.swatch-z3 { background-color: var(--zone-3); }
.swatch-z2 { background-color: var(--zone-2); }
.swatch-z1 { background-color: var(--zone-1); }

/* ==========================================================================
   Zone Distribution Card & Progress Bar
   ========================================================================== */
.zone-progress-bar-container {
  margin-bottom: 16px;
}

.zone-progress-bar {
  display: flex;
  height: 14px;
  width: 100%;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
}

.zone-segment {
  height: 100%;
  transition: width 0.4s ease;
}

.seg-z1 { background-color: var(--zone-1); }
.seg-z2 { background-color: var(--zone-2); }
.seg-z3 { background-color: var(--zone-3); }
.seg-z4 { background-color: var(--zone-4); }
.seg-z5 { background-color: var(--zone-5); }

.zone-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

@media (max-width: 768px) {
  .zone-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.zone-stat-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.zone-stat-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.z1-box::before { background: var(--zone-1); }
.z2-box::before { background: var(--zone-2); }
.z3-box::before { background: var(--zone-3); }
.z4-box::before { background: var(--zone-4); }
.z5-box::before { background: var(--zone-5); }

.zone-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.zone-box-tag {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
}

.zone-box-name {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.zone-box-range {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.zone-box-time {
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  margin-top: 4px;
}

.zone-box-pct {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ==========================================================================
   Session Recording Card
   ========================================================================== */
.session-card {
  background: linear-gradient(180deg, rgba(22, 28, 46, 0.9) 0%, rgba(18, 24, 38, 0.85) 100%);
}

.session-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-idle {
  background: rgba(100, 116, 139, 0.2);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-recording {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: livePulse 1.2s infinite;
}

.badge-paused {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.session-timer-display {
  text-align: center;
  padding: 16px 0 20px;
  background: rgba(10, 13, 20, 0.4);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.timer-digits {
  font-size: 2.8rem;
  font-weight: 900;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  color: #ffffff;
}

.timer-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.session-actions-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.session-actions-grid .btn {
  flex: 1;
}

.btn-record {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
}
.btn-record:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-pause {
  background: #f59e0b;
  color: #ffffff;
}
.btn-pause:hover { background: #d97706; }

.btn-resume {
  background: #10b981;
  color: #ffffff;
}
.btn-resume:hover { background: #059669; }

.btn-stop {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
}
.btn-stop:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.session-quick-export {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.session-quick-export .btn {
  flex: 1;
}

/* ==========================================================================
   Live Stats Cards (4-Pack Grid)
   ========================================================================== */
.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.stat-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.stat-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-icon-wrapper {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrapper svg {
  width: 16px;
  height: 16px;
}

.icon-fire { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.icon-activity { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.icon-target { background: rgba(139, 92, 246, 0.15); color: #a855f7; }
.icon-chip { background: rgba(16, 185, 129, 0.15); color: #10b981; }

.stat-card-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.stat-num {
  font-size: 1.9rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  line-height: 1.1;
}

.stat-unit {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-card-sub {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.stat-multi-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.stat-sub-item {
  display: flex;
  flex-direction: column;
}

.sub-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
}

.sub-val {
  font-size: 1.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.highlight-sub .sub-val {
  color: var(--accent-cyan);
}

/* ==========================================================================
   Huawei Band Quick Help Callout Card
   ========================================================================== */
.guide-callout-card {
  background: linear-gradient(135deg, rgba(22, 28, 46, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%);
  border-left: 4px solid var(--accent-cyan);
}

.callout-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.callout-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.callout-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.callout-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.callout-text strong {
  color: #ffffff;
}

.callout-btn {
  width: 100%;
}

/* ==========================================================================
   OBS STREAM OVERLAY MODE
   ========================================================================== */
body.obs-overlay-mode {
  background: transparent !important;
  background-image: none !important;
  overflow: hidden;
}

body.obs-overlay-mode .app-header,
body.obs-overlay-mode .dashboard-container,
body.obs-overlay-mode .alert-banner {
  display: none !important;
}

body.obs-overlay-mode .obs-overlay-container {
  display: flex !important;
}

.obs-overlay-container {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  padding: 16px;
  box-sizing: border-box;
}

/* Floating Toolbar for Streamer Configuration */
.obs-floating-toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.obs-floating-toolbar.auto-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
  pointer-events: none;
}

.obs-tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.obs-tool-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-right: 4px;
}

.obs-tool-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.obs-tool-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.obs-tool-btn.active {
  background: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 1px 6px rgba(6, 182, 212, 0.4);
}

.obs-tool-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
  margin: 0 4px;
}

.obs-exit-btn {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.obs-exit-btn:hover {
  background: #ef4444;
  color: #ffffff;
}

/* Preset 1: Pill Widget */
.obs-pill-widget {
  display: inline-block;
}

.obs-pill-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: rgba(15, 20, 32, 0.88);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.65);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.obs-heart-box {
  display: flex;
  align-items: center;
  justify-content: center;
}

.obs-heart-svg {
  width: 28px;
  height: 28px;
  color: var(--zone-3);
  filter: drop-shadow(0 0 8px currentColor);
  animation: heartBeat 0.8s infinite ease-in-out;
}

.obs-bpm-box {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.obs-bpm-val {
  font-size: 2.2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 0 12px currentColor;
}

.obs-bpm-lbl {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
}

.obs-pill-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.12);
}

.obs-zone-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(245, 158, 11, 0.2);
  color: var(--zone-3);
  border: 1px solid rgba(245, 158, 11, 0.4);
  letter-spacing: 0.05em;
}

.obs-sparkline-box {
  display: flex;
  align-items: center;
}

.obs-stats-box {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-family: var(--font-mono);
}

.obs-stat-line {
  display: flex;
  gap: 6px;
  font-size: 0.68rem;
}

.obs-k { color: var(--text-muted); font-weight: 700; }
.obs-v { color: #ffffff; font-weight: 800; }

/* Preset 2: Stream Card Widget */
.obs-card-widget {
  width: 280px;
}

.obs-card-inner {
  padding: 16px;
  background: rgba(15, 20, 32, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.7);
}

.obs-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.obs-brand-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.obs-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.obs-card-zone-tag {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--zone-3);
  background: rgba(245, 158, 11, 0.2);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.obs-card-bpm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.obs-card-bpm-val {
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}

.obs-card-bpm-unit {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-muted);
}

.obs-card-chart {
  width: 100%;
  height: 50px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.obs-card-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.obs-card-metric {
  display: flex;
  flex-direction: column;
}

.obs-m-lbl { font-size: 0.6rem; font-weight: 700; color: var(--text-muted); }
.obs-m-val { font-size: 0.85rem; font-weight: 800; font-family: var(--font-mono); color: #ffffff; }

/* Preset 3: Minimalist Widget */
.obs-minimal-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
}

.obs-minimal-heart {
  width: 52px;
  height: 52px;
}

.obs-minimal-bpm {
  font-size: 5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 0 24px currentColor;
}

.obs-minimal-unit {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-muted);
}

/* Background Overrides for OBS */
body.obs-bg-glass .obs-overlay-container { background: rgba(10, 13, 20, 0.5) !important; }
body.obs-bg-green .obs-overlay-container { background: #00ff00 !important; }
body.obs-bg-magenta .obs-overlay-container { background: #ff00ff !important; }

/* ==========================================================================
   Modals (Guide, Settings, History)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.modal-lg {
  max-width: 820px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-icon {
  width: 20px;
  height: 20px;
  color: var(--accent-cyan);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close-btn:hover { color: #ffffff; }

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(10, 13, 20, 0.4);
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: #ffffff;
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.tab-pane {
  display: none;
}

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

/* Guide Step Cards */
.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guide-step-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-cyan);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.step-content h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: #ffffff;
}

.step-content p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.step-content code {
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

/* Web Bluetooth Requirement Items */
.ble-requirements-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.req-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  line-height: 1.45;
}

.req-pass {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #ecfdf5;
}

.req-warn {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fef3c7;
}

.req-icon {
  font-weight: 900;
  font-size: 1rem;
}

/* Settings Forms */
.form-section-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  margin: 18px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.form-section-title:first-child {
  margin-top: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 500px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.form-group label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input, .form-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-cyan);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent-cyan);
  width: 16px;
  height: 16px;
}

.zones-preview-card {
  background: rgba(10, 13, 20, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 12px 0;
}

.preview-header {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.preview-header strong {
  color: var(--accent-cyan);
  font-size: 0.95rem;
}

.preview-zones-table {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  padding: 3px 6px;
  border-radius: 4px;
}

.preview-row strong {
  font-family: var(--font-mono);
}

.z1-row { background: rgba(56, 189, 248, 0.1); color: var(--zone-1); }
.z2-row { background: rgba(16, 185, 129, 0.1); color: var(--zone-2); }
.z3-row { background: rgba(245, 158, 11, 0.1); color: var(--zone-3); }
.z4-row { background: rgba(249, 115, 22, 0.1); color: var(--zone-4); }
.z5-row { background: rgba(239, 68, 68, 0.1); color: var(--zone-5); }

/* History Modal */
.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.history-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.text-danger {
  color: #ef4444 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

.text-danger:hover {
  background: rgba(239, 68, 68, 0.15) !important;
}

.empty-history-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-history-state p {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 400px;
}

.history-items-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition-fast);
}

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

.history-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-date {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}

.history-duration-badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.history-item-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: rgba(10, 13, 20, 0.5);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.hist-stat-box {
  display: flex;
  flex-direction: column;
}

.hist-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
}

.hist-val {
  font-size: 0.85rem;
  font-weight: 800;
  color: #ffffff;
}

.history-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  animation: toastSlideUp 0.25s ease;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.toast-success { border-color: rgba(16, 185, 129, 0.5); }
.toast-warning { border-color: rgba(245, 158, 11, 0.5); }
.toast-error { border-color: rgba(239, 68, 68, 0.5); }

/* ==========================================================================
   Scrollbar & Utilities
   ========================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}
