/* IN KEY — Tactile Instrument
 *
 * A physical desk object: bone plastic, ink silkscreen, one safety-orange
 * accent, hard drop shadows that collapse when you press. Nothing glows except
 * the display, because on real hardware nothing does.
 */

:root {
  --bone:    #F4F1EA;
  --bone-2:  #EAE5DA;
  --bone-3:  #DDD6C6;
  --ink:     #191714;
  --ink-2:   #3A352E;
  --ink-3:   #6E675C;
  --ink-4:   #9A9285;
  --orange:  #FF4D14;
  --amber:   #E8A317;
  --screen:  #14120F;
  --screen-2:#1E1B16;

  /* The device is a bone-plastic object and stays bone in either theme — a
     physical thing doesn't invert. What changes is the bench it sits on. */
  --bench-1: #D4CDBE;
  --bench-2: #C6BFB0;
  --bench-3: #B3AC9D;
  --device-shadow: 0 10px 0 rgba(25, 23, 20, .13), 0 28px 56px rgba(25, 23, 20, .26);

  --edge: 1.5px solid var(--ink);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --display: "Helvetica Neue", Helvetica, "Arial Nova", Arial, sans-serif;
  --ease-press: cubic-bezier(.32, 1.5, .58, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bench-1: #322E28; --bench-2: #211E1A; --bench-3: #131110;
    --device-shadow: 0 10px 0 rgba(0,0,0,.55), 0 30px 74px rgba(0,0,0,.62);
  }
}
:root[data-theme="light"] {
  --bench-1: #D4CDBE; --bench-2: #C6BFB0; --bench-3: #B3AC9D;
  --device-shadow: 0 10px 0 rgba(25, 23, 20, .13), 0 28px 56px rgba(25, 23, 20, .26);
}
:root[data-theme="dark"] {
  --bench-1: #322E28; --bench-2: #211E1A; --bench-3: #131110;
  --device-shadow: 0 10px 0 rgba(0,0,0,.55), 0 30px 74px rgba(0,0,0,.62);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 90% at 50% 0%, var(--bench-1) 0%, var(--bench-2) 55%, var(--bench-3) 100%);
  font-family: var(--mono);
  color: var(--ink);
  display: flex;
  justify-content: center;
  /* Without this the device is a stretched flex item and its bone surface runs
     to the bottom of the viewport below the footer. */
  align-items: flex-start;
  padding: clamp(10px, 2.5vw, 34px) clamp(8px, 2vw, 28px) 56px;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain — the detail that stops it reading as flat vector art. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: .2;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.device {
  width: 100%;
  max-width: 960px;
  background: var(--bone);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--device-shadow);
  overflow: hidden;
}

/* ── shared controls ────────────────────────────────────────────────── */

