:root {
  --ink: #20364d;
  --muted: #53677e;
  --navy: #183b62;
  --blue: #245e98;
  --blue-soft: #eaf1fa;
  --rust: #98471e;
  --rust-soft: #fcf0e8;
  --line: #d8e1ec;
  --ground: #f3f6fa;
  --paper: #ffffff;
  --danger: #a42d32;
  --focus: #bb5b2c;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ground);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button, input, textarea, [role="combobox"] { caret-color: var(--blue); }
::selection { background: #c9dcf3; color: #17344f; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 16px; font-weight: 650; line-height: 1.4; }
h3 { font-size: 16px; line-height: 1.45; font-weight: 650; }
code, .word-editor, .address-equation { font-family: ui-monospace, "Cascadia Code", "DejaVu Sans Mono", monospace; }
button { cursor: pointer; }
.app-header { min-height: 60px; padding: 8px 26px; background: var(--navy); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; flex: 0 0 40px; }
.brand h1 { font-size: 23px; font-weight: 650; letter-spacing: -.025em; line-height: 1.25; }
.brand-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 14px; margin-top: 3px; }
.brand p { color: #d0dfef; font-size: 13px; }
.theory-link, .author-link { display: inline-block; color: #d0dfef; font-size: 13px; text-underline-offset: 3px; }
.theory-link:hover, .author-link:hover { color: #fff; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.button { border: 1px solid #bdcddd; background: var(--paper); color: var(--ink); border-radius: 6px; min-height: 24px; padding: 2px 13px; font-weight: 550; line-height: 1.3; transition: background-color .16s ease, border-color .16s ease; white-space: nowrap; }
.button:hover { background: #eaf1f8; border-color: #7895b3; }
.button:active { background: #dce8f5; }
.button:disabled { background: #edf1f5; color: #708196; border-color: #d7e0e9; cursor: not-allowed; }
.button.primary { color: #fff; border-color: var(--blue); background: var(--blue); width: 100%; margin-top: 2px; min-height: 26px; }
.button.primary:hover { background: #194d82; }
.button.quiet { background: transparent; border-color: #69829d; color: #f2f7fd; font-size: 13px; }
.button.quiet:hover { background: #2b4d74; border-color: #b7cce1; }
.button.text-button { border: 0; background: transparent; color: var(--blue); padding: 2px 0 2px 10px; min-height: 22px; font-size: 12px; }
.workspace { display: grid; grid-template-columns: 250px minmax(0, 1fr) 250px; gap: 20px; max-width: 1920px; margin: 0 auto; padding: 12px 24px; align-items: start; }
.parameter-rail { min-width: 0; padding: 10px 18px; background: #eaf0f7; border-radius: 8px; }
.parameter-rail > h2 { margin-bottom: 10px; }
.field { margin-bottom: 8px; min-width: 0; }
.field label, .section-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.field-help { display: block; font-size: 12px; color: #4d627a; line-height: 1.3; margin-top: 3px; }
.dual-control { margin: 6px 0; grid-column: 1 / -1; }
.dual-option label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.dual-option input { margin: 0; accent-color: var(--blue); }
.text-input { display: flex; align-items: center; width: 100%; min-width: 0; height: auto; border: 1px solid #b9cadd; border-radius: 5px; background: #fff; color: var(--ink); min-height: 24px; padding: 2px 10px; line-height: 1.3; }
.text-input > input { flex: 1; width: 100%; min-width: 0; height: auto; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; }
.text-input .dash-input-stepper { height: 20px; padding: 0 6px; font-size: 14px; line-height: 1; }
.text-input:focus-within { border-color: var(--blue); outline: 3px solid var(--focus); outline-offset: 2px; }
.text-input > input:focus-visible { outline: none; }
.text-input::placeholder { color: #62778d; }
.text-input:focus { border-color: var(--blue); }
.dash-dropdown { border-color: #b9cadd; border-radius: 5px; color: var(--ink); font-size: 13px; }
.dash-dropdown-trigger { min-height: 24px; line-height: 1.3; }
.dash-dropdown-value { min-width: 0; }
.message { font-size: 12px; margin-top: 4px; line-height: 1.3; }
.message:empty { display: none; }
.message.success { color: #35634d; }
.message.error, .graph-notice.error { color: var(--danger); }
.example-section { margin-top: 12px; padding-top: 8px; border-top: 1px solid #cedbe8; }
.examples { display: flex; gap: 6px; }
.button.example { flex: 1; padding: 2px 6px; min-width: 0; color: var(--blue); }
details { margin-top: 10px; border-top: 1px solid #cedbe8; padding-top: 8px; }
summary { cursor: pointer; font-weight: 600; font-size: 13px; }
details p { margin-top: 6px; font-size: 12px; line-height: 1.4; }
.word-editor { display: block; width: 100%; height: 180px; margin-top: 6px; resize: vertical; min-height: 120px; padding: 4px 9px; font-size: 12px; line-height: 1.3; color: var(--ink); border: 1px solid #b9cadd; border-radius: 5px; background: #fff; tab-size: 2; }
.word-editor[readonly] { background: #f5f8fc; color: var(--muted); }
.graph-workspace { min-width: 0; }
.graph-toolbar { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; min-height: 44px; }
.graph-toolbar > div { min-width: 0; }
.graph-toolbar h2 { font-size: 18px; overflow-wrap: anywhere; }
.graph-summary { margin-top: 2px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.mode-switch { display: inline-flex; flex: 0 0 auto; padding: 3px; gap: 2px; background: #e1e9f2; border-radius: 7px; }
.mode-switch label { position: relative; padding: 2px 10px; border-radius: 4px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.mode-switch label:has(input:checked) { background: #fff; color: var(--blue); }
.mode-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode-switch label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
.scope-toolbar { display: flex; align-items: center; gap: 14px; padding: 6px 0; }
.scope-toolbar > label { font-size: 12px; font-weight: 600; }
.layer-slider { min-width: 60px; flex: 1; padding: 4px 8px 18px !important; }
.dash-slider-range, .dash-slider-thumb { background-color: var(--blue); }
.dash-slider-thumb:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.graph-notice { min-height: 20px; font-size: 12px; color: var(--muted); padding: 0 0 4px; line-height: 1.45; }
.module-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.module-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.port-sample { width: 7px; height: 7px; border-radius: 50%; }
.port-sample.input { background: #087f8c; }
.port-sample.output { background: #c56535; }
.module-sample { width: 13px; height: 8px; border: 1.4px solid #76527e; border-radius: 2px; background: #edf3fa; }
.graph-frame { position: relative; height: 510px; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.graph-frame > div { height: 100%; }
#topology-graph { height: 100%; background: #fff; }
.loading-state { padding: 16px 24px; color: var(--blue); background: #edf3fa; font-size: 14px; border-radius: 6px; }
.find-toolbar { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.find-label { font-size: 12px; font-weight: 600; }
.focus-group { width: 135px; }
.focus-index { width: 80px; }
.navigation-hint { margin-left: auto; font-size: 11px; color: var(--muted); }
.words-section { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.word-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.word-legend { display: flex; flex-wrap: wrap; gap: 15px; font-size: 11px; }
.input-legend { color: var(--blue); }
.output-legend { color: var(--rust); }
.word-table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.word-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.word-table th, .word-table td { text-align: left; padding: 2px 12px; border-bottom: 1px solid #e2e9f1; white-space: nowrap; }
.word-table thead th { background: #eaf0f7; font-weight: 600; color: #425b75; font-size: 11px; }
.word-table tbody th { font-weight: 550; color: var(--muted); }
.word-table .numeric { text-align: right; font-variant-numeric: tabular-nums; }
.word-table tbody tr:last-child > * { border-bottom: 0; }
.word-table .active-word { background: #fdf1e7; }
.word-code { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; min-width: 32px; padding: 0 6px; margin-right: 4px; border-radius: 4px; }
.word-code code { font-size: 12px; font-weight: 600; line-height: 1.1; }
.word-code small { font-size: 10px; line-height: 1.1; opacity: .9; }
.input-code { background: var(--blue-soft); color: #24517f; }
.output-code { background: var(--rust-soft); color: #8f451f; }
.inspector-rail { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 17px; min-width: 0; }
.inspector-heading { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px solid #e3eaf2; }
.inspector-heading h2 { font-size: 14px; }
.empty-selection { padding: 10px 0 4px; }
.empty-selection h3 { font-size: 15px; }
.empty-selection p { margin-top: 6px; font-size: 12px; line-height: 1.4; }
.selection-placeholder { display: flex; align-items: center; width: 94px; margin: 3px 0 10px; }
.sample-node { width: 8px; height: 8px; background: #4d79a4; border-radius: 50%; }
.sample-line { height: 1px; width: 62px; background: #9db4cd; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.6; }
.selection-detail { padding-top: 8px; }
.selection-detail > p { margin-top: 6px; font-size: 12px; }
.selection-subtitle { color: var(--muted); margin-top: 4px !important; }
.selected-word { display: flex; flex-wrap: wrap; gap: 3px; margin: 8px 0; }
.selected-word .word-code { margin-right: 0; }
.digit-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.digit-table th { color: var(--muted); font-weight: 550; font-size: 10px; }
.digit-table th, .digit-table td { padding: 2px; border-bottom: 1px solid #e6ecf4; text-align: right; }
.digit-table th:first-child, .digit-table td:first-child { text-align: left; }
.address-equation { font-size: 11px !important; line-height: 1.4; overflow-wrap: anywhere; color: #3c5774; }
.properties { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 12px; margin-top: 8px; }
.properties dt { color: var(--muted); }
.properties dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.connection-count { color: var(--blue); font-size: 11px !important; padding-top: 6px; border-top: 1px solid #e3eaf2; }
.direction-section { border-top: 1px solid #e3eaf2; padding-top: 8px; margin-top: 10px; }
.direction-section > label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.direction-options label { display: flex !important; gap: 7px; align-items: center; margin: 2px 0; font-size: 12px; min-height: 20px; }
input[type="radio"] { accent-color: var(--blue); }
.scheme-description { margin-top: 10px; padding-top: 8px; border-top: 1px solid #e3eaf2; font-size: 12px; line-height: 1.4; color: var(--muted); }
.app-footer { max-width: 1920px; padding: 0 24px 12px; margin: 0 auto; font-size: 11px; color: var(--muted); }
.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; }
@media (min-width: 1700px) { .workspace { grid-template-columns: 270px minmax(0, 1fr) 280px; gap: 24px; } .graph-frame { height: 610px; } }
@media (max-width: 1190px) {
  .workspace { grid-template-columns: 235px minmax(0, 1fr); gap: 18px; }
  .parameter-rail { grid-column: 1; grid-row: 1 / 3; }
  .graph-workspace { grid-column: 2; grid-row: 1; }
  .inspector-rail { grid-column: 2; grid-row: 2; }
  .navigation-hint { flex-basis: 100%; margin-left: 0; margin-top: 3px; }
}
@media (max-width: 700px) {
  .app-header { align-items: flex-start; padding: 8px 16px; flex-direction: column; gap: 8px; }
  .brand h1 { font-size: 22px; }
  .header-actions { width: 100%; gap: 6px; }
  .header-actions .button { padding: 2px 10px; font-size: 12px; }
  .workspace { display: flex; flex-direction: column; padding: 10px 14px; gap: 12px; }
  .parameter-rail, .graph-workspace, .inspector-rail { width: 100%; }
  .parameter-rail { padding: 10px 15px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .parameter-rail > h2 { margin: 0 0 3px; grid-column: 1 / -1; }
  .parameter-rail .field { margin-bottom: 0; }
  .parameter-rail > .field:nth-child(2), .parameter-rail > .field:nth-child(3), .parameter-rail > .field:nth-child(6), .parameter-rail > .primary, .parameter-rail > .message, .parameter-rail > .example-section, .parameter-rail > details { grid-column: 1 / -1; }
  .parameter-rail > .example-section { margin-top: 2px; padding-top: 6px; }
  .parameter-rail > details { margin-top: 0; padding-top: 6px; }
  .graph-toolbar { flex-direction: column; gap: 6px; padding-bottom: 4px; }
  .graph-toolbar h2 { font-size: 18px; }
  .scope-toolbar { gap: 10px; }
  .scope-toolbar .button { font-size: 12px; padding: 2px 10px; }
  .graph-frame { height: 390px; }
  .find-toolbar { gap: 6px; }
  .focus-group { width: 123px; }
  .focus-index { width: 65px; }
  .find-toolbar .button { padding: 2px 9px; }
  .words-section { margin-top: 12px; }
  .word-heading { gap: 8px; }
  .word-legend { font-size: 10px; gap: 12px; }
  .word-table th, .word-table td { padding: 2px 8px; }
  .app-footer { padding: 0 14px 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
