:root {
  /* Brand Colors */
  --primary-color: #007bff;
  --primary-hover: #0056b3;
  --primary-active: #004085;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --info-color: #17a2b8;

  /* Neutral Colors */
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f0f2f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;

  /* Semantic Colors */
  --background-color: var(--gray-100);
  --surface-color: var(--white);
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-500);
  --border-color: var(--gray-300);
  --border-light: var(--gray-200);
  --shadow-color: rgba(0, 0, 0, 0.1);

  /* Spacing System */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */

  /* Typography Scale */
  --font-family-base: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  --font-size-4xl: 2.25rem;   /* 36px */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* Border Radius */
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 var(--shadow-color);
  --shadow-md: 0 4px 6px -1px var(--shadow-color);
  --shadow-lg: 0 10px 15px -3px var(--shadow-color);
  --shadow-xl: 0 20px 25px -5px var(--shadow-color);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;

  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal: 1040;
  --z-popover: 1050;
  --z-tooltip: 1060;
}

/* Dark Mode Variables */
:root.dark-mode {
  --background-color: #121212;
  --surface-color: #1e1e1e;
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --text-muted: #888888;
  --border-color: #555555;
  --border-light: #444444;
  --shadow-color: rgba(0, 0, 0, 0.3);
  
  /* Adjusted colors for dark mode */
  --gray-50: #2c2c2c;
  --gray-100: #323232;
  --gray-200: #3c3c3c;
  --gray-300: #555555;
}

/* ==============================================
   BASE STYLES & TYPOGRAPHY
   ============================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  max-width: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--background-color);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-md) 0;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
  margin: 0 0 var(--space-md) 0;
  color: var(--text-secondary);
}

/* Hide entity select (as per original) */
#entity-select,
label[for="entity-select"] {
  display: none;
}

/* Device Select Group */
.device-select-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.device-select-group select {
  flex: 1;
}

#settings-button {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-lg);
  background-color: var(--secondary-color);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#settings-button:hover {
  background-color: var(--gray-600);
  transform: translateY(-1px);
}

#settings-button:active {
  transform: translateY(0);
}

body.dark-mode #settings-button {
  background-color: var(--gray-600);
  color: var(--text-primary);
}

body.dark-mode #settings-button:hover {
  background-color: var(--gray-500);
}

/* ==============================================
   LAYOUT STRUCTURE
   ============================================== */

/* Main App Container */
#container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--background-color);
}

/* Header Layout */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
  box-sizing: border-box;
  width: 100%;
}

header h1 {
  margin: 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

/* Header Controls Group */
.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Footer Layout */
footer {
  padding: var(--space-lg) var(--space-xl);
  background-color: var(--surface-color);
  border-top: 1px solid var(--border-light);
  text-align: center;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
  box-sizing: border-box;
  width: 100%;
}

footer p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* Main Content Area */
#main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  padding: var(--space-xl);
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* ==============================================
   CONTROL GROUPS & LAYOUT
   ============================================== */

/* Control Sections */
#controls, #save-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background-color: var(--surface-color);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

#save-controls {
  justify-content: center;
}

/* Individual Control Groups */
.control-group {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 160px;
}

.control-group label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  white-space: nowrap;
  margin-right: var(--space-sm);
}

/* Refresh Controls Layout */
.refresh-controls {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  flex-wrap: wrap;
}

.refresh-rate-input-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.refresh-rate-input-group input {
  width: 80px;
  min-width: 80px;
}

.refresh-buttons {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.refresh-buttons button {
  min-width: 100px;
}

/* ==============================================
   FORM ELEMENTS
   ============================================== */

/* Input and Select Base Styles */
input[type="number"], 
input[type="text"], 
select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-sm);
  font-family: var(--font-family-base);
  color: var(--text-primary);
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-normal);
}

/* Focus States */
input[type="number"]:focus, 
input[type="text"]:focus, 
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Button Base Styles */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-base);
  line-height: 1;
  color: var(--white);
  background-color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  min-height: 40px;
  white-space: nowrap;
}

