/* The closest free match to Eurostile Bold Extended is Michroma; a licensed
   Eurostile installed on the device wins automatically. */
@font-face {
  font-family: 'QT Wordmark';
  src: local('Eurostile Bold Extended'), local('Eurostile-BoldExtendedTwo'), local('Eurostile Extended'), local('Eurostile'),
       url('fonts/michroma.woff2') format('woff2');
  font-display: swap;
}

:root {
  --ink: #17171a;
  --ink-dim: #4c4c50;
  --engrave: rgba(255, 255, 255, .55);
  --plate-line: rgba(0, 0, 0, .28);
  --glass: #050b0b;
  --vfd: #5ff2d6;
  --vfd-soft: #8ef7e3;
  --vfd-dim: #2a8a7a;
  --vfd-grid: #17433c;
  --amber: #ffb547;
  --rec: #f2461c;
  --rec-deep: #a82a0c;
  --cream: #efe6d0;
  --print: #d8c8a2;
  --wood-edge: #1c0f08;
  --label: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --wordmark: 'QT Wordmark', 'Eurostile', 'Microgramma', 'Michroma', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
body {
  background: #120a06 url('textures/walnut.jpg') center / cover no-repeat;
  color: var(--ink);
  font: 600 10px/1.25 var(--label);
  letter-spacing: 0.05em;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: none;
  overflow: hidden;
}
button { font: inherit; color: inherit; letter-spacing: inherit; touch-action: manipulation; }
[hidden] { display: none !important; }

#unit {
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: env(safe-area-inset-top) max(9px, env(safe-area-inset-right)) max(9px, env(safe-area-inset-bottom)) max(9px, env(safe-area-inset-left));
  background: url('textures/patina.png') center top / 512px auto, url('textures/walnut.jpg') center / cover no-repeat;
  box-shadow: 0 0 30px rgba(0, 0, 0, .7);
}

/* --- walnut header -------------------------------------------------------- */
#brand { display: flex; align-items: center; gap: 8px; padding: 9px 3px 8px; }
.wordmark {
  flex: 1;
  min-width: 0;
  font-family: var(--wordmark);
  font-size: clamp(15px, 5vw, 21px);
  color: var(--print);
  -webkit-text-stroke: .4px currentColor;
  line-height: 1;
  white-space: nowrap;
  /* silk-screen paint rubbed thin: the wood shows through the letters */
  -webkit-mask: url('textures/print-wear.png') left center / 12em 3em;
  mask: url('textures/print-wear.png') left center / 12em 3em;
}
.head-btn {
  appearance: none;
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 3px;
  background: url('textures/patina.png') left top / 512px auto, url('textures/aluminium.jpg') center / 512px auto #b9ad93;
  background-blend-mode: normal, multiply;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 244, 220, .35), inset 0 -1px 0 rgba(0, 0, 0, .3);
  color: #2c2820;
  font-size: 10.5px;
  font-weight: 700;
}
#btnMore { background-position: 137px 61px, center; }
.head-btn:active { box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6); }

/* --- aluminium faceplate -------------------------------------------------- */
#plate {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas: 'display' 'tracks' 'deck' 'transport';
  gap: 8px;
  padding: 8px;
  border-radius: 4px;
  background: linear-gradient(rgba(128, 104, 66, .34), rgba(128, 104, 66, .05) 150px), url('textures/aluminium.jpg') center / 512px auto;
  box-shadow: 0 2px 7px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 -1px 0 rgba(0, 0, 0, .35);
}
#display { grid-area: display; }
#tracks { grid-area: tracks; }
#deck { grid-area: deck; }
#transport { grid-area: transport; }

