:root {
  color-scheme: dark;
  --ink: #0f1320;
  --desk: #171c2c;
  --rail: #232a3f;
  --rail-hi: #323b57;
  --paper: #ece6d8;
  --dim: #9aa3b8;
  --amber: #f2b33d;
  --tally: #ff4d3d;
  --ok: #57d39b;
  --warn: #f2b33d;
  --font-display: 'Bricolage Grotesque', 'Be Vietnam Pro', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Be Vietnam Pro', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, 'Courier New', monospace;
  --r: 6px;
  --gutter: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--paper);
  font: 400 15px/1.5 var(--font-body);
  overflow-x: hidden;
}

h1,
h2,
p,
ul,
dl,
dd {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.display {
  font: 700 clamp(44px, 9vw, 76px) / 1 var(--font-display);
  letter-spacing: -0.02em;
}

.display.small {
  font-size: clamp(28px, 5vw, 40px);
}

.engraved {
  display: block;
  font: 600 11px/1.2 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

.fine {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--dim);
}

.status {
  font-size: 13px;
  color: var(--dim);
  min-height: 1.3em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ic {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ---------- frame ---------- */

#tally-line {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  background: transparent;
  z-index: 60;
  transition: background-color 0.25s;
}

body[data-rec='recording'] #tally-line {
  background: var(--tally);
}

body[data-rec='paused'] #tally-line {
  background: rgba(255, 77, 61, 0.38);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 12px var(--gutter) 10px;
  border-bottom: 1px solid var(--rail);
  /* stays above the power overlay so the library is reachable while the studio is off */
  position: relative;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.brand-name {
  font: 700 24px/1 var(--font-display);
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 13px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46vw;
}

.nav {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.nav-btn {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  min-height: 40px;
  color: var(--dim);
  font-weight: 500;
  cursor: pointer;
}

.nav-btn:hover:not(:disabled) {
  color: var(--paper);
}

.nav-btn[aria-current='page'] {
  color: var(--paper);
  border-bottom-color: var(--amber);
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.onair {
  font: 600 11px/1 var(--font-mono);
  letter-spacing: 0.16em;
  color: var(--tally);
  min-width: 0;
}

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px var(--gutter);
  background: var(--rail);
  border-bottom: 1px solid var(--amber);
  color: var(--paper);
  font-size: 14px;
}

.screen {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  min-width: 0;
}

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  background: var(--rail);
  border: 1px solid var(--rail-hi);
  border-radius: var(--r);
  color: var(--paper);
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 2px 0 #0a0d16;
  transition: transform 0.06s, box-shadow 0.06s, background-color 0.12s;
  text-align: center;
}

.btn:hover:not(:disabled) {
  background: var(--rail-hi);
}

.btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 0 0 #0a0d16;
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #17120a;
  font-weight: 600;
}

.btn.primary:hover:not(:disabled) {
  background: #ffc452;
}

.btn.primary.attn {
  outline: 2px dashed var(--paper);
  outline-offset: 2px;
}

.btn.live {
  border-color: var(--amber);
  color: var(--amber);
}

.btn.danger {
  background: var(--tally);
  border-color: var(--tally);
  color: #1c0906;
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
  box-shadow: none;
}

.btn.small {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 13px;
}

.btn.big {
  min-height: 54px;
  padding: 12px 26px;
  font-size: 17px;
}

.btn.icon {
  width: 48px;
  min-height: 48px;
  padding: 0;
}

.btn kbd,
.pad kbd {
  font: 600 11px/1 var(--font-mono);
  padding: 3px 5px;
  border: 1px solid currentColor;
  border-radius: 3px;
  opacity: 0.65;
}

.link {
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--amber);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  align-self: flex-start;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row.center {
  justify-content: center;
}

.grow {
  flex: 1 1 180px;
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

input[type='text'],
input[type='number'],
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  background: var(--ink);
  border: 1px solid var(--rail-hi);
  border-radius: var(--r);
  color: var(--paper);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: #6b7389;
}

input[type='range'] {
  width: 100%;
  min-width: 0;
  height: 28px;
  margin: 0;
  accent-color: var(--amber);
  background: transparent;
}

