:root {
  --bg: #07090a;
  --bg-elevated: #0c0f0d;
  --surface: #121813;
  --surface-border: #202822;
  --lime: #c6ff3d;
  --lime-dim: #6e8a2c;
  --lime-wash: rgba(198, 255, 61, 0.12);
  --warning: #ffb84d;
  --danger: #ff5a4e;
  --text-primary: #f2f7ef;
  --text-secondary: #8a958c;
  --text-faint: #52594f;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #9085e9;
  --series-5: #c98500;
  --font-display: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
}

a {
  color: inherit;
}

::selection {
  background: var(--lime-wash);
}

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.app-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- Экран-заставка (auth) ---------- */

.auth-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  gap: 44px;
  text-align: center;
}

/* Сигнатурная дуга — та же 270°-геометрия, что и на часах, только здесь
   она несёт логотип, а не живой пульс: обещание того, каким станет экран
   после первой тренировки. */
.auth-gauge {
  position: relative;
  width: 128px;
  height: 128px;
}

.auth-gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}

.auth-gauge-arc {
  stroke-dasharray: 60 500;
  stroke-dashoffset: 0;
}

.auth-wordmark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.auth-copy {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-heading {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}

.auth-sub {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin: 8px 0 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
}

.field input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--surface-border);
  border-radius: 0;
  padding: 10px 2px;
  font-size: 17px;
  color: var(--text-primary);
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  text-align: center;
  transition: border-color 0.15s ease;
}

.field input::placeholder {
  color: var(--text-faint);
  font-family: var(--font-body);
}

.field input:focus {
  border-color: var(--lime);
}

.field input:focus-visible {
  outline: none;
}

.otp-input {
  text-align: center;
  font-size: 30px;
  letter-spacing: 0.35em;
  padding-left: 0.35em;
}

.auth-field {
  margin-top: 32px;
}

.auth-copy .btn {
  width: 100%;
  margin-top: 28px;
}

.auth-hint {
  margin-top: 18px;
}

.form-error {
  width: 100%;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 15px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-primary {
  background: var(--lime);
  color: #08120a;
}

.btn-quiet {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--surface-border);
}

.btn-quiet:hover {
  color: var(--text-primary);
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

.form-hint {
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

.form-hint button {
  background: none;
  border: none;
  color: var(--lime);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
}

/* ---------- Основной каркас (после входа) ---------- */

.main-header {
  padding: 20px 20px 4px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.main-header h1 {
  font-size: 20px;
  margin: 0;
  font-weight: 700;
}

.main-header .eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.screen {
  flex: 1;
  padding: 12px 20px 100px;
  overflow-y: auto;
}

.hidden {
  display: none !important;
}

/* Карточка тренировки со спарклайном пульса */

.training-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.training-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.training-date {
  font-size: 13px;
  color: var(--text-secondary);
}

.training-goal {
  font-size: 12px;
  color: var(--lime);
  background: var(--lime-wash);
  border-radius: 999px;
  padding: 3px 10px;
  margin-top: 4px;
  display: inline-block;
}

.training-duration {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.training-stats {
  display: flex;
  gap: 18px;
  margin-top: 10px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.stat-label {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  margin-top: 12px;
}

.sparkline .bar {
  flex: 1;
  background: var(--lime-dim);
  border-radius: 2px;
  min-height: 3px;
}

/* Пустые состояния */

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
}

.empty-state .glyph {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}

.empty-state h3 {
  color: var(--text-primary);
  font-size: 16px;
  margin: 0 0 6px;
}

.empty-state p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

/* Профиль */

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--surface-border);
}

.profile-row:last-child {
  border-bottom: none;
}

.profile-row label {
  font-size: 14px;
  color: var(--text-secondary);
}

.profile-row .value-input {
  display: flex;
  align-items: center;
  gap: 4px;
}

.profile-row input,
.profile-row select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 15px;
  text-align: right;
  width: 90px;
}

.profile-row select {
  text-align: left;
  width: auto;
}

.profile-unit {
  font-size: 12px;
  color: var(--text-faint);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--lime-dim);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--lime);
}

.pairing-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
}

.pairing-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.pairing-card p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.pairing-inline {
  display: flex;
  gap: 8px;
}

.pairing-inline input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.2em;
  text-align: center;
}

.pairing-inline .btn {
  padding: 12px 18px;
  flex-shrink: 0;
}

.paired-device {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--lime-wash);
  border: 1px solid var(--lime-dim);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.paired-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  flex-shrink: 0;
}

.paired-device div {
  font-size: 13px;
  color: var(--text-primary);
}

.paired-device small {
  display: block;
  color: var(--text-faint);
  margin-top: 2px;
}

/* Детали тренировки */

