:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1f2733;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #6366f1;
  --accent-ink: #ffffff;
  --pop: #0f172a;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.06);
  --radius: 14px;
  /* noise-color swatches */
  --c-white: #e5e7eb;
  --c-pink:  #f472b6;
  --c-brown: #92603b;
  --c-blue:  #60a5fa;
  --c-green: #4ade80;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 17px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 18px; }

/* header / footer / crumbs */
.site-head { border-bottom: 1px solid var(--line); background: var(--card); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { font-weight: 800; font-size: 19px; color: var(--pop); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.nav a { color: var(--muted); font-size: 15px; margin-left: 18px; }
.crumbs { font-size: 13px; color: var(--muted); margin: 18px 0 4px; }
.crumbs a { color: var(--muted); }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.02em; margin: 10px 0 14px; }
.lead { color: var(--muted); margin: 0 0 20px; }
h2 { font-size: 20px; margin: 30px 0 12px; letter-spacing: -.01em; }
.site-foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0 50px; color: var(--muted); font-size: 14px; background: var(--card); }
.site-foot a { color: var(--muted); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 18px; }

/* ---- the machine ---- */
.machine { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 8px 0 18px; }

.player { display: flex; align-items: center; gap: 18px; }
.play-btn {
  font: inherit; font-weight: 700; font-size: 17px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px;
  padding: 14px 26px; min-width: 132px; justify-content: center;
}
.play-btn:hover { filter: brightness(1.08); }
.play-btn .pi { font-size: 15px; line-height: 1; }
.player-meta { flex: 1; min-width: 0; }
.nowcolor { font-weight: 700; font-size: 16px; color: var(--pop); }

/* little equalizer bars — animate only while playing */
.viz { display: flex; align-items: flex-end; gap: 4px; height: 22px; margin-top: 6px; }
.viz span { width: 5px; height: 5px; border-radius: 3px; background: var(--line); transition: background .2s; }
.machine.playing .viz span { background: var(--accent); animation: bar 1s ease-in-out infinite; }
.machine.playing .viz span:nth-child(2) { animation-delay: .12s; }
.machine.playing .viz span:nth-child(3) { animation-delay: .24s; }
.machine.playing .viz span:nth-child(4) { animation-delay: .36s; }
.machine.playing .viz span:nth-child(5) { animation-delay: .18s; }
.machine.playing .viz span:nth-child(6) { animation-delay: .30s; }
.machine.playing .viz span:nth-child(7) { animation-delay: .06s; }
@keyframes bar { 0%,100% { height: 5px; } 50% { height: 22px; } }
@media (prefers-reduced-motion: reduce) { .machine.playing .viz span { animation: none; height: 13px; } }

/* color swatches */
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 18px 0 4px; }
.swatch {
  display: flex; align-items: center; gap: 10px; text-align: left;
  font: inherit; cursor: pointer; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.swatch:hover { border-color: var(--accent); }
.swatch.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99,102,241,.18); }
.sw-dot { width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto; border: 1px solid rgba(15,23,42,.15); }
.sw-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sw-name { font-weight: 700; font-size: 15px; }
.sw-tag { color: var(--muted); font-size: 12px; }
.sw-white .sw-dot { background: var(--c-white); }
.sw-pink  .sw-dot { background: var(--c-pink); }
.sw-brown .sw-dot { background: var(--c-brown); }
.sw-blue  .sw-dot { background: var(--c-blue); }
.sw-green .sw-dot { background: var(--c-green); }

/* sliders row */
.sliders { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-top: 16px; }
.field { flex: 1; min-width: 150px; }
.field-vol { flex: 2; min-width: 200px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 26px; }
select { width: 100%; padding: 10px 12px; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }

/* waves toggle */
.field-waves { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-waves label[for=waves] { margin: 0; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: background .18s; }
.switch .track::before { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 2px rgba(15,23,42,.3); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(99,102,241,.35); }
.tinylabel { color: var(--muted); font-size: 12px; }

.playhint { color: var(--muted); font-size: 13px; margin: 16px 0 0; }

/* link grids */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 10px; }
.grid a { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; color: var(--ink); font-size: 15px; }
.grid a:hover { border-color: var(--accent); text-decoration: none; }
.chip-emoji { margin-right: 6px; }

/* prose + legend + ads */
.prose { margin: 22px 0; }
.prose p { margin: 0 0 14px; }
.legend { list-style: none; padding: 0; margin: 0 0 14px; }
.legend li { display: flex; align-items: center; gap: 9px; padding: 5px 0; }
.leg-dot { width: 15px; height: 15px; border-radius: 50%; flex: 0 0 auto; border: 1px solid rgba(15,23,42,.15); }
.leg-dot.sw-white { background: var(--c-white); }
.leg-dot.sw-pink  { background: var(--c-pink); }
.leg-dot.sw-brown { background: var(--c-brown); }
.leg-dot.sw-blue  { background: var(--c-blue); }
.leg-dot.sw-green { background: var(--c-green); }
.ad-slot {
  margin: 22px 0;
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, #eef2f6, #eef2f6 10px, #f4f7fa 10px, #f4f7fa 20px);
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: #94a3b8; font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
}

@media (max-width: 620px) {
  h1 { font-size: 23px; }
  .player { gap: 12px; }
  .play-btn { padding: 13px 18px; min-width: 112px; }
  .sliders { gap: 14px; }
}