/* Button States */
button:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active {
  background-color: var(--primary-active);
  border-color: var(--primary-active);
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button:disabled {
  background-color: var(--gray-400);
  border-color: var(--gray-400);
  color: var(--gray-600);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Button Spacing in Groups */
#save-controls .control-group button {
  margin: 0 var(--space-sm);
  min-width: 140px;
}

#save-control-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ==============================================
   COMPONENT-SPECIFIC STYLES
   ============================================== */

/* Status Indicator */
#statusIndicator {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background-color: var(--gray-50);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  transition: all var(--transition-normal);
  white-space: nowrap;
  position: relative;
}

/* WebSocket Connection Status Classes */
#statusIndicator.connected {
  color: var(--success-color);
  background-color: rgba(40, 167, 69, 0.1);
  border-color: var(--success-color);
}

#statusIndicator.connected::before {
  content: "🟢";
  margin-right: var(--space-xs);
}

#statusIndicator.warning {
  color: var(--warning-color);
  background-color: rgba(255, 193, 7, 0.1);
  border-color: var(--warning-color);
}

#statusIndicator.warning::before {
  content: "🟡";
  margin-right: var(--space-xs);
}

#statusIndicator.disconnected {
  color: var(--danger-color);
  background-color: rgba(220, 53, 69, 0.1);
  border-color: var(--danger-color);
}

#statusIndicator.disconnected::before {
  content: "🔴";
  margin-right: var(--space-xs);
}

/* Dark mode status indicator adjustments */
body.dark-mode #statusIndicator.connected {
  background-color: rgba(40, 167, 69, 0.2);
}

body.dark-mode #statusIndicator.warning {
  background-color: rgba(255, 193, 7, 0.2);
}

body.dark-mode #statusIndicator.disconnected {
  background-color: rgba(220, 53, 69, 0.2);
}

/* Coordinates Output */
#coordinatesOutput {
  padding: var(--space-lg);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  background-color: var(--gray-50);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  white-space: pre-wrap;
  overflow-x: auto;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

/* Canvas and Zone Layout */
#canvas-zone-layout {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
  max-width: 100%;
  margin: 0 auto;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 var(--space-md);
}

/* Canvas Container */
#canvas-container {
  position: relative;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
  width: min(960px, 70vw);
  max-width: 100%;
  flex-shrink: 1;
  box-sizing: border-box;
}

#canvas-container canvas {
  display: block;
  touch-action: none; /* Prevent zoom, scroll, and other touch gestures */
  margin: 0 auto; /* Center the canvas */
}

/* Zone Selection Sidebar */
#zone-selection-sidebar {
  background-color: var(--surface-color);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
  width: min(280px, 25vw);
  max-width: 100%;
  flex-shrink: 1;
  box-sizing: border-box;
}

#zone-selection-sidebar h4 {
  margin: 0 0 var(--space-lg) 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  text-align: center;
}

#zone-tiles-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xs);
  width: 100%;
}

