:root {
  --ink: #2a2140;
  --muted: #5c5470;
  --paper: #fffdf8;
  --card: #ffffff;
  --yellow: #ffc531;
  --red: #e4273c;
  --purple: #5b27a8;
  --line: #eadfce;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Outfit, "Avenir Next", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(ellipse 55% 42% at 32% 42%, rgba(255, 214, 90, 0.28), transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 100%, #f7f1e6, #efe6d6 72%);
}

.page {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 12px;
  display: grid;
  grid-template-columns: minmax(280px, 460px) minmax(280px, 420px);
  grid-template-areas:
    "horn intro"
    "horn panel";
  column-gap: 36px;
  row-gap: 8px;
  align-items: center;
}

.intro { grid-area: intro; align-self: end; padding-bottom: 8px; }
.horn-wrap { grid-area: horn; }
.panel { grid-area: panel; align-self: start; }

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--purple);
}

h1 {
  margin: 0;
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-size: clamp(2.7rem, 4.8vw, 4.4rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: #3a146c;
  white-space: nowrap;
}

.lede {
  margin: 14px 0 0;
  max-width: 38ch;
  font-size: 1.08rem;
  line-height: 1.45;
  color: var(--muted);
}

.horn-wrap {
  width: min(100%, 460px);
  margin: 0 auto;
}

#horn {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.key { cursor: pointer; }
.key-well { fill: #2a0c52; }
.key-face { fill: url(#keyFace); }
.key-num {
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-size: 15px;
  fill: #fff8ea;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  user-select: none;
}
.key.is-active .key-face { fill: url(#keyOn); }
.key.is-active .key-num { fill: #3a146c; }
.key:focus-visible { outline: none; }
.key:focus-visible .key-face {
  stroke: #3a146c;
  stroke-width: 3;
}
.key:active .key-face { transform: translateY(2px); }

.wave { opacity: 0; transform-box: fill-box; transform-origin: center; }
#horn.is-playing .wave {
  animation: ripple var(--beat, 0.6s) ease-out infinite;
}
#horn.is-playing .wave-b { animation-delay: calc(var(--beat, 0.6s) / 2); }
#horn.is-playing #cone {
  transform-box: fill-box;
  transform-origin: center;
  animation: pump var(--beat, 0.6s) ease-in-out infinite;
}

@keyframes ripple {
  0% { transform: scale(0.86); opacity: 0.45; }
  100% { transform: scale(1.22); opacity: 0; }
}
@keyframes pump {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px 18px 16px;
  box-shadow: 0 16px 40px rgba(58, 20, 108, 0.08);
}

.status {
  margin: 0 0 12px;
  min-height: 1.4em;
  font-weight: 700;
  color: #3a146c;
}

.lick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.lick {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  text-align: left;
  padding: 7px 10px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: #fbf7f0;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.lick:hover { border-color: #e4d3f5; }
.lick:focus-visible { outline: 3px solid #3a146c; outline-offset: 2px; }
.lick.is-active {
  background: #fff6d4;
  border-color: var(--yellow);
}
.lick-num {
  grid-row: 1 / span 2;
  align-self: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #5b27a8;
  color: white;
  font-family: "Lilita One", sans-serif;
  font-size: 1.05rem;
}
.lick.is-active .lick-num { background: #e09400; color: #3a146c; }
.lick-name { font-weight: 700; }
.lick-meta { color: var(--muted); font-size: 0.92rem; }

.volume-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  font-weight: 700;
}
input[type="range"] {
  width: 100%;
  accent-color: #5b27a8;
}
#volume-readout {
  min-width: 2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stop {
  width: 100%;
  margin-top: 14px;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--red);
  color: white;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 4px 0 #9d1024;
}
.stop:hover { filter: brightness(1.05); }
.stop:active { transform: translateY(2px); box-shadow: 0 2px 0 #9d1024; }
.stop:focus-visible { outline: 3px solid #3a146c; outline-offset: 2px; }
.stop:disabled {
  background: #d36a78;
  opacity: 1;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
kbd {
  display: inline-block;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid #ddd2c2;
  background: #fff;
  font-family: inherit;
  font-size: 0.85em;
}

footer {
  width: min(1040px, calc(100% - 32px));
  margin: 8px auto 28px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}
footer p { margin: 0; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}

@media (max-width: 860px) {
  .page {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "horn"
      "panel";
    width: min(520px, calc(100% - 28px));
    padding-top: 20px;
  }
  .intro { align-self: start; }
  .lede { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  #horn.is-playing .wave,
  #horn.is-playing #cone { animation: none; }
  .wave { display: none; }
}
