/* ==========================================================================
   MIDI OFFICE — a playable studio in small draggable windows.
   White, flat, hairline-bordered — beta-office's own window language
   (see ../beta-office/css/shell.css for the sibling version of this
   chrome), same IBM Plex Mono, same --color-accent-red hover accent
   the rest of the site already uses. Semantic layer over
   /css/tokens.css's shared primitives.
   ========================================================================== */

:root {
  --tone-bg: var(--color-white, #ffffff);
  --tone-bg-raised: var(--color-grey-f7, #f7f7f7);
  --tone-fg: var(--color-black, #000000);
  --tone-fg-muted: rgba(0, 0, 0, 0.6);
  --tone-fg-faint: rgba(0, 0, 0, 0.35);
  --tone-line: rgba(0, 0, 0, 0.14);
  --tone-accent: var(--color-accent-red, #e0261f);
  --tone-accent-dim: rgba(224, 38, 31, 0.16);
  --tone-font: "IBM Plex Mono", ui-monospace, monospace;
  --tone-ease: var(--ease-standard, cubic-bezier(0.22, 1, 0.36, 1));
  --tone-edge: 32px;
  --tone-black-key-width: 34px;
}

* {
  box-sizing: border-box;
}

html,
body.midi-office {
  background: var(--tone-bg);
  color: var(--tone-fg);
  margin: 0;
}

body.midi-office {
  font-family: var(--tone-font);
  min-height: 100vh;
}

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

/* Quick, automatic entrance — no blocking "tap to enter" screen (see
   app.js's header comment for why one isn't needed). Skipped entirely
   under prefers-reduced-motion since .js-enter is never added then
   (same convention the root site's index.html/shop use). */
@keyframes tone-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

html.js-enter .tone-main,
html.js-enter .tone-topbar {
  animation: tone-enter 420ms var(--tone-ease) both;
}

/* ==========================================================================
   Topbar
   ========================================================================== */

.tone-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--tone-edge);
  pointer-events: none;
}

.tone-exit {
  pointer-events: auto;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border: 1px solid var(--tone-fg);
  color: var(--tone-fg);
  background: var(--tone-bg);
  transition: color 150ms var(--tone-ease), background-color 150ms var(--tone-ease);
}

.tone-exit:hover,
.tone-exit:focus-visible {
  color: var(--tone-bg);
  background: var(--tone-fg);
}

.tone-badge {
  pointer-events: none;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tone-fg-muted);
  text-align: right;
}

/* ==========================================================================
   Help — button + searchable panel, same pattern as beta-office's.
   ========================================================================== */

.tone-help-btn {
  position: fixed;
  top: 16px;
  right: var(--tone-edge);
  z-index: 60;
  margin-top: 36px;
  border: 1px solid var(--tone-fg);
  background: var(--tone-bg);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 150ms var(--tone-ease), background-color 150ms var(--tone-ease);
}

.tone-help-btn:hover,
.tone-help-btn:focus-visible {
  color: var(--tone-bg);
  background: var(--tone-fg);
}

.tone-help-panel {
  position: fixed;
  top: 70px;
  right: var(--tone-edge);
  z-index: 200;
  width: min(380px, calc(100vw - 2 * var(--tone-edge)));
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--tone-bg);
  border: 1px solid var(--tone-fg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.tone-help-panel[hidden] {
  display: none;
}

.tone-help-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--tone-line);
}

.tone-help-search {
  flex: 1;
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  padding: 8px 10px;
  font-size: 12px;
}

.tone-help-close {
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  width: 30px;
  height: 30px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.tone-help-list {
  overflow-y: auto;
  padding: 8px;
}

.tone-help-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--tone-line);
  background: none;
  padding: 10px 6px;
  cursor: pointer;
}

.tone-help-item:last-child {
  border-bottom: none;
}

.tone-help-item:hover,
.tone-help-item:focus-visible {
  background: var(--tone-bg-raised);
}

.tone-help-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.tone-help-desc {
  font-size: 11px;
  color: var(--tone-fg-muted);
  line-height: 1.5;
}

.tone-help-empty {
  padding: 16px 6px;
  font-size: 12px;
  color: var(--tone-fg-faint);
}

/* ==========================================================================
   Main — transport + dock.
   ========================================================================== */

