:root {
    --bg: #05080d;
    --ink: #eef6fb;
    --muted: #96a8b6;
    --line: rgba(168, 190, 210, 0.18);
    --panel: rgba(12, 18, 27, 0.86);
    --panel-strong: rgba(7, 11, 17, 0.94);
    --cyan: #55d7ff;
    --green: #76e59f;
    --amber: #ffcc6a;
    --rose: #ff7f9f;
    --violet: #a98bff;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    color: var(--ink);
    font-family: "Outfit", "DM Sans", system-ui, sans-serif;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px) 0 0 / 56px 56px,
        linear-gradient(0deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 56px 56px,
        linear-gradient(135deg, rgba(85, 215, 255, 0.10), transparent 32%),
        linear-gradient(315deg, rgba(255, 204, 106, 0.08), transparent 38%),
        var(--bg);
    letter-spacing: 0;
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

.lab-page {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 48px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 8px 0 22px;
}

.brand,
.back,
.kicker,
.label,
.value,
.tag,
.source,
.readout,
.mini-table {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--cyan);
    font-weight: 700;
}

.mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(85, 215, 255, 0.38);
    border-radius: 8px;
    background: rgba(85, 215, 255, 0.08);
}

.back {
    text-decoration: none;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.035);
}

.back:hover {
    color: var(--ink);
    border-color: rgba(85, 215, 255, 0.58);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
    gap: 20px;
    align-items: stretch;
}

.hero-copy,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 44%),
        var(--panel);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(16px);
}

.hero-copy {
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 430px;
}

.kicker {
    color: var(--green);
    font-size: 0.78rem;
    margin-bottom: 14px;
}

h1 {
    margin: 0;
    font-size: 4.2rem;
    line-height: 0.96;
    letter-spacing: 0;
}

.lede {
    color: #c1d0dc;
    font-size: 1.08rem;
    line-height: 1.58;
    margin: 18px 0 0;
    max-width: 46rem;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.tag {
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 0.74rem;
    background: rgba(255, 255, 255, 0.035);
}

.stage {
    min-height: 430px;
    position: relative;
    overflow: hidden;
}

.stage canvas,
.stage .three-stage {
    width: 100%;
    height: 100%;
    display: block;
}

.stage-overlay {
    position: absolute;
    inset: 14px;
    pointer-events: none;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.readout {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(5, 8, 13, 0.64);
    padding: 10px 12px;
    color: var(--ink);
}

.readout span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
}

.readout b {
    font-size: 1.08rem;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.metric {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    padding: 14px;
    min-height: 104px;
}

.label {
    color: var(--muted);
    font-size: 0.73rem;
    margin-bottom: 8px;
}

.value {
    font-size: 1.58rem;
    color: var(--ink);
}

.metric small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.35;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 14px;
    margin-top: 14px;
}

.panel {
    padding: 16px;
}

.panel h2 {
    margin: 0 0 14px;
    font-size: 1.2rem;
}

.control-row {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.control-row label {
    color: var(--muted);
    font-size: 0.88rem;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--cyan);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lab-button {
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 40px;
    padding: 0 13px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.045);
    cursor: pointer;
}

.lab-button.primary {
    color: #061018;
    background: var(--ink);
    border-color: var(--ink);
    font-weight: 700;
}

.lab-button:hover {
    border-color: rgba(85, 215, 255, 0.62);
}

.mini-table {
    display: grid;
    gap: 8px;
    font-size: 0.82rem;
}

.mini-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid rgba(168, 190, 210, 0.12);
    padding-bottom: 8px;
}

.mini-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.mini-row span:first-child {
    color: var(--muted);
}

.source {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.45;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.84rem;
}

.swatch {
    width: 10px;
    height: 10px;
    border-radius: 99px;
    background: var(--cyan);
    box-shadow: 0 0 14px currentColor;
}

.swatch.green { background: var(--green); color: var(--green); }
.swatch.amber { background: var(--amber); color: var(--amber); }
.swatch.rose { background: var(--rose); color: var(--rose); }
.swatch.violet { background: var(--violet); color: var(--violet); }

@media (max-width: 980px) {
    .hero,
    .workspace {
        grid-template-columns: 1fr;
    }

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

    h1 {
        font-size: 3rem;
    }
}

@media (max-width: 640px) {
    .lab-page {
        width: min(100% - 22px, 1240px);
        padding-top: 14px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-copy {
        min-height: auto;
        padding: 20px;
    }

    .stage {
        min-height: 360px;
    }

    .dashboard {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2.45rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
