/* The Ladder to TON 618 — one page, one climb. */

:root {
  --chat-w: 360px;
  --ink: #14161b;
  --ink-2: #4f5563;
  --ink-3: #8d94a1;
  --line: #eceef2;
  --paper: #ffffff;
  --paper-2: #f6f7f9;
  --accent: #ffb547;
  --accent-ink: #9a5b00;
  --cool: #a9d8ff;
  --glass: rgba(9, 11, 17, 0.44);
  --glass-line: rgba(255, 255, 255, 0.09);
  --hud-ink: #f4f1ea;
  --hud-dim: rgba(244, 241, 234, 0.62);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #07080c;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: var(--chat-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  width: 100%;
}

/* ------------------------------------------------------------------ chat */

.chat {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.06), 8px 0 30px rgba(0, 0, 0, 0.18);
}

.chat-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.chat-title {
  flex: 1;
  min-width: 0;
}

.chat-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chat-title p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--ink-3);
}

.presence {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 9px;
  border-radius: 999px;
  background: var(--paper-2);
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.presence strong {
  color: var(--ink);
}

.presence-dot,
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.chat-toggle {
  display: none;
}

.chat-body {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #d5d8de transparent;
  padding: 8px 0 12px;
}

.chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chat-empty {
  padding: 26px 22px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.5;
}

.chat-empty p {
  margin: 0 0 6px;
}

.chat-empty-title {
  font-weight: 650;
  color: var(--ink);
}

.chat-example {
  position: relative;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px dashed #d9dce2;
  border-radius: 10px;
  color: var(--ink-3);
  font-size: 13px;
}

.chat-example p {
  margin: 4px 0;
}

.chat-example b {
  font-weight: 600;
  margin-right: 6px;
}

.example-tag {
  position: absolute;
  top: -9px;
  left: 12px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--paper);
}

.history-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 18px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.history-divider::before,
.history-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.history-divider.is-live {
  color: #16a34a;
}

.msg {
  position: relative;
  padding: 7px 44px 7px 18px;
  transition: background-color 1.2s ease;
}

.msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.msg-name {
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-you {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
}

.msg-time {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.msg-text {
  margin-top: 1px;
  font-size: 14px;
  line-height: 1.42;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.msg.is-history .msg-text {
  color: var(--ink-2);
}

.msg.is-history .msg-name {
  opacity: 0.75;
}

.msg.is-new {
  animation: msg-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
  background: #fff6dc;
}

.msg.is-new.is-settled {
  background: transparent;
}

.msg.is-mine.is-new {
  background: #eaf4ff;
}

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

.msg-actions {
  position: absolute;
  top: 6px;
  right: 10px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.msg:hover .msg-actions,
.msg:focus-within .msg-actions,
.msg.show-actions .msg-actions {
  opacity: 1;
}

.msg-action {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}

.msg-action:hover,
.msg-action:focus-visible {
  background: var(--paper-2);
  color: var(--ink);
  outline: none;
}

.msg-action.is-armed {
  width: auto;
  padding: 0 8px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11.5px;
  font-weight: 650;
}

.msg-action svg {
  width: 14px;
  height: 14px;
}

.msg-action.mod {
  color: #b91c1c;
}

.chat-jump {
  position: absolute;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.chat-form {
  padding: 12px 14px 12px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

/* the always-visible instruction above the input */
.howto {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f3f6fa;
  border: 1px solid #d3dce8;
  color: #334155;
  font-size: 12.5px;
  line-height: 1.38;
}

.howto strong {
  display: block;
  font-size: 14px;
  color: #0f172a;
}

.howto-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.chat-you {
  margin: 8px 2px 0;
  font-size: 12px;
  color: var(--ink-3);
}

.chat-you strong {
  color: var(--ink-2);
  font-weight: 650;
}

.chat-input-row {
  position: relative;
  display: flex;
  gap: 8px;
}

#chat-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border: 1px solid #dfe2e7;
  border-radius: 11px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

#chat-input:focus {
  border-color: #b9c0cc;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(20, 22, 27, 0.06);
}

#chat-input:disabled {
  opacity: 0.6;
}

#chat-send {
  position: relative;
  min-width: 78px;
  height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  transition: transform 0.08s, background 0.15s, opacity 0.15s;
}

#chat-send:hover {
  background: #2a2e37;
}

#chat-send:active {
  transform: scale(0.97);
}

#chat-send:disabled {
  opacity: 0.4;
  cursor: default;
}

