:root {
  --bg: #0a0a10;
  --surface: #14141d;
  --surface-2: #1a1a26;
  --border: #2a2a3a;
  --ink: #eef0f8;
  --ink-soft: #8f92a8;
  --accent: #b16cff;
  --accent-bright: #d19bff;
  --on-accent: #1a0630;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

.topbar { display: flex; align-items: baseline; gap: 0.7rem; padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border); }
.wordmark { font-weight: 800; letter-spacing: 0.12em; color: var(--accent-bright); }
.tagline { font-size: 0.82rem; color: var(--ink-soft); }

main { max-width: 960px; margin: 0 auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.2rem; }

.presets { display: flex; gap: 0.6rem; }
.preset-btn { flex: 1; background: var(--surface); border: 1px solid var(--border); color: var(--ink-soft); padding: 0.7rem; border-radius: 8px; font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.preset-btn.active { border-color: var(--accent); color: var(--accent-bright); background: var(--surface-2); }

#scope { width: 100%; height: 120px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem; }
.control-group { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; }
.control-group h3 { margin: 0 0 0.7rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-bright); }
.control-group label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 0.7rem; position: relative; }
.control-group label:last-child { margin-bottom: 0; }
.control-group input[type="range"] { accent-color: var(--accent); }
.control-group span { position: absolute; right: 0; top: 0; color: var(--ink); font-weight: 600; font-size: 0.72rem; }

.keys { display: flex; position: relative; height: 130px; background: var(--surface); border-radius: 8px; border: 1px solid var(--border); overflow: hidden; user-select: none; }
.key { flex: 1; border: 1px solid var(--border); background: #fdfdfd; cursor: pointer; }
.key.black { position: absolute; width: 6%; height: 60%; background: #17171f; border: 1px solid #000; z-index: 2; border-radius: 0 0 4px 4px; }
.key.active { background: var(--accent-bright) !important; }
.key.black.active { background: var(--accent) !important; }

.hint { font-size: 0.78rem; color: var(--ink-soft); text-align: center; margin: 0; }

.seq-section { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; }
.seq-section h3 { margin: 0 0 0.8rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-bright); }
.seq-controls { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 0.9rem; font-size: 0.8rem; color: var(--ink-soft); }
.seq-btn { background: var(--accent); color: var(--on-accent); border: none; padding: 0.5rem 1.1rem; border-radius: 6px; font-weight: 700; font-size: 0.82rem; cursor: pointer; }
.seq-btn.playing { background: #ff5c6a; }
.seq-btn-ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); }
.seq-tempo-label { display: flex; align-items: center; gap: 0.4rem; }
.seq-oct-controls { display: flex; align-items: center; gap: 0.4rem; }
.seq-btn-small { background: var(--surface-2); border: 1px solid var(--border); color: var(--ink); width: 24px; height: 24px; border-radius: 5px; cursor: pointer; font-weight: 700; }

.seq-grid { display: grid; grid-template-columns: repeat(var(--seq-steps, 16), 1fr); grid-auto-rows: 16px; gap: 2px; margin-bottom: 0.7rem; overflow-x: auto; }
.seq-cell { background: var(--surface-2); border-radius: 2px; cursor: pointer; }
.seq-cell.beat-start { box-shadow: inset 2px 0 0 rgba(209, 155, 255, 0.25); }
.seq-cell.on { background: var(--accent); }
.seq-cell.playing { outline: 2px solid var(--accent-bright); outline-offset: -2px; }
.seq-cell.on.playing { background: var(--accent-bright); }

.footer-credit { text-align: center; font-size: 0.78rem; color: var(--ink-soft); margin: 0.5rem 0 1rem; }
.footer-credit a { color: var(--accent-bright); text-decoration: none; font-weight: 600; }
