:root { --or: #fc6719; --bg: rgba(14,18,26,0.72); --fg: #fff; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9cc6e4; font-family: Inter, "Segoe UI", system-ui, sans-serif; color: var(--fg); }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 30% 20%, rgba(252,103,25,0.35), transparent 60%), linear-gradient(160deg, #0d1b2a 0%, #1b3a4b 55%, #2a6f73 100%); z-index: 20; }
.card { width: min(460px, 92vw); background: rgba(10,14,22,0.82); border: 1px solid rgba(255,255,255,0.08); border-radius: 18px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,0.5); }
.brand { font-weight: 800; letter-spacing: 0.08em; font-size: 22px; margin-bottom: 18px; }
.brand small { display: block; font-weight: 500; letter-spacing: 0.02em; font-size: 13px; color: #9fb3c8; margin-top: 4px; }
.logo { color: var(--or); }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 12px; color: #9fb3c8; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.08em; }
.field input { width: 100%; padding: 12px 14px; font-size: 17px; border-radius: 10px; border: 1px solid #2c3a4c; background: #121a26; color: #fff; outline: none; }
.field input:focus { border-color: var(--or); }
.steps { display: grid; gap: 8px; margin-bottom: 14px; }
.step { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid #2c3a4c; background: #141d2a; color: #fff; cursor: pointer; font: inherit; }
.step:hover { border-color: #4b6380; }
.step b { grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; background: #2c3a4c; display: flex; align-items: center; justify-content: center; font-size: 13px; align-self: center; }
.step .t { font-weight: 700; font-size: 15px; } .step .t i { font-weight: 400; font-style: normal; color: #8095ab; font-size: 12px; margin-left: 6px; }
.step .s { font-size: 12px; color: #8ea3b9; }
.step.ok { border-color: #2fbf71; } .step.ok b { background: #2fbf71; }
.ride { width: 100%; padding: 15px; font-size: 20px; font-weight: 800; letter-spacing: 0.15em; border: 0; border-radius: 12px; background: var(--or); color: #fff; cursor: pointer; box-shadow: 0 8px 24px rgba(252,103,25,0.4); }
.ride:hover { filter: brightness(1.08); }
.demoNote { font-size: 12px; color: #9fb3c8; margin-top: 10px; text-align: center; }
kbd { background: #263446; border-radius: 4px; padding: 1px 5px; font-size: 11px; }
.warn { background: #3a2a12; border: 1px solid #8a6220; color: #ffd38a; font-size: 12px; padding: 8px 10px; border-radius: 8px; margin-bottom: 12px; }
.adv { margin-top: 14px; font-size: 13px; color: #9fb3c8; } .adv summary { cursor: pointer; }
.adv label { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.adv input { width: 110px; padding: 6px 8px; border-radius: 6px; border: 1px solid #2c3a4c; background: #121a26; color: #fff; }
.loader { text-align: center; color: #cfe3ef; } .spin { width: 46px; height: 46px; border: 4px solid rgba(255,255,255,0.2); border-top-color: var(--or); border-radius: 50%; margin: 0 auto 14px; animation: sp 0.9s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* HUD — Zwift look (one dark translucent top bar), Wattlands behaviour (floating panels) */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; --pbg: rgba(12,16,26,0.74); --pbd: rgba(255,255,255,0.09); --dim: #a9b8cc; --link: #57b8ff; }
.hp { position: absolute; left: 0; top: 0; pointer-events: auto; background: var(--pbg); border: 1px solid var(--pbd); border-radius: 12px; box-shadow: 0 4px 22px rgba(0,0,0,0.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); user-select: none; -webkit-user-select: none; text-shadow: 0 1px 2px rgba(0,0,0,0.35); transition: opacity 0.2s; }
.hp.off, #pChat.off { display: none !important; } /* id rules like #pChat{display:flex} must not override hiding */
.hp.dragging { transition: none; box-shadow: 0 8px 34px rgba(0,0,0,0.55); opacity: 0.92; }
.ic { width: 15px; height: 15px; fill: rgba(255,255,255,0.85); flex: none; } .ic.hr { fill: #ff4d5e; } .ic.bolt { fill: var(--or); width: 22px; height: 22px; }
/* edit-layout mode: every panel shows a dashed frame + title tab, drag anywhere on it */
#hud.edit .hp { outline: 2px dashed rgba(252,103,25,0.85); outline-offset: 2px; cursor: grab; }
#hud.edit .hp.dragging { cursor: grabbing; }
#hud.edit .hp::before { content: attr(data-title); position: absolute; left: 6px; top: 4px; z-index: 3; padding: 2px 8px; font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; background: var(--or); color: #fff; border-radius: 6px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
#hud.edit .hp > * { pointer-events: none; }
.hp .xbtn { display: none; position: absolute; right: -10px; top: -10px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #e04a3a; color: #fff; font-weight: 900; font-size: 13px; line-height: 1; cursor: pointer; z-index: 2; pointer-events: auto !important; }
#hud.edit .hp .xbtn { display: block; }
body.alt-drag .hp { cursor: move; }

/* main top bar */
.tb { display: flex; align-items: center; gap: 14px; padding: 7px 16px 6px; }
.tb-sep { width: 1px; align-self: stretch; background: rgba(255,255,255,0.12); margin: 4px 0; }
.tb-tot { display: grid; grid-template-columns: auto auto; gap: 3px 16px; }
.tm { display: flex; align-items: baseline; gap: 5px; } .tm .ic { width: 13px; height: 13px; align-self: center; opacity: 0.8; }
.tv { font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; line-height: 1.05; min-width: 44px; } .tu { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; }
.tb-side { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 56px; } .sv { font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1; }
.tb-power { display: flex; flex-direction: column; align-items: center; min-width: 150px; }
.pw-row { display: flex; align-items: center; gap: 4px; } .pw { font-size: 50px; font-weight: 900; line-height: 0.95; font-variant-numeric: tabular-nums; min-width: 92px; text-align: center; } .pwu { font-size: 17px; font-weight: 700; align-self: flex-start; margin-top: 4px; }
.zones { position: relative; display: flex; gap: 2px; width: 140px; height: 5px; margin: 4px 0 2px; } .zones i { flex: 1; border-radius: 2px; opacity: 0.9; }
.zones i:nth-child(1) { background: #8b95a5; } .zones i:nth-child(2) { background: #3b82f6; } .zones i:nth-child(3) { background: #22c55e; } .zones i:nth-child(4) { background: #eab308; } .zones i:nth-child(5) { background: #ef4444; }
.zones b { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-left: -1.5px; background: #fff; border-radius: 2px; box-shadow: 0 0 5px #fff; transition: left 0.3s; }
.wkg { font-size: 13px; font-weight: 800; color: #ffd2b3; letter-spacing: 0.03em; }
.tb-grade { display: flex; flex-direction: column; align-items: center; min-width: 104px; } .grade { font-weight: 900; font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; } .grade small { font-size: 18px; margin-left: 1px; }
.draft { display: flex; align-items: center; gap: 5px; margin-top: 5px; width: 100%; } .dl { font-size: 9px; font-weight: 800; letter-spacing: 0.12em; color: var(--dim); }
.dt { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.13); overflow: hidden; } .dt span { display: block; height: 100%; width: 0; background: #6fd3ff; border-radius: 3px; transition: width 0.3s; }
.dp { font-size: 10px; font-weight: 800; color: #6fd3ff; min-width: 24px; text-align: right; } .draft.on .dl { color: #6fd3ff; }
.tb-gear { display: flex; flex-direction: column; align-items: center; min-width: 74px; }
.gl { font-size: 9px; letter-spacing: 0.16em; color: var(--dim); font-weight: 800; } .gn { font-size: 30px; font-weight: 900; line-height: 1.02; transition: transform 0.15s, color 0.15s; font-variant-numeric: tabular-nums; } .gn.flash { transform: scale(1.2); color: var(--or); }
.bars { display: flex; gap: 1px; height: 9px; width: 74px; align-items: flex-end; margin-top: 2px; } .bars i { display: block; height: 100%; flex: 1; background: #3b4a5c; border-radius: 1px; } .bars i.on { background: var(--or); }

/* minimap */
#pMap { padding: 0; overflow: hidden; } #minimap { display: block; width: 230px; height: 230px; border-radius: 11px; cursor: grab; touch-action: none; } #minimap.panning { cursor: grabbing; }
.mapzoom { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; }
.mapzoom button, .hudbtns button { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,0.22); background: rgba(14,20,32,0.82); color: #fff; font-weight: 800; font-size: 14px; line-height: 1; cursor: pointer; }
.mapzoom button:hover, .hudbtns button:hover { border-color: var(--or); color: var(--or); }

/* riders nearby (Wattlands table: ahead / you / behind) */
#pRiders { width: 230px; padding: 0 0 4px; overflow: hidden; }
.ph { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; color: var(--dim); padding: 6px 10px 4px; border-bottom: 1px solid var(--pbd); }
.rlist { display: flex; flex-direction: column; }
.rrow { display: grid; grid-template-columns: 8px 1fr auto; gap: 2px 8px; align-items: center; padding: 4px 10px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 13px; }
.rrow .dot { width: 8px; height: 8px; border-radius: 50%; grid-row: span 2; } .rrow .nm { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.rrow .nm small { opacity: 0.55; font-size: 10px; } .rrow .wk { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; text-align: right; }
.rrow .gp { grid-column: 2 / 4; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; } .rrow .gp.ahead { color: var(--link); }
.rrow.me { background: linear-gradient(90deg, rgba(252,103,25,0.42), rgba(252,103,25,0.08)); box-shadow: inset 3px 0 0 var(--or); }
.rrow.me .nm { font-weight: 800; color: #fff; } .rrow.hl { background: rgba(87,184,255,0.16); box-shadow: inset 3px 0 0 var(--link); }

/* elevation profile */
#pProfile { padding: 6px; } #profile { width: 100%; height: 96px; display: block; }
.region { position: absolute; left: 14px; top: 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #ffd2b3; pointer-events: none; }

.toast { position: absolute; top: 118px; left: 50%; transform: translateX(-50%); background: rgba(252,103,25,0.92); padding: 10px 22px; border-radius: 10px; font-weight: 800; letter-spacing: 0.06em; opacity: 0; transition: opacity 0.4s; }
.toast.on { opacity: 1; }
.help { position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%); background: var(--pbg); padding: 8px 14px; border-radius: 8px; font-size: 13px; line-height: 1.6; text-align: center; white-space: nowrap; }

/* reactions bar (bottom left, above HUD buttons) */
#reactions { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: row-reverse; gap: 6px; pointer-events: auto; z-index: 7; }
#reactions .rbtn { width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,0.22); background: rgba(14,20,32,0.82); color: #fff; font-size: 19px; line-height: 1; cursor: pointer; transition: 0.12s; }
#reactions .rbtn:hover { border-color: var(--or); transform: scale(1.15); }

/* HUD menu + buttons */
.hudbtns { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; pointer-events: auto; z-index: 7; } .hudbtns button { width: 30px; height: 30px; font-size: 16px; }
.hudbtns button.on { background: var(--or); border-color: var(--or); color: #fff; }
.hudbtns #btnPeloton.riding { border-color: var(--or); color: var(--or); } .hudbtns #btnPeloton.riding.on { color: #fff; }
.hudmenu { position: absolute; left: 12px; bottom: 50px; width: 260px; pointer-events: auto; z-index: 8; background: rgba(12,16,26,0.92); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 8px 12px 10px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); backdrop-filter: blur(8px); font-size: 13px; }
.hudmenu.pelomenu { width: 300px; } .pelomenu .mrow { padding: 3px 2px; font-size: 12px; } .pelomenu .mrow.dis { opacity: 0.45; }
.plv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin: 2px 0 4px; } .plv button { padding: 6px 0; border-radius: 7px; border: 1px solid rgba(255,255,255,0.16); background: #1b2433; color: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.plv button:hover { border-color: var(--or); } .plv button.on { background: var(--or); border-color: var(--or); } .plv.off button { opacity: 0.4; }
.pnow { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); margin-bottom: 4px; font-variant-numeric: tabular-nums; } .pnow a { color: var(--dim); } .pnow a:hover { color: var(--or); } .pelomenu .mvol { grid-template-columns: 52px 1fr 36px; } .pelomenu output { font-size: 11px; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
.mh { display: flex; justify-content: space-between; align-items: center; font-weight: 800; letter-spacing: 0.12em; font-size: 11px; color: var(--dim); margin-bottom: 4px; }
.mh button { background: none; border: 0; color: #fff; font-size: 18px; cursor: pointer; }
.mrow { display: flex; align-items: center; gap: 8px; padding: 5px 2px; cursor: pointer; } .mrow input { accent-color: var(--or); width: 15px; height: 15px; } .mrow .k { margin-left: auto; }
.mrow.opt { border-top: 1px solid rgba(255,255,255,0.08); margin-top: 4px; padding-top: 8px; color: var(--dim); font-size: 12px; }
.mbtns { display: flex; gap: 6px; margin-top: 8px; } .mbtns button, .editbanner button { flex: 1; padding: 7px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.16); background: #1b2433; color: #fff; font-weight: 700; cursor: pointer; font-size: 12px; }
.mbtns button:hover, .editbanner button:hover { border-color: var(--or); }
.mnote { font-size: 11px; color: var(--dim); margin-top: 7px; }
.editbanner { position: absolute; left: 50%; top: 42%; transform: translateX(-50%); pointer-events: auto; z-index: 8; background: rgba(252,103,25,0.95); padding: 7px 14px; border-radius: 10px; font-weight: 800; font-size: 12px; letter-spacing: 0.05em; display: flex; gap: 8px; align-items: center; }
.editbanner button { flex: none; padding: 3px 10px; }
.restore { position: absolute; left: 0; pointer-events: auto; z-index: 6; padding: 5px 10px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #fff; background: rgba(12,16,26,0.86); border: 1px solid rgba(255,255,255,0.14); border-left: 0; border-radius: 0 8px 8px 0; cursor: pointer; }
.restore:hover { color: var(--or); border-color: var(--or); }
@media (max-width: 1365px) { .pw { font-size: 44px; min-width: 82px; } .tb { gap: 11px; padding: 6px 12px 5px; } .tv { font-size: 17px; } .sv { font-size: 23px; } .grade { font-size: 31px; } #minimap { width: 200px; height: 200px; } #pRiders { width: 210px; } }
.msec { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; color: var(--dim); margin: 8px 0 2px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 8px; }
.mvol { display: grid; grid-template-columns: 74px 1fr; align-items: center; font-size: 12px; padding: 2px 2px; } .mvol input { accent-color: var(--or); width: 100%; }

/* ---- join screen: route picker */
.routes { display: grid; gap: 6px; }
.route { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; text-align: left; padding: 9px 12px; border-radius: 10px; border: 1px solid #2c3a4c; background: #141d2a; color: #fff; cursor: pointer; font: inherit; }
.route:hover { border-color: #4b6380; } .route.on { border-color: var(--or); background: linear-gradient(90deg, rgba(252,103,25,0.22), #141d2a 70%); }
.route b { font-size: 15px; } .route .st { font-size: 12px; color: #ffd2b3; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.route .ds { grid-column: 1 / 3; font-size: 11.5px; color: #8ea3b9; }
.route canvas { grid-column: 1 / 3; width: 100%; height: 26px; margin-top: 3px; }

/* ---- ping pill + Ride On button */
.hudbtns { align-items: center; }
.ping { font-size: 11px; font-weight: 800; padding: 5px 9px; border-radius: 14px; background: rgba(14,20,32,0.82); border: 1px solid rgba(255,255,255,0.18); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: default; }
.ping.good { color: #3ee08f; } .ping.ok { color: #ffd166; } .ping.slow { color: #ff9f43; } .ping.bad, .ping.off { color: #ff5d6c; }
#btnRideOn { position: relative; width: auto !important; min-width: 30px; padding: 0 7px !important; border-radius: 15px !important; }
#btnRideOn b { font-size: 11px; margin-left: 3px; color: #ffd2b3; } #btnRideOn b:empty { display: none; }
#btnRideOn.pop { animation: pop 0.45s; } @keyframes pop { 40% { transform: scale(1.3); background: var(--or); } }
.rrow { cursor: pointer; } .rrow.sel { background: rgba(252,103,25,0.2); box-shadow: inset 3px 0 0 #ffd166; } .rrow.sel .nm::after { content: ' 🎯'; font-size: 10px; }
.rrow .nm small.ro { opacity: 1; color: #ffd2b3; }

/* ---- Ride On notifications (stacked, Zwift-like) */
.rotoasts { position: absolute; left: 50%; top: 168px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.rotoast { display: flex; align-items: center; gap: 10px; background: rgba(12,16,26,0.86); border: 1px solid rgba(252,103,25,0.7); border-radius: 26px; padding: 6px 16px 6px 6px; font-weight: 700; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,0.4); animation: roin 0.35s ease-out; transition: opacity 0.5s, transform 0.5s; }
.rotoast.out { opacity: 0; transform: translateY(-8px); }
.rotoast .th { width: 34px; height: 34px; border-radius: 50%; background: var(--or); display: flex; align-items: center; justify-content: center; font-size: 19px; }
.rotoast .who { font-weight: 900; } .rotoast .n { font-size: 11px; color: var(--dim); margin-left: 4px; }
.rotoast.sent { border-color: rgba(87,184,255,0.7); } .rotoast.sent .th { background: #2a6fb0; }
@keyframes roin { from { transform: translateY(-14px) scale(0.9); } }

/* ---- junction prompt (Zwift-style arrows) */
.junction { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); display: flex; gap: 10px; pointer-events: auto; align-items: flex-end; }
.junction .jt { position: absolute; left: 50%; top: -24px; transform: translateX(-50%); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; color: #fff; white-space: nowrap; text-shadow: 0 1px 3px #000; }
.jopt { width: 128px; padding: 8px 6px 9px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.18); background: rgba(12,16,26,0.78); color: #fff; font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; transition: transform 0.15s, border-color 0.15s; }
.jopt .ar { font-size: 32px; line-height: 1; font-weight: 900; } .jopt .nm { font-size: 12px; font-weight: 700; text-align: center; line-height: 1.2; } .jopt .rt { font-size: 10px; color: #ffd2b3; font-weight: 800; letter-spacing: 0.06em; min-height: 12px; }
.jopt.on { border-color: var(--or); background: rgba(252,103,25,0.85); transform: translateY(-6px) scale(1.06); }
.jopt.on .rt { color: #fff; }

/* ---- chat panel */
#pChat { width: 320px; display: flex; flex-direction: column; overflow: hidden; }
.chath { display: flex; justify-content: space-between; align-items: center; padding-right: 8px; }
.ctabs { display: flex; gap: 4px; } .ctabs button { position: relative; font: inherit; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid rgba(255,255,255,0.15); background: transparent; color: var(--dim); border-radius: 8px; padding: 2px 8px; cursor: pointer; }
.ctabs button.on { background: var(--or); border-color: var(--or); color: #fff; }
.ctabs button i { font-style: normal; margin-left: 4px; color: #ffd166; } .ctabs button i:empty { display: none; }
.chatlog { height: 170px; overflow-y: auto; padding: 6px 10px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; line-height: 1.35; user-select: text; -webkit-user-select: text; overscroll-behavior: contain; }
.chatlog .cm { overflow-wrap: anywhere; } .chatlog .cn { font-weight: 800; margin-right: 6px; } .chatlog .cs { font-size: 9px; color: var(--dim); margin-right: 5px; text-transform: uppercase; letter-spacing: 0.08em; }
.chatlog .sys { color: var(--dim); font-style: italic; font-size: 12px; } .chatlog .ro { color: #ffd2b3; font-size: 12px; }
.chatform { display: flex; gap: 6px; padding: 6px 8px 8px; border-top: 1px solid var(--pbd); }
.chatform input { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; border: 1px solid #2c3a4c; background: rgba(18,26,38,0.9); color: #fff; font: inherit; font-size: 13px; outline: none; user-select: text; }
.chatform input:focus { border-color: var(--or); } .chatform button { border: 0; border-radius: 8px; background: var(--or); color: #fff; font-weight: 900; width: 34px; cursor: pointer; }
#pChat.typing { box-shadow: 0 0 0 2px rgba(252,103,25,0.6), 0 4px 22px rgba(0,0,0,0.35); }

/* ---- camera menu + view hint */
.cammenu { width: 280px; }
.cammenu .cv { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; cursor: pointer; } .cammenu .cv:hover { background: rgba(255,255,255,0.06); }
.cammenu .cv.on { background: rgba(252,103,25,0.25); box-shadow: inset 3px 0 0 var(--or); } .cammenu .cv .k { margin-left: auto; }
.cammenu .mvol { grid-template-columns: 84px 1fr 36px; } .cammenu output { font-size: 11px; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
.camhint { position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%); display: flex; gap: 4px; opacity: 0; transition: opacity 0.4s; pointer-events: none; }
.camhint.on { opacity: 1; } .camhint span { font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 7px; background: rgba(12,16,26,0.72); color: var(--dim); white-space: nowrap; }
.camhint span.on { background: var(--or); color: #fff; } .camhint span kbd { margin-right: 4px; }
.roburst { position: absolute; left: 0; top: 0; border-radius: 50%; background: var(--or); border: 3px solid #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(0,0,0,0.35); pointer-events: none; will-change: transform; }

/* performance overlay (F) */
.perf { position: fixed; left: 10px; top: 74px; z-index: 40; pointer-events: none; font: 11px/1.45 ui-monospace, Menlo, Consolas, monospace; color: #dfe7ef;
  background: rgba(8, 14, 22, 0.78); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; padding: 6px 9px; max-width: 520px; }
.perf button { pointer-events: auto; margin-top: 4px; font: inherit; color: #fff; background: #23344a; border: 1px solid rgba(255,255,255,0.25); border-radius: 5px; padding: 2px 8px; cursor: pointer; }
.perf button:hover { background: #2f4764; } .perf button kbd { font-size: 10px; opacity: 0.7; }
.costs { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 60; width: min(860px, 96vw); background: rgba(8, 14, 22, 0.94); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px; padding: 8px 10px; color: #dfe7ef; font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; box-shadow: 0 6px 30px rgba(0,0,0,0.5); }
.costs .ch { font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; } .costs .cb { margin-left: auto; display: flex; gap: 6px; }
.costs button { font: inherit; color: #fff; background: #23344a; border: 1px solid rgba(255,255,255,0.25); border-radius: 5px; padding: 2px 9px; cursor: pointer; }
.costs textarea { width: 100%; height: 360px; resize: vertical; box-sizing: border-box; background: #05090f; color: #e6edf5; border: 1px solid rgba(255,255,255,0.12); border-radius: 6px; font: 11.5px/1.4 ui-monospace, Menlo, Consolas, monospace; white-space: pre; overflow: auto; }
.perf b { font-size: 15px; } .perf b.good { color: #3ee08f; } .perf b.ok { color: #ffd166; } .perf b.bad { color: #ff5d6c; }
.mvol select { margin-left: auto; background: #1b2633; color: #fff; border: 1px solid rgba(255,255,255,0.2); border-radius: 5px; padding: 2px 4px; }

/* spectate banner */
.watchban { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 30; pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 16px; border-radius: 12px; background: rgba(12,16,26,0.86); border: 1px solid rgba(255,209,102,0.55); box-shadow: 0 4px 22px rgba(0,0,0,0.4); color: #fff; font-size: 13px; white-space: nowrap; }
.watchban b { color: #ffd166; } .watchban kbd { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,0.14); }
.watchban .ws { color: #a9b8cc; font-variant-numeric: tabular-nums; font-size: 12px; }
.watchban button { pointer-events: auto; border: 0; border-radius: 8px; padding: 6px 11px; font-weight: 700; cursor: pointer; color: #fff; background: rgba(255,255,255,0.12); }
.watchban #watchRideOn { background: #fc6719; }
.watchban button:hover { filter: brightness(1.15); }
.rrow.watch { box-shadow: inset 3px 0 0 #ffd166; background: rgba(255,209,102,0.12); }
body.watching #c { cursor: alias; }
/* Low preset: the vignette of the final post pass as a CSS gradient (same curve: 0 → 28 % darkening, smoothstep) */
#vig { position: fixed; inset: 0; pointer-events: none; display: none; background: radial-gradient(ellipse farthest-corner at center, rgba(0,0,0,0) 47.7%, rgba(0,0,0,0.035) 58%, rgba(0,0,0,0.14) 67.8%, rgba(0,0,0,0.245) 78%, rgba(0,0,0,0.28) 87.9%); }
body.vignette #vig { display: block; }
/* in-game Devices panel (js/devices.js, E / 🔗) + trainer-lost banner + fullscreen button */
.devmenu { width: 360px; left: 12px; bottom: 54px; top: auto; }
.devmenu:focus { outline: none; }
.devmenu .dv { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 8px; }
.devmenu .dv + .dv { border-top: 1px solid rgba(255,255,255,0.06); }
.devmenu .dv > i { width: 9px; height: 9px; border-radius: 50%; background: #5b6b80; } .devmenu .dv.ok > i { background: #3ee08f; box-shadow: 0 0 6px #3ee08f; } .devmenu .dv.lost > i { background: #ff5d6c; }
.devmenu .dv.add > i { background: transparent; border: 1px dashed #5b6b80; }
.devmenu .dvt { display: flex; flex-direction: column; min-width: 0; } .devmenu .dvt b { font-size: 13px; } .devmenu .dvt span { font-size: 11.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.devmenu .dvb { display: flex; gap: 5px; } .devmenu .dvb button { font: inherit; font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 7px; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.06); color: #fff; cursor: pointer; white-space: nowrap; }
.devmenu .dvb button.pri { background: var(--or); border-color: var(--or); } .devmenu .dvb button:hover { filter: brightness(1.15); }
.lostban { position: absolute; left: 50%; top: 92px; transform: translateX(-50%); z-index: 8; pointer-events: auto; cursor: pointer; font: inherit; font-size: 14px; color: #fff; padding: 9px 16px; border-radius: 12px; border: 1px solid #ff5d6c; background: rgba(60,12,18,0.9); box-shadow: 0 6px 24px rgba(0,0,0,0.45); }
.lostban b { color: #ffd166; }
.hudbtns #btnFs.on, .lb-fs.on { background: var(--or); border-color: var(--or); }

/* Crisp: opaque panels. backdrop-filter blurs the game canvas in the compositor, and that cost grows with every panel. */
html.crisp-ui #hud { --pbg: rgba(12,16,26,0.94); }
html.crisp-ui .hp, html.crisp-ui .hudmenu { backdrop-filter: none; -webkit-backdrop-filter: none; }
html.crisp-ui .hudmenu { background: rgba(12,16,26,0.94); }

/* ======================================================================================================
   Touch screens + phones. html.phone / .phone-port / .phone-land are set by js/layout.js (phoneMode):
   portrait ≤ 540 px wide, landscape ≤ 540 px high (and ≤ 1100 px wide). (pointer: coarse) = finger input.
   ====================================================================================================== */
html, body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
#c { touch-action: none; } /* no browser pan / pinch / double-tap zoom on the 3D view */
#hud button, .hudmenu button, .hudmenu label, .watchban, .lostban { touch-action: manipulation; }
.hudmenu select { max-width: 100%; min-width: 0; }
.hudmenu { bottom: var(--menuB, 50px); max-height: calc(100dvh - var(--menuB, 50px) - 10px - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain; }
.devmenu { bottom: var(--menuB, 54px); width: min(360px, calc(100vw - 24px)); }
#hud.edit .hp { touch-action: none; }
.touchpad, .touch-only, .phone-only { display: none; }
.helptouch { white-space: normal; width: max-content; max-width: min(560px, calc(100vw - 24px)); pointer-events: auto; }

.touchpad { position: absolute; right: 12px; bottom: 58px; gap: 12px; pointer-events: auto; z-index: 7; align-items: center; }
.tp-grp { display: flex; gap: 4px; align-items: center; position: relative; }
.touchpad button { width: 48px; height: 44px; padding: 0; border-radius: 12px; border: 1px solid rgba(255,255,255,0.24); background: rgba(14,20,32,0.82); color: #fff;
  font: 800 20px/1 Inter, system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.touchpad button.on { background: var(--or); border-color: var(--or); }
.tp-lbl { position: absolute; left: 50%; top: -9px; transform: translateX(-50%); font-size: 9px; font-weight: 800; letter-spacing: 0.1em; color: #fff; background: rgba(14,20,32,0.9);
  border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; padding: 1px 5px; pointer-events: none; white-space: nowrap; }

@media (pointer: coarse) {
  .touchpad { display: flex; }
  .touch-only, .phone-only { display: flex; }
  .hudbtns .phone-only { display: inline-flex; align-items: center; justify-content: center; }
  .hudbtns button, #reactions .rbtn { width: 44px; height: 44px; font-size: 20px; }
  .mapzoom button { width: 36px; height: 36px; font-size: 18px; }
  .mrow { padding: 8px 2px; min-height: 40px; } .mrow input { width: 20px; height: 20px; }
  .mh button { min-width: 40px; min-height: 40px; }
  .mbtns button { min-height: 40px; } .plv button { min-height: 38px; }
  .cammenu .cv { min-height: 40px; }
  .mvol { min-height: 36px; }
  .devmenu .dvb button { min-height: 38px; padding: 6px 12px; }
  .watchban button { min-height: 40px; }
  .ctabs button { min-height: 36px; padding: 4px 10px; }
  .chatform input { font-size: 16px; } /* < 16 px makes iOS zoom the page when the field gets focus */
  .chatform button { width: 44px; min-height: 40px; }
  .jopt { min-height: 64px; }
  .rrow { min-height: 36px; }
  .help:not(.helptouch) { display: none; }
  .hudmenu .mrow .k, .cammenu .cv .k { display: none; } /* keyboard hints */
  .restore { padding: 10px 12px; }
  #btnEdit { display: none; } /* drag-to-edit stays in the ⚙ menu ("Edit layout") */
}
.hudbtns #btnChat { position: relative; } .hudbtns #btnChat i { position: absolute; right: -2px; top: -2px; width: 9px; height: 9px; border-radius: 50%; background: #ffd166; display: none; }
.hudbtns #btnChat.unread i { display: block; }

/* ---- phones: both orientations */
html.phone .hudbtns { left: calc(8px + env(safe-area-inset-left)); gap: 5px; }
html.phone #reactions { right: calc(8px + env(safe-area-inset-right)); bottom: calc(8px + env(safe-area-inset-bottom)); gap: 5px; }
html.phone .hudmenu { left: calc(8px + env(safe-area-inset-left)); max-width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
html.phone .restore { display: none; } /* panels come back via ⚙ (and 💬 for chat) */
html.phone .hp { border-radius: 10px; }
html.phone .ping { padding: 4px 7px; font-size: 10px; }
html.phone .region { left: 10px; top: 4px; font-size: 9px; }
html.phone #pProfile { padding: 3px; }
html.phone .rrow { font-size: 12px; padding: 3px 8px; min-height: 30px; } .phone .rrow .wk, html.phone .rrow .gp { font-size: 10px; }
html.phone #pRiders { overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
html.phone .ph { padding: 4px 8px 3px; font-size: 9px; position: sticky; top: 0; background: rgba(12,16,26,0.95); z-index: 1; }
html.phone .chatlog { touch-action: pan-y; font-size: 12px; }
html.phone .watchban { white-space: normal; flex-wrap: wrap; justify-content: center; gap: 6px 8px; max-width: calc(100vw - 16px); width: max-content; padding: 6px 8px; font-size: 12px; text-align: center; }
html.phone .watchban kbd { display: none; }
html.phone .editbanner { max-width: calc(100vw - 16px); flex-wrap: wrap; white-space: normal; text-align: center; }
html.phone .editbanner kbd { display: none; }
html.phone .lostban { max-width: calc(100vw - 16px); font-size: 12px; }
html.phone .toast { padding: 7px 14px; font-size: 12px; max-width: calc(100vw - 24px); white-space: normal; text-align: center; }
html.phone .rotoasts { transform: translateX(-50%) scale(0.85); transform-origin: top center; }
html.phone .camhint { flex-wrap: wrap; justify-content: center; width: calc(100vw - 24px); }
html.phone .camhint span kbd { display: none; }
html.phone .helptouch { font-size: 12px; line-height: 1.5; padding: 7px 10px; }
html.phone .jopt { width: min(108px, 30vw); padding: 6px 4px 7px; }
html.phone .jopt .ar { font-size: 26px; } html.phone .jopt .nm { font-size: 11px; }
html.phone .junction { z-index: 7; } html.phone .junction .jt { font-size: 10px; }
html.phone .perf { top: auto; bottom: calc(120px + env(safe-area-inset-bottom)); left: 8px; max-width: calc(100vw - 16px); font-size: 10px; }
html.phone .touchpad { gap: 10px; }

/* main bar, compact */
html.phone .tb { gap: 6px; padding: 4px 8px 3px; }
html.phone .pw { font-size: 32px; min-width: 58px; } html.phone .pwu { font-size: 11px; }
html.phone .ic.bolt { width: 16px; height: 16px; }
html.phone .tb-power { min-width: 0; } html.phone .zones { width: 84px; height: 4px; margin: 2px 0 1px; } html.phone .wkg { font-size: 10px; }
html.phone .tb-side { min-width: 34px; } html.phone .sv { font-size: 19px; } html.phone .tb-side .ic { width: 12px; height: 12px; }
html.phone .tb-grade { min-width: 66px; } html.phone .grade { font-size: 23px; } html.phone .grade small { font-size: 12px; }
html.phone .draft { margin-top: 2px; } html.phone .dl { font-size: 8px; letter-spacing: 0.04em; }
html.phone .tb-gear { min-width: 44px; } html.phone .gn { font-size: 21px; } html.phone .gl { font-size: 8px; } html.phone .bars { width: 44px; height: 6px; }
html.phone .tv { font-size: 14px; min-width: 0; } html.phone .tu { font-size: 8px; } html.phone .tm .ic { width: 10px; height: 10px; }
html.phone .tb-tot { gap: 1px 8px; }

/* ---- phone portrait: bar + profile full width at the top, map right + riders left under them;
   bottom: row 1 = HUD buttons, row 2 = −/+ left, reactions right; chat (💬) sits above row 2 */
html.phone-port #pMain { width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
html.phone-port .tb { flex-wrap: wrap; justify-content: space-between; row-gap: 3px; }
html.phone-port .tb-sep { display: none; }
html.phone-port .tb-tot { order: 9; flex: 1 0 100%; grid-template-columns: repeat(4, auto); justify-content: space-between; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 3px; }
html.phone-port #profile { height: 46px; }
html.phone-port .region { display: none; } /* no room next to the route label drawn in the profile */
html.phone-port #minimap { width: 112px; height: 112px; }
html.phone-port #pRiders { max-height: 112px; }
html.phone-port #pChat { width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
html.phone-port .chatlog { height: clamp(52px, calc(100dvh - 600px), 130px); }
html.phone-port .hudbtns { bottom: calc(8px + env(safe-area-inset-bottom)) !important; }
html.phone-port #reactions { bottom: calc(58px + env(safe-area-inset-bottom)); }
html.phone-port .touchpad { left: calc(8px + env(safe-area-inset-left)); right: auto; bottom: calc(58px + env(safe-area-inset-bottom)); }
html.phone .touchpad button { width: 52px; }
html.phone-port .toast { top: calc(env(safe-area-inset-top) + 46%); }
html.phone-port .rotoasts { top: calc(env(safe-area-inset-top) + 36%); }
html.phone-port .help, html.phone-port .helptouch { bottom: calc(120px + env(safe-area-inset-bottom)); }
html.phone-port .junction { bottom: max(calc(122px + env(safe-area-inset-bottom)), calc(var(--chatUp, 0px) + 30px)); gap: 6px; }
html.phone-port .jopt { width: min(116px, 31vw); }
@media (max-height: 700px) { html.phone-port .jopt { padding: 4px 4px 5px; min-height: 56px; } html.phone-port .jopt .ar { font-size: 22px; } }
html.phone-port .junction { --j0: max(calc(122px + env(safe-area-inset-bottom)), calc(var(--chatUp, 0px) + 24px)); bottom: var(--j0); }
html.phone-port body.watching .junction { bottom: calc(var(--j0) + 100px); }
html.phone-port .camhint { bottom: calc(196px + env(safe-area-inset-bottom)); }

/* ---- phone landscape: bar + profile top left, map + riders top right; bottom left = HUD buttons with
   bottom right = reactions with −/+ above them */
html.phone-land .tb-tot { grid-template-columns: auto auto; }
html.phone-land #profile { height: 40px; }
html.phone-land #minimap { width: 96px; height: 96px; }
html.phone-land #pRiders { width: 184px; }
html.phone-land #pChat { width: min(300px, 34vw); }
html.phone-land #pChat .ctabs button { min-height: 36px; padding: 2px 8px; }
html.phone-land .chath { padding: 2px 6px 2px 0; }
html.phone-land .chatform { padding: 4px 6px 5px; } html.phone-land .chatform input { padding: 5px 8px; }
html.phone-land .chatlog { padding: 4px 8px; }
html.phone-land #hud.chat-on .junction { left: calc(var(--chatR) + 8px); transform: none; }
html.phone-land .chatlog { height: clamp(36px, calc(100dvh - 310px), 140px); }
html.phone-land .hudbtns { bottom: calc(8px + env(safe-area-inset-bottom)) !important; }
html.phone-land .touchpad { left: auto; right: calc(8px + env(safe-area-inset-right)); bottom: calc(58px + env(safe-area-inset-bottom)); }
html.phone-land .toast { top: calc(env(safe-area-inset-top) + 40%); }
html.phone-land .rotoasts { top: calc(env(safe-area-inset-top) + 30%); }
html.phone-land .help, html.phone-land .helptouch { bottom: calc(112px + env(safe-area-inset-bottom)); }
html.phone-land .junction { bottom: calc(60px + env(safe-area-inset-bottom)); gap: 6px; }
html.phone-land .jopt { width: min(108px, 16vw); }
html.phone-land #hud.chat-on .jopt { width: min(88px, 14vw); }
html.phone-land .camhint { bottom: calc(150px + env(safe-area-inset-bottom)); }
html.phone .watchban { top: auto !important; bottom: calc(112px + env(safe-area-inset-bottom)); }
html.phone-land .watchban { left: calc(8px + env(safe-area-inset-left)); transform: none; max-width: calc(100vw - 216px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
