.page-race .app-header {
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-race .app-content {
  padding: 12px 10px calc(270px + env(safe-area-inset-bottom));
}

.header-metrics {
  min-width: 0;
  text-align: right;
}

.header-ist-speed {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.header-elapsed {
  font-size: 0.72rem;
  color: #bfdbfe;
  white-space: nowrap;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-header {
  position: sticky;
  top: calc(58px + env(safe-area-inset-top));
  z-index: 35;
  display: grid;
  grid-template-columns: 56px 1fr 1fr 74px;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 1px solid #3b4654;
  border-radius: 10px;
  padding: 12px 10px;
  min-height: 62px;
  margin-bottom: 10px;
  background: rgba(15, 24, 38, 0.96);
}

.timeline-head-cell {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #bfdbfe;
  justify-self: start;
  text-align: left;
}

.timeline-head-cell:last-child {
  justify-self: end;
  text-align: right;
}

.km-row {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 56px 1fr 1fr 74px;
  align-items: center;
  gap: 6px;
  border: 1px solid #626c78;
  border-radius: 10px;
  padding: 12px 10px;
  min-height: 62px;
  cursor: pointer;
  background: #4b5563;
  color: #f8fafc;
}

.km-row:active {
  transform: translateY(1px);
}

.km-row.is-current {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.55), 0 0 16px rgba(245, 158, 11, 0.42);
}

.km-row.is-completed {
  background: #1e293b;
  border-color: #3b82f6;
}

.km-row.is-completed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 22, 0.38);
  pointer-events: none;
}

.km-km {
  font-weight: 700;
}

.km-col {
  font-size: 0.76rem;
  color: #e5e7eb;
  text-align: left;
}

.km-col-dual {
  display: grid;
  gap: 3px;
}

.km-ist {
  display: grid;
  justify-items: end;
  gap: 0;
}

.km-ist-dual {
  gap: 6px;
}

.km-info-badge {
  font-size: 0.68rem;
}

.km-value-strike {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  opacity: 0.78;
}

.km-subline-live {
  font-size: 0.68rem;
  color: #dbeafe;
  line-height: 1.25;
}

.vp-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.vp-card.vp-type-vp {
  box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.32);
}

.vp-card.vp-type-wp {
  box-shadow: inset 0 0 0 2px rgba(168, 85, 247, 0.42);
}

.vp-card.vp-open {
  filter: saturate(0.82);
}

.vp-card.vp-reached {
  filter: saturate(1.05);
}

.vp-card.vp-reached::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 22, 0.36);
  pointer-events: none;
}

.vp-card.vp-current {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.55), 0 0 18px rgba(245, 158, 11, 0.4);
}

.vp-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.vp-line {
  font-size: 0.82rem;
  margin-bottom: 4px;
  line-height: 1.35;
}

.vp-line-strike {
  text-decoration: line-through;
  text-decoration-thickness: 1.4px;
  opacity: 0.8;
}

.vp-line-live {
  color: #dbeafe;
  font-weight: 700;
}

.vp-meta-line {
  color: #cbd5e1;
}

.vp-warning-line {
  color: #fecaca;
  font-weight: 800;
}

.vp-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.vp-actions button {
  min-height: 46px;
}

.warning-card {
  color: #fecaca;
  white-space: pre-line;
}

.disclaimer-race-bottom {
  margin-top: 14px;
}

.sticky-nextvp h2 {
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.sticky-line {
  font-size: 0.84rem;
  margin-bottom: 4px;
}

.sticky-warning {
  color: #fecaca;
  font-weight: 800;
  white-space: pre-line;
}

.sticky-buffer {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 8px 0;
}

.btn-finish {
  width: 100%;
  min-height: 58px;
  border-color: #86efac;
  background: linear-gradient(180deg, #22c55e, #16a34a);
  color: #062512;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.vp-card.vp-type-finish {
  box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.42);
}

.vp-actions-finish {
  grid-template-columns: 1fr;
}

.vp-actions-finish .btn-finish:disabled {
  background: linear-gradient(180deg, #164e35, #123c29);
  border-color: #34d399;
  color: #d1fae5;
}

.finish-summary-card {
  text-align: center;
  border: 1px solid #fcd34d;
  border-radius: 14px;
  padding: 20px 14px;
  margin-top: 14px;
  min-height: 154px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 249, 196, 0.28), rgba(255, 249, 196, 0)),
    linear-gradient(180deg, rgba(250, 204, 21, 0.36), rgba(161, 98, 7, 0.38));
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 153, 0.45),
    0 12px 28px rgba(120, 53, 15, 0.35);
}

.finish-summary-title {
  font-size: 1.32rem;
  line-height: 1.25;
  font-weight: 900;
  color: #fffbeb;
  letter-spacing: 0.01em;
  margin-bottom: 10px;
  text-shadow: 0 2px 8px rgba(146, 64, 14, 0.45);
}

.finish-summary-line {
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff7d6;
  margin-bottom: 6px;
  text-shadow: 0 1px 6px rgba(120, 53, 15, 0.35);
}

.finish-celebration {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 72%, rgba(4, 10, 16, 0.36), rgba(2, 5, 10, 0.9));
  pointer-events: none;
}

.finish-celebration[hidden] {
  display: none !important;
}

.finish-fireworks-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.finish-celebration-text {
  position: relative;
  z-index: 2;
  font-size: 1.45rem;
  font-weight: 800;
  color: #dcfce7;
  text-shadow: 0 0 20px rgba(34, 197, 94, 0.55);
  animation: finishPulse 700ms ease-in-out infinite alternate;
}

@keyframes finishPulse {
  from {
    transform: scale(1);
    opacity: 0.8;
  }
  to {
    transform: scale(1.06);
    opacity: 1;
  }
}
