/* RC-500 Editor — Copyright (C) 2026 Jon Solberg — GPL-3.0-or-later */
:root {
  --bg: #f4f5f7; --panel: #ffffff; --panel2: #eef0f3; --text: #1b1e23; --muted: #646b76; --line: #d9dde3;
  --accent: #d71920; --accent-ink: #ffffff; --danger: #b4231b; --dirty: #e8a317; --ok: #23a55a;
  --radius: 10px; --side: 230px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101317; --panel: #191d23; --panel2: #222831; --text: #e8eaed; --muted: #9aa3ae; --line: #2c333d;
    --accent: #ff3b3b; --accent-ink: #ffffff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101317; --panel: #191d23; --panel2: #222831; --text: #e8eaed; --muted: #9aa3ae; --line: #2c333d;
  --accent: #ff3b3b; --accent-ink: #ffffff; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
@supports (height: 100dvh) { body { height: 100dvh; } }   /* follows the browser bars on phones */
body {
  background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}
a { color: var(--accent); }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; }

button, select, input { font: inherit; color: inherit; }
button {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer;
  white-space: nowrap;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--danger); }
button.danger:hover:not(:disabled) { border-color: var(--danger); }
button.small { padding: 2px 8px; font-size: 13px; }
button.iconbtn { padding: 6px 9px; }
#btnMore { font-size: 17px; line-height: 1; min-width: 34px; display: inline-flex; align-items: center; justify-content: center; }
button.save.attention { background: var(--dirty); color: #231800; border-color: var(--dirty); font-weight: 600; }
select, input[type=number], input[type=search], input.name {
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; max-width: 100%;
}
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=number] { width: 90px; }
input[type=range] { accent-color: var(--accent); width: 100%; }
input[type=checkbox] { accent-color: var(--accent); }

/* header */
header.top {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line);
  padding-top: max(8px, env(safe-area-inset-top)); min-height: 54px;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; letter-spacing: .3px; white-space: nowrap; }
