/* SPDX-License-Identifier: GPL-3.0-only */
/* The FM-1 Player: FM1VST's "Graphite" look (plugin/Look.h), Inter Tight (OFL 1.1). */
@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/InterTight-VF-latin.woff") format("woff");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --window: #0F1113; --surface: #1D2024; --raised: #23272C; --raised-hover: #2A2F35; --well: #141619;
  --border: #33383F; --line: #2E333A; --divider: #2B2F35; --seg-on: #2C3138;
  --text: #E8EAED; --row-text: #D6D9DD; --muted: #8A9099; --heading: #7D838C; --switch-off: #30353C; --knob-off: #9AA0A8;
  --green: #3DDC84; --amber: #F5A524; --red: #FF6464; --red-fill: #D9443F; --brand: #FF9A4D;
  --accent: #FF8A3D; --on-accent: #1A0E06; --accent-soft: rgba(255, 138, 61, .12);
  --backdrop: #0E0E10; --plate: #1C1C20;
  --head-h: 44px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--backdrop); color: var(--text); overflow: hidden;
  font: 500 14px/1.4 "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---- the header */
#top {
  height: var(--head-h); display: flex; align-items: center; gap: 10px; padding: 0 12px 0 10px;
  background: var(--window); border-bottom: 1px solid #1A1D21; position: relative; z-index: 3;
}
body.embed #top { display: none; }
.brand { display: flex; align-items: center; gap: 9px; background: none; border: 0; padding: 6px 8px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.brand:hover { background: var(--raised); }
.brand b { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.mark { width: 18px; height: 18px; border-radius: 5px; background: linear-gradient(135deg, #FFA45E, #E07A3C); box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); flex: none; }
.fw-pill {
  display: flex; align-items: center; gap: 7px; min-width: 0; background: var(--raised); border: 1px solid var(--line);
  border-radius: 8px; height: 30px; padding: 0 8px 0 11px; cursor: pointer;
}
.fw-pill:hover { background: var(--raised-hover); }
#fw-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#fw-ver { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.fw-pill svg, .ic { width: 14px; height: 14px; flex: none; }
.fw-pill svg { fill: none; stroke: var(--knob-off); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* the running firmware's source (main.js updateSource): next to the picker, an outlined pill; a file's: disabled */
.src-link {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 9px; border-radius: 8px; flex: none; white-space: nowrap;
  border: 1px solid rgba(255, 138, 61, .45); background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; text-decoration: none;
}
.src-link[hidden] { display: none; }
.src-link:hover { background: rgba(255, 138, 61, .2); border-color: var(--accent); }
.src-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.src-link svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.src-arrow { font-size: 12px; opacity: .85; margin-left: -1px; }
.src-link.off { border-color: var(--line); background: none; color: var(--muted); cursor: default; }
.src-link.off .src-arrow { display: none; }
/* the running firmware's own editor (js/editor-panel.js): a button beside Source, and its panel beside the FM-1 */
.ed-btn { cursor: pointer; font: inherit; font-weight: 600; font-size: 13px; }
.ed-btn svg circle { fill: currentColor; stroke: none; }
.ed-btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
:root { --ed-w: min(880px, 58vw); --ed-h: 60vh; }
body.ed-open #stage { width: calc(100% - var(--ed-w)); }
.ed-panel {
  position: fixed; top: var(--head-h); right: 0; bottom: 0; width: var(--ed-w); z-index: 4; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -10px 0 30px rgba(0,0,0,.35);
}
.ed-panel[hidden] { display: none; }
.ed-head { height: 44px; flex: none; display: flex; align-items: center; gap: 9px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--divider); min-width: 0; }
.ed-head b { font-size: 14px; white-space: nowrap; }
.ed-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.ed-src { color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; padding: 6px 6px; border-radius: 6px; }
.ed-src:hover { color: var(--text); background: var(--raised); }
.ed-src[hidden], .ed-pop[hidden] { display: none; }
.ed-pop { height: 28px; padding: 0 10px; flex: none; }
.ed-body { flex: 1; min-height: 0; display: flex; background: #fff; }
.ed-frame { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }
.ed-note { margin: auto; max-width: 440px; padding: 24px; color: var(--row-text); }
.ed-body:has(.ed-note) { background: var(--surface); }
.ed-note p { margin: 0 0 12px; font-size: 13px; line-height: 1.5; }
.ed-note .ed-lead { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.35; }
.ed-note .pill { padding: 0 14px; height: 36px; margin-top: 6px; }
@media (max-width: 900px) {
  body.ed-open #stage { width: auto; height: calc(100% - var(--head-h) - var(--ed-h)); }
  .ed-panel { top: auto; left: 0; width: auto; height: var(--ed-h); border-left: 0; border-top: 1px solid var(--border); box-shadow: 0 -10px 30px rgba(0,0,0,.35); }
}
/* ---- the recorder (js/rec-ui.js): a round record button, the elapsed time and a level meter while recording, Takes */
.rec { display: flex; align-items: center; gap: 6px; flex: none; }
.rec[hidden] { display: none; }
.rec-btn {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; cursor: pointer; padding: 0;
  background: var(--raised); border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.rec-btn:hover:not(:disabled) { background: var(--raised-hover); border-color: rgba(255,100,100,.45); }
.rec-btn:focus-visible, .takes-btn:focus-visible, .take-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.rec-btn:disabled { cursor: progress; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red-fill); box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); transition: border-radius .15s, transform .15s; }
.rec-btn.on { border-color: rgba(255,100,100,.6); background: rgba(255,100,100,.12); }
.rec-btn.on .rec-dot { background: var(--red); animation: rec-pulse 1.2s ease-in-out infinite; }
.rec-btn.count .rec-dot { background: var(--amber); animation: rec-pulse .5s ease-in-out infinite; }
@keyframes rec-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,100,100,.55); } 50% { box-shadow: 0 0 0 5px rgba(255,100,100,0); transform: scale(.82); } }
.rec-time { font: 700 13px/1 "Inter Tight", sans-serif; font-variant-numeric: tabular-nums; color: var(--red); min-width: 32px; }
.rec-time.count { color: var(--amber); min-width: 18px; }
.rec-time[hidden], .rec-meter[hidden], .takes-btn[hidden] { display: none; }
.rec-meter { display: grid; gap: 2px; width: 40px; flex: none; }
.rec-meter i { display: block; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--green) 0 var(--lvl, 0%), var(--switch-off) var(--lvl, 0%) 100%); }
.rec-meter i.hot { background: linear-gradient(90deg, var(--amber) 0 var(--lvl, 0%), var(--switch-off) var(--lvl, 0%) 100%); }
.rec-meter i.clip { background: var(--red); }
.takes-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px 0 10px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  background: var(--raised); border: 1px solid var(--line); color: var(--row-text); font-weight: 600; font-size: 13px;
}
.takes-btn:hover { background: var(--raised-hover); color: var(--text); }
.takes-btn[aria-expanded="true"] { border-color: rgba(255,100,100,.45); }
.takes-btn b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red-fill); color: #fff; font-size: 11px; display: grid; place-items: center; }
.takes-pop {
  position: fixed; z-index: 12; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.55); padding: 6px 0 4px; max-height: min(70vh, 520px); display: flex; flex-direction: column;
}
.takes-pop[hidden] { display: none; }
.takes-head { display: flex; align-items: center; gap: 8px; padding: 2px 6px 6px 14px; border-bottom: 1px solid var(--divider); }
.takes-head b { font-size: 14px; }
.takes-sub { color: var(--muted); font-size: 12px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.takes-list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; }
.take { padding: 9px 12px 10px 10px; border-bottom: 1px solid var(--divider); }
.take:last-child { border-bottom: 0; }
.take-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.take-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.take-name-in { height: 28px; font-size: 13px; }
.take-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 3px 0 8px 38px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.take-clips { color: var(--amber); }
.take-saved { color: var(--green); }
.take-acts { display: flex; gap: 6px; margin-left: 38px; }
.take-btn { cursor: pointer; }
.take-btn svg { width: 14px; height: 14px; flex: none; }
.take-btn.pill { height: 28px; padding: 0 10px; gap: 5px; font-size: 12.5px; }
.take-btn.ghost { margin-left: auto; width: 30px; height: 30px; border: 0; background: none; color: var(--knob-off); border-radius: 8px; display: grid; place-items: center; }
.take-btn.ghost:hover { background: var(--raised); color: var(--text); }
.take-btn.play { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; padding: 0;
  background: var(--raised); border: 1px solid var(--line); color: var(--text); }
