/* Ison in the browser: the app's two themes (dark warm grey, light desert), phone first. A phone shows one module at a
   time under a row of tabs; a wide screen shows them all, as the Mac app does. */
@import url("../fonts/fonts.css");

:root {
  --bg: #23211f; --bar: #1b1a18; --module: #2d2a27; --display: #1a1917; --deck: #8f8778; --line: #3d3934;
  --text: #efe8dc; --dim: #a69d8f; --knob: #2a2725; --track: #5b554d;
  --a: #f0a456; --b: #7fd1c9; --l1: #c39bff; --l2: #f27c9c; --l3: #a8d668; --seq: #e8c35e; --fx: #ef8466;
  --deckText: #2b2722;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #e9dcc4; --bar: #f2e8d6; --module: #f7f0e2; --display: #fbf7ee; --deck: #c9b48f; --line: #d8c8aa;
  --text: #3b2f24; --dim: #7a6a57; --knob: #3b332b; --track: #a89273;
  --a: #c9612b; --b: #2f8c84; --l1: #7e55c9; --l2: #c8456b; --l3: #5f8f2a; --seq: #b0841a; --fx: #c8553a;
  --deckText: #3b2f24;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 400 15px/1.4 "Barlow", "Helvetica Neue", Arial, sans-serif; min-height: 100dvh;
       padding-bottom: env(safe-area-inset-bottom); }
button { font: inherit; color: inherit; }
.label, .top, .tabs, .knob .name, .chip, h2, .power, .go, .seg {
  font-family: "Barlow Semi Condensed", "Barlow", sans-serif; letter-spacing: .06em;
}
a { color: var(--b); }

/* the bar */
.top {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px; background: var(--bar); border-bottom: 1px solid var(--line);
}
.logo { background: none; border: 0; font-weight: 700; font-size: 20px; letter-spacing: .1em; padding: 4px; }
.preset {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: var(--display); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-weight: 700;
  text-align: left;
}
.preset span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset i { font-style: normal; color: var(--dim); }
.icon { background: var(--module); border: 1px solid var(--line); border-radius: 8px; width: 38px; height: 38px; }
.power { background: var(--module); border: 1px solid var(--line); border-radius: 8px; height: 38px; padding: 0 12px;
         font-weight: 700; color: var(--dim); }
