:root {
  color-scheme: dark;
  --bg: #0b0f0d;
  --panel: #131916;
  --panel-2: #19211d;
  --text: #f4f7f5;
  --muted: #9aa8a0;
  --line: #26342d;
  --accent: #56e38a;
  --accent-2: #9df5bb;
  --danger: #ff7d7d;
  --warn: #ffd36a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% -10%, rgba(86, 227, 138, .14), transparent 35rem),
    var(--bg);
  color: var(--text);
}

body {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

button, input { font: inherit; }

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.shell {
  width: min(100%, 520px);
}

.card {
  background: rgba(19, 25, 22, .94);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 26px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bolt {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: var(--accent);
  color: #07110b;
  font-size: 28px;
  box-shadow: 0 10px 30px rgba(86, 227, 138, .20);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  letter-spacing: .18em;
  font-size: .72rem;
  font-weight: 800;
}

h1, h2 { margin: 0; }
h1 { font-size: clamp(2rem, 8vw, 3rem); letter-spacing: -.04em; }
h2 { font-size: 1.55rem; }

.intro {
  margin: 38px 0 16px;
  color: var(--muted);
  font-size: 1.05rem;
}


.charge-notice {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid rgba(86, 227, 138, .42);
  border-radius: 18px;
  background: rgba(86, 227, 138, .10);
  color: var(--text);
}
.charge-notice[hidden] { display: none; }
.charge-notice strong,
.charge-notice span { display: block; }
.charge-notice strong {
  color: var(--accent-2);
  font-size: 1rem;
  margin-bottom: 3px;
}
.charge-notice #chargeNoticeText {
  color: var(--muted);
  line-height: 1.35;
}
.charge-pulse {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(86, 227, 138, .5);
  flex: 0 0 auto;
  animation: chargePulse 1.4s infinite;
}
@keyframes chargePulse {
  0% { box-shadow: 0 0 0 0 rgba(86, 227, 138, .5); }
  70% { box-shadow: 0 0 0 10px rgba(86, 227, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(86, 227, 138, 0); }
}

.cars {
  display: grid;
  gap: 14px;
}

.car {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text);
  padding: 22px;
  text-align: left;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

.car:active { transform: scale(.985); }

.car:hover,
.car:focus-visible {
  border-color: var(--accent);
  outline: none;
  background: #1d2822;
}

.car-name {
  display: block;
  font-size: 1.55rem;
  font-weight: 850;
  letter-spacing: -.025em;
}

.car-sub {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  min-height: 44px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #6c7a72;
  flex: 0 0 auto;
}

.status.busy .dot {
  background: var(--warn);
  animation: pulse 1s infinite alternate;
}
.status.ok { color: var(--accent-2); }
.status.ok .dot { background: var(--accent); }
.status.error { color: var(--danger); }
.status.error .dot { background: var(--danger); }

@keyframes pulse { to { opacity: .35; } }

dialog {
  width: min(calc(100% - 24px), 430px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: #121815;
  color: var(--text);
  padding: 0;
  box-shadow: 0 28px 90px rgba(0,0,0,.62);
}

dialog::backdrop {
  background: rgba(0,0,0,.68);
  backdrop-filter: blur(5px);
}

.pin-card {
  position: relative;
  padding: 28px 24px 24px;
}

.close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 25px;
  cursor: pointer;
}

.pin-hint {
  color: var(--muted);
  margin: 8px 0 20px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 20px 0 24px;
}

.pin-dots i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #56645c;
  background: transparent;
}

.pin-dots i.on {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(86,227,138,.35);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.keypad button {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 750;
  cursor: pointer;
}

.keypad button:active { transform: scale(.97); }
.keypad .ghost { color: var(--muted); }

.start {
  width: 100%;
  margin-top: 16px;
  min-height: 58px;
  border: 0;
  border-radius: 17px;
  background: var(--accent);
  color: #06110a;
  font-weight: 900;
  cursor: pointer;
}

.start:disabled {
  opacity: .35;
  cursor: default;
}

@media (max-width: 380px) {
  .card { padding: 20px; border-radius: 22px; }
  .pin-card { padding: 24px 18px 18px; }
  .keypad button { min-height: 56px; }
}


.status-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
}

.status-link:active {
  transform: scale(.99);
}

.live-shell {
  width: min(100%, 620px);
}

.live-card {
  background: rgba(19, 25, 22, .94);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 26px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
  backdrop-filter: blur(18px);
}

.live-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 28px;
}

.back-link {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  font-size: 1.35rem;
}

.live-heading {
  flex: 1;
}

.live-heading h1 {
  font-size: 2rem;
}

.live-state {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  color: var(--accent-2);
  font-weight: 800;
}

.live-state .dot {
  background: var(--accent);
  animation: pulse 1s infinite alternate;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-2);
}

.metric.wide {
  grid-column: 1 / -1;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: .84rem;
  margin-bottom: 5px;
}

.metric-value {
  display: block;
  font-size: 1.45rem;
  font-weight: 850;
  letter-spacing: -.025em;
}

.metric-sub {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: .82rem;
}

.live-empty {
  padding: 26px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-2);
  color: var(--muted);
  text-align: center;
}

.live-footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
}

@media (max-width: 420px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
  .metric.wide {
    grid-column: auto;
  }
}