input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
  accent-color: var(--amber);
}

.slider {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 62px;
  align-items: center;
  gap: 10px;
}

.slider output {
  white-space: nowrap;
  text-align: right;
  font-size: 12.5px;
  color: var(--paper);
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  cursor: pointer;
  font-size: 14px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chip {
  min-height: 34px;
  padding: 5px 11px;
  background: transparent;
  border: 1px solid var(--rail-hi);
  border-radius: var(--r);
  color: var(--paper);
  font-size: 13.5px;
  cursor: pointer;
}

.chip:hover {
  background: var(--rail);
}

.chip[aria-pressed='true'] {
  background: var(--amber);
  border-color: var(--amber);
  color: #17120a;
  font-weight: 600;
}

progress {
  flex: 1 1 120px;
  min-width: 0;
  height: 8px;
  accent-color: var(--amber);
}

/* ---------- welcome ---------- */

.welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px var(--gutter);
}

.welcome-card {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.lede {
  font-size: 16px;
  color: var(--dim);
}

/* ---------- studio desk ---------- */

.studio {
  display: flex;
  flex-direction: column;
}

.desk {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 0.95fr);
  flex: 1;
}

.strip {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px 22px;
  min-width: 0;
}

.strip + .strip {
  border-left: 1px solid var(--rail);
}

.strip-title {
  font-size: 12px;
  color: var(--paper);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rail);
}

.meter-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meter-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meter-head .mono {
  margin-left: auto;
  font-size: 13px;
}

.clip-led {
  font: 600 10px/1 var(--font-mono);
  letter-spacing: 0.1em;
  padding: 4px 6px;
  border: 1px solid var(--rail-hi);
  border-radius: 3px;
  color: #5a6278;
}

.clip-led.on {
  background: var(--tally);
  border-color: var(--tally);
  color: #1c0906;
}

/* zone colours follow the coach text: below -18 too low, -18..-6 good, -6..-3 hot, above -3 clipping */
.meter {
  position: relative;
  height: 30px;
  border: 1px solid var(--rail-hi);
  border-radius: 3px;
  overflow: hidden;
  background: linear-gradient(
    to right,
    var(--dim) 0 70%,
    var(--ok) 70% 90%,
    var(--warn) 90% 95%,
    var(--tally) 95% 100%
  );
}

.meter-mask {
  position: absolute;
  inset: 0 0 0 auto;
  width: 100%;
  background: rgba(15, 19, 32, 0.88);
}

.meter-hold {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  margin-left: -1px;
  background: var(--paper);
  opacity: 0;
}

.meter-scale {
  position: relative;
  height: 22px;
  font-size: 10px;
  color: var(--dim);
}

.meter-scale span {
  position: absolute;
  top: 0;
  padding-top: 7px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.meter-scale span::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 5px;
  background: var(--dim);
}

.meter-scale span:first-child {
  transform: none;
}

.meter-scale span:first-child::before {
  left: 0;
}

.meter-scale span:last-child {
  transform: translateX(-100%);
}

.meter-scale span:last-child::before {
  left: auto;
  right: 0;
}

.coach {
  font-size: 13.5px;
  min-height: 1.5em;
  color: var(--dim);
}

.coach[data-tone='good'] {
  color: var(--ok);
}

.coach[data-tone='low'] {
  color: var(--warn);
}

.coach[data-tone='hot'] {
  color: var(--tally);
}

.scope-wrap {
  position: relative;
}

#scope-canvas {
  display: block;
  width: 100%;
  height: 84px;
  background: var(--ink);
  border: 1px solid var(--rail);
  border-radius: 3px;
}

.scope-mode {
  position: absolute;
  top: 6px;
  right: 6px;
  min-height: 26px;
  font-size: 11.5px;
  background: rgba(23, 28, 44, 0.9);
}

.seed-row {
  align-items: flex-end;
}

.seed-field {
  flex: 1 1 110px;
}

.keybox {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 64px;
}

.keybox .mono {
  min-height: 40px;
  display: flex;
  align-items: center;
  font-size: 15px;
  color: var(--amber);
}

