.runner-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(185, 28, 28, .18), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(226, 178, 101, .12), transparent 30%),
    linear-gradient(145deg, #04070d 0%, #0b1018 52%, #05070b 100%);
  color: #f8fafc;
}

.runner-hero,
.runner-shell {
  width: min(1320px, calc(100% - 2rem));
  margin: 0 auto;
}

.runner-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 25rem);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: end;
  padding: clamp(6rem, 11vw, 9rem) 0 2rem;
}

.runner-back,
.runner-route-link {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: #e5c27a;
  font-family: Montserrat, Arial, sans-serif;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-decoration: none;
  text-transform: uppercase;
}

.runner-kicker {
  margin: 0 0 .7rem;
  color: #e5c27a;
  font-family: Montserrat, Arial, sans-serif;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.runner-hero h1 {
  max-width: 840px;
  margin: .7rem 0 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.8rem, 8vw, 7rem);
  font-weight: 700;
  line-height: .92;
}

.runner-hero__copy > p:last-child {
  max-width: 720px;
  margin: 1rem 0 0;
  color: #cbd5e1;
  font-size: clamp(1rem, 1.7vw, 1.2rem);
  line-height: 1.75;
}

.runner-identity {
  display: grid;
  justify-items: center;
  gap: .9rem;
  padding: 1.2rem;
  border: 1px solid rgba(226, 178, 101, .2);
  background: rgba(15, 23, 42, .56);
}

.runner-identity img {
  width: min(9rem, 44vw);
  height: auto;
  opacity: .9;
}

.runner-identity span {
  color: #d6c8af;
  font-size: .9rem;
  line-height: 1.55;
  text-align: center;
}

.runner-shell,
.runner-worlds {
  display: grid;
  gap: 1.1rem;
}

.runner-shell {
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 23rem);
  align-items: start;
  padding: 0 0 5rem;
}

.runner-shell.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100%;
  height: 100dvh;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: auto;
  background: #04070d;
}

.runner-shell.is-fullscreen .runner-stage {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 0;
}

.runner-shell.is-fullscreen .runner-notes,
.runner-shell.is-fullscreen ~ .runner-worlds {
  display: none;
}

.runner-stage,
.runner-notes {
  border: 1px solid rgba(148, 163, 184, .18);
  background: rgba(10, 15, 23, .76);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .32);
}

.runner-stage {
  overflow: hidden;
  contain: layout paint;
}

.runner-stage__topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, .14);
}

.runner-stage__topline span,
.runner-scoreboard p {
  display: block;
  margin: 0 0 .25rem;
  color: #c8a96b;
  font-family: Montserrat, Arial, sans-serif;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.runner-stage__topline strong {
  color: #f8fafc;
  font-weight: 700;
}

.runner-scoreboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(4.2rem, auto));
  gap: .65rem;
  align-items: center;
  text-align: right;
}

.runner-scoreboard strong {
  display: block;
  color: #fff;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  line-height: 1;
}

.runner-progress {
  position: relative;
  height: .48rem;
  overflow: hidden;
  border-bottom: 1px solid rgba(148, 163, 184, .14);
  background: rgba(2, 6, 23, .72);
}

.runner-progress span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #e5c27a, #f8fafc);
  transition: transform .18s linear;
}

.runner-progress small {
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(248, 250, 252, .72);
  font-family: Montserrat, Arial, sans-serif;
  font-size: .48rem;
  font-weight: 900;
  letter-spacing: .1em;
}

.runner-canvas-wrap {
  position: relative;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    #070b12;
  background-size: 64px 64px;
}

.runner-start-panel,
.runner-transition-panel {
  position: absolute;
  inset: 1rem;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: .8rem;
  padding: 1.25rem;
  color: #f8fafc;
  text-align: center;
  background: radial-gradient(circle at center, rgba(8, 13, 22, .78), rgba(8, 13, 22, .42) 54%, rgba(8, 13, 22, .16));
}

.runner-start-panel[hidden],
.runner-transition-panel[hidden] {
  display: none;
}

.runner-start-panel h2,
.runner-transition-panel h2 {
  max-width: 42rem;
  margin: 0;
  color: #fff;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: .95;
}

.runner-start-panel p:not(.runner-kicker),
.runner-transition-panel p:not(.runner-kicker) {
  max-width: 34rem;
  margin: 0;
  color: #cbd5e1;
  font-size: 1rem;
}