/* --- fluorescent display -------------------------------------------------- */
#display {
  background: var(--glass);
  border-radius: 4px;
  padding: 8px 11px 8px;
  box-shadow: inset 0 2px 7px #000, 0 1px 0 var(--engrave), 0 0 0 1px rgba(0, 0, 0, .75);
  color: var(--vfd);
  text-shadow: 0 0 7px rgba(95, 242, 214, .6);
}
.vfd-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.vfd-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--vfd-dim); text-shadow: none; font-size: 10px; }
.vfd-status { font: 400 10px var(--wordmark); white-space: nowrap; }
.vfd-status.rec { color: var(--rec); text-shadow: 0 0 9px var(--rec); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.vfd-mid { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 5px; }
.vfd-time { display: flex; align-items: baseline; font: 400 clamp(22px, 7.4vw, 30px)/1 var(--wordmark); }
.vfd-time .cell { display: inline-block; width: 0.98em; text-align: center; }
.vfd-time .punct { display: inline-block; width: .42em; text-align: center; }
.vfd-time .sign { display: inline-block; min-width: 0; }
.vfd-levels { flex: 1; max-width: 42%; display: flex; flex-direction: column; gap: 5px; }
.vfd-levels > div { display: flex; align-items: center; gap: 5px; }
.vfd-levels small { font-size: 8px; color: var(--vfd-dim); text-shadow: none; }
.vfd-bar {
  flex: 1;
  height: 7px;
  overflow: hidden;
  background: repeating-linear-gradient(90deg, #0d2622 0 4px, transparent 4px 6px);
}
.vfd-bar i {
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: repeating-linear-gradient(90deg, var(--vfd) 0 4px, transparent 4px 6px);
  box-shadow: 0 0 6px rgba(95, 242, 214, .55);
}
.vfd-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
.vfd-hint { color: var(--vfd-soft); font-size: 10.5px; line-height: 1.2; text-shadow: 0 0 5px rgba(95, 242, 214, .4); }
.vfd-undo {
  appearance: none;
  flex: none;
  min-height: 26px;
  padding: 0 8px;
  background: transparent;
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 3px;
  font-size: 9.5px;
}

/* --- track rows ------------------------------------------------------------ */
#tracks { display: grid; grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 6px; min-height: 0; }
.track { display: grid; grid-template-columns: 46px minmax(0, 1fr) 54px; gap: 7px; align-items: center; min-height: 0; }

.arm {
  appearance: none;
  width: 44px;
  height: 44px;
  justify-self: center;
  border: 0;
  border-radius: 50%;
  font: 400 15px var(--wordmark);
  color: var(--cream);
  background: radial-gradient(circle at 40% 30%, #3f3f44, #17171a 72%);
  box-shadow: 0 0 0 2px #8d8d88, 0 0 0 3px rgba(0, 0, 0, .55), 0 2px 4px 2px rgba(0, 0, 0, .35);
  transition: box-shadow .1s, background .1s;
}
.arm { position: relative; padding-top: 7px; }
.arm::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 7px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--rec);
}
.arm.on::before { background: #fff; box-shadow: 0 0 5px #fff; }
.arm:active { transform: scale(.96); }
.arm.on {
  color: #fff;
  background: radial-gradient(circle at 40% 30%, #ff7a4d, var(--rec) 55%, var(--rec-deep));
  box-shadow: 0 0 0 2px #8d8d88, 0 0 0 3px rgba(0, 0, 0, .55), 0 0 15px 3px rgba(242, 70, 28, .75);
}

.lane {
  position: relative;
  height: 100%;
  min-height: 34px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--glass);
  box-shadow: inset 0 1px 5px #000, 0 1px 0 var(--engrave), 0 0 0 1px rgba(0, 0, 0, .7);
  touch-action: none;
  cursor: pointer;
}
.lane canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.playhead { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--cream); box-shadow: 0 0 4px var(--cream); pointer-events: none; }
.lane-meter {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--vfd);
  transform: scaleY(0);
  transform-origin: bottom;
  box-shadow: 0 0 5px var(--vfd);
}
.lane-meter.over { background: var(--rec); box-shadow: 0 0 6px var(--rec); }
.lane-empty, .lane-edit { position: absolute; pointer-events: none; font-size: 9px; }
.lane-empty { left: 11px; top: 50%; transform: translateY(-50%); color: var(--vfd-dim); }
.lane-edit { right: 5px; top: 4px; padding: 1px 4px; color: var(--vfd-soft); background: rgba(5, 11, 11, .75); border: 1px solid var(--vfd-grid); border-radius: 2px; font-size: 8px; }

