/* App shell + screens (from mock/song-phrase-instrument.html) */
:root {
  --bg: #0d0d0f;
  --panel: #16161a;
  --border: #2a2a32;
  --text: #e6e6ea;
  --muted: #8b8b9a;
  --accent: #5b8def;
  --accent2: #3db88a;
  --cell: #1c1c22;
  --clip: #252530;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}
.app-root {
  padding: 10px 12px 24px;
  max-width: 28rem;
  margin: 0 auto;
  min-height: 100dvh;
}
header {
  margin-bottom: 12px;
}
h1.app-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: 0.02em;
}
.badge {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
}
nav.app-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
nav.app-tabs button {
  flex: 1;
  min-height: 44px;
  min-width: 0;
  border: none;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
  touch-action: manipulation;
  padding: 0 4px;
}
nav.app-tabs button + button {
  border-left: 1px solid var(--border);
}
nav.app-tabs button[aria-selected='true'] {
  background: #222228;
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.screen {
  display: none;
}
.screen.on {
  display: block;
}
.block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}
.block h2 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.row:last-child {
  margin-bottom: 0;
}
.fake-btn {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--cell);
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  pointer-events: none;
  opacity: 0.85;
}
.callout {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0 0 8px;
  padding: 8px;
  border-radius: 6px;
  border: 1px dashed var(--border);
  background: rgba(91, 141, 239, 0.06);
}
.callout strong {
  color: var(--text);
}
.song-ruler {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  padding-left: 52px;
  font-size: 0.55rem;
  color: var(--muted);
}
.song-ruler span {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.track-lane {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 6px;
}
.track-label {
  width: 46px;
  flex-shrink: 0;
  font-size: 0.58rem;
  color: var(--muted);
  line-height: 1.15;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px;
  background: var(--cell);
}
.track-clips {
  flex: 1;
  display: flex;
  gap: 4px;
  min-width: 0;
}
.clip {
  flex: 1;
  min-height: 36px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--clip);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text);
}
.clip.dim {
  opacity: 0.55;
}
.clip.play {
  box-shadow: 0 0 0 1px var(--accent2);
}
.playhead {
  height: 2px;
  background: var(--accent2);
  border-radius: 1px;
  margin: 4px 0 2px 52px;
  opacity: 0.9;
}
.song-matrix-wrap {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--cell);
}
.song-matrix-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.song-matrix-ruler {
  display: flex;
  gap: 4px;
  padding: 6px 8px 4px 52px;
  font-size: 0.55rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  min-width: min-content;
}
.song-matrix-ruler span {
  flex: 0 0 44px;
  width: 44px;
  text-align: center;
}
.song-matrix-ruler .song-ruler-sentinel {
  opacity: 0.55;
}
.song-matrix-body {
  padding: 6px 8px 8px;
  min-width: min-content;
}
.song-matrix-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 6px;
}
.song-matrix-row:last-child {
  margin-bottom: 0;
}
.song-matrix-label {
  width: 46px;
  flex-shrink: 0;
  font-size: 0.58rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--cell);
}
.song-matrix-clips {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: min-content;
}
.song-matrix-cell {
  flex: 0 0 44px;
  width: 44px;
  min-height: 40px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--clip);
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.song-matrix-cell-empty {
  opacity: 0.55;
  font-weight: 500;
}
.song-matrix-cell-sentinel {
  border-style: dashed;
  opacity: 0.75;
}
.song-matrix-cell-active {
  box-shadow: 0 0 0 1px var(--accent2);
}
.song-matrix-cell-pattern-focus {
  box-shadow:
    0 0 0 2px var(--accent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.song-matrix-ruler-col-playing {
  color: var(--accent2);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--accent2);
  border-radius: 2px;
}
.song-matrix-cell-playing {
  background: rgba(91, 141, 239, 0.22);
  box-shadow:
    inset 0 0 0 1px var(--accent2),
    0 0 12px rgba(91, 141, 239, 0.15);
}
.song-matrix-cell-playing.song-matrix-cell-active {
  box-shadow:
    inset 0 0 0 2px var(--accent),
    0 0 12px rgba(91, 141, 239, 0.2);
}
.song-matrix-label-at-playback {
  color: var(--accent2);
  border-color: var(--accent2);
  background: rgba(91, 141, 239, 0.12);
  box-shadow: inset 2px 0 0 var(--accent2);
}
.song-matrix-playhead {
  margin-left: 52px;
}
.song-pattern-dialog {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  background: var(--cell);
  color: var(--text);
  max-width: 92vw;
}
.song-pattern-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.song-pattern-dialog-inner {
  padding: 14px 16px 16px;
  min-width: 220px;
}
.song-pattern-dialog-title {
  margin: 0 0 10px;
  font-size: 0.85rem;
}
.song-pattern-dialog-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}
.song-pattern-select {
  font: inherit;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--app-bg);
  color: var(--text);
}
.steps {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}
.step {
  aspect-ratio: 1;
  min-height: 38px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--cell);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.52rem;
  color: var(--muted);
  line-height: 1.15;
}
button.step {
  font: inherit;
  padding: 2px;
  cursor: pointer;
  color: inherit;
}
.step .n {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text);
}
.step.sel {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.step.play {
  background: #2a3040;
  box-shadow: inset 0 0 0 1px var(--accent2);
}
.step.rest .n {
  color: var(--muted);
  font-weight: 400;
}
.row16 {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
}
label.mock {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  width: 100%;
}
label.inst-volume {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 8px;
}
label.inst-volume span {
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
  text-align: right;
  color: var(--muted);
}
input[data-volume-range] {
  width: 100%;
  accent-color: var(--accent);
}
.sample-list .sample-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sample-list .sample-row-label {
  flex: 1 1 120px;
  min-width: 0;
}
label.sample-vol {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 100px;
  max-width: 140px;
  margin: 0;
  font-size: 0;
}
label.sample-vol input[type='range'] {
  flex: 1;
  min-width: 48px;
  accent-color: var(--accent);
}
.sample-vol-pct {
  font-size: 0.65rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 2.5em;
  text-align: right;
}
.rail {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--border) 0%, var(--accent) 40%, var(--border) 100%);
  opacity: 0.5;
}
select.mock,
input.mock-check {
  pointer-events: none;
  opacity: 0.7;
}
select.mock {
  width: 100%;
  min-height: 40px;
  margin-top: 4px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--cell);
  color: var(--text);
  font: inherit;
}
.hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.45;
}
.wire-btn {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--cell);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  cursor: default;
}
.wire-btn.primary {
  border-color: #3d5694;
  background: #283454;
  color: #e8eefc;
}
.wire-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
.btn-note {
  font-size: 0.78rem;
}
.help-txt {
  margin: 0 0 8px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}
