/* ev.energy brand tokens (lifted from the public site) — "electric calm":
   a dark jungle-green world where the setup steps form a charging circuit. */
:root {
  --jungle: #0e2b2e;
  --jungle-2: #143e43;
  --jungle-3: #236b73;
  --electric: #50fb60;
  --sand: #f2efeb;
  --card: #ffffff;
  --text: #485d5f;
  --text-heading: #0e2b2e;
  --on-dark: #a6bbbd;
  --border: #e8e7ee;
  --radius: 20px;
  --pill: 100em;
  --font-body: "Source Sans 3", "Source Sans Pro", -apple-system, "Segoe UI", sans-serif;
  --font-display: "Barlow Condensed", var(--font-body);
}

* { box-sizing: border-box; }
/* author display rules (e.g. .btn-row flex) outrank the UA [hidden] rule, so
   toggling the `hidden` attribute on a styled element wouldn't hide it. Force it. */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--jungle);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
}

/* Layered atmosphere: two soft glows + grain, fixed behind everything */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(35, 107, 115, 0.55), transparent 60%),
    radial-gradient(700px 500px at 95% 105%, rgba(80, 251, 96, 0.08), transparent 55%),
    var(--jungle);
}
.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.topbar, .page, .footer { position: relative; z-index: 1; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 32px;
}
.logo { height: 26px; }
.topbar-divider { width: 1px; height: 22px; background: rgba(166, 187, 189, 0.35); }
.topbar-title {
  color: var(--electric);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 0.14em;
}
.topbar-form { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-user { color: var(--on-dark); font-size: 14px; }

.page { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 28px 20px 64px; }

/* ---- hero ---- */
.hero { text-align: center; max-width: 720px; }
.hero-login { padding-top: 7vh; }
.hero-home { padding-top: 3vh; }
.display {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(52px, 9vw, 96px);
  line-height: 0.94;
  letter-spacing: 0.015em;
  color: #fff;
  margin: 0 0 18px;
  text-wrap: balance;
}
.accent-dot { color: var(--electric); }
.lede { font-size: 19px; margin: 0 auto; max-width: 46ch; }
.on-dark { color: var(--on-dark); }

/* The charge line: draws itself across the hero, dot pulses at its tip */
.charge-line {
  position: relative;
  width: min(420px, 70vw);
  height: 2px;
  margin: 0 auto 40px;
  background: repeating-linear-gradient(90deg, var(--electric) 0 10px, transparent 10px 18px);
  background-size: 200% 100%;
  animation: draw 1.1s cubic-bezier(0.6, 0, 0.2, 1) both;
  opacity: 0.85;
}
.charge-dot {
  position: absolute;
  right: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--electric);
  box-shadow: 0 0 0 0 rgba(80, 251, 96, 0.6);
  animation: pulse 2.2s ease-out 1.1s infinite;
}
@keyframes draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(80, 251, 96, 0.55); }
  70% { box-shadow: 0 0 0 14px rgba(80, 251, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(80, 251, 96, 0); }
}

/* ---- cards ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.card-login {
  margin: 44px auto 0;
  padding: 36px 40px;
  max-width: 420px;
}
.card-steps {
  margin-top: 36px;
  padding: 48px 52px 36px;
  max-width: 660px;
  width: 100%;
}

/* ---- the circuit ---- */
.circuit {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}
.node {
  counter-increment: step;
  position: relative;
  padding: 0 0 36px 64px;
}
.node::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--text-heading);
  background: var(--card);
  border: 2.5px solid var(--electric);
  box-shadow: 0 0 0 4px rgba(80, 251, 96, 0.12);
}
.node::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 44px;
  bottom: 2px;
  width: 2px;
  background: repeating-linear-gradient(180deg, rgba(35, 107, 115, 0.5) 0 6px, transparent 6px 12px);
}
.node-last { padding-bottom: 8px; }
.node-last::after { display: none; }
.node h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-heading);
  margin: 6px 0 4px;
}
.node p { margin: 4px 0 12px; }
.hint { font-size: 14.5px; opacity: 0.8; }
code {
  background: var(--sand);
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 0.92em;
}

