@font-face { font-family: 'Archivo'; src: url(../fonts/archivo-latin.woff2) format('woff2'); font-weight: 100 900; font-stretch: 62% 125%;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Archivo'; src: url(../fonts/archivo-latin-ext.woff2) format('woff2'); font-weight: 100 900; font-stretch: 62% 125%;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ink: #0b0b0b;
  --ink-2: #141414;
  --ink-3: #1d1d1d;
  --paper: #f4f4ef;
  --muted: #8b8b85;
  --line: rgba(244, 244, 239, .10);
  --line-2: rgba(244, 244, 239, .18);
  --accent: #ff5a1f;          /* "Signal Orange" */
  --accent-ink: #0b0b0b;      /* text on accent */
  --radius: 4px;
  --wide: 'Archivo', system-ui, sans-serif;
}
:root[data-accent="violet"] { --accent: #8b6cff; --accent-ink: #0b0b0b; }
:root[data-accent="orange"] { --accent: #ff5a1f; --accent-ink: #0b0b0b; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--ink); color: var(--paper);
  font-family: var(--wide); font-stretch: 100%; font-weight: 450;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- display type ---------- */
.display { font-weight: 900; font-stretch: 125%; text-transform: uppercase; letter-spacing: -0.02em; line-height: .88; }
.label { font-size: 11px; font-weight: 700; font-stretch: 112%; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.accent { color: var(--accent); }

/* ---------- app shell ---------- */
.app { height: 100%; display: grid; grid-template-rows: 72px 1fr; }
.topbar { display: flex; align-items: center; gap: 40px; padding: 0 40px; border-bottom: 1px solid var(--line); }
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 900; font-stretch: 125%; font-size: 20px; letter-spacing: -0.01em; }
.wordmark .mark { width: 26px; height: 26px; display: block; }
.tabs { display: flex; gap: 6px; height: 100%; }
.tab { position: relative; padding: 0 16px; font-size: 13px; font-weight: 800; font-stretch: 112%; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); height: 100%; }
.tab:hover { color: var(--paper); }
.tab.active { color: var(--paper); }
.tab.active::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: -1px; height: 3px; background: var(--accent); }
.topbar .spacer { flex: 1; }