/* Zone Tile Styling */
.zone-tile {
  background-color: var(--gray-50);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: var(--space-xs);
  padding-left: calc(var(--space-xs) + 8px); /* Extra space for color indicator */
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  min-height: 45px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.zone-tile:hover {
  background-color: var(--gray-100);
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.zone-tile.selected {
  background-color: rgba(0, 123, 255, 0.1);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.zone-tile.edit-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.zone-tile.edit-disabled:hover {
  background-color: var(--gray-50);
  border-color: var(--border-light);
  transform: none;
  box-shadow: none;
}

.zone-tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

/* Small delete button inside zone tiles */
.zone-delete-btn {
  display: none; /* only visible in edit mode */
  margin-left: var(--space-xs);
  padding: 4px 6px;
  min-height: auto;
  line-height: 1;
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--danger-color);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

body.is-edit-mode .zone-delete-btn {
  display: inline-flex;
}

.zone-delete-btn:hover {
  background-color: rgba(220, 53, 69, 0.1);
  border-color: rgba(220, 53, 69, 0.2);
}

.zone-delete-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Zone Color Indicator */
.zone-color-indicator {
  width: 4px;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  opacity: 0; /* Hidden by default */
}

/* Zone Color Classes - matching canvas colors */
.zone-color-indicator.ha-zone-1 { 
  background: linear-gradient(to bottom, #3b82f6, #1d4ed8); 
  opacity: 1; /* Show when colored */
}
.zone-color-indicator.ha-zone-2 { 
  background: linear-gradient(to bottom, #10b981, #047857); 
  opacity: 1; /* Show when colored */
}
.zone-color-indicator.ha-zone-3 { 
  background: linear-gradient(to bottom, #f59e0b, #d97706); 
  opacity: 1; /* Show when colored */
}
.zone-color-indicator.ha-zone-4 { 
  background: linear-gradient(to bottom, #ef4444, #dc2626); 
  opacity: 1; /* Show when colored */
}
.zone-color-indicator.user-zone { 
  background: linear-gradient(to bottom, #8b5cf6, #7c3aed); 
  opacity: 1; /* Show when colored */
}
.zone-color-indicator.exclusion-zone { 
  background: linear-gradient(to bottom, #f87171, #ef4444); 
  opacity: 1; /* Show when colored */
}

/* Editing Status Indicator */
#editing-status {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 1000;
  
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--primary-color);
  
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 4px 16px rgba(0, 0, 0, 0.05);
  
  /* Animation properties */
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Ensure it doesn't interfere with canvas interactions */
  pointer-events: none;
}

#editing-status.show {
  transform: translateX(0);
  opacity: 1;
}

#editing-status::before {
  content: "✏️";
  margin-right: var(--space-xs);
  font-size: 16px;
}

#editing-status.has-changes {
  background: rgba(255, 248, 220, 0.95);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning-color);
}

#editing-status.has-changes::before {
  content: "⚠️";
}

/* Dark mode editing status */
body.dark-mode #editing-status {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(96, 165, 250, 0.3);
  color: #60a5fa;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
}

body.dark-mode #editing-status.has-changes {
  background: rgba(68, 64, 60, 0.95);
  border-color: rgba(251, 191, 36, 0.4);
  color: #fbbf24;
}

/* Mobile Fullscreen Button */
#fullscreen-button {
  position: absolute;
  bottom: var(--space-md);
  right: var(--space-md);
  z-index: 1000;
  
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  
  width: 48px;
  height: 48px;
  
  display: none; /* Hidden by default, shown only on mobile */
  align-items: center;
  justify-content: center;
  
  color: var(--text-primary);
  font-size: 20px;
  
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
  
  transition: all 0.2s ease;
  cursor: pointer;
  
  pointer-events: auto;
}

#fullscreen-button:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2), 0 3px 12px rgba(0, 0, 0, 0.15);
}

#fullscreen-button:active {
  transform: scale(0.95);
}

/* Fullscreen mode styles */
#canvas-container.fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  background: var(--canvas-bg) !important;
}

#canvas-container.fullscreen canvas {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
}

/* Show mobile fullscreen button only on small screens */
@media (max-width: 1200px) and (pointer: coarse) {
  #fullscreen-button {
    display: flex;
  }
}

/* Dark mode fullscreen button */
body.dark-mode #fullscreen-button {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

body.dark-mode #fullscreen-button:hover {
  background: rgba(30, 41, 59, 1);
}

.zone-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

/* Status Indicator Circle */
.zone-status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--gray-400);
  transition: background-color var(--transition-fast);
}

.zone-status-indicator.enabled-configured {
  background-color: var(--success-color);
}

.zone-status-indicator.enabled-not-configured {
  background-color: var(--danger-color);
}

.zone-status-indicator.disabled {
  background-color: var(--gray-400);
}

/* Zone Coordinates */
.zone-coordinates {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.2;
}

