:root {
      --background: rgb(255 255 255);
      --foreground: rgb(15 23 42);
      --card: rgb(255 255 255);
      --card-foreground: rgb(15 23 42);
      --primary: rgb(108 92 231);
      --primary-foreground: rgb(250 250 250);
      --secondary: rgb(244 244 245);
      --secondary-foreground: rgb(108 92 231);
      --muted: rgb(244 244 245);
      --muted-foreground: rgb(113 113 122);
      --faint: rgb(250 250 250);
      --faint-foreground: rgb(161 161 170);
      --accent: rgb(237 233 254);
      --accent-foreground: rgb(108 92 231);
      --danger: rgb(220 53 69);
      --danger-foreground: rgb(250 250 250);
      --success: rgb(34 153 84);
      --success-foreground: rgb(250 250 250);
      --warning: rgb(255 140 0);
      --warning-foreground: rgb(15 23 42);
      --border: rgb(228 228 231);
      --input: rgb(228 228 231);
      --ring: rgb(108 92 231);
    }

    * { box-sizing: border-box; }
    body { margin: 0; display: flex; flex-direction: column; min-height: 100vh; }

    /* ---------- Top nav ---------- */
    [data-topnav] {
      background: #fff;
      border-bottom: 1px solid var(--border);
      padding: 0.75rem 1rem;
      display: flex;
      align-items: center;
      gap: 1rem;
      position: sticky;
      top: 0;
      z-index: 100;
    }
    [data-topnav] .logo {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-weight: 700;
      font-size: 1.125rem;
      color: var(--foreground);
      text-decoration: none;
      flex-shrink: 0;
    }
    [data-topnav] .logo img { height: 28px; }
    .search-container {
      flex: 1;
      max-width: 400px;
      position: relative;
    }
    .search-container input {
      width: 100%;
      padding: 0.5rem 1rem 0.5rem 2.5rem;
      border: 1px solid var(--border);
      border-radius: 0.5rem;
      font-size: 0.875rem;
      background: var(--background-alt);
    }
    .search-container input:focus {
      outline: none;
      border-color: var(--primary);
      background: #fff;
    }
    .search-container::before {
      content: "🔍";
      position: absolute;
      left: 0.75rem;
      top: 50%;
      transform: translateY(-50%);
      font-size: 0.875rem;
    }
    .nav-links {
      display: flex;
      gap: 1rem;
      margin-left: auto;
    }
    .nav-links a {
      color: var(--foreground-light);
      font-size: 0.875rem;
      text-decoration: none;
      white-space: nowrap;
    }
    .nav-links a:hover { color: var(--foreground); }
    .nav-links a.active { color: var(--foreground); font-weight: 500; }
    .mobile-menu-btn {
      display: none;
      background: none;
      border: none;
      font-size: 1.5rem;
      cursor: pointer;
      padding: 0.25rem;
      color: var(--foreground);
    }
    .search-toggle-btn {
      display: none;
      background: none;
      border: none;
      font-size: 1rem;
      cursor: pointer;
      padding: 0.25rem;
    }
    .account-menu { position: relative; }
    .account-btn {
      background: none;
      border: none;
      cursor: pointer;
      padding: 0;
      border-radius: 50%;
    }
    .account-avatar { width: 32px; height: 32px; border-radius: 50%; display: block; }
    .account-dropdown {
      display: none;
      position: absolute;
      top: 100%;
      right: 0;
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 0.5rem;
      padding: 0.5rem;
      min-width: 180px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.1);
      z-index: 102;
    }
    .account-dropdown a {
      display: block;
      padding: 0.5rem 0.75rem;
      color: var(--foreground);
      text-decoration: none;
      font-size: 0.875rem;
      border-radius: 0.25rem;
    }
    .account-dropdown a:hover { background: var(--border); }
    .account-menu.open .account-dropdown { display: block; }

    /* ---------- Main content area (no sidebar) ---------- */
    .content-wrapper {
      flex: 1;
      max-width: 900px;
      width: 100%;
      margin: 0 auto;
      padding: 2rem;
    }

    /* ---------- Explorer-specific styles ---------- */
    .stats-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 1.5rem;
      padding: 1.25rem 1.5rem;
      background: var(--accent);
      border: 1px solid var(--border);
      border-radius: 10px;
      margin-bottom: 2rem;
    }
    .stats-bar div { display: flex; flex-direction: column; min-width: 110px; }
    .stats-bar span.label { font-size: 0.78rem; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.03em; }
    .stats-bar span.value { font-size: 1.2rem; font-weight: 700; color: var(--primary); }
    section { margin-bottom: 2.5rem; }
    #search-form, #tx-search-form, #address-search-form, #contract-search-form { display: flex; gap: 0.6rem; }
    #search-form input, #tx-search-form input, #address-search-form input, #contract-search-form input { flex: 1; }
    #search-result pre, #tx-search-result pre { max-height: 400px; overflow: auto; }
    table a { text-decoration: none; color: var(--primary); }
    table a:hover { text-decoration: underline; }
    .hash-cell { font-family: monospace; }

    /* ---------- Overview dashboard (Blockscout-style) ---------- */
    .ov-banner {
      background: linear-gradient(135deg, #5fcf9a, #4cb589);
      border-radius: 12px;
      padding: 1.75rem 2rem;
      margin-bottom: 1.5rem;
      color: #fff;
    }
    .ov-banner h1 { margin: 0 0 1rem; font-size: 1.6rem; }
    .ov-banner #search-form { max-width: 700px; }
    .ov-banner #search-form input {
      border: none;
      border-radius: 8px;
      padding: 0.7rem 1rem;
      font-size: 0.9rem;
    }
    .ov-banner #search-form button {
      border-radius: 8px;
      background: #fff;
      color: var(--foreground);
      border: none;
      padding: 0.7rem 1.2rem;
      font-weight: 600;
      cursor: pointer;
    }
    .ov-stats-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0.85rem;
      margin-bottom: 1.5rem;
    }
    .ov-stat-card {
      display: flex;
      align-items: center;
      gap: 0.7rem;
      background: var(--faint);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 0.9rem 1rem;
    }
    .ov-stat-icon {
      flex-shrink: 0;
      width: 34px;
      height: 34px;
      border-radius: 8px;
      background: var(--accent);
      color: var(--accent-foreground);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1rem;
    }
    .ov-stat-label { font-size: 0.75rem; color: var(--muted-foreground); }
    .ov-stat-value { font-size: 1rem; font-weight: 700; color: var(--foreground); }
    .ov-chart-card {
      background: var(--faint);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 1rem 1.25rem;
      margin-bottom: 1.5rem;
    }
    .ov-chart-card h3 { margin: 0 0 0.75rem; font-size: 0.9rem; color: var(--muted-foreground); font-weight: 600; }
    .ov-chart-note { font-size: 0.72rem; color: var(--faint-foreground); margin-top: 0.4rem; }
    .ov-spark-meta {
      display: flex;
      gap: 1.25rem;
      font-size: 0.78rem;
      color: var(--muted-foreground);
      margin-bottom: 0.5rem;
    }
    .ov-spark-meta b { color: var(--foreground); font-weight: 600; }
    .ov-spark-dot { transition: r 0.1s ease; }
    .ov-spark-hit:hover { cursor: pointer; }
    .ov-spark-hit:hover + .ov-spark-dot { r: 4.5; }
    .ov-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
    .ov-col h2 { font-size: 1rem; margin: 0 0 0.85rem; }
    .ov-block-util-line { font-size: 0.8rem; color: var(--muted-foreground); margin: -0.5rem 0 0.85rem; }
    .ov-block-util-line b { color: var(--success); }
    .ov-block-card {
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 0.85rem 1rem;
      margin-bottom: 0.6rem;
    }
    .ov-block-top { display: flex; align-items: center; gap: 0.5rem; }
    .ov-block-icon {
      flex-shrink: 0;
      width: 26px;
      height: 26px;
      border-radius: 6px;
      background: var(--accent);
      color: var(--accent-foreground);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.85rem;
    }
    .ov-block-num { font-weight: 700; color: var(--primary); text-decoration: none; }
    .ov-block-age { margin-left: auto; font-size: 0.75rem; color: var(--muted-foreground); white-space: nowrap; }
    .ov-block-rows { margin-top: 0.55rem; display: flex; flex-direction: column; gap: 0.3rem; }
    .ov-block-row { display: flex; gap: 0.5rem; font-size: 0.82rem; }
    .ov-block-row-label { width: 60px; flex-shrink: 0; color: var(--muted-foreground); }
    .ov-block-row-value { color: var(--foreground); display: inline-flex; align-items: center; gap: 0.3rem; }
    .ov-block-row-value.mono { font-family: monospace; }
    .ov-block-row-value a { color: var(--primary); text-decoration: none; }
    .blocks-table-num { color: var(--primary); text-decoration: none; font-weight: 600; }
    .blocks-table-num:hover { text-decoration: underline; }

    .ov-tx-banner {
      background: #fef9e7;
      border: 1px solid #f5e6b3;
      color: #8a6d1f;
      border-radius: 8px;
      padding: 0.55rem 0.9rem;
      font-size: 0.8rem;
      margin-bottom: 0.4rem;
    }
    .ov-tx-table { display: flex; flex-direction: column; }
    .ov-tx-row {
      display: grid;
      grid-template-columns: 24px minmax(0, 1.5fr) minmax(0, 1.7fr) auto;
      align-items: center;
      gap: 0.85rem;
      padding: 0.7rem 0;
      border-bottom: 1px solid var(--border);
    }
    .ov-tx-row:last-child { border-bottom: none; }
    .ov-tx-status-icon {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      border: 1px solid var(--border);
      color: var(--muted-foreground);
      font-size: 0.65rem;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .ov-tx-type-col { min-width: 0; }
    .ov-tx-type {
      display: inline-block;
      font-size: 0.73rem;
      font-weight: 700;
      padding: 1px 9px;
      border-radius: 20px;
      margin-bottom: 0.3rem;
    }
    .ov-tx-type.tx-plain      { background: #ede9fe; color: #6d28d9; }
    .ov-tx-type.tx-contract   { background: #dbeafe; color: #1d4ed8; }
    .ov-tx-type.tx-coin       { background: #ffedd5; color: #c2410c; }
    .ov-tx-hash-row { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
    .ov-tx-hash { font-family: monospace; font-size: 0.82rem; color: var(--primary); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ov-tx-age { font-size: 0.73rem; color: var(--muted-foreground); white-space: nowrap; margin-left: 0.3rem; }
    .ov-tx-addr-col { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
    .ov-tx-addr-line { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
    .ov-tx-dir-icon { flex-shrink: 0; font-size: 0.75rem; color: var(--muted-foreground); width: 14px; text-align: center; }
    .ov-addr-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
    .ov-tx-addr { font-family: monospace; font-size: 0.8rem; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ov-tx-amounts { text-align: right; white-space: nowrap; font-size: 0.8rem; }
    .ov-tx-amounts .ov-amt-label { color: var(--muted-foreground); margin-right: 0.3rem; }
    .ov-tx-amounts div { margin-bottom: 0.25rem; }
    .ov-tx-amounts div:last-child { margin-bottom: 0; }
    @media (max-width: 640px) {
      .ov-tx-row { grid-template-columns: 18px 1fr; }
      .ov-tx-addr-col, .ov-tx-amounts { grid-column: 2; }
    }
    @media (max-width: 860px) {
      .ov-stats-grid { grid-template-columns: 1fr 1fr; }
      .ov-columns { grid-template-columns: 1fr; }
    }

    /* ---------- Address detail card (Blockscout-style) ---------- */
    .addr-card { margin-top: 1.25rem; }
    .addr-page-title {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      margin: 0 0 1rem;
      font-size: 1.4rem;
      font-weight: 700;
    }
    .addr-type-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 0.72rem;
      font-weight: 700;
      padding: 2px 9px;
      border-radius: 20px;
      letter-spacing: 0.02em;
    }
    .addr-type-badge.eoa      { background: #f0fdf4; color: #166534; }
    .addr-type-badge.contract { background: #fef9c3; color: #854d0e; }
    .addr-id-row {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      min-width: 0;
      padding-bottom: 1.1rem;
      border-bottom: 1px solid var(--border);
      margin-bottom: 0.25rem;
    }
    .addr-icon {
      flex-shrink: 0;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: var(--accent);
      color: var(--accent-foreground);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.85rem;
    }
    .addr-hash {
      font-weight: 600;
      font-size: 0.95rem;
      overflow-wrap: anywhere;
      flex: 1;
      min-width: 0;
    }
    /* Generic copy-to-clipboard button, used next to any hash/address value */
    .copy-btn {
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: none;
      border: none;
      border-radius: 5px;
      width: 20px;
      height: 20px;
      padding: 0;
      cursor: pointer;
      color: var(--muted-foreground);
      vertical-align: middle;
    }
    .copy-btn svg { width: 13px; height: 13px; display: block; }
    .copy-btn:hover { color: var(--primary); background: var(--accent); }
    .copy-btn.copied { color: var(--success); }
    /* Larger variant used next to the main address heading */
    .copy-btn.addr-copy-btn { width: 26px; height: 26px; border-radius: 6px; }
    .copy-btn.addr-copy-btn svg { width: 15px; height: 15px; }

    .hash-with-copy {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      min-width: 0;
    }
    .result-value.hash-with-copy { width: 100%; }
    .hash-with-copy > .hash-text { overflow-wrap: anywhere; min-width: 0; }
    td .hash-with-copy .hash-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .addr-detail-list { padding-top: 0.15rem; }
    .addr-detail-row {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      padding: 0.7rem 0;
      border-bottom: 1px solid var(--border);
    }
    .addr-detail-row:last-child { border-bottom: none; }
    .addr-detail-loading { color: var(--muted-foreground); font-style: italic; }
    .addr-block-link { color: var(--primary); text-decoration: none; }
    .addr-block-link:hover { text-decoration: underline; }
    .addr-token-section { margin-top: 1.5rem; }
    .addr-token-list { margin-top: 0.5rem; }
    .addr-token-row {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.55rem 0;
      border-bottom: 1px solid var(--border);
      font-size: 0.85rem;
    }
    .addr-token-row:last-child { border-bottom: none; }
    .addr-token-symbol { font-weight: 600; width: 80px; flex-shrink: 0; }
    .addr-token-balance { flex: 1; }
    .addr-token-contract { color: var(--muted-foreground); font-size: 0.78rem; }
    .addr-tabs {
      display: flex;
      gap: 0.25rem;
      border-bottom: 1px solid var(--border);
      margin: 1.1rem 0 1.1rem;
      overflow-x: auto;
    }
    .addr-tab {
      background: none;
      border: none;
      border-bottom: 2px solid transparent;
      padding: 0.6rem 0.9rem;
      font-size: 0.85rem;
      color: var(--muted-foreground);
      cursor: pointer;
      white-space: nowrap;
    }
    .addr-tab:hover { color: var(--foreground); }
    .addr-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
    .addr-tab-count { color: var(--faint-foreground); font-size: 0.78rem; }
    .addr-tab-panel { min-height: 60px; }
    .addr-scan-note { margin-top: 0.75rem; font-size: 0.75rem; color: var(--muted-foreground); }
    .addr-transfer-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
    .addr-transfer-table th {
      text-align: left;
      padding: 0.5rem 0.6rem;
      color: var(--muted-foreground);
      font-weight: 500;
      border-bottom: 1px solid var(--border);
    }
    .addr-transfer-table td {
      padding: 0.5rem 0.6rem;
      border-bottom: 1px solid var(--border);
    }
    .addr-transfer-dir {
      font-size: 0.7rem;
      font-weight: 700;
      padding: 1px 7px;
      border-radius: 4px;
    }
    .addr-transfer-dir.in  { background: #f0fdf4; color: #166534; }
    .addr-transfer-dir.out { background: #fef2f2; color: #991b1b; }
    .addr-detail-label-wrap {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      width: 170px;
      flex-shrink: 0;
      font-size: 0.85rem;
      color: var(--muted-foreground);
    }
    .addr-info-icon {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      border: 1px solid var(--faint-foreground);
      color: var(--faint-foreground);
      font-size: 9px;
      font-style: normal;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .addr-detail-value {
      font-size: 0.92rem;
      font-weight: 600;
      color: var(--foreground);
      overflow-wrap: anywhere;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }
    .addr-detail-value .addr-coin-icon { color: var(--success); }
    @media (max-width: 600px) {
      .addr-detail-row { flex-wrap: wrap; }
      .addr-detail-label-wrap { width: 100%; }
    }

    /* ---------- Pagination (Blocks view) ---------- */
    .pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
    .pagination button {
      padding: 0.4rem 0.9rem;
      border: 1px solid var(--border);
      background: #fff;
      border-radius: 0.4rem;
      cursor: pointer;
      font-size: 0.85rem;
    }
    .pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
    .pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
    .pagination span { font-size: 0.85rem; color: var(--muted-foreground); }

    /* ---------- Bar charts (Analytics / Gas Tracker views) ---------- */
    .chart-block { margin-bottom: 2rem; }
    .chart-block h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }
    .bar-chart { display: flex; flex-direction: column; gap: 0.4rem; }
    .bar-row { display: flex; align-items: center; gap: 0.75rem; }
    .bar-label { width: 70px; font-size: 0.75rem; color: var(--muted-foreground); font-family: monospace; flex-shrink: 0; }
    .bar-track { flex: 1; background: var(--muted); border-radius: 4px; height: 14px; overflow: hidden; }
    .bar-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; }
    .bar-value { width: 100px; text-align: right; font-size: 0.75rem; color: var(--foreground); flex-shrink: 0; }

    /* ---------- API docs view ---------- */
    #api-docs table { width: 100%; border-collapse: collapse; }
    #api-docs th, #api-docs td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; vertical-align: top; }
    #api-docs code, #search-result code { background: var(--muted); padding: 0.1rem 0.4rem; border-radius: 0.25rem; font-size: 0.85em; }

    /* ---------- Search result cards ---------- */
    .result-card {
      margin-top: 1.25rem;
      border: 1px solid var(--border);
      border-radius: 10px;
      overflow: hidden;
      background: var(--card);
    }
    .result-card-header {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      padding: 0.85rem 1.25rem;
      background: var(--faint);
      border-bottom: 1px solid var(--border);
    }
    .result-card-title {
      font-weight: 700;
      font-size: 1.05rem;
      color: var(--foreground);
      margin-left: 0.25rem;
    }
    .result-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 0.73rem;
      font-weight: 600;
      padding: 3px 9px;
      border-radius: 20px;
      letter-spacing: 0.02em;
    }
    .result-badge-block    { background: var(--accent); color: var(--accent-foreground); }
    .result-badge-tx       { background: #e0f2fe; color: #0369a1; }
    .result-badge-addr     { background: #f0fdf4; color: #166534; }
    .result-badge-contract { background: #fef9c3; color: #854d0e; }
    .result-badge-wallet   { background: #f0fdf4; color: #166534; }
    .result-badge-success  { background: #dcfce7; color: #15803d; }
    .result-badge-error    { background: #fee2e2; color: #dc2626; }
    .result-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0;
      padding: 0;
    }
    .result-item {
      padding: 0.7rem 1.25rem;
      border-bottom: 1px solid var(--border);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      gap: 3px;
      min-width: 0;
    }
    .result-item:nth-child(even) { border-right: none; }
    .result-item-full {
      grid-column: 1 / -1;
      border-right: none;
    }
    .result-label {
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--muted-foreground);
      font-weight: 600;
    }
    .result-value {
      font-size: 0.875rem;
      color: var(--foreground);
      word-break: break-all;
    }
    .result-value.mono { font-family: monospace; font-size: 0.82rem; }
    .result-truncate {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .result-section {
      padding: 1rem 1.25rem;
      border-top: 1px solid var(--border);
    }
    .result-section-title {
      font-size: 0.8rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--muted-foreground);
      margin: 0 0 0.75rem;
    }
    .result-table-wrap { overflow-x: auto; }
    .result-section table { width: 100%; font-size: 0.82rem; }
    .result-section th { color: var(--muted-foreground); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; }
    .result-empty-note {
      padding: 0.75rem 1.25rem;
      font-size: 0.85rem;
      color: var(--muted-foreground);
      border-top: 1px solid var(--border);
      margin: 0;
    }
    .result-input-data {
      font-size: 0.75rem;
      font-family: monospace;
      background: var(--muted);
      padding: 0.75rem;
      border-radius: 6px;
      overflow-x: auto;
      word-break: break-all;
      white-space: pre-wrap;
      max-height: 160px;
      margin: 0;
    }
    @media (max-width: 600px) {
      .result-grid { grid-template-columns: 1fr; }
      .result-item { border-right: none; }
      .result-item-full { grid-column: 1; }
    }

    /* ---------- Footer ---------- */
    footer {
      background: #1a1a2e;
      color: #fff;
      padding: 2rem 1rem;
      margin-top: auto;
      width: 100%;
    }
    footer .footer-content {
      display: flex;
      justify-content: space-between;
      max-width: 1200px;
      margin: 0 auto;
      gap: 2rem;
      flex-wrap: wrap;
    }
    footer .footer-brand { max-width: 280px; }
    footer .footer-brand p {
      color: rgba(255,255,255,0.6);
      font-size: 0.875rem;
      margin-top: 0.75rem;
    }
    footer .footer-links { display: flex; gap: 2rem; flex-wrap: wrap; }
    footer .footer-links > div { min-width: 120px; }
    footer .footer-links h5 {
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: rgba(255,255,255,0.4);
      margin-bottom: 1rem;
    }
    footer .footer-links ul { list-style: none; padding: 0; margin: 0; }
    footer .footer-links li { margin: 0.5rem 0; }
    footer .footer-links a { color: rgba(255,255,255,0.8); font-size: 0.875rem; }
    footer .footer-links a:hover { color: #fff; }
    footer .footer-bottom {
      max-width: 1200px;
      margin: 1.5rem auto 0;
      padding-top: 1.5rem;
      border-top: 1px solid rgba(255,255,255,0.1);
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 1rem;
      font-size: 0.8125rem;
      color: rgba(255,255,255,0.5);
    }
    footer .footer-bottom a { color: rgba(255,255,255,0.6); }
    footer .logo {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-weight: 700;
      font-size: 1.125rem;
      color: #fff;
      text-decoration: none;
    }
    footer .logo img { height: 24px; filter: brightness(0) invert(1); }

    /* ---------- Chain switcher badge (sub navbar dropdown) ---------- */
    .chain-subnav-switcher {
      position: sticky;
      right: 0;
      margin-left: auto;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      background: var(--faint);
      padding-left: 0.75rem;
    }
    .chain-switch-badge {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      padding: 0.35rem 0.7rem;
      border: 1px solid var(--border);
      border-radius: 999px;
      background: #fff;
      color: var(--foreground);
      text-decoration: none;
      font-size: 0.8125rem;
      font-weight: 500;
      white-space: nowrap;
      flex-shrink: 0;
      cursor: pointer;
    }
    .chain-switch-badge:hover { background: var(--muted); }
    .chain-switch-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--chain-color, var(--primary));
      flex-shrink: 0;
    }
    .chain-switch-icon { font-size: 0.9rem; line-height: 1; width: 16px; height: 16px; object-fit: contain; flex-shrink: 0; }
    .chain-switch-caret { font-size: 0.65rem; color: var(--muted-foreground); }
    .chain-switch-panel {
      display: none;
      position: fixed; /* escapes .crypto-subnav's overflow-x:auto clipping */
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 8px 24px rgba(0,0,0,0.12);
      min-width: 220px;
      padding: 6px;
      z-index: 1000;
    }
    .chain-switch-panel.open { display: block; }
    .chain-switch-option {
      display: flex;
      align-items: center;
      gap: 8px;
      width: 100%;
      padding: 8px 10px;
      border: none;
      background: none;
      border-radius: 8px;
      font-size: 0.85rem;
      color: var(--foreground);
      cursor: pointer;
      text-align: left;
    }
    .chain-switch-option:hover:not(:disabled) { background: var(--muted); }
    .chain-switch-option:disabled { cursor: default; opacity: 0.6; }
    .chain-switch-option-active { font-weight: 600; }
    .chain-switch-check { margin-left: auto; color: var(--success); font-size: 0.8rem; }
    .chain-switch-viewmore {
      display: block;
      margin-top: 4px;
      padding: 8px 10px;
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--primary);
      text-decoration: none;
      border-top: 1px solid var(--border);
    }
    .chain-switch-viewmore:hover { background: var(--muted); border-radius: 8px; }
    @media (max-width: 768px) {
      .chain-switch-name { display: none; }
      .chain-switch-badge { padding: 0.35rem 0.5rem; }
    }

    /* ---------- Networks screen ---------- */
    .networks-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 1rem;
    }
    .network-card {
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 1.1rem 1.15rem;
      display: flex;
      flex-direction: column;
      gap: 0.85rem;
      background: var(--faint);
    }
    .network-card-active {
      border-color: var(--chain-color, var(--primary));
      box-shadow: 0 0 0 1px var(--chain-color, var(--primary));
    }
    .network-card-top { display: flex; align-items: flex-start; gap: 0.65rem; }
    .network-card-icon {
      flex-shrink: 0;
      width: 34px;
      height: 34px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.1rem;
      padding: 6px;
      object-fit: contain;
      background: color-mix(in srgb, var(--chain-color, var(--primary)) 16%, transparent);
      color: var(--chain-color, var(--primary));
    }
    .network-card-name { font-weight: 700; font-size: 0.95rem; }
    .network-card-meta { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 2px; }
    .network-card-active-pill {
      margin-left: auto;
      font-size: 0.68rem;
      font-weight: 600;
      color: var(--success-foreground);
      background: var(--success);
      padding: 2px 8px;
      border-radius: 999px;
      white-space: nowrap;
    }
    .network-card-rpc {
      font-size: 0.72rem;
      color: var(--muted-foreground);
      background: var(--muted);
      padding: 0.45rem 0.6rem;
      border-radius: 6px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .network-card-btn {
      border: 1px solid var(--chain-color, var(--primary));
      color: var(--chain-color, var(--primary));
      background: transparent;
      border-radius: 8px;
      padding: 0.5rem 0.75rem;
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
    }
    .network-card-btn:hover:not(:disabled) {
      background: var(--chain-color, var(--primary));
      color: #fff;
    }
    .network-card-btn:disabled {
      cursor: default;
      opacity: 0.55;
      border-style: dashed;
    }

    /* ---------- Sidebar overlay (mobile) ---------- */
    .sidebar-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.3);
      z-index: 99;
    }
    .sidebar-overlay.active { display: block; }

    /* ---------- Crypto sub-nav ---------- */
.crypto-subnav {
  background: var(--faint);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 53px; /* height of the topnav */
  z-index: 99;
}
.crypto-subnav::-webkit-scrollbar { display: none; }

.crypto-subnav a {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0.55rem 0.875rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.crypto-subnav a:hover { color: var(--foreground); }
.crypto-subnav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

.subnav-icon { font-size: 0.875rem; opacity: 0.7; }

.subnav-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 0.25rem;
  flex-shrink: 0;
}

.subnav-live-badge {
  font-size: 10px;
  background: var(--success);
  color: var(--success-foreground);
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 600;
  line-height: 1.6;
  margin-left: 2px;
}

@media (max-width: 768px) {
  .crypto-subnav { top: 45px; padding: 0 0.75rem; }
  .crypto-subnav a { padding: 0.5rem 0.625rem; font-size: 0.75rem; }
}

    /* ---------- Responsive ---------- */
    @media (max-width: 768px) {
      [data-topnav] {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
      }
      .search-toggle-btn { display: block; }
      .search-container {
        display: none;
        order: 5;
        max-width: 100%;
        width: 100%;
        flex-basis: 100%;
      }
      .search-container.search-open { display: block; }
      .search-container input { width: 100%; }
      .right-menu-btn { margin-left: auto; }
      .account-menu { margin-left: 0.5rem; }
      .nav-links { display: none; }
      .mobile-menu-btn { display: block; }
      .nav-links.mobile-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        padding: 1rem;
        border-bottom: 1px solid var(--border);
        gap: 0.75rem;
        z-index: 101;
      }
      .content-wrapper { padding: 1.5rem 1rem; }
      footer .footer-content { flex-direction: column; gap: 1.5rem; }
      footer .footer-brand { max-width: 100%; }
      footer .footer-links { flex-direction: column; gap: 1.25rem; }
      footer .footer-bottom { flex-direction: column; text-align: center; }
    }