/* ==========================================================================
   Trening w toku i ekran biegu — design-handoff/design/Trening-v2.dc.html,
   Trening-bieg.dc.html. Pełnoekranowa warstwa nad aplikacją (focus.js).
   ========================================================================== */

body.fx-open {
  overflow: hidden;
}

.fx {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--vt-bg);
  color: var(--vt-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Na szerokim ekranie warstwa to wyśrodkowana kolumna telefonu */
@media (min-width: 768px) {
  .fx {
    background: rgb(var(--vt-bg-rgb) / 0.92);
    align-items: center;
  }
  .fx > * {
    width: 100%;
    max-width: 560px;
  }
}

.fx-head {
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--vt-line);
  background: var(--vt-bg);
}

.fx-head-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fx-icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: 12px;
  background: var(--vt-surface);
  color: var(--vt-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

span.fx-icon-btn { background: transparent; }

.fx-flip { transform: scaleX(-1); }

.fx-head-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.fx-head-row > .fx-head-sub {
  flex: 1;
  text-align: center;
}

.fx-head-title {
  font-weight: 600;
  font-size: 15px;
}

.fx-head-sub {
  font-size: 12px;
  color: var(--vt-muted);
}

.fx-finish {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--vt-line);
  border-radius: 12px;
  background: transparent;
  color: var(--vt-text);
  font: 600 14px var(--vt-font-body);
  cursor: pointer;
}

.fx-finish:hover { background: var(--vt-surface); }

.fx-progress {
  display: flex;
  gap: 4px;
}

.fx-seg {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--vt-line);
  overflow: hidden;
}

.fx-seg-fill {
  display: block;
  height: 100%;
  background: var(--vt-accent);
}

.fx-seg--current { outline: 1px solid var(--vt-muted); outline-offset: 1px; }

.fx-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fx-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fx-title h1 {
  margin: 0;
  font-family: var(--vt-font-display);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.fx-meta {
  font-size: 13px;
  color: var(--vt-muted);
}

.fx-eyebrow {
  font-family: var(--vt-font-data);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--vt-cardio);
}

.fx-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--vt-radius-md);
  background: var(--vt-accent-tint);
  color: var(--vt-text);
  font-size: 14px;
  line-height: 1.5;
}

.fx-hint .vt-icon { color: var(--vt-accent); margin-top: 2px; }
.fx-hint p { margin: 0; }
.fx-hint strong { font-weight: 600; }

.fx-hint--insight {
  background: var(--vt-surface-2);
  border: 1px solid var(--vt-line);
}

/* Przerwa */
.fx-rest {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--vt-radius-md);
  background: var(--vt-surface);
  border: 1px solid var(--vt-accent);
}

.fx-rest-time {
  font-size: 26px;
  font-weight: 600;
  color: var(--vt-accent);
}

.fx-rest-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--vt-line);
  overflow: hidden;
}

.fx-rest-fill {
  height: 100%;
  background: var(--vt-accent);
  transition: width 1s linear;
}

.fx-rest-skip {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--vt-line);
  border-radius: 12px;
  background: transparent;
  color: var(--vt-text);
  font: 500 14px var(--vt-font-body);
  cursor: pointer;
}

/* Serie */
.fx-sets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fx-set {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: var(--vt-radius-md);
  font: inherit;
  color: var(--vt-text);
  text-align: left;
}

.fx-set--done {
  border: 0;
  background: var(--vt-surface);
  cursor: pointer;
}

.fx-set--todo {
  border: 1px dashed var(--vt-line);
  color: var(--vt-muted);
}