/* --- knobs: machined aluminium ---------------------------------------------- */
.knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  touch-action: none;
  cursor: ns-resize;
  outline: none;
  min-width: 0;
}
.knob .cap {
  position: relative;
  width: var(--size, 38px);
  height: var(--size, 38px);
  border-radius: 50%;
  background: repeating-conic-gradient(#3c3c3e 0 3deg, #17171a 3deg 6deg);
  box-shadow: 0 3px 5px rgba(0, 0, 0, .55), 0 1px 1px rgba(0, 0, 0, .6);
}
.knob .cap::before {
  content: '';
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: conic-gradient(from 30deg, #f6f6f3, #a9a9a6, #ecece8, #8f8f8c, #f6f6f3, #a9a9a6, #ecece8, #8f8f8c, #f6f6f3);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3), inset 0 1px 1px rgba(255, 255, 255, .85);
}
.knob .ptr { position: absolute; inset: 0; will-change: transform; }
.knob .ptr::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 11%;
  width: 2px;
  height: 30%;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--ink);
}
.knob.large .ptr::after { width: 3px; margin-left: -1.5px; background: var(--rec); }
.knob .ring { display: none; }
.knob small { font-size: 8.5px; font-weight: 700; color: var(--ink); white-space: nowrap; text-shadow: 0 1px 0 var(--engrave); font-variant-numeric: tabular-nums; }
.knob.active small { color: var(--rec-deep); }
.knob:focus-visible .cap { outline: 2px solid var(--rec); outline-offset: 2px; }

/* --- deck ------------------------------------------------------------------- */
#deck {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 4px 2px;
  border-top: 1px solid var(--plate-line);
  box-shadow: inset 0 1px 0 var(--engrave);
}
.pitch-window {
  background: var(--glass);
  border-radius: 3px;
  padding: 7px 6px;
  text-align: center;
  box-shadow: inset 0 1px 5px #000, 0 1px 0 var(--engrave), 0 0 0 1px rgba(0, 0, 0, .7);
  min-width: 0;
}
.pitch-val { font: 400 clamp(13px, 4.2vw, 17px)/1.1 var(--wordmark); color: var(--vfd); text-shadow: 0 0 7px rgba(95, 242, 214, .55); white-space: nowrap; }
.pitch-val .pct { margin-left: 3px; font: 700 .85em var(--label); }
.pitch-sub { margin-top: 3px; font-size: 8.5px; color: var(--vfd-dim); white-space: nowrap; }

