:root {
  --bg: #111318;
  --surface: #1a1d24;
  --surface-2: #232733;
  --line: #2e3340;
  --text: #eef0f4;
  --muted: #8b92a3;
  --accent: #ff7a3d;
  --accent-2: #ffb380;
  --fill: #6aa8ff;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 760px; margin: 0 auto; padding: 16px 18px 4px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: .2px; }
.brand svg { width: 26px; height: 26px; color: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: 8px 18px 40px; }
section { margin-top: 14px; }
.label {
  font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); margin: 0 0 8px;
}

/* Style chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface);
  padding: 9px 15px; border-radius: 999px; font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.chip[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #1a0d05; }

/* Track cards */
.tracks { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.track {
  text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 14px; min-height: 74px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  transition: border-color .15s, background .15s;
}
.track .name { font-weight: 650; }
.track .meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.track[aria-pressed="true"] { border-color: var(--accent); background: linear-gradient(180deg, #2a1f1a, var(--surface)); }
.track[aria-pressed="true"] .name { color: var(--accent-2); }
.track .num { opacity: .5; }

/* Transport */
.transport {
  margin-top: 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 18px;
}
.now { display: flex; justify-content: space-between; align-items: flex-start; }
.now-style { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.now-track { font-size: 20px; font-weight: 700; margin-top: 2px; }
.counter { text-align: right; line-height: 1; }
.counter span { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.counter small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.counter.countin span { color: var(--fill); }

.steps { display: flex; gap: 4px; margin: 16px 0 6px; height: 14px; }
.steps .beat { flex: 1; display: flex; gap: 3px; }
.steps i { flex: 1; border-radius: 3px; background: var(--surface-2); transition: background .06s; }
.steps i.down { background: #333949; }
.steps i.on { background: var(--accent); }
.steps.fill i.on { background: var(--fill); }
.steps.countin i.on { background: var(--fill); }

.tempo { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 10px; }
.bpm { display: flex; flex-direction: column; align-items: center; }
.bpm input {
  width: 3.4em; text-align: center; background: none; border: none; outline: none;
  font-size: 56px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1; padding: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.bpm input::-webkit-outer-spin-button, .bpm input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bpm span { font-size: 11px; color: var(--muted); letter-spacing: 1.5px; }
.round {
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface-2); font-size: 26px; line-height: 1;
}
.round:active { background: var(--line); }

input[type=range] { width: 100%; accent-color: var(--accent); margin: 14px 0 4px; }

.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-top: 12px; }
.ghost {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 10px; font-weight: 650;
}
.ghost:active { background: var(--line); }
.ghost.small { padding: 7px 12px; font-size: 13px; }
.ghost.flash { border-color: var(--fill); color: var(--fill); }
.play {
  width: 84px; height: 84px; border-radius: 50%; border: none;
  background: var(--accent); color: #1a0d05; display: grid; place-items: center;
  box-shadow: 0 8px 30px -8px rgba(255, 122, 61, .6);
  transition: transform .08s;
}
.play:active { transform: scale(.96); }
.play svg { width: 36px; height: 36px; }
.play .i-stop { display: none; }
.play.playing .i-play { display: none; }
.play.playing .i-stop { display: block; }

/* Options */
.panel { margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; }
.panel summary { padding: 12px 0; font-weight: 650; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.panel summary::after { content: "▾"; color: var(--muted); }
.panel[open] summary::after { content: "▴"; }
.panel .grid { display: grid; gap: 4px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line); }
.row input[type=range] { max-width: 50%; margin: 0; }
select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(18px); background: #fff; }
.panel h3 { margin-top: 12px; }
.mutes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-bottom: 14px; }
.mutes button { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 4px; font-weight: 600; font-size: 13px; }
.mutes button[aria-pressed="false"] { opacity: .4; text-decoration: line-through; }

.hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
@media (hover: none) { .hint { display: none; } }
@media (max-width: 420px) {
  .bpm input { font-size: 48px; }
  .tracks { grid-template-columns: 1fr 1fr; }
}