.tone-main {
  max-width: 920px;
  margin: 0 auto;
  padding: 96px var(--tone-edge) 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.tone-transport,
.tone-dock {
  border: 1px solid var(--tone-line);
  background: var(--tone-bg-raised);
  padding: 20px;
}

.tone-transport {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  /* Sticky and above the windows layer (z-index: 500) — transport
     controls the one clock every module locks to, so a floating
     window cascaded on top of it must never be able to block it. */
  position: sticky;
  top: 64px;
  z-index: 600;
}

.tone-dock-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.tone-dock-desc {
  margin: 0 0 18px;
  font-size: 12px;
  color: var(--tone-fg-muted);
}

.tone-dock-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1px;
  background: var(--tone-line);
  border: 1px solid var(--tone-line);
}

.tone-dock-btn {
  background: var(--tone-bg);
  border: none;
  text-align: left;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 76px;
  cursor: pointer;
  transition: background-color 150ms var(--tone-ease);
}

.tone-dock-btn:hover,
.tone-dock-btn:focus-visible {
  background: var(--tone-bg-raised);
}

.tone-dock-btn-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.tone-dock-btn-desc {
  font-size: 11px;
  color: var(--tone-fg-faint);
}

/* ---------- Shared field/control styling ---------- */

.tone-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 96px;
}

.tone-field-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tone-field label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tone-fg-faint);
}

.tone-field input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--tone-line);
  outline: none;
}

.tone-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--tone-fg);
  border: none;
  cursor: pointer;
  transition: background-color 150ms var(--tone-ease);
}

.tone-field input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--tone-fg);
  border: none;
  cursor: pointer;
}

.tone-field input[type="range"]:hover::-webkit-slider-thumb,
.tone-field input[type="range"]:focus-visible::-webkit-slider-thumb {
  background: var(--tone-accent);
}

.tone-field-value {
  font-size: 11px;
  color: var(--tone-fg-muted);
}

.tone-select {
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  color: var(--tone-fg);
  padding: 7px 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tone-mini-btn {
  display: inline-block;
  border: 1px solid var(--tone-fg);
  background: var(--tone-bg);
  padding: 7px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-align: center;
  transition: color 150ms var(--tone-ease), background-color 150ms var(--tone-ease);
}

.tone-mini-btn:hover,
.tone-mini-btn:focus-visible {
  color: var(--tone-bg);
  background: var(--tone-fg);
}

.tone-toggle-btn {
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  padding: 9px 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background-color 150ms var(--tone-ease), border-color 150ms var(--tone-ease), color 150ms var(--tone-ease);
}

.tone-toggle-btn.tone-is-active {
  background: var(--tone-accent);
  border-color: var(--tone-accent);
  color: var(--tone-bg);
}

.tone-hint {
  font-size: 11px;
  color: var(--tone-fg-faint);
  line-height: 1.6;
}

/* ---------- Transport specifics ---------- */

.tone-play-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--tone-fg);
  background: var(--tone-bg);
  padding: 10px 18px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  transition: background-color 150ms var(--tone-ease), color 150ms var(--tone-ease), border-color 150ms var(--tone-ease);
}

.tone-play-icon {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
}

.tone-play-btn.tone-is-playing {
  background: var(--tone-accent);
  border-color: var(--tone-accent);
  color: var(--tone-bg);
}

.tone-play-btn.tone-is-playing .tone-play-icon {
  width: 8px;
  height: 10px;
  border: none;
  background: currentColor;
}

.tone-tap-btn {
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  padding: 8px 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: border-color 150ms var(--tone-ease), color 150ms var(--tone-ease);
}

.tone-tap-btn:hover,
.tone-tap-btn:focus-visible {
  border-color: var(--tone-accent);
  color: var(--tone-accent);
}

.tone-field-bpm,
.tone-field-volume {
  min-width: 140px;
}

/* ==========================================================================
   Windows — beta-office's small-floating-window chrome, same idea.
   ========================================================================== */

.tone-windows-layer {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
}

.tone-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--tone-bg);
  border: 1px solid var(--tone-fg);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  pointer-events: auto;
}

.tone-window.tone-is-dragging {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
}

.tone-window.tone-is-hidden {
  display: none;
}

.tone-window.tone-is-maximized {
  left: 12px !important;
  top: 90px !important;
  width: calc(100vw - 24px) !important;
  height: calc(100vh - 100px) !important;
}

