@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("/static/fonts/inter-latin.woff2") format("woff2");
}

@font-face {
    font-family: "Newsreader";
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url("/static/fonts/newsreader-latin.woff2") format("woff2");
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url("/static/fonts/jetbrains-mono-latin.woff2") format("woff2");
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg-canvas: #FAF9F6;
    --bg-surface: #FFFFFF;
    --bg-subtle: #F3F1EC;
    --bg-active: #EAE7DF;
    --border-hairline: rgba(24, 24, 27, 0.09);
    --border-strong: rgba(24, 24, 27, 0.18);
    --ink-primary: #18181B;
    --ink-secondary: #52525B;
    --ink-muted: #71717A;
    --accent: #1D4ED8;
    --accent-soft: rgba(29, 78, 216, 0.08);
    --status-pass: #15803D;
    --status-pass-bg: rgba(21, 128, 61, 0.08);
    --status-warn: #B45309;
    --status-warn-bg: rgba(180, 83, 9, 0.08);
    --status-pruned: #991B1B;
    --status-pruned-bg: rgba(153, 27, 27, 0.08);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg-canvas: #0C0D0F;
    --bg-surface: #121417;
    --bg-subtle: #191C21;
    --bg-active: #22262E;
    --border-hairline: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --ink-primary: #ECEEF2;
    --ink-secondary: #A1A1AA;
    --ink-muted: #71717A;
    --accent: #60A5FA;
    --accent-soft: rgba(96, 165, 250, 0.12);
    --status-pass: #34D399;
    --status-pass-bg: rgba(52, 211, 153, 0.10);
    --status-warn: #FBBF24;
    --status-warn-bg: rgba(251, 191, 36, 0.10);
    --status-pruned: #F87171;
    --status-pruned-bg: rgba(248, 113, 113, 0.10);
}

