/* The Song Studio (ADR-0074). Phones first: the play bar sticks to the top,
   the keyboard to the bottom, everything between scrolls. */

#music { --gap: var(--space-3); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); padding-bottom: var(--space-6); }
#music > * { min-width: 0; }
#music [hidden] { display: none !important; }
.h { font-size: var(--step-1); margin: var(--space-3) 0 var(--space-2); }
.hint { color: var(--ink-soft); margin: 0 0 var(--space-2); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.row .btn { padding-inline: var(--space-4); }
.status { min-height: 1.6em; margin: 0; color: var(--ink-soft); text-align: center; }

.round {
  display: grid; place-items: center; flex: 0 0 auto; width: var(--tap); height: var(--tap); padding: 0; border: 0;
  border-radius: var(--radius-full); background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  font: 700 var(--step-1)/1 var(--font-ui); cursor: pointer; touch-action: manipulation;
}
.round[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.round:disabled { opacity: .35; cursor: default; }
.round:active:not(:disabled) { transform: translateY(1px); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: var(--radius-full); background: var(--surface); box-shadow: var(--shadow); }
.seg button {
  min-height: calc(var(--tap) - 6px); padding: 0 var(--space-4); border: 0; border-radius: var(--radius-full);
  background: transparent; color: var(--ink); font: 700 var(--step-0)/1 var(--font-ui); cursor: pointer; touch-action: manipulation;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg.small button { padding: 0 var(--space-3); font-size: var(--step--1); }

.chip-btn {
  min-height: var(--tap); padding: 0 var(--space-4); border: 0; border-radius: var(--radius-full);
  background: var(--surface-2); color: var(--ink); font: 700 var(--step--1)/1.1 var(--font-ui); cursor: pointer; touch-action: manipulation;
}

/* ---- the deck ---- */
.deck {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-2);
  margin-inline: calc(-1 * var(--space-2)); padding: var(--space-2); border-radius: 0 0 var(--radius) var(--radius);
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
/* In a Home Screen app the deck sticks under the status bar but its buttons sit
   below the system's blur band, on a solid deck (ADR-0105). */
.app .deck { top: calc(var(--app-top) - var(--app-edge)); padding-top: calc(var(--space-2) + var(--app-edge)); background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
.play {
  display: grid; place-items: center; flex: 0 0 auto; width: 4.2rem; height: 4.2rem; padding: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); font: 400 1.9rem/1 var(--font-ui);
  cursor: pointer; touch-action: manipulation;
}
.play[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.nowbox { flex: 1 1 auto; min-width: 0; display: grid; line-height: 1.05; }
.nowbox b { font-size: var(--step-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowbox small { color: var(--ink-soft); font-weight: 600; }
.rec[aria-pressed="true"] { background: #e23b4e; color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgb(226 59 78 / .25); } }
@media (max-width: 26rem) { .deck .round { width: 46px; height: 46px; font-size: var(--step-0); } .deck { gap: 6px; } }

/* the chords of the song, one a bar; tap one to jump there */
.strip { flex: none; min-height: 48px; display: flex; gap: 4px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 2px; }
.strip button {
  flex: 0 0 auto; min-width: 3.2rem; min-height: 44px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); font: 700 var(--step--1)/1 var(--font-ui);
  cursor: pointer; touch-action: manipulation;
}
.strip button.now { background: var(--accent-2); color: #fff; box-shadow: none; }
.strip button.loop { box-shadow: inset 0 -4px 0 var(--accent-3), inset 0 0 0 2px var(--line); }

/* ---- the four ways in ---- */
.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.modes button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tap); padding: 4px 2px;
  border: 0; border-radius: calc(var(--radius) - 4px); background: transparent; color: var(--ink);
  font: 700 var(--step--1)/1.1 var(--font-ui); cursor: pointer; touch-action: manipulation;
}
.modes button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.modes button > span:first-child { font-size: 1.25rem; }

/* ---- Play ---- */
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr)); gap: var(--space-2); }
.style {
  display: grid; place-items: center; gap: 2px; min-height: 4.6rem; padding: var(--space-2); border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font: 700 var(--step--1)/1.15 var(--font-ui);
  cursor: pointer; touch-action: manipulation;
}
.style span { font-size: 1.7rem; line-height: 1; }
.style[aria-pressed="true"] { background: var(--accent-2); color: #fff; }
.dials { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; margin-top: var(--space-3); }
.dial { display: flex; align-items: center; gap: var(--space-2); }
.dial b { min-width: 3.2rem; text-align: center; font-size: var(--step-1); }
.dial-name { font-weight: 700; color: var(--ink-soft); }
.band { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: var(--space-2); }
.player {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-2);
  padding: var(--space-2); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.player .on {
  grid-column: 1 / 3; display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap); padding: 0 var(--space-2);
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); text-align: start;
  font: 700 var(--step-0)/1.15 var(--font-ui); cursor: pointer; touch-action: manipulation;
}
.player .on span:first-child { font-size: 1.3rem; }
.player .on { min-width: 0; overflow-wrap: anywhere; font-size: .95rem; padding: 0 2px; gap: 6px; }
.player .round { width: 44px; height: 44px; font-size: var(--step-0); }
.player .on small { display: block; font-weight: 500; color: var(--ink-soft); font-size: var(--step--1); }
.player.off { opacity: .55; }
.player.off .on span:first-child { filter: grayscale(1); }
.player .lamp { position: absolute; top: 8px; left: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); opacity: 0; transition: opacity .08s; }
.player .lamp.flash { opacity: 1; }

