:root {
  --green: #0097BF;          /* vendigo primary */
  --green-light: #1ab8d9;    /* lighter mid */
  --green-bright: #5cd5ec;   /* bright accent — bolts, glow */
  --green-600: #006d8a;      /* darker primary for done state */
  --green-50: #e6f6fa;
  --green-100: #c7e9f0;
  --ink: #0f172a;
  --muted: #5a7280;
  --line: #c8dde4;
  --bg: #D5EBF1;             /* vendigo bg */
  --card: #ffffff;
  --ring-bg: #a8d4de;        /* track — slightly darker than bg for contrast */
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --glow: rgba(92, 213, 236, 0.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 16px 20px 32px;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 60%);
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 8px;
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 0; background: transparent;
  color: var(--ink);
  display: grid; place-items: center;
  cursor: pointer;
}
.icon-btn:hover { background: var(--green-100); }

.updated {
  text-align: left;
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
  display: flex; flex-direction: column;
}
.updated strong { color: var(--ink); font-weight: 600; font-size: 13px; }

/* Vehicle */
.vehicle { text-align: center; margin-top: 8px; }
.vehicle h1 {
  font-size: 22px; font-weight: 700; margin: 0;
  letter-spacing: -0.01em;
}
.plug {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
}

/* Ring wrap (positioned for bolts overlay) */
.ring-wrap {
  position: relative;
  display: grid;
  place-items: center;
  margin: 18px 0 4px;
  isolation: isolate;
}

/* Rotating glow halo behind ring */
.ring-wrap::before {
  content: '';
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    var(--glow) 60deg,
    transparent 140deg,
    transparent 220deg,
    rgba(26, 184, 217, 0.4) 280deg,
    transparent 340deg
  );
  filter: blur(14px);
  z-index: -1;
  animation: halo-spin 5s linear infinite;
}
@keyframes halo-spin {
  to { transform: rotate(360deg); }
}

/* Ring */
.ring {
  --pct: 0;
  --size: 240px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background:
    conic-gradient(var(--green) calc(var(--pct) * 1%), var(--ring-bg) 0);
  display: grid;
  place-items: center;
  transition: background 600ms ease;
  position: relative;
  animation: ring-pulse 2.6s ease-in-out infinite;
}
@keyframes ring-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(92, 213, 236, 0), 0 10px 30px rgba(15, 23, 42, 0.06); }
  50%      { box-shadow: 0 0 36px 6px rgba(92, 213, 236, 0.45), 0 10px 30px rgba(15, 23, 42, 0.06); }
}

.ring::after {
  content: '';
  position: absolute; inset: 14px;
  border-radius: 50%;
  background: transparent;
}
.ring-inner {
  position: relative;
  width: calc(var(--size) - 28px);
  height: calc(var(--size) - 28px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, var(--green-bright) 0%, var(--green-light) 35%, var(--green) 70%, var(--green-600) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow:
    inset 0 0 0 6px #fff,
    inset 0 -20px 40px rgba(0, 0, 0, 0.10);
  text-align: center;
  padding: 18px;
  overflow: hidden;
}

/* Sweeping shine across inner disc */
.ring-inner::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.22) 48%,
    rgba(255, 255, 255, 0.0) 60%
  );
  animation: shine-sweep 3.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine-sweep {
  0%   { transform: translate(-25%, -25%) rotate(0deg); opacity: 0; }
  20%  { opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translate(25%, 25%) rotate(0deg); opacity: 0; }
}

.battery {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 26px; font-weight: 700;
  line-height: 1;
  position: relative;
  z-index: 1;
}
.battery svg {
  animation: battery-pulse 1.6s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}
@keyframes battery-pulse {
  0%, 100% { transform: scale(1);    opacity: 1;   }
  50%      { transform: scale(1.18); opacity: 0.85;}
}

.ring-label {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  position: relative;
  z-index: 1;
}

