:root {
    --bg-0: #02060a;
    --bg-1: #06111a;
    --bg-2: #0a1b27;
    --panel: rgba(5, 16, 25, 0.66);
    --panel-strong: rgba(8, 22, 34, 0.84);
    --line: rgba(120, 210, 255, 0.16);
    --line-strong: rgba(120, 210, 255, 0.36);
    --text: #ebfff9;
    --muted: rgba(198, 233, 245, 0.72);
    --cyan: #5af4ff;
    --teal: #28d7a3;
    --amber: #ffbf4d;
    --rose: #ff7d8e;
    --shadow: 0 32px 80px rgba(0, 0, 0, 0.45);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --mouse-x: 0.5;
    --mouse-y: 0.5;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Chakra Petch", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 16%, rgba(40, 215, 163, 0.14), transparent 28%),
        radial-gradient(circle at 82% 18%, rgba(255, 191, 77, 0.12), transparent 22%),
        radial-gradient(circle at 50% 58%, rgba(90, 244, 255, 0.1), transparent 36%),
        linear-gradient(180deg, var(--bg-2), var(--bg-1) 30%, var(--bg-0));
    overflow-x: hidden;
    transition: background 0.7s ease, color 0.4s ease;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at calc(var(--mouse-x) * 100%) calc(var(--mouse-y) * 100%), rgba(90, 244, 255, 0.09), transparent 24%);
    pointer-events: none;
    z-index: -1;
    transition: background 0.7s ease;
}

body.deep-scan {
    background:
        radial-gradient(circle at 16% 14%, rgba(255, 96, 122, 0.18), transparent 26%),
        radial-gradient(circle at 78% 18%, rgba(255, 191, 77, 0.18), transparent 24%),
        radial-gradient(circle at 50% 56%, rgba(90, 244, 255, 0.16), transparent 38%),
        linear-gradient(180deg, #14060d, #091521 34%, #03070b);
}

body.deep-scan::before {
    background: radial-gradient(circle at calc(var(--mouse-x) * 100%) calc(var(--mouse-y) * 100%), rgba(255, 191, 77, 0.14), transparent 28%);
}

canvas,
.grid-layer,
.noise-layer,
.scanline-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

#backdrop-canvas {
    opacity: 0.86;
    z-index: -4;
}

.grid-layer {
    background-image:
        linear-gradient(rgba(90, 244, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(90, 244, 255, 0.05) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: radial-gradient(circle at center, black 28%, transparent 86%);
    opacity: 0.3;
    z-index: -3;
}

.noise-layer {
    background-image:
        linear-gradient(0deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.02)),
        repeating-linear-gradient(90deg, transparent 0 8px, rgba(255, 255, 255, 0.014) 8px 9px);
    mix-blend-mode: screen;
    opacity: 0.4;
    z-index: -2;
}

.scanline-layer {
    background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0 2px, transparent 2px 4px);
    opacity: 0.16;
    z-index: -1;
}

body.deep-scan .grid-layer {
    opacity: 0.44;
    filter: hue-rotate(34deg) saturate(1.35);
}

body.deep-scan .noise-layer {
    opacity: 0.54;
}

body.deep-scan .scanline-layer {
    opacity: 0.28;
    mix-blend-mode: screen;
}

.page-shell {
    width: min(1600px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 28px 0 28px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 24px;
}

.brand-block {
    max-width: 760px;
}

.eyebrow,
.pill-label,
.hud-label,
.confidence-detail,
.metric-caption,
.subtitle,
.ticker-track,
.event-feed,
.confidence-row,
.rune-strip {
    font-family: "IBM Plex Mono", monospace;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--cyan);
    letter-spacing: 0.24em;
    text-transform: uppercase;
    font-size: 11px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 5.8rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    text-shadow: 0 0 28px rgba(90, 244, 255, 0.16);
}

.subtitle {
    margin-top: 16px;
    max-width: 56ch;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.8;
}

.mode-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 18px;
    padding: 16px 18px;
    max-width: 820px;
    border-radius: 18px;
    border: 1px solid rgba(90, 244, 255, 0.14);
    background: linear-gradient(180deg, rgba(5, 16, 25, 0.7), rgba(4, 11, 18, 0.54));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.45s ease, transform 0.45s ease, background 0.45s ease;
}

.mode-callout-copy {
    color: rgba(226, 244, 252, 0.84);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.82rem;
    line-height: 1.7;
}

.mode-callout kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.8rem;
    padding: 0.18rem 0.45rem;
    margin: 0 0.18rem;
    border-radius: 8px;
    border: 1px solid rgba(90, 244, 255, 0.26);
    background: rgba(7, 22, 35, 0.78);
    color: var(--cyan);
    font-family: inherit;
    font-size: 0.8rem;
}

.mode-callout-status {
    flex-shrink: 0;
    min-width: 160px;
    padding-left: 18px;
    border-left: 1px solid rgba(90, 244, 255, 0.14);
}