.take-btn.play:hover { background: var(--raised-hover); }
.take.playing .take-btn.play { background: var(--red-fill); border-color: transparent; color: #fff; }
.takes-pop .pill.primary { background: var(--red-fill); color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* the page's volume (the sheet's PLAYING) */
.vol-wrap { display: flex; align-items: center; gap: 8px; }
.vol { width: 120px; accent-color: var(--accent); }
.vol-val { color: var(--muted); font-size: 12.5px; min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
#status { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
#status a { color: var(--row-text); font-weight: 600; text-decoration: none; }
#status a:hover { text-decoration: underline; }
#top nav { display: flex; gap: 4px; margin-left: auto; flex: none; }
#top nav a { color: var(--row-text); text-decoration: none; font-weight: 600; font-size: 13px; padding: 6px 10px; border-radius: 8px; }
#top nav a:hover { background: var(--raised); color: var(--text); }
#install-link { color: var(--accent) !important; }

/* ---- my FM-1: the status dot (grey off, amber pulsing busy, green on, red bad), the header button, its menu */
.fm1-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; background: #5A6068; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.fm1-dot.busy { background: var(--amber); box-shadow: 0 0 0 3px rgba(245,165,36,.16), 0 0 8px rgba(245,165,36,.6); }
.fm1-dot.busy.live { animation: fm1-pulse 1.1s ease-in-out infinite; }
.fm1-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(61,220,132,.16), 0 0 8px rgba(61,220,132,.55); }
.fm1-dot.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(255,100,100,.16), 0 0 8px rgba(255,100,100,.5); }
@keyframes fm1-pulse { 50% { opacity: .35; transform: scale(.8); } }
.fm1-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 11px 0 10px; border-radius: 8px; cursor: pointer;
  background: var(--raised); border: 1px solid var(--line); color: var(--row-text); font-weight: 600; font-size: 13px; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04); align-self: center;
}
.fm1-btn[hidden] { display: none; }
.fm1-btn:hover { background: var(--raised-hover); color: var(--text); }
.fm1-btn[data-tone="on"] { border-color: rgba(61,220,132,.35); color: var(--text); }
.fm1-btn[data-tone="bad"] { border-color: rgba(255,100,100,.4); }
.fm1-btn[data-tone="busy"] { border-color: rgba(245,165,36,.35); }
.fm1-via { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--green); background: rgba(61,220,132,.12); border-radius: 5px; padding: 2px 5px; }
.fm1-via[hidden] { display: none; }
.fm1-short { display: none; }
.fm1-menu {
  position: fixed; z-index: 12; width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.55); padding: 12px;
}
.fm1-menu[hidden] { display: none; }
.fm1-menu-line { display: flex; gap: 9px; align-items: baseline; color: var(--row-text); font-size: 13px; }
.fm1-menu-line .fm1-dot { transform: translateY(-1px); }
.fm1-menu-row { display: flex; gap: 8px; margin-top: 12px; }
.fm1-menu-row .pill { flex: 1; }
.remote-status .fm1-dot { margin-right: 8px; vertical-align: 1px; }