.power[aria-pressed="true"] { background: var(--b); border-color: var(--b); color: #14211f; }
.meter { width: 6px; height: 34px; background: var(--display); border-radius: 3px; position: relative; overflow: hidden; }
.meter b { position: absolute; left: 0; right: 0; bottom: 0; height: 0;
           background: linear-gradient(to top, var(--b), var(--seq), var(--fx)); }

/* the tabs (a phone) */
.tabs {
  position: sticky; top: calc(55px + env(safe-area-inset-top)); z-index: 3; display: flex; gap: 6px; overflow-x: auto;
  padding: 8px 10px; background: var(--bg); scrollbar-width: none; border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; border: 1px solid var(--line); background: var(--module); border-radius: 999px; padding: 7px 13px;
  font-weight: 700; font-size: 13px; color: var(--dim); text-transform: uppercase; border-top: 2px solid var(--c, var(--line));
}
.tabs button[aria-selected="true"] { color: var(--text); background: var(--display); border-color: var(--c, var(--b)); }

/* modules */
main { padding: 10px; display: grid; gap: 10px; }
.module { background: var(--module); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
          border-top: 3px solid var(--c, var(--line)); }
.module > h2 { margin: 0; padding: 10px 12px 6px; font-size: 14px; text-transform: uppercase; color: var(--c, var(--text));
               display: flex; align-items: center; gap: 8px; }
.module > h2 .sp { flex: 1; }
.row { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.chip {
  border: 1px solid var(--line); background: var(--display); border-radius: 8px; padding: 7px 10px; font-weight: 700;
  font-size: 13px; text-transform: uppercase; display: inline-flex; gap: 6px; align-items: baseline;
}
.chip small { color: var(--dim); font-weight: 600; font-size: 11px; }
.chip.on { background: var(--c, var(--b)); border-color: var(--c, var(--b)); color: #15130f; }
.chip.on small { color: #15130f; opacity: .7; }
canvas.display { display: block; width: 100%; height: 150px; background: var(--display);
                 border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); touch-action: pan-y; }
.deck { background: var(--deck); padding: 12px 6px 8px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 2px; }

/* knobs */
.knob { display: flex; flex-direction: column; align-items: center; gap: 2px; touch-action: none; user-select: none;
        -webkit-user-select: none; cursor: ns-resize; }
.knob svg { width: 62px; height: 62px; overflow: visible; }
.knob .name { font-size: 11px; font-weight: 700; color: var(--deckText); text-transform: uppercase; }
.knob .val { font-size: 11px; color: var(--deckText); opacity: .75; min-height: 14px; font-variant-numeric: tabular-nums; }
.knob.active .val { opacity: 1; font-weight: 700; }

/* key, sequencer, routes */
.big { font: 700 34px/1.05 "Barlow Semi Condensed", sans-serif; letter-spacing: .03em; padding: 12px 12px 2px; }
.notes { padding: 0 12px 10px; font-size: 14px; }
.notes b { font-family: "Barlow Semi Condensed", sans-serif; margin-right: 6px; }
.keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 0 12px 12px; }
.keys button { padding: 10px 0; border-radius: 8px; border: 1px solid var(--line); background: var(--display); font-weight: 700; }
.keys button.on { background: var(--b); color: #14211f; border-color: var(--b); }
.keys button.inscale { border-color: var(--b); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 12px 12px; }
.step { border: 1px solid var(--line); background: var(--display); border-radius: 10px; padding: 8px 4px; text-align: center;
        position: relative; overflow: hidden; }
.step.off { opacity: .35; }
.step.now { border-color: var(--seq); box-shadow: inset 0 0 0 1px var(--seq); }
.step .deg { font: 700 22px/1 "Barlow Semi Condensed", sans-serif; }
.step .nn { font-size: 11px; color: var(--dim); min-height: 14px; }
.step .ctl { display: flex; justify-content: center; gap: 4px; margin-top: 6px; }
.step .ctl button { border: 1px solid var(--line); background: var(--module); border-radius: 6px; padding: 2px 7px; font-size: 13px; }
.step .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--seq); }
.routes { padding: 0 12px 12px; display: grid; gap: 8px; }
.route { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; background: var(--display);
         border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.route input { grid-column: 1 / -1; width: 100%; accent-color: var(--c); }
.route button { background: none; border: 0; color: var(--dim); font-size: 16px; }
.hint { color: var(--dim); font-size: 13px; padding: 0 12px 12px; margin: 0; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end;
         justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-card { background: var(--module); width: min(560px, 100%); max-height: 82dvh; overflow: auto; border-radius: 16px 16px 0 0;
              padding: 0 14px calc(16px + env(safe-area-inset-bottom)); border: 1px solid var(--line); }
.sheet-head { position: sticky; top: 0; background: var(--module); display: flex; justify-content: space-between;
              align-items: center; padding: 14px 0 10px; font-family: "Barlow Semi Condensed", sans-serif; font-size: 18px; }
.list { display: grid; gap: 6px; }
.list button { text-align: left; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--display);
               font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.list button.on { border-color: var(--b); color: var(--b); }
.list .sec { font: 700 12px/1 "Barlow Semi Condensed", sans-serif; letter-spacing: .12em; color: var(--dim); margin: 10px 0 2px; }
.field { display: grid; gap: 4px; margin: 10px 0; }
.field input[type="range"] { width: 100%; accent-color: var(--b); }
.field .lab { display: flex; justify-content: space-between; font-weight: 600; }
.field .lab span { color: var(--dim); font-variant-numeric: tabular-nums; }

/* the first screen */
.start { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: grid; place-items: center; padding: 24px;
         text-align: center; }
.start[hidden] { display: none; }
.start h1 { font: 700 64px/1 "Barlow Semi Condensed", sans-serif; letter-spacing: .08em; margin: 0 0 12px; }
.start h1 span { font-weight: 600; color: var(--dim); }
.start p { max-width: 36ch; margin: 0 auto 18px; }
.start .small { font-size: 13px; color: var(--dim); }
.go { background: var(--b); color: #14211f; border: 0; border-radius: 12px; padding: 16px 28px; font-size: 18px; font-weight: 700;
      text-transform: uppercase; margin-bottom: 22px; }

/* a wide screen: every module at once, the tabs gone */
@media (min-width: 900px) {
  .tabs { display: none; }
  main { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); padding: 12px; }
  .module[hidden] { display: block !important; }
  .module.wide { grid-column: span 2; }
}
@media (max-width: 899px) {
  .module[hidden] { display: none; }
  canvas.display { height: 34vh; max-height: 260px; min-height: 140px; }
}
