.biogen-route-map {
  --brm-red: #e51f3b;
  --brm-red-dark: #b90f2b;
  --brm-navy: #123b59;
  --brm-ink: #12252f;
  --brm-cream: #f4f3e8;
  --brm-grass: #a9c98d;
  --brm-sun: #ffd35d;
  --brm-height: min(78vh, 760px);
  position: relative;
  width: 100%;
  min-width: 0;
  color: var(--brm-ink);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.biogen-route-map *,
.biogen-route-map *::before,
.biogen-route-map *::after {
  box-sizing: border-box;
}

.biogen-route-map button,
.biogen-route-map input {
  font: inherit;
}

.brm-stage {
  position: relative;
  min-height: 520px;
  height: var(--brm-height);
  max-height: 920px;
  overflow: hidden;
  isolation: isolate;
  background: #b9d8de;
  border-radius: 28px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.1),
    0 16px 42px -24px rgba(18, 37, 47, 0.4),
    0 30px 70px -42px rgba(18, 59, 89, 0.45);
}

.biogen-route-map:fullscreen,
.biogen-route-map:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  padding: 0;
  background: #b9d8de;
}

.biogen-route-map:fullscreen .brm-stage,
.biogen-route-map:-webkit-full-screen .brm-stage {
  width: 100%;
  height: 100vh;
  max-height: none;
  border-radius: 0;
}

.brm-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: 1px solid rgba(0, 0, 0, 0.1);
  outline-offset: -1px;
}

.brm-stage__shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10, 42, 59, 0.2) 0, transparent 23%),
    linear-gradient(0deg, rgba(10, 29, 38, 0.23) 0, transparent 31%);
}

.brm-header {
  position: absolute;
  z-index: 3;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brm-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 7px 14px 7px 7px;
  color: var(--brm-ink);
  border-radius: 18px;
  background: rgba(250, 250, 242, 0.92);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 5px 18px -8px rgba(17, 37, 47, 0.35);
  backdrop-filter: blur(14px) saturate(1.15);
}

.brm-brand__flag {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  font-size: 25px;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  border-radius: 11px;
  background: var(--brm-red);
  transform: skew(-6deg);
  box-shadow: inset 0 -5px 12px rgba(124, 0, 25, 0.2);
}

.brm-brand__copy {
  display: grid;
  line-height: 1.05;
}