.detail-close-btn {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.detail-summary {
  display: flex;
  gap: 18px;
  margin: 4px 0 20px;
  flex-wrap: wrap;
}

.metric-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.metric-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.metric-tab.active {
  background: var(--bg-elevated);
  border-color: var(--metric-color, var(--lime-dim));
  color: var(--text-primary);
}

.metric-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--metric-color, var(--text-faint));
  flex-shrink: 0;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 16px 12px 10px;
  margin-bottom: 20px;
}

.map-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  /* overflow не скрываем ни здесь, ни на .route-map — иначе попап MapLibre,
     вставляемый внутрь контейнера карты и выходящий за его границы,
     обрезается и становится невидимым при клике на маркер. */
}

.route-map {
  width: 100%;
  height: 340px;
}

/* Скругление углов карты — на canvas и внутренние контролы отдельно,
   раз overflow:hidden с контейнера снят ради видимости попапов. */
.route-map .maplibregl-canvas,
.route-map .maplibregl-map {
  border-radius: var(--radius-lg);
}

/* CARTO Voyager светлый независимо от темы приложения — лёгкое затемнение
   вписывает карту в тёмную палитру, не гася насыщенные цвета стиля. */
.route-map .maplibregl-canvas {
  filter: brightness(0.92);
}

.route-comment-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--series-1);
  border: 2px solid var(--bg-elevated);
  box-shadow: 0 0 0 1px var(--series-1);
}

/* Попап MapLibre рисуется на светлом фоне независимо от темы приложения —
   без этого текст наследует светлый --text-primary и становится нечитаемым. */
.maplibregl-popup-content {
  color: #1a1a1a;
  font-family: inherit;
}

.comment-popup-time {
  font-weight: 600;
  font-size: 13px;
}

.comment-popup-offset {
  font-size: 11px;
  color: #6b6b6b;
  margin-top: 1px;
}

.comment-popup-metrics {
  font-size: 11px;
  color: #3987e5;
  margin-top: 4px;
}

.comment-popup-text {
  font-size: 13px;
  margin-top: 6px;
}

.chart-svg {
  width: 100%;
  height: 140px;
  display: block;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke: var(--lime);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-grid-line {
  stroke: var(--surface-border);
  stroke-width: 1;
}

.chart-axis-label {
  fill: var(--text-faint);
  font-size: 9px;
  font-family: var(--font-display);
}

.advice-marker {
  fill: var(--bg-elevated);
  stroke-width: 2;
  cursor: pointer;
}

.advice-marker.priority-urgent,
.advice-marker.priority-high {
  stroke: var(--danger);
}

.advice-marker.priority-normal {
  stroke: var(--lime);
}

.advice-marker.priority-low {
  stroke: var(--text-faint);
}

.comment-marker {
  fill: var(--bg-elevated);
  stroke: var(--series-1);
  stroke-width: 2;
  cursor: pointer;
}

.chart-hover-line {
  stroke: var(--text-faint);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 0.1s ease;
  z-index: 5;
}

.chart-tooltip.visible {
  opacity: 1;
}

.chart-wrap {
  position: relative;
}

.chart-range-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 10px;
  font-size: 11px;
  font-family: var(--font-display);
  color: var(--text-secondary);
}

.advice-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.advice-entry {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-left: 3px solid var(--lime-dim);
  border-radius: var(--radius-sm);
}

.advice-entry.priority-urgent,
.advice-entry.priority-high {
  border-left-color: var(--danger);
}

.advice-entry.comment-entry {
  border-left-color: var(--series-1);
  background: var(--bg-elevated);
}

.advice-entry-time {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-faint);
  flex-shrink: 0;
  padding-top: 1px;
}

.advice-entry-message {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.45;
}

.advice-entry-source {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin: 0 0 10px;
}

/* AI-анализ тренировки */

.ai-analysis-card {
  background: var(--surface);
  border: 1px solid var(--lime-dim);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
}

.ai-analysis-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--lime-wash);
  border: 1px solid var(--lime-dim);
  color: var(--lime);
  font-size: 14px;
  font-weight: 700;
  padding: 13px 18px;
  border-radius: 999px;
  cursor: pointer;
  margin-bottom: 20px;
}

.ai-analysis-trigger:disabled {
  opacity: 0.6;
  cursor: default;
}

.ai-analysis-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.ai-analysis-body strong {
  display: block;
  margin: 14px 0 4px;
  color: var(--lime);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ai-analysis-body strong:first-child {
  margin-top: 0;
}

/* Таб-бар */

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: rgba(10, 13, 11, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--surface-border);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

.tab-btn.active {
  color: var(--lime);
}

.tab-btn svg {
  width: 20px;
  height: 20px;
}

.logout-row {
  text-align: center;
  padding: 24px 0 8px;
}

.logout-row button {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 13px;
  cursor: pointer;
}

/* ===================== PWA: статус сети, обновление, установка ===================== */

/* Баннеры фиксированы поверх контента и учитывают вырез сверху. */
.offline-banner,
.update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  font-size: 13px;
  text-align: center;
}

