:root {
    --bg: #0a0b0e;
    --panel: #12141a;
    --panel2: #181b23;
    --line: #232733;
    --fg: #e6e8ee;
    --muted: #7c8497;
    --accent: #7aa2ff;
    --prov: #ff8a5c;
    --peer: #7aa2ff;
    --cust: #6ee7b7;
    --warn: #ffd166;
    --bad: #ff6b6b;
}

* {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    padding: 0;
}
body {
    font:
        14px/1.5 ui-sans-serif,
        system-ui,
        -apple-system,
        Segoe UI,
        Roboto,
        sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
}
a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

.muted {
    color: var(--muted);
}
.small {
    font-size: 12px;
    font-weight: 400;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: rgba(10, 11, 14, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10;
}
.brand {
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--fg);
}

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 22px 80px;
}

.hero {
    text-align: center;
    padding: 60px 0 20px;
}
.hero h1 {
    font-size: 38px;
    margin: 0 0 12px;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.hero p {
    margin: 0 0 28px;
}

#search {
    display: flex;
    gap: 8px;
    max-width: 640px;
    margin: 0 auto;
}
#q {
    flex: 1;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--fg);
    border-radius: 10px;
    padding: 14px 16px;
    font: inherit;
    outline: none;
}
#q:focus {
    border-color: var(--accent);
}
#search button {
    background: var(--accent);
    color: #0a0b0e;
    border: 0;
    border-radius: 10px;
    padding: 0 22px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
#search button:hover {
    filter: brightness(1.1);
}

.results {
    max-width: 640px;
    margin: 8px auto 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    text-align: left;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.results .r {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 12px;
    align-items: baseline;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--fg);
}
.results .r:last-child {
    border-bottom: 0;
}
.results .r:hover,
.results .r.sel {
    background: var(--panel2);
    text-decoration: none;
}
.results .rasn {
    color: var(--accent);
    font: 600 12px ui-monospace, monospace;
}
.results .rname {
    font-weight: 500;
}
.results .rorg {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.examples {
    margin-top: 22px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.examples a {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 14px;
    background: var(--panel);
}

.loader {
    margin-top: 26px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    min-height: 22px;
}

.info {
    display: grid;
    gap: 18px;
}
.head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 4px;
}
.asn-num {
    color: var(--muted);
    font:
        600 12px ui-monospace,
        monospace;
    letter-spacing: 0.1em;
}
.asn-name {
    font-size: 30px;
    margin: 2px 0 4px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.asn-sub {
    font-size: 14px;
}
.flag {
    font-size: 44px;
    line-height: 1;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.badge {
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 999px;
    padding: 4px 11px;
    font-size: 12px;
    color: var(--muted);
}
.badge strong {
    color: var(--fg);
    font-weight: 600;
}
.badge.hot {
    color: var(--warn);
    border-color: #4a3f1a;
}
.badge.tier1 {
    color: var(--prov);
    border-color: #4a2f1a;
}
.badge.good {
    color: var(--cust);
    border-color: #1a4a3a;
}

.grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    grid-template-areas:
        'stats class'
        'stats contact'
        'rpki rpki';
    gap: 14px;
}
.grid .card.stats {
    grid-area: stats;
}
.grid .card.class {
    grid-area: class;
}
.grid .card.contact {
    grid-area: contact;
}
.grid .card.rpki {
    grid-area: rpki;
}
.grid.two {
    grid-template-columns: repeat(2, 1fr);
    grid-template-areas: none;
}
.grid.two .card {
    display: flex;
    flex-direction: column;
    max-height: 540px;
}
.grid.two .card .list {
    flex: 1;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
}

@media (max-width: 860px) {
    .grid {
        grid-template-columns: 1fr;
        grid-template-areas: 'stats' 'class' 'contact' 'rpki';
    }
    .grid.two {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 18px;
}
.card h3 {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.kv {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 14px;
}
.kv dt {
    color: var(--muted);
    font-size: 12px;
    align-self: center;
}
.kv dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}

.bar {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    background: var(--panel2);
    margin-bottom: 14px;
}
.card.rpki .kv {
    grid-template-columns: repeat(4, max-content 1fr);
    gap: 8px 18px;
}
@media (max-width: 700px) {
    .card.rpki .kv {
        grid-template-columns: max-content 1fr;
    }
}
.bar .v {
    background: var(--cust);
}
.bar .i {
    background: var(--bad);
}
.bar .u {
    background: var(--muted);
}

.graph {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 50%, #1a2240 0%, #0a0b0e 65%),
        repeating-radial-gradient(
            circle at 50% 50%,
            transparent 0 60px,
            rgba(122, 162, 255, 0.04) 60px 61px
        );
}
.viz canvas {
    width: 100%;
    height: 520px;
    display: block;
    cursor: grab;
}
.tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(18, 20, 26, 0.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 10px;
    font:
        12px ui-monospace,
        monospace;
    white-space: nowrap;
    transform: translate(-50%, calc(-100% - 10px));
    z-index: 5;
}
.tooltip .rel {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
}
.legend {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
}
.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.dot.prov {
    background: var(--prov);
}
.dot.peer {
    background: var(--peer);
}
.dot.cust {
    background: var(--cust);
}

.list {
    max-height: 340px;
    overflow-y: auto;
    font:
        13px ui-monospace,
        monospace;
}
.list .row {
    display: flex;
    justify-content: space-between;
    padding: 6px 4px;
    border-bottom: 1px solid var(--line);
}
.list .row:last-child {
    border-bottom: 0;
}
.list .row .rel {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 4px;
}
.rel.provider {
    background: #3a2515;
    color: var(--prov);
}
.rel.peer {
    background: #1a2540;
    color: var(--peer);
}
.rel.customer {
    background: #14322a;
    color: var(--cust);
}
.list .row .rpki {
    font-size: 11px;
    color: var(--muted);
}
.rpki.valid {
    color: var(--cust);
}
.rpki.invalid {
    color: var(--bad);
}
.rpki.unknown {
    color: var(--muted);
}

.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.tabs button {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    padding: 4px 12px;
    border-radius: 6px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.tabs button.on {
    background: var(--panel2);
    color: var(--fg);
    border-color: var(--accent);
}

.empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--muted);
}

.ipctx h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.ipctx .ipmono {
    font:
        600 13px ui-monospace,
        monospace;
    color: var(--accent);
    text-transform: none;
    letter-spacing: 0;
}
.ipctx code {
    background: var(--panel2);
    border: 1px solid var(--line);
    padding: 1px 6px;
    border-radius: 4px;
    font:
        12px ui-monospace,
        monospace;
}
.chip {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--panel2);
}

.ruler {
    position: relative;
    margin: 8px 0 18px;
}
.ruler .track {
    height: 6px;
    background: var(--panel2);
    border-radius: 3px;
    overflow: hidden;
}
.ruler .marker {
    position: absolute;
    top: -3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.25);
    transform: translateX(-50%);
}
.ruler .ends {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font:
        11px ui-monospace,
        monospace;
    color: var(--muted);
}