.coord-label {
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

.coord-value {
  font-family: var(--font-family-mono);
  color: var(--text-primary);
}

/* Zone Status Text */
.zone-status-text {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  text-align: center;
  padding: var(--space-xs);
  background-color: var(--surface-color);
  border-radius: var(--radius-sm);
}

.zone-status-text.presence {
  color: var(--success-color);
  background-color: rgba(40, 167, 69, 0.1);
}

.zone-status-text.no-presence {
  color: var(--warning-color);
  background-color: rgba(255, 193, 7, 0.1);
}

.zone-status-text.disabled {
  color: var(--gray-500);
  background-color: var(--gray-100);
}

.zone-status-text.enabled-not-configured {
  color: var(--danger-color);
  background-color: rgba(220, 53, 69, 0.1);
}

/* ==============================================
   TOOLTIP STYLES
   ============================================== */

/* Tooltip container */
.zone-tile {
  position: relative;
}

/* Tooltip for disabled zones */
.zone-tile.disabled::before {
  content: "This zone is disabled in Home Assistant. To enable it, go to Settings → Devices & services → Entities, search for the zone entities, and enable them.";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--gray-800);
  color: var(--white);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  line-height: 1.3;
  white-space: normal;
  width: 280px;
  max-width: 90vw;
  text-align: left;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
  pointer-events: none;
}

/* Tooltip arrow */
.zone-tile.disabled::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--gray-800);
  margin-bottom: -6px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
  pointer-events: none;
  z-index: 1000;
}

/* Show tooltip on hover */
.zone-tile.disabled:hover::before,
.zone-tile.disabled:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Info Display (if used) */
#info-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.info-group {
  padding: var(--space-lg);
  background-color: var(--surface-color);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.info-group h2 {
  margin-bottom: var(--space-md);
  font-size: var(--font-size-lg);
  color: var(--text-primary);
}

.info-group p {
  margin: 0;
  padding: var(--space-md);
  background-color: var(--gray-50);
  border-radius: var(--radius-sm);
  word-wrap: break-word;
  transition: background-color var(--transition-normal);
}

/* ==============================================
   TABLE STYLES
   ============================================== */

#target-tracking-info {
  background-color: var(--surface-color);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
  overflow: hidden;
}

/* Collapsible Header */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.collapsible-header:hover {
  background-color: var(--gray-50);
}

.collapsible-header h3 {
  margin: 0;
  font-size: var(--font-size-xl);
  color: var(--text-primary);
}

/* Collapse Toggle Button */
.collapse-toggle {
  background: none;
  border: none;
  padding: var(--space-xs);
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.collapse-toggle:hover {
  background-color: var(--gray-100);
  color: var(--text-primary);
  transform: none;
  box-shadow: none;
}

.toggle-icon {
  font-size: var(--font-size-sm);
  transition: transform var(--transition-normal);
  user-select: none;
}

/* Collapsed state */
.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

/* Collapsible Content */
.collapsible-content {
  padding: var(--space-lg);
  transition: max-height var(--transition-normal), opacity var(--transition-normal);
  overflow: hidden;
}

.collapsed .collapsible-content {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

/* Hide the table completely */
#target-tracking-info table {
  display: none;
}

#target-tracking-info th, 
#target-tracking-info td {
  padding: var(--space-md);
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  word-wrap: break-word;
  transition: background-color var(--transition-fast);
}

#target-tracking-info th {
  background-color: var(--success-color);
  color: var(--white);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#target-tracking-info tr:nth-child(even) td {
  background-color: var(--gray-50);
}

#target-tracking-info tr:hover td {
  background-color: var(--gray-100);
}

/* ==============================================
   ZONE ANIMATION STYLES
   ============================================== */

@keyframes zoneAppear {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes zoneDisappear {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.5;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

/* Zone animation class that will be applied via JavaScript */
.zone-creating {
  animation: zoneAppear 0.3s ease-out forwards;
}

.zone-deleting {
  animation: zoneDisappear 0.25s ease-in forwards;
}

/* Ghost zone preview styles (for canvas-based implementation) */
.canvas-container.creating-zone {
  cursor: crosshair !important;
}

/* ==============================================
   CANVAS CURSOR STYLES
   ============================================== */

canvas.crosshair { cursor: crosshair; }
canvas.move { cursor: move; }
canvas.nwse-resize { cursor: nwse-resize; }

/* ==============================================
   DARK MODE OVERRIDES
   ============================================== */

body.dark-mode {
  color-scheme: dark;
}

/* Dark mode button styles */
body.dark-mode button {
  background-color: #bb86fc;
  border-color: #bb86fc;
  color: #000000;
}

body.dark-mode button:hover {
  background-color: #9a67ea;
  border-color: #9a67ea;
  color: #ffffff;
}

body.dark-mode button:active {
  background-color: #7a3fe0;
  border-color: #7a3fe0;
}

body.dark-mode button:disabled {
  background-color: var(--gray-600);
  border-color: var(--gray-600);
  color: var(--gray-400);
}

/* Dark mode table overrides */
body.dark-mode #target-tracking-info th {
  background-color: #6b8e23;
  color: var(--white);
}

body.dark-mode #target-tracking-info tr:nth-child(even) td {
  background-color: var(--gray-200);
}