.mini-meter {
  flex: 1 1 80px;
  height: 8px;
  background: var(--ink);
  border: 1px solid var(--rail);
  border-radius: 2px;
  overflow: hidden;
}

#bus-meter-fill {
  height: 100%;
  width: 0;
  background: var(--ok);
}

.gr {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 62px;
  align-items: center;
  gap: 10px;
}

.gr-bar {
  height: 8px;
  background: var(--ink);
  border: 1px solid var(--rail);
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  justify-content: flex-end;
}

#duck-fill {
  height: 100%;
  width: 0;
  background: var(--amber);
}

.gr .mono {
  white-space: nowrap;
  text-align: right;
  font-size: 12.5px;
}

.pads {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pads.user:empty {
  display: none;
}

.pad {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  min-height: 62px;
  padding: 8px 9px;
  background: var(--rail);
  border: 1px solid var(--rail-hi);
  border-radius: var(--r);
  color: var(--paper);
  font-size: 13px;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 0 #0a0d16;
  transition: transform 0.05s, box-shadow 0.05s;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.pad:active,
.pad.live {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #0a0d16;
}

.pad.live {
  border-color: var(--amber);
}

.pad kbd {
  align-self: flex-end;
}

.file-btn {
  align-self: flex-start;
}

#sfx-file:focus-visible + .file-btn {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ---------- teleprompter ---------- */

.prompter {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 16px 20px;
  padding: 16px 20px;
  border-top: 1px solid var(--rail);
  background: var(--desk);
}

.prompter-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.prompter-view {
  height: 250px;
  overflow-y: auto;
  padding: 80px 20px 180px;
  background: var(--ink);
  border: 1px solid var(--rail);
  border-radius: 3px;
  font: 500 clamp(24px, 3.4vw, 40px) / 1.45 var(--font-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
}

.prompter-view:empty::before {
  content: 'Kịch bản sẽ chạy ở đây.';
  color: #5a6278;
}

/* ---------- transport ---------- */

.transport {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  background: var(--desk);
  border-top: 1px solid var(--rail-hi);
}

.t-buttons,
.t-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.t-tools {
  margin-left: auto;
}

.rec {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  min-width: 132px;
  padding: 10px 22px;
  background: var(--rail);
  border: 1px solid var(--rail-hi);
  border-radius: var(--r);
  color: var(--paper);
  font: 700 18px/1 var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 0 #0a0d16;
  transition: transform 0.06s, box-shadow 0.06s, background-color 0.2s;
}

.rec:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #0a0d16;
}

.rec-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--paper);
  background: transparent;
}

body[data-rec='recording'] .rec {
  background: var(--tally);
  border-color: var(--tally);
  color: #1c0906;
}

body[data-rec='recording'] .rec-dot {
  background: #1c0906;
  border-color: #1c0906;
}

body[data-rec='paused'] .rec {
  border-color: var(--tally);
}

body[data-rec='paused'] .rec-dot {
  border-color: var(--tally);
}

.t-time {
  min-width: 0;
}

.timecode {
  font-size: clamp(38px, 9vw, 64px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}

body[data-rec='paused'] .timecode {
  color: var(--dim);
}

.t-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--dim);
}

/* ---------- edit ---------- */

.edit,
.library {
  padding: 18px var(--gutter) 40px;
}

.edit-head {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

#ep-title {
  font: 700 22px/1.2 var(--font-display);
  min-height: 48px;
}

.edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 0 28px;
}

.edit-main,
.edit-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.edit-side {
  border-left: 1px solid var(--rail);
  padding-left: 28px;
}

#edit-wave {
  display: block;
  width: 100%;
  height: 240px;
  background: var(--desk);
  border: 1px solid var(--rail);
  border-radius: 3px;
  cursor: pointer;
  touch-action: manipulation;
}

.play-row .status {
  margin-left: auto;
  font-size: 12px;
}

.block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--rail);
}

.edit-side .block:first-child {
  padding-top: 0;
  border-top: 0;
}

.block-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.block-head .engraved {
  margin-right: auto;
}

.marker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.marker-list li {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
}