.mode-callout-label {
    display: block;
    color: rgba(198, 233, 245, 0.72);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.mode-callout-status strong {
    display: block;
    margin-top: 8px;
    font-size: 1rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

body.deep-scan .mode-callout {
    border-color: rgba(255, 191, 77, 0.28);
    background: linear-gradient(180deg, rgba(24, 10, 16, 0.74), rgba(7, 18, 27, 0.64));
    transform: translateY(-2px);
}

body.deep-scan .mode-callout-status strong {
    color: var(--amber);
}

.status-cluster {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    gap: 12px;
    min-width: min(36vw, 380px);
}

.status-pill {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(8, 22, 34, 0.84), rgba(4, 11, 18, 0.74));
    backdrop-filter: blur(18px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow);
}

.status-pill strong {
    display: block;
    margin-top: 8px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.status-pill.accent {
    border-color: rgba(40, 215, 163, 0.3);
}

.status-pill.warning {
    border-color: rgba(255, 191, 77, 0.28);
}

.pill-label {
    font-size: 0.72rem;
    color: rgba(198, 233, 245, 0.78);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(240px, 300px);
    gap: 18px;
}

.side-column {
    display: grid;
    gap: 16px;
}

.metric-card,
.protocol-card,
.core-stage {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(8, 20, 31, 0.88), rgba(4, 11, 18, 0.72));
    backdrop-filter: blur(20px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), var(--shadow);
}

.metric-card::before,
.protocol-card::before,
.core-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(90, 244, 255, 0.09), transparent 44%, rgba(255, 191, 77, 0.08));
    opacity: 0.9;
    pointer-events: none;
}

.metric-card {
    padding: 18px 18px 16px;
}

.metric-header h2,
.card-heading h2 {
    font-size: 1.18rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.metric-value-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 18px 0 12px;
}