body.dark-mode #target-tracking-info tr:hover td {
  background-color: var(--gray-300);
}

/* ==============================================
   TARGET TRACKING CARDS
   ============================================== */

/* Target cards */
.target-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.target-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.target-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--primary-color);
}

.target-name {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xl);
  color: var(--text-primary);
}

.target-status {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.target-status.active {
  background-color: var(--success-color);
  color: var(--white);
}

.target-status.inactive {
  background-color: var(--gray-400);
  color: var(--white);
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.target-item {
  display: flex;
  flex-direction: column;
}

.target-label {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
  font-weight: var(--font-weight-medium);
}

.target-value {
  font-size: var(--font-size-base);
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-mono);
}

/* Dark mode target cards */
body.dark-mode .target-card {
  background-color: var(--gray-200);
  border-color: var(--border-color);
}

body.dark-mode .target-card:hover {
  background-color: var(--gray-300);
}

/* Mobile adjustments for target cards */
@media (max-width: 480px) {
  .target-card {
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
  }
  
  .target-name {
    font-size: var(--font-size-lg);
  }
  
  .target-status {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
  }
  
  .target-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }
  
  .target-value {
    font-size: var(--font-size-sm);
  }
}

/* Dark mode toggle button */
#dark-mode-toggle {
  background-color: var(--gray-200);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-lg);
  transition: all var(--transition-fast);
}

#dark-mode-toggle:hover {
  background-color: var(--gray-300);
  transform: translateY(-1px);
}

body.dark-mode #dark-mode-toggle {
  background-color: var(--gray-200);
  color: var(--text-primary);
}

body.dark-mode #dark-mode-toggle:hover {
  background-color: var(--gray-300);
}

/* Easter Egg Toggle Button */
.easter-egg-toggle {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-slow), visibility var(--transition-slow), transform var(--transition-slow);
  transform: scale(0.8);
  background-color: var(--gray-200);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-lg);
  min-height: auto;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.easter-egg-toggle:hover {
  background-color: var(--gray-300);
  transform: scale(0.85);
}

/* Show easter egg when activated */
.easter-egg-toggle.revealed {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* Pulse when revealed */
.easter-egg-toggle.revealed:hover {
  animation: easterEggPulse 2s infinite;
}

@keyframes easterEggPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Dark mode easter egg */
body.dark-mode .easter-egg-toggle {
  background-color: var(--gray-200);
  color: var(--text-primary);
}

body.dark-mode .easter-egg-toggle:hover {
  background-color: var(--gray-300);
}

/* Dark mode collapsible overrides */
body.dark-mode .collapsible-header:hover {
  background-color: var(--gray-200);
}

body.dark-mode .collapse-toggle:hover {
  background-color: var(--gray-300);
}

/* Dark mode zone tiles */
body.dark-mode .zone-tile {
  background-color: var(--gray-200);
  border-color: var(--border-color);
}

body.dark-mode .zone-tile:hover {
  background-color: var(--gray-300);
}

body.dark-mode .zone-tile.selected {
  background-color: rgba(187, 134, 252, 0.2);
  border-color: #bb86fc;
}

body.dark-mode .zone-coordinates {
  color: var(--text-muted);
}

body.dark-mode .zone-status-text {
  background-color: var(--gray-200);
}

body.dark-mode .zone-status-text.disabled {
  background-color: var(--gray-300);
}

/* Dark mode tooltip */
body.dark-mode .zone-tile.disabled::before {
  background-color: var(--gray-700);
  color: var(--gray-100);
}

body.dark-mode .zone-tile.disabled::after {
  border-top-color: var(--gray-700);
}

/* ==============================================
   SETTINGS STYLES
   ============================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  box-sizing: border-box;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gray-50);
}

.modal-header h3 {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.close-button {
  background: none;
  border: none;
  font-size: var(--font-size-2xl);
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-button:hover {
  background: var(--gray-200);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
  background: var(--gray-50);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--text-primary);
  border: none;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--gray-300);
  transform: translateY(-1px);
}

/* Settings Sections */
.settings-section {
  margin-bottom: var(--space-xl);
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-light);
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-light);
}

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