.marker-list .t {
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--amber);
  font: 400 13px/1 var(--font-mono);
  cursor: pointer;
  text-align: left;
}

.marker-list .btn {
  width: 40px;
  padding: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 0 0;
  border-top: 1px solid var(--rail);
}

.stats dt {
  font: 600 10px/1.2 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.stats dd {
  font-size: 15px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.cover {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid var(--rail);
  border-radius: 3px;
}

/* ---------- library ---------- */

.lib-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.lib-head .status {
  margin-left: auto;
}

.lib-list li {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 18px;
  padding: 14px 0;
  border-top: 1px solid var(--rail);
}

.lib-list li:last-child {
  border-bottom: 1px solid var(--rail);
}

.lib-title {
  font: 700 18px/1.25 var(--font-display);
  overflow-wrap: anywhere;
}

.lib-meta {
  font-size: 12px;
  color: var(--dim);
  margin-top: 4px;
}

.lib-wave {
  display: block;
  width: 100%;
  height: 44px;
}

.lib-actions {
  display: flex;
  gap: 8px;
}

/* ---------- overlays, toasts ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  background: rgba(15, 19, 32, 0.9);
}

.overlay-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 24px;
  background: var(--desk);
  border: 1px solid var(--rail-hi);
  border-radius: var(--r);
  text-align: center;
}

#power-overlay {
  z-index: 40;
}

.countin {
  background: rgba(15, 19, 32, 0.72);
  pointer-events: none;
  z-index: 70;
}

.countin-num {
  font-size: clamp(120px, 30vw, 240px);
  font-weight: 600;
  line-height: 1;
  color: var(--paper);
}

.toasts {
  position: fixed;
  right: var(--gutter);
  left: var(--gutter);
  bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: min(440px, 100%);
  padding: 10px 14px;
  background: var(--rail);
  border: 1px solid var(--rail-hi);
  border-left: 3px solid var(--amber);
  border-radius: 3px;
  font-size: 14px;
  pointer-events: auto;
  overflow-wrap: anywhere;
}

.toast.error {
  border-left-color: var(--paper);
}

.toast.ok {
  border-left-color: var(--ok);
}

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .desk {
    grid-template-columns: minmax(0, 1fr);
  }

  .strip {
    padding: 16px var(--gutter) 20px;
  }

  .strip + .strip {
    border-left: 0;
    border-top: 1px solid var(--rail);
  }

  .prompter {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px var(--gutter);
  }

  .edit-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .edit-side {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--rail);
    padding-top: 16px;
  }

  .lib-list li {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .transport {
    gap: 10px 14px;
    padding-top: 10px;
    padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
    padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  }

  .transport {
    gap: 8px 10px;
    padding-top: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .t-buttons {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .rec {
    min-height: 46px;
    min-width: 0;
    gap: 8px;
    padding: 6px 12px;
    font-size: 15px;
  }

  .rec-dot {
    width: 14px;
    height: 14px;
  }

  .transport .btn.icon {
    width: 44px;
    min-height: 44px;
  }

  .t-time {
    flex: 1;
    text-align: right;
  }

  .timecode {
    font-size: clamp(26px, 8vw, 40px);
  }

  .t-sub {
    margin-top: 2px;
    font-size: 11px;
  }

  .t-tools {
    margin-left: 0;
    width: 100%;
    gap: 6px 8px;
  }

  .t-tools .btn {
    min-height: 36px;
    padding: 4px 9px;
    font-size: 13px;
  }

  .t-tools .btn kbd {
    display: none;
  }

  .t-tools .switch {
    font-size: 13px;
    gap: 6px;
  }

  .nav {
    margin-left: 0;
    width: 100%;
    order: 3;
  }

  .nav-btn {
    flex: 1;
    padding: 8px 4px;
  }

  .slider,
  .gr {
    grid-template-columns: 62px minmax(0, 1fr) 64px;
    gap: 8px;
  }

  #edit-wave {
    height: 190px;
  }

  .play-row .status {
    margin-left: 0;
    width: 100%;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toasts {
    bottom: calc(190px + env(safe-area-inset-bottom, 0px));
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
