:root {
    color-scheme: dark;
    --ink: #101411;
    --surface: #151b17;
    --surface-raised: #1b231d;
    --line: #344039;
    --line-strong: #566359;
    --paper: #ecf0e8;
    --muted: #9da89e;
    --accent: #b8f23d;
    --accent-soft: #283a1c;
    --signal: #65d9b5;
    --failure: #ff806c;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--ink);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--paper);
    background-color: var(--ink);
    background-image:
        linear-gradient(rgba(184, 242, 61, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(184, 242, 61, 0.035) 1px, transparent 1px);
    background-size: 32px 32px;
}

button,
select,
textarea,
input {
    font: inherit;
}

button,
select,
input[type="checkbox"] {
    cursor: pointer;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.site-shell {
    width: min(1640px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 32px;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    border-bottom: 1px solid var(--line);
}

.wordmark {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--paper);
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-decoration: none;
}

.mark {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: var(--ink);
    background: var(--accent);
    font-size: 17px;
    letter-spacing: 0;
}

.wordmark-section {
    color: var(--muted);
    font-weight: 500;
}

.stage-badge,
.status,
.eyebrow,
.panel-index,
.channel-heading,
.source-meta,
.limit-marker,
footer {
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stage-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
}

.stage-badge span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--signal);
    box-shadow: 0 0 14px var(--signal);
}

.intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 560px);
    align-items: end;
    gap: 48px;
    padding: 44px 0 36px;
}

.eyebrow {
    margin: 0 0 13px;
    color: var(--accent);
    font-size: 11px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    max-width: 770px;
    font-size: clamp(38px, 5.4vw, 76px);
    font-weight: 580;
    line-height: 0.96;
    letter-spacing: -0.055em;
}

.intro-copy {
    margin-bottom: 4px;
    color: #c5cec6;
    font-size: 16px;
    line-height: 1.65;
}

.workbench {
    display: grid;
    grid-template-columns: minmax(440px, 1.25fr) minmax(250px, 0.55fr) minmax(430px, 1.2fr);
    min-height: 650px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.22);
}

.panel {
    min-width: 0;
}

.source-panel,
.control-panel {
    border-right: 1px solid var(--line);
}

.source-panel {
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-raised);
}

.panel-header > div:first-child {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.panel-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
}

.panel-index {
    color: var(--accent);
    font-size: 9px;
}

.example-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

select {
    min-height: 36px;
    padding: 0 32px 0 10px;
    color: var(--paper);
    border: 1px solid var(--line-strong);
    border-radius: 0;
    background: var(--ink);
}

.example-description {
    min-height: 50px;
    margin: 0;
    padding: 14px 20px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    line-height: 1.55;
}

.source-editor {
    display: block;
    flex: 1;
    width: 100%;
    min-height: 490px;
    resize: vertical;
    padding: 22px;
    color: #e7eee7;
    border: 0;
    border-radius: 0;
    outline-offset: -2px;
    background: #111613;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 13px;
    line-height: 1.65;
    tab-size: 4;
}

.source-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 20px;
    color: #78837a;
    border-top: 1px solid var(--line);
    font-size: 9px;
}

.control-panel {
    background: #171d19;
}

.panel-header.compact {
    justify-content: flex-start;
}

.control-intro {
    margin: 0;
    padding: 18px 20px 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.capabilities {
    margin: 0;
    padding: 8px 20px 22px;
    border: 0;
}

.capabilities label {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid #2a332d;
}

.capabilities input {
    width: 15px;
    height: 15px;
    margin: 2px 0 0;
    accent-color: var(--accent);
}

.capabilities strong,
.capabilities small {
    display: block;
}

.capabilities strong {
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    font-weight: 600;
}

.capabilities small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.35;
}

.budget-control {
    padding: 0 20px 20px;
}

.budget-control label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 11px;
}

.budget-control select {
    width: 100%;
}

.run-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: calc(100% - 40px);
    min-height: 48px;
    margin: 0 20px;
    color: var(--ink);
    border: 1px solid var(--accent);
    border-radius: 0;
    background: var(--accent);
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.run-button:hover:not(:disabled) {
    background: #cdfb6a;
}

.run-button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.limit-note {
    margin: 24px 20px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.limit-marker {
    color: var(--failure);
    font-size: 9px;
}

.limit-note p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}

.result-panel {
    display: flex;
    min-height: 0;
    flex-direction: column;
}

.result-heading {
    min-height: 72px;
}

.status {
    padding: 5px 7px;
    font-size: 9px;
    border: 1px solid currentColor;
}

.status.idle {
    color: var(--muted);
}

.status.success {
    color: var(--signal);
}

.status.failure {
    color: var(--failure);
}

.result-tabs {
    display: flex;
    min-height: 47px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}

.result-tabs button {
    position: relative;
    min-width: max-content;
    padding: 0 10px;
    color: var(--muted);
    border: 0;
    background: transparent;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 9px;
    letter-spacing: 0.08em;
}

.result-tabs button.active {
    color: var(--paper);
}

.result-tabs button.active::after {
    position: absolute;
    right: 10px;
    bottom: 0;
    left: 10px;
    height: 2px;
    background: var(--accent);
    content: "";
}

