/* SPDX-License-Identifier: GPL-3.0-only
 * FM1-Chord editor (0.8): the dark module-panel look, as on the FM-1: near-black panels, light text, one cyan
 * accent, knobs. Big type and big touch targets (iPad first). Green / amber / red keep their words too. */
:root {
  color-scheme: dark;
  --bg: #1b1d20;
  --panel: #262a2e;
  --panel2: #1f2326;
  --ink: #eceef0;
  --soft: #a3a9b1;
  --line: #3a3f45;
  --line2: #555c64;
  --sel: #3cc8dc;
  --selbg: #173a40;
  --hit: #ffc24a;
  --press: #2f4f55;
  --white-key: #34383d;
  --black-key: #17191c;
  --dark-ink: #0e1012;
  --g-bg: #133a29; --g-bd: #3ddc84; --g-ink: #a6f3c8;
  --a-bg: #3d2f10; --a-bd: #ffb020; --a-ink: #ffd98a;
  --r-bg: #43201d; --r-bd: #ff5a4f; --r-ink: #ffb4ad;
  --radius: 12px;
  --tap: 56px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/1.4 -apple-system, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  touch-action: manipulation;
}
button, select, input { font: inherit; color: var(--ink); }
button {
  min-height: var(--tap); min-width: var(--tap); padding: 8px 18px; border-radius: var(--radius);
  border: 2px solid var(--line2); background: var(--panel); font-weight: 650; cursor: pointer;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
button:active { background: var(--press); }
button.on, button[aria-pressed="true"] { background: var(--selbg); border-color: var(--sel); box-shadow: inset 0 0 0 2px var(--sel); }
button.primary { background: var(--sel); border-color: var(--sel); color: var(--dark-ink); }
button:disabled { opacity: .45; cursor: default; }
select, input[type="text"], input:not([type]) {
  min-height: var(--tap); border-radius: var(--radius); border: 2px solid var(--line2); background: var(--panel);
  padding: 6px 12px; font-weight: 600;
}
a { color: var(--sel); }

/* ---- top bar ---- */
.top { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px 18px; padding: 12px 16px;
  border-bottom: 2px solid var(--sel); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.brand { font-size: 26px; font-weight: 800; letter-spacing: .02em; }
.brand small { display: block; font-size: 15px; font-weight: 600; color: var(--soft); letter-spacing: 0; }
.setbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; grid-column: 1 / -1; }
.setbar .lbl { font-weight: 700; color: var(--soft); }
#lib { max-width: 320px; }
#setname { width: 12em; text-transform: uppercase; letter-spacing: .04em; }
.conn { display: flex; gap: 10px; align-items: center; justify-self: end; }
#status { font-weight: 700; color: var(--soft); max-width: 22em; }
#status.ok { color: var(--g-ink); }
#status.bad { color: var(--r-ink); }
button.sound.on { background: var(--g-bg); border-color: var(--g-bd); box-shadow: none; }

main { padding: 12px 16px 24px; max-width: 1500px; margin: 0 auto; }

/* ---- keyboard ---- */
.kbwrap { background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 12px; }
.kbhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.octave { display: flex; gap: 8px; align-items: center; }
#oct-val { font-size: 22px; font-weight: 800; min-width: 5.5em; text-align: center; }
.nowplaying { font-size: 30px; font-weight: 800; min-height: 1.3em; text-align: center; flex: 1; }
.nowplaying small { font-size: 18px; color: var(--soft); font-weight: 700; margin-left: 10px; }
.kbview { display: flex; gap: 6px; }

.kb { position: relative; height: 300px; display: flex; user-select: none; -webkit-user-select: none; touch-action: none; }
.kb .kb-key { position: relative; border: 2px solid #0e1012; border-radius: 0 0 10px 10px; background: var(--white-key);
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center; text-align: center;
  padding: 6px 2px 10px; cursor: pointer; overflow: hidden; }
.kb .kb-key.white { flex: 1; margin-right: -2px; z-index: 1; }
.kb .kb-key.black { position: absolute; top: 0; height: 56%; background: var(--black-key); z-index: 2;
  border-radius: 0 0 8px 8px; justify-content: flex-start; padding-top: 8px; }
.kb .kb-key .cn { font-size: 19px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.kb .kb-key .cn.m { font-size: 16px; } .kb .kb-key .cn.l { font-size: 14px; white-space: normal; }
.kb .kb-key.black .cn { font-size: 16px; } .kb .kb-key.black .cn.m, .kb .kb-key.black .cn.l { font-size: 14px; white-space: normal; }
.kb .kb-key .kn { font-size: 14px; font-weight: 700; color: var(--soft); margin-top: 4px; }
.kb .kb-key.empty .cn { color: var(--soft); font-weight: 600; }
.kb .kb-key.sel { box-shadow: inset 0 0 0 4px var(--sel); background: var(--selbg); }
.kb .kb-key.black.sel { background: #1e4950; }
.kb .kb-key.hit { background: var(--hit) !important; }
.kb .kb-key.sug-green { background: var(--g-bg); } .kb .kb-key.sug-amber { background: var(--a-bg); }

/* the tiles view: 27 big buttons, 9 a row */
.kb.grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 8px; height: auto; }
.kb.grid .kb-key { position: static; height: 96px; border-radius: 12px; margin: 0; justify-content: center; padding: 6px; }
.kb.grid .kb-key.black { background: #2a2e33; }
.kb.grid .kb-key .cn { font-size: 22px; }

/* ---- tabs and panels ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.tabs button { font-size: 19px; border-radius: 12px 12px 0 0; border-bottom: none; min-width: 8em; }
.tabs button.on { background: var(--panel); box-shadow: inset 0 4px 0 var(--sel); border-color: var(--line2); }
.panel { background: var(--panel); border: 2px solid var(--line2); border-radius: 0 16px 16px 16px; padding: 18px; min-height: 340px; }
.panel h2 { font-size: 24px; margin: 0 0 12px; }
.panel h3 { font-size: 19px; margin: 18px 0 8px; color: var(--soft); text-transform: uppercase; letter-spacing: .05em; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row + .row { margin-top: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-width: 64px; }
.qual button { min-width: 84px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 8px 28px; }
.big { font-size: 40px; font-weight: 850; line-height: 1.1; }
.notes { font-size: 20px; font-weight: 700; color: var(--soft); }
.hint { color: var(--soft); font-size: 17px; }
.chordhead { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between;
  padding-bottom: 12px; border-bottom: 2px solid var(--line); }

.field { margin: 6px 0 10px; }
.field > label { display: block; font-weight: 700; margin-bottom: 6px; }
/* sliders: big thumbs, the value beside */
.ctl { display: grid; grid-template-columns: 9em 1fr 4.6em; gap: 12px; align-items: center; min-height: var(--tap); }
.ctl label { font-weight: 700; }
.ctl output { font-weight: 800; font-size: 20px; text-align: right; white-space: nowrap; }
input[type="range"] { width: 100%; height: 44px; accent-color: var(--sel); }
input[type="range"]::-webkit-slider-thumb { width: 34px; height: 34px; }

/* ---- suggestions ---- */
.sugbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.pill { display: inline-block; border: 2px solid; border-radius: 999px; padding: 2px 12px; font-weight: 800; font-size: 16px; }
.pill.green { background: var(--g-bg); border-color: var(--g-bd); color: var(--g-ink); }
.pill.amber { background: var(--a-bg); border-color: var(--a-bd); color: var(--a-ink); }
.pill.red { background: var(--r-bg); border-color: var(--r-bd); color: var(--r-ink); }
.sugs { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.sug { border: 3px solid; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sug.green { background: var(--g-bg); border-color: var(--g-bd); color: var(--g-ink); }
.sug.amber { background: var(--a-bg); border-color: var(--a-bd); color: var(--a-ink); }
.sug.red { background: var(--r-bg); border-color: var(--r-bd); color: var(--r-ink); }
.sug .top2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sug .nm { font-size: 30px; font-weight: 850; color: var(--ink); }
.sug .rn { font-size: 18px; font-weight: 800; color: var(--ink); }
.sug .why { font-size: 16px; font-weight: 600; color: var(--ink); }
.sug .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.sug .acts button { min-height: 50px; padding: 6px 12px; font-size: 17px; }
.sug.picked { outline: 4px solid var(--sel); outline-offset: 2px; }

/* ---- progression ---- */
.steps { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.step { border: 2px solid var(--line2); border-radius: 12px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; background: var(--panel2); }
.step.now { background: var(--hit); color: var(--dark-ink); }
.step .nm { font-size: 22px; font-weight: 800; min-width: 3.5em; }
.step button { min-height: 46px; min-width: 46px; padding: 4px 10px; }
.phrases { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.phrase { text-align: left; display: flex; flex-direction: column; gap: 6px; }
.phrase .bar { display: grid; grid-template-columns: repeat(16, 1fr); gap: 1px; height: 14px; }
.phrase .bar i { background: var(--line); }
.phrase .bar i.h { background: var(--sel); }
button.rec.on { background: var(--r-bg); border-color: var(--r-bd); box-shadow: none; }

/* ---- device ---- */
table.slots { border-collapse: collapse; width: 100%; font-size: 18px; }
table.slots td, table.slots th { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
table.slots td.acts { white-space: nowrap; text-align: right; }
table.slots button { min-height: 46px; padding: 4px 12px; }
.callout { border: 2px solid var(--line2); border-radius: 12px; padding: 12px 14px; background: var(--panel2); }
.callout.warn { border-color: var(--a-bd); background: var(--a-bg); color: var(--a-ink); }

/* learn */
.mini { display: flex; position: relative; height: 150px; margin-top: 10px; touch-action: none; }
.mini .mk { flex: 1; border: 2px solid #0e1012; margin-right: -2px; background: var(--white-key); border-radius: 0 0 8px 8px;
  display: flex; align-items: flex-end; justify-content: center; font-size: 13px; font-weight: 700; padding-bottom: 6px; }
.mini .mk.b { position: absolute; top: 0; height: 58%; background: var(--black-key); z-index: 2; }
.mini .mk.on { background: var(--hit); color: var(--dark-ink); }

footer { text-align: center; color: var(--soft); padding: 18px; font-size: 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel);
  border: 2px solid var(--sel); border-radius: 14px; padding: 12px 20px; font-weight: 800; z-index: 20; max-width: 90vw; }

@media (max-width: 900px) {
  .kb { height: 240px; }
  .kb .kb-key .cn { font-size: 15px; }
  .tabs button { min-width: 6em; font-size: 17px; }
}
/* live sync (0.4): green when changes go to the FM-1 as you make them */
button.live { box-shadow: none; background: var(--panel); border-color: var(--line2); }
button.live.on { background: var(--g-bg); border-color: var(--g-bd); }
/* paste chords (0.4) */
dialog#imp { border: 3px solid var(--ink); border-radius: 16px; background: var(--panel); color: var(--ink); padding: 0;
  width: min(880px, 94vw); max-height: 90vh; }
dialog#imp::backdrop { background: rgba(14, 16, 18, .8); }
.imp { padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; }
.imp h2 { margin: 0; font-size: 26px; }
.imp textarea { font: 20px/1.45 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink); background: var(--panel2);
  border: 2px solid var(--line2); border-radius: 12px; padding: 12px; width: 100%; resize: vertical; }
.imp .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.imp .row.end { justify-content: flex-end; }
.imp .chk { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.imp .chk input { width: 28px; height: 28px; }
.implist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow: auto; }
.implist li { border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 19px; }
.implist li > div { margin-top: 4px; font-weight: 600; word-spacing: 4px; }
.implist .bad { color: var(--r-ink); background: var(--r-bg); border-radius: 8px; padding: 2px 8px; display: inline-block; }
/* sound part 2 (0.6): macros, the mod matrix */
.macros .ctl { grid-template-columns: 11em 1fr 3.5em; }
.macros .ctl label { font-size: 19px; }
.matrix { display: flex; flex-direction: column; gap: 10px; }
.mrow { display: grid; grid-template-columns: 2em minmax(9em, 13em) auto minmax(9em, 13em) 1fr; gap: 10px; align-items: center;
  border: 2px solid var(--line); border-radius: 12px; padding: 6px 12px; background: var(--panel); }
.mrow .mnum { font-weight: 800; font-size: 22px; text-align: center; }
.mrow .marrow { font-weight: 700; color: var(--soft); }
.mrow .ctl { grid-template-columns: 2em 1fr 4.2em; }
.seg.small button { min-width: 0; padding-left: 10px; padding-right: 10px; }
@media (max-width: 760px) { .mrow { grid-template-columns: 2em 1fr; } .mrow .marrow { display: none; } .mrow .ctl { grid-column: 1 / -1; } }

/* ---- 0.8: dark module panels and knobs ---- */
.kb .kb-key.hit, .kb .kb-key.hit .cn, .kb .kb-key.hit .kn { color: var(--dark-ink) !important; }
.kb .kb-key { color: var(--ink); }
/* a key's fit after the key before it: a coloured bar along its foot */
.kb .kb-key.fit-green { box-shadow: inset 0 -6px 0 var(--g-bd); }
.kb .kb-key.fit-amber { box-shadow: inset 0 -6px 0 var(--a-bd); }
.kb .kb-key.fit-red { box-shadow: inset 0 -6px 0 var(--r-bd); }
.kb .kb-key.sel.fit-green, .kb .kb-key.sel.fit-amber, .kb .kb-key.sel.fit-red { box-shadow: inset 0 0 0 4px var(--sel); }
.panel { background: var(--bg); border-color: var(--line); }
.tabs button.on { background: var(--bg); color: var(--sel); }
.panel h3 { color: var(--ink); display: flex; align-items: center; gap: 8px; font-size: 17px; letter-spacing: .08em; }
.panel h3::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--sel); flex: none; }
.panel .cols { gap: 12px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.panel .cols > div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px 12px; }
.panel .cols > div > h3:first-child { margin-top: 10px; }
.seg button { background: var(--panel2); border-color: var(--line2); }
.seg button.on, .seg button[aria-pressed="true"] { background: var(--selbg); border-color: var(--sel); color: var(--sel); box-shadow: none; }
/* knobs: the range input lies over the dial (keyboard and screen readers use it); drag up and down */
.ctl.knob { display: inline-grid; grid-template-columns: 1fr; grid-template-rows: 64px auto auto; width: 104px;
  justify-items: center; gap: 2px; margin: 4px 2px; vertical-align: top; min-height: 0; }
.ctl.knob svg, .ctl.knob input[type="range"] { grid-row: 1; grid-column: 1; }
.ctl.knob svg { width: 72px; height: 64px; }
.ctl.knob input[type="range"] { width: 72px; height: 64px; opacity: 0; margin: 0; cursor: ns-resize; touch-action: none; }
.ctl.knob input[type="range"]:focus-visible + output { outline: 3px solid var(--sel); outline-offset: 2px; border-radius: 6px; }
.ctl.knob output { grid-row: 2; font-size: 19px; font-weight: 800; text-align: center; }
.ctl.knob label { grid-row: 3; font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  color: var(--soft); text-align: center; line-height: 1.15; }
.knob .kt { fill: none; stroke: var(--line); stroke-width: 6; stroke-linecap: round; }
.knob .kv { fill: none; stroke: var(--sel); stroke-width: 6; stroke-linecap: round; }
.knob .kc { fill: #31363b; }
.knob .kp { stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; }
.macros .ctl.knob, .mrow .ctl.knob { grid-template-columns: 1fr; }
.mrow { background: var(--panel); border-color: var(--line); }
/* the chord page's rating: this key after the one before */
.fitbadge { display: inline-flex; align-items: center; gap: 10px; border: 2px solid; border-radius: 10px; padding: 6px 12px;
  font-weight: 800; font-size: 18px; }
.fitbadge.green { background: var(--g-bg); border-color: var(--g-bd); color: var(--g-ink); }
.fitbadge.amber { background: var(--a-bg); border-color: var(--a-bd); color: var(--a-ink); }
.fitbadge.red { background: var(--r-bg); border-color: var(--r-bd); color: var(--r-ink); }
.fitbadge.none { border-color: var(--line2); color: var(--soft); }
.seg button.t-green { border-color: var(--g-bd); box-shadow: inset 0 -4px 0 var(--g-bd); }
.seg button.t-amber { border-color: var(--a-bd); box-shadow: inset 0 -4px 0 var(--a-bd); }
.seg button.t-red { border-color: #6b3532; box-shadow: inset 0 -4px 0 var(--r-bd); }
.seg button.on.t-green, .seg button.on.t-amber, .seg button.on.t-red { color: var(--ink); background: var(--selbg); }

/* in the Ableton device (host.js): no links out of it */
body.host footer { display: none; }