/* 2-second cooldown: the button fills back up, with the seconds left */
#chat-send.is-cooling {
  background: #5d6270;
  opacity: 1;
}

.send-label {
  position: relative;
  z-index: 1;
}

.send-cooldown {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  background: rgba(255, 255, 255, 0.22);
}

/* the private "+1" when your message makes him climb */
.plus-layer {
  position: absolute;
  right: 14px;
  top: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.plus {
  position: absolute;
  right: 0;
  bottom: 6px;
  font-size: 22px;
  font-weight: 900;
  color: #f59e0b;
  text-shadow: 0 2px 10px rgba(245, 158, 11, 0.55);
  animation: plus-rise 1.1s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes plus-rise {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.6);
  }
  18% {
    opacity: 1;
    transform: translateY(-6px) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translateY(-46px) scale(1);
  }
}

.stage-plus {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.stage-plus .plus-big {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 44px;
  font-weight: 900;
  color: #ffd27a;
  -webkit-text-stroke: 1px rgba(80, 40, 0, 0.35);
  text-shadow: 0 0 22px rgba(255, 190, 80, 0.85), 0 3px 12px rgba(0, 0, 0, 0.45);
  animation: plus-big 1.4s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

.stage-plus .plus-big small {
  display: block;
  margin-top: -6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  color: #fff3d6;
  -webkit-text-stroke: 0;
}

@keyframes plus-big {
  0% {
    opacity: 0;
    transform: translate(-50%, -20%) scale(0.5);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -60%) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -190%) scale(1);
  }
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 18px;
  margin: 6px 2px 0;
  font-size: 12px;
}

.chat-status {
  color: var(--ink-3);
}

.chat-status.is-error {
  color: #b91c1c;
}

.chat-status.is-ok {
  color: #15803d;
}

.chat-counter {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------- stage */

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #0b0d12;
  color: var(--hud-ink);
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.32) 100%);
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.28), transparent);
}

.topbar > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.music-btn {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--hud-ink, #fff);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
}

.chat-you {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.sent-count {
  font-weight: 700;
  color: var(--ink-2, #475569);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.brand h1 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.brand h1 span {
  color: #d9ccff;
}

.live {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.live-label {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #86efac;
}

.live.is-offline .live-dot {
  background: #f59e0b;
  animation: none;
}

.live.is-offline .live-label {
  color: #fcd34d;
}

.live-sep {
  opacity: 0.5;
}

.info-btn {
  margin-left: auto;
  padding: 6px 13px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--hud-ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.info-btn:hover {
  background: rgba(20, 24, 34, 0.6);
}

/* HUD -------------------------------------------------------------------- */

.hud {
  position: absolute;
  top: 62px;
  right: 70px;
  width: 244px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.hud-card {
  padding: 10px 13px 11px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.hud-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hud-dim);
}

.hud-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.distance {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  margin: 4px 0 4px;
}

.distance-value {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

.distance-unit {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

.hud-sub {
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--hud-ink);
  font-variant-numeric: tabular-nums;
}

.hud-dim {
  color: var(--hud-dim);
}

.hud-climb {
  border-color: rgba(255, 196, 97, 0.35);
}

.climb-cta {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: #ffd27a;
  text-shadow: 0 2px 14px rgba(255, 170, 60, 0.35);
}

.climb-rules {
  margin: 6px 0 6px;
  padding: 0;
  list-style: none;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--hud-ink);
}

.climb-rules li::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 8px 2px 1px;
  border-radius: 50%;
  background: #ffc861;
}

.climb-rules b {
  color: #ffd27a;
}

.climb-status {
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--hud-ink);
  transition: background 0.3s, color 0.3s;
}

.climb-status.is-climbing {
  background: rgba(255, 196, 97, 0.18);
  color: #ffe2a8;
}

.stage-index {
  float: right;
  letter-spacing: 0.06em;
}

.stage-name {
  margin-top: 3px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.milestone {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--hud-ink);
}

.milestone b {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hud-dim);
  font-weight: 700;
}

.milestone-next + .milestone,
.milestone + .milestone-next {
  margin-top: 6px;
  padding-top: 6px;
}

.milestone .eta {
  color: var(--hud-dim);
}

/* Journey track ---------------------------------------------------------- */

.track {
  position: absolute;
  top: 74px;
  bottom: 40px;
  right: 22px;
  width: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.track-end {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hud-dim);
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.track-top {
  color: #d9ccff;
  margin-bottom: 8px;
}

.track-bottom {
  margin-top: 8px;
}

.track-rail {
  position: relative;
  flex: 1;
  width: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
}

.track-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--p, 0) * 100%);
  border-radius: 4px;
  background: linear-gradient(to top, #ffb547, #c8b4ff);
}

