/* triple lock: make your own. Same family as stationarystore.ie: near-black, off-white, cyan = live, magenta = record. */
[hidden] { display: none !important; }
:root {
  --bg: #0d0f12; --card: #111118; --line: #33373e; --ink: #eeeae3; --dim: #a8a9ac;
  --cyan: #00e5ff; --magenta: #ff0066; --pad: #171920;
  --serif: Georgia, 'Times New Roman', serif;
  font: 15px/1.45 Arial, Helvetica, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
button, select, .button {
  font: inherit; color: var(--ink); background: #1a1c23; border: 1px solid var(--line);
  border-radius: 3px; padding: 8px 12px; min-height: 44px; cursor: pointer; touch-action: manipulation;
}
button:hover, .button:hover { border-color: var(--dim); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
button.go { background: var(--cyan); border-color: var(--cyan); color: #05060a; font-weight: 700; }
button.ghost { background: transparent; }
button.rec { color: var(--magenta); border-color: #5a2338; }
button.rec.on { background: var(--magenta); border-color: var(--magenta); color: #05060a; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .65; } }
@media (prefers-reduced-motion: reduce) { button.rec.on { animation: none; } }
label { display: inline-flex; gap: 6px; align-items: center; color: var(--dim); }
label.chk { min-height: 44px; cursor: pointer; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--magenta); }
input[type=range] { accent-color: var(--magenta); }
a { color: var(--cyan); }
kbd { font: 700 12px/1 Arial, sans-serif; border: 1px solid var(--dim); border-radius: 3px; padding: 2px 5px; margin-right: 4px; }
h1, h2 { font-family: var(--serif); font-weight: 400; }

/* the very top: a version out to a file, a version in from a file */
.filebar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; padding: 8px 16px; border-bottom: 1px solid var(--line); background: #0a0b0e; }
.filebar > * { flex: 0 0 auto; }
.filesay { flex: 1 1 260px; color: var(--dim); font-size: 13px; }
.filebar button { border-color: var(--cyan); }

/* a recording has stopped: download it, yes or no */
.ask { position: fixed; inset: 0; z-index: 50; background: rgba(5,6,10,.82); display: flex; align-items: center; justify-content: center; padding: 16px; }
.askbox { width: 100%; max-width: 460px; background: var(--card); border: 2px solid var(--cyan); border-radius: 4px; padding: 18px; }
.asksay { margin: 0 0 6px; font-family: var(--serif); font-size: 20px; }
.askbox .row button { flex: 1 1 140px; min-height: 52px; font-size: 16px; }

/* the bar at the top: play, write and record are always in reach */
.loopseg button { min-width: 0; font-size: 14px; font-weight: 700; padding: 8px 10px; }
.bar { position: sticky; top: 0; z-index: 20; background: rgba(13,15,18,.96); border-bottom: 1px solid var(--line); padding: 8px 16px; backdrop-filter: blur(6px); }
.transport { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: 1100px; margin: 0 auto; }
button.big { min-width: 56px; font-size: 22px; background: var(--cyan); border-color: var(--cyan); color: #05060a; }
button.big.on { background: var(--magenta); border-color: var(--magenta); }
.tempo { color: var(--dim); font-size: 13px; padding: 0 4px; }
input[type=number] { font: inherit; color: var(--ink); background: #1a1c23; border: 1px solid var(--line); border-radius: 3px; padding: 8px; min-height: 44px; width: 5.2em; }
#tempoCard input[type=range] { flex: 1 1 180px; max-width: 420px; min-height: 44px; }
.starts button { flex: 1 1 220px; min-height: 56px; font-size: 16px; text-align: left; }
.startsay { margin: 10px 0 0; }
.barsrow { margin: 0 0 8px; }
.barsrow .grp { display: inline-flex; gap: 8px; align-items: center; color: var(--dim); }
.barsrow output { min-width: 4.5em; text-align: center; color: var(--ink); }
.status { max-width: 1100px; margin: 4px auto 0; min-height: 1.3em; font-size: 13px; color: var(--dim); }
.status.err { color: var(--magenta); }
.warn { max-width: 1100px; margin: 6px auto 0; padding: 6px 10px; border: 1px solid var(--magenta); border-radius: 3px; color: var(--ink); background: rgba(255,0,102,.12); font-size: 14px; }
.tabbar { max-width: 1100px; margin: 6px auto 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; border: 2px solid var(--magenta); border-radius: 3px; background: rgba(255,0,102,.12); }
.loadingnote { grid-column: 1 / -1; color: var(--dim); margin: 12px 0; }
.pad .na { display: none; font-size: 11px; color: var(--magenta); }
.pad.unavail { opacity: .55; border-style: dashed; }
.pad.unavail .na { display: block; }
#loadErr { margin: 0 0 10px; }

main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 24px; display: grid; gap: 14px; }
.intro h1 { margin: 6px 0 0; font-size: 44px; letter-spacing: -1px; line-height: 1.05; }
.intro .by { margin: 4px 0 8px; color: var(--cyan); font-family: var(--serif); font-size: 18px; }
.intro .lead { margin: 0; font-size: 17px; max-width: 46em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 3px; padding: 14px; min-width: 0; }
.card h2 { margin: 0 0 6px; font-size: 22px; }
.card h2 small { font-family: Arial, sans-serif; font-size: 13px; color: var(--dim); margin-left: 6px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 0; }
.hint { color: var(--dim); font-size: 13px; margin: 0 0 8px; }

/* Keys play: Micheál | Melody | Beats */
.keysrow { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.keyslabel { font-family: var(--serif); font-size: 20px; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; min-width: 104px; font-size: 16px; font-weight: 700; }
.seg button:first-child { border-radius: 3px 0 0 3px; }
.seg button + button { border-left: 0; }
.seg button:last-child { border-radius: 0 3px 3px 0; }
.seg button.on { background: var(--cyan); border-color: var(--cyan); color: #05060a; }
.keyssay { color: var(--dim); font-size: 14px; flex: 1 1 260px; }

/* the board: rows of ten; the first three are the three letter rows of the keyboard, the next three the same keys with Shift */
.board { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.pad {
  position: relative; min-height: 84px; touch-action: manipulation; padding: 6px 6px 6px; text-align: left; display: flex; flex-direction: column; justify-content: flex-start; gap: 3px;
  background: var(--pad); border: 2px solid #262a33; border-radius: 4px; overflow: hidden; user-select: none; -webkit-user-select: none;
}
.pad .k { font: 700 22px/1 Arial, sans-serif; color: var(--cyan); }
.pad .w { font-size: 12px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.pad .tag { font-size: 11px; color: var(--magenta); }
.pad.r0 { border-color: #24414a; } .pad.r1, .pad.r2 { border-color: #3a3340; } .pad.r3, .pad.r4, .pad.r5 { border-color: #4a2836; }
.pad.r3 { margin-top: 10px; }   /* a gap between the keyed rows and the tapped ones */
.pad.sel { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pad.hit, .pad.down { background: var(--magenta); color: #05060a; }
.pad.hit .k, .pad.down .k, .pad.hit .tag, .pad.down .tag { color: #05060a; }
.board.mel .pad .k { color: var(--dim); font-size: 14px; }
/* rows 4 to 6 are on the same keys with Shift or Caps Lock: their legend is quieter until capitals are on */
.pad.r3 .k, .pad.r4 .k, .pad.r5 .k { font-size: 16px; color: var(--dim); }
.board.shifted .pad.r0 .k, .board.shifted .pad.r1 .k, .board.shifted .pad.r2 .k { color: var(--dim); }
.board.shifted .pad.r3, .board.shifted .pad.r4, .board.shifted .pad.r5 { border-color: var(--cyan); }
.board.shifted .pad.r3 .k, .board.shifted .pad.r4 .k, .board.shifted .pad.r5 .k { color: var(--cyan); font-size: 22px; }
.pad.hit .k, .pad.down .k { color: #05060a !important; }

.padpanel { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.padpanel .who { flex: 1 1 100%; margin: 0; }
.padpanel .who b { color: var(--cyan); }
.padpanel .grp { display: inline-flex; gap: 6px; align-items: center; }
.padpanel output { min-width: 4.5em; text-align: center; }
.padpanel input[type=range] { width: 150px; }
/* the pad editor: Edit on, a tap opens a pad */
.editbtn.on { background: var(--cyan); border-color: var(--cyan); color: #05060a; font-weight: 700; }
.board.editing .pad { border-style: dashed; }
.padpanel { border: 1px solid var(--cyan); border-radius: 3px; padding: 12px; }
.padpanel .who { flex: 1 1 60%; font-size: 16px; }
.padpanel .wave { flex: 1 1 100%; width: 100%; height: 80px; background: #05060a; border: 1px solid var(--line); border-radius: 2px; }
.padpanel .trimrow, .padpanel .fxrow, .padpanel .savrow { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 0; }
.padpanel .trimrow input[type=range] { width: 220px; }
.padpanel .fxrow { border-top: 1px solid var(--line); padding-top: 10px; }
.padpanel .fxrow input[type=range] { width: 110px; }
.padpanel .fxrow output { min-width: 3em; }
.padpanel .savrow { border-top: 1px solid var(--line); padding-top: 10px; }

/* Melody */
.melpanel { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.melctl { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.melctl .grp { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.sounds button.on { background: var(--cyan); border-color: var(--cyan); color: #05060a; }
.kb kbd { border-color: currentColor; }
.notes { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; touch-action: none; }
.note { min-height: 64px; padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: #e9e5de; color: #111; border: 2px solid #ccc; user-select: none; -webkit-user-select: none; }
.note .n { font-weight: 700; font-size: 16px; }
.note .k { font: 700 13px/1 Arial, sans-serif; color: #3c3f47; }
.note.black { background: #1d1f27; color: var(--ink); border-color: #444; }
.note.black .k { color: var(--dim); }
.note.root { border-color: var(--cyan); }
.note.down { background: var(--magenta); color: #05060a; border-color: var(--magenta); }
.note.blank { visibility: hidden; }
/* Beats: the drums, in the two rows their keys are in */
.note.drum { background: #1d1f27; color: var(--ink); border-color: #4a2836; touch-action: manipulation; }
.note.drum .n { font-size: 13px; text-align: center; line-height: 1.15; }
.note.drum .k { color: var(--cyan); }
.note.drum.down { background: var(--magenta); color: #05060a; border-color: var(--magenta); }
.note.drum.down .k { color: #05060a; }
.pad .k:empty::before { content: 'tap'; font-size: 11px; font-weight: 400; color: var(--dim); }

/* the road, the breaks and the ender */
.card h3 { font-family: var(--serif); font-weight: 400; font-size: 18px; margin: 14px 0 4px; }
.card h3 small { font-family: Arial, sans-serif; font-size: 13px; color: var(--dim); margin-left: 6px; }
.brk { flex: 0 0 auto; display: flex; align-items: stretch; scroll-snap-align: start; }
.brk .blk { border-radius: 3px 0 0 3px; min-width: 104px; }
.brk .fire { border-radius: 0 3px 3px 0; border-left: 0; min-width: 44px; color: var(--cyan); font-size: 16px; }
.blk.due { border-style: dashed; border-color: var(--magenta); }
.breaks .blk .no, .ender .blk .no { color: var(--cyan); font-weight: 700; }
.enderrow { margin-top: 0; align-items: stretch; }
.ender { overflow: visible; padding-bottom: 4px; }
.ender .hint, .breaks .hint { margin: 6px 0; max-width: 34em; }
#endIt { align-self: center; }
.blocktools { border-top: 1px solid var(--line); padding-top: 10px; }
.road { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; }
.blk { flex: 0 0 auto; min-width: 92px; max-width: 140px; min-height: 64px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; scroll-snap-align: start; padding: 6px 8px; }
.blk .no { font-size: 11px; color: var(--dim); }
.blk .nm { font-size: 13px; font-weight: 700; line-height: 1.15; }
.blk .ln { font-size: 11px; color: var(--dim); }
.blk.cur { border: 2px solid var(--ink); }
.blk.playing { background: var(--cyan); color: #05060a; border-color: var(--cyan); }
.blk.playing .no, .blk.playing .ln { color: #05060a; }
.blk.voice .ln::after { content: ' · voice'; }
.addmenu { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding: 10px; border: 1px dashed var(--line); }
.addmenu p { flex: 1 1 100%; margin: 0 0 4px; }

/* the grid */
.grid { overflow-x: auto; padding-bottom: 6px; }
.grid table { border-collapse: separate; border-spacing: 2px 3px; }
.grid th { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left; font-weight: 400; font-size: 12px; padding: 0 6px 0 0; min-width: 120px; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid th .k { color: var(--cyan); font-weight: 700; margin-right: 4px; }
.grid th button { min-height: 32px; padding: 2px 8px; font-size: 12px; margin-left: 4px; }
.grid th #allWords { margin: 0 0 4px; border-color: var(--cyan); }
.grid td { padding: 0; }
.grid .barhead { font-size: 11px; color: var(--dim); text-align: left; padding-left: 2px; }
.cell { display: block; width: 24px; height: 32px; min-height: 0; padding: 0; border-radius: 2px; background: #1d2028; border: 1px solid #2a2e37; font-size: 9px; line-height: 1; color: #05060a; overflow: hidden; }
.cell.beat { background: #252934; }
.cell.on { background: var(--magenta); border-color: var(--magenta); }
.cell.song { background: #ff4d8d; }
.cell.mel { background: var(--cyan); border-color: var(--cyan); font-weight: 700; }
.cell.tail { background: rgba(0,229,255,.35); border-color: rgba(0,229,255,.35); }
.cell.now { outline: 2px solid var(--ink); outline-offset: -2px; }
.grid td.gap { width: 6px; }
.music .cell { width: 24px; height: 26px; }
.music span.cell { cursor: default; opacity: .7; }
.music .cell.on { background: #8a8d94; border-color: #8a8d94; }
.music button.cell.on { background: var(--cyan); border-color: var(--cyan); }
.music tr.muted .cell.on, .music tr.muted button.cell.on { background: #3a3d44; border-color: #3a3d44; }
.music th button.on { background: var(--magenta); color: #05060a; border-color: var(--magenta); }
.gridempty { color: var(--dim); font-size: 13px; }

/* the three parts of the block (his words, the drums, the instruments): each rolls up */
details.sub { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 4px; }
details.sub > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-height: 44px; padding-top: 8px; }
details.sub > summary::-webkit-details-marker { display: none; }
details.sub > summary h3 { margin: 0; }
details.sub > summary h3::before { content: '▸ '; color: var(--cyan); }
details.sub[open] > summary h3::before { content: '▾ '; }
details.sub > summary small { color: var(--dim); font-size: 13px; }
/* Expand all words: a row for every line, its words in full; a line with nothing in the block is one light strip a bar */
.grid.allwords th { white-space: normal; min-width: 200px; max-width: 260px; line-height: 1.25; padding: 3px 8px 3px 0; }
.strip { height: 32px; cursor: pointer; border-radius: 2px; background: repeating-linear-gradient(to right, #191b22 0, #191b22 24px, transparent 24px, transparent 26px); }
.strip:hover { background: repeating-linear-gradient(to right, #262a35 0, #262a35 24px, transparent 24px, transparent 26px); }

/* the piano roll: the names of the notes stay put on the left; the steps scroll across, the notes up and down */
.rollwrap { margin-top: 0; }
.rollpick { flex-wrap: wrap; }
.rollpick button { min-width: 0; font-size: 14px; }
.rollbox { display: flex; align-items: flex-start; overflow: auto; margin-top: 6px; border: 1px solid var(--line); border-radius: 2px; overscroll-behavior: contain; }
.rollkeys { position: sticky; left: 0; z-index: 1; flex: 0 0 52px; background: var(--card); }
.rk { height: 22px; line-height: 20px; font-size: 11px; padding: 0 6px; margin-bottom: 0; border: 1px solid var(--card); border-radius: 2px; background: #e9e5de; color: #111; }
.rk.black { background: #1d1f27; color: var(--ink); }
.rk.root { box-shadow: inset 3px 0 0 var(--cyan); }
.rk.off { opacity: .6; }
.rollarea { position: relative; flex: 0 0 auto; }
#rollCv { display: block; cursor: pointer; touch-action: pan-x pan-y; }
.rollhead { position: absolute; left: 0; top: 0; width: 24px; border: 2px solid var(--ink); border-radius: 2px; pointer-events: none; }

/* Change the chords */
details.card > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-height: 44px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { margin: 0; }
details.card > summary h2::before { content: '▸ '; color: var(--cyan); }
details.card[open] > summary h2::before { content: '▾ '; }
details.card > summary small { color: var(--dim); font-size: 13px; }
details.card:not([open]) > summary { min-height: 32px; }
.chords { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chordtools { flex: 1 1 100%; margin: 0 0 4px; }
.chordtools .seg button { min-width: 0; font-size: 14px; }
.chord { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 3px; min-width: 130px; }
.chord b { font-size: 12px; color: var(--dim); font-weight: 400; }
.chord .nm { font-family: var(--serif); font-size: 20px; color: var(--cyan); }
.chord select { width: 100%; }
.layers { display: grid; gap: 8px; margin-top: 14px; }
.layer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.layer b { min-width: 9em; }
.layer button.on { background: var(--magenta); color: #05060a; border-color: var(--magenta); }

.foot { max-width: 1100px; margin: 0 auto; padding: 8px 16px 40px; color: var(--dim); font-size: 13px; }
.foot p { margin: 4px 0; }
.foot a { margin-right: 14px; }
.visitors { color: var(--ink); }
.odo { display: inline-flex; gap: 2px; vertical-align: middle; margin: 0 6px; }
.odo span { font: 700 16px/1 'Courier New', monospace; background: #05060a; color: var(--cyan); border: 1px solid var(--line); border-radius: 2px; padding: 4px 5px; }

@media (max-width: 760px) {
  .bar { padding: 6px 10px; }
  .transport { gap: 6px; }
  .transport button { padding: 6px 9px; font-size: 14px; }
  main { padding: 10px 10px 20px; }
  .intro h1 { font-size: 36px; }
  .intro .lead { font-size: 15px; }
  /* the board becomes a thumb-sized grid that scrolls inside itself */
  .board { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pad { min-height: 76px; }
  .pad .k { font-size: 16px; }
  .notes { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .seg button { min-width: 84px; }
  .loopseg button { min-width: 0; font-size: 13px; padding: 6px 8px; }
  .filebar { padding: 6px 10px; }
  .filebar button { flex: 1 1 150px; padding: 6px 9px; font-size: 14px; }
  .starts button { flex: 1 1 100%; }
  .padpanel input[type=range] { width: 120px; }
}

/* ?check: the sound engine's health, one line at the foot of the window */
.check { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 6px 10px; background: #05060a; border-top: 1px solid var(--cyan); color: var(--cyan); font: 12px/1.35 'Courier New', monospace; }