.tone-window-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--tone-line);
  background: var(--tone-bg-raised);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.tone-window.tone-is-dragging .tone-window-titlebar {
  cursor: grabbing;
}

.tone-window-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tone-window-controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.tone-window-btn {
  width: 18px;
  height: 18px;
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  cursor: pointer;
  padding: 0;
  position: relative;
}

.tone-window-btn:hover,
.tone-window-btn:focus-visible {
  border-color: var(--tone-accent);
}

.tone-window-min::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 5px;
  height: 1.5px;
  background: currentColor;
}

.tone-window-max::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1.5px solid currentColor;
}

.tone-window-close::before,
.tone-window-close::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 50%;
  height: 1.5px;
  background: currentColor;
}

.tone-window-close::before {
  transform: rotate(45deg);
}

.tone-window-close::after {
  transform: rotate(-45deg);
}

.tone-window-content {
  flex: 1;
  overflow: auto;
  padding: 14px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tone-window-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 45%, var(--tone-fg-muted) 45%, var(--tone-fg-muted) 55%, transparent 55%),
    linear-gradient(135deg, transparent 65%, var(--tone-fg-muted) 65%, var(--tone-fg-muted) 75%, transparent 75%);
}

/* ==========================================================================
   Taskbar — minimized window chips.
   ========================================================================== */