.fx-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--vt-accent);
  color: var(--vt-accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fx-set-n { flex: 1; font-size: 14px; }
.fx-set-v { font-size: 14px; }

.fx-active {
  background: var(--vt-surface-2);
  border: 1px solid var(--vt-accent);
  border-radius: var(--vt-radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fx-active-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.fx-active-n { font-weight: 600; font-size: 16px; }
.fx-last { font-size: 12px; color: var(--vt-muted); }

.fx-steppers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fx-stepper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fx-stepper-l,
.fx-field-l {
  font-size: 12px;
  color: var(--vt-muted);
}

.fx-stepper-row {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  background: var(--vt-bg);
  border-radius: var(--vt-radius-md);
  overflow: hidden;
}

.fx-stepper-row--wide { max-width: 260px; }

.fx-stepper-row button {
  height: 52px;
  border: 0;
  background: transparent;
  color: var(--vt-text);
  font: 500 22px var(--vt-font-body);
  cursor: pointer;
}

.fx-stepper-row button:hover { background: var(--vt-surface); }

.fx-stepper-row span {
  text-align: center;
  font-size: 22px;
  font-weight: 600;
}

.fx-done-note {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--vt-radius-md);
  background: var(--vt-accent-tint);
}

.fx-done-title { font-weight: 600; }
.fx-done-sub { font-size: 13px; color: var(--vt-accent); }

.fx-add {
  min-height: 48px;
  border: 1px dashed var(--vt-line);
  border-radius: var(--vt-radius-md);
  background: transparent;
  color: var(--vt-muted);
  font: 500 14px var(--vt-font-body);
  cursor: pointer;
}

.fx-add:hover { color: var(--vt-text); border-color: var(--vt-muted); }

.fx-foot {
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--vt-line);
  background: var(--vt-bg);
}

.fx-foot--stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fx-foot:empty { display: none; }

.fx-next {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid var(--vt-line);
  border-radius: var(--vt-radius-md);
  background: var(--vt-surface);
  color: var(--vt-muted);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.fx-next:hover { border-color: var(--vt-muted); }

.fx-next-text { display: flex; flex-direction: column; gap: 2px; }
.fx-next-l { font-size: 12px; color: var(--vt-muted); }
.fx-next-name { font-size: 15px; font-weight: 600; color: var(--vt-text); }

.fx-icon-btn:focus-visible,
.fx-finish:focus-visible,
.fx-rest-skip:focus-visible,
.fx-set:focus-visible,
.fx-stepper-row button:focus-visible,
.fx-add:focus-visible,
.fx-next:focus-visible,
.fx-rpe button:focus-visible {
  outline: 2px solid var(--vt-accent);
  outline-offset: 2px;
}

/* Podsumowanie */
.fx-sum-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fx-sum {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: var(--vt-radius-md);
  background: var(--vt-surface);
}

.fx-sum-l { font-size: 12px; color: var(--vt-muted); }
.fx-sum-v { font-size: 22px; font-weight: 600; }

.fx-note {
  margin: 0;
  font-size: 13px;
  color: var(--vt-warn);
}

.fx-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fx-rpe {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.fx-rpe button {
  min-height: 44px;
  border: 1px solid var(--vt-line);
  border-radius: var(--vt-radius-sm);
  background: transparent;
  color: var(--vt-text);
  font-size: 15px;
  cursor: pointer;
}

.fx-rpe button[aria-pressed="true"] {
  background: var(--vt-accent);
  border-color: var(--vt-accent);
  color: var(--vt-accent-ink);
  font-weight: 600;
}

.fx-notes {
  width: 100%;
  border: 1px solid var(--vt-line);
  border-radius: var(--vt-radius-sm);
  background: var(--vt-surface);
  color: var(--vt-text);
  font: 15px/1.5 var(--vt-font-body);
  padding: 10px 12px;
  resize: vertical;
}

.fx-notes:focus { outline: 2px solid var(--vt-accent); outline-offset: 0; }

.fx-center { justify-content: center; }

/* Ekran biegu */
.fx-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fx-target {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: var(--vt-radius-md);
  background: var(--vt-surface);
  border: 1px solid var(--vt-line);
}

.fx-target-l { font-size: 12px; color: var(--vt-muted); }
.fx-target-v { font-size: 20px; font-weight: 600; }

.fx-garmin {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  border-radius: var(--vt-radius-lg);
  background: var(--vt-cardio-tint);
  border: 1px solid rgb(var(--vt-cardio-rgb) / 0.35);
}

.fx-garmin > .vt-icon { color: var(--vt-cardio); }
.fx-garmin > div { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.fx-garmin-t { font-weight: 600; }
.fx-garmin-s { font-size: 13px; color: var(--vt-muted); }

.fx-garmin--done {
  background: var(--vt-accent-tint);
  border-color: rgb(var(--vt-accent-rgb) / 0.35);
}

.fx-garmin--done > .vt-icon { color: var(--vt-accent); }

@media (prefers-reduced-motion: reduce) {
  .fx-rest-fill { transition: none; }
}
