/* Breakpad styles: three skins (graphite, hardware, paper) over one layout of two 4x4 pad grids. */
:root {
  --accent: #3ee6b0;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --pad-r: 14px;
}

.skin-graphite {
  --bg: #0b0b0c; --body: #121214; --line: #232327; --pad: #1c1c1f; --pad-edge: #26262a;
  --text: #ececee; --mute: #7c7c84; --faint: #3a3a40; --chip: #18181b; --display: #0f0f11;
  --pad-shadow: inset 0 1px 0 rgba(255,255,255,.035), inset 0 -2px 0 rgba(0,0,0,.4);
  --lit-text: #0b0b0c;
}
.skin-hardware {
  --bg: #0d0d0d; --body: color-mix(in srgb, var(--accent) 16%, #151515); --line: color-mix(in srgb, var(--accent) 20%, #2a2a2a);
  --pad: #2a2a2c; --pad-edge: #1a1a1b; --text: #f2f2f2; --mute: color-mix(in srgb, var(--accent) 35%, #9a9a9a); --faint: #444;
  --chip: #161616; --display: #0a0c0b;
  --pad-shadow: inset 0 2px 0 rgba(255,255,255,.06), inset 0 -3px 0 rgba(0,0,0,.45), 0 2px 0 rgba(0,0,0,.5);
  --lit-text: #0b0b0c;
  --pad-r: 10px;
}
.skin-paper {
  --bg: #efede7; --body: #f7f6f2; --line: #dcd8cf; --pad: #e4e0d7; --pad-edge: #d6d1c6;
  --text: #1b1b1b; --mute: #7d786d; --faint: #c9c4b8; --chip: #ebe8e1; --display: #ffffff;
  --pad-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -2px 0 rgba(0,0,0,.06);
  --lit-text: #111;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  -webkit-font-smoothing: antialiased; overflow: hidden; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background .4s var(--ease), color .4s var(--ease);
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
kbd { font-family: var(--mono); font-size: 10px; color: var(--mute); margin-left: 6px; }

.app {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) 22px max(10px, env(safe-area-inset-bottom)); gap: 14px;
}

.top { width: min(1180px, 100%); display: flex; align-items: center; gap: 16px; }
.brand { font-size: 17px; font-weight: 300; letter-spacing: -.01em; flex: 1; }
.skins { display: flex; gap: 2px; background: var(--chip); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.skins button { font-size: 12px; padding: 5px 11px; border-radius: 999px; color: var(--mute); transition: color .2s, background .2s; }
.skins button.on { background: var(--text); color: var(--bg); }
.help-btn { font-size: 12px; color: var(--mute); padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); }
.help-btn:hover { color: var(--text); }

.device {
  width: min(1180px, 100%); background: var(--body); border: 1px solid var(--line); border-radius: 26px;
  padding: 20px 22px 18px; display: flex; flex-direction: column; gap: 18px;
  transition: background .5s var(--ease), border-color .5s var(--ease);
}
.skin-hardware .device { border-radius: 18px; box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 30px 60px rgba(0,0,0,.45); }