.status-chip {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 14px;
  transition: color 0.3s ease;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
/* connected + unknown: brand green, the dot pulses */
.status-connected, .status-unknown { color: var(--jungle-3); }
.status-connected .status-dot, .status-unknown .status-dot {
  background: var(--electric);
  animation: pulse 2.4s ease-out infinite;
}
/* disconnected: amber, steady dot, normal-case copy */
.status-disconnected { color: #b06a00; text-transform: none; letter-spacing: 0.01em; font-weight: 700; }
.status-disconnected .status-dot { background: #f0a020; }
/* checking: muted grey, gently breathing */
.status-checking { color: var(--text); opacity: 0.75; }
.status-checking .status-dot { background: #b9c4c4; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }

/* manual "check again" button, pinned to the right of the status chip */
.status-refresh {
  margin-left: auto;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border);
  color: inherit;
  cursor: pointer;
  flex: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.status-refresh svg { width: 16px; height: 16px; }
.status-refresh:hover { border-color: var(--electric); color: var(--jungle); box-shadow: 0 0 0 4px rgba(80, 251, 96, 0.18); }
.status-refresh:focus-visible { outline: 3px solid var(--electric); outline-offset: 2px; }
.status-refresh:disabled { cursor: default; }
.status-refresh.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- buttons ---- */
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.btn-primary, .btn-secondary, .btn-google, .btn-ghost {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  border-radius: var(--pill);
  padding: 12px 28px;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-primary {
  background: var(--electric);
  color: var(--jungle);
  box-shadow: 0 4px 18px rgba(80, 251, 96, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(80, 251, 96, 0.45); }
.btn-secondary {
  background: var(--card);
  color: var(--text-heading);
  border: 1.5px solid var(--jungle);
}
.btn-secondary:hover { background: var(--sand); transform: translateY(-1px); }
.btn-google {
  width: 100%;
  justify-content: center;
  background: var(--card);
  color: var(--text-heading);
  border: 1.5px solid var(--border);
  padding: 14px 28px;
}
.btn-google:hover {
  border-color: var(--electric);
  box-shadow: 0 0 0 4px rgba(80, 251, 96, 0.18);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--on-dark);
  border: 1px solid rgba(166, 187, 189, 0.4);
  padding: 7px 18px;
  font-size: 14px;
  font-weight: 600;
}
.btn-ghost:hover { color: #fff; border-color: #fff; }
:is(.btn-primary, .btn-secondary, .btn-google, .btn-ghost):focus-visible {
  outline: 3px solid var(--electric);
  outline-offset: 2px;
}

.copy-done { color: var(--jungle-3); font-weight: 700; }
.copy-done.pop { animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* circular icon button (rotate/regenerate) with a hover/focus tooltip */
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--jungle-3);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { border-color: var(--electric); color: var(--jungle); box-shadow: 0 0 0 4px rgba(80, 251, 96, 0.18); transform: translateY(-1px); }
.icon-btn:focus-visible { outline: 3px solid var(--electric); outline-offset: 2px; }
.icon-btn[data-tooltip]::after,
.status-refresh[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--jungle);
  color: var(--sand);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.icon-btn[data-tooltip]:hover::after, .icon-btn[data-tooltip]:focus-visible::after,
.status-refresh[data-tooltip]:hover::after, .status-refresh[data-tooltip]:focus-visible::after { opacity: 1; }

/* inline confirm before a destructive rotate */
.confirm-box {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--sand);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.confirm-box p { margin: 0 0 12px; color: var(--text-heading); font-size: 14.5px; }

/* post-issue guidance: importing replaces the old profile (a known footgun) */
.import-note {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--sand);
  border: 1px solid var(--border);
  border-left: 4px solid var(--electric);
  border-radius: 12px;
}
.import-note p { margin: 0; color: var(--text-heading); font-size: 14.5px; }
.import-note .pubkey-line { margin-top: 10px; font-size: 13px; opacity: 0.85; }
.import-note code {
  word-break: break-all;
  font-size: 12.5px;
  background: rgba(14, 43, 46, 0.06);
  padding: 1px 6px;
  border-radius: 6px;
}

.alert {
  background: #ffded6;
  color: #7a2e16;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 15px;
}
.fineprint { font-size: 13px; opacity: 0.75; margin: 18px 0 0; text-align: center; }

.footer {
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: var(--on-dark);
  opacity: 0.8;
}
.footer-link {
  color: var(--electric);
  text-decoration: none;
  font-weight: 600;
}
.footer-link:hover { text-decoration: underline; }

/* ---- staggered load reveals ---- */
.reveal, .reveal-1, .reveal-2, .reveal-late { animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.reveal-1 { animation-delay: 0.08s; }
.reveal-2 { animation-delay: 0.16s; }
.reveal-late { animation-delay: 0.3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 560px) {
  .card-steps { padding: 32px 24px; }
  .node { padding-left: 54px; }
  .topbar-user { display: none; }
}
