/* Вкладка «Тренировка» и полноэкранный режим «Один тап». */

@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("/fonts/onest-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("/fonts/onest-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --wk-display: "Onest", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --wk-go-fg: #f6f7f4;
  --wk-go-muted: rgba(246, 247, 244, 0.74);
  --wk-count-bg: #e4e8e3;
  --wk-rest-bg: #66716b;
  --wk-rest-fg: #f3f5f1;
  --wk-rest-muted: rgba(243, 245, 241, 0.78);
  --wk-line: rgba(24, 33, 28, 0.12);
  --wk-t1: 26px;
  --wk-t2: 16px;
  --wk-num: min(52vw, 32vh);
}

@media (prefers-color-scheme: dark) {
  :root {
    --wk-go-fg: #0c140f;
    --wk-go-muted: rgba(12, 20, 15, 0.72);
    --wk-count-bg: #1f2923;
    --wk-rest-bg: #0a0e0c;
    --wk-rest-fg: #9aa69f;
    --wk-rest-muted: rgba(154, 166, 159, 0.8);
    --wk-line: rgba(233, 237, 233, 0.14);
  }
}

/* ---------- вкладка ---------- */

.workout-view { display: flex; flex-direction: column; gap: 14px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card); }
.wk-tab-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }
.wk-day-pick select { min-height: 36px; padding: 0 10px; border: 1px solid var(--input); border-radius: var(--radius-md); background: var(--background); color: var(--foreground); font-weight: 650; }
.wk-tab-done { color: var(--green-2); font-size: var(--text-sm); font-weight: 700; }
.wk-tab-title { font-family: var(--wk-display); font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.wk-tab-warm, .wk-tab-status { color: var(--muted); }
.wk-tab-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 1.3em; color: var(--foreground); }
.wk-tab-start { min-height: 56px; margin-top: 6px; border: 0; border-radius: var(--radius-lg); background: var(--primary); color: var(--primary-foreground); font-family: var(--wk-display); font-size: 1.25rem; font-weight: 800; }
.wk-tab-start:focus-visible, .wk-day-pick select:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- полноэкранный режим ---------- */

html.wk-open, html.wk-open body { overflow: hidden; }
/* Во время тренировки уведомления (ошибки отправки) — сверху, поверх экрана. */
html.wk-open .toast { z-index: 80; top: calc(env(safe-area-inset-top, 0px) + 64px); bottom: auto; transform: translate(-50%, -240px); }
html.wk-open .toast.visible { transform: translate(-50%, 0); }

.wk-screen {
  --wk-bg: var(--background);
  --wk-ink: var(--foreground);
  --wk-ink2: var(--muted-foreground);
  position: fixed; inset: 0; z-index: 60; overflow: hidden;
  background: var(--wk-bg); color: var(--wk-ink);
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.wk-screen[data-s="go"] { --wk-bg: var(--primary); --wk-ink: var(--wk-go-fg); --wk-ink2: var(--wk-go-muted); --wk-line: rgba(246, 247, 244, 0.22); }
.wk-screen[data-s="count"] { --wk-bg: var(--wk-count-bg); }
.wk-screen[data-s="rest"] { --wk-bg: var(--wk-rest-bg); --wk-ink: var(--wk-rest-fg); --wk-ink2: var(--wk-rest-muted); }

.wk-tap { position: absolute; inset: 0; z-index: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; touch-action: manipulation; }
.wk-tap:active, .wk-zone:active { background: color-mix(in srgb, var(--wk-ink) 6%, transparent); }
.wk-tap:focus-visible, .wk-zone:focus-visible { outline: 3px solid var(--wk-ink); outline-offset: -10px; border-radius: 18px; }

.wk-layout {
  position: relative; z-index: 1; height: 100%; box-sizing: border-box;
  display: flex; flex-direction: column;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 20px calc(22px + env(safe-area-inset-bottom, 0px));
  pointer-events: none; animation: wk-in 0.2s ease;
}
@keyframes wk-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.wk-bar { display: flex; justify-content: space-between; align-items: center; min-height: 48px; }
.wk-bar-group { display: flex; align-items: center; gap: 4px; }
.wk-ctl { pointer-events: auto; position: relative; z-index: 2; display: grid; place-items: center; width: 48px; height: 48px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--wk-ink2); }
.wk-ctl svg { width: 26px; height: 26px; display: block; }
.wk-ctl:focus-visible, .wk-link:focus-visible { outline: 2px solid var(--wk-ink); outline-offset: 2px; }