.settings-item-info {
  flex: 1;
  margin-right: var(--space-lg);
}

.settings-item-label {
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.settings-item-description {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
}

.settings-item-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Toggle Switches */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.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: var(--gray-300);
  transition: var(--transition-normal);
  border-radius: 28px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: var(--transition-normal);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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

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

/* Number inputs */
.settings-number-input {
  width: 100px;
  padding: var(--space-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  text-align: center;
}

.settings-number-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.settings-number-input.invalid {
  border-color: var(--danger-color);
  background-color: rgba(220, 38, 38, 0.1);
}

.settings-number-input.invalid:focus {
  border-color: var(--danger-color);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Dark mode styles for modal */
body.dark-mode .modal-header,
body.dark-mode .modal-footer {
  background: var(--gray-200);
  border-color: var(--border-color);
}

body.dark-mode .close-button:hover {
  background: var(--gray-300);
}

body.dark-mode .btn-secondary {
  background: var(--gray-600);
  color: var(--text-primary);
}

body.dark-mode .btn-secondary:hover {
  background: var(--gray-500);
}

body.dark-mode .toggle-slider {
  background-color: var(--gray-600);
}

body.dark-mode .settings-number-input {
  background: var(--gray-200);
  border-color: var(--border-color);
  color: var(--text-primary);
}

body.dark-mode .settings-number-input.invalid {
  border-color: var(--danger-color);
  background-color: rgba(220, 38, 38, 0.2);
}

body.dark-mode .settings-number-input.invalid:focus {
  border-color: var(--danger-color);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

/* ==============================================
   RESPONSIVE DESIGN
   ============================================== */

/* Tablet and Mobile Layout */
@media (max-width: 1200px) {
  #canvas-zone-layout {
    flex-direction: column !important;
    gap: var(--space-md);
    align-items: stretch;
    padding: 0; /* Remove padding that could cause overflow */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
  }

  #canvas-container {
    width: 100% !important;
    max-width: 100%;
    margin: 0;
    order: 1;
    display: flex;
    justify-content: center;
    overflow: hidden; /* Prevent horizontal scrolling */
    box-sizing: border-box;
    padding: 0;
  }

  #zone-selection-sidebar {
    width: 100% !important;
    max-width: 100%;
    order: 2;
    padding: var(--space-md); /* Reduce padding on mobile */
    box-sizing: border-box;
    margin: 0;
  }

  /* Canvas responsive sizing handled by JS */
  #canvas-container canvas {
    max-width: 100%;
    height: auto;
  }

  /* Button layout on tablets */
  #save-control-group {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm);
  }

  #save-control-group button {
    flex: 1;
    min-width: 120px;
    max-width: 180px;
    min-height: 44px; /* Touch-friendly height */
  }

  /* Vertical zone tiles on tablet */
  #zone-tiles-container {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  /* Better zone tile touch targets */
  .zone-tile {
    min-height: 55px;
    padding: var(--space-sm);
    padding-left: calc(var(--space-sm) + 8px);
  }

  /* Settings modal responsiveness */
  .modal-overlay {
    padding: var(--space-md);
  }

  .modal-content {
    max-width: 95%;
    max-height: 85vh;
  }

  .device-select-group {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  #settings-button {
    width: 100%;
    height: 44px;
    margin-top: var(--space-sm);
  }



  /* Improve table on tablet */
  #target-tracking-info {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #target-tracking-info table {
    min-width: 100%;
    font-size: var(--font-size-xs);
  }
}

  @media (max-width: 480px) {
  :root {
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
  }

  header, footer {
    padding: var(--space-md);
    box-sizing: border-box;
    width: 100%;
  }

  header h1 {
    font-size: var(--font-size-xl);
  }

  /* Mobile header controls */
  .header-controls {
    gap: var(--space-xs);
  }

  #dark-mode-toggle,
  .easter-egg-toggle {
    width: 35px;
    height: 35px;
    font-size: var(--font-size-base);
  }

  #main-content {
    padding: var(--space-md);
    gap: var(--space-md);
    margin: 0;
    width: 100%;
  }

  #controls, #save-controls {
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-md);
  }

  .control-group {
    min-width: auto;
  }

  #save-controls .control-group button {
    margin: var(--space-xs) 0;
    min-width: auto;
  }

  #info-display {
    grid-template-columns: 1fr;
  }

  #canvas-container {
    border-radius: var(--radius-sm);
  }
  
  /* Adjust editing status overlay for mobile */
  #editing-status {
    top: var(--space-sm);
    right: var(--space-sm);
    font-size: var(--font-size-xs);
    padding: var(--space-xs) var(--space-sm);
    max-width: calc(100% - 2 * var(--space-sm));
    box-sizing: border-box;
  }

  /* Canvas responsive sizing handled by JS */
  #canvas-container canvas {
    max-width: 100%;
    height: auto;
  }

  /* Stack buttons vertically on very small screens */
  #save-control-group {
    flex-direction: column;
    gap: var(--space-xs);
  }

  #save-control-group button {
    width: 100%;
    max-width: none;
    padding: var(--space-md) var(--space-sm);
    font-size: var(--font-size-sm);
    min-height: 44px; /* Touch-friendly height */
  }

  /* Zone tiles optimized for touch */
  .zone-tile {
    min-height: 60px;
    padding: var(--space-sm);
    padding-left: calc(var(--space-sm) + 8px);
  }

  .zone-tile-header {
    margin-bottom: var(--space-xs);
  }

  .zone-coordinates {
    font-size: 11px;
  }

  /* Keep vertical layout for zone tiles */
  #zone-tiles-container {
    grid-template-columns: 1fr;
  }

  /* Settings modal mobile optimizations */
  .modal-overlay {
    padding: var(--space-sm);
  }

  .modal-content {
    max-width: 100%;
    max-height: 90vh;
    margin: 0;
  }

  .modal-header,
  .modal-footer {
    padding: var(--space-md);
  }

  .modal-body {
    padding: var(--space-md);
  }

  .settings-item {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-md);
    padding: var(--space-md) 0;
  }

  .settings-item-info {
    margin-right: 0;
    margin-bottom: var(--space-sm);
  }

  .settings-item-control {
    justify-content: flex-end;
  }

  .modal-footer {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    padding: var(--space-md);
    font-size: var(--font-size-base);
  }

  /* Stack refresh controls vertically on mobile */
  .refresh-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .refresh-rate-input-group input {
    width: 100%;
  }

  .refresh-buttons {
    justify-content: center;
  }


}

