:root {
  color-scheme: dark;
  --bg: #020617;
  --surface: rgba(15, 23, 42, 0.78);
  --surface-solid: #0f172a;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --brand: #ea580c;
  --brand-light: #fb923c;
  --warning: #fdba74;
  --danger: #f87171;
  --success: #4ade80;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(circle at top, #172033 0, var(--bg) 36rem); color: var(--text); min-height: 100vh; }
a { color: var(--brand-light); }
a:hover { color: #fdba74; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.site-header { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 64px; padding: .75rem max(1rem, calc((100vw - 1180px) / 2)); border-bottom: 1px solid var(--border); background: rgba(2, 6, 23, .9); backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: white; font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand); font-size: .75rem; }
.back-link { color: #cbd5e1; font-size: .9rem; text-decoration: none; }

main { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 3rem 0 5rem; }
.hero { max-width: 850px; }
.eyebrow { margin: 0 0 .35rem; color: var(--brand-light); font-size: .76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2.25rem, 6vw, 4.5rem); letter-spacing: -.045em; }
.hero-copy { max-width: 760px; color: #cbd5e1; font-size: 1.08rem; line-height: 1.7; }
.notice { margin-top: 1.5rem; padding: 1rem 1.1rem; border: 1px solid rgba(251, 146, 60, .4); border-radius: 14px; background: rgba(234, 88, 12, .09); color: #fed7aa; line-height: 1.55; }

.toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(170px, .3fr) auto; align-items: end; gap: 1rem; margin: 2rem 0 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.toolbar label:not(.checkbox-field) { display: grid; gap: .45rem; color: #cbd5e1; font-size: .78rem; font-weight: 700; }
input[type="search"], select { width: 100%; min-height: 42px; padding: .65rem .75rem; border: 1px solid var(--border-strong); border-radius: 9px; outline: none; background: #0f172a; color: var(--text); }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand-light); outline-offset: 2px; }
.checkbox-field { display: flex; align-items: center; gap: .55rem; min-height: 42px; color: #cbd5e1; font-size: .86rem; }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--brand); }

.catalog-summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 44px; color: #cbd5e1; }
.catalog-summary div { display: flex; flex-wrap: wrap; gap: .45rem 1rem; align-items: baseline; }
#snapshot-info { color: var(--muted); font-size: .78rem; }
.status-message { min-height: 1.5rem; margin: .5rem 0; color: var(--muted); }
.status-message.error, .dialog-status.error { color: var(--danger); }
.status-message.success, .dialog-status.success { color: var(--success); }
.hidden { display: none !important; }

.network-list { display: grid; gap: 1rem; }
.network-card { overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 14px 35px rgba(0, 0, 0, .18); }
.network-card[open] { border-color: var(--border-strong); }
.network-card summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 1rem 1.1rem; cursor: pointer; list-style: none; }
.network-card summary::-webkit-details-marker { display: none; }
.network-card summary:hover { background: rgba(30, 41, 59, .45); }
.network-title-row { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.network-title { margin: 0; color: white; font-size: 1.05rem; }
.network-subtitle { margin: .35rem 0 0; color: var(--muted); font-size: .78rem; }
.badge { display: inline-flex; align-items: center; padding: .2rem .5rem; border: 1px solid var(--border-strong); border-radius: 999px; color: #cbd5e1; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.badge.active { border-color: rgba(74, 222, 128, .35); color: var(--success); }
.badge.deprecated, .badge.danger { border-color: rgba(248, 113, 113, .4); color: var(--danger); }
.badge.token { border-color: rgba(251, 146, 60, .4); color: var(--brand-light); }
.expand-label { color: var(--brand-light); font-size: .78rem; font-weight: 700; }
.network-content { display: grid; gap: 1rem; padding: 0 1.1rem 1.15rem; border-top: 1px solid var(--border); }
.data-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; padding-top: 1rem; }
.data-item { min-width: 0; padding: .7rem; border: 1px solid var(--border); border-radius: 10px; background: rgba(2, 6, 23, .42); }
.data-item span { display: block; margin-bottom: .28rem; color: var(--muted); font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.data-item code, .url-row code, .token-address { overflow-wrap: anywhere; color: #fed7aa; font-size: .77rem; }
.section-title { margin: .3rem 0 .5rem; font-size: .9rem; }
.url-list { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.url-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: 9px; background: rgba(2, 6, 23, .35); }
.url-row a { overflow-wrap: anywhere; font-size: .78rem; }
.small-button { flex: 0 0 auto; padding: .35rem .55rem; border: 1px solid var(--border-strong); border-radius: 7px; background: #1e293b; color: #e2e8f0; font-size: .7rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; padding: .6rem .85rem; border-radius: 9px; font-weight: 750; }
.button.primary { border: 1px solid var(--brand); background: var(--brand); color: white; }
.button.primary:hover { background: #f97316; }
.button.secondary { border: 1px solid var(--border-strong); background: #1e293b; color: var(--text); }
.button.secondary:hover { background: #334155; }
.warning-list { margin: 0; padding: .75rem 1rem .75rem 2rem; border: 1px solid rgba(248, 113, 113, .35); border-radius: 10px; color: #fecaca; background: rgba(127, 29, 29, .13); font-size: .8rem; }
.token-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .65rem; }
.token-button { display: grid; gap: .3rem; width: 100%; padding: .75rem; text-align: left; border: 1px solid rgba(251, 146, 60, .32); border-radius: 10px; background: rgba(234, 88, 12, .07); color: var(--text); }
.token-button:hover { background: rgba(234, 88, 12, .14); }
.token-name { font-weight: 800; }
.token-source { color: var(--muted); font-size: .7rem; }
.empty-tokens { margin: 0; color: var(--muted); font-size: .8rem; }
.empty-state { padding: 3rem 1rem; text-align: center; border: 1px dashed var(--border-strong); border-radius: 16px; color: var(--muted); }

#token-dialog { width: min(520px, calc(100% - 2rem)); padding: 0; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface-solid); color: var(--text); box-shadow: 0 30px 90px rgba(0, 0, 0, .65); }
#token-dialog::backdrop { background: rgba(2, 6, 23, .78); backdrop-filter: blur(4px); }
.dialog-card { padding: 1.25rem; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.dialog-heading h2 { margin: 0; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; background: #1e293b; color: white; font-size: 1.25rem; }
#dialog-description { color: #cbd5e1; line-height: 1.55; }
#dialog-address { display: block; padding: .75rem; border: 1px solid var(--border); border-radius: 9px; overflow-wrap: anywhere; color: #fed7aa; background: #020617; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.dialog-status { min-height: 1.25rem; margin: .85rem 0 0; font-size: .8rem; }
footer { padding: 2rem 1rem; border-top: 1px solid var(--border); color: var(--muted); text-align: center; font-size: .78rem; }

@media (max-width: 820px) {
  .toolbar { grid-template-columns: 1fr 1fr; }
  .checkbox-field { grid-column: 1 / -1; }
  .data-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  main { width: min(100% - 1rem, 1180px); padding-top: 2rem; }
  .toolbar { grid-template-columns: 1fr; }
  .checkbox-field { grid-column: auto; }
  .data-grid { grid-template-columns: 1fr; }
  .network-card summary { grid-template-columns: 1fr; }
  .expand-label { display: none; }
  .url-row { align-items: flex-start; }
  .dialog-actions { grid-template-columns: 1fr; }
}