.offline-banner {
  background: var(--warning);
  color: #1a1200;
  font-weight: 500;
}

.update-banner {
  background: var(--lime);
  color: #101a00;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 500;
}

.update-banner button {
  background: #101a00;
  color: var(--lime);
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.install-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-top: 28px;
}

.install-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.install-card p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===================== Живая тренировка ===================== */

.sensor-list {
  margin-top: 8px;
}

.sensor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--surface-border);
}

.sensor-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.sensor-name {
  font-size: 14px;
}

.sensor-status {
  font-size: 12px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sensor-row.connected .sensor-status {
  color: var(--lime);
}

.btn-sensor {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.btn-sensor:disabled {
  opacity: 0.4;
  cursor: default;
}

.live-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 14px 0 0;
}

.live-goal-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 11px 12px;
  font-size: 14px;
  font-family: inherit;
}

/* --- активная тренировка --- */

.live-timer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 16px;
}

.live-timer {
  font-family: var(--font-display);
  font-size: 44px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}

.live-badges {
  display: flex;
  gap: 6px;
  align-items: center;
}

.live-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--warning);
  border: 1px solid var(--warning);
  border-radius: 999px;
  padding: 3px 9px;
}

.live-badge-dim {
  color: var(--text-faint);
  border-color: var(--surface-border);
  font-weight: 400;
  letter-spacing: 0;
}

/* Крупная сетка: цифры должны читаться с руля на ходу, поэтому пульс
   занимает всю ширину, остальное — по две колонки. */
.live-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.live-metric {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.live-metric-primary {
  grid-column: 1 / -1;
}

.live-metric-value {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.live-metric-primary .live-metric-value {
  font-size: 60px;
  color: var(--lime);
}

.live-metric-label {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.live-metric-zone {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

.coach-feed {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coach-feed-empty {
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  padding: 16px 0;
}

.coach-msg {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-left: 3px solid var(--lime-dim);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  line-height: 1.45;
  animation: coach-msg-in 0.25s ease-out;
}

.coach-msg-urgent {
  border-left-color: var(--danger);
}

.coach-msg-high {
  border-left-color: var(--warning);
}

.coach-msg-time {
  display: block;
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}

@keyframes coach-msg-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .coach-msg { animation: none; }
}

/* Кнопки управления закреплены над таб-баром: во время заезда до них нужно
   дотягиваться не глядя, поэтому позиция фиксированная и цель крупная. */
.live-controls {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 14px 0 4px;
  margin-top: 20px;
  background: linear-gradient(to bottom, transparent, var(--bg) 30%);
}

.btn-live {
  flex: 1;
  border: none;
  border-radius: var(--radius-md);
  padding: 17px 0;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.btn-live-pause {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
}

.btn-live-stop {
  background: var(--danger);
  color: #fff;
}

/* --- живая карта во время заезда --- */

.live-map-card {
  margin-top: 16px;
}

/* Ниже, чем карта в деталях: на экране заезда приоритет у цифр, карта —
   вспомогательный контекст. */
.live-map {
  height: 220px;
}

/* Текущая позиция: точка с пульсацией, чтобы её было видно на треке. */
.live-position-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lime);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--lime);
}

@media (prefers-reduced-motion: no-preference) {
  .live-position-marker {
    animation: live-position-pulse 2s ease-out infinite;
  }
}

@keyframes live-position-pulse {
  0% { box-shadow: 0 0 0 2px var(--lime); }
  70% { box-shadow: 0 0 0 10px rgba(198, 255, 61, 0); }
  100% { box-shadow: 0 0 0 2px rgba(198, 255, 61, 0); }
}

/* --- трансляция заезда с часов --- */

.watch-session-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--lime-wash);
  border: 1px solid var(--lime-dim);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.watch-session-pulse {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lime);
}

@media (prefers-reduced-motion: no-preference) {
  .watch-session-pulse {
    animation: watch-pulse 1.6s ease-out infinite;
  }
}

@keyframes watch-pulse {
  0% { box-shadow: 0 0 0 0 rgba(198, 255, 61, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(198, 255, 61, 0); }
  100% { box-shadow: 0 0 0 0 rgba(198, 255, 61, 0); }
}

.watch-session-text {
  flex: 1;
  min-width: 0;
}

.watch-session-text h3 {
  margin: 0 0 2px;
  font-size: 14px;
}

.watch-session-text p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.live-badge-watch {
  color: var(--lime);
  border-color: var(--lime-dim);
}

.live-watch-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  padding: 18px 0 4px;
  margin-top: 20px;
}

/* Разрыв связи с часами: данные на экране заморожены, это надо показать. */
.live-stale .live-metric-value {
  opacity: 0.45;
  transition: opacity 0.3s;
}

/* Пояснение под полем профиля (например, зачем нужен FTP). */
.profile-note {
  display: block;
  margin: 8px 2px 0;
  line-height: 1.5;
  color: var(--text-faint);
}
