/* Classic Tesla — circa 2013-2015 Model S app */

:root {
  --font: 'Montserrat', 'Gotham', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --text: #fff;
  --muted: #9a9a9a;
  --dim: #5c5c5c;
  --blue: #3b8ee8;
  --air: #3fa2ff;
  --air2: #7b8cff;
  --menu-w: 270px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  /* Space above the header. Installed iPhone apps get extra room (below). */
  --top-pad: var(--safe-top);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  background: #000;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
  overflow: hidden;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { fill: currentColor; }

/* ------------------------------------------------------------ red screens */

.red-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,.07) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,.07) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 90% 60% at 50% 30%, #d4121e 0%, #a8000d 55%, #6e0008 100%);
}
#splash { justify-content: center; gap: 40px; transition: opacity .35s; }
#splash.out { opacity: 0; pointer-events: none; }
.wordmark { width: 180px; height: 24px; fill: #fff; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }

.login-inner {
  width: 100%; max-width: 420px;
  padding: calc(var(--top-pad) + 64px) 30px 30px;
  display: flex; flex-direction: column; align-items: center;
}
.login-sub {
  margin: 10px 0 44px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
  text-shadow: 0 1px 1px rgba(0,0,0,.3);
}
.login-field {
  width: 100%; height: 50px; margin-bottom: 14px; padding: 0 16px;
  font: 400 19px var(--font); color: #222;
  border: 1px solid #7a0a10; border-radius: 7px;
  background: linear-gradient(#e2e2e2, #fff 30%);
  box-shadow: inset 0 2px 3px rgba(0,0,0,.35), 0 1px 0 rgba(255,255,255,.25);
  outline: none;
  -webkit-user-select: text; user-select: text;
}
.login-field::placeholder { color: #9a9a9a; }
.login-field:focus { border-color: #3b0005; }
.login-go {
  margin-top: 10px; width: 100%; height: 46px; border-radius: 7px;
  font-weight: 600; font-size: 15px; letter-spacing: .06em;
  background: linear-gradient(#5a0a0f, #3a0206 50%, #2c0004 51%, #3c0409);
  border: 1px solid #230003;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 1px rgba(255,255,255,.15);
}
.login-go:active { background: #2a0003; }
.login-error { min-height: 20px; margin-top: 16px; font-size: 13px; font-weight: 500; text-align: center; }

/* ------------------------------------------------------------ app shell */

#app {
  position: fixed; top: 0; bottom: 0; left: 0; right: 0;
  margin: 0 auto; max-width: 520px;
  display: flex; flex-direction: column;
  background: #000;
  transition: transform .3s cubic-bezier(.2,.8,.3,1);
  z-index: 2;
  box-shadow: -4px 0 14px rgba(0,0,0,.8);
}
body.menu-open #app { transform: translateX(var(--menu-w)); }
#menu-shield { position: absolute; inset: 0; z-index: 30; }

.navbar {
  flex: 0 0 auto;
  position: relative; z-index: 10;
  height: calc(52px + var(--top-pad));
  padding: var(--top-pad) 10px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(#2a2a2a, #161616 50%, #0c0c0c 51%, #121212);
  border-bottom: 1px solid #000;
  box-shadow: 0 1px 0 #2d2d2d, 0 2px 6px rgba(0,0,0,.7);
}
.nav-title {
  position: absolute; left: 70px; right: 70px; bottom: 0; height: 52px; margin: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 500; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 -1px 0 #000;
  pointer-events: none;
}
.nav-title.long { left: 64px; right: 128px; justify-content: flex-start; padding-left: 8px; }

.nav-btn, .gbtn {
  position: relative;
  background: linear-gradient(#484848, #2e2e2e 50%, #222 51%, #2b2b2b);
  border: 1px solid #070707;
  border-radius: 7px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 1px rgba(255,255,255,.07);
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0,0,0,.8);
}
.nav-btn {
  height: 36px; min-width: 50px; padding: 0 12px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .06em;
  z-index: 1;
}
.nav-btn.icon { width: 52px; padding: 0; display: grid; place-items: center; }
.nav-btn.icon svg { width: 24px; height: 24px; }
.nav-btn:active, .gbtn:active:not(:disabled) {
  background: linear-gradient(#1a1a1a, #222);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.8);
}
.nav-extra { display: flex; gap: 8px; margin-right: auto; margin-left: 10px; }
.nav-extra .nav-btn.icon { width: 44px; color: #aaa; }
.nav-extra .nav-btn.icon.on {
  color: #fff;
  background: linear-gradient(#5aa2f5, #2f79d8 50%, #1f68c9 51%, #2c78d9);
  border-color: #0c2f60;
}
.nav-extra .nav-btn.icon svg { width: 22px; height: 22px; }
#map-car svg { width: 30px; height: 16px; }

#views { position: relative; flex: 1 1 auto; overflow: hidden; }

.view { position: absolute; inset: 0; }

/* ------------------------------------------------------------ stage (spotlight + brushed floor) */

.stage-view {
  display: flex; flex-direction: column; align-items: center;
  overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, rgba(0,0,0,.05) 1px 2px, transparent 2px 3px),
    linear-gradient(#262626, #1a1a1a 45%, #0e0e0e);
}
.platform {
  position: absolute; z-index: 0;
  left: -60%; right: -60%; top: -40%;
  height: calc(40% + var(--curve));
  border-radius: 50%;
  background: radial-gradient(ellipse 30% 42% at 50% 64%, #3e3e3e 0%, #1f1f1f 45%, #080808 80%, #000 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.14), 0 3px 0 rgba(0,0,0,.6), 0 8px 18px rgba(0,0,0,.55);
  pointer-events: none;
}
.stage-view > :not(.platform) { position: relative; z-index: 1; }
.stack {
  position: absolute !important; left: 0; right: 0; top: 0; height: var(--curve);
  display: flex; flex-direction: column; align-items: center; justify-content: space-evenly;
  padding-bottom: 12px;
}
.stage-bottom, .home-bottom, .controls-bottom, .charge-bottom, .climate-bottom {
  position: absolute !important; left: 0; right: 0; bottom: 0; top: var(--curve);
}

#view-home { --curve: 70%; }
#view-controls { --curve: 56%; }
#view-charge { --curve: 62%; }
#view-climate { --curve: 60%; }

.home-top { text-align: center; min-height: 44px; }
.status-line { font-size: 18px; font-weight: 600; text-shadow: 0 1px 2px #000; }
.status-sub { font-size: 16px; font-weight: 400; margin-top: 3px; color: #e8e8e8; }

.car-wrap { width: 88%; max-width: 420px; }
.car {
  position: relative; width: 100%;
  aspect-ratio: 2.05 / 1;
  display: grid; place-items: center;
}
.car img, .car svg.fallback-car { width: 100%; height: 100%; object-fit: contain; display: block; }
.car img { opacity: 0; transition: opacity .4s; }
.car img.ready { opacity: 1; }

/* ------------------------------------------------------------ range bar */

.range-block { width: 82%; max-width: 380px; display: flex; flex-direction: column; align-items: center; }
.range-bar {
  position: relative; width: 100%; height: 48px;
  border-radius: 9px;
  background: linear-gradient(#3a3a3a, #202020 48%, #111 52%, #1d1d1d);
  border: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -1px 0 rgba(255,255,255,.04), 0 1px 0 rgba(255,255,255,.08);
  overflow: hidden;
}
.range-bar.big { height: 52px; }
.range-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  border-radius: 8px 0 0 8px;
  background: linear-gradient(#a6ec72, #5cc331 45%, #3b9c18 53%, #48ae22 80%, #6ac83d);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.5), 1px 0 2px rgba(0,0,0,.6);
  transition: width .6s ease;
}
.range-bar.low .range-fill { background: linear-gradient(#f1f27b, #c7c62d 45%, #9fa414 53%, #b0b21c 80%, #cccd46); }
.range-bar.critical .range-fill { background: linear-gradient(#ff8c7a, #e2412b 45%, #b8220f 53%, #c93019 80%, #e0513c); }
.range-bar.charging .range-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: shimmer 2.2s linear infinite;
}
@keyframes shimmer { from { background-position: -60% 0; } to { background-position: 160% 0; } }
.range-ticks {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0,0,0,.35) calc(10% - 1px) 10%);
  pointer-events: none;
}
.range-text {
  position: absolute; inset: 0;
  display: flex; align-items: baseline; justify-content: center;
  padding-top: 1px;
  text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 0 1px #000;
}
.range-num { font-size: 42px; font-weight: 600; line-height: 48px; letter-spacing: -.01em; }
.range-bar.big .range-num { line-height: 52px; font-size: 44px; }
.range-unit { font-size: 19px; font-weight: 500; margin-left: 3px; }
.range-label { margin-top: 12px; font-size: 15px; color: #dcdcdc; }
.pill {
  margin-top: 10px; padding: 3px 9px; border-radius: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  color: #ddd; background: linear-gradient(#555, #333); border: 1px solid #111;
}

/* ------------------------------------------------------------ home */

#view-home .car-wrap { width: 94%; }
.home-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px 0;
}
.address { font-size: 15px; line-height: 1.35; color: #eee; text-shadow: 0 1px 1px #000; }

.lock-btn { width: 40px; height: 48px; display: grid; place-items: center; }
.lock-btn svg { width: 34px; height: 41px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.8)); }
.lock-btn.small svg { width: 28px; height: 34px; }
.lock-btn:active { transform: scale(.94); }

/* ------------------------------------------------------------ buttons */

.gbtn {
  height: 52px; padding: 0 18px; min-width: 140px;
  font-size: 15.5px; font-weight: 500; letter-spacing: .05em;
  border-radius: 9px;
}
.gbtn.wide { min-width: 176px; }
.gbtn:disabled {
  color: #6a6a6a; text-shadow: none;
  background: linear-gradient(#2e2e2e, #232323);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.gbtn.busy { color: transparent; }
.gbtn.busy::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px;
  border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ------------------------------------------------------------ controls */

#view-controls .stack { padding-bottom: 26px; }
#controls-lock { position: absolute; top: calc(var(--curve) - 40px); z-index: 2; }
.controls-bottom {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 26px 16px 6px;
}
.tray {
  display: flex; gap: 10px; padding: 8px;
  border-radius: 13px;
  background: linear-gradient(#0f0f0f, #1a1a1a);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.9), 0 1px 0 rgba(255,255,255,.08);
}
.btn-row { display: flex; gap: 18px; }
.controls-bottom .gbtn { width: min(44vw, 176px); min-width: 0; padding: 0 6px; }

/* ------------------------------------------------------------ charge */

.charge-mid {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 30px;
}
.charge-mid .range-block { width: 86%; }
.limit-labels {
  width: 100%; display: flex; justify-content: space-between; margin-bottom: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; color: var(--muted);
}
#limit-pct { color: #fff; font-size: 13px; }
.limit-track { position: relative; width: 100%; height: 22px; touch-action: none; }
.limit-marker {
  position: absolute; top: 6px; left: 90%; width: 0; height: 0; margin-left: -7px;
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 10px solid #fff;
  filter: drop-shadow(0 1px 1px #000);
  transition: left .2s;
}
.limit-track.editing { cursor: grab; }
.limit-track.editing .limit-marker { transform: scale(1.6); transform-origin: 50% 0; transition: none; }
.limit-track.editing::before {
  content: ''; position: absolute; left: 0; right: 0; top: 2px; height: 2px; background: #3a3a3a; border-radius: 2px;
}
.charge-bottom {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding-top: 20px;
}
.rate-head { text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
.rate-row { display: flex; gap: 30px; font-size: 18px; color: #ddd; align-items: baseline; }
.rate-row b { font-weight: 600; color: #fff; }
.bolt { width: 12px; height: 18px; margin-right: 6px; vertical-align: -2px; fill: #fff; }

/* ------------------------------------------------------------ climate */

.xray-wrap { position: relative; width: 94%; max-width: 440px; }
.car.xray { aspect-ratio: 2.9 / 1; }
.car.xray img, .car.xray svg.fallback-car {
  filter: grayscale(1) brightness(2.3) contrast(.85) drop-shadow(0 0 1px rgba(210,225,255,.8));
  mix-blend-mode: screen;
}
.car.xray img.ready { opacity: .42; }
.car.xray svg.fallback-car { opacity: .45; }
.airflow {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  pointer-events: none; opacity: 0; transition: opacity .5s;
}
.airflow.on { opacity: 1; }
.airflow path { fill: url(#g-air); opacity: .95; }
.airflow.on path { animation: flow 1.8s ease-in-out infinite; }
.airflow .a2 { animation-delay: .25s !important; }
.airflow .a3 { animation-delay: .5s !important; }
.airflow .a4 { animation-delay: .7s !important; }
.airflow .a5 { animation-delay: .9s !important; }
@keyframes flow {
  0% { transform: translateX(-10px); opacity: .25; }
  50% { opacity: 1; }
  100% { transform: translateX(8px); opacity: .25; }
}
.airflow.heat { --air: #ff5b4a; --air2: #b56cff; }
.airflow.cool { --air: #3fa2ff; --air2: #7b8cff; }

.climate-bottom {
  display: grid; place-items: center; padding-top: 16px;
}
.thermostat {
  width: 118px; height: min(30vh, 178px);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-radius: 20px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 2px),
    linear-gradient(#3a3a3a, #1c1c1c 50%, #2a2a2a);
  border: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 4px 10px rgba(0,0,0,.7);
}
.thermo-arrow { width: 100%; flex: 1; display: grid; place-items: center; }
.thermo-arrow::before {
  content: ''; width: 0; height: 0;
  border-left: 14px solid transparent; border-right: 14px solid transparent;
}
.thermo-arrow.up::before { border-bottom: 11px solid #8a8a8a; }
.thermo-arrow.down::before { border-top: 11px solid #8a8a8a; }
.thermo-arrow:active::before { filter: brightness(1.8); }
.thermo-window {
  width: 104px; height: 64px; margin: 0 -2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; font-weight: 500; letter-spacing: -.02em;
  border-radius: 10px;
  background: linear-gradient(#0a0a0a, #1b1b1b);
  border: 1px solid #000;
  box-shadow: inset 0 0 0 1.5px #1e3c5c, inset 0 2px 6px rgba(0,0,0,.9), 0 0 0 3px #111, 0 0 10px rgba(40,110,190,.35);
  text-shadow: 0 0 8px rgba(120,180,255,.3);
}
.thermo-window sup { font-size: 26px; margin-top: -14px; }
.thermostat.pending .thermo-window { color: #cfe3ff; }

/* ------------------------------------------------------------ location */

#view-location { background: #111; }
#map { position: absolute; inset: 0; background: #1a1a1a; }
.leaflet-container { font-family: var(--font); background: #1a1a1a; }
.leaflet-control-attribution { font-size: 9px; background: rgba(0,0,0,.5) !important; color: #aaa; }
.leaflet-control-attribution a { color: #ccc; }
.leaflet-control-zoom { display: none; }
.car-marker svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.7)); transition: transform .5s; }
.me-marker { width: 16px; height: 16px; border-radius: 50%; background: #2f86ff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47,134,255,.25); }
.gauge { position: absolute; right: 10px; top: 10px; width: 108px; height: 108px; z-index: 500; pointer-events: none; filter: drop-shadow(0 3px 6px rgba(0,0,0,.7)); }
.gauge svg { width: 100%; height: 100%; }
.g-speed { font: 600 30px var(--font); fill: #fff; }
.g-unit { font: 500 11px var(--font); fill: #aaa; }
.map-address {
  position: absolute; left: 10px; right: 10px; bottom: 22px; z-index: 500;
  padding: 10px 14px; border-radius: 9px;
  font-size: 13.5px; line-height: 1.35;
  background: rgba(20,20,20,.86); border: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 2px 8px rgba(0,0,0,.6);
}
.map-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------ tab bar */

.tabbar {
  flex: 0 0 auto;
  display: flex;
  height: calc(62px + var(--safe-bot));
  padding-bottom: var(--safe-bot);
  background: linear-gradient(#262626, #121212 50%, #070707 51%, #0b0b0b);
  border-top: 1px solid #3a3a3a;
  box-shadow: 0 -1px 0 #000, 0 -3px 8px rgba(0,0,0,.6);
  z-index: 10;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 4px; padding-bottom: 7px;
  color: #8b8b8b; font-size: 11.5px; font-weight: 500;
  border-left: 1px solid rgba(0,0,0,.6);
  box-shadow: inset 1px 0 0 rgba(255,255,255,.04);
}
.tab:first-child { border-left: 0; box-shadow: none; }
.tab svg { height: 30px; width: 44px; filter: drop-shadow(0 -1px 0 rgba(0,0,0,.8)); }
.tab .t-logo { width: 30px; height: 31px; }
.tab .t-car { width: 48px; height: 22px; margin-top: 8px; }
.tab .t-charge { width: 44px; height: 28px; margin-top: 2px; }
.tab .t-climate { width: 28px; height: 28px; margin-top: 2px; }
.tab .t-location { width: 28px; height: 28px; margin-top: 2px; }
.tab.active { color: #fff; font-weight: 600; }
.tab.active svg { filter: drop-shadow(0 0 6px rgba(255,255,255,.3)); }

/* ------------------------------------------------------------ side menu */

#menu {
  position: fixed; top: 0; bottom: 0; left: max(0px, calc(50% - 260px)); width: var(--menu-w);
  z-index: 1;
  background: linear-gradient(90deg, #161616, #1d1d1d);
  visibility: hidden;
}
body.menu-open #menu { visibility: visible; }
@media (max-width: 520px) { #menu { left: 0; } }
.menu-scroll { height: 100%; overflow-y: auto; padding: calc(var(--top-pad) + 14px) 0 calc(var(--safe-bot) + 20px); }
.menu-head {
  padding: 18px 16px 7px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em; color: #7d7d7d;
  text-shadow: 0 -1px 0 #000;
}
.menu-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid #000; box-shadow: 0 -1px 0 rgba(255,255,255,.04); }
.menu-list.last { margin-top: 26px; }
.menu-row {
  width: 100%; min-height: 50px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 15px; font-weight: 500; text-align: left;
  border-bottom: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  background: linear-gradient(#222, #1b1b1b);
}
button.menu-row:active { background: #2d5fa8; }
.menu-row.info span { color: var(--muted); font-weight: 400; font-size: 13.5px; text-align: right; overflow-wrap: anywhere; }
.menu-row.selected::after { content: '\2713'; color: var(--blue); font-weight: 700; }
.menu-row.danger { color: #ff6a5c; }
.menu-note { margin: 18px 16px 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

.switch { position: relative; width: 51px; height: 31px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute; inset: 0; border-radius: 16px;
  background: #0d0d0d; border: 1px solid #3a3a3a;
  transition: background .2s;
}
.switch span::after {
  content: ''; position: absolute; left: 1px; top: 1px; width: 27px; height: 27px; border-radius: 50%;
  background: linear-gradient(#fff, #ddd); box-shadow: 0 2px 4px rgba(0,0,0,.6);
  transition: transform .2s;
}
.switch input:checked + span { background: var(--blue); border-color: #1f5da8; }
.switch input:checked + span::after { transform: translateX(20px); }

/* ------------------------------------------------------------ HUD + alert */

#hud { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; pointer-events: none; }
.hud-box {
  min-width: 150px; max-width: 230px; min-height: 130px; padding: 22px 18px 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  border-radius: 12px; background: rgba(0,0,0,.82);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08);
  font-size: 14.5px; font-weight: 500; text-align: center;
}
.hud-check { display: none; font-size: 40px; line-height: 40px; }
#hud.done .spinner { display: none; }
#hud.done .hud-check { display: block; }

.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
.spinner.light { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

#alert { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(0,0,0,.55); padding: 20px; }
.alert-box {
  width: 284px; overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(rgba(58,58,58,.97), rgba(28,28,28,.97));
  border: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 10px 30px rgba(0,0,0,.8);
  text-align: center;
}
.alert-title { padding: 20px 16px 6px; font-size: 17px; font-weight: 600; }
.alert-msg { padding: 0 18px 18px; font-size: 14px; line-height: 1.4; color: #d6d6d6; -webkit-user-select: text; user-select: text; }
.alert-btns { display: flex; border-top: 1px solid #000; box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.alert-btns button { flex: 1; height: 46px; font-size: 16px; font-weight: 500; color: #7cb6ff; }
.alert-btns button + button { border-left: 1px solid #000; box-shadow: inset 1px 0 0 rgba(255,255,255,.06); }
.alert-btns button.primary { font-weight: 700; }
.alert-btns button:active { background: rgba(255,255,255,.08); }

/* short screens */
@media (max-height: 640px) {
  .range-num { font-size: 36px; }
  .gbtn { height: 46px; }
  .thermo-window { height: 56px; font-size: 38px; }
}

/* ------------------------------------------------------------ installed iPhone app */
/* iOS can report a page height shorter than the screen for home-screen apps,
   leaving a gap under anything pinned to bottom: 0. app.js sets --app-h to the
   full screen height and adds this class only for installed iPhone/iPad apps. */
html.ios-standalone { --top-pad: calc(var(--safe-top) + 10px); }
html.ios-standalone,
html.ios-standalone body { height: var(--app-h, 100%); }
html.ios-standalone #app,
html.ios-standalone #menu,
html.ios-standalone .red-screen { bottom: auto; height: var(--app-h, 100%); }
