:root {
  color-scheme: dark;
  --bg: #0e0b1a;
  --bg-2: #140f24;
  --card: #191330;
  --card-2: #1f1839;
  --border: #322a54;
  --text: #f1edff;
  --text-dim: #ada6c9;
  --accent: #a78bfa;
  --accent-2: #f472b6;
  --accent-3: #34d1c5;
  --danger: #fb7185;
  --danger-2: #ef4444;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --radius: 20px;
  font-size: 16px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
}

.wrap {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Background blobs */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}
.blob-a { width: 420px; height: 420px; background: var(--accent); top: -120px; left: -100px; }
.blob-b { width: 380px; height: 380px; background: var(--accent-2); bottom: -140px; right: -80px; }
.blob-c { width: 320px; height: 320px; background: var(--accent-3); top: 40%; left: 60%; opacity: 0.2; }

/* Header */
.site-header {
  position: relative;
  z-index: 1;
  padding: 28px 0 10px;
}
.header-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo-mark {
  display: inline-flex;
  color: var(--accent-2);
}
.logo strong { color: var(--accent); font-weight: 800; }
.tagline {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-style: italic;
}

/* Main */
main.wrap {
  position: relative;
  z-index: 1;
  padding-bottom: 60px;
}

.hero {
  text-align: center;
  padding: 30px 0 34px;
}
.hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.15;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--text) 30%, var(--accent) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  max-width: 560px;
  margin: 0 auto;
  color: var(--text-dim);
  font-size: 1.02rem;
  line-height: 1.6;
}

.card {
  background: linear-gradient(160deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}

/* Recorder */
.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  color: var(--text-dim);
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.status-dot.recording {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.25);
  animation: pulse 1.4s ease-in-out infinite;
}
.status-dot.ready {
  background: var(--accent-3);
  box-shadow: 0 0 0 4px rgba(52, 209, 197, 0.2);
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.25); }
  50% { box-shadow: 0 0 0 8px rgba(251, 113, 133, 0.12); }
}
#statusText { flex: 1; }
.timer {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}

canvas#visualizer {
  width: 100%;
  height: 140px;
  display: block;
  background: #0b0818;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 22px;
}

.transport {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.mic-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #150f28;
  background: linear-gradient(150deg, var(--accent-3), var(--accent));
  box-shadow: 0 10px 30px -8px rgba(167, 139, 250, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mic-btn:hover { transform: translateY(-2px) scale(1.03); }
.mic-btn:active { transform: translateY(0) scale(0.97); }
.mic-btn.recording {
  background: linear-gradient(150deg, var(--danger), var(--danger-2));
  box-shadow: 0 10px 30px -8px rgba(239, 68, 68, 0.6);
  animation: mic-pulse 1.4s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45), 0 10px 30px -8px rgba(239, 68, 68, 0.6); }
  50% { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0), 0 10px 30px -8px rgba(239, 68, 68, 0.6); }
}
.mic-btn:disabled { opacity: 0.5; cursor: not-allowed; animation: none; }

.playback-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}
.pill-btn:hover { background: rgba(255, 255, 255, 0.09); transform: translateY(-1px); }
.pill-btn:active { transform: translateY(0); }
.pill-btn.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #150f28;
}
.pill-btn.primary:hover { filter: brightness(1.06); }
.pill-btn.ghost {
  background: transparent;
  color: var(--text-dim);
}
.pill-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 18px 0 0;
}

/* Effects */
.effects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}
.effects-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.reverse-toggle, .fx-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  user-select: none;
}
.reverse-toggle input, .fx-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #352c56;
  border: 1px solid var(--border);
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #cfc7ef;
  transition: transform 0.2s ease, background 0.2s ease;
}
input:checked + .switch {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-color: transparent;
}
input:checked + .switch::after {
  transform: translateX(18px);
  background: #150f28;
}
input:focus-visible + .switch {
  outline: 2px solid var(--accent-3);
  outline-offset: 2px;
}

.effect-row {
  display: grid;
  grid-template-columns: 130px 1fr 60px;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.effect-row label {
  font-weight: 600;
  font-size: 0.92rem;
}
.effect-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--accent-3);
  font-weight: 700;
  font-size: 0.9rem;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #352c56;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--accent-3), var(--accent));
  border: 2px solid #0e0b1a;
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--accent-3), var(--accent));
  border: 2px solid #0e0b1a;
  cursor: pointer;
}
input[type="range"]:disabled { opacity: 0.35; }

.effect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.effect-toggle {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.effect-toggle input[type="range"] { margin-top: 12px; }

.preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.preset-label {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-right: 4px;
}
.chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.chip:hover { background: rgba(255, 255, 255, 0.09); transform: translateY(-1px); }

/* About */
.about-card h2 { margin-top: 0; font-size: 1.2rem; }
.about-card ol {
  color: var(--text-dim);
  line-height: 1.7;
  padding-left: 22px;
  margin-bottom: 0;
}
.about-card li { margin-bottom: 8px; }
.about-card li:last-child { margin-bottom: 0; }

/* Footer */
.site-footer {
  position: relative;
  z-index: 1;
  padding: 20px 0 40px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
}

@media (max-width: 560px) {
  .card { padding: 20px; }
  .effect-row {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .effect-value { text-align: left; }
  .mic-btn { width: 74px; height: 74px; }
}