.wire-row-title {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 6px;
  width: 100%;
}
.song-name-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  width: 100%;
  margin-bottom: 8px;
}
.song-name-input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--cell);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.song-name-input::placeholder {
  color: #666;
}
.slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.slot-head .slot-h2 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.hamburger {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--cell);
  cursor: pointer;
  touch-action: manipulation;
}
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}
.inst-menu-panel {
  margin-top: 4px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #101014;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.inst-menu-panel[hidden] {
  display: none !important;
}
.inst-menu-panel .menu-wide {
  width: 100%;
  justify-content: center;
}
.inst-menu-panel .menu-wide.fake-wrap {
  pointer-events: none;
  opacity: 0.85;
  display: flex;
}
.inst-menu-panel .menu-hint {
  margin: -4px 0 0;
  font-size: 0.62rem;
  color: var(--muted);
  line-height: 1.35;
}
.pattern-inst-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.75rem;
  color: var(--muted);
  width: 100%;
}
.pattern-inst-select {
  width: 100%;
  min-height: 42px;
  margin-top: 4px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--cell);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}
.app-status {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 8px;
  min-height: 1.2em;
}
button.file-btn,
label.file-btn {
  min-height: 40px;
  padding: 0 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--cell);
  color: var(--text);
  border-radius: 6px;
  font: inherit;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
}
label.file-btn input {
  display: none;
}
code {
  font-size: 0.85em;
  color: #aac;
}