.ipline {
    font:
        12px ui-monospace,
        monospace;
    margin: 8px 0 14px;
}

.adjacency {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin: 6px 0 14px;
}
.adj-cell,
.adj-self {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    background: var(--panel2);
    border-radius: 8px;
    font:
        12px ui-monospace,
        monospace;
}
.adj-self {
    background: rgba(122, 162, 255, 0.1);
    align-items: center;
}
.adj-self strong {
    color: var(--accent);
    font-weight: 600;
}
.adj-cell code {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--muted);
    font-size: 11px;
}
.adj-cell a code {
    color: var(--fg);
}

.tools {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
}
.tools a {
    font-size: 12px;
    padding: 4px 10px;
    background: var(--panel2);
    border: 1px solid var(--line);
    border-radius: 6px;
}
.tools a:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.rankbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
}
.rankbar-track {
    height: 4px;
    background: var(--panel2);
    border-radius: 2px;
    overflow: hidden;
}
.rankbar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cust), var(--accent));
}
.rankbar-lbl {
    font:
        11px ui-monospace,
        monospace;
    white-space: nowrap;
}

.relbar-wrap {
    margin-top: 14px;
}
.relbar {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    background: var(--panel2);
    margin-bottom: 6px;
}
.relbar .seg.prov {
    background: var(--prov);
}
.relbar .seg.peer {
    background: var(--peer);
}
.relbar .seg.cust {
    background: var(--cust);
}
.rel-lbls {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.rel-lbls .prov {
    color: var(--prov);
}
.rel-lbls .peer {
    color: var(--peer);
}
.rel-lbls .cust {
    color: var(--cust);
}

.footnote {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
}
.footnote strong {
    color: var(--fg);
}

.histwrap {
    margin-bottom: 14px;
}
.hist-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 60px;
    background: var(--panel2);
    border-radius: 6px;
    padding: 6px;
}
.hbar {
    flex: 1;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    min-height: 0;
    opacity: 0.7;
}
.hbar:hover {
    opacity: 1;
}
.hist-axis {
    display: flex;
    justify-content: space-between;
    font:
        10px ui-monospace,
        monospace;
    color: var(--muted);
    margin-top: 4px;
}

@media (max-width: 600px) {
    .hero h1 {
        font-size: 28px;
    }
    .head {
        flex-direction: column;
        align-items: stretch;
    }
    .flag {
        font-size: 32px;
    }
}