.tone-taskbar {
  position: fixed;
  left: var(--tone-edge);
  bottom: 16px;
  z-index: 500;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tone-taskbar-chip {
  border: 1px solid var(--tone-fg);
  background: var(--tone-bg);
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.tone-taskbar-chip:hover,
.tone-taskbar-chip:focus-visible {
  border-color: var(--tone-accent);
  color: var(--tone-accent);
}

/* ==========================================================================
   Sequencer / Sampler step grid — shared classes between both modules.
   ========================================================================== */

.tone-seq-tracks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tone-seq-track {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tone-seq-track-label {
  width: 50px;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--tone-fg-muted);
}

.tone-seq-steps {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
}

.tone-seq-step {
  aspect-ratio: 1;
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  cursor: pointer;
  padding: 0;
  transition: background-color 120ms var(--tone-ease), border-color 120ms var(--tone-ease);
}

.tone-seq-step.tone-is-beat {
  border-color: rgba(0, 0, 0, 0.3);
}

.tone-seq-step.tone-is-active {
  background: var(--tone-accent-dim);
  border-color: var(--tone-accent);
}

.tone-seq-step.tone-is-playhead {
  box-shadow: inset 0 0 0 2px var(--tone-fg);
}

.tone-seq-step.tone-is-active.tone-is-playhead {
  background: var(--tone-accent);
  box-shadow: inset 0 0 0 2px var(--tone-fg);
}

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

/* ==========================================================================
   Synth — controls + playable keyboard.
   ========================================================================== */

.tone-synth-controls {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.tone-keyboard {
  position: relative;
  display: flex;
  height: 140px;
  user-select: none;
  touch-action: none;
}

.tone-key {
  border: none;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
  transition: background-color 80ms linear, color 80ms linear;
}

.tone-key-white {
  position: relative;
  flex: 1;
  height: 100%;
  background: var(--tone-bg);
  color: var(--tone-fg-faint);
  border: 1px solid var(--tone-fg);
  border-right: none;
}

.tone-key-white:last-child {
  border-right: 1px solid var(--tone-fg);
}

.tone-key-black {
  position: absolute;
  top: 0;
  z-index: 2;
  width: var(--tone-black-key-width);
  height: 58%;
  background: var(--tone-fg);
  color: var(--tone-bg);
  border: 1px solid var(--tone-fg);
}

.tone-key-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.tone-key.tone-is-pressed {
  background: var(--tone-accent);
  border-color: var(--tone-accent);
  color: var(--tone-bg);
}

/* NOTE/KEY display toggle — a 2-up segmented version of .tone-toggle-
   btn, same border/accent/typography tokens, just split into a group
   so the active side reads clearly against the inactive one. */
.tone-segmented {
  display: flex;
  border: 1px solid var(--tone-line);
}

.tone-segmented-btn {
  border: none;
  background: var(--tone-bg);
  padding: 9px 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background-color 150ms var(--tone-ease), color 150ms var(--tone-ease);
}

.tone-segmented-btn:first-child {
  border-right: 1px solid var(--tone-line);
}

.tone-segmented-btn.tone-is-active {
  background: var(--tone-accent);
  color: var(--tone-bg);
}

.tone-synth-status {
  display: flex;
  gap: 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--tone-fg-muted);
}

/* ---------- FX ---------- */

.tone-fx-controls {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Sampler
   ========================================================================== */

.tone-sampler-load,
.tone-dj-crossfader {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tone-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.tone-file-label {
  cursor: pointer;
}

.tone-sampler-status {
  font-size: 11px;
  color: var(--tone-fg-muted);
}

.tone-sampler-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tone-sampler-pads {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 4px;
}

.tone-sampler-pad {
  aspect-ratio: 1;
  border: 1px solid var(--tone-fg);
  background: var(--tone-bg);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 100ms var(--tone-ease), color 100ms var(--tone-ease);
}

.tone-sampler-pad:hover,
.tone-sampler-pad:focus-visible,
.tone-sampler-pad:active {
  background: var(--tone-accent);
  color: var(--tone-bg);
  border-color: var(--tone-accent);
}

/* ==========================================================================
   DJ decks
   ========================================================================== */

.tone-dj-decks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tone-dj-deck {
  border: 1px solid var(--tone-line);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tone-dj-deck-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.tone-dj-play {
  align-self: flex-start;
}

.tone-dj-crossfader {
  border-top: 1px solid var(--tone-line);
  padding-top: 14px;
}

.tone-dj-crossfader .tone-field {
  flex: 1;
}

/* ==========================================================================
   AI Jam
   ========================================================================== */

.tone-ai-face {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.tone-ai-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tone-ai-status {
  font-size: 11px;
  color: var(--tone-fg-muted);
  min-height: 1.4em;
}

/* ==========================================================================
   Recorder
   ========================================================================== */

.tone-recorder-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tone-record-btn.tone-is-active {
  background: var(--tone-accent);
  border-color: var(--tone-accent);
  color: var(--tone-bg);
}

.tone-record-timer {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tone-takes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tone-take-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--tone-line);
  padding-top: 10px;
}

.tone-take-name {
  font-size: 11px;
  font-weight: 700;
  min-width: 100px;
}

.tone-take-audio {
  height: 32px;
  flex: 1;
  min-width: 160px;
}

/* ==========================================================================
   Pinkroll
   ========================================================================== */

.tone-pinkroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.tone-pinkroll.tone-is-dropping {
  outline: 1px dashed var(--tone-accent);
  outline-offset: 4px;
}

.tone-pinkroll-rail {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tone-pinkroll-stage {
  flex: 999 1 280px;
  min-width: 0;
  min-height: 400px;
  height: 100%;
}

.tone-pinkroll-board {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Kept in the layout at 2px rather than display:none — browsers can
   stop decoding frames for a video that isn't rendered at all. */
.tone-pinkroll-video {
  position: fixed;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

.tone-pinkroll-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tone-fg-faint);
}

.tone-pinkroll-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tone-pinkroll-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.tone-pinkroll-check input {
  margin: 0;
  accent-color: var(--tone-accent);
}

.tone-pinkroll-name {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
}

.tone-pinkroll-swatches {
  display: flex;
  gap: 8px;
}

.tone-pinkroll-swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid var(--tone-bg);
  box-shadow: 0 0 0 1px var(--tone-line);
  cursor: pointer;
}

.tone-pinkroll-swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--tone-fg);
}

.tone-pinkroll .tone-toggle-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tone-pinkroll .tone-file-input:focus-visible + .tone-file-label,
.tone-pinkroll-name:focus-visible,
.tone-pinkroll-swatch:focus-visible {
  outline: 2px solid var(--tone-accent);
  outline-offset: 2px;
}

.tone-pinkroll-status {
  min-height: 1.4em;
  margin: 0;
}

.tone-pinkroll-status.tone-is-error {
  color: var(--tone-accent);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
  :root {
    --tone-edge: 18px;
    --tone-black-key-width: 26px;
  }

  .tone-badge {
    display: none;
  }

  .tone-help-btn {
    margin-top: 0;
    top: auto;
    bottom: 16px;
  }

  .tone-help-panel {
    top: auto;
    bottom: 60px;
    right: 18px;
  }

  .tone-main {
    padding-top: 80px;
    gap: 16px;
  }

  .tone-seq-track-label {
    width: 40px;
    font-size: 9px;
  }

  .tone-seq-steps {
    gap: 3px;
  }

  .tone-keyboard {
    height: 110px;
  }

  .tone-dj-decks {
    grid-template-columns: 1fr;
  }

  .tone-window {
    max-width: calc(100vw - 24px);
  }
}

/* ==========================================================================
   EP-133 Workstation — js/workstation/*.js. An original display/panel
   language (not a copy of the EP-133's own screen/icon artwork):
   monospace readout rows, flat hairline-bordered buttons/pads, same
   --tone-* tokens the rest of MIDI OFFICE already uses.
   ========================================================================== */

.ws-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 11px;
}

.ws-display {
  border: 1px solid var(--tone-fg);
  background: var(--tone-bg-raised);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--tone-font);
}

.ws-display-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ws-dv {
  color: var(--tone-fg-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.ws-dv-big {
  font-size: 14px;
  font-weight: 700;
  color: var(--tone-fg);
}

.ws-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.ws-btn {
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  padding: 7px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color 120ms var(--tone-ease), color 120ms var(--tone-ease), border-color 120ms var(--tone-ease);
}

.ws-btn:hover,
.ws-btn:focus-visible {
  border-color: var(--tone-accent);
}

.ws-btn.ws-is-active {
  background: var(--tone-accent);
  border-color: var(--tone-accent);
  color: var(--tone-bg);
}

.ws-groups,
.ws-modes {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

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

.ws-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--tone-fg-muted);
}

.ws-field input[type="range"] {
  width: 90px;
}

.ws-field select {
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  color: var(--tone-fg);
  font-size: 10px;
  padding: 4px;
}

.ws-pads {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  flex: 1;
  min-width: 220px;
}

.ws-pad {
  aspect-ratio: 1;
  border: 1px solid var(--tone-fg);
  background: var(--tone-bg);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 80ms linear, color 80ms linear;
}

.ws-pad.ws-is-active {
  background: var(--tone-accent);
  border-color: var(--tone-accent);
  color: var(--tone-bg);
}

.ws-knobs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 140px;
}

.ws-mode-body {
  border: 1px solid var(--tone-line);
  padding: 10px;
  min-height: 80px;
}

.ws-hint-block {
  font-size: 11px;
  color: var(--tone-fg-faint);
}

.ws-footer-row {
  align-items: center;
}

.ws-mini {
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  padding: 6px 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.ws-mini.ws-is-active {
  background: var(--tone-accent);
  border-color: var(--tone-accent);
  color: var(--tone-bg);
}

.ws-mini:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ws-hint {
  font-size: 9px;
  color: var(--tone-fg-faint);
  letter-spacing: 0.02em;
}

.ws-seq-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ws-seq-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-seq-row-label {
  width: 18px;
  font-size: 9px;
  font-weight: 700;
  color: var(--tone-fg-muted);
  flex-shrink: 0;
}

.ws-seq-steps {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 2px;
}

.ws-seq-step {
  aspect-ratio: 1;
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  cursor: pointer;
  padding: 0;
}

.ws-seq-step.ws-is-beat {
  border-color: rgba(0, 0, 0, 0.3);
}

.ws-seq-step.ws-is-on {
  background: var(--tone-accent-dim);
  border-color: var(--tone-accent);
}

.ws-seq-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.ws-sound-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ws-waveform {
  width: 100%;
  height: 60px;
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
}

.ws-editor-fields {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .ws-pads {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   Sound Editor — sections, inline-number inputs, and readouts used by
   js/workstation/sound-editor.js. Same flat/hairline language as the
   rest of .ws-*; reuses --tone-* tokens only, no new color literals.
   ========================================================================== */

.ws-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ws-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--tone-fg-muted);
  text-transform: uppercase;
}

.ws-field-readout {
  min-width: 34px;
  text-align: right;
  font-weight: 700;
  color: var(--tone-fg);
}

.ws-file-row {
  align-items: center;
}

.ws-sound-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ws-mute-groups {
  gap: 4px;
}

/* ---- Keys mode (js/workstation/keys-mode.js) ---- */

.ws-keys {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ws-keys-source {
  display: flex;
  align-items: center;
  min-height: 18px;
}

.ws-keys-controls {
  align-items: center;
}

.ws-keys-stepper {
  gap: 8px;
}

.ws-keys-value {
  min-width: 26px;
  text-align: center;
  font-weight: 700;
  color: var(--tone-fg);
}

.ws-field input[type="number"] {
  width: 56px;
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  color: var(--tone-fg);
  font-family: var(--tone-font);
  font-size: 10px;
  padding: 4px;
}

.ws-keys-strip {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
}

.ws-keys-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--tone-line);
  background: var(--tone-bg-raised);
  padding: 6px 2px;
  font-size: 9px;
}

.ws-keys-cell-pad {
  color: var(--tone-fg-faint);
  font-weight: 700;
}

.ws-keys-cell-note {
  color: var(--tone-fg);
  font-weight: 700;
  letter-spacing: 0.02em;
}

@media (max-width: 720px) {
  .ws-keys-strip {
    grid-template-columns: repeat(6, 1fr);
  }
}

.ws-mixer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ws-mixer-strips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ws-mixer-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 120px;
  min-width: 120px;
  padding: 10px;
  border: 1px solid var(--tone-line);
}

