:root {
  /* Color System */
  --color-bg-primary: #1a1a1a;
  --color-bg-secondary: #2d2d2d;
  --color-bg-panel: rgba(255, 255, 255, 0.05);
  --color-text-primary: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.7);
  --color-accent: #00d9ff;
  --color-success: #00ff88;
  --color-warning: #ffaa00;
  --color-danger: #ff4444;
  --color-info: #4488ff;
  --color-border: rgba(255, 255, 255, 0.15);
  
  /* Chat-specific colors */
  --color-chat-message: rgba(0, 217, 255, 0.1);
  --color-chat-own: rgba(0, 255, 136, 0.1);
  --color-chat-input: rgba(255, 255, 255, 0.08);

  /* Spacing System */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Z-index Scale */
  --z-dropdown: 40;
  --z-header: 50;
  --z-modal: 100;

  /* Touch Targets */
  --touch-target-min: 44px;

  /* Border Radius */
  --border-radius: 0.5rem;
  --border-radius-lg: 0.75rem;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  overflow-x: hidden;
}

body {
  padding-bottom: 80px; /* Add space for fixed app-controls */
}

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg-panel);
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: var(--touch-target-min);
  user-select: none;
}

.btn:hover:not(:disabled) {
  background: var(--color-accent);
  border-color: var(--color-accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: black;
  font-weight: 600;
}

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

.btn--small {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
  min-height: 32px;
}

/* Power Button Styles */
.power-btn {
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  border-radius: 50%;
  background: var(--color-bg-secondary);
  border: 2px solid var(--color-border);
  color: var(--color-text-secondary);
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px; /* Better centering for SVG */
}

.power-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  transform: scale(1.05);
}

.power-btn.active {
  background: #2d5a2d; /* Darker, more mellow green */
  border-color: #4a7c59; /* Mellow green border */
  color: #88c999; /* Soft green text */
}

.power-btn.active:hover {
  background: #1a4d3a; /* Even darker on hover */
  border-color: #5a8b5a;
}

.power-icon {
  width: 100%;
  height: 100%;
}

/* Form Elements */
input, textarea, select {
  width: 100%;
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg-panel);
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: var(--font-size-base);
  transition: all var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

input::placeholder, textarea::placeholder {
  color: var(--color-text-secondary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-small { font-size: var(--font-size-sm); }
.text-muted { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}