:root {
    --bg: #0b0d12;
    --panel: #11141b;
    --border: #1b2130;
    --text: #e6e9ef;
    --muted: #a5adbb;
    --brand: #3b82f6;
    --accent: #22d3ee;
    --ok: #10b981;
    --warn: #f59e0b;
    --bad: #ef4444;
}
html, body { background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 32px; }

/* Header */
.header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0 24px; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.brand .title { font-weight: 700; letter-spacing: 0.2px; }
.nav { display: flex; gap: 18px; font-size: 14px; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 28px; padding: 28px 0; }
.card {
    background: linear-gradient(180deg, rgba(27,33,48,.7), rgba(17,20,27,.6));
    border: 1px solid var(--border);
    border-radius: 14px; padding: 24px;
    box-shadow: 0 12px 30px rgba(0,0,0,.25);
}
h1 { margin: 0 0 12px; font-size: 28px; }
.subtitle { color: var(--muted); font-size: 15px; line-height: 1.6; }
.cta { margin-top: 18px; display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.btn.primary { background: var(--brand); border-color: #2b5fcc; }
.btn:hover { filter: brightness(1.08); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 18px; margin-top: 4px; font-weight: 700; letter-spacing: 0.2px; }

/* Sections */
.section { margin-top: 28px; }
/* grid: make left and right columns slightly asymmetric so Metrics is wider */
.grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
    margin-top: 8px;
}

/* ensure cards fill their grid cell consistently */
.grid > .card {
    width: 100%;
    box-sizing: border-box;
}

.card h3 { margin: 0 0 10px; font-size: 18px; }
.list { display: grid; gap: 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #0e1118; }
.pill { font-size: 12px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); min-width: 48px; text-align: center; }

/* Status */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }

/* Footer */
.footer { margin: 36px 0 8px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; display:inline-block; max-width:420px; overflow:hidden; text-overflow:ellipsis; vertical-align:middle; }
.hint { color: var(--muted); font-size: 12px; }

/* Metrics */
.metrics-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.metrics-kpi { background: transparent; border: 1px solid var(--border); padding: 10px; border-radius: 8px; }
.metrics-kpi .label { color: var(--muted); font-size: 12px; }
.metrics-kpi .value { font-weight: 700; margin-top:6px; }
.networks-table { margin-top: 10px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.networks-table .row { display: grid; grid-template-columns: 1fr 160px 70px; gap: 8px; padding: 8px 10px; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.02); }
.networks-table .row.head { background: rgba(255,255,255,0.02); font-size: 13px; color: var(--muted); }
.health-pill { display:inline-block; padding:4px 8px; border-radius:999px; font-size:12px; color: #07121a; }
.health-good { background: var(--ok); }
.health-mid { background: var(--warn); }
.health-bad { background: var(--bad); color: #fff; }
.small-muted { font-size:12px; color:var(--muted); }
/* chainId placeholder / spinner */
.chainid-placeholder { display:inline-flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); margin-top:4px; }
.chainid-spinner { width:12px; height:12px; border:2px solid rgba(255,255,255,0.06); border-top-color:var(--accent); border-radius:50%; animation:spin 0.9s linear infinite; }
@keyframes spin { from { transform:rotate(0deg); } to { transform:rotate(360deg); } }
.chainid-value { color:var(--muted); font-size:12px; margin-top:4px; display:block; }


/* small success state when chainId resolved */
.chainid-value { color: var(--muted); font-size: 12px; margin-top:4px; }

.health-preferred { display:inline-block; padding:4px 8px; border-radius:999px; font-size:12px; color:#07121a; background: var(--brand); }

/* layout fixes to prevent badge overlap and ensure truncation */
/* scope column layout only to networks list and networks-table rows */
.networks-list .row > div,
.networks-table .row > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* keep general .row children layout unchanged for other cards (gas, metrics, etc.) */
.row > div { min-width: 0; }

/* hint and truncation rules (unchanged) */
.hint { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint .preferred-wrap { display: block; white-space: normal; }
.pill, .health-preferred { white-space: nowrap; }
.mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hint { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint .preferred-wrap { display: block; white-space: normal; }
.pill, .health-preferred { white-space: nowrap; }
.mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Ensure the live-gas card uses full content width (matches .card width in grid) */
.card.full-width {
    width: 100%;
    box-sizing: border-box;
}

/* Gas list layout: left-align tiers, allow truncation with ellipsis, preserve monospace for urls/numbers */
/* Gas list: allow wrapping and multi-line tier values */
#gas-list .row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

#gas-list .row > div:first-child {
    flex: 1 1 48%;
    min-width: 0;
}

#gas-list .row > .mono {
    flex: 0 1 48%;
    max-width: 48%;
    text-align: left;
    white-space: normal;     /* allow wrapping */
    overflow: visible;       /* don't clip */
}

/* each tier on its own line for clarity */
#gas-list .mono span {
    display: block;
    margin: 3px 0;
    line-height: 1.25;
}

/* small screens: stack left/right vertically */
@media (max-width: 640px) {
    #gas-list .row > .mono { max-width: 100%; flex-basis: 100%; }
    #gas-list .row > div:first-child { flex-basis: 100%; }
}

/* Responsive tweaks for networks list layout */
@media (max-width: 980px) {
    .hero { grid-template-columns: 1fr; }
    .grid { grid-template-columns: 1fr 1fr; }
    .networks-table .row { grid-template-columns: 1fr 140px 70px; }
}
@media (max-width: 640px) {
    .grid { grid-template-columns: 1fr; }
    .nav { display: none; }
    .networks-table .row { grid-template-columns: 1fr 110px 70px; }
    .mono { max-width: 220px; }
}