.track-ticks {
  position: absolute;
  inset: 0;
}

.track-tick {
  position: absolute;
  left: -3px;
  bottom: calc(var(--t, 0) * 100%);
  width: 10px;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
}

.track-marker {
  position: absolute;
  left: 50%;
  bottom: calc(var(--p, 0) * 100%);
  width: 14px;
  height: 14px;
  margin: 0 0 -7px -7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 181, 71, 0.35), 0 0 16px rgba(255, 181, 71, 0.9);
}

.track-marker span {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Overlays --------------------------------------------------------------- */

.connection {
  position: absolute;
  left: 50%;
  top: 64px;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(30, 20, 6, 0.72);
  border: 1px solid rgba(255, 181, 71, 0.35);
  color: #ffe2b0;
  font-size: 12.5px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ending {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  width: min(380px, calc(100% - 40px));
  padding: 20px 24px 22px;
  border-radius: 18px;
  text-align: left;
  background: rgba(14, 10, 28, 0.56);
  border: 1px solid rgba(200, 180, 255, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(60, 30, 140, 0.35);
  animation: ending-in 2.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes ending-in {
  from {
    opacity: 0;
    transform: translate(-14px, -50%);
  }
  to {
    opacity: 1;
    transform: translate(0, -50%);
  }
}

.ending-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #cbb9ff;
}

.ending h2 {
  margin: 8px 0 6px;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.ending p {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(244, 241, 234, 0.85);
}

.ending-stats {
  font-variant-numeric: tabular-nums;
  color: rgba(244, 241, 234, 0.7) !important;
}

.ending-foot {
  margin-top: 10px !important;
  font-size: 12.5px !important;
  color: rgba(244, 241, 234, 0.55) !important;
}

.about {
  position: absolute;
  top: 64px;
  right: 20px;
  z-index: 20;
  width: min(460px, calc(100% - 40px));
  max-height: calc(100% - 90px);
  overflow-y: auto;
  padding: 22px 24px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  font-size: 13.5px;
  line-height: 1.55;
}

.about h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.about h3 {
  margin: 16px 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.about p {
  margin: 0 0 6px;
  color: #2b2f38;
}

.about-foot {
  margin-top: 14px !important;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-3) !important;
  font-size: 12.5px;
}

.about-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-3);
  cursor: pointer;
}

.about-close:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.nogl {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 12px;
}

.nogl p {
  margin: 0;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 24px;
  margin: 0;
  background: #07080c;
  color: #fff;
  font-size: 16px;
  text-align: center;
}

.no-hud .hud,
.no-hud .track,
.no-hud .topbar,
.no-hud .preview,
.no-hud .connection {
  display: none !important;
}

/* Preview tools (development only) */
.preview {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 30;
  width: min(560px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(10, 12, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
  color: #e9e6df;
}

.preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  flex-wrap: wrap;
}

.preview input[type="range"] {
  flex: 1;
}

.preview select,
.preview button {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 12px;
}

.preview .preview-tag {
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fbbf24;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
  :root {
    --chat-w: 320px;
  }
  .hud {
    width: 260px;
    right: 66px;
  }
  .distance-value {
    font-size: 34px;
  }
}

@media (max-width: 960px) {
  :root {
    --chat-w: 290px;
  }
  .hud {
    width: 232px;
    right: 60px;
    gap: 8px;
  }
  .hud-card {
    padding: 11px 13px;
  }
  .distance-value {
    font-size: 30px;
  }
  .climb-cta {
    font-size: 16px;
  }
  #stage-blurb {
    display: none;
  }
  .brand h1 {
    font-size: 11.5px;
    letter-spacing: 0.12em;
  }
}

@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .stage {
    grid-row: 1;
  }
  .chat {
    grid-row: 2;
    height: 36dvh;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
    border-radius: 16px 16px 0 0;
    margin-top: -14px;
  }
  .chat.is-collapsed {
    height: auto;
  }
  .chat.is-collapsed .chat-scroll,
  .chat.is-collapsed .chat-jump {
    display: none;
  }
  .chat-head {
    align-items: center;
    padding: 12px 14px 10px;
  }
  .chat-title p {
    display: none;
  }
  .chat-toggle {
    display: block;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
  }
  .chat-form {
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  }
  .chat-you {
    display: flex;
    font-size: 11px;
  }
  .msg {
    padding: 6px 40px 6px 14px;
  }
  .chat-jump {
    bottom: 84px;
  }
  .topbar {
    padding: 10px 12px;
    gap: 8px;
  }
  .brand h1 {
    font-size: 10.5px;
    letter-spacing: 0.1em;
  }
  .live {
    padding: 4px 9px;
    font-size: 11px;
  }
  .live-sep,
  .live-label {
    display: none;
  }
  .info-btn {
    padding: 4px 10px;
    font-size: 11px;
  }
  .hud {
    top: 44px;
    left: 8px;
    right: 8px;
    width: auto;
    flex-direction: row;
    align-items: flex-start;
    gap: 6px;
  }
  .hud-card {
    padding: 5px 8px;
    border-radius: 9px;
    background: rgba(24, 22, 28, 0.42);
  }
  .hud-sub,
  .climb-cta {
    line-height: 1.25;
  }
  .hud-label {
    font-size: 9px;
    letter-spacing: 0.1em;
  }
  .hud-distance {
    flex: 1.25;
    min-width: 0;
  }
  .hud-climb {
    flex: 1;
    min-width: 0;
  }
  .hud-stage,
  #dist-remaining,
  .climb-rules,
  #climb-detail {
    display: none;
  }
  .distance {
    margin: 2px 0 0;
  }
  .distance-value {
    font-size: 18px;
  }
  .distance-unit {
    font-size: 11px;
  }
  .hud-sub {
    font-size: 9.5px;
    line-height: 1.3;
  }
  .climb-cta {
    font-size: 11.5px;
  }
  .climb-status {
    margin-top: 3px;
    padding: 2px 6px;
    font-size: 9.5px;
  }
  .howto {
    margin-bottom: 8px;
    padding: 7px 10px;
    font-size: 11.5px;
  }
  .howto strong {
    font-size: 13px;
  }
  .howto-badge {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
  .track {
    top: auto;
    bottom: 24px;
    left: 14px;
    right: 14px;
    width: auto;
    height: 22px;
    flex-direction: row;
  }
  .track-rail {
    height: 4px;
    width: auto;
    flex: 1;
  }
  .track-top {
    order: 3;
    margin: 0 0 0 8px;
  }
  .track-bottom {
    order: 1;
    margin: 0 8px 0 0;
  }
  .track-rail {
    order: 2;
  }
  .track-fill {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    height: auto;
    width: calc(var(--p, 0) * 100%);
    background: linear-gradient(to right, #ffb547, #c8b4ff);
  }
  .track-tick {
    top: -3px;
    bottom: auto;
    left: calc(var(--t, 0) * 100%);
    width: 1px;
    height: 10px;
  }
  .track-marker {
    bottom: auto;
    top: 50%;
    left: calc(var(--p, 0) * 100%);
    margin: -7px 0 0 -7px;
  }
  .track-marker span {
    right: auto;
    left: 50%;
    top: -26px;
    transform: translateX(-50%);
  }
  .ending {
    left: 10px;
    right: 10px;
    top: 112px;
    width: auto;
    transform: none;
    padding: 12px 14px;
    animation: none;
  }
  .ending h2 {
    font-size: 20px;
  }
  .ending p {
    font-size: 12.5px;
  }
  .about {
    top: 48px;
    right: 10px;
    left: 10px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .presence-dot,
  .live-dot {
    animation: none;
  }
  .msg.is-new,
  .ending {
    animation: none;
  }
  .chat-scroll {
    scroll-behavior: auto;
  }
}
