:root {
  --bg-primary: #0a0c10;
  --bg-surface: #141824;
  --text-main: #e2e8f0;
  --text-muted: #64748b;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --border: #1e293b;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background: var(--bg-primary);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.app-container {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

header {
  text-align: center;
  margin-bottom: 1.5rem;
}

h1 {
  font-size: 1.3rem;
  letter-spacing: 0.15em;
  color: var(--accent);
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.visualizer-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#pulseCanvas {
  width: 100%;
  height: 100%;
}

.frequency-badge {
  position: absolute;
  font-size: 1rem;
  font-weight: bold;
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-row, .slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.grid-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input, select {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-main);
  padding: 0.5rem;
  font-size: 0.9rem;
  outline: none;
}

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

.safety-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.action-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn {
  flex: 1;
  padding: 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}

.btn.primary {
  background: var(--accent);
  color: #000;
}

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

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

.progress-container {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.5s linear;
}