/* --- transport --------------------------------------------------------------- */
#transport { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.key {
  appearance: none;
  height: clamp(50px, 8.2dvh, 64px);
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, #303034, #17171a);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 8.5px;
  box-shadow: 0 2px 3px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .17);
}
.key svg { width: 19px; height: 15px; }
.key:active, .key.dn { transform: translateY(1px); background: linear-gradient(180deg, #111113, #232327); box-shadow: inset 0 2px 4px #000; color: var(--vfd); }
.key.dn svg { filter: drop-shadow(0 0 4px var(--vfd)); }
.key.rec { color: #fff; background: linear-gradient(180deg, #f6562b, #c63410); }
.key.rec:active, .key.rec.dn { color: #fff; background: linear-gradient(180deg, #a02608, #cf3a13); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .7), 0 0 14px rgba(242, 70, 28, .8); }
.key.rec.dn svg { filter: none; }

/* --- metal switches, in sheets and the editor ---------------------------------- */
.sw {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  min-height: 40px;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, #f1f1ec, #c6c6c0);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .55), inset 0 1px 0 #fff;
}
.sw:active { transform: translateY(1px); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5); }
.sw.on { background: linear-gradient(180deg, #17171a, #2a2a2e); color: var(--vfd); box-shadow: inset 0 2px 3px #000; text-shadow: 0 0 5px rgba(95, 242, 214, .5); }
.sw.primary { background: linear-gradient(180deg, #f6562b, #c63410); color: #fff; }
.sw.danger { color: var(--rec-deep); }
.sw[disabled] { opacity: .4; }

.seg { display: flex; flex: 1 1 0; min-width: 0; }
.seg .sw { flex: 1 1 0; min-width: 0; border-radius: 0; margin-left: 1px; }
.seg .sw:first-child { border-radius: 3px 0 0 3px; margin-left: 0; }
.seg .sw:last-child { border-radius: 0 3px 3px 0; }

/* --- power ------------------------------------------------------------------- */
#powerUp {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  background: url('textures/patina.png') center / 512px auto, url('textures/walnut.jpg') center / cover no-repeat;
}
.wordmark.big { flex: none; font-size: clamp(25px, 8.5vw, 38px); }
#powerBtn {
  appearance: none;
  width: 96px;
  height: 96px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(from 30deg, #f6f6f3, #a9a9a6, #ecece8, #8f8f8c, #f6f6f3, #a9a9a6, #ecece8, #8f8f8c, #f6f6f3);
  box-shadow: 0 0 0 5px #17171a, 0 0 0 6px rgba(255, 255, 255, .2), 0 8px 22px rgba(0, 0, 0, .8);
}
#powerBtn:active { transform: scale(.97); }
#powerBtn span { position: relative; width: 28px; height: 28px; border: 3.5px solid var(--rec); border-radius: 50%; }
#powerBtn span::after { content: ''; position: absolute; left: 50%; top: -9px; width: 8px; height: 17px; margin-left: -4px; background: linear-gradient(90deg, #d4d4d0, #d4d4d0) center / 100% 100%; }
#powerBtn span::before { content: ''; position: absolute; z-index: 1; left: 50%; top: -9px; width: 3.5px; height: 15px; margin-left: -1.75px; background: var(--rec); border-radius: 2px; }
#powerUp .hint { margin: 0; color: var(--cream); font-size: 11px; letter-spacing: .2em; text-shadow: 0 1px 2px #000; }
#powerUp .error { max-width: 320px; margin: 0; color: #ffc9a3; font: 500 13px/1.4 var(--label); letter-spacing: 0; -webkit-user-select: text; user-select: text; }

#toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 50px);
  transform: translate(-50%, -8px);
  width: max-content;
  max-width: 90vw;
  padding: 8px 12px;
  border-radius: 3px;
  background: var(--glass);
  color: var(--amber);
  box-shadow: 0 0 0 1px #5f4a1c, 0 6px 18px rgba(0, 0, 0, .7);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --- sheets ------------------------------------------------------------------- */
dialog#sheet {
  width: min(96vw, 520px);
  max-height: 92dvh;
  padding: 13px;
  overflow-y: auto;
  border: 0;
  border-radius: 6px;
  background: url('textures/aluminium.jpg') center / 512px auto;
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .85), inset 0 1px 0 rgba(255, 255, 255, .8);
}
dialog#sheet::backdrop { background: rgba(8, 4, 2, .72); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sheet-head .sw { width: auto; padding: 0 16px; flex: none; }
.sheet-title { margin: 0 0 10px; font: 400 14px var(--wordmark); -webkit-text-stroke: .3px currentColor; }
.sheet-head .sheet-title { margin: 0; }
.sheet-text { margin: 0 0 12px; font: 500 14px/1.4 var(--label); letter-spacing: 0; }
.sheet-actions { display: flex; gap: 8px; margin-top: 12px; }
.sheet-stack { display: flex; flex-direction: column; gap: 7px; }
.more-tabs { display: flex; margin-bottom: 4px; }
.sheet-input {
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 3px;
  background: var(--glass);
  color: var(--vfd);
  box-shadow: inset 0 1px 4px #000;
  font: 500 17px var(--label);
  -webkit-user-select: text;
  user-select: text;
}
.section { padding: 11px 1px; border-top: 1px solid var(--plate-line); box-shadow: inset 0 1px 0 var(--engrave); }
.section:first-child { border-top: 0; box-shadow: none; }
.section h3 { margin: 0 0 8px; font-size: 10.5px; font-weight: 700; text-shadow: 0 1px 0 var(--engrave); }
.row { display: flex; align-items: center; gap: 6px; }
.row .sw, .row label.sw { flex: 1 1 0; width: auto; min-width: 0; cursor: pointer; }
.row .knob { flex: none; }
.row + .row { margin-top: 7px; }
.note { margin: 8px 0 0; color: var(--ink-dim); font: 500 12px/1.4 var(--label); letter-spacing: 0; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }
.time { flex: none; min-width: 58px; text-align: center; font: 700 13px var(--label); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.tag { flex: none; min-width: 28px; font-weight: 700; font-size: 10.5px; }
.locator { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.locator .sw { flex: 1 1 0; width: auto; }
.knob-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 4px; }
.eq { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px 2px; justify-items: center; }
.col-head { font-size: 9.5px; font-weight: 700; }
.tape-item { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; }
.tape-item .card {
  appearance: none;
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 6px 10px;
  border: 0;
  border-radius: 3px;
  text-align: left;
  color: var(--vfd);
  background: var(--glass);
  box-shadow: inset 0 1px 4px #000;
}
.tape-item .card b { display: block; overflow: hidden; font: 700 13px var(--label); letter-spacing: 0; white-space: nowrap; text-overflow: ellipsis; }
.tape-item .card span { color: var(--vfd-dim); font-size: 9.5px; }
.tape-item .card.current { box-shadow: inset 0 1px 4px #000, 0 0 0 2px var(--rec); }
.tape-item .sw { flex: none; width: 62px; min-height: 46px; font-size: 9px; }

/* --- waveform editor ------------------------------------------------------------ */
.editor {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto auto minmax(90px, 1fr) auto auto auto;
  gap: 7px;
  padding: calc(env(safe-area-inset-top) + 8px) max(9px, env(safe-area-inset-right)) max(9px, env(safe-area-inset-bottom)) max(9px, env(safe-area-inset-left));
  background: url('textures/aluminium.jpg') center / 512px auto;
}
.ed-bar { display: grid; grid-template-columns: minmax(0, 1fr) 66px 66px; gap: 6px; }
.ed-tracks .seg { flex: 1; }
.ed-tracks { display: flex; }
.ed-read { min-height: 14px; font-size: 10.5px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 0 var(--engrave); letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-stage { position: relative; min-height: 0; overflow: hidden; border-radius: 4px; background: var(--glass); box-shadow: inset 0 2px 7px #000, 0 1px 0 var(--engrave), 0 0 0 1px rgba(0, 0, 0, .75); }
.ed-wave { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.ed-head { position: absolute; top: 0; bottom: 0; left: 0; width: 1px; background: var(--cream); box-shadow: 0 0 4px var(--cream); pointer-events: none; }
.ed-mini-wrap { position: relative; height: 38px; overflow: hidden; border-radius: 3px; background: var(--glass); box-shadow: inset 0 1px 4px #000, 0 0 0 1px rgba(0, 0, 0, .7); touch-action: none; }
.ed-mini { position: absolute; inset: 0; width: 100%; height: 100%; }
.ed-window { position: absolute; top: 0; bottom: 0; min-width: 8px; background: rgba(239, 230, 208, .17); border-left: 1px solid var(--cream); border-right: 1px solid var(--cream); pointer-events: none; }
.ed-tools { display: grid; grid-template-columns: 44px 44px 50px minmax(0, 1fr); gap: 5px; }
.ed-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.ed-play { background: linear-gradient(180deg, #303034, #17171a); color: var(--vfd); box-shadow: 0 1px 2px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .17); }

/* --- phone on its side ------------------------------------------------------------ */
@media (orientation: landscape) and (max-height: 520px) {
  #unit { max-width: none; }
  #brand { padding: 4px 3px; }
  .head-btn { min-height: 26px; }
  #plate {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto;
    grid-template-areas: 'display tracks' 'deck tracks' 'transport tracks';
    gap: 5px 9px;
    padding: 5px 7px;
  }
  #display { padding: 4px 9px; display: flex; flex-direction: column; justify-content: center; }
  .vfd-time { font-size: 19px; }
  .vfd-mid { margin: 1px 0; }
  .vfd-foot { min-height: 18px; }
  .vfd-hint { font-size: 9.5px; }
  #deck { padding: 2px 4px 0; border: 0; box-shadow: none; }
  #deck .knob { --size: 42px !important; }
  #deck .knob .cap { width: 42px; height: 42px; }
  .key { height: 38px; }
  .key svg { width: 15px; height: 12px; }
  .key span { display: none; }
  .arm { width: 36px; height: 36px; }
  .track { grid-template-columns: 40px minmax(0, 1fr) 50px; }
  .track .knob small { display: none; }
  .track .knob .cap { width: 34px; height: 34px; }
  .editor { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; padding-top: 5px; gap: 5px 8px; }
  .ed-bar { grid-column: 1 / 3; }
  .ed-read { grid-column: 1 / 3; min-height: 0; }
  .ed-stage { grid-column: 1; grid-row: 3; }
  .ed-mini-wrap { grid-column: 1; grid-row: 4; height: 28px; }
  .ed-tools { grid-column: 2; grid-row: 3; align-self: start; grid-template-columns: 1fr 1fr 1fr; }
  .ed-tools .ed-play { grid-column: 1 / 4; }
  .ed-grid { grid-column: 2; grid-row: 3 / 5; align-self: end; }
  .ed-grid .sw, .ed-tools .sw, .ed-bar .sw { min-height: 30px; font-size: 9px; }
}

/* --- short phones with the browser's bars showing ----------------------------------- */
@media (orientation: portrait) and (max-height: 640px) {
  #brand { padding: 5px 3px; }
  .head-btn { min-height: 28px; }
  #plate { gap: 5px; padding: 6px; }
  #display { padding: 5px 9px; }
  .vfd-mid { margin: 1px 0 2px; }
  .arm { width: 38px; height: 38px; }
  .track .knob small { display: none; }
  .track .knob .cap { width: 36px; height: 36px; }
  #deck .knob .cap { width: 48px; height: 48px; }
  .ed-grid .sw { min-height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .vfd-status.rec { animation: none; }
}