.brand b { color: var(--accent); }
button.status { display: inline-flex; align-items: center; gap: 7px; background: var(--panel2); border-radius: 99px; padding: 5px 12px;
  font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: #8a9099; flex: none; }
.status .dot.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.status .sep { opacity: .6; }
.status .unsaved { background: var(--dirty); color: #231800; border-radius: 99px; padding: 0 7px; font-weight: 600; font-size: 12px; }
.actions { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.actions .ic { display: none; }
#banner .warn { margin: 0; border-radius: 0; }
.warn { background: #fff4d6; color: #5a4100; padding: 8px 14px; border-radius: 8px; }
:root[data-theme="dark"] .warn { background: #3a2f12; color: #ffe39a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .warn { background: #3a2f12; color: #ffe39a; } }
.ok { color: var(--ok); font-weight: 600; }

nav.tabs { display: flex; gap: 2px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
nav.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 9px 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
nav.tabs button .ti { display: none; }
nav.tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.layout { flex: 1; display: flex; min-height: 0; }
aside.side { width: var(--side); border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.sidehead { display: none; }
#memfilter { margin: 8px; }
#memlist { list-style: none; margin: 0; padding: 0 0 20px; overflow-y: auto; flex: 1; position: relative; }
#memlist li { display: flex; gap: 8px; align-items: center; padding: 5px 12px; cursor: pointer; border-left: 3px solid transparent; }
#memlist li:hover { background: var(--panel2); }
#memlist li.sel { background: var(--panel2); border-left-color: var(--accent); font-weight: 600; }
#memlist .no { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 22px; white-space: nowrap; }
#memlist .nm { flex: 1; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
#memlist li.dirty .no::after { content: " •"; color: var(--dirty); }
#memlist .wav { color: var(--accent); font-size: 10px; }

main { flex: 1; overflow-y: auto; padding: 14px 18px 60px; min-width: 0; }
.memhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.memtitle { display: flex; align-items: center; gap: 12px; min-width: 0; }
.big { font-size: 26px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.big2 { font-size: 20px; font-weight: 700; padding: 0 8px; font-variant-numeric: tabular-nums; }
input.name { font: 600 20px ui-monospace, "Cascadia Mono", Consolas, monospace; width: 15ch; letter-spacing: 1px; min-width: 0; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Cards packed in columns (no big empty gaps), wide cards across */
.grid { columns: 3 320px; column-gap: 14px; }
.grid > * { break-inside: avoid; margin: 0 0 14px; min-width: 0; display: block; }
.grid > .card.wide { column-span: all; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; }
.card h3 { margin: 0 0 6px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.row { display: grid; grid-template-columns: 128px minmax(0, 1fr); align-items: center; gap: 2px 10px; padding: 3px 0; }
.row > label { color: var(--muted); display: flex; align-items: center; gap: 5px; line-height: 1.2; }
.row .ib { width: 17px; height: 17px; padding: 0; border-radius: 50%; font: italic 700 11px/15px Georgia, serif; color: var(--muted); flex: none; }
.row .hint { grid-column: 1 / -1; display: none; font-size: 12.5px; color: var(--muted); background: var(--panel2); border-radius: 6px; padding: 6px 9px; margin: 2px 0 4px; }
.row.showhint .hint { display: block; }
.row.showhint .ib { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.ctl select { flex: 1; min-width: 0; text-overflow: ellipsis; }
.slider { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.slider input { min-width: 0; }
.slider output { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.note { color: var(--muted); font-size: 12.5px; }
.warnnote { color: var(--dirty); }
.info { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.info.center { text-align: center; margin-top: 18px; }
label.inl { display: inline-flex; align-items: center; gap: 2px; margin-right: 10px; white-space: nowrap; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Assign 1–8 */
.assigns { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 8px; margin-top: 8px; }
.arow { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 5px 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel2); }
.arow .anum { grid-row: span 3; align-self: start; font-weight: 700; display: flex; align-items: center; gap: 3px; padding-top: 5px; }
.afield { display: flex; align-items: center; gap: 6px; min-width: 0; }
.afield select { flex: 1; min-width: 0; }
.alabel { color: var(--muted); font-size: 12.5px; min-width: 34px; }
.arow.off .afield { opacity: .5; }
.arow input[type=number] { width: 80px; }

.raw details summary { cursor: pointer; color: var(--muted); }
.rawsec h4 { margin: 12px 0 6px; font-size: 12px; color: var(--accent); }
.rawgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 12px; }
.rawgrid label { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.rawgrid input { width: 80px; }

table.loops { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 12px; }
table.loops th, table.loops td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.loops th { color: var(--muted); font-size: 12px; text-transform: uppercase; background: var(--panel2); }
table.loops tr.sel td { background: var(--panel2); }
table.loops td.no { color: var(--accent); font-weight: 700; cursor: pointer; width: 40px; }
table.loops td.nm { font-family: ui-monospace, Consolas, monospace; white-space: pre; width: 130px; }
.loopcell { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.loopcell .fname { flex: 1; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loopcell small { color: var(--muted); }
.empty-l { flex: 1; color: var(--muted); }

.datagrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin-top: 8px; }
.datagrid button { width: 100%; }
.phoneonly { display: none !important; }
@media (max-width: 819px) { .phoneonly { display: grid !important; margin: 4px 0 16px; } }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
button.transport { font-size: 16px; padding: 10px 20px; }
.ccpad { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line, rgba(128,128,128,.25)); border-radius: 8px; }
.cchead { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; font-size: 13.5px; }
.ccctl { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ccslider { display: flex; gap: 6px; align-items: center; flex: 1; min-width: 150px; }
.ccslider input { flex: 1; }
.ccval { width: 28px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.ccn { color: var(--muted); font-variant-numeric: tabular-nums; }
button.pad { touch-action: none; user-select: none; white-space: nowrap; }
button.pad.on { background: var(--accent); color: var(--accent-ink); }
.midilog { font: 12.5px ui-monospace, Consolas, monospace; max-height: 420px; overflow-y: auto; margin-top: 8px; }
.midilog .in { color: var(--accent); }
.midilog .out { color: var(--muted); }

.empty, .about { max-width: 720px; }
.about h3 { margin-top: 22px; }
a.kofi { display: inline-block; margin-top: 8px; padding: 8px 14px; border-radius: 8px; background: #ff5e5b; color: #fff; text-decoration: none; font-weight: 600; }

/* Start page */
.start { max-width: 780px; margin: 0 auto; display: grid; gap: 12px; }
.hero h2 { margin: 4px 0 4px; font-size: 22px; }
.hero p { margin: 0; color: var(--muted); }
.step .stephead { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.step .stephead h3 { margin: 0; font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--text); }
.stepno { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line); font-weight: 700; flex: none; }
.step.done .stepno { background: var(--ok); border-color: var(--ok); color: #fff; }
.step p { margin: 6px 0; }
.checklist { margin: 6px 0; padding-left: 20px; }
.checklist li { margin: 3px 0; }

/* menus and dialogs */
.menu-back { position: fixed; inset: 0; z-index: 55; }
.menu { position: fixed; min-width: 230px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 5px; box-shadow: 0 10px 30px rgba(0,0,0,.35); display: flex; flex-direction: column; }
.menu button { background: none; border: 0; text-align: left; padding: 9px 12px; border-radius: 7px; }
.menu button:hover:not(:disabled) { background: var(--panel2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; width: min(520px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.modal.busy { display: flex; align-items: center; gap: 14px; width: min(420px, 100%); }
.modal.busy p { margin: 0; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal h2 { margin: 0 0 10px; font-size: 18px; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal .checks { display: flex; flex-wrap: wrap; gap: 6px 0; }
.modal .rangein input { width: 70px; }
ul.dl { list-style: none; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }

#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(520px, calc(100% - 24px)); pointer-events: none; }
.toast { background: #242a33; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.3); transition: opacity .5s; }
.toast.err { background: var(--danger); }
.toast.out { opacity: 0; }

/* ------------------------------------------------------------------ phones: memory picker on top, tab bar at the bottom */
.only-narrow { display: none !important; }
@media (max-width: 820px) {
  .only-narrow { display: inline-flex !important; }
  .only-wide { display: none !important; }
  header.top { gap: 8px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); min-height: 52px; }
  .brand .appicon { width: 22px; height: 22px; }
  button.mempick { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; background: var(--panel2);
    font: 600 15px ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
  button.mempick b { color: var(--accent); }
  button.mempick .caret { margin-left: auto; color: var(--muted); font-family: system-ui, sans-serif; }
  button.status { padding: 9px; border-radius: 50%; }
  .actions { margin-left: 0; gap: 4px; }
  .actions button { padding: 7px 10px; }
  .actions .lb { display: none; }
  .actions .ic { display: inline; font-size: 17px; line-height: 1; }
  /* the tab bar is the last part of the page layout (not fixed), so it sits right at the bottom in every browser */
  nav.tabs { order: 10; flex: none; z-index: 30; padding: 0; border-top: 1px solid var(--line); border-bottom: 0;
    justify-content: space-around; box-shadow: 0 -4px 14px rgba(0,0,0,.18); overflow: visible; }
  nav.tabs button { flex: 1; flex-direction: column; gap: 0; padding: 5px 2px 4px; font-size: 11.5px; line-height: 1.2; border-bottom: 0; border-top: 3px solid transparent; }
  nav.tabs button .ti { display: block; font-size: 18px; line-height: 1.1; }
  nav.tabs button.on { border-top-color: var(--accent); color: var(--accent); }
  aside.side { position: fixed; inset: 0; z-index: 45; width: auto; border: 0; transform: translateY(100%); transition: transform .2s; padding-top: env(safe-area-inset-top); }
  body.show-list aside.side { transform: none; }
  .sidehead { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 0; font-size: 16px; }
  #memlist li { padding: 9px 14px; font-size: 15px; }
  main { padding: 10px 10px 30px; }
  .grid { columns: 1; }
  .row { grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); }
  .memhead { flex-wrap: nowrap; }
  .memtitle .big { display: none; }
  input.name { flex: 1; width: auto; font-size: 18px; }
  .assigns { grid-template-columns: 1fr; }
  #toasts { bottom: 76px; }
  table.loops td.nm { width: auto; }
}

/* ------------------------------------------------------------------ Direct mode: the RC-500 panel */
.rcwrap { width: 100%; max-width: 1110px; margin: 0 0 10px; box-sizing: border-box; }
.rcpanel {
  position: relative; width: 920px; height: 714px; transform-origin: top left; user-select: none; -webkit-user-select: none;
  border-radius: 18px; color: #fff; font-family: "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(255,255,255,.14), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, transparent 421px, rgba(0,0,0,.1) 421px, rgba(0,0,0,.2) 100%),
    linear-gradient(180deg, #d7262c 0%, #c71f26 50%, #b81a21 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.3), inset 0 -4px 0 rgba(0,0,0,.25), inset 2px 0 0 rgba(255,255,255,.12), 0 14px 34px rgba(0,0,0,.4);
}
.rcpanel > * { position: absolute; transform: translate(-50%, -50%); }
.jack { width: 44px; height: 22px; border-radius: 4px 4px 0 0; background: linear-gradient(90deg, #8d9095, #e6e8eb 45%, #9a9da2); box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); z-index: -1; }
.jack.mini { width: 22px; height: 6px; border-radius: 1px; }
.jack.black { background: linear-gradient(90deg, #111214, #3a3c40 45%, #141517); box-shadow: inset 0 -2px 0 rgba(0,0,0,.5), 0 0 0 1px #55585e; }
.xlr { width: 76px; height: 6px; border-radius: 1px; background: linear-gradient(90deg, #111214, #3a3c40 45%, #141517); box-shadow: inset 0 -2px 0 rgba(0,0,0,.5), 0 0 0 1px #55585e; z-index: -1; }
.jlabel { font-size: 14px; font-weight: 600; letter-spacing: .3px; color: var(--muted); white-space: nowrap; font-family: system-ui, sans-serif; }
.jlabel.grp { font-size: 15px; font-weight: 700; color: var(--text); }
.logo { transform: translate(-100%, -50%) !important; display: flex; align-items: baseline; gap: 14px; font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 700; white-space: nowrap; }
.logo .ls { font-size: 17px; letter-spacing: .5px; }
.logo .mdl { font-size: 33px; letter-spacing: 1px; }
.plabel { font-size: 15px; font-weight: 700; letter-spacing: .2px; white-space: pre; text-align: center; line-height: 1.1; text-shadow: 0 1px 0 rgba(0,0,0,.18); }
.vline { width: 2px; height: 310px; background: #fff; }
.hline { width: 120px; height: 2px; background: #fff; }
.seam { width: 920px; height: 2px; background: rgba(255,255,255,.35); z-index: 1; }
/* The upper deck is flat; the raised edge of the stomp section casts its shadow up onto the deck. */
.seamshade { width: 920px; height: 20px; background: linear-gradient(0deg, rgba(0,0,0,.42), rgba(0,0,0,0)); pointer-events: none; }

.led { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #5b1013; box-shadow: inset 0 1px 2px rgba(0,0,0,.6); }
.led.sm { width: 13px; height: 13px; } .led.xs { width: 11px; height: 11px; }
.led.blue { background: #6f8cff; box-shadow: 0 0 10px #6f8cff; }
.led.red { background: #ff3030; box-shadow: 0 0 10px #ff3030; }
.led.green { background: #46ff8a; box-shadow: 0 0 10px #46ff8a; }
.led.yellow { background: #ffe14a; box-shadow: 0 0 10px #ffe14a; }
.led.white { background: #fff; box-shadow: 0 0 10px #fff; }
.led.blink { animation: ledblink 1s steps(1) infinite; }
@keyframes ledblink { 50% { opacity: .3; } }
.led.tempoled { background: #5b1013; box-shadow: inset 0 1px 2px rgba(0,0,0,.6); }
.led.tempoled.on { background: #ff3030; box-shadow: 0 0 12px #ff3030; }

.vslider { display: block; }
.vtrack { position: relative; width: 48px; height: 128px; cursor: ns-resize; touch-action: none; }
.vtrack.dis { cursor: not-allowed; opacity: .4; filter: grayscale(1); }
.vgroove { position: absolute; left: 50%; top: 0; bottom: 0; width: 8px; transform: translateX(-50%); border-radius: 2px; background: #0e0e10; box-shadow: inset 0 1px 3px #000; }
.vticks { position: absolute; inset: 6px -6px; display: flex; flex-direction: column; justify-content: space-between; }
.vticks i { display: block; height: 2px; background: linear-gradient(90deg, #fff 0 12px, transparent 12px calc(100% - 12px), #fff calc(100% - 12px)); }
.vticks i.s { height: 1px; margin: 0 6px; background: linear-gradient(90deg, #fff 0 6px, transparent 6px calc(100% - 6px), #fff calc(100% - 6px)); }
.vthumb { position: absolute; left: 50%; width: 30px; margin-left: -15px; height: 30px; border-radius: 3px;
  background: repeating-linear-gradient(180deg, #2a2b2e 0 4px, #18191b 4px 6px); box-shadow: 0 3px 5px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.18); }
.vthumb::after { content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 3px; background: #e9eaec; }

.rcpanel button.sq { width: 40px; height: 38px; padding: 0; border-radius: 5px; border: 0; cursor: pointer;
  background: linear-gradient(180deg, #2a2b2e, #111214); box-shadow: 0 3px 0 #4a0a0d, 0 4px 6px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.12); }
.rcpanel button.sq:active:not(:disabled) { transform: translate(-50%, calc(-50% + 2px)); box-shadow: 0 1px 0 #4a0a0d, inset 0 1px 0 rgba(255,255,255,.08); }
.rcpanel button.sq:disabled { cursor: default; opacity: .4; filter: grayscale(1); }
.miclevel { opacity: .45; filter: grayscale(1); }
.rcpanel button.sq:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.lcdframe { width: 256px; height: 108px; border-radius: 6px; background: #0b0b0c; box-shadow: inset 0 0 0 2px #1d1d20, 0 1px 0 rgba(255,255,255,.2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.lcd { width: 172px; height: 58px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border-radius: 2px; color: #fff;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; box-shadow: inset 0 0 8px rgba(0,0,0,.35); transition: background .15s; }
.lcd.blue { background: #2b3cf0; } .lcd.red { background: #e3241f; } .lcd.green { background: #18b84b; }
.lcd.yellow { background: #e5b80b; } .lcd.white { background: #c9ccd2; color: #111; }
.lcdno { font: 800 38px/1 "Arial Black", Arial, sans-serif; letter-spacing: -1px; }
.lcdname { display: flex; flex-direction: column; font-size: 17px; font-weight: 700; line-height: 1.05; white-space: pre; }
.lcdinfo { display: flex; gap: 12px; font: 11px ui-monospace, Consolas, monospace; color: #8f9399; }

.knob { width: 78px; height: 78px; border-radius: 50%; cursor: ns-resize; touch-action: none; outline: none;
  background: radial-gradient(circle at 50% 55%, #0c0c0d 60%, #000 100%); box-shadow: 0 5px 8px rgba(0,0,0,.5), 0 0 0 3px rgba(0,0,0,.25); }
.knob:focus-visible { box-shadow: 0 0 0 3px #fff, 0 5px 8px rgba(0,0,0,.5); }
.knobcap { position: relative; width: 100%; height: 100%; border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #3a3b3e 0%, #1a1b1d 45%, #0b0b0c 75%); box-shadow: inset 0 2px 2px rgba(255,255,255,.12); }
.knobshine { position: absolute; inset: 8px; border-radius: 50%; background: radial-gradient(circle at 35% 25%, rgba(255,255,255,.16), transparent 50%); }
.miclevel { position: relative; width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #3a3b3e 0%, #1a1b1d 45%, #0b0b0c 75%); box-shadow: 0 5px 8px rgba(0,0,0,.5), inset 0 2px 2px rgba(255,255,255,.12); }
.micmark { position: absolute; left: 50%; top: 4px; width: 4px; height: 22px; margin-left: -2px; background: #fff; border-radius: 1px; }
.mtick { position: absolute; width: 3px; height: 14px; background: #fff; bottom: -12px; }
.mtick.l { left: 2px; transform: rotate(40deg); } .mtick.r { right: 2px; transform: rotate(-40deg); }

.fswwrap { width: 250px; height: 250px; }
.rcpanel button.fsw { position: relative; width: 100%; height: 100%; background: none; border: 0; padding: 0; cursor: pointer; touch-action: none;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; color: #fff; border-radius: 16px; }
.rcpanel button.fsw:focus-visible { outline: 2px dashed rgba(255,255,255,.6); }
.rcpanel button.fsw:disabled { cursor: not-allowed; opacity: 1; }
.rcpanel button.fsw:disabled .pill { opacity: .5; }
.fswlabel { white-space: pre; height: 62px; display: flex; align-items: flex-end; justify-content: center; text-align: center;
  font: 800 25px/1 "Helvetica Neue", Arial, sans-serif; letter-spacing: .3px; text-shadow: 0 1px 0 rgba(0,0,0,.18); }
.pill { width: 14px; height: 40px; border-radius: 7px; margin-top: 20px; background: #5b1013; box-shadow: inset 0 1px 3px rgba(0,0,0,.6); }
.pill.white { background: #fff; box-shadow: 0 0 12px rgba(255,255,255,.9); }
.pill.red { background: #ff2a2a; box-shadow: 0 0 12px #ff2a2a; }
.pill.green { background: #46ff8a; box-shadow: 0 0 12px #46ff8a; }
.pill.blue { background: #5f84ff; box-shadow: 0 0 12px #5f84ff; }
.pill.yellow { background: #ffe14a; box-shadow: 0 0 12px #ffe14a; }
/* Footswitch drawn like the one in Iridium Control: chrome nut ring, dark gap, brushed cap, shiny dome. */
.stomp { position: relative; margin-top: 22px; width: 88px; height: 88px; border-radius: 50%;
  background: radial-gradient(circle closest-side, #1c1d20 0 80%, transparent 81%),
    conic-gradient(#f2f2f2, #8c8f94, #e0e0e0, #6b6e73, #f2f2f2);
  box-shadow: 3px 6px 6px rgba(0,0,0,.45); }
.stomp::before, .stomp::after { content: ""; position: absolute; left: 50%; top: 50%; border-radius: 50%; transform: translate(-50%, -50%); transition: transform .05s; }
.stomp::before { width: 70%; height: 70%; background: conic-gradient(#bfc2c6, #f7f7f7, #7d8085, #ededed, #bfc2c6); }
.stomp::after { width: 52%; height: 52%; background: radial-gradient(circle at 35% 35%, #fdfdfd, #a9acb1 70%); box-shadow: 0 0 0 1px rgba(0,0,0,.18); }
.rcpanel button.fsw.down .stomp::before, .rcpanel button.fsw.down .stomp::after { transform: translate(-50%, -50%) scale(.9); }
.rcpanel button.fsw:disabled .stomp { opacity: .85; }
.tools button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.dnote { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; }
.dfuncs { display: grid; gap: 4px; margin: 8px 0; }
.dfunc { display: flex; align-items: center; gap: 8px; }
.dfunc .ccn { width: 44px; }
.info.warn { color: var(--danger); background: none; padding: 0; }
@media (max-width: 820px) { .keyhelp { display: none; } }

.clockstrip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; margin: 4px 0 10px; max-width: 1110px; }
.clockstrip.on { border-color: var(--accent); }
.clockstrip .clabel { font-weight: 600; margin-right: 4px; }
.clockstrip input { width: 80px; }
.clockstrip .note:last-child { flex-basis: 100%; }
.midilog .mark { color: var(--text); font-weight: 700; margin: 4px 0; }

/* Hold feedback on footswitches: a ring fills while you hold (2 s) */
@property --hold { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
.stomp .holdring { position: absolute; inset: -9px; border-radius: 50%; pointer-events: none; opacity: 0; z-index: 2;
  background: conic-gradient(#fff var(--hold), transparent var(--hold));
  -webkit-mask: radial-gradient(circle, transparent 0 62%, #000 63% 70%, transparent 71%); mask: radial-gradient(circle, transparent 0 62%, #000 63% 70%, transparent 71%); }
.rcpanel button.fsw.holding .holdring { opacity: 1; animation: holdfill 2s linear forwards; }
.rcpanel button.fsw.held .holdring { opacity: 1; --hold: 100%; background: #fff; }
@keyframes holdfill { from { --hold: 0%; } to { --hold: 100%; } }
.holdhint { margin-top: 12px; font: 600 13px/1 "Helvetica Neue", Arial, sans-serif; color: rgba(255,255,255,.75); letter-spacing: .5px; }
select.dim { opacity: .55; }
.row .warnnote { flex-basis: 100%; font-size: 12px; }

/* label above a full-width control (long option names) */
.row.stack { grid-template-columns: minmax(0, 1fr); gap: 3px; padding: 5px 0; }
.row.stack > label { color: var(--text); }
.brand .appicon { display: block; border-radius: 5px; }
@media (max-width: 819px) { .status .unsaved { display: none; } .brand .appicon { display: none; } }
.info.lead { max-width: 900px; margin: 0 0 12px; }

.rawhelp p { margin: 8px 0; font-size: 13px; color: var(--muted); max-width: 900px; }
.rawsec h4 small { color: var(--muted); font-weight: 400; }
.rawgrid label.chg span { color: var(--dirty); font-weight: 600; }
.rawgrid label.chg input { border-color: var(--dirty); }

.stored h3 { margin: 16px 0 4px; font-size: 15px; }
.rawgrid.ro .rawitem { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line, rgba(128,128,128,.2)); padding: 2px 0; }
.rawgrid.ro .rawitem b { color: var(--text); font-variant-numeric: tabular-nums; }
.modal:has(.stored) { max-width: min(920px, 96vw); }
.modal:has(.stored) .modal-body { max-height: 70vh; overflow: auto; }

/* Direct: the pedal is "off" until a real RC-500 is connected */
.rcwrap { position: relative; }
.rcpanel.off { filter: grayscale(1) brightness(.55) contrast(.9); pointer-events: none; }
/* Storage mode: still the red pedal, but dimmed like a button that can't be pressed. */
.rcpanel.dim { filter: saturate(.55) brightness(.62); opacity: .8; pointer-events: none; }
.rcpanel.off .lcd { background: #1a1d22 !important; color: transparent; }
.rcpanel.off .lcd * { visibility: hidden; }
.rcpanel.off .lcdinfo { visibility: hidden; }
.rcpanel.off .pill { background: #5b1013 !important; box-shadow: inset 0 1px 3px rgba(0,0,0,.6) !important; }
.rcpanel.off .led { background: #3a0c0e !important; box-shadow: none !important; }
.offlabel { position: absolute; left: 43%; top: 24%; transform: translate(-50%, -50%); padding: 10px 18px; border-radius: 99px;
  background: rgba(10, 12, 16, .85); color: #fff; font-weight: 600; font-size: 15px; white-space: nowrap; pointer-events: none; }

.loopcell button.playing { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.helpdl dt { font-weight: 700; margin-top: 10px; }
.helpdl dd { margin: 2px 0 0 0; color: var(--text); }

/* connection light: a USB plug, green when the pedal is connected */
.status .plug, .statuspop .plug { display: inline-flex; color: #8a9099; flex: none; }
.status .plug.ok, .statuspop .plug.ok { color: var(--ok); filter: drop-shadow(0 0 4px var(--ok)); }
.statuspop { width: min(330px, calc(100vw - 16px)); padding: 10px; }
.statuspop .srow { display: flex; gap: 10px; align-items: flex-start; padding: 6px 4px; }
.statuspop .srow b { display: block; }
.statuspop .srow small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.35; margin-top: 1px; }
.statuspop .sicon { width: 16px; text-align: center; flex: none; }
.statuspop .sicon.dirty { color: var(--dirty); }
.statuspop .sbtns { display: flex; gap: 8px; padding: 8px 4px 2px; }
.statuspop .sbtns button { background: var(--panel2); border: 1px solid var(--line); text-align: center; padding: 7px 14px; }
.statuspop .sbtns button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.lightsbar { margin: 6px 0 10px; }
.lightsbar .lbrow { display: flex; align-items: center; gap: 8px; }
.lightsbar .ib { width: 20px; height: 20px; padding: 0; border-radius: 50%; font: italic 700 12px/18px Georgia, serif; color: var(--muted); }
.lightsbar .lighthint { margin: 6px 0 0; background: var(--panel2); border-radius: 6px; padding: 8px 10px; max-width: 760px; }