.pill { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 12px; font-weight: 800; font-stretch: 112%; text-transform: uppercase; letter-spacing: .08em; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.on { border-color: var(--accent); }
.pill.on .dot { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.pill:hover { border-color: var(--paper); }
.pill .sub { color: var(--muted); font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; height: 56px; padding: 0 28px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font-weight: 900; font-stretch: 118%; text-transform: uppercase; letter-spacing: .04em; font-size: 15px; transition: transform .12s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--paper); border: 1px solid var(--line-2); }
.btn.ghost:hover { border-color: var(--paper); }
.btn.small { height: 40px; padding: 0 18px; font-size: 12px; }
.btn.danger { background: transparent; color: #ff6b6b; border: 1px solid rgba(255,107,107,.35); }

main { overflow-y: auto; }
.view { padding: 48px 40px 80px; max-width: 1600px; margin: 0 auto; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 40px; }
.view-head h1 { font-size: clamp(56px, 7vw, 104px); }
.view-head .meta { margin-top: 14px; color: var(--muted); font-size: 15px; }

/* ---------- route cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 24px; }
.card { position: relative; background: var(--ink-2); border-radius: var(--radius); overflow: hidden; cursor: pointer; border: 1px solid var(--line); transition: border-color .15s, transform .15s; text-align: left; }
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card .thumb { position: relative; aspect-ratio: 16 / 9; background: var(--ink-3) center / cover no-repeat; }
.card .thumb::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(11,11,11,.85)); }
.card .thumb svg { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 38%; z-index: 1; }
.card .badge { position: absolute; top: 14px; left: 14px; z-index: 2; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 900; font-stretch: 115%; letter-spacing: .08em; text-transform: uppercase; padding: 6px 10px; border-radius: 2px; }
.card .go { position: absolute; top: 14px; right: 14px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; background: var(--paper); color: var(--ink); display: grid; place-items: center; opacity: 0; transform: scale(.85); transition: .15s; }
.card:hover .go { opacity: 1; transform: none; }
.card .body { padding: 20px 22px 22px; }
.card h3 { font-size: 26px; font-weight: 900; font-stretch: 118%; text-transform: uppercase; letter-spacing: -0.01em; line-height: 1; }
.card .place { color: var(--muted); font-size: 13px; margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.stat .v { font-size: 22px; font-weight: 800; font-stretch: 110%; font-variant-numeric: tabular-nums; line-height: 1; }
.stat .v small { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 3px; }
.stat .label { margin-bottom: 7px; font-size: 10px; }

.add-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 28px; min-height: 100%;
  border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: transparent; text-align: left; cursor: pointer; transition: .15s; }
.add-card:hover, .add-card.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.add-card .plus { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 36px; font-weight: 500; }
.add-card h3 { font-size: 30px; }
.add-card p { color: var(--muted); font-size: 14px; line-height: 1.5; max-width: 34ch; margin-top: 10px; }

/* ---------- route detail ---------- */
.detail { display: grid; grid-template-columns: 1.35fr 1fr; gap: 40px; }
.detail .hero { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: var(--ink-3) center/cover; }
.back { display: inline-flex; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 24px; }
.back:hover { color: var(--paper); }
.detail h1 { font-size: clamp(48px, 5.5vw, 84px); }
.bigstats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin: 28px 0; }
.bigstats > div { padding: 18px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.bigstats .v { font-size: 34px; font-weight: 900; font-stretch: 112%; font-variant-numeric: tabular-nums; margin-top: 8px; line-height: 1; }
.bigstats .v small { font-size: 14px; color: var(--muted); font-weight: 700; margin-left: 4px; }
.profile-wrap { margin-top: 32px; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px 14px; }
.profile-wrap canvas { width: 100%; height: 190px; display: block; }
.table { width: 100%; border-collapse: collapse; margin-top: 12px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 8px; border-bottom: 1px solid var(--line); font-weight: 600; }
.table tr.pb td { color: var(--accent); }
.table td.rank { font-weight: 900; font-stretch: 118%; width: 44px; }
.row-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 22px 0; font-size: 14px; }

/* ---------- forms / settings ---------- */
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.panel { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panel h3 { font-size: 18px; font-weight: 900; font-stretch: 118%; text-transform: uppercase; margin-bottom: 18px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; max-width: 32ch; }
.field input[type=number], .field select, .field input[type=text] { width: 110px; height: 40px; background: var(--ink); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 0 12px; font-weight: 700; text-align: right; }
.field input[type=text] { width: 220px; text-align: left; }
.field input[type=range] { width: 180px; accent-color: var(--accent); }
.swatches { display: flex; gap: 10px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; }
.swatch.on { border-color: var(--paper); }
.toggle { appearance: none; width: 46px; height: 26px; border-radius: 99px; background: var(--ink-3); border: 1px solid var(--line-2); position: relative; cursor: pointer; transition: .15s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: .15s; }
.toggle:checked { background: var(--accent); border-color: var(--accent); }
.toggle:checked::after { left: 23px; background: var(--ink); }

/* ---------- records ---------- */
.records { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 48px; }
.record { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.record .v { font-size: 46px; font-weight: 900; font-stretch: 115%; line-height: 1; margin-top: 16px; font-variant-numeric: tabular-nums; }
.record .v small { font-size: 16px; color: var(--muted); margin-left: 4px; }
.record .s { color: var(--muted); font-size: 13px; margin-top: 10px; }
.record:first-child { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.record:first-child .label, .record:first-child .s, .record:first-child .v small { color: rgba(11,11,11,.6); }
h2.section { font-size: 28px; font-weight: 900; font-stretch: 118%; text-transform: uppercase; margin: 8px 0 12px; }

/* ---------- import overlay ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(8px); display: grid; place-items: center; z-index: 50; }
.modal .box { width: min(560px, 92vw); background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 32px; }
.modal h2 { font-size: 34px; margin-bottom: 8px; }
.modal p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.bar { height: 6px; background: var(--ink-3); border-radius: 3px; overflow: hidden; margin: 24px 0 10px; }
.bar > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.modal .field input[type=text] { width: 100%; }
.modal .actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--paper); color: var(--ink); padding: 14px 22px; border-radius: 4px; font-weight: 700; font-size: 14px; z-index: 80; }

/* ================= RIDE ================= */
.ride { position: fixed; inset: 0; background: #000; z-index: 40; overflow: hidden; cursor: none; }
.ride.cursor { cursor: default; }
.ride video, .ride canvas.scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud * { pointer-events: auto; }
.glass { background: rgba(11,11,11,.62); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); border: 1px solid rgba(244,244,239,.08); }

.hud-top { position: absolute; top: 24px; left: 28px; right: 28px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.hud-route { display: flex; align-items: center; gap: 14px; padding: 12px 18px 12px 14px; border-radius: 6px; }
.hud-route .wordmark { font-size: 15px; }
.hud-route .wordmark .mark { width: 22px; height: 22px; }
.hud-route .sep { width: 1px; height: 22px; background: var(--line-2); }
.hud-route .name { font-weight: 800; font-stretch: 112%; text-transform: uppercase; font-size: 14px; letter-spacing: .02em; }
.hud-right { display: flex; gap: 12px; align-items: stretch; }
.chip { border-radius: 6px; padding: 12px 18px; min-width: 120px; }
.chip .v { font-size: 30px; font-weight: 900; font-stretch: 112%; font-variant-numeric: tabular-nums; line-height: 1; margin-top: 6px; }
.chip.gap .v.ahead { color: var(--accent); }
.chip.gap .v.behind { color: var(--paper); }
.chip .label { font-size: 10px; }

.minimap { position: absolute; right: 28px; top: 104px; width: 190px; height: 160px; border-radius: 8px; padding: 0; overflow: hidden; background: rgba(11,11,11,.42); pointer-events: none; }
.minimap canvas { width: 100%; height: 100%; display: block; }
@media (max-height: 760px) { .minimap { width: 150px; height: 120px; top: 92px; } }
.grade-tag { position: absolute; right: 28px; top: 50%; transform: translateY(-50%); text-align: right; }
.grade-tag .g { font-size: 128px; font-weight: 900; font-stretch: 125%; line-height: .8; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; text-shadow: 0 2px 30px rgba(0,0,0,.35); }
.grade-tag .g small { font-size: 56px; margin-left: 4px; }
.grade-tag .next { margin-top: 18px; display: inline-block; padding: 10px 14px; border-radius: 6px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.grade-tag .arrow { display: inline-block; width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-bottom: 22px solid var(--accent); margin-right: 14px; transform: translateY(-14px); }
.grade-tag.down .arrow { transform: translateY(-14px) rotate(180deg); border-bottom-color: var(--paper); }
.grade-tag.flat .arrow { display: none; }

.hud-bottom { position: absolute; left: 28px; right: 28px; bottom: 24px; border-radius: 8px; padding: 22px 28px 16px; }
.metrics { display: grid; grid-template-columns: 1.5fr repeat(5, 1fr); align-items: end; gap: 8px; }
.metric { padding-left: 18px; border-left: 1px solid var(--line-2); }
.metric:first-child { padding-left: 0; border-left: 0; }
.metric .v { font-size: 54px; font-weight: 850; font-stretch: 110%; font-variant-numeric: tabular-nums; line-height: .9; margin-top: 8px; letter-spacing: -0.02em; }
.metric .v small { font-size: 16px; font-weight: 700; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.metric.power .v { font-size: 96px; color: var(--accent); font-stretch: 118%; letter-spacing: -0.035em; }
.metric.power .v small { color: var(--accent); opacity: .7; font-size: 22px; }
.metric .sub { font-size: 12px; color: var(--muted); margin-top: 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric .label { font-size: 10px; }
.hud-profile { margin-top: 18px; position: relative; height: 92px; }
.hud-profile canvas { width: 100%; height: 100%; display: block; }

.hud-help { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); padding: 10px 14px; border-radius: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.hud-help b { color: var(--paper); }
.paused { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); z-index: 40; }
.paused .box { text-align: center; background: rgba(12,12,12,.82); padding: 32px 44px 36px; border-radius: 20px; }
.paused h2 { font-size: 120px; }
.paused .row-actions { justify-content: center; margin-top: 28px; }

.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: 280px; font-weight: 900; font-stretch: 125%; color: var(--accent); text-shadow: 0 8px 60px rgba(0,0,0,.4); pointer-events: none; }
.countdown.loading { font-size: 44px; font-weight: 700; font-stretch: 100%; color: #f4f1ea; background: #0b0b0b; z-index: 30; }

/* finish screen */
.finish { position: absolute; inset: 0; z-index: 40; background: rgba(11,11,11,.86); backdrop-filter: blur(14px); display: grid; place-items: center; }
.finish .box { width: min(1100px, 92vw); }
.finish h2 { font-size: 110px; }
.finish .pbflag { display: inline-block; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; font-weight: 900; font-stretch: 118%; letter-spacing: .08em; font-size: 14px; text-transform: uppercase; margin-bottom: 18px; border-radius: 2px; }

@media (max-width: 900px) {
  .topbar { padding: 0 16px; gap: 16px; }
  .view { padding: 28px 16px 60px; }
  .detail { grid-template-columns: 1fr; }
  .records { grid-template-columns: 1fr 1fr; }
  .metrics { grid-template-columns: repeat(3, 1fr); row-gap: 14px; }
  .metric:nth-child(4) { border-left: 0; padding-left: 0; }
  .metric.power .v { font-size: 64px; }
  .metric .v { font-size: 36px; }
  .grade-tag .g { font-size: 80px; }
}
[hidden] { display: none !important; }

/* gears + intervals */
.gearchip { min-width: 150px; transition: box-shadow .2s; }
.gearchip.flash { box-shadow: 0 0 0 2px var(--accent) inset; }
.gearbar { display: flex; gap: 3px; margin-top: 8px; }
.gearbar:empty { display: none; }
.gearbar i { flex: 1; height: 5px; border-radius: 2px; background: rgba(244,244,239,.18); }
.gearbar i.on { background: var(--accent); }
.metric.power.z-lo .v, .metric.power.z-lo .v small { color: #6fb6ff; }
.metric.power.z-hi .v, .metric.power.z-hi .v small { color: #ff3b3b; }
.metric.power.z-ok .v { text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent); }
.metric .sub.hint-on { color: var(--accent); }
.grade-tag .next b { color: var(--accent); font-weight: 800; }
.profile-modal .box { max-width: 560px; }

/* steppers, "no answer" chip, segmented switch */
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-wrap { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.stepper { display: flex; align-items: center; height: 44px; background: var(--ink); border: 1px solid var(--line-2); border-radius: 99px; padding: 3px; transition: border-color .15s, opacity .15s; }
.stepper:focus-within { border-color: var(--accent); }
.stepper .sb { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--ink-3); color: var(--paper); font: 700 18px/1 inherit; cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.stepper .sb:hover { background: var(--accent); color: var(--ink); }
.stepper .sv { display: flex; align-items: baseline; gap: 4px; padding: 0 8px; min-width: 74px; justify-content: center; }
.stepper input { width: 52px; background: none; border: 0; outline: 0; color: var(--paper); font-weight: 800; font-size: 17px; text-align: right; font-variant-numeric: tabular-nums; padding: 0; }
.stepper small { color: var(--muted); font-size: 11px; font-weight: 700; }
.stepper.off { opacity: .45; }
.nochip { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: none; color: var(--muted); font: 700 11px/1 inherit; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
.nochip.on { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.seg { display: inline-flex; background: var(--ink); border: 1px solid var(--line-2); border-radius: 99px; padding: 3px; flex-shrink: 0; }
.seg button { height: 36px; padding: 0 16px; border: 0; border-radius: 99px; background: none; color: var(--muted); font: 700 13px/1 inherit; cursor: pointer; white-space: nowrap; transition: .15s; }
.seg button.on { background: var(--accent); color: var(--ink); }
.modal .form { margin-top: 18px; }
.modal .box { width: min(620px, 94vw); }
.field .stepper input[type=text] { width: 56px; height: auto; background: none; border: 0; border-radius: 0; padding: 0; text-align: right; }
.field > div:first-child { min-width: 0; }
.modal .box { width: min(700px, 94vw); }
.stepper-wrap { flex-wrap: nowrap; }
@media (max-width: 720px) { .stepper-wrap { flex-direction: column; align-items: flex-end; } }
.settings { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
.panel .field { flex-wrap: wrap; }
.panel .field > div:first-child { flex: 1 1 160px; }
.panel .field > .stepper-wrap, .panel .field > .seg { margin-left: auto; }
.camchip { cursor: pointer; border: 0; color: inherit; font: inherit; text-align: left; }
.flash { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); padding: 12px 22px; border-radius: 14px; font-weight: 700; font-size: 22px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 20; }
.flash.on { opacity: 1; }
.rf-bubble { position: absolute; left: 0; top: 0; max-width: 300px; white-space: normal !important; text-align: center; padding: 8px 14px; border-radius: 5px; background: rgba(238,226,198,.84); border: 1px solid rgba(96,72,40,.45); color: #2a1f12; font: 600 18px/1.25 Georgia, 'Times New Roman', serif; font-style: italic; box-shadow: 0 6px 24px rgba(0,0,0,.25); width: max-content; animation: rfpop .25s ease-out; }
.rf-bubble::after { content: none; } /* parchment note, no comic tail */
@keyframes rfpop { from { opacity: 0; transform: scale(.8); } }

/* 3D world: a slim, see-through instrument strip so the road and the handlebar stay in view */
.ride.world3d .hud-bottom { left: 50%; right: auto; width: min(1100px, calc(100% - 56px)); transform: translateX(-50%); bottom: 14px; padding: 10px 20px 8px; background: rgba(11,11,11,.38); }
.ride.world3d .metric .v { font-size: 34px; margin-top: 4px; }
.ride.world3d .metric.power .v { font-size: 56px; }
.ride.world3d .metric .sub { margin-top: 4px; font-size: 11px; }
.ride.world3d .hud-profile { margin-top: 8px; height: 72px; } /* 38 px left only ~4 px for the mountains: the profile looked flat */

/* group ride */
.chip.groupchip { min-width: 170px; text-align: left; }
.groupchip .glist { display: grid; gap: 3px; margin-top: 4px; font-size: 13px; }
.groupchip .grow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: baseline; }
.groupchip .grow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 90px; }
.groupchip .grow b { font-weight: 600; }
.groupchip .grow.behind b { color: var(--paper); }
.groupchip .grow.ahead b { color: var(--accent); }
.groupchip .grow i { font-style: normal; color: var(--muted); font-size: 11px; }
.group-code { font: 700 44px/1 var(--display, inherit); letter-spacing: .18em; text-transform: uppercase; margin: 14px 0 6px; }
.group-list { display: grid; gap: 6px; margin: 14px 0; }
.group-list div { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.06); }

/* voice chat: speaking = green glow + speaker icon (group window, group chip, mic chip) */
.ico { vertical-align: -0.12em; }
.spk { display: none; color: #3dff8a; margin-right: 6px; font-style: normal; }
.speaking > span > .spk, .grow.speaking .spk { display: inline; }
.group-list div.speaking { box-shadow: 0 0 0 2px #3dff8a, 0 0 16px rgba(61,255,138,.45); }
.groupchip .grow.speaking span { color: #3dff8a; max-width: 112px; }
.groupchip .grow .spk { font-size: 12px; color: #3dff8a; margin-right: 4px; }
.voicebar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: -4px 0 12px; }
.voicebar .btn.on { border-color: #3dff8a; color: #3dff8a; }
.voicebar .vstat { color: var(--muted); font-size: 13px; }
.voicechip .v { font-size: 26px; }
.voicechip.on { box-shadow: inset 0 0 0 2px #3dff8a; }
.voicechip.on .v { color: #3dff8a; }
.voicechip.muted .v { color: var(--muted); opacity: .6; }
.voicechip.speaking { box-shadow: inset 0 0 0 2px #3dff8a, 0 0 22px rgba(61,255,138,.6); }

/* training program */
.wpanel { position: absolute; left: 28px; top: 50%; transform: translateY(-50%); width: 260px; padding: 14px 16px; border-radius: 6px; }
.wpanel .wstep { font-weight: 800; text-transform: uppercase; letter-spacing: .04em; font-size: 13px; margin-top: 6px; }
.wpanel .wtarget { font-size: 54px; font-weight: 900; font-stretch: 112%; line-height: 1; margin-top: 4px; display: flex; align-items: baseline; gap: 6px; }
.wpanel .wtarget small { font-size: 18px; }
.wpanel .wleft { margin-left: auto; font-size: 22px; font-weight: 800; color: var(--accent); }
.wpanel .wnext { color: var(--muted); font-size: 12px; margin: 6px 0 10px; }
.wpanel .wsvg, .workout-pick .wsvg { width: 100%; height: 46px; display: block; border-radius: 3px; background: rgba(255,255,255,.04); }
.workout-pick { display: grid; gap: 8px; margin-top: 10px; }

/* rider editor (Mii style) */
.modal .avbox { width: min(980px, 96vw); display: grid; grid-template-columns: minmax(240px, 380px) 1fr; gap: 24px; padding: 24px; max-height: 94vh; }
.avleft { display: flex; flex-direction: column; gap: 10px; }
.avcanvas { width: 100%; aspect-ratio: 3 / 4; border-radius: 6px; background: radial-gradient(circle at 50% 35%, #3a3f48, #15171b 75%); display: block; }
.avname input { width: 100%; background: var(--ink); border: 1px solid var(--line-2); color: var(--paper); padding: 10px 12px; border-radius: 6px; font: inherit; }
.avbtns { display: flex; gap: 8px; }
.avright { display: flex; flex-direction: column; min-height: 0; }
.avtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.avtab { padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); font-weight: 700; font-size: 13px; }
.avtab.on { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.avopts { overflow-y: auto; min-height: 0; flex: 1; padding-right: 4px; }
.avrow { margin-bottom: 16px; }
.avk { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.avchips { display: flex; flex-wrap: wrap; gap: 6px; }
.avchip { padding: 9px 13px; border-radius: 6px; background: var(--ink); border: 1px solid var(--line-2); color: var(--paper); font-size: 13px; }
.avchip.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.avsw { flex-wrap: wrap; gap: 8px; }
.avsw .swatch { width: 28px; height: 28px; }
.avslide { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.avslide input { flex: 1; }
.avhint { font-size: 12px !important; }
@media (max-width: 700px) { .modal .avbox { grid-template-columns: 1fr; overflow-y: auto; } .avcanvas { aspect-ratio: 4 / 3; } }

/* HUD chooser (ride: button "Anzeige" / key I; settings page) */
.hudpanel { position: absolute; top: 90px; right: 24px; z-index: 30; width: min(420px, 92vw); padding: 18px; border-radius: 8px; pointer-events: auto; max-height: 75vh; overflow-y: auto; }
.hudpanel .hudclose { margin-top: 12px; }
.hud-bottom.slim { right: auto; min-width: 0; }
.hud-bottom.slim .metrics { gap: 28px; }
.hud-bottom.slim .metric { min-width: 150px; }
.hudpresets { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.hudchecks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 13px; }
.hudchecks label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
/* Unreal view connected: the browser world sleeps, dark backdrop behind the HUD */
.ride.ue-live canvas { visibility: hidden; }
.ride.ue-live { background: #0b0b0b; }
.ride.ue-live::before { content: 'Bild läuft in Unreal'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: rgba(255,255,255,.35); font-size: 15px; letter-spacing: .08em; text-transform: uppercase; pointer-events: none; }