.ws-mixer-master {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 160px;
  padding: 10px;
  border: 1px solid var(--tone-fg);
  background: var(--tone-bg-raised);
}

.ws-mixer-strip-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--tone-fg-muted);
}

.ws-mixer-fader-field {
  width: 100%;
}

.ws-mixer-fader {
  width: 100%;
  flex: 1;
}

.ws-mixer-readout {
  text-align: right;
}

.ws-mixer-strip-buttons {
  gap: 6px;
}

.ws-mixer-toggle {
  flex: 1;
}

/* ---- Effects (js/workstation/effects.js) ---- */

.ws-fx {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ws-fx-live {
  align-items: center;
  border-top: 1px solid var(--tone-line);
  padding-top: 10px;
}

.ws-fx-sidechain {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--tone-line);
  padding-top: 10px;
}

.ws-fx-sc-targets {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ws-fx-sc-targets .ws-field {
  gap: 4px;
}

/* ---- Project management (js/workstation/ui.js) ---- */

.ws-project-row {
  align-items: center;
  border-top: 1px solid var(--tone-line);
  border-bottom: 1px solid var(--tone-line);
  padding: 10px 0;
}

.ws-project-name {
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  color: var(--tone-fg);
  padding: 7px 9px;
  font-size: 10px;
  font-family: var(--tone-font);
  min-width: 120px;
}

.ws-select {
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  color: var(--tone-fg);
  padding: 7px 8px;
  font-size: 10px;
  max-width: 180px;
}

.ws-project-status {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--tone-fg-muted);
}

