:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #152033;
  --muted: #647085;
  --aerob: #34d399;
  --anaerob: #f97316;
  --blue: #2563eb;
  --danger: #dc2626;
  --border: rgba(21,32,51,0.12);
  --shadow: 0 18px 45px rgba(21,32,51,0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background:
    linear-gradient(180deg, rgba(37,99,235,0.08) 0%, transparent 320px),
    var(--bg);
  color: var(--text);
}

.wrap { max-width: 920px; margin: 0 auto; padding: 24px; }
.hero { padding: 18px 0 6px; }
.hero h1 { margin: 8px 0 10px; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.05; }
.kicker, .eyebrow { color: var(--blue); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; font-size: .78rem; margin: 0 0 6px; }
.lead { color: var(--muted); max-width: 720px; font-size: 1.08rem; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}

h2 { margin: 0 0 14px; font-size: 1.35rem; }

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.section-head h2 { margin: 0; }

.play-btn {
  border: 0;
  background: var(--blue);
  color: white;
  min-width: 96px;
  height: 42px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.track {
  display: grid;
  gap: 12px;
  margin: 16px 0 12px;
}

.lane {
  display: grid;
  grid-template-columns: minmax(128px, 170px) 1fr;
  gap: 12px;
  align-items: center;
}

.lane-label {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.2;
}

.rail {
  position: relative;
  height: 48px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, transparent 0 11.5%, rgba(21,32,51,0.08) 11.5% 12%),
    #eef3fb;
  border: 1px solid var(--border);
}

.rail::after {
  content: "800 m";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #7a8496;
  font-size: .75rem;
  font-weight: 800;
}

.runner {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(21,32,51,0.18);
  transition: left .18s linear;
  z-index: 2;
}

.fast-runner { background: var(--danger); }
.even-runner { background: var(--blue); }
.race-slider { width: 100%; margin: 6px 0 14px; }

.race-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.race-stats div {
  background: #f7f9fd;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.race-stats span, .meter-label span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.race-stats strong { font-size: 1.2rem; }

.energy-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.energy-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcff;
}

.energy-card h3 { margin: 0 0 8px; font-size: 1rem; }
.energy-card p { margin: 0 0 12px; color: var(--muted); min-height: 74px; }
.energy-card.danger { border-left: 5px solid var(--danger); }
.energy-card.calm { border-left: 5px solid var(--blue); }

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.meter {
  height: 16px;
  border-radius: 999px;
  background: #e8edf5;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0;
  transition: width .18s linear;
}

.danger-fill { background: linear-gradient(90deg, #f97316, #dc2626); }
.calm-fill { background: linear-gradient(90deg, #60a5fa, #2563eb); }

.race-message {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #eef6ff;
  color: #1e3a8a;
  font-weight: 800;
}

label { display:block; margin: 8px 0; color: var(--muted); }
input[type="range"] { width: 100%; }
.bar { display: flex; height: 26px; border-radius: 999px; overflow: hidden; background: #e8edf5; }
.seg { height: 100%; transition: width .2s ease; }
.aerob { background: var(--aerob); }
.anaerob { background: var(--anaerob); }
.legend { margin-top: 10px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.zone { margin-top: 10px; color: #92400e; font-weight: 800; }
.hints ul { margin: 8px 0 0 18px; color: var(--muted); }
.hints li { margin: 8px 0; }
.back { display: inline-block; margin-top: 10px; color: var(--blue); text-decoration: none; font-weight: 800; }

@media (max-width: 680px) {
  .wrap { padding: 16px; }
  .section-head, .energy-cards, .race-stats { grid-template-columns: 1fr; }
  .section-head { display: grid; }
  .play-btn { width: 100%; }
  .lane { grid-template-columns: 1fr; gap: 6px; }
  .energy-card p { min-height: 0; }
}
