/* Układ: scena 3D jako parkiet po lewej, pulpit sterowania po prawej; na telefonie pulpit pod sceną. */
:root {
  --bg: #e7ecf1;
  --surface: #f7f9fb;
  --surface-2: #edf1f5;
  --ink: #17202b;
  --muted: #586577;
  --line: #cdd5de;
  --accent: #8a5b00;
  --accent-ink: #ffffff;
  --left: #2f6fd6;
  --right: #cf4c22;
  --skirt: #9b3d63;
  --scene-bg: #dde4ea;
  --hud-bg: rgba(247, 249, 251, 0.82);
  --hud-ink: #17202b;
  --danger: #b42318;
  --ok: #1f7a4d;
  --focus: #2f6fd6;

  --font-ui: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-count: "Archivo", "Arial Narrow", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;
  --radius: 10px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1318; --surface: #161c23; --surface-2: #1d252e; --ink: #e6eaef; --muted: #98a4b3;
    --line: #2a3440; --accent: #e2b04a; --accent-ink: #1b1406; --left: #6d9fff; --right: #ff8b5e; --skirt: #e48ab0;
    --scene-bg: #141a21; --hud-bg: rgba(22, 28, 35, 0.8); --hud-ink: #e6eaef; --danger: #ff7b6e; --ok: #5fd39a;
    --focus: #8fb6ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1318; --surface: #161c23; --surface-2: #1d252e; --ink: #e6eaef; --muted: #98a4b3;
  --line: #2a3440; --accent: #e2b04a; --accent-ink: #1b1406; --left: #6d9fff; --right: #ff8b5e; --skirt: #e48ab0;
  --scene-bg: #141a21; --hud-bg: rgba(22, 28, 35, 0.8); --hud-ink: #e6eaef; --danger: #ff7b6e; --ok: #5fd39a;
  --focus: #8fb6ff; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 var(--font-ui);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Pasek górny ---------- */
.topbar { grid-row: 1; }
.boot-error { grid-row: 2; }
.layout { grid-row: 3; }
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-block: 10px;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 50%;
  background:
    radial-gradient(circle at 35% 70%, var(--left) 0 26%, transparent 27%),
    radial-gradient(circle at 68% 32%, var(--right) 0 26%, transparent 27%),
    var(--surface-2);
  border: 1px solid var(--line);
}
.brand-name { font-weight: 800; font-stretch: 112%; letter-spacing: 0.02em; font-size: 18px; }
.pickers { flex: 1 1 520px; min-width: 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.picker { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.picker-mode { flex: 0 0 auto; }
.picker-class { flex: 0 1 220px; }
.picker-type { flex: 0 1 190px; }
.picker-figure { flex: 1 1 260px; }
.picker-role { flex: 0 0 auto; }
.picker select { width: 100%; }
.picker-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; }
.seg {
  border: 0; background: transparent; border-radius: 6px; padding: 0 12px; min-height: 32px; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--muted);
}
.seg.is-on { background: var(--ink); color: var(--surface); }
.seg:disabled { opacity: .4; cursor: not-allowed; }
.load-actions { display: flex; gap: 8px; }
.load-actions .btn { flex: 1 1 0; }

select, input[type="number"] {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; min-height: 40px;
}

.boot-error {
  display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline;
  padding-block: 10px;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  background: var(--surface-2); border-bottom: 2px solid var(--danger); font-size: 14px;
}
.boot-error strong { color: var(--danger); }

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); cursor: pointer; text-decoration: none;
  font-weight: 600; white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn[aria-disabled="true"] { pointer-events: none; }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.icon { width: 40px; padding: 0; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Układ ---------- */
.layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 14px;
  padding-block: 14px;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}

