@layer reset, base, layout, components, responsive;
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, ol, ul, pre { margin: 0; }
  button, input, select, textarea { font: inherit; }
  button { cursor: pointer; color: inherit; }
  a { color: inherit; text-decoration: none; }
  button { background: none; border: 0; }
  [hidden] { display: none !important; }
}
@layer base {
  :root { color-scheme: dark; --bg: #080c12; --surface: #0d131d; --raised: #111b29; --soft: #111e30; --text: #e4eaf3; --muted: #9baabc; --faint: #7a8a9f; --line: #233044; --accent: #77acff; --solid: #3979de; --green: #91bda9; --danger: #ffaaa6; --mono: 'Cascadia Code', Consolas, 'SFMono-Regular', monospace; --sans: 'Segoe UI', Arial, sans-serif; font: 14px/1.6 var(--sans); background: var(--bg); color: var(--text); }
  :root[data-theme='light'] { color-scheme: light; --bg: #f3f5f8; --surface: #fff; --raised: #edf1f6; --soft: #e7efff; --text: #152135; --muted: #52627a; --faint: #64738a; --line: #d6deea; --accent: #225bad; --solid: #2665c2; --green: #34735d; --danger: #aa3434; }
  body { height: 100dvh; overflow: hidden; }
  ::selection { background: var(--accent); color: var(--bg); }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
  a:hover, button:hover { color: var(--accent); }
  input, textarea, select { color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 3px; }
  input, textarea { caret-color: var(--accent); }
  textarea { resize: none; }
  .skip-link { position: fixed; left: 12px; top: -100px; background: var(--solid); color: #fff; padding: 10px; z-index: 100; }
  .skip-link:focus { top: 10px; }
  .content-scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  .icon-button { padding: 4px 6px; color: var(--muted); font-size: 18px; line-height: 1.2; }
  .quiet-button, .text-button { color: var(--muted); font: 10px var(--mono); }
  .quiet-button { padding: 7px 8px; }
  .text-button { padding: 0; }
  .primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 22px; font: 11px var(--mono); min-height: 39px; padding: 11px 15px; border: 1px solid var(--solid); border-radius: 3px; }
  .primary-button { color: #fff; background: var(--solid); }
  .primary-button:hover { color: #fff; background: #316bc6; }
  .secondary-button { color: var(--muted); border-color: var(--line); background: transparent; }
  .secondary-button:hover { border-color: var(--accent); }
  .mobile-only { display: none; }
}
@layer layout {
  .app { height: 100%; display: grid; grid-template-rows: 68px minmax(0, 1fr) 29px; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); gap: 20px; }
  .brand { display: flex; align-items: center; gap: 12px; font: 12px var(--mono); font-weight: 600; letter-spacing: .04em; }
  .brand img { border: 1px solid var(--line); border-radius: 7px; }
  .brand small { display: block; font: 9px var(--mono); color: var(--faint); letter-spacing: 0; margin-top: 5px; }
  .topbar-right { display: flex; align-items: center; gap: 25px; }
  .local-indicator { color: var(--faint); font: 9px var(--mono); letter-spacing: .07em; }
  .local-indicator i, .status-bar i { display: inline-block; width: 5px; height: 5px; background: var(--green); border-radius: 50%; margin-right: 7px; }
  .source-link { font: 10px var(--mono); color: var(--muted); }
  .app-body { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 0; }
  #sidebar-slot { min-height: 0; border-right: 1px solid var(--line); }
  .sidebar { display: flex; flex-direction: column; height: 100%; padding: 24px 0 18px; background: var(--bg); min-height: 0; }
  .sidebar-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 22px 16px; color: var(--faint); font: 9px var(--mono); letter-spacing: .08em; }
  #case-list { display: grid; gap: 5px; }
  .case-item { display: grid; grid-template-columns: 24px 1fr; gap: 9px; padding: 13px 20px; border-left: 2px solid transparent; }
  .case-item.active { background: var(--soft); border-left-color: var(--accent); }
  .case-item .case-number { font: 10px var(--mono); color: var(--faint); padding-top: 2px; }
  .case-item.active .case-number { color: var(--accent); }
  .case-item strong { font-size: 12px; font-weight: 500; display: block; }
  .case-item small { display: block; color: var(--faint); font: 9px var(--mono); margin-top: 5px; }
  .case-item small.preview { color: var(--accent); }
  .sidebar-section { display: flex; justify-content: space-between; gap: 10px; color: var(--faint); font: 9px var(--mono); letter-spacing: .05em; padding: 27px 22px 14px; margin-top: 7px; border-top: 1px solid var(--line); }
  .chapter-list { overflow-y: auto; scrollbar-width: thin; min-height: 0; padding-bottom: 15px; }
  .chapter-link { display: grid; grid-template-columns: 17px 1fr 9px; align-items: start; gap: 9px; padding: 9px 18px 9px 22px; font-size: 10px; color: var(--muted); }
  .chapter-link > span:first-child { color: var(--faint); font: 9px/1.7 var(--mono); }
  .chapter-link.active { color: var(--accent); background: var(--soft); }
  .chapter-link .chapter-reviewed { color: var(--green); font-size: 9px; }
  .record-name small { display: block; color: var(--faint); font: 8px/1.7 var(--mono); margin-top: 2px; }
  .field-guide { padding: 6px 22px 24px; font-size: 11px; color: var(--muted); }
  .field-guide p { padding-bottom: 12px; }
  .field-guide p span { color: var(--accent); font: 10px var(--mono); margin-right: 10px; }
  .guide-note { margin-top: 15px; font-size: 10px; color: var(--faint); line-height: 1.9; }
  .sidebar-footer { margin-top: auto; display: grid; gap: 7px; border-top: 1px solid var(--line); padding: 17px 22px 0; flex-shrink: 0; }
  .sidebar-footer span { font: 8px var(--mono); color: var(--faint); letter-spacing: .1em; }
  .sidebar-footer a { color: var(--muted); font: 10px var(--mono); }
  .main { display: grid; grid-template-rows: 47px minmax(0, 1fr); min-height: 0; min-width: 0; background: var(--surface); outline: none; }
  .workspace-bar { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 0 29px; border-bottom: 1px solid var(--line); }
  .breadcrumbs { display: flex; align-items: center; gap: 11px; color: var(--muted); font: 10px var(--mono); min-width: 0; }
  #current-case { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .breadcrumb-separator { color: var(--faint); }
  .workspace-actions { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
  .overview { padding: 35px clamp(25px, 3.6vw, 60px) 26px; }
  .chapter-layout { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
  .reader { padding: 30px clamp(25px, 4.3vw, 68px) 35px; min-width: 0; outline: none; }
  #workbench-slot { display: none; min-height: 0; border-left: 1px solid var(--line); }
  .workbench { display: flex; flex-direction: column; background: var(--bg); height: 100%; min-height: 0; width: 100%; }
  .workbench-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 21px 16px; color: var(--faint); font: 9px var(--mono); letter-spacing: .08em; }
  .workbench-tabs { display: flex; border-bottom: 1px solid var(--line); margin: 0 20px; }
  .workbench-tabs button { flex: 1; padding: 10px 0; font: 10px var(--mono); color: var(--faint); border-bottom: 2px solid transparent; }
  .workbench-tabs button[aria-selected='true'] { color: var(--accent); border-color: var(--accent); }
  .status-bar { display: flex; justify-content: space-between; align-items: center; padding: 0 19px; border-top: 1px solid var(--line); color: var(--faint); font: 9px var(--mono); }
  .status-bar > span { display: flex; align-items: center; gap: 5px; }
  .status-bar i { margin-right: 2px; }
  .status-separator { color: var(--line); padding: 0 8px; }
}
@layer components {
  .overview-hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 30px; align-items: center; margin-bottom: 35px; }
  .eyebrow { color: var(--faint); font: 9px var(--mono); letter-spacing: .09em; margin-bottom: 20px; }
  .blue-square { display: inline-block; width: 5px; height: 5px; background: var(--accent); margin-right: 7px; }
  .overview h1 { font-size: clamp(34px, 4.5vw, 62px); line-height: 1.08; font-weight: 500; letter-spacing: -2.2px; }
  .overview h1 > span { color: var(--accent); }
  .hero-copy { color: var(--muted); font-size: 12px; line-height: 1.9; margin: 19px 0 23px; }
  .resume-link { display: block; width: max-content; max-width: 100%; font: 9px var(--mono); color: var(--muted); margin-top: 14px; }
  .signal-map { position: relative; aspect-ratio: 1.4; border: 1px solid var(--line); background: var(--bg); overflow: hidden; }
  .signal-map svg { position: absolute; inset: 14px 0; width: 100%; height: calc(100% - 28px); }
  .map-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 24px 24px; opacity: .25; }
  .map-label { position: absolute; top: 15px; left: 16px; font: 8px var(--mono); color: var(--faint); z-index: 1; }
  .map-corner { position: absolute; width: 13px; height: 13px; border-color: var(--accent); border-style: solid; z-index: 1; }
  .top-left { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
  .bottom-right { right: -1px; bottom: -1px; border-width: 0 2px 2px 0; }
  .trace-path { fill: none; stroke: var(--accent); stroke-width: 1.5; }
  .trace-echo { fill: none; stroke: var(--muted); stroke-width: .7; stroke-dasharray: 3 6; opacity: .5; }
  .trace-nodes { fill: var(--accent); }
  .trace-rings { fill: var(--bg); fill-opacity: .4; stroke: var(--accent); stroke-width: .7; }
  .trace-numbers { fill: var(--muted); font: 10px var(--mono); }
  .map-bottom { position: absolute; bottom: 15px; inset-inline: 16px; display: flex; justify-content: space-between; color: var(--faint); font: 8px var(--mono); }
  .directory-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
  .directory-heading h2 { font-size: 13px; font-weight: 500; }
  .directory-heading > span { color: var(--faint); font: 8px var(--mono); white-space: nowrap; }
  .file-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto 18px; align-items: center; gap: 19px; padding: 19px 0; border-bottom: 1px solid var(--line); }
  .file-index { color: var(--accent); font: 11px var(--mono); }
  .file-row h3 { font-size: 16px; font-weight: 500; letter-spacing: -.3px; }
  .file-row p { color: var(--muted); font-size: 11px; margin-top: 4px; }
  .file-row-meta { text-align: right; }
  .file-row-meta > span { display: block; color: var(--muted); font: 9px var(--mono); }
  .file-row-meta small { display: block; color: var(--faint); font: 8px var(--mono); margin-top: 7px; }
  .file-arrow { color: var(--accent); font-size: 19px; }
  .overview-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 21px; color: var(--faint); font: 9px var(--mono); line-height: 1.8; }
  .overview-foot > span > i { display: inline-block; width: 5px; height: 5px; background: var(--green); margin-right: 7px; border-radius: 50%; }
  .overview-foot button { font-size: 9px; white-space: nowrap; }
  .reader-meta { display: flex; justify-content: space-between; align-items: center; gap: 15px; color: var(--faint); font: 9px var(--mono); padding-bottom: 21px; border-bottom: 1px solid var(--line); }
  #case-status { color: var(--accent); font-size: 8px; }
  .chapter-kicker { font: 10px var(--mono); color: var(--accent); margin-top: 29px; }
  .reader h1 { font-size: clamp(26px, 3vw, 37px); font-weight: 500; line-height: 1.2; letter-spacing: -1px; margin: 12px 0 25px; }
  .chapter-body { color: var(--muted); font-size: 14px; line-height: 1.95; }
  .chapter-body > * + * { margin-top: 17px; }
  .chapter-body strong, .chapter-body code { color: var(--text); }
  .chapter-body p { max-width: 76ch; }
  .chapter-body ul, .chapter-body ol { padding-left: 21px; }
  .chapter-body li + li { margin-top: 7px; }
  .chapter-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
  .chapter-body code { font: 11px/1.9 var(--mono); overflow-wrap: anywhere; }
  .evidence { border: 1px solid var(--line); background: var(--bg); margin-block: 23px; border-radius: 3px; overflow: hidden; }
  .evidence-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line); font: 8px var(--mono); color: var(--faint); letter-spacing: .06em; }
  .evidence-actions { display: flex; align-items: center; gap: 15px; }
  .evidence-actions button { font-size: 9px; color: var(--muted); letter-spacing: 0; }
  .evidence pre, .evidence blockquote { padding: 17px; margin: 0; color: var(--text); font: 12px/1.9 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
  .evidence .line { display: block; }
  .hints { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 18px; }
  .hint-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
  .hint-heading h2 { font-size: 12px; font-weight: 500; }
  #hint-count { color: var(--faint); font: 9px var(--mono); }
  #hint-list { padding-left: 22px; color: var(--muted); font-size: 12px; line-height: 1.9; }
  #hint-list li { padding: 5px 0; }
  #hint-list li::marker { font-family: var(--mono); color: var(--accent); font-size: 10px; }
  .hint-button { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 11px 14px; margin-top: 10px; border: 1px dashed var(--line); color: var(--accent); font: 10px var(--mono); }
  .hint-button:disabled { color: var(--faint); cursor: default; }
  .review-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 30px; padding: 17px 0; border-top: 1px solid var(--line); }
  .review-button { display: flex; align-items: center; gap: 8px; padding: 0; color: var(--muted); font: 10px var(--mono); }
  .review-button[aria-pressed='true'] { color: var(--green); }
  .review-row small { color: var(--faint); font-size: 9px; }
  .chapter-navigation { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); margin-top: 5px; }
  .chapter-navigation button { text-align: left; padding: 22px 12px 5px 0; min-width: 0; }
  .chapter-navigation button + button { text-align: right; padding-inline: 12px 0; }
  .chapter-navigation span { display: block; color: var(--faint); font: 8px var(--mono); letter-spacing: .05em; }
  .chapter-navigation strong { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 6px; }
  .chapter-navigation button:disabled { opacity: .35; cursor: default; }
  .notes-panel { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 20px; }
  .note-caption, .note-save { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--faint); font: 8px var(--mono); }
  .note-caption { margin-bottom: 12px; }
  #note-reference { color: var(--accent); }
  #notebook { width: 100%; flex: 1; min-height: 150px; border: 0; border-bottom: 1px solid var(--line); padding: 0 0 15px; background-color: transparent; background-image: repeating-linear-gradient(transparent 0 27px, var(--line) 27px 28px); background-attachment: local; font: 11px/28px var(--mono); }
  #notebook::placeholder { color: var(--faint); }
  .note-save { margin: 12px 0 20px; }
  .note-guidance { display: flex; gap: 11px; color: var(--faint); font-size: 10px; line-height: 1.9; padding-bottom: 20px; }
  .note-guidance > span { color: var(--accent); }
  .notes-panel .secondary-button { width: 100%; font-size: 9px; }
  .tools-panel { padding: 20px; flex: 1; min-height: 0; }
  .tool-label { display: block; font: 8px var(--mono); color: var(--faint); letter-spacing: .06em; margin-bottom: 8px; }
  #tool-method { width: 100%; padding: 9px; font: 10px var(--mono); }
  .tool-description { font-size: 10px; line-height: 1.8; color: var(--muted); margin: 11px 0 18px; }
  #tool-parameter-row { margin-bottom: 16px; }
  #tool-parameter { width: 100%; padding: 9px; font: 11px var(--mono); }
  #tool-input, #tool-output { width: 100%; height: 128px; padding: 10px; font: 11px/1.8 var(--mono); overflow-wrap: anywhere; }
  .tools-panel > .primary-button { width: 100%; margin: 12px 0 21px; }
  .tool-output-header { display: flex; align-items: center; justify-content: space-between; }
  .tool-output-header button { font-size: 9px; margin-bottom: 8px; }
  .tool-error { color: var(--danger); font-size: 10px; line-height: 1.7; margin-top: 8px; }
  .tool-footnote { color: var(--faint); font-size: 9px; line-height: 1.8; margin-top: 16px; }
  dialog { padding: 0; color: var(--text); background: var(--bg); border: 1px solid var(--line); max-width: calc(100vw - 18px); }
  dialog::backdrop { background: #000b; }
  #case-dialog, #workbench-dialog { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: 360px; }
  #case-dialog .sidebar { padding-top: 22px; }
  .modal-only { display: none; }
  dialog .modal-only, dialog .mobile-only { display: block; }
  dialog .workbench-header { min-height: 60px; }
  .toast { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 100; width: max-content; max-width: calc(100vw - 30px); padding: 11px 17px; border: 1px solid var(--accent); border-radius: 3px; background: var(--raised); color: var(--text); font: 11px/1.8 var(--mono); }
  .noscript { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; background: var(--bg); padding: 30px; }
  .noscript h1 { font-size: 24px; margin-bottom: 15px; }
  .noscript p { max-width: 55ch; color: var(--muted); }
}
@layer responsive {
  @media (min-width: 1180px) { .chapter-layout { grid-template-columns: minmax(0, 1fr) 290px; } #workbench-slot { display: block; } }
  @media (min-width: 1500px) { .app-body { grid-template-columns: 260px minmax(0, 1fr); } .chapter-layout { grid-template-columns: minmax(0, 1fr) 330px; } .reader { padding-inline: 6vw; } .overview { padding-inline: 6vw; } .overview-hero { max-width: 1200px; margin-bottom: 50px; } .case-table, .directory-heading, .overview-foot { max-width: 1200px; } }
  @media (max-width: 1000px) {
    .app-body { grid-template-columns: 198px minmax(0, 1fr); }
    .topbar { padding-inline: 20px; }
    .topbar-right { gap: 16px; }
    .case-item { padding-inline: 16px; gap: 6px; }
    .sidebar-heading, .sidebar-section { padding-inline: 18px; }
    .chapter-link { padding-inline: 18px 13px; gap: 6px; }
    .workspace-bar { padding-inline: 23px; }
    .overview { padding: 30px 27px 24px; }
    .overview-hero { gap: 20px; }
    .overview h1 { font-size: 39px; }
    .hero-copy { font-size: 11px; }
    .map-label, .map-bottom { font-size: 6px; }
    .directory-heading > span { font-size: 7px; }
    .directory-heading h2 { font-size: 12px; }
    .file-row { gap: 13px; padding-block: 17px; }
    .file-row h3 { font-size: 15px; }
    .file-row p { font-size: 10px; }
    .file-row-meta { max-width: 90px; }
    .overview-foot { font-size: 8px; }
  }
  @media (max-width: 760px) {
    .app { grid-template-rows: 60px minmax(0, 1fr) 27px; }
    .app-body { grid-template-columns: minmax(0, 1fr); }
    #sidebar-slot { display: none; }
    .mobile-only { display: block; }
    .topbar { padding-inline: 15px; gap: 12px; }
    .brand { font-size: 10px; gap: 8px; }
    .brand img { width: 28px; height: 28px; }
    .brand small { font-size: 8px; }
    .local-indicator { display: none; }
    .topbar-right { gap: 8px; }
    .source-link { font-size: 9px; }
    .quiet-button { font-size: 9px; }
    .main { grid-template-rows: 43px minmax(0, 1fr); }
    .workspace-bar { padding-inline: 12px; gap: 8px; }
    .breadcrumbs { font-size: 9px; gap: 7px; }
    .workspace-actions { gap: 5px; }
    #resume-header { display: none; }
    .overview { padding: 27px 23px 24px; }
    .overview-hero { grid-template-columns: 1fr; margin-bottom: 27px; }
    .overview h1 { font-size: 47px; }
    .eyebrow { font-size: 8px; margin-bottom: 16px; }
    .hero-copy { font-size: 12px; margin: 17px 0 20px; }
    .signal-map { display: none; }
    .directory-heading { gap: 10px; align-items: flex-start; }
    .directory-heading h2 { font-size: 12px; max-width: 23ch; }
    .directory-heading > span { max-width: 70px; text-align: right; white-space: normal; line-height: 1.8; }
    .file-row { grid-template-columns: 23px minmax(0, 1fr) 15px; gap: 12px; padding-block: 19px; }
    .file-row h3 { font-size: 16px; }
    .file-row p { font-size: 11px; line-height: 1.7; }
    .file-row-meta { grid-column: 2; max-width: none; display: flex; text-align: left; gap: 10px; align-items: center; }
    .file-row-meta > span, .file-row-meta small { font-size: 8px; margin: 0; }
    .file-arrow { grid-column: 3; grid-row: 1 / span 2; }
    .overview-foot { display: block; font-size: 8px; }
    .overview-foot button { margin-top: 13px; }
    .reader { padding: 23px 23px 28px; }
    .reader h1 { font-size: 29px; margin-bottom: 22px; }
    .reader-meta { font-size: 8px; padding-bottom: 17px; }
    .chapter-kicker { margin-top: 23px; font-size: 9px; }
    .chapter-body { font-size: 13px; line-height: 1.9; }
    .evidence pre, .evidence blockquote { font-size: 11px; padding: 14px; }
    .evidence-heading { padding-inline: 12px; }
    .evidence-actions { gap: 12px; }
    .review-row { align-items: flex-start; flex-direction: column; gap: 8px; }
    .chapter-navigation strong { font-size: 10px; line-height: 1.7; }
    .status-bar { padding-inline: 12px; font-size: 8px; }
    .footer-hint, .footer-hint + .status-separator { display: none; }
    .status-separator { padding-inline: 4px; }
    .notes-panel, .tools-panel { padding: 20px; }
    #notebook, #tool-input, #tool-output, #tool-parameter, #tool-method { font-size: 16px; }
    #notebook::placeholder, #tool-input::placeholder, #tool-output::placeholder { font-size: 12px; }
  }
  @media (max-width: 360px) { .brand small, .source-link { display: none; } .overview { padding-inline: 18px; } .overview h1 { font-size: 41px; } .reader { padding-inline: 18px; } .workspace-bar { padding-inline: 9px; } #workbench-open { font-size: 8px; } }
}