/* Small phones */
@media (max-width: 375px) {
  /* Canvas responsive sizing handled by JS */
  #canvas-container canvas {
    max-width: 100%;
    height: auto;
  }
  
  /* Compact zone tiles */
  .zone-tile {
    min-height: 50px;
    padding: var(--space-xs);
    padding-left: calc(var(--space-xs) + 6px);
  }
  
  .zone-coordinates {
    font-size: 10px;
  }
  
  .zone-title {
    font-size: var(--font-size-sm);
  }

  /* Compact buttons */
  #save-control-group button {
    padding: var(--space-sm) var(--space-xs);
    font-size: 12px;
  }
  
  /* Smaller editing status overlay */
  #editing-status {
    font-size: 10px;
    padding: 6px var(--space-xs);
  }
  
  #editing-status::before {
    font-size: 12px;
  }
}

@media (max-width: 320px) {
  header h1 {
    font-size: var(--font-size-lg);
  }

  #target-tracking-info {
    padding: var(--space-md);
  }

  #target-tracking-info th, 
  #target-tracking-info td {
    padding: var(--space-sm);
    font-size: var(--font-size-xs);
  }
  
  /* Canvas responsive sizing handled by JS */
  #canvas-container canvas {
    max-width: 100%;
    height: auto;
  }
}