.runner-name-card {
  display: grid;
  gap: .35rem;
  width: min(100%, 22rem);
  margin: .15rem 0 .1rem;
  padding: .75rem .85rem;
  border: 1px solid rgba(226, 178, 101, .34);
  background:
    linear-gradient(135deg, rgba(226, 178, 101, .08), transparent 45%),
    rgba(2, 6, 23, .7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.runner-name-card label,
.runner-name-card span {
  font-family: Montserrat, Arial, sans-serif;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.runner-name-card label {
  color: #e5c27a;
}

.runner-name-card input {
  width: 100%;
  min-height: 2.45rem;
  border: 1px solid rgba(148, 163, 184, .3);
  background: rgba(15, 23, 42, .9);
  color: #fff;
  outline: none;
  padding: 0 .75rem;
  font: 800 .9rem Montserrat, Arial, sans-serif;
  text-align: center;
}

.runner-name-card input:focus {
  border-color: rgba(226, 178, 101, .78);
}

.runner-name-card input[readonly] {
  opacity: .82;
}

.runner-start-panel button,
.runner-transition-panel button {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 2.85rem;
  margin-top: .3rem;
  padding: 0 1rem;
  border: 1px solid rgba(226, 178, 101, .55);
  background: rgba(226, 178, 101, .16);
  color: #fff;
  cursor: pointer;
  font-family: Montserrat, Arial, sans-serif;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

#runner-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 22rem;
  border: 0;
  outline: none;
  touch-action: manipulation;
}

#runner-canvas:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(229, 194, 122, .9);
}

.runner-touch-hint {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  display: none;
  align-items: center;
  gap: .4rem;
  padding: .5rem .7rem;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(2, 6, 23, .72);
  color: #e5c27a;
  font-family: Montserrat, Arial, sans-serif;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.runner-score-feedback {
  position: absolute;
  top: 1rem;
  left: 50%;
  z-index: 4;
  max-width: min(28rem, calc(100% - 2rem));
  transform: translateX(-50%);
  padding: .55rem .8rem;
  border: 1px solid rgba(226, 178, 101, .4);
  background: rgba(2, 6, 23, .84);
  color: #f8fafc;
  font-family: Montserrat, Arial, sans-serif;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-align: center;
  text-transform: uppercase;
}

.runner-score-feedback[hidden] {
  display: none;
}

.runner-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .65rem;
  padding: 1rem;
  border-top: 1px solid rgba(148, 163, 184, .14);
}

.runner-controls button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  min-height: 3rem;
  border: 1px solid rgba(226, 178, 101, .32);
  background: rgba(15, 23, 42, .82);
  color: #fff;
  cursor: pointer;
  font-family: Montserrat, Arial, sans-serif;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.runner-controls button span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.runner-controls button:hover {
  border-color: rgba(226, 178, 101, .72);
  background: rgba(226, 178, 101, .16);
  transform: translateY(-1px);
}

.runner-controls button:disabled {
  cursor: not-allowed;
  opacity: .42;
  transform: none;
}

.runner-notes {
  padding: 1rem;
}

.runner-notes h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.05;
}

.runner-notes ul {
  display: grid;
  gap: .6rem;
  margin: .85rem 0;
  padding: 0;
  list-style: none;
}

.runner-notes li {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: .6rem;
  align-items: start;
  color: #cbd5e1;
  font-size: .92rem;
  line-height: 1.42;
}

.runner-notes li i {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: #e5c27a;
  background: rgba(226, 178, 101, .08);
}

.runner-leaderboard {
  display: grid;
  gap: .75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, .14);
}

.runner-leaderboard h3 {
  margin: 0;
  color: #fff;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.05;
}

.runner-leaderboard ol {
  display: grid;
  gap: .35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.runner-leaderboard li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
  min-height: 2.15rem;
  padding: .42rem .55rem;
  border: 1px solid rgba(148, 163, 184, .12);
  background: rgba(15, 23, 42, .48);
}

.runner-leaderboard li span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: .45rem;
  color: #d6c8af;
  font-size: .82rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.runner-leaderboard li em {
  display: inline-grid;
  flex: 0 0 1.4rem;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  color: #05070b;
  background: #e5c27a;
  font-style: normal;
  font-size: .72rem;
  font-weight: 900;
}

.runner-leaderboard li strong {
  color: #fff;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.1rem;
  line-height: 1;
}

.runner-worlds {
  width: min(1320px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0 0 5rem;
}

.runner-worlds__head {
  max-width: 780px;
}

.runner-worlds__head h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.runner-worlds__head p:last-child {
  max-width: 660px;
  color: #cbd5e1;
  line-height: 1.65;
}

.runner-world-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .9rem;
}

.runner-world-card {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, .18);
  background: rgba(10, 15, 23, .76);
  cursor: pointer;
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
}

.runner-world-card:hover,
.runner-world-card.is-active {
  border-color: color-mix(in srgb, var(--runner-world-color, #e5c27a) 70%, white 0%);
  background: rgba(15, 23, 42, .92);
  transform: translateY(-2px);
}

.runner-world-card__visual {
  position: relative;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--runner-world-color, #e5c27a) 32%, transparent), transparent 36%),
    #020617;
}

.runner-world-card__visual::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(2, 6, 23, .8));
  content: "";
}

.runner-world-card__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .72;
}

.runner-world-card > div:last-child {
  padding: 1rem;
}

