/* battery.fun — sticker register: paper, one volt green, thick black ink, hard offset shadows. */
:root {
  --paper: #fbfbf9;
  --paper-2: #f1f3ee;
  --volt: #65f933;
  --volt-deep: #3ac412;
  --volt-soft: #e4ffd8;
  --ink: #101014;
  --muted: #6a6f68;
  --line: 3px;
  --r: 18px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --display: 'Fredoka', system-ui, sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; }
h1, h2, h3, .num, .btn, .tabs a, .pill { font-family: var(--display); }
h1 { font-size: clamp(30px, 5.2vw, 52px); line-height: 1.02; margin: 0 0 10px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(19px, 2.4vw, 24px); margin: 0 0 8px; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
p { margin: 0 0 12px; }
.lede { font-size: clamp(16px, 1.9vw, 19px); color: var(--muted); max-width: 54ch; }

/* ----------------------------------------------------------------- stage --- */
.stage { position: fixed; inset: 0; z-index: 0; }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage-veil { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(251,251,249,0) 34%, rgba(251,251,249,.72) 86%, rgba(251,251,249,.96) 100%); }

/* ---------------------------------------------------------------- topbar --- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 12px 18px;
  background: rgba(251,251,249,.82); backdrop-filter: blur(10px);
  border-bottom: var(--line) solid var(--ink);
}
.wordmark { display: flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.02em; }
.wordmark svg { width: 26px; height: 34px; display: block; }
.tabs { display: flex; gap: 4px; margin-left: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  text-decoration: none; font-weight: 600; font-size: 15px; padding: 7px 13px; border-radius: 999px;
  border: var(--line) solid transparent; white-space: nowrap; color: var(--muted);
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current='page'] { background: var(--volt); border-color: var(--ink); color: var(--ink); box-shadow: var(--shadow-sm); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; white-space: nowrap;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--volt-deep); }
.pill.off i { background: var(--muted); }

/* ----------------------------------------------------------------- shell --- */
.screen:focus, .screen:focus-visible { outline: none; }
.outlet { position: relative; z-index: 10; padding: 86px 18px 40px; min-height: 100%; }
.screen { max-width: 1120px; margin: 0 auto; }

/* Each page leaves the stage a different piece of the frame, so no two screens are the same
   rectangle with different words in it. */
@media (min-width: 1040px) {
  .screen[data-page='cell'] { max-width: 700px; margin-right: 4vw; margin-left: auto; }
  .screen[data-page='grid'] { max-width: 660px; margin-left: 4vw; margin-right: auto; }
  .screen[data-page='token'] { max-width: 620px; margin-right: 5vw; margin-left: auto; }
  .screen[data-page='docs'] { max-width: 1040px; margin-left: 4vw; margin-right: auto; }
}
.hero { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .hero { grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr); gap: 34px; } }

.card {
  background: #fff; border: var(--line) solid var(--ink); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 16px; }
.card.flat { box-shadow: none; }
.card.volt { background: var(--volt-soft); }

.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.grid3 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid3 { grid-template-columns: repeat(3, 1fr); } }

/* ------------------------------------------------------------------ bits --- */
.stat { background: #fff; border: var(--line) solid var(--ink); border-radius: 14px; padding: 14px 15px; }
.stat .k { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--display); font-weight: 600; font-size: 26px; line-height: 1.15; margin-top: 3px; word-break: break-word; }
.stat .s { font-size: 13px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 13px; }
.dash { color: var(--muted); }

