:root { --bug-top: 30%; --bg: #1a1040; --bg2: #2a1d5c; --card: #fdfbff; --ink: #1d1638; --muted: #6b6390; --accent: #7b5cff; --green: #19b38a; --red: #ef476f; --pink: #ff5d8f; --c1: #ff5d8f; --c2: #ffd166; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Fredoka, system-ui, sans-serif; background: radial-gradient(ellipse at 50% -10%, var(--bg2), var(--bg) 70%) fixed, var(--bg); color: var(--ink); min-height: 100vh; padding: 0 16px 40px; padding-top: env(safe-area-inset-top); overflow-x: hidden; }

/* the colored light beams behind everything (faster while music plays) */
#beams { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
#beams i { position: absolute; bottom: -10vh; width: 26vw; height: 150vh; background: linear-gradient(to top, var(--c1), transparent 75%); opacity: 0.22; transform-origin: 50% 100%; filter: blur(14px); animation: sweep 9s ease-in-out infinite alternate; border-radius: 50% 50% 0 0; }
#beams i:nth-child(1) { left: -6vw; animation-delay: -2s; }
#beams i:nth-child(2) { left: 22vw; background: linear-gradient(to top, var(--c2), transparent 75%); animation-delay: -5s; animation-duration: 11s; }
#beams i:nth-child(3) { left: 52vw; animation-delay: -1s; animation-duration: 8s; }
#beams i:nth-child(4) { left: 80vw; background: linear-gradient(to top, var(--c2), transparent 75%); animation-delay: -7s; }
body.playing #beams i { animation-duration: 2.4s; opacity: 0.38; }
@keyframes sweep { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }

header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; color: #fff; max-width: 1200px; margin: 0 auto; }
header h1 { font-size: 26px; margin: 0; flex: 1; min-width: 200px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
header .logo { display: inline-block; animation: bop 0.9s ease-in-out infinite alternate; }
body.playing header .logo { animation-duration: 0.3s; }
.back { color: #fff; text-decoration: none; font-size: 20px; width: 44px; height: 44px; flex: none; display: grid; place-items: center; background: rgba(255, 255, 255, 0.15); border-radius: 50%; }
nav { display: flex; gap: 6px; background: rgba(255, 255, 255, 0.1); padding: 5px; border-radius: 18px; }
.tab { background: transparent; color: #fff; border: 0; font-size: 16px; padding: 9px 14px; border-radius: 14px; }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15); }
.tab b { background: var(--pink); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 13px; }
.tab b:empty { display: none; }
.page { max-width: 1200px; margin: 0 auto; }
.hidden { display: none !important; }
.panel { background: var(--card); border-radius: 22px; padding: 14px 16px; margin: 12px 0; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28); }
.panel h2 { margin: 0 0 8px; font-size: 19px; }
h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.grow { flex: 1; }
.hint { color: var(--muted); font-size: 14px; }
button, select { font: inherit; font-size: 15px; border: 0; border-radius: 14px; padding: 9px 13px; background: #ece8ff; color: var(--ink); cursor: pointer; touch-action: manipulation; transition: transform 0.08s, background 0.15s; }
button:active { transform: scale(0.94); }
button.big { font-size: 18px; padding: 11px 18px; color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2); }
button.go { background: var(--green); color: #fff; }
button.party { background: linear-gradient(135deg, var(--c1), var(--c2)); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
button.stop { background: var(--red); color: #fff; }
button.save { background: var(--accent); color: #fff; }
button.icon { font-size: 20px; width: 46px; height: 46px; padding: 0; }
label { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
input[type=range] { width: 140px; accent-color: var(--accent); }
.big-e { font-size: 42px; }

/* ---------- Make music: the stage and the tune side by side ---------- */
#make .top { display: grid; grid-template-columns: minmax(280px, 40%) minmax(0, 1fr); gap: 12px; margin-top: 4px; }
#make .top .panel { margin: 0; }
#stage { position: relative; min-height: 300px; padding: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 120%, var(--c1) -30%, transparent 60%), radial-gradient(circle at 50% 0%, #3b2a7a, #120a30 75%); }
#stage3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.title-chip { position: absolute; top: 10px; left: 10px; max-width: calc(100% - 80px); background: rgba(255, 255, 255, 0.95); color: var(--ink); font-size: 18px; font-weight: 600; padding: 7px 14px; border-radius: 18px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-chip small { opacity: 0.6; }
#eq { position: absolute; right: 14px; top: 14px; display: flex; gap: 3px; height: 38px; align-items: flex-end; }
#eq i { width: 6px; height: 100%; background: linear-gradient(to top, var(--c1), var(--c2)); transform-origin: 50% 100%; border-radius: 3px; transform: scaleY(0.15); }
.moves { position: absolute; left: 8px; right: 8px; bottom: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.moves::-webkit-scrollbar { display: none; }
.moves button { min-width: 0; background: rgba(20, 10, 50, 0.55); color: #fff; border-radius: 14px; display: flex; flex-direction: column; align-items: center; padding: 5px 2px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.moves .e { font-size: 22px; line-height: 1.1; }
.moves small { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 520px) { .moves small { display: none; } .moves .e { font-size: 24px; } }
/* (an iPad held upright: the stage is narrow too, and the names were cut to "Free...", "Bou...": just the bigger emoji,
   each button has its name as a title, 2026-10-24. A phone held sideways keeps them below the stage: .moves-home) */
@media (max-width: 1000px) and (orientation: portrait) { .moves small { display: none; } .moves .e { font-size: 26px; } .moves button { padding: 7px 2px; } }
.moves button.on { background: #fff; color: var(--ink); box-shadow: 0 0 0 3px var(--c2); }

#tune { display: flex; flex-direction: column; min-width: 0; }
.transport { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.transport [hidden] { display: none; }
#roll-wrap { position: relative; margin-top: 10px; flex: 1; display: flex; }
#roll { position: relative; flex: 1; height: 190px; min-height: 160px; overflow-x: auto; overflow-y: hidden; background: #f4f1ff; border-radius: 16px; padding: 7px 0; -webkit-overflow-scrolling: touch; }
#roll-in { position: relative; height: 100%; min-width: 100%; background-image: repeating-linear-gradient(90deg, rgba(123, 92, 255, 0.28) 0 2px, transparent 2px calc(var(--px, 40px) * 4)), repeating-linear-gradient(90deg, rgba(123, 92, 255, 0.1) 0 1px, transparent 1px var(--px, 40px)); }
.nb { position: absolute; border-radius: 7px; background: var(--k); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18); font-size: 12px; color: #fff; font-weight: 600; display: flex; align-items: center; justify-content: center; cursor: pointer; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3); transition: transform 0.1s, box-shadow 0.1s; overflow: hidden; }
.nb.rest { background: repeating-linear-gradient(45deg, #ddd7f3 0 5px, #ece8ff 5px 10px); box-shadow: none; text-shadow: none; }
.nb.sel { outline: 3px solid var(--ink); outline-offset: 1px; z-index: 2; }
.nb.now { transform: scale(1.18); box-shadow: 0 0 16px var(--k), 0 0 4px #fff; z-index: 3; filter: brightness(1.15); }
#playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 3px; background: var(--red); border-radius: 2px; box-shadow: 0 0 8px var(--red); pointer-events: none; z-index: 4; }
#roll-empty[hidden] { display: none; }
#roll-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; color: var(--muted); pointer-events: none; }
#edit { display: flex; gap: 4px; background: var(--ink); padding: 4px; border-radius: 14px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); }
#edit[hidden] { display: none; }
#edit button { background: rgba(255, 255, 255, 0.15); color: #fff; font-size: 17px; min-width: 42px; height: 38px; padding: 0 8px; }
.info { margin: 8px 2px 0; font-size: 15px; color: var(--muted); min-height: 46px; }
.info b { color: var(--ink); }

/* ---------- the pickers ---------- */
.pickers { display: grid; gap: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 82px; padding: 8px 10px; border-radius: 16px; background: #f1edff; box-shadow: 0 3px 0 #ddd5ff; }
.chip .e { font-size: 30px; line-height: 1.1; }
.chip span:last-child:not(.e) { font-size: 13px; white-space: nowrap; }
.chip.on { background: var(--accent); color: #fff; box-shadow: 0 3px 0 #4f37c7; transform: translateY(-2px); }
.chip.band { background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18); }
.chip.band.on { outline: 4px solid var(--ink); outline-offset: 1px; }
.chips.wrap .chip { flex-direction: row; min-width: 0; font-size: 14px; padding: 7px 11px; }
.tools { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; }
.speed { font-size: 22px; }
.speed b { font-size: 16px; min-width: 30px; }
.lens { display: inline-flex; gap: 6px; }
.lens button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 58px; padding: 8px 10px; }
.lens button small { font-size: 12px; }
.lens button.on { background: var(--accent); color: #fff; }
.len { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, #ff9f1c, #ff4d6d); }
.rec { background: #fff0f3; color: var(--red); font-weight: 600; padding: 11px 16px; box-shadow: 0 3px 0 #ffd0da; }
.rec.on { background: var(--red); color: #fff; animation: pulse 0.8s infinite alternate; }
#rec-msg:empty { display: none; }
#rec-msg { font-size: 17px; color: var(--ink); }

/* ---------- the piano (each note its own color) ---------- */
#piano-wrap { background: linear-gradient(#2b1f5e, #1a1040); padding: 14px 14px 18px; }
#piano { position: relative; height: 180px; user-select: none; -webkit-user-select: none; touch-action: none; }
.key { position: absolute; top: 0; border-radius: 0 0 12px 12px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; transition: background 0.12s, box-shadow 0.12s; }
.key.white { height: 100%; background: linear-gradient(#fff 62%, color-mix(in srgb, var(--k) 40%, #fff)); border: 2px solid #c9c2e8; border-top: 0; z-index: 1; }
.key.white span { width: 26px; height: 26px; border-radius: 50%; background: var(--k); color: #fff; font-size: 13px; font-weight: 600; display: grid; place-items: center; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3); }
.key.black { height: 60%; background: linear-gradient(#3a2d6e, #140c33); border-bottom: 7px solid var(--k); z-index: 2; box-shadow: 0 3px 4px rgba(0, 0, 0, 0.4); }
.key.down { background: var(--k) !important; box-shadow: 0 0 22px var(--k), inset 0 -8px 0 rgba(0, 0, 0, 0.12); }
.key.white.down span { background: #fff; color: var(--k); }
#floaters { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.floater { position: fixed; font-size: 30px; font-weight: 700; transform: translate(-50%, 0); animation: floatUp 1.25s ease-out forwards; text-shadow: 0 0 10px currentColor; }
@keyframes floatUp { to { transform: translate(calc(-50% + var(--dx)), -190px) rotate(18deg) scale(1.3); opacity: 0; } }
@keyframes bop { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-4px) rotate(6deg); } }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.05); } }

/* ---------- My tunes ---------- */
.banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: linear-gradient(135deg, #fff, #f1edff); }
.banner > div { flex: 1; min-width: 220px; font-size: 16px; line-height: 1.4; }
.go-town { background: var(--green); color: #fff; text-decoration: none; padding: 11px 16px; border-radius: 14px; font-size: 17px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.tcard { background: linear-gradient(135deg, var(--c1), var(--c2)); border-radius: 22px; color: #fff; padding: 14px; display: grid; grid-template-columns: 76px 1fr; gap: 10px 12px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.tcard .art { font-size: 46px; background: rgba(255, 255, 255, 0.28); border-radius: 18px; display: grid; place-items: center; height: 76px; text-shadow: none; }
.tcard.playing .art { animation: bop 0.35s ease-in-out infinite alternate; background: rgba(255, 255, 255, 0.5); }
.tcard .about { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.tcard .about b { font-size: 20px; }
.tcard .about small { font-size: 13px; opacity: 0.95; }
.tcard .btns { grid-column: 1 / -1; display: flex; gap: 6px; }
.tcard .btns button { background: rgba(255, 255, 255, 0.9); color: var(--ink); text-shadow: none; }
.tcard .btns button.go { background: var(--ink); color: #fff; min-width: 54px; font-size: 18px; }
.tcard .btns [data-open] { flex: 1; }
.empty { text-align: center; grid-column: 1 / -1; font-size: 17px; }

/* ---------- naming a tune ---------- */
.sheet { position: fixed; inset: 0; background: rgba(10, 5, 30, 0.6); display: grid; place-items: center; z-index: 60; padding: 16px; }
.sheet-in { background: var(--card); border-radius: 24px; padding: 18px; width: min(640px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4); }
.sheet-in h2 { margin: 0 0 8px; }
.sheet-in h3 { margin-top: 12px; }
.n-preview { font-size: 28px; font-weight: 600; text-align: center; padding: 12px; border-radius: 18px; background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.n-preview .e { font-size: 38px; vertical-align: middle; }
.chip.icon { font-size: 24px; padding: 6px 8px; }
.words .chip { font-size: 15px; }
.row.end { margin-top: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 18px; font-size: 17px; z-index: 70; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35); width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; text-align: center; } /* (max-content: centered with left 50%, it would otherwise wrap at half the screen) */
.toast.show { animation: toastIn 0.25s ease-out; }
@keyframes toastIn { from { transform: translate(-50%, 20px); opacity: 0; } }

/* ---------- Sound board ---------- */
#board .chip { box-shadow: 0 2px 0 #ddd5ff; }
#board .chip.on { box-shadow: 0 2px 0 #4f37c7; }

/* ---------- smaller screens ---------- */
@media (max-width: 760px) {
  #make .top { grid-template-columns: 1fr; }
  #stage { min-height: 280px; }
  header h1 { font-size: 22px; }
  .tab span { display: none; }
  .tab { font-size: 20px; padding: 8px 14px; }
  #piano { height: 160px; }
  .transport button.big span { display: none; }
  .transport button.big { font-size: 22px; padding: 10px 16px; }
}
@media (max-height: 450px) and (min-width: 761px) {
  /* (a phone on its side: the buttons on one row, and the tune shorter, so the piano starts on the first screen) */
  #stage { min-height: 210px; }
  #roll { height: 118px; min-height: 110px; }
  .info { min-height: 40px; }
  #piano { height: 140px; }
  .transport button.big span { display: none; }
  .transport button.big { font-size: 22px; padding: 10px 16px; }
  #edit-hint { display: none; } /* (so a note's buttons fit beside the count) */
  .title-chip { left: 40px; max-width: calc(100% - 110px); } /* (clear of the 🐞 tab on the left edge) */
}
/* (every instrument and band in view at once: no hidden ones off to the side) */
#instr, #band { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); overflow: visible; }
#instr .chip, #band .chip { min-width: 0; }
@media (max-width: 760px) { #instr, #band { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; } #instr .chip span:last-child:not(.e), #band .chip span:last-child:not(.e) { font-size: 11.5px; } }
@media (max-height: 450px) { .moves small { display: none; } .moves .e { font-size: 24px; } }

/* ---------- a phone held sideways: the piano first (Wes, 2026-10-19: layout A) ----------
   One short top bar (🏠, the name, the instrument and band as buttons, the tabs as icons); the dancer smaller beside
   Play / the band / undo / save and the note roll; the whole piano across the bottom with no scrolling. The pickers
   (instrument, band, dance moves, speed) open over the piano from the two buttons (studio.js fitShort). */
.quick, .pick-x, .moves-home { display: none; }
@media (max-height: 500px) and (orientation: landscape) {
  body { padding-bottom: 0; }
  header { flex-wrap: nowrap; gap: 8px; padding: 5px 0; }
  header h1 { font-size: 17px; min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-block: 6px; margin-block: -6px; } /* (room for the bobbing 🎹, which the cut-off edge shaved: the header stays the same height) */
  .tab span { display: none; } .tab { font-size: 17px; padding: 6px 10px; } nav { padding: 3px; gap: 2px; }
  .quick { display: flex; gap: 6px; flex: none; }
  .qp { font-size: 14px; font-weight: 600; padding: 7px 11px; border-radius: 14px; background: #fff; color: var(--ink); white-space: nowrap; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18); }
  .qp + .qp { background: linear-gradient(90deg, var(--c1), var(--c2)); color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3); }
  #make .top { grid-template-columns: 170px minmax(0, 1fr); gap: 8px; margin-top: 0; }
  #stage { min-height: 0; height: 122px; }
  .title-chip { left: 6px; top: 6px; max-width: calc(100% - 12px); font-size: 13px; padding: 9px 11px; }
  #eq { display: none; }
  #tune { padding: 8px 10px; height: 122px; }
  .transport { flex-wrap: nowrap; gap: 6px; }
  .transport button.big { font-size: 18px; padding: 6px 13px; }
  .transport .icon { font-size: 16px; padding: 6px 10px; }
  #roll-wrap { margin-top: 6px; min-height: 0; }
  #roll { height: auto; min-height: 0; }
  #roll-empty { font-size: 15px; }
  /* (a picked note's buttons sit over undo / new / save while you change it, not over the roll; ✓ puts them back) */
  #tune { position: relative; }
  .info { position: absolute; right: 8px; top: 6px; min-height: 0; margin: 0; pointer-events: none; }
  #edit button { min-width: 38px; height: 38px; font-size: 16px; padding: 0 7px; }
  .info > * { pointer-events: auto; }
  #count, #edit-hint, .info .grow { display: none; }
  #piano-wrap { margin: 8px 0 0; padding: 8px 8px 10px; }
  #piano { height: max(130px, calc(100vh - 212px)); height: max(130px, calc(100dvh - 212px)); }
  .key.white span { width: 22px; height: 22px; font-size: 12px; }
  /* the pickers: a sheet over the piano */
  #pickers { display: none; position: fixed; z-index: 30; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); bottom: 0; max-height: calc(100vh - 60px); max-height: calc(100dvh - 60px); overflow-y: auto; margin: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45); padding: 10px 14px 14px; }
  #pickers.open { display: grid; }
  #pickers.open { grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; }
  #pickers > :not(.pick-x) { grid-column: 1; }
  .pick-x { display: block; grid-column: 2; grid-row: 1 / span 9; align-self: start; position: sticky; top: 0; background: var(--accent); color: #fff; font-weight: 600; } /* (its own column: it never covers a chip) */
  .moves-home { display: block; }
  .moves-home .moves { position: static; grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .moves-home .moves button { background: #ece8ff; color: var(--ink); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .moves-home .moves small { display: block; }
}
/* confetti when a tune is saved (shared/polish.js celebrate; the same look as ../shared/polish.css, without its other rules) */
.pm-confetti { position: fixed; width: 10px; height: 14px; border-radius: 3px; pointer-events: none; z-index: 50; will-change: transform, opacity; }
