:root {
  /* Core Colors - Light Mode (Default) */
  --bg-color: #f0f2f5;
  --surface-color: #ffffff;
  --text-primary: #1a1b1e;
  --text-secondary: #6e727a;
  --accent-color: #0066cc; /* Brand Blue */
  --accent-glow: rgba(0, 102, 204, 0.3);
  --danger-color: #ff3b30;
  --success-color: #34c759;
  --ptt-idle: #e0e0e0;
  --ptt-active: #ff3b30; /* Red when talking */
  --ptt-shadow: #bebebe;
  
  /* Layout */
  --header-height: 60px;
  --safe-area-bottom: env(safe-area-inset-bottom, 20px);
  
  /* Effects */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.12);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: 1px solid rgba(255, 255, 255, 0.5);
  
  /* Typography */
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --ptt-idle: #333333;
    --ptt-active: #ff453a;
    --ptt-shadow: #000000;
    --glass-bg: rgba(30, 30, 30, 0.85);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none; /* App-like feel */
}

body {
  margin: 0;
  font-family: var(--font-stack);
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease;
}

/* --- Layout Structure --- */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.visualizer-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.controls-container {
  padding-bottom: calc(40px + var(--safe-area-bottom));
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 20px;
}

/* --- Components Styles (Host styles for Web Components) --- */

wn-header {
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

wn-channel-selector {
  width: 100%;
  max-width: 400px;
  padding: 0 20px;
}

/* PTT Button Styling - The Star of the Show */
wn-ptt-button {
  display: block;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--ptt-idle);
  box-shadow: 
    0 10px 20px rgba(0,0,0,0.2),
    inset 0 4px 8px rgba(255,255,255,0.2),
    inset 0 -4px 8px rgba(0,0,0,0.2);
  position: relative;
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
}

wn-ptt-button:active, wn-ptt-button[active] {
  transform: scale(0.95);
  background: var(--ptt-active);
  box-shadow: 
    0 4px 12px rgba(255, 59, 48, 0.4),
    inset 0 4px 12px rgba(0,0,0,0.3);
}

/* Ripple/Ring Effect */
wn-ptt-button::after {
  content: '';
  position: absolute;
  top: -10px; left: -10px; right: -10px; bottom: -10px;
  border-radius: 50%;
  border: 2px solid var(--ptt-active);
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
}

wn-ptt-button[active]::after {
  opacity: 1;
  transform: scale(1.1);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(1.05); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

.mic-icon {
  width: 48px;
  height: 48px;
  fill: var(--text-primary);
  opacity: 0.5;
  transition: all 0.2s ease;
}

wn-ptt-button[active] .mic-icon {
  fill: white;
  opacity: 1;
  transform: scale(1.1);
}

/* Modal / Settings Overlay */
.modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end; /* Bottom sheet on mobile */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-content {
  background: var(--bg-color);
  width: 100%;
  border-radius: 20px 20px 0 0;
  padding: 30px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-top: var(--glass-border);
}

.modal.open .modal-content {
  transform: translateY(0);
}

@media (min-width: 768px) {
  .modal { align-items: center; justify-content: center; }
  .modal-content { width: 400px; border-radius: 20px; transform: scale(0.9); }
  .modal.open .modal-content { transform: scale(1); }
}

input, select {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--text-secondary);
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 16px;
  margin-bottom: 15px;
  outline: none;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn {
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  background: var(--accent-color);
  color: white;
  width: 100%;
}