/* Values from Robin's 主界面 · 交互原型 (Main.dc.html); dark glass on satellite, light glass on map. */
:root {
  --blue: #0A84FF; --green: #30D158; --orange: #FF9F0A; --red: #FF453A; --stop: #E5241B;
  --ink: #FFFFFF; --row: rgba(255,255,255,0.12); --on: rgba(255,255,255,0.24); --track: rgba(255,255,255,0.22);
  --gl-bg: rgba(24,28,24,0.34); --gl-bd: rgba(255,255,255,0.30);
  --gl-sh: inset 0 1px 0 rgba(255,255,255,0.38), inset 0 -1px 0 rgba(255,255,255,0.08), 0 10px 30px rgba(0,0,0,0.28);
  --sh-bg: rgba(28,30,28,0.66); --sh-bd: rgba(255,255,255,0.22);
  --sh-sh: inset 0 1px 0 rgba(255,255,255,0.30), 0 20px 50px rgba(0,0,0,0.40);
  --grab: rgba(255,255,255,0.35); --map-bg: #1A2416;
  --top: max(14px, env(safe-area-inset-top)); --bottom: max(14px, env(safe-area-inset-bottom));
}
body.map {
  --ink: #111111; --row: rgba(0,0,0,0.06); --on: rgba(0,0,0,0.10); --track: rgba(0,0,0,0.12);
  --gl-bg: rgba(255,255,255,0.52); --gl-bd: rgba(255,255,255,0.85); --gl-sh: inset 0 1px 0 rgba(255,255,255,0.95), 0 10px 30px rgba(0,0,0,0.14);
  --sh-bg: rgba(246,246,244,0.74); --sh-bd: rgba(255,255,255,0.9); --sh-sh: inset 0 1px 0 #fff, 0 20px 50px rgba(0,0,0,0.22);
  --grab: rgba(0,0,0,0.2); --map-bg: #E4E7DC;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--map-bg); color: var(--ink);
  font-family: -apple-system, 'SF Pro Text', 'PingFang SC', system-ui, Roboto, sans-serif; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; border: none; background: none; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
svg .f { fill: currentColor; }
.num { font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }

#map { position: fixed; inset: 0; background: var(--map-bg); }
.leaflet-container { background: var(--map-bg); font: inherit; }
.leaflet-control-attribution { font-size: 9px; background: rgba(0,0,0,0.25) !important; color: #ddd; }
.leaflet-control-attribution a { color: #ddd; }
body.map .leaflet-control-attribution { background: rgba(255,255,255,0.6) !important; color: #333; }

.gl { backdrop-filter: blur(22px) saturate(180%); -webkit-backdrop-filter: blur(22px) saturate(180%);
  background: var(--gl-bg); border: 1px solid var(--gl-bd); box-shadow: var(--gl-sh); color: var(--ink); }
.sh { backdrop-filter: blur(34px) saturate(190%); -webkit-backdrop-filter: blur(34px) saturate(190%);
  background: var(--sh-bg); border: 1px solid var(--sh-bd); box-shadow: var(--sh-sh); color: var(--ink); }

/* frosted cover while driving; a clear hole stays around the active rover */
#frost { position: fixed; inset: 0; z-index: 500; backdrop-filter: blur(5px) saturate(120%); -webkit-backdrop-filter: blur(5px) saturate(120%);
  background: rgba(12,16,12,0.16); touch-action: none; }

#top { position: fixed; left: 16px; right: 16px; top: var(--top); height: 64px; display: flex; align-items: center; gap: 10px; z-index: 800; }
#top .fill { flex: 1; }
.av { width: 50px; height: 50px; border-radius: 25px; font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.pill { height: 50px; border-radius: 25px; display: flex; align-items: center; padding: 0 4px; gap: 2px; }
.pb { width: 44px; height: 42px; border-radius: 21px; display: flex; align-items: center; justify-content: center; }
.pb svg { width: 21px; height: 21px; }
.pb.on { background: var(--blue); color: #fff; }
.pb.conn { width: 42px; border: 2px solid transparent; }
.pb.conn.srv { border-color: var(--blue); background: rgba(10,132,255,0.24); }
.pb.conn.local { color: var(--blue); }
.pb.conn.bad { border-color: var(--orange); }
.stop { width: 64px; height: 64px; border-radius: 32px; display: flex; align-items: center; justify-content: center; }
.stop span { width: 30px; height: 30px; border-radius: 5px; background: var(--stop); box-shadow: 0 2px 6px rgba(229,36,27,0.5); display: block; }
.stop:active span { transform: scale(0.9); }

#row2 { position: fixed; left: 16px; right: 16px; top: calc(var(--top) + 76px); display: flex; align-items: center; flex-wrap: wrap; gap: 8px; z-index: 800; pointer-events: none; }
#row2 > * { pointer-events: auto; }
.hold { height: 64px; border-radius: 32px; display: flex; align-items: center; padding: 0 6px; }
.hold button { width: 44px; height: 44px; border-radius: 22px; background: var(--row); font-size: 28px; font-weight: 600; line-height: 1; }
.hold button:disabled { opacity: 0.35; }
.hold .lv { display: flex; flex-direction: column; align-items: center; padding: 0 4px; min-width: 52px; }
.hold small { font-weight: 600; font-size: 11px; opacity: 0.85; }
.hold b { font-size: 26px; line-height: 1.05; }
.hold.active { background: var(--blue); color: #fff; border-color: transparent; }
.hold.active button { background: rgba(255,255,255,0.22); }
.chip { height: 44px; border-radius: 22px; padding: 0 16px; font-weight: 600; font-size: 15px; }
.chip.small { height: 34px; font-size: 13px; padding: 0 12px; }
.chip.accent { background: var(--blue); color: #fff; }
.chip.warn { background: var(--orange); color: #111; }

.round { position: fixed; right: 16px; bottom: calc(var(--bottom) + 108px); width: 48px; height: 48px; border-radius: 24px; display: flex; align-items: center; justify-content: center; z-index: 800; }
.round svg { width: 22px; height: 22px; }

#gauges { position: fixed; left: 16px; right: 16px; bottom: var(--bottom); height: 92px; border-radius: 30px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; padding: 0 8px; z-index: 800; }
.gauge { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.gauge .ring { position: relative; width: 52px; height: 52px; }
.gauge .ring svg { position: absolute; inset: 0; width: 52px; height: 52px; }
.gauge .ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; }
.gauge > small { font-size: 11px; font-weight: 500; opacity: 0.75; white-space: nowrap; }

#toast { position: fixed; left: 50%; top: calc(var(--top) + 150px); transform: translateX(-50%); font-size: 14px; font-weight: 600; border-radius: 20px; padding: 10px 16px; max-width: calc(100vw - 32px); text-align: center; z-index: 1200; }
#banner { position: fixed; left: 16px; right: 16px; top: calc(var(--top) + 150px); z-index: 1100; background: var(--orange); color: #111; border-radius: 16px; padding: 8px 14px; font-size: 13px; font-weight: 600; text-align: center; }

#joy { position: fixed; left: 50%; bottom: calc(var(--bottom) + 130px); width: 164px; height: 164px; margin-left: -82px; border-radius: 82px; touch-action: none; z-index: 900; }
#joy .ax { position: absolute; background: var(--track); display: block; }
#joy .ax.v { left: 50%; top: 14px; bottom: 14px; width: 1px; }
#joy .ax.h { top: 50%; left: 14px; right: 14px; height: 1px; }
#knob { position: absolute; left: 50px; top: 50px; width: 62px; height: 62px; border-radius: 31px; background: rgba(255,255,255,0.95); box-shadow: inset 0 1px 0 #fff, 0 6px 16px rgba(0,0,0,0.35); display: block; pointer-events: none; }
#joy.off { opacity: 0.45; }

#scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.18); z-index: 1000; }
#sheet { position: fixed; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); max-height: 78vh; overflow-y: auto; border-radius: 38px; padding: 10px 16px 22px; display: flex; flex-direction: column; gap: 10px; z-index: 1001; }
#sheet .grab { align-self: center; width: 36px; height: 5px; border-radius: 3px; background: var(--grab); display: block; flex: none; }
#sheet .hd { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px; gap: 8px; }
#sheet .hd b { font-size: 20px; font-weight: 700; }
#sheet .hd small, .sub { font-size: 12px; opacity: 0.7; }
.sec { font-size: 12px; font-weight: 600; opacity: 0.65; padding: 0 4px; }
.row { min-height: 56px; border-radius: 20px; background: var(--row); display: flex; align-items: center; gap: 12px; padding: 8px 16px; text-align: left; width: 100%; }
.row.on { background: var(--blue); color: #fff; }
.row:disabled { opacity: 0.55; }
.row .grow { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .nm { font-weight: 600; font-size: 16px; }
.row .ds { font-size: 12px; opacity: 0.75; overflow-wrap: anywhere; }
.row .st { font-size: 13px; font-weight: 600; white-space: nowrap; opacity: 0.9; }
.tick { width: 24px; height: 24px; border-radius: 12px; border: 2px solid var(--track); display: flex; align-items: center; justify-content: center; flex: none; }
.tick svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3.6; opacity: 0; }
.tick.on { border-color: var(--blue); background: var(--blue); }
.tick.on svg { opacity: 1; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--row); border-radius: 20px; padding: 3px; }
.seg button { height: 40px; border-radius: 17px; font-weight: 600; font-size: 14px; }
.seg button.on { background: rgba(255,255,255,0.92); color: #111; }
body.map .seg button.on { background: #fff; }
.sw { width: 52px; height: 32px; border-radius: 16px; background: var(--track); position: relative; display: block; flex: none; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: left 0.15s; }
.sw.on { background: var(--green); }
.sw.on::after { left: 23px; }
.big { height: 54px; border-radius: 27px; font-weight: 700; font-size: 16px; background: var(--green); color: #0B2A14; }
.big:disabled { background: var(--row); color: var(--ink); opacity: 0.8; }
.danger { height: 52px; border-radius: 20px; background: var(--row); color: var(--red); font-weight: 600; font-size: 16px; }
.small-btn { height: 34px; border-radius: 17px; padding: 0 14px; background: var(--on); font-weight: 600; font-size: 13px; white-space: nowrap; }
.log { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; opacity: 0.8; max-height: 120px; overflow-y: auto; padding: 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }

#pressPop { position: fixed; width: 210px; border-radius: 24px; padding: 8px; display: flex; flex-direction: column; gap: 6px; z-index: 1001; }
#pressPop .for { font-size: 12px; opacity: 0.7; padding: 4px 8px 0; }
#pressPop .act { min-height: 46px; border-radius: 16px; font-weight: 600; font-size: 15px; padding: 6px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#pressPop .act small { font-size: 11px; font-weight: 500; opacity: 0.8; }
#pressPop .go { background: var(--blue); color: #fff; }
#pressPop .rtl { background: var(--orange); color: #111; }
#pressPop .act:disabled { opacity: 0.5; }
#pressPop .cancel { height: 40px; border-radius: 16px; font-size: 15px; opacity: 0.8; }
#pressDot { position: fixed; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 10px; border: 3px solid var(--blue); background: rgba(255,255,255,0.75); z-index: 1001; }

/* rover marker: black disc + heading arrow, status ring (mode colour, AUTO progress), label */
.rv { width: 110px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rv .dot { position: relative; width: 60px; height: 60px; }
.rv .dot svg.ringsvg { position: absolute; inset: 0; width: 60px; height: 60px; }
.rv .disc { position: absolute; left: 6px; top: 6px; width: 48px; height: 48px; border-radius: 24px; border: 3px solid #fff; background: #111; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.rv.active .disc { border-color: var(--blue); }
.rv .disc svg { width: 22px; height: 22px; fill: #fff; stroke: none; }
.rv .badge { position: absolute; right: -2px; top: -2px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; background: var(--red); color: #fff; }
.rv .lbl { font-size: 11px; font-weight: 600; border-radius: 10px; padding: 3px 8px; white-space: nowrap; }
.rv .who { font-size: 10px; font-weight: 600; border-radius: 8px; padding: 2px 6px; background: var(--blue); color: #fff; white-space: nowrap; }
.rv.stale { opacity: 0.55; }

#login { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; background: rgba(10,14,10,0.35); padding: 16px; }
#loginForm { width: 100%; max-width: 340px; border-radius: 32px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
#loginForm .ttl { font-size: 24px; }
#loginForm input { height: 48px; border-radius: 16px; border: 1px solid var(--gl-bd); background: var(--row); color: var(--ink); padding: 0 14px; font: inherit; font-size: 16px; }
#loginForm button { height: 50px; border-radius: 25px; background: var(--blue); color: #fff; font-weight: 700; font-size: 16px; }
.err { color: var(--red); min-height: 1em; }