.ws-project-status.ws-is-error {
  color: var(--tone-accent);
}

/* ---- Keyboard-map overlay (js/workstation/ui.js) ---- */

.ws-keymap-overlay {
  display: none;
  position: absolute;
  top: 60px;
  right: 14px;
  z-index: 50;
  width: min(360px, calc(100% - 28px));
  max-height: 70%;
  overflow-y: auto;
  background: var(--tone-bg);
  border: 1px solid var(--tone-fg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  padding: 12px;
  font-size: 11px;
}

.ws-keymap-overlay.ws-is-open {
  display: block;
}

.ws-keymap-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--tone-line);
}

.ws-keymap-close {
  border: 1px solid var(--tone-line);
  background: var(--tone-bg);
  width: 24px;
  height: 24px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.ws-keymap-diagram {
  font-family: var(--tone-font);
  font-size: 10px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
  margin-bottom: 10px;
  padding: 8px;
  background: var(--tone-bg-raised);
}

.ws-keymap-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.ws-keymap-rows > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.ws-keymap-rows kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 1px 5px;
  border: 1px solid var(--tone-fg-muted);
  font-family: var(--tone-font);
  font-size: 10px;
  text-align: center;
}

.ws-keymap-rows span {
  color: var(--tone-fg-muted);
}

.ws-keymap-note {
  font-size: 10px;
  color: var(--tone-fg-faint);
  line-height: 1.5;
  border-top: 1px solid var(--tone-line);
  padding-top: 8px;
}