/* ---------- Scena ---------- */
.stage {
  min-height: 0; min-width: 0;
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  border-radius: var(--radius); overflow: hidden;
  background: var(--scene-bg);
  border: 1px solid var(--line);
}
.stage-view { position: relative; min-height: 0; touch-action: none; }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage-bar {
  display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap;
  padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--line);
}
.captions { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.hud { position: absolute; inset: 0; pointer-events: none; color: var(--hud-ink); }
.hud-meta {
  position: absolute; left: 12px; top: 12px; max-width: calc(100% - 170px);
  background: var(--hud-bg); border-radius: 8px; padding: 8px 12px;
  backdrop-filter: blur(6px);
}
.hud-name { font-weight: 700; font-size: 15px; line-height: 1.25; text-wrap: balance; }
.hud-meter { font-size: 12.5px; color: var(--muted); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }

.counter {
  position: absolute; right: 12px; top: 12px; width: 132px;
  background: var(--hud-bg); border-radius: 12px; padding: 6px 10px 10px;
  text-align: center; backdrop-filter: blur(6px);
}
.counter-beat {
  font-family: var(--font-count); font-weight: 850; font-stretch: 70%;
  font-size: 96px; line-height: 1; font-variant-numeric: tabular-nums;
  transition: transform .08s ease-out, color .08s;
}
.counter.is-one .counter-beat { color: var(--accent); }
.counter.pulse .counter-beat { transform: scale(1.08); }
.counter.is-lead .counter-beat { color: var(--muted); }
.counter-dots { display: flex; justify-content: center; gap: 6px; margin-top: 2px; }
.counter-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.counter-dots i.on { background: var(--ink); }
.counter-dots i.on.first { background: var(--accent); }
.counter-bar { font-size: 12px; color: var(--muted); margin-top: 6px; letter-spacing: 0.05em; font-variant-numeric: tabular-nums; }

.caption { min-width: 0; }
.caption + .caption { border-top: 1px dashed var(--line); padding-top: 6px; }
.caption-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-tag {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 2px 8px; border-radius: 4px; border: 1px solid currentColor;
}
.role-tag.partner { color: var(--ink); }
.role-tag.partnerka { color: var(--skirt); }
.count-chip {
  font-family: var(--font-count); font-weight: 800; font-stretch: 85%;
  font-size: 22px; min-width: 2ch; font-variant-numeric: tabular-nums;
}
.foot-chip {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 2px 8px; border-radius: 999px; color: #fff;
}
.foot-chip.l { background: var(--left); }
.foot-chip.r { background: var(--right); }
.step-no { font-size: 12.5px; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.caption-text { margin: 2px 0 0; font-size: 15.5px; line-height: 1.35; min-height: 1.35em; }

.views {
  display: flex; gap: 4px; flex-wrap: wrap; flex: 0 0 auto;
  background: var(--surface-2); border-radius: 9px; padding: 3px;
}
.view-btn {
  border: 0; background: transparent; border-radius: 7px; padding: 5px 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--hud-ink);
}
.view-btn.is-on { background: var(--ink); color: var(--surface); }

.drop-hint {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border: 3px dashed var(--accent); border-radius: var(--radius);
  font-weight: 700; font-size: 20px; pointer-events: none;
}
.drop-hint span { background: var(--surface); padding: 10px 16px; border-radius: 8px; }
.rec-badge {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  background: var(--danger); color: #fff; font-weight: 700; padding: 4px 12px; border-radius: 999px;
  font-size: 13px; letter-spacing: 0.04em;
}

/* ---------- Pulpit ---------- */
.panel {
  min-height: 0; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column;
}
.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.tab {
  border: 0; background: transparent; padding: 12px 8px; cursor: pointer; font-weight: 700;
  color: var(--muted); border-bottom: 3px solid transparent;
}
.tab.is-on { color: var(--ink); border-bottom-color: var(--accent); }
.tabpanel { padding: 14px; display: flex; flex-direction: column; gap: 14px; }

.transport { display: flex; gap: 8px; flex-wrap: wrap; }
.transport .play { flex: 1 1 110px; }
.play .i-pause { display: none; }
.play.is-playing .i-pause { display: block; }
.play.is-playing .i-play { display: none; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; }
.field label { font-weight: 600; font-size: 14px; }
.field output { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

.steps-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.steps-head h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.steps-legend { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.l { background: var(--left); }
.dot.r { background: var(--right); }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.steps li { margin: 0; }
.step-item {
  width: 100%; text-align: left; display: grid; grid-template-columns: 26px 46px 1fr; gap: 8px; align-items: start;
  padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer;
}
.step-item:hover { background: var(--surface-2); }
.step-item.is-current { background: var(--surface-2); border-color: var(--accent); }
.step-item .n {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums;
}
.step-item .n.l { background: var(--left); }
.step-item .n.r { background: var(--right); }
.step-item .c { font-family: var(--font-count); font-weight: 800; font-stretch: 85%; font-size: 17px; line-height: 24px; font-variant-numeric: tabular-nums; }
.step-item .d { font-size: 14px; line-height: 1.35; min-width: 0; }
.step-item .meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.step-item .who { font-weight: 700; }
.step-item .who.k { color: var(--skirt); }
.step-item .other { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.dance-note { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }

.lead { margin: 0; color: var(--muted); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.render-info { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.render-actions { display: flex; gap: 8px; }
.progress { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; font-size: 14px; }
.progress-bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.progress-bar div { height: 100%; width: 0; background: var(--accent); }
.render-result { display: flex; flex-direction: column; gap: 10px; }
.render-result video { width: 100%; max-width: 100%; border-radius: 8px; background: #000; }
.render-result-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }

.messages { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.msg { border-radius: 8px; padding: 10px 12px; font-size: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.msg.error { border-color: var(--danger); }
.msg.error strong { color: var(--danger); }
.msg.ok strong { color: var(--ok); }
.msg ul { margin: 6px 0 0; padding-left: 18px; }
.msg-close { float: right; border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; padding: 0 0 0 8px; }

/* ---------- Dialog wklejania ---------- */
.dialog {
  width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  border: 1px solid var(--line); border-radius: 12px; padding: 0;
  background: var(--surface); color: var(--ink);
}
.dialog::backdrop { background: rgba(10, 14, 20, 0.5); }
.dialog-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.dialog h2 { margin: 0; font-size: 19px; }
.hint { margin: 0; color: var(--muted); font-size: 14px; }
code { font-family: var(--font-mono); font-size: 0.9em; }
textarea {
  width: 100%; min-height: 260px; resize: vertical;
  font: 13px/1.5 var(--font-mono);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px;
}
.paste-errors:empty { display: none; }
.paste-errors { color: var(--danger); font-size: 14px; max-height: 160px; overflow: auto; }
.paste-errors ul { margin: 0; padding-left: 18px; }
.dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Ikona po kliknięciu animacji (pauza / wznowienie) ---------- */
.tap-icon {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px;
  border-radius: 50%; background: rgba(10, 14, 20, 0.55); color: #fff;
  display: grid; place-items: center; pointer-events: none; opacity: 0; transform: scale(0.8);
}
.tap-icon svg { width: 38px; height: 38px; fill: currentColor; grid-area: 1 / 1; }
.tap-icon .i-pause { display: none; }
.tap-icon.is-pause .i-pause { display: block; }
.tap-icon.is-pause .i-play { display: none; }
.tap-icon.show { animation: tap-pop .6s ease-out; }
@keyframes tap-pop {
  0% { opacity: 0; transform: scale(0.8); }
  20% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  .tap-icon.show { animation-duration: .9s; animation-timing-function: steps(1, end); }
}

/* ---------- Pasek tytułu i miejsce na przyciski (używane na telefonie) ---------- */
.stage-head { display: none; }
.transport-slot:empty { display: none; }
/* na komputerze grupa nie zmienia układu panelu; na telefonie trafia pod scenę */
/* ---------- Układy: lista figur i plansze ---------- */
.routine-panel { display: flex; flex-direction: column; gap: 8px; }
.routine-edit { font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 700; }
.routine-edit:hover { text-decoration: underline; }
.routine-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.routine-list li {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid transparent; font-size: 14px; cursor: pointer;
}
.routine-list li .no { font-weight: 800; color: var(--muted); min-width: 1.6em; }
.routine-list li.is-board { background: transparent; border: 1px dashed var(--line); color: var(--muted); font-style: italic; }
.routine-list li.is-current { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); }
.board {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(5px); cursor: pointer;
  animation: board-in .3s ease;
}
@keyframes board-in { from { opacity: 0; } to { opacity: 1; } }
.board-card {
  width: min(520px, 100%); max-height: 100%; overflow: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px 22px; box-shadow: 0 14px 40px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column; gap: 10px;
}
.board-title { margin: 0; font-size: clamp(18px, 3.2vw, 24px); font-weight: 900; font-stretch: 108%; }
.board-text { margin: 0; font-size: clamp(16px, 2.6vw, 20px); font-weight: 600; color: var(--accent); white-space: pre-line; }
.board-text:empty { display: none; }
.board-figures { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.board-figures:empty { display: none; }
.board-bar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.board-bar i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; }
.board-hint { margin: 0; font-size: 12.5px; color: var(--muted); text-align: right; }

/* dyskretny odnośnik do edytora na samym dole panelu */
.quiet-links { margin: 6px 0 0; text-align: right; font-size: 11.5px; }
.quiet-links a { color: var(--muted); opacity: .35; text-decoration: none; }
.quiet-links a:hover, .quiet-links a:focus-visible { opacity: .9; text-decoration: underline; }
body.embed .quiet-links { display: none; }

/* ---------- Ekran startowy „Krok do tańca” ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--left) 14%, transparent), transparent 55%),
    radial-gradient(circle at 75% 80%, color-mix(in srgb, var(--right) 14%, transparent), transparent 55%),
    var(--bg);
  transition: opacity .5s ease, visibility .5s;
}
.splash.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
/* w ramce edytora: mniejszy napis „Przygotowanie wizualizacji”, bez paska postępu */
.splash.splash-embed .splash-title { font-size: clamp(20px, 6vw, 28px); font-stretch: 105%; }
.splash.splash-embed .splash-bar { display: none; }
.splash-card { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 360px; }
.splash-title {
  margin: 0; font-size: clamp(30px, 8vw, 44px); font-weight: 900; font-stretch: 115%; letter-spacing: 0.01em;
  color: var(--ink);
}
.splash-text { margin: 0; color: var(--muted); font-size: 15px; min-height: 1.4em; }
.splash-bar { width: min(260px, 70vw); height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 8%; border-radius: 4px; background: var(--accent); transition: width .25s ease; }
.splash-steps { position: relative; width: 120px; height: 92px; }
.splash-steps .fp {
  position: absolute; width: 20px; height: 34px; border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%;
  opacity: 0; animation: splash-step 2.4s infinite;
}
.splash-steps .fp.l { background: var(--left); }
.splash-steps .fp.r { background: var(--right); }
.splash-steps .fp:nth-child(1) { left: 34px; top: 56px; transform: rotate(-8deg); animation-delay: 0s; }
.splash-steps .fp:nth-child(2) { left: 66px; top: 38px; transform: rotate(8deg); animation-delay: .3s; }
.splash-steps .fp:nth-child(3) { left: 38px; top: 18px; transform: rotate(-8deg); animation-delay: .6s; }
.splash-steps .fp:nth-child(4) { left: 70px; top: 0; transform: rotate(8deg); animation-delay: .9s; }
@keyframes splash-step {
  0% { opacity: 0; } 12% { opacity: .95; } 55% { opacity: .95; } 80%, 100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .splash-steps .fp { animation: none; opacity: .9; } }

.live-controls { display: contents; }
/* podgląd w ramce edytora (?embed=1): sama scena z przyciskami */
body.embed .topbar, body.embed .panel, body.embed .load-actions, body.embed .hud-meta { display: none; }
body.embed .layout { grid-template-columns: minmax(0, 1fr); padding: 0; }
body.embed .stage { border-radius: 0; border: 0; }
body.embed .stage-bar { padding: 6px 10px; }
body.embed .transport-slot .toggles { display: none; }
body.embed .stage-view { height: max(200px, calc(100vh - 310px)); }
.transport-slot .live-controls { display: flex; flex-direction: column; gap: 10px; }
.transport-slot .field { gap: 2px; }
.transport-slot .toggles { grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.transport-slot { padding: 8px 10px; background: var(--surface); border-top: 1px solid var(--line); }
.sh-text { min-width: 0; flex: 1; }
.sh-name { font-weight: 700; font-size: 14px; line-height: 1.25; text-wrap: balance; }
.sh-meter { font-size: 12px; color: var(--muted); letter-spacing: 0.03em; font-variant-numeric: tabular-nums; }
.sh-counter { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.sh-beat {
  font-family: var(--font-count); font-weight: 850; font-stretch: 70%;
  font-size: 40px; line-height: 1; min-width: 1ch; text-align: center; font-variant-numeric: tabular-nums;
  transition: transform .08s ease-out, color .08s;
}
.sh-counter.is-one .sh-beat { color: var(--accent); }
.sh-counter.is-lead .sh-beat { color: var(--muted); }
.sh-counter.pulse .sh-beat { transform: scale(1.1); }
.sh-side { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sh-dots { display: flex; gap: 4px; }
.sh-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.sh-dots i.on { background: var(--ink); }
.sh-dots i.on.first { background: var(--accent); }
.sh-bar { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Telefon ---------- */
@media (max-width: 820px) {
  body { overflow: auto; display: block; }
  .layout { grid-template-columns: minmax(0, 1fr); padding-block: 8px; gap: 10px; }
  /* tytuł nad animacją, przyciski pod nią: na ekranie mieści się pasek górny, scena i nawigacja */
  .stage-head {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .hud { display: none; }
  .stage-view { height: max(230px, calc(100svh - 330px)); }
  .transport-slot .transport { flex-wrap: nowrap; }
  .transport-slot .btn { min-height: 44px; }
  .panel { overflow: visible; }
  .caption-text { font-size: 14.5px; }
  .stage-bar { padding: 8px 12px; }
  /* zwarty pasek górny: logo i małe przyciski w jednym wierszu, pod nimi wybór tańca */
  .topbar { gap: 6px 8px; padding-block: 6px; }
  .brand { order: 1; }
  .load-actions .btn { min-height: 36px; padding: 0 10px; font-size: 13px; }
  .pickers { order: 3; flex-basis: 100%; gap: 6px; }
  .picker-mode { flex: 1 1 100%; }
  .picker-mode .segmented { width: 100%; }
  .picker-class { flex: 1 1 100%; }
  .picker-type { flex: 1 1 38%; }
  .picker-figure { flex: 1 1 56%; }
  .picker select { min-height: 38px; padding: 6px 8px; }
  .picker-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .picker-role, .segmented { width: 100%; }
  .seg { flex: 1; min-height: 30px; }
  .views { width: 100%; justify-content: space-between; }
}
@media (max-width: 420px) {
  .toggles, .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .counter-beat { transition: none; }
  .counter.pulse .counter-beat { transform: none; }
}