.wk-mid { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.wk-low { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.wk-name { max-width: 22ch; margin: 0; font-family: var(--wk-display); font-size: var(--wk-t1); font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; text-wrap: balance; }
.wk-num { margin: 0; font-family: var(--wk-display); font-size: var(--wk-num); font-weight: 800; line-height: 0.82; letter-spacing: -0.05em; font-variant-numeric: proportional-nums lining-nums; }
.wk-num.is-wide { font-size: min(36vw, 24vh); }
.wk-num small { margin-left: 0.3em; font-size: var(--wk-t1); font-weight: 700; letter-spacing: 0; }
.wk-side { margin: 0; font-size: var(--wk-t1); font-weight: 600; text-wrap: balance; }
.wk-count { margin: 0; color: var(--wk-ink2); font-size: var(--wk-t2); font-weight: 400; font-variant-numeric: tabular-nums; }
.wk-side .wk-count { margin-left: 0.5em; }
.wk-cue { max-width: 30ch; margin: 0; color: var(--wk-ink2); font-size: var(--wk-t2); text-wrap: balance; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wk-clock { margin: 0; color: var(--wk-ink2); font-size: var(--wk-t2); font-variant-numeric: tabular-nums; }
.is-paused .wk-num { opacity: 0.4; }
.wk-hint { margin: 0; font-family: var(--wk-display); font-size: var(--wk-t1); font-weight: 700; letter-spacing: 0.01em; }
.wk-forms { display: flex; align-items: center; gap: 6px; min-height: 24px; color: var(--wk-ink2); }
.wk-link { pointer-events: auto; position: relative; z-index: 2; margin: 0; padding: 6px 4px; border: 0; border-radius: 4px; background: none; color: var(--wk-ink2); font-size: var(--wk-t2); }

.wk-progress { position: absolute; top: 0; left: 0; right: 0; z-index: 1; height: 3px; background: var(--wk-line); }
.wk-progress i { display: block; width: 0; height: 100%; background: var(--wk-ink2); transition: width 0.2s ease; }

.wk-zone { position: absolute; top: 0; bottom: 0; z-index: 0; width: 33.3334%; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; touch-action: manipulation; }
.wk-zone.is-left { left: 0; }
.wk-zone.is-center { left: 33.3333%; }
.wk-zone.is-right { right: 0; }
.wk-row { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.wk-pm { width: 44px; height: 44px; color: var(--wk-ink2); }
.wk-pm svg { display: block; width: 44px; height: 44px; }

.wk-veil { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; background: rgba(10, 14, 12, 0.45); }
.wk-sheet { display: flex; flex-direction: column; gap: 14px; width: 100%; box-sizing: border-box; padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px)); border-radius: 18px 18px 0 0; background: var(--background); color: var(--foreground); }
.wk-sheet p { max-width: 62ch; margin: 0; }
.wk-sheet .wk-sheet-more { color: var(--muted-foreground); }
.wk-sheet-ok { min-height: 56px; margin-top: 6px; border: 0; border-radius: 14px; background: var(--primary); color: var(--primary-foreground); font-size: 1.1rem; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .wk-layout, .wk-screen, .wk-progress i { animation: none; transition: none; }
}

/* ---------- новые цифры плана из недельного отчёта ---------- */

.plan-proposal-card { padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card); }
.workout-view .plan-proposal { margin: -4px -4px 6px; padding: 16px; border-radius: var(--radius-lg); background: var(--accent); }
.plan-proposal { display: flex; flex-direction: column; gap: 12px; }
.plan-proposal h2 { font-family: var(--wk-display); font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.pp-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pp-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; }
.pp-name { font-weight: 650; }
.pp-day { color: var(--muted); font-size: var(--text-sm); font-weight: 600; }
.pp-change { font-family: var(--wk-display); font-weight: 700; white-space: nowrap; font-variant-numeric: proportional-nums lining-nums; }
.pp-change s { color: var(--muted); font-weight: 600; }
.pp-change b { color: var(--green-2); font-weight: 800; }
.pp-reason { grid-column: 1 / -1; color: var(--muted); font-size: var(--text-sm); }
.pp-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pp-accept { flex: 1 1 auto; min-height: 52px; border: 0; border-radius: var(--radius-lg); background: var(--primary); color: var(--primary-foreground); font-family: var(--wk-display); font-size: 1.1rem; font-weight: 800; }
.pp-later { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--muted); font-weight: 650; }
.pp-accept:focus-visible, .pp-later:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* ---------- пауза: болезнь, травма, отъезд ---------- */

