:root {
  --bg: #05070b;
  --bg-2: #0b111c;
  --panel: rgba(18, 25, 39, 0.82);
  --panel-solid: #111827;
  --panel-soft: rgba(255,255,255,0.055);
  --line: rgba(255,255,255,0.12);
  --text: #f5f7fb;
  --muted: #aab4c5;
  --gold: #f3c969;
  --gold-2: #b8842d;
  --green: #7ef29d;
  --cyan: #8ee7ff;
  --red: #ff6a75;
  --amber: #ffd166;
  --shadow: 0 24px 80px rgba(0,0,0,0.46);
  --radius: 28px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 10% -10%, rgba(142,231,255,0.22), transparent 34rem),
    radial-gradient(circle at 95% 5%, rgba(243,201,105,0.18), transparent 34rem),
    linear-gradient(135deg, #03050a 0%, #07101d 50%, #03050a 100%);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 42px;
}
.topbar,
.hero-card,
.panel,
.metric-card {
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255,255,255,0.09), rgba(255,255,255,0.035));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 24px;
}
.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 950;
  letter-spacing: -0.08em;
  color: #07101d;
  background:
    radial-gradient(circle at 25% 20%, #fff7cd, transparent 32%),
    linear-gradient(135deg, var(--gold), #89f7ba 48%, var(--cyan));
  box-shadow: 0 14px 30px rgba(243,201,105,0.24), inset 0 0 0 1px rgba(255,255,255,0.55);
}
.brand-lockup h1,
.hero-card h2,
.panel h3,
.modal-card h2 {
  margin: 0;
  line-height: 1.02;
  letter-spacing: -0.055em;
}
.brand-lockup h1 { font-size: clamp(1.45rem, 4vw, 2.2rem); }
.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 850;
}
.muted { color: var(--muted); line-height: 1.55; }
.top-actions, .button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.button-column { display: grid; gap: 10px; }
button, .ghost-link {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 850;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
button:active, .ghost-link:active { transform: scale(0.98); }
.primary-btn {
  color: #07101d;
  background: linear-gradient(135deg, var(--gold), #8ff7ad 60%, var(--cyan));
  box-shadow: 0 15px 28px rgba(126,242,157,0.18);
}
.ghost-btn, .ghost-link {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
}
.danger-btn {
  color: white;
  background: linear-gradient(135deg, #a6192e, var(--red));
}
.compact { padding: 9px 12px; font-size: 0.9rem; }
.hero-card {
  margin: 16px 0 12px;
  padding: clamp(22px, 5vw, 42px);
  min-height: 220px;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  overflow: hidden;
  position: relative;
}
.hero-card:before {
  content: "";
  position: absolute;
  inset: -1px;
  background:
    radial-gradient(circle at 72% 30%, rgba(142,231,255,0.18), transparent 18rem),
    radial-gradient(circle at 25% 75%, rgba(243,201,105,0.12), transparent 20rem);
  pointer-events: none;
}
.hero-card > * { position: relative; }
.hero-card h2 {
  max-width: 800px;
  font-size: clamp(2rem, 7vw, 4.6rem);
}
.hero-card p:not(.eyebrow) {
  max-width: 780px;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.55;
}
.hero-meter { display: grid; justify-items: center; gap: 9px; }
.hero-meter small { color: var(--muted); font-weight: 800; }
.ring {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, #111827 0 53%, transparent 54%),
    conic-gradient(var(--green) calc(var(--score, 82) * 1%), rgba(255,255,255,0.09) 0);
  box-shadow: inset 0 0 0 1px var(--line), 0 18px 48px rgba(126,242,157,0.18);
}
.ring span { font-size: 2.1rem; font-weight: 950; letter-spacing: -0.08em; }
.tabbar {
  position: sticky;
  top: 88px;
  z-index: 19;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px;
  margin-bottom: 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(5,7,11,0.74);
  backdrop-filter: blur(18px);
}
.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  white-space: nowrap;
}
.tab.active {
  color: #08101c;
  background: linear-gradient(135deg, var(--gold), var(--cyan));
}
.view { display: none; animation: fadeUp 0.24s ease both; }
.active-view { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(7px);} to { opacity: 1; transform: translateY(0);} }
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel, .metric-card {
  border-radius: var(--radius);
  padding: clamp(18px, 4vw, 26px);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.panel h3 { font-size: clamp(1.28rem, 3vw, 2rem); }
.status-badge {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.07);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 900;
  font-size: 0.78rem;
  white-space: nowrap;
}
.status-badge.green { color: #00140a; background: var(--green); border-color: transparent; }
.status-badge.red { color: white; background: var(--red); border-color: transparent; }
.status-badge.amber { color: #211305; background: var(--amber); border-color: transparent; }
.scooter-visual {
  height: 190px;
  position: relative;
  margin: 10px 0 2px;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 80%, rgba(255,255,255,0.08), transparent 44%), rgba(255,255,255,0.035);
  overflow: hidden;
}
.wheel { position: absolute; bottom: 30px; width: 54px; height: 54px; border-radius: 50%; border: 10px solid #1c2330; box-shadow: inset 0 0 0 3px #576074, 0 14px 30px rgba(0,0,0,0.35); }
.wheel.front { left: 18%; }
.wheel.rear { right: 18%; }
.deck { position: absolute; left: 25%; right: 25%; bottom: 58px; height: 15px; border-radius: 999px; background: linear-gradient(90deg, #202939, #c7cbd4, #202939); }
.stem { position: absolute; left: 24%; bottom: 80px; height: 110px; width: 13px; transform: rotate(-18deg); transform-origin: bottom; border-radius: 999px; background: linear-gradient(#586274, #141922); }
.scooter-line { position: absolute; inset: auto 18% 55px 18%; height: 2px; background: linear-gradient(90deg, transparent, rgba(243,201,105,0.8), transparent); }
.stats-row,
.ride-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.ride-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 22px 0; }
.stats-row div,
.ride-stats div,
.large-number,
.big-readout {
  border-radius: 20px;
  padding: 14px;
  background: rgba(255,255,255,0.055);
  border: 1px solid var(--line);
}
.stats-row strong,
.ride-stats strong,
.large-number strong,
.metric-card strong {
  display: block;
  font-size: clamp(1.5rem, 5vw, 2.6rem);
  letter-spacing: -0.08em;
}
.stats-row span,
.ride-stats span,
.large-number span,
.metric-card span,
.metric-card small { color: var(--muted); font-weight: 800; }
.metric-card { min-height: 150px; background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(255,255,255,0.035)); }
.metric-card strong { margin: 10px 0 4px; color: var(--gold); }
.alert-stack, .tip-list, .history-list { display: grid; gap: 10px; }
.alert-item, .tip-item, .history-item {
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.055);
  border-radius: 18px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}
.alert-item strong, .tip-item strong, .history-item strong { display: block; margin-bottom: 4px; }
.alert-item small, .tip-item small, .history-item small { color: var(--muted); line-height: 1.45; }
.alert-item.high { border-color: rgba(255,106,117,0.45); background: rgba(255,106,117,0.095); }
.alert-item.medium { border-color: rgba(255,209,102,0.45); background: rgba(255,209,102,0.08); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.045);
  padding: 13px;
  border-radius: 18px;
}
.check-item input { transform: translateY(4px); accent-color: var(--gold); }
.check-item strong { display: block; }
.check-item small { color: var(--muted); display: block; margin-top: 3px; line-height: 1.35; }
.toggle-list { display: grid; gap: 12px; }
.toggle-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.045);
  border-radius: 20px;
  padding: 14px;
}
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row small { color: var(--muted); line-height: 1.4; margin-top: 4px; }
.toggle-row input { width: 46px; height: 26px; accent-color: var(--green); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.single { grid-template-columns: 1fr; }
label { color: var(--muted); font-weight: 850; }
input, select {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0,0,0,0.26);
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}
input:focus, select:focus { border-color: rgba(243,201,105,0.8); box-shadow: 0 0 0 4px rgba(243,201,105,0.09); }
.lens-wrap {
  position: relative;
  min-height: 280px;
  border-radius: 22px;
  overflow: hidden;
  background: #02040a;
  border: 1px solid var(--line);
}
#awarenessVideo { width: 100%; height: 360px; object-fit: cover; display: block; background: radial-gradient(circle, rgba(142,231,255,0.16), transparent 40%), #03050a; }
.lens-overlay {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.detect-btn { background: rgba(5,7,11,0.72); border: 1px solid rgba(255,255,255,0.18); backdrop-filter: blur(12px); }
.map-panel canvas {
  width: 100%;
  height: auto;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px),
    radial-gradient(circle at 70% 30%, rgba(142,231,255,0.12), transparent 38%),
    #060b13;
  background-size: 40px 40px, 40px 40px, auto, auto;
}
.range-row { display: block; margin: 18px 0; }
.range-row span { color: var(--gold); margin-left: 8px; }
.map-links { margin-top: 14px; }
.badge-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.badge {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  padding: 14px;
}
.badge.unlocked { border-color: rgba(126,242,157,0.4); background: rgba(126,242,157,0.075); }
.badge strong { display: block; }
.badge small { color: var(--muted); }
.voice-line {
  margin: 18px 0 0;
  padding: 18px;
  border-left: 4px solid var(--gold);
  background: rgba(243,201,105,0.08);
  border-radius: 0 18px 18px 0;
  color: #fff3cc;
  line-height: 1.55;
}
.system-log {
  min-height: 260px;
  max-height: 360px;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 14px;
  background: #03050a;
  color: #b7ffc7;
  white-space: pre-wrap;
}
.modal {
  width: min(560px, calc(100% - 26px));
  border: 0;
  border-radius: 30px;
  padding: 0;
  color: var(--text);
  background: transparent;
}
.modal::backdrop { background: rgba(0,0,0,0.72); backdrop-filter: blur(8px); }
.modal-card {
  display: grid;
  gap: 14px;
  padding: 26px;
  border-radius: 30px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #111827, #070b12);
  box-shadow: var(--shadow);
}
.modal-mark { width: 68px; height: 68px; border-radius: 22px; }
.danger-modal .modal-card { border-color: rgba(255,106,117,0.5); }
.toast-stack {
  position: fixed;
  z-index: 50;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
  width: min(420px, calc(100% - 32px));
}
.toast {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(17,24,39,0.94);
  box-shadow: var(--shadow);
  padding: 14px;
}
.toast strong { display:block; margin-bottom: 4px; }
.toast small { color: var(--muted); line-height: 1.45; }
@media (max-width: 900px) {
  .grid.two, .grid.three, .form-grid, .check-grid { grid-template-columns: 1fr; }
  .hero-card { align-items: flex-start; flex-direction: column; }
  .hero-meter { justify-self: start; }
  .topbar { align-items: flex-start; }
  .top-actions { justify-content: flex-end; }
  .ride-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .app-shell { width: min(100% - 18px, 1180px); }
  .brand-mark { width: 48px; height: 48px; }
  .topbar { top: 6px; border-radius: 20px; }
  .tabbar { top: 78px; }
  .hero-card, .panel, .metric-card { border-radius: 22px; }
  .stats-row { grid-template-columns: 1fr; }
}