.runner-world-card span {
  color: var(--runner-world-color, #e5c27a);
  font-family: Montserrat, Arial, sans-serif;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.runner-world-card h3 {
  margin: .4rem 0 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.65rem;
  line-height: 1;
}

.runner-world-card p {
  margin: .65rem 0 0;
  color: #cbd5e1;
  font-size: .92rem;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .runner-hero,
  .runner-shell {
    grid-template-columns: 1fr;
  }

  .runner-world-grid {
    grid-template-columns: 1fr;
  }

  .runner-hero {
    padding-top: 5.5rem;
  }

  .runner-identity {
    justify-items: start;
    grid-template-columns: auto 1fr;
    text-align: left;
  }

  .runner-identity img {
    width: 5.2rem;
  }

  .runner-identity span {
    text-align: left;
  }
}

@media (max-width: 1180px) {
  .runner-stage__topline {
    grid-template-columns: 1fr;
  }

  .runner-scoreboard {
    justify-content: start;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .runner-hero,
  .runner-shell {
    width: 100%;
  }

  .runner-hero {
    width: min(100% - 1rem, 1320px);
  }

  .runner-hero h1 {
    font-size: clamp(2.45rem, 17vw, 4rem);
  }

  .runner-shell {
    gap: .75rem;
  }

  .runner-stage {
    border-left: 0;
    border-right: 0;
  }

  .runner-stage__topline {
    gap: .65rem;
    padding: .75rem;
  }

  .runner-progress {
    height: .42rem;
  }

  .runner-stage__topline,
  .runner-scoreboard {
    align-items: start;
    text-align: left;
  }

  .runner-scoreboard {
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .35rem;
  }

  .runner-stage__topline span,
  .runner-scoreboard p {
    font-size: .48rem;
    letter-spacing: .11em;
  }

  .runner-scoreboard strong {
    font-size: .96rem;
  }

  #runner-canvas {
    min-height: clamp(24rem, 86vw, 34rem);
  }

  .runner-touch-hint {
    display: inline-flex;
  }

  .runner-score-feedback {
    top: .55rem;
    font-size: .62rem;
    letter-spacing: .08em;
  }

  .runner-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    padding: .65rem;
  }

  .runner-controls button {
    min-height: 2.85rem;
    padding: .35rem .45rem;
    font-size: .66rem;
    letter-spacing: .08em;
  }

  .runner-start-panel,
  .runner-transition-panel {
    inset: .35rem;
    gap: .45rem;
    padding: .85rem .7rem;
    align-content: center;
  }

  .runner-start-panel h2,
  .runner-transition-panel h2 {
    max-width: min(21rem, 94%);
    font-size: clamp(2.05rem, 10.5vw, 3.25rem);
    line-height: .98;
    text-wrap: balance;
    overflow-wrap: anywhere;
  }

  .runner-start-panel p:not(.runner-kicker),
  .runner-transition-panel p:not(.runner-kicker) {
    max-width: 20rem;
    font-size: .86rem;
    line-height: 1.35;
  }

  .runner-name-card {
    width: min(100%, 19rem);
    padding: .55rem;
  }

  .runner-name-card input {
    min-height: 2.25rem;
    font-size: .8rem;
  }

  .runner-start-panel button,
  .runner-transition-panel button {
    max-width: min(19rem, 96%);
    min-height: 2.65rem;
    padding: .45rem .8rem;
    white-space: normal;
    justify-content: center;
    font-size: .66rem;
    line-height: 1.2;
    letter-spacing: .09em;
  }

  .runner-kicker {
    font-size: .58rem;
    letter-spacing: .18em;
  }
}

@media (max-width: 420px) {
  .runner-stage__topline {
    padding: .6rem;
  }

  .runner-scoreboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #runner-canvas {
    min-height: clamp(24rem, 105vw, 31rem);
  }

  .runner-transition-panel h2 {
    font-size: clamp(1.72rem, 9vw, 2.55rem);
  }

  .runner-start-panel p:not(.runner-kicker),
  .runner-transition-panel p:not(.runner-kicker) {
    font-size: .8rem;
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .runner-shell.is-fullscreen .runner-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .runner-shell.is-fullscreen .runner-controls button {
    min-height: 2.55rem;
    font-size: .58rem;
  }

  .runner-shell.is-fullscreen #runner-canvas {
    height: clamp(25rem, calc(100dvh - 13.5rem), 72dvh);
    min-height: 0;
  }
}

@media (max-width: 640px) and (orientation: landscape) {
  .runner-shell.is-fullscreen .runner-stage {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .runner-shell.is-fullscreen .runner-controls {
    position: absolute;
    right: .5rem;
    bottom: .5rem;
    width: min(23rem, calc(100% - 1rem));
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: rgba(2, 6, 23, .72);
  }

  .runner-shell.is-fullscreen #runner-canvas {
    height: calc(100dvh - 4.5rem);
    min-height: 0;
  }
}

.runner-shell.is-fullscreen #runner-canvas {
  min-height: min(72dvh, 52rem);
}

.runner-shell.is-fullscreen .runner-canvas-wrap {
  min-height: 0;
}

@media (prefers-reduced-motion: reduce) {
  .runner-controls button,
  .runner-world-card {
    transition: none;
  }
}