.btn {
  appearance: none; cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 16px;
  padding: 12px 18px; border-radius: 14px; border: var(--line) solid var(--ink);
  background: var(--volt); color: var(--ink); box-shadow: var(--shadow);
  transition: transform .06s ease, box-shadow .06s ease;
}
.btn:hover { transform: translate(1px, 1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(5px, 5px); box-shadow: 0 0 0 var(--ink); }
.btn[disabled] { background: var(--paper-2); color: var(--muted); cursor: not-allowed; box-shadow: var(--shadow-sm); }
.btn.ghost { background: #fff; }
.btn.small { font-size: 14px; padding: 8px 13px; border-width: 2px; box-shadow: var(--shadow-sm); }
.btn.wide { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.field .box { display: flex; align-items: center; gap: 8px; border: var(--line) solid var(--ink); border-radius: 14px; background: #fff; padding: 10px 13px; }
.field input, .field select {
  border: 0; outline: 0; background: transparent; font-family: var(--display); font-weight: 600;
  font-size: 22px; width: 100%; color: var(--ink); min-width: 0;
}
.field select { font-size: 16px; }
.field .unit { font-family: var(--display); font-weight: 600; color: var(--muted); }

/* the charge meter: the same object as the 3D one, flattened into the HUD */
.meter { border: var(--line) solid var(--ink); border-radius: 12px; height: 26px; background: var(--paper-2); overflow: hidden; position: relative; }
.meter i { display: block; height: 100%; width: 0; background: var(--volt); border-right: var(--line) solid var(--ink); transition: width .5s ease; }
.meter.empty i { border-right: 0; }
.meter span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 14px; }

.rows { display: flex; flex-direction: column; gap: 0; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 2px dashed #dfe2db; font-size: 15px; }
.row:last-child { border-bottom: 0; }
.row b { font-family: var(--display); font-weight: 600; }

.steps { counter-reset: s; display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.step .n { width: 34px; height: 34px; border-radius: 50%; border: var(--line) solid var(--ink); background: var(--volt); display: grid; place-items: center; font-family: var(--display); font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 24px); z-index: 60;
  background: var(--ink); color: #fff; border-radius: 12px; padding: 11px 16px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

footer.foot { position: relative; z-index: 10; text-align: center; color: var(--muted); font-size: 13px; padding: 10px 18px 28px; }

@media (max-width: 760px) {
  /* two rows: the identity and the wallet on top, the pages underneath, nothing clipped */
  .topbar { padding: 9px 12px 7px; gap: 8px; flex-wrap: wrap; }
  .wordmark { font-size: 19px; }
  .tabs { order: 3; flex-basis: 100%; margin: 2px -12px -7px; padding: 4px 12px 7px; border-top: 2px solid #e6e8e2; }
  .topbar-right { margin-left: auto; }
  .topbar-right .pill.chain { display: none; }
  .outlet { padding: calc(118px + 30vh) 14px 26px; }
  .card { padding: 16px; }
  h1 { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ------------------------------------------------------------------ docs --- */
/* A rail and a body, not one endless page: each section is its own screen, and the stage behind
   it looks at the part of the object that section talks about. */
.docs { display: grid; gap: 22px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .docs { grid-template-columns: 208px minmax(0, 1fr); gap: 34px; } }

.docs-rail { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.docs-rail::-webkit-scrollbar { display: none; }
.docs-rail a {
  text-decoration: none; font-family: var(--display); font-weight: 600; font-size: 15px;
  padding: 8px 14px; border-radius: 12px; border: 2px solid transparent; color: var(--muted);
  white-space: nowrap;
}
.docs-rail a:hover { color: var(--ink); }
.docs-rail a.on { background: var(--volt); border-color: var(--ink); color: var(--ink); box-shadow: var(--shadow-sm); }
@media (min-width: 900px) {
  .docs-rail { position: sticky; top: 92px; flex-direction: column; overflow: visible; }
  .docs-rail a { padding: 9px 14px; }
}

.docs-body > .card, .docs-body > .grid2 { margin-top: 16px; }
.docs-body h2 { margin-top: 2px; }
.docs-body p.last { margin-bottom: 0; }
.docs-body .card p { max-width: 68ch; }

.diagram { display: block; width: 100%; height: auto; margin: 4px 0 18px; }
.card .diagram { margin: 18px 0 0; }

.formula {
  font-family: var(--display); font-weight: 600; font-size: clamp(19px, 2.4vw, 27px);
  background: #fff; border: var(--line) solid var(--ink); border-radius: 14px;
  padding: 14px 18px; text-align: center; margin: 4px 0 14px;
}

a.tile { text-decoration: none; display: block; }
a.tile:hover { transform: translate(1px, 1px); box-shadow: 4px 4px 0 var(--ink); }
a.tile h3 { margin-bottom: 4px; }
a.tile p { color: var(--muted); }

.docs-next {
  display: inline-block; margin-top: 18px; text-decoration: none;
  font-family: var(--display); font-weight: 600; font-size: 16px;
  padding: 11px 18px; border-radius: 14px; border: var(--line) solid var(--ink);
  background: #fff; box-shadow: var(--shadow-sm);
}
.docs-next:hover { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
