﻿/* Tandem Ride — planner page + full-screen WebGL riding view with DOM overlays */
:root { --text: #fbf5f1; --muted: #d2bfb4; --panel: rgba(36, 22, 20, .92); --line: rgba(255, 228, 214, .16);
  --accent: #ffb04a; --accent-2: #e2483d; --field: #1d1210; --card2: #2e1d1a; --sel: #4a2a22; --good: #57d68d; --bad: #ff7a64; font-family: Inter, system-ui, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #22150f; color: var(--text); overscroll-behavior: none; }
h1, h2 { font-family: 'Space Grotesk', Inter, sans-serif; margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
button, select, input { font: inherit; color: inherit; }
button, select { cursor: pointer; touch-action: manipulation; }

.game { position: fixed; inset: 0; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- planner ---------- */
.planner { position: absolute; inset: 0; z-index: 20; overflow: auto; padding: 18px 14px 30px; user-select: text; -webkit-user-select: text;
  background: radial-gradient(120% 70% at 20% 0%, #6a3424 0%, transparent 60%), radial-gradient(90% 60% at 100% 100%, #2f4a2a 0%, transparent 70%), #1a100d; }
.pcard { width: min(640px, 100%); margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 22px 22px 16px; box-shadow: 0 30px 70px rgba(0, 0, 0, .4); }
.kicker { margin: 0; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); text-align: center; }
.pcard h1 { font-size: clamp(36px, 8vw, 54px); text-align: center; line-height: 1.05; margin: 4px 0 2px;
  background: linear-gradient(180deg, #ffe0a8, #ff7a4a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { text-align: center; margin: 0 0 16px; font: 600 17px 'Space Grotesk', sans-serif; color: var(--accent); }
.challenge { background: rgba(255, 196, 80, .15); border: 1px solid rgba(255, 196, 80, .45); color: #ffd98a; border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 14px; }
.field { position: relative; margin-bottom: 4px; }
.field label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 4px 2px; }
.row { display: flex; gap: 6px; }
.row input { flex: 1; min-width: 0; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; }
.row input:focus { border-color: var(--accent); }
.icon { width: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-size: 18px; }
.ac { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--field); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 30px rgba(0, 0, 0, .5); }
.ac li { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.ac li b { display: block; font-size: 15px; } .ac li small { color: var(--muted); font-size: 12px; }
.ac li:hover, .ac li.act { background: var(--sel); }
.swap { display: block; margin: 2px auto -2px; background: none; border: 0; color: var(--muted); font-size: 20px; padding: 0 10px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.chip { border: 1px solid var(--line); background: var(--card2); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.chip:hover { border-color: var(--accent); }
.modes { border: 0; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.modes legend { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; padding: 0; }
.modes label { display: flex; cursor: pointer; }
.modes input { position: absolute; opacity: 0; pointer-events: none; }
.modes span { flex: 1; border: 1px solid var(--line); background: var(--card2); border-radius: 12px; padding: 9px 11px; }
.modes b { display: block; font-size: 15px; } .modes small { color: var(--muted); font-size: 12px; line-height: 1.35; display: block; margin-top: 2px; }
.modes input:checked + span { border-color: var(--accent); background: var(--sel); box-shadow: 0 0 0 2px rgba(255, 176, 74, .25); }
.modes input:focus-visible + span { outline: 2px solid var(--accent); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.opts label { display: flex; flex-direction: column; gap: 4px; }
.opts select { background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 8px; color: var(--text); }
.opts .chk { flex-direction: row; align-items: center; gap: 8px; }
.pick { display: flex; align-items: center; gap: 10px; }
.swatches { display: flex; gap: 6px; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); padding: 0; }
.sw.sel { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); }
.btn { border: 1px solid var(--line); background: #3a2622; border-radius: 12px; padding: 11px 18px; font-weight: 700; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #2a0e06; border: 0; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.big { font-size: 19px; padding: 14px 24px; }
.btn.wide { width: 100%; }
.status { min-height: 1.2em; color: #ffd98a; font-size: 14px; margin: 8px 0 0; }
.route-box { margin-top: 6px; }
#pmap { height: 280px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--field); }
.alts { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.alts li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; background: var(--card2); }
.alts li.sel { border-color: var(--accent); background: var(--sel); }
.alts b { display: block; } .alts small { color: var(--muted); }
.seg-info { color: var(--muted); font-size: 13px; margin: 10px 0; }
.help { margin-top: 16px; font-size: 13px; color: var(--muted); }
.help summary { cursor: pointer; font-weight: 700; color: var(--text); }
.help ul { padding-left: 18px; line-height: 1.55; }
.attrib { font-size: 12px; color: var(--muted); margin: 14px 0 0; text-align: center; }
.links { font-size: 13px; color: var(--muted); margin: 10px 0 0; text-align: center; }
kbd { display: inline-block; min-width: 22px; padding: 0 5px; border-radius: 6px; border: 1px solid var(--line); border-bottom-width: 3px; background: #3a2622; font: 600 12px Inter, sans-serif; text-align: center; color: var(--text); }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.hud b { font-family: 'Space Grotesk', sans-serif; }
.nav { position: absolute; left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top)); display: flex; gap: 12px; align-items: center;
  background: rgba(20, 84, 58, .92); border-radius: 16px; padding: 10px 16px 10px 12px; max-width: min(520px, calc(100vw - 24px)); box-shadow: 0 8px 22px rgba(0, 0, 0, .35); text-shadow: none; }
.nav-arrow { width: 52px; height: 52px; flex: none; display: grid; place-items: center; color: #fff; font-size: 36px; }
.nav-arrow svg { width: 50px; height: 50px; transition: transform .3s; }
.nav-main b { display: block; font-size: 26px; line-height: 1.05; }
.nav-main span { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; }
.nav-main small { display: block; font-size: 12px; color: #bfe8d4; margin-top: 2px; }
.nav-main small:empty { display: none; }
.hud-r { position: absolute; right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(4, auto); gap: 4px 14px; background: rgba(26, 14, 12, .62); border-radius: 14px; padding: 8px 12px; backdrop-filter: blur(3px); text-align: right; }
.stats span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stats b { font-size: 18px; }
.stats small { display: block; font-size: 11px; color: var(--muted); }
.stats small:empty { display: none; }
.btns { display: flex; gap: 6px; pointer-events: auto; }
.hb { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: rgba(26, 14, 12, .55); font-size: 15px; font-weight: 700; display: grid; place-items: center; padding: 0; backdrop-filter: blur(3px); }
.hb.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #2a0e06; border-color: transparent; }
/* background audio: Music or YouTube (one at a time) */
.media { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: auto; text-shadow: none; }
.media-pick { display: flex; padding: 3px; gap: 3px; border-radius: 13px; border: 1px solid var(--line); background: rgba(26, 14, 12, .55); backdrop-filter: blur(3px); }
.mb { height: 32px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--muted); transition: background .15s, color .15s; }
.mb:hover { color: var(--text); background: rgba(255, 255, 255, .08); }
.mb.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #2a0e06; }
.mb:focus-visible, .yt-list a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.yt-row { width: 270px; border-radius: 14px; border: 1px solid var(--line); background: rgba(26, 14, 12, .78); backdrop-filter: blur(3px); padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.yt-player { border-radius: 9px; overflow: hidden; background: #000; height: 44px; }
.yt-player iframe { display: block; width: 100%; height: 44px; border: 0; }
.yt-list ul { list-style: none; margin: 0; padding: 0; max-height: 132px; overflow-y: auto; scrollbar-width: thin; }
.yt-list a { display: block; padding: 6px 8px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-list a:hover { background: rgba(255, 255, 255, .08); }
.yt-list a.on { color: var(--accent); font-weight: 600; }
.yt-list a.on::before { content: '♪ '; }
.speedo { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 12px; }
.spd { text-align: right; }
.spd b { font-size: 54px; line-height: .9; display: block; }
.spd span { font-size: 13px; color: var(--muted); }
.spd em { display: block; font-style: normal; font-size: 12px; color: var(--accent); margin-top: 3px; }
#h-gear { color: var(--muted); } #h-gear.warn { color: #ff7a64; font-weight: 700; }
.grade { text-shadow: none; display: grid; place-items: center; text-align: center; width: 74px; height: 64px; border-radius: 12px; border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4); background: #2f8f5b; color: #fff; transition: background .4s; }
.grade small { font: 800 9px/1 Inter, sans-serif; letter-spacing: .08em; opacity: .85; margin-top: 4px; }
.grade b { font-size: 21px; line-height: 1; margin-bottom: 4px; white-space: nowrap; }
.grade.up1 { background: #c9a227; } .grade.up2 { background: #e07a2c; } .grade.up3 { background: #d0322a; animation: limflash .6s ease-in-out infinite alternate; }
.grade.down { background: #2f7cc6; }
#h-unit::before { content: ''; }
.minimap-wrap { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); width: 210px; height: 210px; border-radius: 50%;
  overflow: hidden; border: 3px solid rgba(255, 255, 255, .85); box-shadow: 0 8px 22px rgba(0, 0, 0, .45); z-index: 5; transition: all .25s; }
#minimap { position: absolute; inset: 0; }
.minimap-wrap .leaflet-control-attribution { font-size: 8px; padding: 0 4px; max-width: 100%; }
.minimap-wrap:not(.big) .leaflet-control-attribution { position: fixed; display: none; }
.minimap-wrap.big { left: 50%; bottom: 50%; transform: translate(-50%, 50%); width: min(92vw, 900px); height: min(78vh, 680px); border-radius: 18px; z-index: 15; }
.mapsize { position: absolute; z-index: 800; right: 50%; transform: translateX(50%); bottom: 6px; border: 0; border-radius: 999px; background: rgba(26, 14, 12, .75); color: #fff; width: 30px; height: 26px; padding: 0; }
.minimap-wrap.big .mapsize { right: 10px; transform: none; top: 10px; bottom: auto; width: 36px; height: 36px; font-size: 18px; }
.car-ico { display: grid; place-items: center; }
#car-arrow { color: #e2483d; font-size: 22px; line-height: 1; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }

.advise { position: absolute; left: 50%; top: max(18px, calc(env(safe-area-inset-top) + 8px)); transform: translateX(-50%); pointer-events: none; }
.advise span { width: 60px; height: 60px; display: grid; place-content: center; text-align: center; background: #f6c431; color: #1b1b1b; border: 3px solid #1b1b1b;
  border-radius: 8px; transform: rotate(45deg); box-shadow: 0 0 0 2px #f6c431, 0 4px 14px rgba(0, 0, 0, .4); }
.advise b, .advise small { display: block; transform: rotate(-45deg); line-height: 1; }
.advise b { font: 700 20px 'Space Grotesk', sans-serif; } .advise small { font-size: 7px; font-weight: 800; }
.advise.over span { background: #ff5a3c; box-shadow: 0 0 0 2px #ff5a3c, 0 0 22px rgba(255, 90, 60, .8); animation: pulse .5s ease-in-out infinite alternate; }
.offroad { position: absolute; left: 50%; bottom: max(120px, calc(env(safe-area-inset-bottom) + 120px)); transform: translateX(-50%); background: rgba(26, 14, 12, .78);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; font-size: 14px; white-space: nowrap; z-index: 4; }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-weight: 700; }
.toast { position: absolute; left: 50%; top: 32%; transform: translateX(-50%); background: rgba(26, 14, 12, .82); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: 14px; font-weight: 600; pointer-events: none; opacity: 0; transition: opacity .3s; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; z-index: 6; }
.toast.show { opacity: 1; }
.touch { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; z-index: 6;
  padding: 0 max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
.tgroup { display: flex; gap: 10px; pointer-events: auto; }
.tb { width: 66px; height: 66px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(26, 14, 12, .4); font-size: 24px; color: rgba(255, 255, 255, .85); display: grid; place-items: center; padding: 0; }
.tb.down { background: rgba(255, 176, 74, .6); color: #2a0e06; }
@media (pointer: coarse) {
  .minimap-wrap:not(.big) { width: 130px; height: 130px; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); }
  .speedo { bottom: max(96px, calc(env(safe-area-inset-bottom) + 96px)); }
}

/* ---------- panels ---------- */
.panel { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; z-index: 30; overflow: auto; background: rgba(20, 10, 8, .5); }
.card { width: min(520px, 100%); max-height: calc(100dvh - 28px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  padding: 22px 22px 16px; box-shadow: 0 30px 70px rgba(0, 0, 0, .45); backdrop-filter: blur(8px); text-align: center; animation: rise .3s ease-out; user-select: text; }
.card.small { width: min(320px, 100%); }
.card h2 { font-size: 30px; }
.sub { color: var(--muted); margin: 6px 0 14px; }
.spinner { width: 40px; height: 40px; margin: 6px auto 12px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .15); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.settings { display: grid; gap: 8px; margin: 14px 0; text-align: left; }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.settings select { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-width: 160px; }
.row2 { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.o-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.o-stats div { background: rgba(0, 0, 0, .25); border-radius: 12px; padding: 8px 4px; }
.o-stats span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.o-stats b { font: 700 20px 'Space Grotesk', sans-serif; white-space: nowrap; }
.good { color: var(--good); } .bad { color: var(--bad); }
.r-score { font-size: 15px; color: var(--muted); margin: 10px 0 4px; } .r-score b { font: 700 36px 'Space Grotesk', sans-serif; color: var(--text); margin-left: 6px; }
.r-lines { list-style: none; padding: 8px 12px; margin: 0; text-align: left; font-size: 13px; background: rgba(0, 0, 0, .22); border-radius: 12px; }
.r-lines li { display: flex; justify-content: space-between; padding: 2px 0; color: var(--muted); } .r-lines b { color: var(--text); }
.r-best { color: #ffd98a; font-weight: 600; min-height: 1em; margin: 10px 0 0; }
.r-challenge { background: rgba(255, 196, 80, .15); border-radius: 10px; padding: 8px; color: #ffd98a; font-weight: 600; }
.share { display: flex; gap: 8px; margin-top: 12px; }
.share input { flex: 1; min-width: 0; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.share-msg { color: var(--good); font-size: 13px; min-height: 1em; margin: 6px 0 0; }
.ad-wrap { width: 100%; text-align: center; margin-top: 12px; }
.ad-wrap.ad-on { min-height: 100px; }
.ad-wrap:has(ins[data-ad-status="unfilled"]) { display: none; }
.ad-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.nojs { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; }

/* small screens */
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, auto); }
  .nav { max-width: calc(100vw - 24px); padding: 8px 12px 8px 8px; }
  .nav-main b { font-size: 21px; } .nav-main span { font-size: 13px; }
  .hud-r { top: auto; bottom: max(200px, calc(env(safe-area-inset-bottom) + 200px)); }
  .mb { height: 30px; padding: 0 10px; font-size: 12px; }
  .yt-row { width: min(270px, calc(100vw - 24px)); }
  .yt-list ul { max-height: 96px; }
  .modes, .opts { grid-template-columns: 1fr; }
  .spd b { font-size: 42px; }
}
@media (max-height: 520px) {
  .hud-r { top: max(12px, env(safe-area-inset-top)); bottom: auto; }
  .yt-list { display: none; }  /* short screens: player strip only, so it clears the speedometer */
  .nav { max-width: 46vw; }
  .minimap-wrap:not(.big) { width: 120px; height: 120px; }
  .speedo { bottom: max(84px, calc(env(safe-area-inset-bottom) + 84px)); }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { to { transform: rotate(45deg) scale(1.1); } }
@keyframes limflash { to { transform: scale(1.08); box-shadow: 0 0 0 3px #ff5a3c, 0 0 18px rgba(255, 90, 60, .8); } }

/* ---------- planner: blocks, team, route stats, elevation profile ---------- */
.block { margin: 0 0 14px; }
.bh { font: 700 13px Inter, sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 8px; }
.midrow { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 2px 0; }
.midrow .swap { margin: 0; }
.link.small { font-size: 13px; text-decoration: none; }
.link.small:hover { text-decoration: underline; }
.crew { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.seat { border: 1px solid var(--line); background: var(--card2); border-radius: 14px; padding: 10px 12px; display: grid; gap: 7px; font-size: 13px; color: var(--muted); min-width: 0; }
.seat-t { margin: 0; font-weight: 700; color: var(--text); font-size: 15px; }
.seat-t small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.seat label { display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 8px; }
.seat input, .seat select { min-width: 0; width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 9px; padding: 7px 8px; color: var(--text); }
.unit { display: flex; align-items: center; gap: 6px; } .seat .unit input { width: 80px; flex: none; } .unit em { font-style: normal; }
.seat .pick { gap: 8px; } .seat .pick > span { width: 62px; flex: none; }
.seat .swatches { flex-wrap: wrap; gap: 5px; } .seat .sw { width: 22px; height: 22px; }
.coop-help { font-size: 13px; color: var(--muted); line-height: 1.7; margin: -4px 0 0; background: rgba(0, 0, 0, .2); border-radius: 10px; padding: 8px 10px; }
.alts b { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bdg { font-style: normal; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.bdg.flat { background: #2f8f5b; color: #fff; } .bdg.short { background: #2f7cc6; color: #fff; }
.rstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 8px; }
.rstats div { background: rgba(0, 0, 0, .25); border-radius: 10px; padding: 7px 8px; }
.rstats span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.rstats b { font: 700 17px 'Space Grotesk', sans-serif; }
.prof-wrap { position: relative; }
#prof { display: block; width: 100%; height: 130px; border-radius: 12px; background: rgba(0, 0, 0, .28); cursor: crosshair; touch-action: pan-y; }
.prof-tip { position: absolute; top: 6px; transform: translateX(-50%); background: rgba(10, 6, 5, .85); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; }
.legend { margin: 6px 0 0; font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 3px; vertical-align: -1px; }
.climbs { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; font-size: 13px; }
.climbs li { background: rgba(0, 0, 0, .2); border-radius: 8px; padding: 5px 10px; }
.climbs li b { color: #ff9a7a; margin-right: 4px; } .climbs li small { color: var(--muted); } .climbs li.none { color: var(--muted); }
.climbs:empty { display: none; }
.rs-note { color: var(--muted); font-size: 12px; margin: 8px 0 0; line-height: 1.45; }
.start-row { justify-content: stretch; }
.start-row #btn-start { flex: 1 1 220px; }

/* ---------- HUD: team panel, elevation strip ---------- */
.team { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom)); width: min(380px, calc(100vw - 500px));
  background: rgba(26, 14, 12, .66); border: 1px solid var(--line); border-radius: 16px; padding: 8px 10px; backdrop-filter: blur(3px); text-shadow: none; }
#hprof { display: block; width: 100%; height: 50px; border-radius: 9px; background: rgba(0, 0, 0, .25); }
.kom { margin: 5px 0 3px; font-size: 12px; font-weight: 700; color: #ffd27a; }
.kom:empty { display: none; }
.rider { display: grid; grid-template-columns: 92px 1fr 56px; gap: 8px; align-items: center; margin-top: 5px; }
.who b { display: block; font: 700 13px 'Space Grotesk', sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; line-height: 1; }
.bar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; border-radius: 99px; background: linear-gradient(90deg, #57c47e, #a5e06a); transition: width .3s; }
.rider.low .bar i { background: linear-gradient(90deg, #f08a3c, #e8c547); }
.rider.bonk .bar i { background: #e2483d; }
.rider.bonk .who b { color: #ff7a64; }
.rider .w { text-align: right; font-size: 14px; }
.rider.sprint .w { color: #ffd27a; }
.sync { margin: 5px 0 0; font-size: 12px; font-weight: 700; color: #8fe3b0; text-align: center; }
.sync.off { color: #ff7a64; animation: blink .4s ease-in-out infinite alternate; }
@keyframes blink { to { opacity: .45; } }
@media (max-width: 1000px) { .team { width: min(340px, calc(100vw - 440px)); } }
@media (max-width: 860px), (pointer: coarse) {
  .team { bottom: auto; top: calc(max(12px, env(safe-area-inset-top)) + 96px); width: min(340px, calc(100vw - 24px)); padding: 6px 8px; }
  #hprof { height: 36px; }
  .rider { grid-template-columns: 74px 1fr 48px; margin-top: 3px; }
  .advise { top: auto; bottom: max(250px, calc(env(safe-area-inset-bottom) + 250px)); left: 24px; transform: none; }
}
@media (max-width: 720px) {
  .crew { grid-template-columns: 1fr; }
  .rstats { grid-template-columns: 1fr 1fr; }
  .grade { width: 62px; height: 54px; } .grade b { font-size: 17px; }
}
@media (max-height: 520px) {
  .team { top: max(8px, env(safe-area-inset-top)); width: min(300px, 40vw); }
  #hprof, .kom { display: none; }
}
@media (pointer: coarse) and (max-width: 600px) {
  .minimap-wrap:not(.big) { left: max(12px, env(safe-area-inset-left)); transform: none; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 82px); width: 112px; height: 112px; }
}
