:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --fg: #e7e9ec;
  --muted: #8b93a1;
  --accent: #5eead4;
  --accent-dim: #1f3d3a;
  --danger: #f87171;
  --border: #22262c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: 2rem 1rem;
}

header {
  text-align: center;
}

h1 {
  margin: 0;
  font-family: "Permanent Marker", cursive;
  font-size: 2.5rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--accent);
  text-shadow:
    2px 2px 0 rgba(255, 255, 255, 0.08),
    -2px 3px 10px rgba(94, 234, 212, 0.35);
  transform: rotate(-2deg);
}

.tag {
  position: fixed;
  font-family: "Permanent Marker", cursive;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  pointer-events: none;
  user-select: none;
  opacity: 0.5;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.6));
  z-index: 0;
}

.tag--king-b {
  top: 1rem;
  left: 1rem;
  color: #ff6ec7;
  transform: rotate(-9deg);
}

.tag--liny-v {
  bottom: 1rem;
  right: 1rem;
  color: #7dd3fc;
  transform: rotate(7deg);
}

.tag--dr-kai {
  top: 1rem;
  right: 1rem;
  color: #fbbf24;
  transform: rotate(8deg);
}

.tag--mart-d {
  bottom: 1rem;
  left: 1rem;
  color: #a3e635;
  transform: rotate(-6deg);
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 360px;
}

.effect-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: #14171b;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.95rem;
}

.mic-button {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #14171b;
  color: var(--fg);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.mic-button:hover {
  border-color: var(--accent);
}

.mic-button.listening {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.5);
  animation: pulse 1.6s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.45); }
  70%  { box-shadow: 0 0 0 22px rgba(94, 234, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); }
}

.frame-flow {
  width: 100%;
}

.frame-flow-label {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.frame-flow-canvas {
  display: block;
  width: 100%;
  height: 56px;
  border-radius: 0.5rem;
  background: #14171b;
  border: 1px solid var(--border);
}

.frame-flow-legend {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.4rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.legend-swatch {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: middle;
}

.legend-swatch--pass {
  background: var(--accent);
  opacity: 0.55;
}

.legend-swatch--hit {
  background: #ff6ec7;
}

.level-meter {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #14171b;
  border: 1px solid var(--border);
  overflow: hidden;
}

.level-meter-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.05s linear;
}

.status {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.status.error {
  color: var(--danger);
}

.tuning {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
}

.tuning summary {
  cursor: pointer;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tuning summary:hover {
  color: var(--fg);
}

.tuning-row {
  margin-top: 0.9rem;
}

.tuning-row label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.tuning-hint {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 400;
}

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

.tuning-controls input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}

.tuning-controls input[type="number"] {
  width: 4.5rem;
  padding: 0.3rem 0.4rem;
  background: #14171b;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  font-size: 0.8rem;
}

.tuning-unit {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.tuning-note {
  margin: 0.9rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}

footer {
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

footer a {
  color: inherit;
}
