:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --card-bg: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #d9dce1;
  --accent: #2563eb;
  --accent-text: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

#app {
  width: 100%;
  max-width: 32rem;
}

.screen {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 2rem;
  animation: screen-in 320ms ease-out;
}

@keyframes screen-in {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.45);
  }
  60% {
    opacity: 1;
    transform: translateY(0) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen {
    animation: none;
  }
}

h1 {
  font-size: 1.4rem;
  margin-top: 0;
}

h2 {
  font-size: 1.15rem;
  margin-top: 0;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.progress {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

input[type="text"],
input[type="number"],
select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  font-size: 1rem;
  background: var(--card-bg);
  color: var(--text);
}

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.consent-label input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

button {
  font-size: 1rem;
  padding: 0.6rem 1.1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.play-row {
  margin: 1.5rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.loop-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.scale {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4.5rem, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.scale button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.25rem;
}

.scale button .value {
  font-weight: 600;
  font-size: 1.1rem;
}

.scale button .label {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.15rem;
  text-align: center;
}

.actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.mushra-grid {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 1.25rem;
}

.mushra-row {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  transition: border-color 150ms ease, background 150ms ease;
}

.mushra-row.playing {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.06);
}

button.playing {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.mushra-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.mushra-row-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.mushra-row-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.mushra-value {
  min-width: 2.5ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
}

.mushra-slider {
  width: 100%;
  accent-color: var(--accent);
}

.mushra-slider:disabled {
  opacity: 0.4;
}

.mushra-bands {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.waveform-wrap {
  margin-top: 1rem;
}

.waveform-canvas {
  display: block;
  width: 100%;
  height: 80px;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--card-bg);
  cursor: crosshair;
  touch-action: none;
}

.waveform-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.waveform-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

button.small {
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
}

.demo-card {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}

.demo-card h2 {
  margin-bottom: 0.25rem;
}

.button-link {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.6rem 1.1rem;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  font-size: 1rem;
}
