:root {
  --bg: #f6f5fa;
  --surface: #ffffff;
  --fg: #19162a;
  --muted: #6d6884;
  --line: #e8e5f0;
  --accent: #6c3ee8;
  --accent-soft: #efe9fd;
  --code-bg: #f3f1f9;
  --ok: #138a5b;
  --ok-soft: #e3f5ed;
  --warn: #9a6400;
  --warn-soft: #fbf0d9;
  --shadow: 0 1px 2px rgba(25, 22, 42, .04), 0 4px 16px rgba(25, 22, 42, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0d17;
    --surface: #17141f;
    --fg: #ece9f6;
    --muted: #9b96b2;
    --line: #2a2638;
    --accent: #a48bff;
    --accent-soft: #241d3d;
    --code-bg: #1f1b2b;
    --ok: #4fd39a;
    --ok-soft: #12291f;
    --warn: #e8b553;
    --warn-soft: #2c2312;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ---- header ---- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 22px; padding-bottom: 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo { width: 38px; height: 38px; border-radius: 50%; flex: none; background: radial-gradient(circle at 30% 30%, #b99bff, #6c3ee8 55%, #3b1d9a); }
h1 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.lead { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.switch { display: inline-flex; padding: 4px; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.switch button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600;
  padding: 8px 14px; border-radius: 9px; cursor: pointer;
}
.switch button span { font-weight: 400; font-size: 12px; margin-left: 4px; opacity: .8; }
.switch button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }

/* ---- layout ---- */
main { padding: 24px 16px 8px; }
.network { display: none; }
body[data-network="mainnet"] .network[data-for="mainnet"],
body[data-network="testnet"] .network[data-for="testnet"] { display: block; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; box-shadow: var(--shadow); min-width: 0;
}
.card.wide { grid-column: 1 / -1; }
.restore { margin-top: 16px; }
h2 { margin: 0 0 4px; font-size: 16px; }
h3 { margin: 22px 0 8px; font-size: 14px; }
.hint { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
h3 .hint { font-weight: 400; margin-left: 4px; }

/* ---- key / value rows ---- */
.rows { display: grid; grid-template-columns: 150px 1fr; margin: 6px 0 0; }
.rows dt, .rows dd { padding: 9px 0; border-top: 1px solid var(--line); margin: 0; }
.rows dt:first-of-type, .rows dt:first-of-type + dd { border-top: 0; }
.rows dt { color: var(--muted); font-size: 13.5px; }
.rows dd { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rows dd code { min-width: 0; }
.rows small { color: var(--muted); font-size: 12px; }

code {
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg); padding: 2px 6px; border-radius: 6px; word-break: break-all;
}
.hint code { font-size: 12.5px; padding: 1px 4px; }

/* ---- buttons ---- */
.copy {
  flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer;
}
.copy:hover { color: var(--accent); border-color: var(--accent); }
.copy.done { color: var(--ok); border-color: var(--ok); }
.copy svg { width: 15px; height: 15px; }
.button {
  display: inline-block; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 14px;
  background: var(--accent-soft); color: var(--accent);
}
.button:hover { text-decoration: none; filter: brightness(.97); }

.links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; }
.tile { display: block; padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--fg); }
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile b { display: block; margin-bottom: 2px; }
.tile span { color: var(--muted); font-size: 13px; }

/* ---- snapshot table ---- */
.snapshots { overflow-x: auto; }
.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 6px 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list tr:last-child td { border-bottom: 0; }
.list td.actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding-right: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--code-bg); color: var(--muted); }
.badge.pruned { background: var(--ok-soft); color: var(--ok); }
.badge.pre-epoch, .badge.post-epoch { background: var(--accent-soft); color: var(--accent); }
.badge.archive { background: var(--warn-soft); color: var(--warn); }
.download { font-weight: 600; }

/* ---- restore steps ---- */
.steps { list-style: none; counter-reset: step; margin: 8px 0 0; padding: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 34px; margin-bottom: 14px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent);
}
.steps em { color: var(--muted); font-style: normal; font-size: 13px; }
pre { position: relative; margin: 6px 0 0; }
pre code { display: block; padding: 11px 44px 11px 12px; overflow-x: auto; white-space: pre; word-break: normal; border: 1px solid var(--line); }
pre .copy { position: absolute; top: 6px; right: 6px; }

footer { display: flex; gap: 18px; padding: 28px 16px 40px; color: var(--muted); font-size: 13.5px; }

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .links { grid-template-columns: 1fr; }
  .rows { grid-template-columns: 1fr; }
  .rows dt { padding-bottom: 0; }
  .rows dd { border-top: 0; padding-top: 4px; }
  .rows dt:first-of-type + dd { padding-top: 4px; }
  .switch { width: 100%; }
  .switch button { flex: 1; }
}
