/* style.css — Garage Drums — dark industrial, amber valve glow */

/* =============================================
   TOKENS
   ============================================= */
:root {
  --text-2xs:  0.6875rem;
  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-lg:   1.125rem;
  --text-xl:   clamp(1.25rem, 1rem + 1vw, 1.625rem);
  --text-brand: clamp(1.75rem, 1.1rem + 2.4vw, 2.75rem);
  --text-tempo: clamp(2.5rem, 1.8rem + 2.4vw, 3.5rem);

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;

  --color-bg: #0d0d0d;
  --color-surface: #151515;
  --color-surface-2: #1c1c1c;
  --color-surface-3: #242424;
  --color-well: #0a0a0a;
  --color-border: #303030;
  --color-border-dim: #222;
  --color-text: #ece4da;
  --color-text-muted: #a39a90;
  --color-text-faint: #77706a;

  --color-amber: #e8a020;
  --color-amber-bright: #ffb22e;
  --color-amber-dim: #7a4d08;
  --color-red: #ef4444;
  --color-red-dim: #7a1a1a;

  --color-kick: #e8a020;
  --color-snare: #f0603a;
  --color-hihat: #d8c84a;
  --color-openhat: #3fca6c;
  --color-crash: #33c6d4;
  --color-tom: #c85ad0;

  --font-display: 'Oswald', 'Impact', sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'Courier New', monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 4px;
  --lane-h: 34px;
  --label-w: 158px;
}

/* =============================================
   PAGE
   ============================================= */
body {
  background:
    radial-gradient(1200px 500px at 50% -120px, rgba(232,160,32,0.07), transparent 70%),
    var(--color-bg);
  font-family: var(--font-mono);
  color: var(--color-text);
}

.skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link {
  position: fixed; left: var(--space-3); top: 8px; z-index: 60;
  padding: var(--space-2) var(--space-4); background: var(--color-amber); color: #111;
  font-weight: 700; font-size: var(--text-sm); text-decoration: none; border-radius: var(--radius);
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-5) clamp(var(--space-4), 3vw, var(--space-10)) var(--space-10);
}

/* =============================================
   TOP BAR
   ============================================= */
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4);
  padding-bottom: var(--space-4); margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border-dim);
}
.brand-title {
  font-family: var(--font-display); font-size: var(--text-brand); font-weight: 700;
  letter-spacing: 0.08em; line-height: 1; text-transform: uppercase;
  text-shadow: 0 0 40px rgba(232,160,32,0.12);
}
.brand-title .accent { color: var(--color-amber); text-shadow: 0 0 22px rgba(232,160,32,0.45); }
.brand-sub {
  margin-top: var(--space-2); font-size: var(--text-xs); color: var(--color-text-muted);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.topbar-meta { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }
.meta-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 6px 10px; border: 1px solid var(--color-border); border-radius: 999px;
  font-size: var(--text-2xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-muted);
  background: var(--color-surface);
}
.meta-led { width: 6px; height: 6px; border-radius: 50%; background: var(--color-amber); box-shadow: 0 0 8px var(--color-amber); }

/* =============================================
   PANELS
   ============================================= */