/* ---- the keyboard ---- */
.keydock {
  position: sticky; bottom: 0; z-index: 15; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2);
  margin-inline: calc(-1 * var(--space-2)); padding: var(--space-2) var(--space-2) max(var(--space-2), env(safe-area-inset-bottom));
  border-radius: var(--radius) var(--radius) 0 0; background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 -6px 20px rgb(0 0 0 / .08);
}
.keybar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.keybar .round { width: 46px; height: 46px; font-size: var(--step-0); }
.keybar .seg { padding: 2px; flex: 1 1 13rem; min-width: 0; flex-wrap: nowrap; }
.keybar .seg button { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keybar .seg button { min-height: 42px; padding: 0 8px; }
.keybar .chip-btn { min-height: 46px; margin-left: auto; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keydock.folded #keys, .keydock.folded .keybar > :not(#keys-fold):not(.chip-btn) { display: none; }
.keys { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

.piano { position: relative; display: flex; height: 8.5rem; --black-w: calc(100% / 15 * .62); }
.key { min-width: 0; overflow: hidden; border: 0; padding: 0; cursor: pointer; font: 700 .72rem/1 var(--font-ui); touch-action: none; }
.key.white {
  position: relative; flex: 1 1 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px;
  margin-right: 2px; border-radius: 0 0 8px 8px; background: #fffdf8; color: #7c6455; box-shadow: inset 0 -5px 0 rgb(0 0 0 / .08), 0 1px 2px rgb(0 0 0 / .2);
}
.key.white.in { background: color-mix(in srgb, var(--note) 12%, #fffdf8); }
.key.white.in::before { content: ""; position: absolute; bottom: 24px; width: 7px; height: 7px; border-radius: 50%; background: var(--note); }
.key.black {
  position: absolute; top: 0; z-index: 2; width: var(--black-w); height: 58%; border-radius: 0 0 6px 6px;
  background: #3b2a20; color: #fff; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
  box-shadow: inset 0 -4px 0 rgb(255 255 255 / .12);
}
.key.black span { font-size: .6rem; opacity: .8; }
.key.black.in { box-shadow: inset 0 -4px 0 #f4c542; }
.key.white.now { box-shadow: inset 0 -7px 0 #43b0a0, 0 1px 2px rgb(0 0 0 / .2); }
.key.black.now { box-shadow: inset 0 -6px 0 #5fcbba; }
.key.home span { text-decoration: underline 2px; text-underline-offset: 2px; }
.key.down, .key.lit { background: var(--accent) !important; color: #fff; }
.key.goal { animation: glow .9s ease-in-out infinite; box-shadow: inset 0 0 0 3px #d9a400; }
@keyframes glow { 0%, 100% { background: #f4c542; color: #3b2a20; } 50% { background: #ffe9a3; color: #3b2a20; } }

.magic { display: flex; gap: 4px; height: 8.5rem; align-items: flex-end; }
.bar {
  flex: 1 1 0; height: var(--h); min-width: 0; border: 0; border-radius: 10px; padding: 0 0 8px; display: flex; align-items: flex-end; justify-content: center;
  overflow: hidden; background: var(--note); color: #fff; font: 800 .74rem/1 var(--font-ui); letter-spacing: -.02em; text-shadow: 0 1px 2px rgb(0 0 0 / .35); cursor: pointer; touch-action: none;
  box-shadow: inset 0 -6px 0 rgb(0 0 0 / .15);
}
.bar.now { outline: 3px solid var(--ink); outline-offset: -3px; }
.bar.down, .bar.lit { filter: brightness(1.25); transform: translateY(3px); }
.bar.goal { animation: glow .9s ease-in-out infinite; }

.chordpad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chordkey {
  display: grid; place-items: center; gap: 2px; min-height: 3.9rem; padding: 4px; border: 0; border-radius: 12px;
  background: color-mix(in srgb, var(--note) 22%, var(--surface)); color: var(--ink); cursor: pointer; touch-action: none;
  box-shadow: inset 0 -5px 0 color-mix(in srgb, var(--note) 55%, transparent);
}
.chordkey b { font-size: var(--step-1); }
.chordkey small { font-weight: 700; color: var(--ink-soft); }
.chordkey.now { outline: 3px solid var(--accent-2); outline-offset: -3px; }
.chordkey.down { background: var(--note); color: #fff; }
.chordkey.down small { color: #fff; }

/* ---- the folds ---- */
.folds { display: grid; gap: var(--space-2); margin-top: var(--space-4); }
.fold { border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.fold > summary {
  display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap); padding: var(--space-2) var(--space-4);
  cursor: pointer; list-style: none; font-weight: 800; touch-action: manipulation;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary > span:nth-child(2) { flex: 1 1 auto; }
.fold > summary .val { color: var(--ink-soft); font-weight: 600; font-size: var(--step--1); }
.fold > summary::after { content: "▾"; color: var(--ink-soft); transition: transform .15s; }
.fold[open] > summary::after { transform: rotate(180deg); }
.fold > .body { display: grid; gap: var(--space-3); padding: 0 var(--space-4) var(--space-4); }
.fold .body p, .fold .body h3 { margin: 0; }
.fold h3 { font-size: var(--step-0); }
.fold input[type="text"] {
  flex: 1 1 12rem; min-width: 0; min-height: var(--tap); padding: 0 var(--space-4); border: 0; border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line);
}
progress { width: 100%; height: 12px; accent-color: var(--accent); }
.list { margin: 0; padding-left: 1.2em; }
.list li { margin-bottom: var(--space-2); }
.songs { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.songs li { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius-sm); background: var(--surface-2); }
.songs li b { flex: 1 1 auto; min-width: 0; }
.songs li small { display: block; color: var(--ink-soft); font-weight: 500; }
.songs .btn { padding-inline: var(--space-3); min-height: 44px; }

.switch {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); width: 100%; min-height: var(--tap);
  padding: var(--space-1) 0; border: 0; background: transparent; color: var(--ink); text-align: start;
  font: 700 var(--step-0)/1.25 var(--font-ui); cursor: pointer; touch-action: manipulation;
}
.switch::after {
  content: ""; flex: 0 0 auto; width: 52px; height: 32px; border-radius: 16px; background-color: var(--line);
  background-image: radial-gradient(circle at 16px 16px, #fff 0 12px, transparent 13px); transition: background-color .15s;
}
.switch[aria-checked="true"]::after { background-color: var(--accent-2); background-image: radial-gradient(circle at 36px 16px, #fff 0 12px, transparent 13px); }

/* ---- Studio and Blocks share these ---- */
.panel { padding: var(--space-3); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); display: grid; gap: var(--space-3); }
.panel h3 { margin: 0; font-size: var(--step-0); }
.field { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.field > span { font-weight: 700; min-width: 5.5rem; }
.field input[type="range"] { flex: 1 1 8rem; min-width: 0; min-height: var(--tap); accent-color: var(--accent); }
.field output { min-width: 3.5rem; font-weight: 700; text-align: end; }
select {
  min-height: var(--tap); max-width: 100%; padding: 0 var(--space-3); border: 0; border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); font-weight: 700;
}
.chords { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chord {
  display: grid; place-items: center; min-height: 3.6rem; padding: 4px; border: 0; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); cursor: pointer; touch-action: manipulation; font: 700 var(--step-0)/1.1 var(--font-ui);
}
.chord small { font-size: var(--step--1); color: var(--ink-soft); }
.chord[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.chord[aria-pressed="true"] small { color: inherit; }
.chord.now { box-shadow: inset 0 -4px 0 var(--accent-2); }
.picker { display: grid; gap: var(--space-2); padding: var(--space-3); border-radius: var(--radius-sm); background: var(--surface-2); }
.picker .chords .chord { background: var(--surface); }
.tracks { display: grid; gap: var(--space-2); }
.track { display: grid; gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius-sm); background: var(--surface-2); }
.track[aria-current="true"] { box-shadow: inset 0 0 0 3px var(--accent); }
.track-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.track-top b { flex: 1 1 6rem; min-width: 0; font-size: var(--step-0); }
.track-top .round { width: 44px; height: 44px; font-size: var(--step-0); }
.track .ms { width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-weight: 800; cursor: pointer; }
.track .ms[aria-pressed="true"] { background: var(--accent-3); color: #3b2a20; }
.track .ms.solo[aria-pressed="true"] { background: var(--accent-2); color: #fff; }
.track-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.track-row select { flex: 1 1 8rem; }
.track-row input[type="range"] { flex: 1 1 6rem; min-height: 44px; accent-color: var(--accent); }

/* a grid of steps: drums, a part, a melody */
.grid-wrap { overflow-x: auto; overscroll-behavior-x: contain; border-radius: var(--radius-sm); background: var(--surface-2); }
.grid { display: grid; gap: 2px; padding: 4px; width: max-content; }
.grid .name {
  position: sticky; left: 0; z-index: 1; display: flex; align-items: center; padding: 0 6px; min-width: 4.4rem; max-width: 6rem;
  background: var(--surface-2); font: 700 .78rem/1.1 var(--font-ui); color: var(--ink-soft);
}
.grid .name.white { color: var(--ink); }
.cell {
  width: 30px; height: 34px; padding: 0; border: 0; border-radius: 5px; background: var(--surface); cursor: pointer; touch-action: manipulation;
}
.cell.beat { background: color-mix(in srgb, var(--surface) 70%, var(--line)); }
.cell.bar { margin-left: 4px; }
.cell.scale { background: color-mix(in srgb, var(--surface) 80%, var(--accent-2)); }
.cell.on { background: var(--accent); }
.cell.on.l3 { background: color-mix(in srgb, var(--accent) 80%, #000); }
.cell.on.l1 { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.cell.hold { background: color-mix(in srgb, var(--accent) 55%, var(--surface)); border-radius: 0 5px 5px 0; }
.cell.head { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.tools-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.tools-row .seg button { min-height: 44px; padding: 0 var(--space-3); font-size: var(--step--1); }

/* ---- Blocks ---- */
.lanes-wrap { overflow-x: auto; overscroll-behavior-x: contain; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.lanes { display: grid; gap: 4px; padding: 6px; width: max-content; position: relative; }
.lane { display: flex; gap: 4px; align-items: stretch; }
.lane-name {
  position: sticky; left: 0; z-index: 2; display: flex; align-items: center; gap: 4px; width: 4.6rem; padding: 0 6px; border-radius: 8px;
  background: var(--surface-2); font: 700 .75rem/1.1 var(--font-ui);
}
.lane-name span:first-child { font-size: 1.2rem; }
.slot-cell {
  position: relative; width: 58px; height: 52px; padding: 0; border: 0; border-radius: 8px; background: var(--surface-2); cursor: pointer; touch-action: manipulation;
}
.slot-cell.target { box-shadow: inset 0 0 0 2px var(--accent-2); }
.slot-cell.head { box-shadow: inset 0 0 0 3px var(--accent-3); }
.blk {
  position: absolute; z-index: 1; top: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; padding: 0 4px;
  border-radius: 8px; color: #fff; font: 800 .74rem/1.05 var(--font-ui); text-align: center; text-shadow: 0 1px 1px rgb(0 0 0 / .3);
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / .18); pointer-events: none; overflow: hidden;
}
.chordrow .slot-cell { height: 36px; background: transparent; font: 700 .8rem/1 var(--font-ui); color: var(--ink); }
.palette { display: grid; gap: var(--space-2); }
.palette-blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr)); gap: 6px; }
.pblock {
  min-height: 3.4rem; padding: 4px; border: 0; border-radius: 10px; color: #fff; font: 800 var(--step--1)/1.1 var(--font-ui);
  text-shadow: 0 1px 1px rgb(0 0 0 / .3); box-shadow: inset 0 -5px 0 rgb(0 0 0 / .18); cursor: pointer; touch-action: manipulation;
}
.pblock[aria-pressed="true"] { outline: 4px solid var(--ink); outline-offset: 2px; }
.k-drums { background: #e8617d; } .k-bass { background: #5b8def; } .k-chords { background: #43b0a0; }
.k-arp { background: #f39a4a; } .k-pad { background: #a77be0; } .k-melody { background: #d9a400; }

/* ---- Learn ---- */
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: var(--space-2); }
.lesson-card {
  display: grid; gap: 2px; align-content: start; justify-items: start; min-height: 4.6rem; padding: var(--space-3); border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); text-align: start; font: 700 var(--step-0)/1.2 var(--font-ui);
  cursor: pointer; touch-action: manipulation;
}
.lesson-card span:first-child { font-size: 1.5rem; }
.lesson-card.done::after { content: "✓"; justify-self: end; margin-top: -1.4em; color: var(--accent-2); font-size: var(--step-1); }
.lesson { display: grid; gap: var(--space-3); }
.lesson p { margin: 0; font-size: var(--step-0); }
.task { display: grid; gap: var(--space-2); padding: var(--space-3); border-radius: var(--radius); background: var(--surface-2); }
.task .say { font-weight: 800; font-size: var(--step-1); }
.dots { display: flex; flex-wrap: wrap; gap: 6px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent-2); }
.yay { font-size: var(--step-2); font-weight: 800; text-align: center; color: var(--accent); }
.tapper { min-height: 7rem; font-size: var(--step-2); }

/* ---- Big screen: the whole studio fills the screen ---- */
body.big { overflow: hidden; }
body.big > :not(.wrap) { display: none; }
body.big .wrap > :not(main) { display: none; }
body.big .wrap { width: 100%; padding: 0; }
body.big #music {
  position: fixed; inset: 0; z-index: 60; overflow-y: auto; overscroll-behavior: contain; align-content: start;
  padding: max(var(--space-2), var(--app-top)) max(var(--space-3), env(safe-area-inset-right)) 0 max(var(--space-3), env(safe-area-inset-left));
  background: var(--bg);
}
body.big .folds { display: none; }
@media (min-width: 900px) {
  #music { --gap: var(--space-4); }
  .piano, .magic { height: 11rem; }
}
/* On a phone the three keyboards get a row of their own, so no word is cut. */
@media (max-width: 40rem) {
  .keybar .seg { order: -1; flex: 1 1 100%; }
  .keybar .seg button { white-space: normal; text-overflow: clip; line-height: 1.05; }
}
#music[data-mode="blocks"] .keydock { display: none; }

/* ---- how much shows: Easy, Everything, My way (ADR-0083) ---- */
.levelbar { display: flex; align-items: center; gap: var(--space-2); }
.levelbar .levels { flex: 1 1 auto; flex-wrap: nowrap; min-width: 0; }
/* the picture above the word, like the four views below, so "Everything" fits a phone in every language */
.levelbar .levels button {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 4px 4px; line-height: 1.05; font-size: var(--step--1); overflow-wrap: anywhere; border-radius: calc(var(--radius) - 3px);
}
.levelbar .levels { border-radius: var(--radius); }
.levelbar .levels button > span:first-child { font-size: 1.1rem; }
#explain[aria-pressed="true"] { background: #f4c542; color: #3b2a20; }
body.big .levelbar { display: none; }

/* 💡: a line under a tool saying what it is for, only while 💡 is on */
.why { display: none; }
#music.explain .why {
  display: flex; gap: var(--space-2); align-items: flex-start; margin: 0; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm); background: color-mix(in srgb, #f4c542 18%, var(--surface)); color: var(--ink);
  font-size: var(--step--1); line-height: 1.35;
}
#music.explain .why::before { content: "💡"; flex: 0 0 auto; }
#music.explain .why[hidden] { display: none; }
.view .why + .why { margin-top: var(--space-2); }
#v-play > .why { margin-top: var(--space-2); }

/* the welcome card and the My way helper take the whole room while open */
#music.welcoming > :not(#welcome) { display: none !important; }
.welcome { display: grid; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.welcome .h { margin: 0; }
.welcome p { margin: 0; }
.welcome .step { color: var(--ink-soft); font-weight: 700; font-size: var(--step--1); }
.choices { display: grid; gap: var(--space-2); }
.choice, .wish {
  display: flex; align-items: center; gap: var(--space-3); min-height: 4.4rem; padding: var(--space-3); border: 0; border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink); text-align: start; font: 700 var(--step-0)/1.2 var(--font-ui); cursor: pointer; touch-action: manipulation;
}
.choice > span:first-child, .wish > span:first-child { font-size: 2rem; line-height: 1; }
.choice b { display: block; font-size: var(--step-1); }
.choice small { display: block; margin-top: 2px; font-weight: 500; color: var(--ink-soft); }
.choice[data-choice="easy"] { background: var(--accent); color: var(--accent-ink); }
.choice[data-choice="easy"] small { color: inherit; opacity: .9; }
.wishes { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: var(--space-2); }
.wish { min-height: var(--tap); }
.wish[aria-pressed="true"] { background: var(--accent-2); color: #fff; }
.toolset { display: grid; gap: 4px; }
.switch.tool { gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius-sm); background: var(--surface-2); }
.switch.tool .tool-icon { flex: 0 0 auto; width: 2rem; font-size: 1.4rem; text-align: center; }
.switch.tool .tool-words { flex: 1 1 auto; min-width: 0; }
.switch.tool b { display: block; }
.switch.tool small { display: block; font-weight: 500; color: var(--ink-soft); font-size: var(--step--1); line-height: 1.3; }

/* Easy's invitation to do more */
.more { margin-top: var(--space-4); }
.more p { margin: 0; }
/* the helper's Back and Start stay in reach while the list of tools scrolls */
.welcome > .row:last-child {
  position: sticky; bottom: 0; z-index: 2; margin: 0 calc(-1 * var(--space-4)) calc(-1 * var(--space-4));
  padding: var(--space-3) var(--space-4) max(var(--space-3), env(safe-area-inset-bottom));
  border-radius: 0 0 var(--radius) var(--radius); background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

/* a long word in a picker (Armenian "sixteenths") must not push a fold wider than the phone */
.fold { min-width: 0; }
.fold > .body { grid-template-columns: minmax(0, 1fr); }
.field select { min-width: 0; flex: 1 1 7rem; text-overflow: ellipsis; }
@media (min-width: 48rem) {
  .choices { grid-template-columns: repeat(3, 1fr); }
  .choice { flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; padding: var(--space-4); }
}
/* Do Re Mi on the magic bars: a name like Соль or Սոլ stands letter over letter, so it fits a phone's bar */
.keys[data-names="solfege"] .bar span { writing-mode: vertical-rl; text-orientation: upright; letter-spacing: -1px; line-height: 1; }