.btn {
  appearance: none;
  font: inherit; font-family: var(--mono);
  font-size: 11px; letter-spacing: .14em;
  padding: 10px 15px 9px;
  background: var(--bone-2);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .2s var(--ease-press), box-shadow .2s var(--ease-press), background .14s;
  user-select: none; touch-action: manipulation; white-space: nowrap;
}
.btn:hover { background: #F1ECE1; }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); transition-duration: 0s; }
.btn:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 3px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--orange); color: #FFF6F2; }
.btn.primary:hover { background: #FF5C28; }
.btn.tiny { font-size: 9.5px; letter-spacing: .1em; padding: 6px 9px 5px; box-shadow: 0 3px 0 var(--ink); }
.btn.tiny:active { transform: translateY(3px); }
.btn.ghost { background: transparent; box-shadow: none; border-color: rgba(25,23,20,.28); color: var(--ink-3); }
.btn.ghost:active { transform: none; }
.btn.rec[aria-pressed="true"] { background: var(--orange); color: #FFF6F2; }

.led {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--bone-3);
  box-shadow: inset 0 0 0 1.2px rgba(25,23,20,.5);
  margin-right: 7px; vertical-align: middle; transform: translateY(-1px);
}
.led.on { background: #FFF6F2; box-shadow: inset 0 0 0 1.2px rgba(25,23,20,.3), 0 0 8px rgba(255,255,255,.7); }

.panel-label { font-size: 9px; letter-spacing: .26em; color: var(--ink-3); text-transform: uppercase; }

select {
  font: inherit; font-family: var(--mono); font-size: 12px;
  padding: 7px 8px;
  background: var(--bone-2);
  border: 1.5px solid var(--ink);
  border-radius: 3px; color: var(--ink); cursor: pointer;
}
select:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; }

.note { font-size: 10.5px; line-height: 1.6; letter-spacing: .04em; color: var(--ink-3); margin: 2px 0 0; }
.note.inline { margin: 0; align-self: center; }
.note b { font-weight: 400; color: var(--ink); }

.chip { width: 9px; height: 9px; border-radius: 2px; border: 1.4px solid var(--ink); flex: none; display: inline-block; }

/* ── header ─────────────────────────────────────────────────────────── */

.head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 15px 24px 13px;
  border-bottom: var(--edge);
  background: linear-gradient(180deg, #F7F4EE, var(--bone));
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.wordmark {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(22px, 3.6vw, 31px);
  /* Looser than the old five-letter wordmark carried. "IN KEY" is two words, and
     at -.055em the space between them closed up until it read as one. */
  letter-spacing: -.03em; line-height: .85; margin: 0;
}
.tagline {
  margin: 0; font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3);
  flex: 1 1 auto;
}
.head-actions { display: flex; gap: 8px; }

/* ── now playing (the one thing that glows) ─────────────────────────── */

.now {
  margin: 13px 24px;
  background: linear-gradient(180deg, var(--screen-2), var(--screen));
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: auto auto auto auto minmax(60px, 1fr);
  align-items: center;
  gap: 7px 18px;
  box-shadow: inset 0 3px 10px rgba(0,0,0,.55);
  position: relative; overflow: hidden;
}
.now::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px);
}
.playbtn {
  appearance: none;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid var(--orange);
  background: rgba(255,77,20,.12);
  color: var(--orange);
  cursor: pointer; display: grid; place-items: center;
  transition: transform .18s var(--ease-press), background .16s;
}
.playbtn:hover { background: rgba(255,77,20,.24); }
.playbtn:active { transform: scale(.92); transition-duration: 0s; }
.playbtn[aria-pressed="true"] { background: var(--orange); color: #FFF6F2; }
.playbtn:focus-visible { outline: 2.5px solid var(--orange); outline-offset: 3px; }

.now-time {
  font-size: 14px; color: var(--orange);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(255,77,20,.45); white-space: nowrap;
}
.now-sep { opacity: .45; margin: 0 3px; }
/* min-width holds the slot open while the value is a placeholder. */
.now-read { display: flex; flex-direction: column; gap: 2px; min-width: 84px; }
.now-k { font-size: 8px; letter-spacing: .22em; color: #7E7466; text-transform: uppercase; }
.now-v {
  font-size: 12.5px; color: var(--orange);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 9px rgba(255,77,20,.4); white-space: nowrap;
}
.now-v.amber { color: var(--amber); text-shadow: 0 0 9px rgba(232,163,23,.4); }
#scope { width: 100%; height: 34px; display: block; opacity: .9; }
.now-meta {
  grid-column: 1 / -1;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: 8.5px; letter-spacing: .16em; color: #8A8073; text-transform: uppercase;
  border-top: 1px solid rgba(255,255,255,.07); padding-top: 7px;
}
.now-mode { color: #6E6558; }

/* ── the recipe ─────────────────────────────────────────────────────── */

.recipe { list-style: none; margin: 0; padding: 0; counter-reset: none; }

.step {
  position: relative;
  border-bottom: 1px solid rgba(25,23,20,.11);
  background: var(--bone);
  transition: background .2s;
}
.step:last-child { border-bottom: 0; }
.step.open { background: var(--bone-2); }

.step-head {
  appearance: none;
  font: inherit; font-family: var(--mono);
  width: 100%;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 14px;
  padding: 13px 24px 12px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.step-head:hover { background: rgba(25,23,20,.03); }
.step-head:focus-visible { outline: 2.5px solid var(--ink); outline-offset: -3px; }

.step-n {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10.5px;
  border: 1.5px solid var(--ink);
  background: var(--bone);
  color: var(--ink-3);
  flex: none;
}
.step.done .step-n { background: var(--ink); color: var(--bone); }
.step.open .step-n { background: var(--orange); border-color: var(--ink); color: #FFF6F2; }

.step-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step-title { font-size: 13px; letter-spacing: .04em; }
.step-title em {
  font-style: normal; font-size: 9.5px; letter-spacing: .06em;
  color: var(--ink-3); line-height: 1.4;
}
.step:not(.done):not(.open) .step-title { color: var(--ink-4); }
.step:not(.done):not(.open) .step-title em { color: var(--ink-4); }

.step-sum {
  font-size: 10.5px; letter-spacing: .05em;
  color: var(--orange);
  text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 230px;
}
.step-caret { font-size: 9px; color: var(--ink-3); transition: transform .22s var(--ease-press); }
.step.open .step-caret { transform: rotate(180deg); }


.step-body {
  padding: 2px 24px 20px 64px;
  display: flex; flex-direction: column; gap: 20px;
  border-left: 2px solid rgba(255,77,20,.28);
  margin-left: 36px;
}
.step-next { display: flex; justify-content: flex-end; padding-top: 4px; border-top: 1px dashed rgba(25,23,20,.2); }
.step-next .btn { font-size: 12px; padding: 12px 20px 11px; }

/* ── groups + cards ─────────────────────────────────────────────────── */

.group { display: flex; flex-direction: column; gap: 10px; }
.group-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.group-note { font-size: 9.5px; letter-spacing: .08em; color: var(--ink-3); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 8px; }
/* Six choices auto-fit to five across plus a lone orphan on the second row. Three
   across gives an even 2x3 instead. Written as a count test rather than a class
   on the dish step, so any future step with six options is laid out correctly too. */
.cards:has(> :nth-child(6)) { grid-template-columns: repeat(3, 1fr); }

.card {
  appearance: none;
  font: inherit; font-family: var(--mono);
  text-align: left;
  background: var(--bone);
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  box-shadow: 0 4px 0 var(--ink);
  padding: 10px 11px 9px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform .2s var(--ease-press), box-shadow .2s var(--ease-press), background .15s;
  color: var(--ink);
}
.card:hover { background: #F8F5EF; }
.card:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); transition-duration: 0s; }
.card:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 3px; }
.card[aria-pressed="true"] {
  background: var(--orange); color: #FFF6F2;
  transform: translateY(4px); box-shadow: 0 0 0 var(--ink);
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-name { font-size: 12px; letter-spacing: .04em; }
.card-tick { font-size: 8px; opacity: 0; }
.card[aria-pressed="true"] .card-tick { opacity: 1; }
.card-hint { font-size: 9.5px; letter-spacing: .04em; line-height: 1.45; color: var(--ink-3); }
.card[aria-pressed="true"] .card-hint { color: rgba(255,246,242,.82); }
.card-ref { font-size: 8.5px; letter-spacing: .1em; color: var(--ink-3); text-transform: uppercase; }
.card[aria-pressed="true"] .card-ref { color: rgba(255,246,242,.75); }

.nz { position: relative; height: 24px; background: rgba(25,23,20,.07); border-radius: 2px; overflow: hidden; }
.nz i { position: absolute; height: 3px; border-radius: 2px; background: var(--ink); }
.card[aria-pressed="true"] .nz { background: rgba(255,246,242,.16); }
.card[aria-pressed="true"] .nz i { background: #FFF6F2; }

.cz { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 10px; }
.cz b { font-weight: 400; letter-spacing: .01em; }
.cz i { font-style: normal; opacity: .4; font-size: 8.5px; }

/* ── the drum grid ──────────────────────────────────────────────────── */

.grid { display: flex; flex-direction: column; gap: 5px; }

.grow {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
}
.grow-k {
  font-size: 9.5px; letter-spacing: .14em;
  color: var(--ink); display: flex; align-items: center; gap: 7px;
}
.grow-a { justify-self: end; }
.grow.ruler { height: 13px; }
.gr {
  font-size: 8px; letter-spacing: .1em; color: var(--ink-3);
  display: grid; place-items: center;
}
.gr.beat { color: var(--ink); }

.gcells { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; }

.gcell {
  appearance: none;
  aspect-ratio: 1;
  min-height: 22px;
  padding: 0;
  border: 1.3px solid rgba(25,23,20,.22);
  border-radius: 3px;
  background: var(--bone-3);
  cursor: pointer;
  box-shadow: inset 0 1.5px 2px rgba(25,23,20,.14);
  transition: background .1s, transform .12s var(--ease-press);
  position: relative;
}
.gcell.beat { border-color: rgba(25,23,20,.5); }
.gcell:hover { background: #D2CABA; }
.gcell.soft { background: var(--tint, var(--ink)); opacity: .5; box-shadow: none; }
.gcell.on { background: var(--tint, var(--ink)); opacity: 1; box-shadow: 0 2px 0 rgba(25,23,20,.4); border-color: var(--ink); }
.gcell:active { transform: scale(.9); }
.gcell.cursor::after {
  content: ''; position: absolute; inset: -3px;
  border: 1.5px solid var(--orange); border-radius: 4px;
}
.gcell:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; }

/* ── strips, steppers, sliders ──────────────────────────────────────── */

.strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.stepper {
  display: flex; align-items: center; gap: 8px;
  background: var(--bone);
  border: 1.5px solid var(--ink);
  border-radius: 4px; padding: 6px 9px;
}
.stepper-k { font-size: 9px; letter-spacing: .18em; color: var(--ink-3); text-transform: uppercase; }
.stepper b { font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; min-width: 32px; text-align: center; }
.stepper-u { font-size: 9px; letter-spacing: .1em; color: var(--ink-3); }

.sl { display: flex; align-items: center; gap: 10px; flex: 1 1 240px; min-width: 0; }
.sl-k { font-size: 9px; letter-spacing: .16em; color: var(--ink-3); text-transform: uppercase; min-width: 54px; }
.sl-track {
  position: relative; flex: 1 1 auto; height: 22px;
  background: var(--bone-3);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: inset 0 2px 4px rgba(25,23,20,.26);
  cursor: ew-resize; touch-action: none; min-width: 80px;
}
.sl-fill { position: absolute; inset: 1.5px auto 1.5px 1.5px; width: calc(var(--v, 50%) - 3px); background: var(--orange); border-radius: 2px; }
.sl-knob {
  position: absolute; top: -1.5px; bottom: -1.5px; left: var(--v, 50%);
  width: 12px; margin-left: -6px;
  background: var(--bone); border: 1.5px solid var(--ink); border-radius: 3px;
  box-shadow: 0 2px 0 rgba(25,23,20,.45);
}
.sl-track:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 3px; }
.sl-v { font-size: 10px; letter-spacing: .05em; min-width: 56px; font-variant-numeric: tabular-nums; }

/* ── timeline ───────────────────────────────────────────────────────── */

.song-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.song-note { font-size: 9.5px; letter-spacing: .1em; color: var(--ink-3); flex: 1 1 auto; }

.tl { display: flex; gap: 5px; align-items: stretch; overflow-x: auto; padding-bottom: 4px; }

.blk {
  position: relative;
  flex: 1 1 0; min-width: 54px; height: 74px;
  background: var(--bone);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer; overflow: hidden; padding: 0;
}
.blk:hover { background: #F8F5EF; }
.blk:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 3px; }
.blk.dragging { opacity: .55; transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.blk.dropbefore { box-shadow: -3px 0 0 var(--orange), 0 3px 0 var(--ink); }
/* Height is energy. The silhouette of the row is the shape of the track. */
.blk-bar { position: absolute; left: 0; right: 0; bottom: 0; background: var(--tint); opacity: .3; transition: opacity .2s; }
.blk.live .blk-bar { opacity: .55; }
.blk::after {
  content: ''; position: absolute; inset: 0 auto 0 0;
  width: var(--played, 0%);
  background: rgba(255,77,20,.16);
  border-right: 1.5px solid rgba(255,77,20,.55);
  pointer-events: none; transition: width .1s linear;
}
.blk:not(.live)::after { border-right-color: transparent; }
.blk-name { position: absolute; left: 6px; bottom: 5px; font-size: 9.5px; letter-spacing: .08em; }
.blk-bars { position: absolute; left: 6px; top: 5px; font-size: 8.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.blk-x {
  position: absolute; top: 2px; right: 2px;
  width: 17px; height: 17px;
  border: 0; border-radius: 3px; background: transparent;
  color: var(--ink-3); font: inherit; font-size: 13px; line-height: 1;
  cursor: pointer; opacity: 0; transition: opacity .15s;
}
.blk:hover .blk-x, .blk:focus-within .blk-x { opacity: 1; }
.blk-x:hover { background: var(--orange); color: #FFF6F2; }

.addrow { display: flex; gap: 5px; flex-wrap: wrap; }
/* An author `display` beats the UA's [hidden] rule regardless of specificity,
   so the row has to opt out explicitly or it is always open. */
.addrow[hidden] { display: none; }
.addrow .btn { border-left: 4px solid var(--tint); }

/* ── the live keyboard ──────────────────────────────────────────────── */

.live {
  border-top: var(--edge);
  background: var(--bone-2);
  padding: 16px 24px 20px;
  display: flex; flex-direction: column; gap: 11px;
}
.live-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.live-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.kb-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }

.key {
  appearance: none;
  font: inherit; font-family: var(--mono);
  /* Wider than tall. Square keys at this width made the keyboard tower over
     the recipe it is supposed to sit underneath. */
  aspect-ratio: 1 / .5;
  min-height: 54px;
  background: var(--bone);
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--ink), 0 7px 11px rgba(25,23,20,.14);
  transition: transform .24s var(--ease-press), box-shadow .24s var(--ease-press), background .25s;
  touch-action: none; user-select: none;
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  padding: 6px 7px;
  position: relative; overflow: hidden;
}
.key:hover { background: #F9F6F0; }
/* Lit means "this note is in the chord playing right now" — the teaching cue. */
.key.inchord { box-shadow: inset 0 4px 0 var(--amber), 0 5px 0 var(--ink), 0 7px 11px rgba(25,23,20,.14); }
.key.down {
  transform: translateY(5px);
  box-shadow: 0 0 0 var(--ink), 0 1px 3px rgba(25,23,20,.2);
  background: var(--orange);
  transition-duration: 0s;
}
.key:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 3px; }
.key-n { font-size: 11px; font-variant-numeric: tabular-nums; }
.key-c { font-size: 8.5px; letter-spacing: .1em; color: var(--ink-3); }
.key.down .key-n, .key.down .key-c { color: #FFF6F2; }

.takes { display: flex; flex-direction: column; gap: 5px; }
.take {
  display: grid;
  grid-template-columns: 22px 1fr auto auto auto;
  align-items: center; gap: 9px;
  background: var(--bone);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 10.5px; letter-spacing: .05em;
}
.take.muted { opacity: .5; }
.take-n {
  display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--ink); color: var(--bone); font-size: 9px;
}
.take-c { color: var(--ink-3); font-size: 9.5px; }

/* ── footer + toast ─────────────────────────────────────────────────── */

.foot {
  padding: 12px 24px 15px;
  border-top: var(--edge);
  background: var(--bone);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: 8.5px; letter-spacing: .13em; color: var(--ink-3); text-transform: uppercase;
}

.toast {
  position: fixed; left: 50%; bottom: 22px;
  transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bone);
  font-size: 11px; letter-spacing: .09em;
  padding: 12px 18px; border-radius: 5px;
  box-shadow: 0 8px 26px rgba(25,23,20,.42);
  opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .32s var(--ease-press);
  z-index: 200; max-width: min(90vw, 520px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── responsive ─────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .head, .foot, .live { padding-left: 14px; padding-right: 14px; }
  .now { margin-left: 14px; margin-right: 14px; grid-template-columns: auto auto 1fr; }
  #scope { grid-column: 1 / -1; }
  .step-head { padding-left: 14px; }
  .step-body { padding-left: 40px; padding-right: 14px; margin-left: 20px; }
  .cards, .cards:has(> :nth-child(6)) { grid-template-columns: 1fr 1fr; }
  .grow { grid-template-columns: 64px minmax(0, 1fr) 28px; gap: 7px; }
  .grow-k { font-size: 8.5px; letter-spacing: .06em; }
}

@media (max-width: 520px) {
  .now-read { display: none; }
  .cards, .cards:has(> :nth-child(6)) { grid-template-columns: 1fr; }
  .step-sum { max-width: 110px; }
  .step-head { padding-right: 74px; }
  .gcell { min-height: 16px; }
  .gcells { gap: 2px; }
  .key { aspect-ratio: 1 / 1.1; }
  .key-c { display: none; }
}

/* ── accessibility ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .key.down, .card:active, .btn:active, .blk.dragging, .gcell:active { transform: none; }
  .step-caret { transform: none !important; }
}
@media (prefers-contrast: more) {
  :root { --ink-3: #464038; --ink-4: #6A6358; }
  .gcell { border-color: rgba(25,23,20,.45); }
}

/* ── taste-test tools on a finished ingredient ──────────────────────── */

/* One cluster, so OFF and SOLO cannot drift apart as the row width changes. */
.step-tools {
  position: absolute;
  top: 12px; right: 20px;
  display: flex; align-items: center; gap: 6px;
}

/* Live activity. A dot that brightens and swells with whatever that ingredient
   is playing — the point is to connect a name in the recipe to a sound you can
   hear, which no static label can do. */
.step-act {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bone-3);
  box-shadow: inset 0 0 0 1.2px rgba(25, 23, 20, .3);
  --lvl: 0;
  transform: scale(calc(1 + var(--lvl) * 0.6));
  background-color: color-mix(in oklab, var(--orange) calc(var(--lvl) * 100%), var(--bone-3));
  transition: transform 90ms linear, background-color 90ms linear;
  flex: none;
}

.step-solo, .step-mute {
  appearance: none;
  font: inherit; font-family: var(--mono);
  font-size: 8.5px; letter-spacing: .12em;
  padding: 4px 7px 3px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  cursor: pointer;
}
.step-solo { background: var(--bone); color: var(--ink-3); }
.step-solo.on { background: var(--amber); color: var(--ink); }
.step-mute { background: var(--ink); color: var(--bone); }
.step-mute.off { background: var(--bone-3); color: var(--ink-3); }
.step-solo:focus-visible, .step-mute:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; }

/* The head has to leave room for the cluster. */
.step-head { padding-right: 150px; }

/* A soloed track needs to say so somewhere you are already looking. */
.now-mode.solo { color: var(--amber); }

@media (max-width: 520px) {
  .step-head { padding-right: 132px; }
  .step-sum { max-width: 78px; }
}
@media (prefers-reduced-motion: reduce) {
  .step-act { transform: none; }
}

/* ── quiet attribution ─────────────────────────────────────────────────── */
.byline { margin-top: 16px; width: 100%; text-align: center; font-size: 12px; letter-spacing: .02em; opacity: .55; }
.byline a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.byline a:hover { opacity: 1; }
.byline span { margin: 0 6px; opacity: .5; }

/* ── footer credit ──────────────────────────────────────────────────── */

/* CC-BY asks for attribution "in a reasonable manner", so the sources are named
   here in the page rather than only behind a link. */
.foot-credit { max-width: 68ch; line-height: 1.7; text-transform: none; letter-spacing: .04em; }
.foot-credit a { color: var(--ink-2); }
.byline { margin: 0; font-size: 8.5px; letter-spacing: .13em; color: var(--ink-3); }
.byline a { color: var(--ink-2); }