/* Lightning bolts rising inside the ring */
.bolts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.bolt {
  position: absolute;
  width: 16px; height: 16px;
  color: var(--green-bright);
  opacity: 0;
  filter: drop-shadow(0 0 6px rgba(92, 213, 236, 0.95));
  animation: bolt-rise 2.8s ease-in-out infinite;
}
.bolt svg { width: 100%; height: 100%; display: block; fill: currentColor; }
.bolt.b1 { left: 18%;  bottom: 18%; animation-delay: 0s;    }
.bolt.b2 { right: 22%; bottom: 26%; animation-delay: 0.9s;  }
.bolt.b3 { left: 48%;  bottom: 12%; animation-delay: 1.7s;  }
.bolt.b4 { right: 36%; bottom: 14%; animation-delay: 2.3s;  }
@keyframes bolt-rise {
  0%   { opacity: 0; transform: translateY(0)    scale(0.7) rotate(-6deg); }
  20%  { opacity: 1; }
  70%  { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-90px) scale(1.15) rotate(8deg); }
}

/* Ready */
.ready {
  text-align: center;
  margin-top: 14px;
}
.ready p { margin: 4px 0; font-size: 15px; }
.ready .muted { color: var(--muted); font-size: 13px; }

/* Actions */
.actions {
  display: grid;
  gap: 10px;
  margin: 18px 0 22px;
}
.pill {
  appearance: none;
  border: 2px solid var(--green);
  background: #fff;
  color: var(--green);
  border-radius: 999px;
  height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, transform 80ms ease;
}
.pill:active { transform: scale(0.98); }
.pill:hover { background: var(--green-50); }
.pill.ghost {
  border-color: var(--line);
  color: var(--ink);
}
.pill.ghost:hover { background: var(--green-100); }
.pill[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Boost button glows brighter when active */
.pill#boostBtn:not([disabled]) svg {
  animation: bolt-flash 1.4s ease-in-out infinite;
}
@keyframes bolt-flash {
  0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 0 transparent); }
  50%      { transform: scale(1.15); filter: drop-shadow(0 0 6px var(--green-bright)); }
}

/* Energy card */
.energy {
  background: var(--card);
  border-radius: 18px;
  padding: 16px 16px 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.energy-head {
  display: flex; align-items: center; justify-content: space-between;
}
.energy-head h2 {
  font-size: 18px; font-weight: 700; margin: 0;
}
.caret { color: var(--muted); }
.energy-sub { margin: 4px 0 14px; color: var(--muted); font-size: 13px; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat {
  background: var(--green-50);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  position: relative;
  overflow: hidden;
}
.stat-label { display:block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.stat-value small { font-size: 12px; font-weight: 600; color: var(--muted); margin-inline-start: 4px; }

/* Brief flash when a stat value updates */
.stat.flash::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(92, 213, 236, 0.45), transparent);
  animation: stat-flash 700ms ease-out forwards;
  pointer-events: none;
}
@keyframes stat-flash {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Brand */
.brand {
  margin-top: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.brand span { font-weight: 700; color: var(--green); }

/* Done state — freeze the show */
body.done .ring,
body.done .ring-inner::before,
body.done .ring-wrap::before,
body.done .battery svg,
body.done .bolt {
  animation: none;
}
body.done .bolts { display: none; }
body.done .ring-wrap::before { opacity: 0.25; }
body.done .ring-inner {
  background: radial-gradient(circle at 30% 25%, var(--green-light) 0%, var(--green) 50%, var(--green-600) 100%);
}
body.done .pill#boostBtn { display: none; }

@media (max-width: 360px) {
  .ring { --size: 210px; }
  .ring-wrap::before { width: 250px; height: 250px; }
  .battery { font-size: 22px; }
  .ring-label { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .ring,
  .ring-inner::before,
  .ring-wrap::before,
  .battery svg,
  .bolt,
  .pill#boostBtn:not([disabled]) svg {
    animation: none !important;
  }
  .bolts { display: none; }
}