.wk-pause { display: flex; flex-direction: column; gap: 10px; }
.wk-pause-eyebrow { color: var(--muted); font-size: var(--text-sm); font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.wk-pause-meta { font-family: var(--wk-display); font-size: 1.1rem; font-weight: 700; color: var(--foreground); }
.wk-pause-note, .wk-pause-back { color: var(--muted); }
.wk-pause-back { margin-top: 4px; }
.wk-shift-note { margin: 8px 0 0; color: var(--muted); font-size: var(--text-sm); text-align: center; }
.wk-pause-links { display: flex; justify-content: center; gap: 0 20px; flex-wrap: wrap; }
.wk-pause-links .wk-link { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--muted); font-size: var(--text-sm); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.wk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wk-chip { min-height: 44px; padding: 0 16px; border: 1px solid var(--input); border-radius: 999px; background: var(--background); color: var(--foreground); font-weight: 650; }
.wk-chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }
.wk-pause-from { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-weight: 650; }
.wk-pause-from span { white-space: nowrap; }
.wk-pause-from select { min-width: 0; flex: 1 1 auto; min-height: 44px; padding: 0 10px; border: 1px solid var(--input); border-radius: var(--radius-md); background: var(--background); color: var(--foreground); font-weight: 650; }
.wk-chip:focus-visible, .wk-pause-from select:focus-visible, .wk-pause-links .wk-link:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.wk-tab-start:disabled { opacity: 0.6; }

/* ---------- справка по упражнению (кнопка «i») ---------- */

.wk-tab-list li { padding-left: 2px; }
.wk-tab-list li > span { vertical-align: middle; }
.wk-info { display: inline-grid; place-items: center; width: 36px; height: 36px; margin: -6px 0 -6px 4px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted-foreground); vertical-align: middle; }
.wk-info svg { width: 20px; height: 20px; display: block; }
.wk-info:focus-visible, .wk-guide-close:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; }
.wk-guide-veil { z-index: 75; }
.wk-guide { gap: 10px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; user-select: text; }
.wk-guide-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.wk-guide h2 { margin: 0; font-family: var(--wk-display); font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.wk-guide h3 { margin: 6px 0 0; font-size: var(--text-sm, 0.9rem); font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-foreground); }
.wk-guide ol, .wk-guide ul { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 1.3em; }
.wk-guide-close { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: -10px -10px 0 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted-foreground); }
.wk-guide-close svg { width: 24px; height: 24px; }
.wk-guide-plan { font-weight: 700; }
.wk-guide-plan span { color: var(--muted-foreground); font-weight: 500; }
.wk-guide-cue { color: var(--muted-foreground); }
.wk-guide-warn { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #d9822b 16%, transparent); }
.wk-guide-video { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 14px; background: #101512; }
.wk-guide-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.wk-guide-play { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 100%; margin: 0; padding: 0; border: 0; background: none; color: #f6f7f4; font-size: 1.05rem; font-weight: 700; }
.wk-guide-play svg { width: 56px; height: 56px; padding: 12px; border-radius: 50%; background: rgba(246, 247, 244, 0.16); box-sizing: border-box; }
.wk-guide-play:focus-visible { outline: 3px solid var(--ring); outline-offset: -4px; border-radius: 14px; }
.wk-guide-note { color: var(--foreground); }
.wk-guide-yt { align-self: flex-start; color: var(--muted-foreground); font-size: var(--text-sm, 0.9rem); text-decoration: underline; text-underline-offset: 3px; }