.deck { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--space-5); margin-bottom: var(--space-5); }
.panel {
  background: linear-gradient(180deg, #181818, var(--color-surface));
  border: 1px solid var(--color-border-dim); border-top-color: #2c2c2c;
  border-radius: 6px; padding: var(--space-5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 10px 30px rgba(0,0,0,0.35);
  min-width: 0;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.panel-label {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; color: var(--color-text-muted);
  letter-spacing: 0.22em; text-transform: uppercase;
}
.panel-hint { font-size: var(--text-xs); color: var(--color-text-faint); letter-spacing: 0.04em; text-align: right; }

/* =============================================
   PADS
   ============================================= */
.pads-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.drum-pad {
  --lane: var(--color-amber);
  position: relative; overflow: hidden;
  aspect-ratio: 1.18; min-height: 92px; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2);
  background: linear-gradient(165deg, #262626, #1b1b1b 60%, #171717);
  border: 1px solid #2e2e2e; border-top-color: #3b3b3b; border-bottom-color: #0f0f0f;
  border-radius: 6px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), inset 0 -2px 0 rgba(0,0,0,0.35), 0 3px 8px rgba(0,0,0,0.5);
  transition: transform 70ms var(--ease), box-shadow 120ms var(--ease), background 120ms var(--ease), border-color 120ms;
  user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.drum-pad::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--lane); opacity: 0.55; transition: opacity 120ms, height 120ms;
}
.drum-pad:hover:not(.active) { background: linear-gradient(165deg, #2c2c2c, #1f1f1f 60%, #191919); border-top-color: #474747; }
.drum-pad:hover::after { opacity: 0.9; }
.drum-pad.active {
  transform: translateY(1px) scale(0.985);
  border-color: color-mix(in srgb, var(--lane) 60%, #000);
  background: radial-gradient(120% 90% at 50% 40%, color-mix(in srgb, var(--lane) 22%, #222), #1a1a1a 75%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 1px color-mix(in srgb, var(--lane) 35%, transparent), 0 0 26px color-mix(in srgb, var(--lane) 40%, transparent);
}
.drum-pad.active::after { opacity: 1; height: 5px; }
.pad-name { font-family: var(--font-display); font-size: clamp(1rem, 0.8rem + 0.7vw, 1.375rem); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1; }
.drum-pad.active .pad-name { color: var(--lane); }
.pad-key {
  font-size: var(--text-2xs); color: var(--color-text-muted); padding: 1px 7px;
  border: 1px solid var(--color-border); border-radius: 3px; background: rgba(0,0,0,0.25); letter-spacing: 0.1em;
}
.pad-led { position: absolute; top: 10px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: #333; transition: background 80ms, box-shadow 80ms; }
.drum-pad.active .pad-led { background: var(--lane); box-shadow: 0 0 8px var(--lane); }

/* =============================================
   CONSOLE
   ============================================= */
.console { display: flex; flex-direction: column; gap: var(--space-4); }
.tempo { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.tempo-readout { display: flex; align-items: baseline; gap: var(--space-3); min-width: 9.5rem; }
.tempo-label { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; letter-spacing: 0.18em; color: var(--color-text-muted); }
.tempo-value {
  font-family: var(--font-display); font-size: var(--text-tempo); font-weight: 700; color: var(--color-amber); line-height: 1;
  font-variant-numeric: tabular-nums lining-nums; text-shadow: 0 0 24px rgba(232,160,32,0.35); min-width: 3ch;
}
.tempo-buttons { display: flex; gap: var(--space-2); }
.knob-btn {
  min-width: 44px; height: 44px; padding: 0 var(--space-3);
  background: var(--color-surface-2); border: 1px solid var(--color-border); border-bottom-color: #0f0f0f; border-radius: var(--radius);
  color: var(--color-text); font-size: var(--text-lg); font-weight: 700; line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 2px 4px rgba(0,0,0,0.4);
  transition: background 120ms, color 120ms, border-color 120ms, transform 70ms;
}
.knob-btn:hover { background: var(--color-surface-3); border-color: #444; }
.knob-btn:active { transform: translateY(1px); }
.tap-btn { font-size: var(--text-xs); letter-spacing: 0.16em; }
.tap-btn.flash { color: #111; background: var(--color-amber); border-color: var(--color-amber); }
.beat-lights { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.beat-dot { width: 11px; height: 11px; border-radius: 50%; background: #2c2c2c; box-shadow: inset 0 1px 1px rgba(0,0,0,0.6); transition: background 60ms, box-shadow 60ms; }
.beat-dot.downbeat { width: 13px; height: 13px; }
.beat-dot.on { background: var(--color-amber); box-shadow: 0 0 10px rgba(232,160,32,0.7); }
.beat-dot.downbeat.on { background: var(--color-amber-bright); box-shadow: 0 0 14px rgba(255,178,46,0.9); }
.beat-dot.count { background: var(--color-red); box-shadow: 0 0 10px rgba(239,68,68,0.7); }

.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; display: block;
}
.slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--fill-c, #8c857e) var(--fill, 50%), #2e2e2e var(--fill, 50%)); }
.slider::-moz-range-track { height: 6px; border-radius: 3px; background: #2e2e2e; }
.slider::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--fill-c, #8c857e); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 26px; margin-top: -10px; border-radius: 3px;
  background: linear-gradient(#d9d2c9, #a8a098); border: 1px solid #111; box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.slider::-moz-range-thumb { width: 18px; height: 26px; border-radius: 3px; background: #c9c1b8; border: 1px solid #111; }
.slider-amber { --fill-c: var(--color-amber); }
.slider-amber::-webkit-slider-thumb { background: linear-gradient(#ffc04d, #e8a020); box-shadow: 0 0 12px rgba(232,160,32,0.5); }
.slider-amber::-moz-range-thumb { background: var(--color-amber); }
.slider:focus-visible { outline: 2px solid var(--color-amber); outline-offset: 2px; }

.console-row { display: flex; gap: var(--space-4); align-items: flex-end; }
.console-row.two-col > * { flex: 1 1 0; min-width: 0; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-1); gap: var(--space-2); }
.field-head label, .field-head span { font-size: var(--text-xs); color: var(--color-text-muted); letter-spacing: 0.16em; text-transform: uppercase; }
.field-head output { font-size: var(--text-xs); color: var(--color-text); font-variant-numeric: tabular-nums; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; background: var(--color-well); }
.segmented button {
  min-height: 44px; font-size: var(--text-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-text-muted);
  transition: background 120ms, color 120ms;
}
.segmented button + button { border-left: 1px solid var(--color-border); }
.segmented button:hover { color: var(--color-text); background: var(--color-surface-2); }
.segmented button[aria-checked="true"] { background: rgba(232,160,32,0.12); color: var(--color-amber); box-shadow: inset 0 -2px 0 var(--color-amber); }

.transport { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.t-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0 var(--space-3);
  background: linear-gradient(#222, #1a1a1a); border: 1px solid var(--color-border); border-top-color: #383838; border-bottom-color: #0d0d0d;
  border-radius: var(--radius); color: var(--color-text-muted);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 2px 5px rgba(0,0,0,0.45);
  transition: color 120ms, background 120ms, border-color 120ms, box-shadow 160ms, transform 70ms;
}
.t-btn svg { flex: none; }
.t-btn:hover { color: var(--color-text); border-color: #474747; }
.t-btn:active { transform: translateY(1px); }
.t-btn[aria-pressed="true"] { color: var(--color-amber); border-color: var(--color-amber-dim); background: linear-gradient(rgba(232,160,32,0.12), rgba(232,160,32,0.05)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 0 14px rgba(232,160,32,0.18); }
.t-rec { color: #f87171; border-color: var(--color-red-dim); }
.t-rec:hover { color: #fca5a5; border-color: #a12a2a; }
.t-rec[aria-pressed="true"] { color: #fff; background: linear-gradient(#c62828, #9f1d1d); border-color: #ef4444; animation: rec-pulse 1.1s ease-in-out infinite; }
.t-rec.armed { color: #fecaca; border-color: #ef4444; animation: rec-pulse 0.55s ease-in-out infinite; }
@keyframes rec-pulse { 0%,100% { box-shadow: 0 0 0 1px rgba(239,68,68,0.25), 0 0 10px rgba(239,68,68,0.25); } 50% { box-shadow: 0 0 0 1px rgba(239,68,68,0.6), 0 0 24px rgba(239,68,68,0.55); } }
.t-play .i-stop { display: none; }
.t-play[aria-pressed="true"] .i-play { display: none; }
.t-play[aria-pressed="true"] .i-stop { display: block; }
.t-ghost { color: var(--color-text-muted); }
.t-export { color: var(--color-text); }
.t-export:hover { color: var(--color-amber); border-color: var(--color-amber-dim); }
.t-btn:disabled { opacity: 0.55; cursor: progress; }

.status {
  display: flex; align-items: center; gap: var(--space-3); min-height: 48px;
  padding: var(--space-2) var(--space-3); background: var(--color-well); border: 1px solid var(--color-border-dim); border-radius: var(--radius);
}
.status-led { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #3a3a3a; }
.status-led.ok { background: var(--color-openhat); box-shadow: 0 0 8px rgba(63,202,108,0.7); }
.status-led.rec { background: var(--color-red); box-shadow: 0 0 8px rgba(239,68,68,0.8); animation: blink 0.8s ease-in-out infinite; }
.status-led.play { background: var(--color-amber); box-shadow: 0 0 8px rgba(232,160,32,0.8); }
@keyframes blink { 50% { opacity: 0.25; } }
.status-text { flex: 1; min-width: 0; font-size: var(--text-xs); line-height: 1.45; color: var(--color-text); letter-spacing: 0.02em; }
.status-undo {
  flex: none; min-height: 36px; min-width: 64px; padding: 0 var(--space-3); border: 1px solid var(--color-amber-dim); border-radius: var(--radius);
  color: var(--color-amber); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
}
.status-undo:hover { background: rgba(232,160,32,0.1); }

.out-row { align-items: center; }
.vol-field { flex: 1; min-width: 0; }
.vu { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.vu-label { font-size: var(--text-2xs); color: var(--color-text-faint); letter-spacing: 0.2em; text-transform: uppercase; }
.vu-meter { display: flex; gap: 3px; align-items: flex-end; height: 22px; }
.vu-bar { width: 5px; height: 100%; border-radius: 1px; background: #262626; transition: background 50ms; }
.vu-bar.lit-g { background: #3fca6c; box-shadow: 0 0 4px rgba(63,202,108,0.6); }
.vu-bar.lit-y { background: #d8c84a; box-shadow: 0 0 4px rgba(216,200,74,0.6); }
.vu-bar.lit-r { background: #ef4444; box-shadow: 0 0 4px rgba(239,68,68,0.6); }

.export-row { justify-content: space-between; align-items: stretch; flex-wrap: wrap; }
.export-group { display: flex; gap: var(--space-2); }
.select {
  min-height: 48px; padding: 0 34px 0 var(--space-3);
  background: var(--color-well) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a39a90' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
  -webkit-appearance: none; appearance: none;
  border: 1px solid var(--color-border); border-radius: var(--radius); color: var(--color-text);
  font-size: var(--text-xs); letter-spacing: 0.08em; cursor: pointer;
}
.select:focus-visible { outline: 2px solid var(--color-amber); outline-offset: 2px; }

/* =============================================
   PATTERN GRID
   ============================================= */
.pattern-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); flex-wrap: wrap; }
.pattern-title { display: flex; align-items: baseline; gap: var(--space-4); min-width: 0; }
.pattern-name { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text); white-space: nowrap; }
.pattern-edited { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: none; color: var(--color-amber); }
.presets { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }
.preset {
  min-height: 40px; padding: 0 var(--space-3); border: 1px solid var(--color-border); border-radius: 999px;
  background: var(--color-surface-2); color: var(--color-text-muted); font-size: var(--text-xs); letter-spacing: 0.06em; white-space: nowrap;
  transition: color 120ms, border-color 120ms, background 120ms;
}
.preset:hover { color: var(--color-text); border-color: #4a4a4a; }
.preset[aria-pressed="true"] { color: #111; background: var(--color-amber); border-color: var(--color-amber); font-weight: 700; }

.grid-scroll { overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--color-border-dim); border-radius: var(--radius); background: var(--color-well); scrollbar-color: #444 transparent; }
.seq { --steps: 16; display: grid; grid-template-columns: var(--label-w) repeat(var(--steps), minmax(26px, 1fr)); min-width: 100%; width: max-content; position: relative; }
.seq-ruler { display: contents; }
.ruler-corner { position: sticky; left: 0; z-index: 3; background: var(--color-well); border-bottom: 1px solid var(--color-border-dim); }
.ruler-cell { height: 26px; display: flex; align-items: center; justify-content: center; font-size: var(--text-2xs); color: var(--color-text-faint); border-bottom: 1px solid var(--color-border-dim); font-variant-numeric: tabular-nums; }
.ruler-cell.beat { color: var(--color-text-muted); font-weight: 700; }
.ruler-cell.now { color: var(--color-amber); }
.lane-head {
  position: sticky; left: 0; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 0 8px;
  background: linear-gradient(90deg, #121212 85%, rgba(18,18,18,0.92)); border-right: 1px solid var(--color-border-dim);
  border-bottom: 1px solid #161616;
}
.lane-name {
  flex: 1; min-width: 0; height: var(--lane-h); display: flex; align-items: center; gap: 8px; padding: 0 6px; border-radius: 3px;
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lane); text-align: left; white-space: nowrap; overflow: hidden;
}
.lane-name::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--lane); box-shadow: 0 0 6px color-mix(in srgb, var(--lane) 60%, transparent); }
.lane-name:hover { background: rgba(255,255,255,0.04); }
.ln-short { display: none; }
.lane-mute {
  flex: none; width: 30px; height: 26px; border: 1px solid var(--color-border); border-radius: 3px;
  font-size: var(--text-2xs); font-weight: 700; color: var(--color-text-faint); letter-spacing: 0.05em;
}
.lane-mute:hover { color: var(--color-text); border-color: #555; }
.lane-mute[aria-pressed="true"] { background: #3a1414; border-color: #9f1d1d; color: #fca5a5; }
.lane-head.muted .lane-name { opacity: 0.4; }
.cell {
  height: var(--lane-h); padding: 4px 2px; border-bottom: 1px solid #161616; position: relative;
  display: flex; align-items: stretch; justify-content: stretch;
}
.cell::before { content: ''; flex: 1; border-radius: 3px; background: #1d1d1d; border: 1px solid #262626; transition: background 80ms, box-shadow 120ms, border-color 80ms; }
.cell.beat-col::before { background: #222; border-color: #2c2c2c; }
.cell.bar-start { border-left: 1px solid #3a3a3a; }
.cell:hover::before { border-color: #4a4a4a; }
.cell[aria-pressed="true"]::before { background: var(--lane); border-color: color-mix(in srgb, var(--lane) 70%, #fff); box-shadow: 0 0 10px color-mix(in srgb, var(--lane) 45%, transparent), inset 0 1px 0 rgba(255,255,255,0.3); }
.cell.muted[aria-pressed="true"]::before { opacity: 0.35; box-shadow: none; }
.cell.now::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.06); pointer-events: none; }
.cell.now[aria-pressed="true"]::before { filter: brightness(1.35); }
.cell:focus-visible { outline: none; }
.cell:focus-visible::before { outline: 2px solid var(--color-amber); outline-offset: 1px; }
.grid-foot { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-3); font-size: var(--text-xs); color: var(--color-text-faint); }
.grid-swipe { display: none; color: var(--color-text-muted); }
.grid-swipe::before { content: '⇆ '; }

/* =============================================
   SHORTCUTS + FOOTER
   ============================================= */
.shortcuts { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-6); margin-top: var(--space-5); font-size: var(--text-xs); color: var(--color-text-muted); }
.shortcuts kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--color-border); border-bottom-color: #0d0d0d; border-radius: 3px; background: var(--color-surface-2); color: var(--color-amber); font-family: var(--font-mono); font-size: var(--text-2xs); text-align: center; }
.footer { margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--color-border-dim); text-align: center; font-size: var(--text-2xs); color: var(--color-text-faint); letter-spacing: 0.12em; text-transform: uppercase; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (min-width: 1600px) {
  :root { --lane-h: 38px; }
}
@media (min-width: 1101px) {
  /* side by side: the pads stretch to the console's height, so neither panel has a gap at the bottom */
  .pads-panel { display: flex; flex-direction: column; }
  .pads-grid { flex: 1; grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .drum-pad { aspect-ratio: auto; height: 100%; min-height: 120px; }
}
@media (max-width: 1100px) {
  .deck { grid-template-columns: 1fr; }
  .drum-pad { aspect-ratio: 2.3; }
}
@media (max-width: 900px) {
  .pattern-head { align-items: flex-start; flex-direction: column; }
  .presets { justify-content: flex-start; }
}
@media (hover: none) and (pointer: coarse) {
  .shortcuts, .grid-tip, .pad-key { display: none; }
  .panel-hint::after { content: ''; }
}
@media (max-width: 640px) {
  :root { --label-w: 118px; --lane-h: 44px; }
  .slider { height: 44px; }
  .shortcuts, .grid-tip, .pad-key { display: none; }
  .ln-full { display: none; }
  .ln-short { display: inline; }
  .tempo { display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .tempo-buttons { grid-column: 1 / -1; }
  .beat-lights { grid-row: 1; grid-column: 2; }
  .tempo-buttons .knob-btn { flex: 1; }
  .app { padding: var(--space-3) var(--space-4) var(--space-8); }
  .topbar { margin-bottom: var(--space-4); padding-bottom: var(--space-3); }
  .topbar-meta { display: none; }
  .brand-sub { letter-spacing: 0.08em; }
  .panel { padding: var(--space-4); }
  .deck { gap: var(--space-4); margin-bottom: var(--space-4); }
  .drum-pad { aspect-ratio: 1.15; min-height: 84px; }
  .pads-grid { gap: var(--space-2); }
  .panel-hint { display: none; }
  .tempo { gap: var(--space-3); }
  .tempo-readout { min-width: 0; }
  .beat-lights { margin-left: auto; }
  .console-row.two-col { flex-direction: column; align-items: stretch; }
  .transport { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .export-row { flex-direction: column; }
  .export-group { width: 100%; }
  .export-group .t-btn { flex: 1; }
  .t-ghost { width: 100%; }
  .seq { grid-template-columns: var(--label-w) repeat(var(--steps), 44px); }
  .lane-mute { width: 44px; height: 44px; }
  .lane-name { height: 44px; padding: 0 2px; gap: 6px; letter-spacing: 0.06em; }
  .lane-head { padding: 0 6px; gap: 4px; }
  .presets { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; margin-bottom: -4px; scrollbar-width: none; }
  .presets::-webkit-scrollbar { display: none; }
  .preset { min-height: 44px; }
  .grid-swipe { display: inline; }
  .pattern-name { font-size: var(--text-lg); }
}
@media (max-width: 380px) {
  .tempo-buttons .knob-btn { min-width: 44px; padding: 0 var(--space-2); }
  .tempo-label { font-size: var(--text-base); }
}
@media (prefers-reduced-motion: reduce) {
  .t-rec[aria-pressed="true"], .t-rec.armed, .status-led.rec { animation: none; }
}
