:root {
  --bar: #0b0b0c;
  --line: #2a2a2d;
  --ink: #e8e6e1;
  --dim: #8b8985;
  --accent: #f2a33a;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --top: 48px;
  --bottom: 44px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #111; color: var(--ink); font: 12px/1.4 var(--mono); -webkit-font-smoothing: antialiased; }
#stage { position: fixed; inset: var(--top) 0 var(--bottom) 0; }
#view { width: 100%; height: 100%; display: block; touch-action: none; outline: none; -webkit-user-select: none; user-select: none; }

.bar { position: fixed; left: 0; right: 0; background: var(--bar); display: flex; align-items: center; z-index: 5; }
.bar.top { top: 0; height: var(--top); padding: 0 12px; gap: 12px; justify-content: space-between; }
.bar.top .left, .bar.top .right { display: flex; align-items: center; gap: 10px; flex: 1 1 0; min-width: 0; }
.bar.top .right { justify-content: flex-end; }
.bar.bottom { bottom: 0; height: calc(var(--bottom) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
.bar.bottom button { flex: 1; height: var(--bottom); border: 0; background: #1b1b1d; color: var(--ink); font: inherit; letter-spacing: .04em; cursor: pointer; }
.bar.bottom button:nth-child(2) { background: #232325; }
.bar.bottom button:nth-child(3) { background: #2b2b2e; }
.bar.bottom button:nth-child(4) { background: #343437; }
.bar.bottom button:nth-child(5) { background: #3d3d41; }
.bar.bottom button:nth-child(6) { background: #47474b; }
.bar.bottom button.on { background: var(--ink); color: #111; }

.btn { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px; background: #131314; color: var(--ink); font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn:hover { border-color: #55555a; }
.btn .dim, .dim { color: var(--dim); }
.picker { min-width: 0; max-width: 46vw; }
.picker #fw-name { overflow: hidden; text-overflow: ellipsis; }
.led { width: 7px; height: 7px; border-radius: 50%; background: #3a3a3d; }
.on-air .led { background: #62d36e; box-shadow: 0 0 8px #62d36e; }
.status { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.warn { color: var(--accent); }
.status.bad { color: #ff6b5e; }

.hint { position: fixed; left: 50%; bottom: calc(var(--bottom) + 22px); transform: translateX(-50%); padding: 7px 12px; background: rgba(11, 11, 12, .82); border-radius: 3px; pointer-events: none; z-index: 4; transition: opacity .4s; white-space: nowrap; }
.hint.gone { opacity: 0; }

.panel { position: fixed; top: calc(var(--top) + 10px); right: 10px; width: min(340px, calc(100vw - 20px)); max-height: calc(100vh - var(--top) - var(--bottom) - 20px); background: rgba(13, 13, 14, .96); border: 1px solid var(--line); border-radius: 4px; z-index: 6; display: flex; flex-direction: column; overflow: hidden; }
.panel[hidden] { display: none; }
.panel.wide { left: 50%; right: auto; transform: translateX(-50%); width: min(520px, calc(100vw - 20px)); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
.panel-head strong { flex: 1; font-weight: 500; letter-spacing: .04em; }
.panel-head input[type=search] { flex: 1; min-width: 0; height: 28px; padding: 0 8px; background: #19191b; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); font: inherit; outline: none; }
.panel-head input[type=search]:focus { border-color: var(--accent); }
.btn.close { padding: 0 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; border-bottom: 1px solid #1c1c1e; }
.row select { height: 28px; background: #19191b; color: var(--ink); border: 1px solid var(--line); border-radius: 3px; font: inherit; padding: 0 6px; }
.foot { margin: 0; padding: 10px; color: var(--dim); font-size: 11px; }
.foot a { color: var(--ink); }
.swatches { display: flex; gap: 8px; }
.swatches button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #111; outline: 1px solid var(--line); cursor: pointer; padding: 0; }
.swatches button.on { outline: 2px solid var(--ink); }

#fw-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
#fw-list li { padding: 9px 10px; border-bottom: 1px solid #1c1c1e; cursor: pointer; }
#fw-list li:hover, #fw-list li.on { background: #1d1d20; }
#fw-list li.on .name::before { content: "● "; color: #62d36e; }
#fw-list .name { color: var(--ink); }
#fw-list .ver, #fw-list .by { color: var(--dim); }
#fw-list .about { color: var(--dim); font-size: 11px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.keys { border-collapse: collapse; width: 100%; }
.keys th { text-align: left; font-weight: 500; color: var(--dim); padding: 10px 10px 4px; letter-spacing: .04em; }
.keys td { padding: 4px 10px; vertical-align: top; }
.keys td:first-child { white-space: nowrap; }
kbd { display: inline-block; min-width: 18px; padding: 1px 4px; border: 1px solid #3a3a3e; border-bottom-width: 2px; border-radius: 3px; background: #1b1b1d; font: inherit; text-align: center; }
#help-panel { overflow-y: auto; }

@media (max-width: 640px) {
  .status { display: none; }
  .status.warn, .status.bad { display: block; position: fixed; top: calc(var(--top) + 8px); left: 8px; right: 8px; padding: 6px 10px; background: rgba(11, 11, 12, .85); border-radius: 3px; z-index: 4; text-align: center; }
  .picker .dim { display: none; }
  .bar.bottom button { font-size: 11px; }
}

/* the player view: the synth alone, nothing else on screen but the way out */
.bar.bottom button:nth-child(7) { background: var(--accent); color: #111; }
#player-exit { display: none; position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: calc(env(safe-area-inset-left) + 8px); z-index: 7; background: rgba(11, 11, 12, .55); border-color: rgba(255, 255, 255, .18); opacity: .7; }
body.player #player-exit { display: inline-flex; }
body.player .bar, body.player .hint { display: none; }
body.player #stage { inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
body.player { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