/* ---- the stage: the FM-1 edge to edge */
#stage { position: relative; height: calc(100% - var(--head-h)); outline: none; overflow: hidden; touch-action: none; }
body.embed #stage { height: 100%; }
#device-wrap, #screen-wrap { position: absolute; inset: 0; }
#device-wrap[hidden], #screen-wrap[hidden] { display: none; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
body.stacked #stage { display: flex; flex-direction: column; }
body.stacked #screen-wrap { position: relative; inset: auto; flex: none; }
body.stacked #device-wrap { position: relative; inset: auto; flex: 1; overflow-x: auto; overflow-y: hidden; overscroll-behavior: contain; touch-action: pan-x; scrollbar-width: thin; }
body.stacked #device { touch-action: pan-x; }

/* the corner button: fades in on movement or a first touch; opens the sheet */
#corner {
  position: absolute; z-index: 2; border-radius: 50%; border: 1px solid var(--line); background: rgba(35, 39, 44, .94);
  color: var(--row-text); display: grid; place-items: center; padding: 0; cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity .25s ease; box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
#corner .ic { width: 57%; height: 57%; }
#corner:hover { background: var(--raised-hover); color: var(--text); }
body.chrome #corner, #corner:focus-visible, body:not(.running) #corner { opacity: 1; pointer-events: auto; }
body.embed #corner, body.sheet-open #corner { display: none; }