:root {
    --font-sans: "Inter", "PingFang SC", -apple-system, sans-serif;
    --font-editorial: "Newsreader", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
    --font-mono: "JetBrains Mono", "Fira Code", monospace;
    --command-bar-height: 48px;
    --telemetry-rail-width: 248px;
    --inspector-width: 400px;
    --telemetry-bar-height: 28px;
    --radius-control: 4px;
    --motion-standard: 160ms cubic-bezier(0.2, 0, 0, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    background: var(--bg-canvas);
    color: var(--ink-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button {
    border: 0;
    color: inherit;
    font: inherit;
}

button:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

h1,
h2,
p {
    margin: 0;
}

.workbench {
    display: grid;
    grid-template-rows: var(--command-bar-height) minmax(0, 1fr) var(--telemetry-bar-height);
    width: 100%;
    height: 100vh;
    height: 100dvh;
    isolation: isolate;
}

.command-bar {
    display: grid;
    grid-template-columns: var(--telemetry-rail-width) minmax(0, 1fr) auto;
    min-width: 0;
    border-bottom: 1px solid var(--border-hairline);
    background: var(--bg-surface);
}

.command-brand,
.research-context,
.command-actions {
    display: flex;
    align-items: center;
    min-width: 0;
}

.command-brand {
    gap: 12px;
    padding: 0 16px;
    border-right: 1px solid var(--border-hairline);
}

.wordmark,
.version,
.micro-label,
.section-code,
.section-index,
.context-label,
.connection-state,
.arena-status,
.log-state {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.wordmark {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.version {
    color: var(--ink-muted);
    font-size: 10px;
}

.research-context {
    gap: 16px;
    padding: 0 20px;
    overflow: hidden;
}

.context-label,
.context-iteration {
    flex: 0 0 auto;
}

.context-label,
.micro-label,
.section-code {
    color: var(--ink-muted);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.09em;
}

.context-value {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 64ch;
    overflow: hidden;
    color: var(--ink-secondary);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-actions {
    gap: 20px;
    padding: 0 16px;
}

.connection-state {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--ink-muted);
    font-size: 10px;
    letter-spacing: 0.06em;
}

.status-dot {
    width: 5px;
    height: 5px;
    border: 1px solid var(--ink-muted);
    border-radius: 50%;
}

.theme-control {
    display: flex;
    padding: 2px;
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-control);
    background: var(--bg-subtle);
}

.theme-option {
    min-height: 24px;
    padding: 2px 9px;
    border-radius: 2px;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    font-size: 11px;
    transition: background-color var(--motion-standard), color var(--motion-standard);
}

.theme-option:hover {
    color: var(--ink-primary);
}

.theme-option[aria-pressed="true"] {
    background: var(--bg-surface);
    color: var(--ink-primary);
}

.workbench-grid {
    display: grid;
    grid-template-columns: var(--telemetry-rail-width) minmax(0, 1fr) var(--inspector-width);
    min-width: 0;
    min-height: 0;
}

.panel-scroll {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: var(--border-strong) transparent;
    scrollbar-width: thin;
}

.telemetry-rail {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-hairline);
    background: var(--bg-subtle);
}

.telemetry-rail > * {
    flex-shrink: 0;
}

.rail-heading,
.arena-heading,
.inspector-heading {
    display: flex;
    align-items: center;
    min-height: 52px;
    border-bottom: 1px solid var(--border-hairline);
}

.rail-heading {
    gap: 10px;
    padding: 0 16px;
}

.rail-heading h1,
.arena-heading h1,
.inspector-heading h1 {
    font-size: 12px;
    font-weight: 550;
    letter-spacing: -0.01em;
}

.section-index {
    color: var(--ink-muted);
    font-size: 10px;
}

.rail-section {
    padding: 24px 16px;
    border-bottom: 1px solid var(--border-hairline);
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.section-heading h2 {
    font-size: 12px;
    font-weight: 500;
}

.section-code {
    font-size: 9px;
    white-space: nowrap;
}

.panel-empty {
    max-width: 28ch;
    color: var(--ink-muted);
    font-size: 12px;
}

.rail-footnote {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
    padding: 20px 16px;
}

.mono,
.numeric {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.rail-footnote .mono {
    color: var(--ink-secondary);
    font-size: 10px;
}

.hypothesis-arena {
    display: grid;
    grid-template-rows: 52px minmax(0, 1fr) 32px;
    min-width: 0;
    min-height: 0;
    background: var(--bg-surface);
}

.arena-heading,
.inspector-heading {
    justify-content: space-between;
    gap: 12px;
    padding: 0 24px;
}

.arena-heading > div,
.inspector-heading > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.arena-canvas {
    display: grid;
    padding: 32px;
}

.canvas-empty {
    align-self: center;
    max-width: 580px;
    padding-bottom: 5vh;
}

.canvas-empty h2 {
    margin-top: 20px;
    font-family: var(--font-editorial);
    font-size: clamp(32px, 3.1vw, 48px);
    font-weight: 400;
    letter-spacing: -0.035em;
    line-height: 1.12;
}

.canvas-empty p {
    max-width: 40ch;
    margin-top: 20px;
    color: var(--ink-secondary);
    font-size: 13px;
    line-height: 1.65;
}

.arena-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    border-top: 1px solid var(--border-hairline);
    color: var(--ink-muted);
    font-size: 9px;
    letter-spacing: 0.06em;
}

.evidence-inspector {
    border-left: 1px solid var(--border-hairline);
    background: var(--bg-surface);
}

.inspector-heading {
    padding: 0 20px;
}

.inspector-empty {
    padding: 32px 24px;
}

.inspector-empty p {
    max-width: 28ch;
    margin-top: 12px;
    color: var(--ink-muted);
    font-size: 13px;
}

.telemetry-bar {
    display: grid;
    grid-template-columns: var(--telemetry-rail-width) minmax(0, 1fr) auto;
    align-items: center;
    min-width: 0;
    border-top: 1px solid var(--border-hairline);
    background: var(--bg-subtle);
    color: var(--ink-muted);
}

.telemetry-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
    padding: 0 16px;
    border-right: 1px solid var(--border-hairline);
}

.terminal-prompt {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 11px;
}

.telemetry-empty {
    padding: 0 16px;
    font-size: 11px;
}

.log-state {
    padding: 0 16px;
    font-size: 9px;
    letter-spacing: 0.06em;
}

@media (max-width: 1100px) {
    :root {
        --inspector-width: 320px;
    }

    .connection-state {
        display: none;
    }
}

@media (max-width: 800px) {
    :root {
        --telemetry-rail-width: 200px;
        --inspector-width: 0px;
    }

    .evidence-inspector {
        display: none;
    }

    .theme-option {
        padding-inline: 7px;
    }

    .command-actions {
        padding-inline: 8px;
    }
}