.display {
  position: relative; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(160px, 1.1fr) auto;
  align-items: center; gap: 22px; padding: 14px 18px; border-radius: 16px; background: var(--display);
  border: 1px solid var(--line); min-height: 86px; overflow: hidden;
}
.skin-hardware .display { border-radius: 8px; border-color: #000; box-shadow: inset 0 2px 8px rgba(0,0,0,.8); }
.kitname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kit-text { min-width: 0; flex: 1; }
.kitname .name { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
.kitname .key { font-size: 12px; color: var(--mute); margin-top: 6px; letter-spacing: .02em; }
.arrow { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--mute); border: 1px solid var(--line); flex: none; transition: color .2s, transform .15s; }
.arrow:hover { color: var(--text); }
.arrow:active { transform: scale(.9); }
.arrow svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.scope { width: 100%; height: 48px; display: block; }
.meters { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.tempo { display: flex; align-items: baseline; gap: 6px; font-family: var(--mono); }
.tempo span { font-size: 24px; font-variant-numeric: tabular-nums; }
.tempo small { font-size: 10px; color: var(--mute); }
.tempo button { width: 22px; height: 22px; border-radius: 6px; color: var(--mute); border: 1px solid var(--line); font-family: var(--mono); font-size: 13px; line-height: 1; align-self: center; }
.tempo button:hover { color: var(--text); }
.pos { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--mute); }
.pos span { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.steps { display: grid; grid-template-columns: repeat(16, 5px); gap: 3px; }
.steps i { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); transition: background .08s; }
.steps i:nth-child(4n+1) { background: color-mix(in srgb, var(--faint) 60%, var(--mute)); }
.steps i.on { background: var(--accent); }
.filter { position: absolute; left: 18px; right: 18px; bottom: 0; height: 2px; }
.filter span { position: absolute; top: 0; height: 2px; background: var(--accent); left: 50%; width: 0; transition: width .06s linear, left .06s linear; }
.status { position: absolute; right: 18px; top: 8px; font-size: 10px; letter-spacing: .12em; color: var(--accent); text-transform: uppercase; opacity: 0; transition: opacity .3s; }
.status.on { opacity: 1; }

.banks { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; position: relative; }
.bank { position: relative; }
.bank-label { font-size: 10px; letter-spacing: .16em; color: var(--mute); margin: 0 0 8px 2px; }
.grid {
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: 10px;
  aspect-ratio: 1.42; position: relative;
}
.pad {
  position: relative; border-radius: var(--pad-r); background: var(--pad); box-shadow: var(--pad-shadow);
  border: 1px solid var(--pad-edge); overflow: hidden; touch-action: none; cursor: pointer;
  transition: transform .14s var(--ease), background .4s var(--ease), border-color .4s;
  will-change: transform;
}
.pad.down { transform: scale(.955); transition-duration: .04s; }
.pad .light { position: absolute; inset: 0; background: var(--accent); opacity: 0; pointer-events: none; }
.pad.fx .light { background: color-mix(in srgb, var(--accent) 70%, #ffffff); }
.pad.held .light { opacity: .82; }
.pad .lab { position: absolute; left: 11px; bottom: 9px; right: 30px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; mix-blend-mode: normal; }
.pad .sub { position: absolute; left: 11px; top: 9px; font-size: 10px; color: var(--mute); font-family: var(--mono); }
.pad .k { position: absolute; right: 10px; top: 8px; font-family: var(--mono); font-size: 10px; color: var(--mute); }
.pad.flash .lab, .pad.held .lab, .pad.flash .k, .pad.held .k, .pad.flash .sub, .pad.held .sub { color: var(--lit-text); }
.skin-hardware .pad .lab { color: #d8d8d8; }
.skin-hardware .pad.flash .lab, .skin-hardware .pad.held .lab { color: #0b0b0c; }
.pad.empty { opacity: .35; }
.pad.chop .sub b { color: var(--text); font-weight: 600; }

.finger { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 2px solid var(--text); pointer-events: none; opacity: .8; transition: opacity .2s; z-index: 3; }

.bank-tabs { display: none; }

.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.play {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 18px 0 14px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; transition: transform .12s var(--ease), background .3s;
}
.play:active { transform: scale(.95); }
.play svg { width: 14px; height: 14px; fill: currentColor; }
.play .i-stop { display: none; }
.playing .play .i-play { display: none; }
.playing .play .i-stop { display: block; }
.layers { display: flex; gap: 6px; }
.layers button, .drop {
  height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--mute);
  display: inline-flex; align-items: center; gap: 7px; transition: color .2s, border-color .2s, background .2s, transform .12s var(--ease);
}
.layers button:active, .drop:active { transform: scale(.95); }
.layers button i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); transition: background .2s; }
.layers button.on { color: var(--text); }
.layers button.on i { background: var(--accent); }
.drop { color: var(--text); }
.drop.armed { border-color: var(--accent); color: var(--accent); }
.drop.pending { animation: blink .35s steps(2) infinite; }
@keyframes blink { 50% { border-color: var(--line); } }
.tp { display: none; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--mute); align-items: center; gap: 7px; transition: color .2s, border-color .2s; }
.tp i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); transition: background .2s; }
.native .tp { display: inline-flex; }
.captured .tp { color: var(--accent); border-color: var(--accent); }
.captured .tp i { background: var(--accent); }
.roll { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--mute); }
.roll span { font-size: 10px; letter-spacing: .14em; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line); transition: all .15s; }
.roll.on span { background: var(--accent); color: var(--lit-text); border-color: var(--accent); }
.roll b { font-weight: 400; font-family: var(--mono); font-size: 11px; }