.metric-value {
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.metric-unit {
    color: var(--cyan);
    font-size: 0.94rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.metric-caption {
    color: rgba(198, 233, 245, 0.72);
    font-size: 0.78rem;
    line-height: 1.55;
}

.sparkline {
    display: block;
    width: 100%;
    height: 72px;
    margin: 8px 0 14px;
}

.core-column {
    display: grid;
    gap: 16px;
}

.rune-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: rgba(198, 233, 245, 0.8);
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.rune-strip span {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(90, 244, 255, 0.14);
    background: rgba(5, 16, 25, 0.54);
}

.core-stage {
    min-height: 720px;
    padding: 24px;
    transition: border-color 0.45s ease, box-shadow 0.45s ease, transform 0.45s ease;
}

body.deep-scan .core-stage {
    border-color: rgba(255, 191, 77, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 40px 100px rgba(0, 0, 0, 0.52);
}

#core-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.core-hud {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.hud-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    gap: 12px;
    width: min(46%, 420px);
}

.hud-panel {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(4, 12, 19, 0.54);
    border: 1px solid rgba(90, 244, 255, 0.13);
}

.hud-panel.primary {
    width: min(34%, 260px);
    min-width: 220px;
}

.hud-label {
    color: rgba(198, 233, 245, 0.72);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.hud-value {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 8px;
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.hud-value small {
    color: var(--cyan);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hud-value.text {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.orb-label {
    position: absolute;
    z-index: 2;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(90, 244, 255, 0.14);
    background: rgba(4, 12, 19, 0.6);
    color: rgba(235, 255, 249, 0.86);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.74rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.orb-label-north {
    top: 19%;
    left: 50%;
    transform: translateX(-50%);
}

.orb-label-east {
    top: 49%;
    right: 8%;
    transform: translateY(-50%);
}

.orb-label-south {
    bottom: 17%;
    left: 50%;
    transform: translateX(-50%);
}

.orb-label-west {
    top: 49%;
    left: 8%;
    transform: translateY(-50%);
}

.orb-label-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.96rem;
    border-color: rgba(255, 191, 77, 0.2);
}

.deep-scan-overlay {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 24px;
    z-index: 3;
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(255, 191, 77, 0.18);
    background: linear-gradient(180deg, rgba(21, 10, 15, 0.18), rgba(7, 18, 27, 0.18));
    backdrop-filter: blur(18px);
    opacity: 0;
    transform: translateY(28px) scale(0.985);
    transition: opacity 0.55s ease, transform 0.55s ease, border-color 0.55s ease, background 0.55s ease;
    pointer-events: none;
}

.deep-scan-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(120deg, rgba(255, 191, 77, 0.08), transparent 34%, rgba(90, 244, 255, 0.08));
    opacity: 0.6;
}

body.deep-scan .deep-scan-overlay {
    opacity: 1;
    transform: translateY(0) scale(1);
    border-color: rgba(255, 191, 77, 0.34);
    background: linear-gradient(180deg, rgba(29, 12, 17, 0.76), rgba(7, 18, 27, 0.78));
}

.deep-scan-header,
.deep-scan-grid,
.deep-scan-spectrum {
    position: relative;
    z-index: 1;
}

.deep-scan-header h2 {
    font-size: 1.2rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.deep-scan-text {
    margin-top: 10px;
    max-width: 64ch;
    color: rgba(242, 229, 214, 0.86);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.78rem;
    line-height: 1.75;
}

.deep-scan-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.scan-stat {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 191, 77, 0.16);
    background: rgba(9, 16, 25, 0.46);
}

.scan-stat-label {
    display: block;
    color: rgba(236, 228, 213, 0.72);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.69rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.scan-stat strong {
    display: block;
    margin-top: 8px;
    color: var(--amber);
    font-size: 1.15rem;
    letter-spacing: 0.08em;
}

.deep-scan-spectrum {
    display: grid;
    grid-template-columns: repeat(28, minmax(0, 1fr));
    align-items: end;
    gap: 6px;
    height: 104px;
}

.spectrum-bar {
    height: 18%;
    border-radius: 999px 999px 6px 6px;
    background: linear-gradient(180deg, rgba(255, 191, 77, 0.9), rgba(90, 244, 255, 0.42));
    box-shadow: 0 0 18px rgba(255, 191, 77, 0.16);
    transform-origin: bottom center;
    transition: height 0.16s linear, opacity 0.18s linear, transform 0.18s linear;
}

body.deep-scan .metric-card,
body.deep-scan .protocol-card {
    border-color: rgba(255, 191, 77, 0.18);
}

body.deep-scan .ticker-track {
    animation-duration: 18s;
}

.lower-grid {
    display: grid;
    grid-template-columns: 1.25fr 0.95fr;
    gap: 16px;
}

.protocol-card {
    padding: 20px;
}

.card-heading {
    margin-bottom: 16px;
}

.event-feed {
    display: grid;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.event-feed li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(4, 12, 19, 0.42);
    border: 1px solid rgba(90, 244, 255, 0.08);
    color: rgba(228, 247, 255, 0.88);
    font-size: 0.76rem;
    line-height: 1.6;
}

.event-feed time {
    color: var(--cyan);
    white-space: nowrap;
}

.confidence-list {
    display: grid;
    gap: 16px;
}

.confidence-row {
    display: grid;
    gap: 8px;
}

.confidence-row > div:first-child {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.confidence-name {
    display: block;
    font-size: 0.84rem;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.confidence-detail {
    display: block;
    margin-top: 4px;
    color: rgba(198, 233, 245, 0.62);
    font-size: 0.74rem;
}

.confidence-value {
    color: var(--amber);
    font-size: 0.88rem;
    justify-self: end;
}

.confidence-track {
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(90, 244, 255, 0.08);
}

.confidence-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), var(--cyan) 72%, var(--amber));
    box-shadow: 0 0 22px rgba(90, 244, 255, 0.25);
    transition: width 0.8s ease;
}

.ticker {
    position: relative;
    margin-top: 16px;
    overflow: hidden;
    border-top: 1px solid rgba(90, 244, 255, 0.12);
    border-bottom: 1px solid rgba(90, 244, 255, 0.12);
    padding: 10px 0;
    background: rgba(2, 8, 12, 0.6);
}

.ticker-track {
    display: inline-flex;
    gap: 36px;
    padding-left: 100%;
    white-space: nowrap;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(228, 247, 255, 0.82);
    animation: ticker-scroll 34s linear infinite;
}

@keyframes ticker-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

@media (max-width: 1320px) {
    .dashboard {
        grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    }

    .dashboard > .side-column:last-child {
        grid-column: 1 / -1;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .page-shell {
        width: min(100vw - 20px, 1600px);
        padding-top: 18px;
    }

    .topbar,
    .dashboard,
    .lower-grid,
    .dashboard > .side-column:last-child {
        grid-template-columns: 1fr;
        display: grid;
    }

    .topbar {
        gap: 18px;
    }

    .mode-callout {
        grid-template-columns: 1fr;
        display: grid;
    }

    .mode-callout-status {
        padding-left: 0;
        border-left: 0;
        border-top: 1px solid rgba(90, 244, 255, 0.14);
        padding-top: 14px;
    }

    .status-cluster {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-width: 0;
    }

    .core-stage {
        min-height: 640px;
    }

    .core-hud {
        flex-direction: column;
    }

    .hud-panel.primary,
    .hud-grid {
        width: 100%;
        min-width: 0;
    }

    .deep-scan-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    h1 {
        font-size: 2.5rem;
    }

    .status-cluster,
    .hud-grid {
        grid-template-columns: 1fr;
    }

    .metric-card,
    .protocol-card,
    .core-stage {
        border-radius: 20px;
    }

    .core-stage {
        min-height: 560px;
    }

    .orb-label-east,
    .orb-label-west {
        display: none;
    }

    .orb-label-north {
        top: 15%;
    }

    .orb-label-south {
        bottom: 12%;
    }

    .ticker-track {
        font-size: 0.68rem;
        gap: 24px;
    }

    .deep-scan-overlay {
        left: 14px;
        right: 14px;
        bottom: 14px;
        padding: 14px;
        border-radius: 18px;
    }

    .deep-scan-grid {
        grid-template-columns: 1fr;
    }

    .deep-scan-spectrum {
        gap: 4px;
        height: 88px;
    }
}