.tab-count {
    margin-left: 4px;
    color: var(--failure);
}

.result-body {
    flex: 1;
    min-height: 520px;
    max-height: 570px;
    overflow: auto;
    background: #121714;
}

.empty-state {
    display: grid;
    place-content: center;
    min-height: 460px;
    padding: 32px;
    color: #7f8a81;
    text-align: center;
}

.empty-state > span {
    margin-bottom: 14px;
    color: var(--line-strong);
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 36px;
}

.empty-state p {
    max-width: 330px;
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
}

.empty-state.success > span {
    color: var(--signal);
}

.channel-heading {
    display: flex;
    justify-content: space-between;
    padding: 16px 20px 10px;
    color: #778279;
    font-size: 9px;
}

.channel-heading.diagnostic {
    margin-top: 10px;
    border-top: 1px solid var(--line);
}

.console-output,
.bytecode-output {
    margin: 0;
    padding: 8px 20px 24px;
    color: #e4eae4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
}

.console-output.diagnostic {
    color: #ffd1c9;
}

.bytecode-output {
    color: #bdd5c3;
    white-space: pre;
    overflow-wrap: normal;
}

.diagnostic-list {
    margin: 0;
    padding: 16px 20px 30px;
    list-style: none;
}

.diagnostic-list li {
    margin-bottom: 12px;
    padding: 16px;
    border-left: 2px solid var(--failure);
    background: rgba(255, 128, 108, 0.055);
}

.diagnostic-list li > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.diagnostic-list code {
    color: var(--failure);
}

.diagnostic-list li > div span,
.diagnostic-list small {
    color: var(--muted);
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 9px;
}

.diagnostic-list p {
    margin: 12px 0 8px;
    font-size: 12px;
    line-height: 1.55;
}

.execution-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    border-bottom: 1px solid var(--line);
}

.execution-grid div {
    min-height: 78px;
    padding: 16px 20px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.execution-grid div:nth-child(even) {
    border-right: 0;
}

.execution-grid dt,
.capability-evidence h3,
.digest span {
    margin-bottom: 8px;
    color: var(--muted);
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.execution-grid dd {
    margin: 0;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 13px;
}

.capability-evidence {
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.capability-evidence h3:not(:first-child) {
    margin-top: 20px;
}

.none-label {
    margin: 0;
    color: #748077;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
}

.inline-capabilities {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.inline-capabilities li {
    padding: 5px 7px;
    color: var(--signal);
    border: 1px solid #315b4e;
    background: #15261f;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 9px;
}

.digest {
    padding: 20px;
}

.digest span,
.digest code {
    display: block;
}

.digest code {
    color: var(--accent);
    font-size: 10px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 0 34px;
    color: #778178;
    font-size: 9px;
}

.boot-screen {
    display: grid;
    place-content: center;
    min-height: 100vh;
    color: var(--muted);
    text-align: center;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
}

.boot-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin: 0 auto 18px;
    color: var(--ink);
    background: var(--accent);
    font-size: 25px;
    font-weight: 800;
}

.not-found {
    max-width: 700px;
    margin: 15vh auto;
    padding: 30px;
}

.not-found h1 {
    margin-bottom: 28px;
}

.not-found a {
    color: var(--accent);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#blazor-error-ui {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 1000;
    display: none;
    padding: 14px 48px 14px 16px;
    color: var(--ink);
    background: var(--failure);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    font-size: 13px;
}

#blazor-error-ui .reload {
    margin-left: 12px;
    color: inherit;
    font-weight: 700;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 7px;
    right: 10px;
    color: var(--ink);
    border: 0;
    background: transparent;
    font-size: 24px;
}

@media (max-width: 1220px) {
    .workbench {
        grid-template-columns: minmax(430px, 1.25fr) minmax(260px, 0.75fr);
    }

    .result-panel {
        grid-column: 1 / -1;
        border-top: 1px solid var(--line-strong);
    }

    .control-panel {
        border-right: 0;
    }

    .result-body {
        min-height: 420px;
        max-height: 620px;
    }
}

@media (max-width: 780px) {
    .site-shell {
        padding: 0 16px;
    }

    .wordmark-section {
        display: none;
    }

    .intro {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 34px 0 28px;
    }

    .intro-copy {
        max-width: 620px;
    }

    .workbench {
        display: block;
    }

    .source-panel,
    .control-panel {
        border-right: 0;
        border-bottom: 1px solid var(--line-strong);
    }

    .source-editor {
        min-height: 460px;
    }

    .panel-header {
        align-items: flex-start;
        gap: 14px;
    }

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

    .result-body {
        min-height: 440px;
        max-height: none;
    }

    footer {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .site-header {
        min-height: 62px;
    }

    .stage-badge {
        font-size: 8px;
    }

    .stage-badge span {
        display: none;
    }

    .panel-header:not(.compact) {
        flex-direction: column;
    }

    .example-picker,
    .example-picker select {
        width: 100%;
    }

    .source-editor {
        padding: 17px;
        font-size: 12px;
    }

    .source-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

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

    .execution-grid div {
        border-right: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }
}