.kits { width: min(1180px, 100%); display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.kits::-webkit-scrollbar { display: none; }
.kits button {
  flex: none; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mute);
  padding: 8px 14px; border-radius: 999px; transition: color .2s, background .2s;
}
.kits button i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); opacity: .35; transition: opacity .2s, transform .3s var(--ease); }
.kits button:hover { color: var(--text); }
.kits button.on { color: var(--text); background: var(--chip); box-shadow: inset 0 0 0 1px var(--line); }
.kits button.on i { opacity: 1; transform: scale(1.3); }
.kits button.loading i { animation: pulse .6s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .1; } }

.hint { font-size: 11px; color: var(--mute); letter-spacing: .02em; }
.captured .hint::after { content: "  ·  Touchpad: stukaj palcami, Tab wychodzi"; color: var(--accent); }

.help { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 10; animation: fade .2s var(--ease); }
.help[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.help-card { background: var(--body); border: 1px solid var(--line); border-radius: 20px; padding: 24px 28px; width: min(560px, 92vw); animation: rise .35s var(--ease); }
@keyframes rise { from { transform: translateY(12px) scale(.98); filter: blur(6px); opacity: 0; } }
.help-card h2 { margin: 0 0 14px; font-size: 18px; font-weight: 600; }
.help-card h3 { font-size: 11px; color: var(--mute); font-weight: 500; letter-spacing: .08em; margin: 0 0 6px; text-transform: uppercase; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.help-card pre { font-family: var(--mono); font-size: 15px; margin: 0; letter-spacing: .3em; line-height: 1.6; }
.help-card ul { padding: 0; list-style: none; margin: 16px 0; font-size: 13px; line-height: 1.9; color: var(--mute); }
.help-card li kbd { color: var(--text); margin: 0 2px 0 0; font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.help-card > button { height: 34px; padding: 0 16px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600; }

.enter { animation: enter .6s var(--ease) both; }
@keyframes enter { from { opacity: 0; filter: blur(8px); transform: scale(.92); } }
.relabel .lab, .relabel .sub { animation: relabel .45s var(--ease) both; }
@keyframes relabel { from { opacity: 0; filter: blur(4px); transform: translateY(4px); } }
.kitname .name.swap { animation: swap .5s var(--ease) both; }
@keyframes swap { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

@media (max-height: 820px) and (min-width: 821px) {
  .device { padding: 14px 18px 14px; gap: 14px; }
  .grid { gap: 8px; }
  .app { gap: 10px; }
  .display { min-height: 74px; padding: 10px 16px; }
  .kitname .name { font-size: 26px; }
}
@media (max-height: 700px) and (min-width: 821px) {
  .grid { aspect-ratio: 1.75; }
  .hint { display: none; }
}

@media (max-width: 820px) {
  .app { padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); gap: 10px; justify-content: flex-start; }
  .top { gap: 8px; }
  .help-btn, .hint, .roll, .layers kbd, .drop kbd { display: none; }
  .skins button { padding: 5px 9px; font-size: 11px; }
  .device { padding: 12px; gap: 12px; border-radius: 22px; flex: 1; }
  .display { grid-template-columns: 1fr auto; gap: 10px; padding: 10px 12px; min-height: 0; }
  .scope { display: none; }
  .kitname { gap: 6px; }
  .kitname .name { font-size: 20px; overflow: hidden; text-overflow: ellipsis; }
  .kitname .key { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
  .arrow { width: 26px; height: 26px; }
  .status { top: auto; bottom: 5px; right: 12px; font-size: 9px; }
  .tempo span { font-size: 20px; }
  .tempo small { display: none; }
  .steps { grid-template-columns: repeat(16, 4px); gap: 2px; }
  .steps i { width: 4px; height: 4px; }
  .pad .lab { left: 8px; right: 6px; bottom: 7px; font-size: 9.5px; letter-spacing: .04em; }
  .pad .sub { left: 8px; top: 7px; }
  .banks { grid-template-columns: 1fr; flex: 1; }
  .bank { display: none; }
  .bank.show { display: flex; flex-direction: column; }
  .bank-label { display: none; }
  .grid { aspect-ratio: auto; flex: 1; gap: 8px; }
  .pad .k { display: none; }
  .bank-tabs { display: flex; gap: 4px; background: var(--chip); border-radius: 999px; padding: 3px; border: 1px solid var(--line); }
  .bank-tabs button { flex: 1; font-size: 13px; padding: 8px; border-radius: 999px; color: var(--mute); }
  .bank-tabs button.on { background: var(--text); color: var(--bg); }
  .controls { gap: 6px; }
  .layers { flex-wrap: wrap; }
  .layers button, .drop, .play { height: 34px; padding: 0 11px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .enter, .relabel .lab, .relabel .sub, .kitname .name.swap { animation: none; }
}