.brm-brand__copy strong {
  font-family: "Arial Narrow", "Avenir Next Condensed", "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.brm-brand__copy small,
.brm-terrain-key small {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.63;
}

.brm-terrain-key {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  color: #fff;
  border-radius: 12px;
  background: rgba(10, 42, 59, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(12px);
}

.brm-terrain-key span {
  width: 23px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #7bb66a, #f1d570, #d18462);
}

.brm-stats {
  position: absolute;
  z-index: 3;
  top: 20px;
  right: 72px;
  display: flex;
  color: #fff;
  border-radius: 17px;
  background: rgba(10, 42, 59, 0.78);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.11),
    0 7px 24px -12px rgba(5, 25, 35, 0.62);
  backdrop-filter: blur(14px) saturate(1.1);
}

.brm-stats > div {
  min-width: 91px;
  padding: 11px 15px 10px;
}

.brm-stats > div + div {
  border-left: 1px solid rgba(255, 255, 255, 0.13);
}

.brm-stats span {
  font-family: "Arial Narrow", "Avenir Next Condensed", sans-serif;
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.brm-stats small {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.7;
}

.brm-stats label {
  display: block;
  margin-top: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.63;
}

.brm-stats .brm-stats__grade {
  min-width: 94px;
}

.brm-stats__grade span {
  font-size: 14px;
}

.brm-fullscreen {
  position: absolute;
  z-index: 4;
  top: 20px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: #fff;
  border: 0;
  border-radius: 12px;
  background: rgba(10, 42, 59, 0.78);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.11);
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition-property: scale, background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.brm-fullscreen:hover { background: rgba(10, 42, 59, 0.95); }
.brm-fullscreen:active { scale: 0.96; }
.brm-fullscreen svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.brm-console {
  position: absolute;
  z-index: 4;
  right: 20px;
  bottom: 20px;
  left: 20px;
  padding: 12px 16px 10px;
  border-radius: 22px;
  background: rgba(250, 250, 242, 0.94);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 9px 28px -13px rgba(18, 37, 47, 0.42),
    0 22px 55px -30px rgba(18, 37, 47, 0.5);
  backdrop-filter: blur(16px) saturate(1.15);
}

.brm-console__meta {
  display: grid;
  grid-template-columns: 76px 1fr 55px;
  align-items: center;
  gap: 12px;
  min-height: 26px;
}

.brm-console__meta > span {
  color: var(--brm-red);
  font-family: "Arial Narrow", "Avenir Next Condensed", sans-serif;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.brm-console__meta > span:last-child {
  color: var(--brm-ink);
  text-align: right;
  opacity: 0.58;
}

.brm-console__meta p {
  overflow: hidden;
  margin: 0;
  color: var(--brm-ink);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  text-wrap: pretty;
  white-space: nowrap;
}

.brm-transport {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: end;
  gap: 13px;
}

.brm-play {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  padding: 0;
  color: #fff;
  border: 0;
  border-radius: 15px;
  background: var(--brm-red);
  box-shadow:
    inset 0 -6px 13px rgba(124, 0, 25, 0.2),
    0 6px 13px -7px rgba(151, 0, 31, 0.65);
  cursor: pointer;
  transition-property: scale, background-color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.brm-play:hover { background: #cf1532; }
.brm-play:active { scale: 0.96; }

.brm-play__icons {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.brm-play svg {
  grid-area: 1 / 1;
  width: 22px;
  height: 22px;
  fill: currentColor;
  transition-property: scale, opacity, filter;
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.brm-play__play { margin-left: 2px; opacity: 1; scale: 1; filter: blur(0); }
.brm-play__pause { opacity: 0; scale: 0.25; filter: blur(4px); }
.brm-is-playing .brm-play__play { opacity: 0; scale: 0.25; filter: blur(4px); }
.brm-is-playing .brm-play__pause { opacity: 1; scale: 1; filter: blur(0); }

.brm-scrubber {
  position: relative;
  height: 78px;
}

.brm-profile {
  position: absolute;
  inset: 0 0 16px;
  width: 100%;
  height: 62px;
  overflow: visible;
}

.brm-profile__area { fill: rgba(18, 59, 89, 0.08); }
.brm-profile__line { fill: none; stroke: rgba(18, 59, 89, 0.38); stroke-width: 2; vector-effect: non-scaling-stroke; }

.brm-track {
  position: absolute;
  right: 0;
  bottom: 23px;
  left: 0;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(18, 59, 89, 0.16);
}

.brm-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brm-red-dark), var(--brm-red));
  box-shadow: 0 0 11px rgba(229, 31, 59, 0.38);
}

.brm-scrubber input[type="range"] {
  position: absolute;
  right: -9px;
  bottom: 10px;
  left: -9px;
  width: calc(100% + 18px);
  height: 32px;
  margin: 0;
  opacity: 0;
  outline: none;
  cursor: ew-resize;
}

.brm-scrubber::after {
  content: "";
  position: absolute;
  bottom: 17px;
  left: calc(var(--brm-progress, 0) * 1%);
  width: 17px;
  height: 17px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--brm-red);
  box-shadow:
    0 0 0 1px rgba(113, 0, 21, 0.18),
    0 3px 9px rgba(113, 0, 21, 0.32);
  pointer-events: none;
  transform: translateX(-50%);
}

.brm-km-ticks {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: space-between;
  color: rgba(18, 37, 47, 0.52);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.brm-hint {
  margin: 0;
  color: rgba(18, 37, 47, 0.48);
  font-size: 9px;
  font-weight: 650;
  line-height: 1;
  text-align: center;
  text-wrap: pretty;
}

.brm-loading {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 13px;
  color: var(--brm-navy);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--brm-cream);
  transition-property: opacity, visibility;
  transition-duration: 350ms;
  transition-timing-function: ease-out;
}

.brm-loading__mark {
  width: 50px;
  height: 50px;
  border: 7px solid rgba(18, 59, 89, 0.12);
  border-top-color: var(--brm-red);
  border-radius: 50%;
  animation: brm-spin 750ms linear infinite;
}

.brm-is-ready .brm-loading {
  visibility: hidden;
  opacity: 0;
}

.brm-error {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-content: center;
  margin: 0;
  padding: 30px;
  color: #fff;
  text-align: center;
  background: var(--brm-navy);
}

.brm-fullscreen:focus-visible,
.brm-play:focus-visible {
  outline: 3px solid var(--brm-sun);
  outline-offset: 3px;
}

.brm-scrubber:has(input:focus-visible)::after {
  box-shadow:
    0 0 0 1px rgba(113, 0, 21, 0.18),
    0 3px 9px rgba(113, 0, 21, 0.32),
    0 0 0 4px var(--brm-sun);
}

@keyframes brm-spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .brm-stage { min-height: 580px; border-radius: 20px; }
  .brm-header { top: 13px; left: 13px; }
  .brm-brand { min-height: 48px; border-radius: 15px; }
  .brm-brand__flag { width: 34px; height: 34px; border-radius: 8px; font-size: 21px; }
  .brm-terrain-key { display: none; }
  .brm-fullscreen { top: 13px; right: 13px; }
  .brm-stats { top: 72px; right: 13px; left: 13px; justify-content: stretch; }
  .brm-stats > div { flex: 1; min-width: 0; padding: 9px 12px 8px; }
  .brm-stats span { font-size: 18px; }
  .brm-stats .brm-stats__grade { min-width: 0; }
  .brm-console { right: 13px; bottom: 13px; left: 13px; padding: 10px 12px 9px; border-radius: 18px; }
  .brm-console__meta { grid-template-columns: 62px 1fr 40px; gap: 8px; }
  .brm-console__meta p { font-size: 10px; }
  .brm-transport { grid-template-columns: 44px 1fr; gap: 9px; }
  .brm-play { width: 44px; height: 44px; margin-bottom: 10px; border-radius: 13px; }
  .brm-km-ticks { font-size: 7px; }
  .brm-hint { display: none; }
}

@media (max-width: 440px) {
  .brm-brand__copy small { display: none; }
  .brm-stats > div { padding-inline: 9px; }
  .brm-stats label { letter-spacing: 0.06em; }
  .brm-stats__grade { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .biogen-route-map *,
  .biogen-route-map *::before,
  .biogen-route-map *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