/* the start overlay (the autoplay policy: sound needs a gesture) */
#start {
  position: absolute; left: var(--start-x, 50%); top: var(--start-y, 50%); transform: translate(-50%, -50%); z-index: 2; text-align: center;
  background: rgba(23, 26, 30, .9); border: 1px solid var(--border); border-radius: 16px; padding: 18px 22px 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.55); backdrop-filter: blur(6px); max-width: calc(100% - 32px);
}
#start[hidden] { display: none; }
#start-btn {
  display: inline-flex; align-items: center; gap: 10px; border: 0; border-radius: 12px; padding: 12px 20px; cursor: pointer;
  background: linear-gradient(135deg, #FFA45E, #E07A3C); color: #1A0E06; font-size: 17px; font-weight: 600;
}
#start-btn svg { width: 18px; height: 18px; fill: currentColor; }
#start-btn b { font-weight: 800; }
.start-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.start-row button { white-space: nowrap; }
.start-fm1 {
  display: inline-flex; align-items: center; gap: 9px; border-radius: 12px; padding: 0 18px; min-height: 48px; cursor: pointer;
  background: var(--raised); border: 1px solid var(--border); color: var(--text); font-size: 15px; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.start-fm1:hover:not(:disabled) { background: var(--raised-hover); }
.start-fm1:disabled { cursor: default; color: var(--row-text); }
.start-fm1[hidden] { display: none; }
#start p { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }
#start p.start-note { color: var(--row-text); font-size: 13px; }
#start p.start-note.on { color: var(--green); }
#start p.start-note.bad { color: var(--amber); max-width: 420px; margin-left: auto; margin-right: auto; }
#start p[hidden] { display: none; }
kbd { font: 600 11px/1 "Inter Tight", sans-serif; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; color: var(--row-text); background: var(--raised); }

.toast {
  position: absolute; left: 50%; bottom: 18px; transform: translate(-50%, 12px); z-index: 4; max-width: min(560px, calc(100% - 32px));
  background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 10px 14px;
  font-size: 13px; box-shadow: 0 8px 28px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(255, 100, 100, .45); }
.toast.ok { border-color: rgba(61, 220, 132, .45); }
/* a save from an older version, offered once (main.js offerCarry): above the toast, until answered */
.offer {
  position: absolute; left: 50%; bottom: 18px; transform: translate(-50%, 12px); z-index: 5; max-width: min(620px, calc(100% - 32px));
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
  background: var(--surface); border: 1px solid var(--accent, var(--border)); color: var(--text); border-radius: 12px; padding: 10px 12px 10px 16px;
  font-size: 13.5px; box-shadow: 0 8px 28px rgba(0,0,0,.5); opacity: 0; transition: opacity .2s, transform .2s;
}
.offer.show { opacity: 1; transform: translate(-50%, 0); }
.offer[hidden] { display: none; }
.offer .offer-btns { display: flex; gap: 6px; flex: none; }
.offer.show ~ .toast { bottom: 84px; }
.sheet .carry { border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; font-size: 13px; color: var(--row-text); }
.sheet .carry .pills { margin-top: 8px; }

/* ---- the sheet (FM1VST Sheet.cpp: 360 wide, the browser 620, About 400; slides in over a scrim) */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .18s ease-out; z-index: 10; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; top: 8px; right: 8px; bottom: 8px; width: min(360px, calc(100vw - 16px)); z-index: 11;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.55);
  display: flex; flex-direction: column; transform: translateX(calc(100% + 24px)); transition: transform .18s cubic-bezier(.33, 1, .68, 1), width .18s ease-out;
  outline: none; visibility: hidden;
}
.sheet.open { transform: none; visibility: visible; }
.sheet[data-page="firmware"] { width: min(620px, calc(100vw - 16px)); }
.sheet[data-page="about"] { width: min(400px, calc(100vw - 16px)); }
.sheet-head { height: 54px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 14px; border-bottom: 1px solid var(--divider); }
.sheet-head .brand { padding: 0; cursor: default; gap: 9px; }
.sheet-head .brand:hover { background: none; }
.sheet-head .brand b { font-size: 15.5px; }
.sheet-head .ver { color: var(--heading); font-size: 12px; font-weight: 600; }
.icon-btn { width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: none; color: var(--knob-off); border-radius: 8px; cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn .ic { width: 16px; height: 16px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 18px 18px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.heading { margin: 20px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--heading); display: flex; justify-content: space-between; }
.heading-val { letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 4px 0; }
.row-label { color: var(--row-text); font-size: 15px; min-width: 0; }
.row-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.note { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 6px 0 2px; }
.remote-status { margin: 10px 0 0; }
.remote-status.ok { color: var(--green); }
.remote-status.bad { color: var(--amber); }
.src-lines { margin-top: 10px; font-size: 13px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.src-lines a, .src-inline { font-weight: 600; text-decoration: none; }
.src-lines a:hover { text-decoration: underline; }
.links { margin-top: 12px; font-size: 13px; color: var(--muted); }
.links a { font-weight: 600; text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* firmware card (FM1VST FirmwareCard) */
.fw-card {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; padding: 10px 12px 10px 14px;
  background: var(--raised); border: 1px solid var(--line); border-radius: 10px;
}
.fw-card:hover { background: var(--raised-hover); }
.fw-card.slim { padding: 9px 12px; }
.fw-card .led { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 9px var(--accent); flex: none; align-self: flex-start; margin-top: 8px; }
.fw-text { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.fw-top { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.fw-top b { font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-top .muted { font-size: 13px; }
.fw-meta { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-meta.warn { color: var(--amber); }
.chev { color: var(--knob-off); display: grid; }
.ic-wrap { color: var(--knob-off); display: grid; }
.ic-wrap .ic { width: 16px; height: 16px; }

/* the saves' nav: ‹ name › */
.nav { display: flex; align-items: center; height: 44px; background: var(--raised); border: 1px solid var(--line); border-radius: 10px; }
.nav-arrow { width: 34px; height: 100%; border: 0; background: none; color: var(--knob-off); cursor: pointer; display: grid; place-items: center; border-radius: 10px; }
.nav-arrow:hover { color: var(--text); background: var(--raised-hover); }
.nav-mid { flex: 1; position: relative; min-width: 0; height: 100%; }
.nav-select {
  width: 100%; height: 100%; appearance: none; -webkit-appearance: none; background: none; border: 0; color: var(--text); cursor: pointer;
  font: 600 14.5px "Inter Tight", sans-serif; text-align: center; text-align-last: center; padding: 0 22px;
}
.nav-select option { background: var(--surface); color: var(--text); }
.nav-chev { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--knob-off); pointer-events: none; display: grid; }
.pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.pills.two { grid-template-columns: 1fr 1fr; }
.pill {
  height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--raised); color: var(--row-text);
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04); display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.pill:hover:not(:disabled) { background: var(--raised-hover); }
.pill:disabled { opacity: .4; cursor: default; }
.pill.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.pill.danger { color: var(--red); border-color: rgba(255,100,100,.35); }
.pill.danger-fill { background: var(--red-fill); border-color: transparent; color: #fff; }
.pill.ghost { background: none; border-color: transparent; color: var(--muted); box-shadow: none; }
.inline { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.inline .grow { flex: 1; color: var(--row-text); }
.inline .pill { padding: 0 12px; flex: none; }
.text, .select {
  height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--well); color: var(--text); padding: 0 10px;
  font: 500 14px "Inter Tight", sans-serif; min-width: 0;
}
.text { flex: 1; }
.text:focus, .select:focus { outline: none; border-color: var(--accent); }
.select { max-width: 170px; cursor: pointer; }

/* switch / segmented / stepper (FM1VST Look::drawSwitch, drawSegmented, drawStepper) */
.switch { width: 38px; height: 22px; border-radius: 11px; border: 0; background: var(--switch-off); position: relative; cursor: pointer; flex: none; padding: 0; }
.switch span { position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--knob-off); transition: left .15s ease, background .15s; }
.switch.on { background: var(--accent); }
.switch.on span { left: 19px; background: #fff; box-shadow: 0 .75px 0 rgba(0,0,0,.18); }
.switch:disabled { opacity: .4; }
.seg { display: flex; padding: 2px; background: var(--well); border: 1px solid var(--line); border-radius: 8px; flex: none; }
.seg button { border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 13px; padding: 6px 11px; border-radius: 6px; cursor: pointer; }
.seg button:hover:not(.on):not(:disabled) { background: var(--raised); color: var(--row-text); }
.seg button.on { background: var(--seg-on); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.seg button:disabled { opacity: .45; cursor: default; }
/* two engines at two versions (the native core behind the Hub): one per line, the latest first */
.seg.stack { flex-direction: column; width: 100%; margin: 0 0 8px; }
.seg.stack button { text-align: left; padding: 8px 11px; }
.seg.stack button small { font-weight: 500; opacity: .75; margin-left: 4px; }
/* the emulated CPU clock, one line of five; 360 and 480 (an overclock) in amber when picked */
.seg.wide { width: 100%; margin: 0 0 6px; }
.seg.wide button { flex: 1; padding: 6px 4px; }
.seg.wide button.oc.on { background: color-mix(in srgb, var(--seg-on) 55%, var(--amber, #F5B544)); }
.seg.wide button.dev:not(.on) { color: var(--row-text); }
/* under the six choices: the device's range (320, 360) and the overclock (480, 640) */
.mhz-scale { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0 4px; font-size: 10.5px; color: var(--muted); margin: 0 2px 6px; text-align: center; }
.mhz-scale span { border-top: 1px solid currentColor; padding-top: 3px; }
.mhz-scale .dev { grid-column: 3 / 5; color: var(--row-text); }
.mhz-scale .oc { grid-column: 5 / 7; color: var(--amber); }
/* the firmware browser's engine filter: All / Native / Emulated, above the category chips */
.seg.engine-filter { display: inline-flex; margin: 12px 0 0; }
.seg.engine-filter + .chips { margin-top: 8px; }
.stepper { display: flex; align-items: center; height: 32px; width: 118px; background: var(--well); border: 1px solid var(--line); border-radius: 8px; flex: none; }
.stepper button { width: 30px; height: 100%; border: 0; background: none; cursor: pointer; display: grid; place-items: center; border-radius: 6px; color: var(--knob-off); }
.stepper button:hover { color: var(--text); background: var(--raised); }
.stepper svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.stepper span { flex: 1; text-align: center; font-weight: 600; font-size: 13px; }

/* theme swatches (FM1VST Swatches: the base and the membrane, split on the diagonal) */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(0,0,0,.5); cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- the firmware browser */
.search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; background: var(--well); border: 1px solid var(--line); border-radius: 10px; margin-top: 14px; color: var(--knob-off); }
.search .ic { width: 16px; height: 16px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font: 500 15px "Inter Tight", sans-serif; }
.search input::placeholder { color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.chip { height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: var(--raised); color: #9EA4AD; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.chip:hover:not(.on) { background: var(--raised-hover); color: var(--text); }
.chip.on { background: var(--accent); color: var(--on-accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); gap: 8px; }
.card {
  position: relative; height: 58px; text-align: left; padding: 9px 12px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line);
  cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0;
}
.card:hover { background: var(--raised-hover); border-color: var(--border); }
.card.current { border: 2px solid var(--accent); padding: 8px 11px; background: color-mix(in srgb, var(--raised) 92%, var(--accent)); }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 0; }
.card-top b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-ver { color: var(--accent); font-size: 11px; font-weight: 600; white-space: nowrap; flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.card-meta { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta.split { display: flex; gap: 6px; }
.card-meta.split > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-note { flex: none; color: var(--knob-off, var(--muted)); font-size: 10.5px; font-weight: 600; }
.card-note.heavy { color: var(--amber, #F5B544); font-weight: 500; }
.card-badge { position: absolute; left: 5px; top: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--green); box-shadow: 0 0 5px var(--green); }
.cards { grid-auto-flow: row dense; }
.card.badged { grid-column: span 2; }
.card-top .card-tag { margin-right: auto; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.card.file { border-style: dashed; background: none; }
.card.file .card-ver { color: var(--knob-off); }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 14px 0; margin: 0; }

/* ---- About */
.about-what { color: var(--row-text); font-size: 13.5px; margin: 0 0 10px; }
.kv { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--divider); font-size: 13px; }
.kv .k { color: var(--muted); width: 92px; flex: none; }
.kv .v { color: var(--row-text); min-width: 0; overflow-wrap: anywhere; }
.kv a { text-decoration: none; }
.credits { white-space: pre-wrap; font: 500 11.5px/1.45 "Inter Tight", sans-serif; color: var(--muted); background: var(--well); border-radius: 8px; padding: 10px; max-height: 220px; overflow: auto; }
.credit-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.credit-list li { margin: 5px 0; }
.credit-list a { text-decoration: none; font-weight: 600; }

/* ---- small screens */
@media (max-width: 640px) {
  #top { gap: 6px; padding: 0 6px; }
  #top .brand b { display: none; }
  #status { display: none; }
  #top nav a:last-child, #top nav #vst-link, #install-link .long { display: none; }
  .src-link { width: 34px; padding: 0; justify-content: center; }
  .src-link .src-text, .src-link .src-arrow { display: none; }
  .ed-sub, .ed-src { display: none; }
  .ed-head { gap: 8px; }
  .ed-head b { flex: 1; overflow: hidden; text-overflow: ellipsis; }
  .src-link svg { width: 16px; height: 16px; }
  #top nav { gap: 2px; }
  #top nav a { padding: 6px 7px; }
  .fm1-btn { padding: 0 9px; gap: 6px; }
  .fm1-btn .fm1-label { display: none; }
  .fm1-btn .fm1-short { display: inline; }
  .rec { gap: 4px; }
  .takes-btn { padding: 0 6px; }
  .takes-btn .takes-label { display: none; }
  .rec-meter { width: 24px; }
  /* (room for the recorder: the version and Install go while there are takes; Source and Editor too while recording) */
  body.has-takes #install-link, body.recording #install-link, body.recording #fw-src, body.recording #ed-btn { display: none; }
}
@media (max-width: 430px) {
  body.has-takes #fw-ver, body.recording #fw-ver { display: none; }
  .sheet { top: 0; right: 0; bottom: 0; width: 100vw !important; border-radius: 0; border: 0; }
}
/* a phone on its side: the FM-1 takes the whole height; the settings are behind the corner button */
@media (max-height: 500px) and (orientation: landscape) {
  #top { display: none; }
  #stage { height: 100%; }
}
@media (prefers-reduced-motion: reduce) { .sheet, .scrim, #corner, .toast { transition: none; } .fm1-dot.busy.live, .rec-btn .rec-dot { animation: none !important; } }
