@charset "UTF-8";
@import url("https://fonts.googleapis.com/css2?family=Google+Sans+Flex:opsz,wght@6..144,1..1000&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

:root {
  --dora-black: rgb(34, 30, 39);
  --bg: white;
  --surface: rgb(250, 249, 247);
  --surface2: rgb(240, 238, 234);
  --border: rgb(214, 208, 242);
  --accent: rgb(11, 57, 84);
  --accent-dim: rgb(73, 160, 236);
  --viz-primary: rgb(73, 160, 236);
  --viz-compare: rgb(111, 84, 214);
  --viz-handle: rgb(232, 168, 56);
  --danger: rgb(245, 90, 36);
  --warn: rgb(240, 225, 90);
  --text: color-mix(in srgb, var(--dora-black), white 12%);
  --text-bright: color-mix(in srgb, var(--dora-black), white 5%);
  --text-dim: color-mix(in srgb, var(--dora-black), white 38%);
  --mono: "Roboto", Arial, Helvetica, sans-serif;
  --sans: "Latin Modern Roman", "Times New Roman", Times, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
  .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;
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    min-height: 100vh;
  }

  header {
    border-bottom: 1px solid var(--border);
    padding: 2rem 2rem 1.5rem;
    position: relative;
  }

  .header-eyebrow {
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.6rem;
  }

  h1 {
    font-family: var(--mono);
    font-size: clamp(1.1rem, 3vw, 1.8rem);
    font-weight: 500;
    color: var(--text-bright);
    line-height: 1.25;
    max-width: 700px;
  }

  h1 .sub {
    display: block;
    font-size: 0.65em;
    font-weight: 300;
    color: var(--text-dim);
    margin-top: 0.3rem;
    font-style: italic;
  }

  .paper-links {
    display: flex;
    flex-wrap: nowrap;
    gap: clamp(0.45rem, 1vw, 1.15rem);
    align-items: center;
  }

  .paper-links a,
  .paper-links button {
    border: none;
    background: none;
    color: var(--accent-dim);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding: 0;
    font-size: clamp(8px, 0.82vw, 10px);
    cursor: pointer;
    height: auto;
    line-height: 1.35;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    white-space: nowrap;
    font-family: inherit;
  }

  .paper-links .paper-link-primary {
    color: var(--accent);
    font-weight: 500;
  }

  .paper-links a:hover,
  .paper-links button:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
  }

  .paper-links a:focus-visible,
  .paper-links button:focus-visible {
    outline: 1px dashed var(--accent-dim);
    outline-offset: 2px;
  }

  .layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    grid-template-rows: auto 1fr;
    min-height: calc(100vh - 130px);
  }

  @media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .controls-panel { border-right: none; border-bottom: 1px solid var(--border); }
  }

  .controls-panel {
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
  }

  .panel-section {
    margin-bottom: 1.8rem;
  }

  .panel-section-label,
  .section-toggle {
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
    margin-bottom: 1rem;
  }

  .section-toggle {
    width: 100%;
    background: transparent;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding-top: 0;
    position: relative;
    box-shadow: 0 7px 11px -12px rgba(0, 0, 0, 0.45);
  }

  .section-toggle::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 6px;
    pointer-events: none;
    background: linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.07),
      rgba(0, 0, 0, 0)
    );
  }

  .section-toggle > span:first-child {
    flex: 1;
  }

  .section-toggle-hint {
    font-size: 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    opacity: 0.78;
    transition: opacity 0.2s ease;
  }

  .panel-section.collapsed .section-toggle-hint {
    opacity: 1;
  }

  .section-chevron {
    color: var(--text-dim);
    font-size: 12px;
    transform: rotate(0deg);
    transition: transform 0.2s ease;
  }

  .panel-section.collapsed .section-chevron {
    transform: rotate(-90deg);
  }

  .section-content {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.24s ease, opacity 0.2s ease;
    opacity: 1;
  }

  .panel-section.collapsed .section-content {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
  }

  .control-row {
    margin-bottom: 1rem;
  }

  .control-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.3rem;
  }

  .control-label {
    color: var(--text-bright);
    font-size: 12px;
  }

  .control-label .sym {
    color: var(--accent);
    font-weight: 600;
  }

  .control-value {
    font-size: 11px;
    color: var(--accent);
    min-width: 3.5em;
    text-align: right;
  }

  .control-desc {
    font-size: 10px;
    color: var(--text-dim);
    font-style: italic;
    margin-bottom: 0.4rem;
    line-height: 1.4;
  }

  input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
  }

  input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: background 0.15s;
  }

  input[type=range]::-webkit-slider-thumb:hover {
    background: #fff;
  }

  input[type=range].warn::-webkit-slider-thumb { background: var(--warn); }
  input[type=range].danger::-webkit-slider-thumb { background: var(--danger); }
  input[type=range].semantic-good::-webkit-slider-thumb {
    background: #28a745;
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.55);
    animation: sliderPulseGood 0.52s ease-out;
  }
  input[type=range].semantic-bad::-webkit-slider-thumb {
    background: #d93025;
    box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.55);
    animation: sliderPulseBad 0.52s ease-out;
  }
  input[type=range].semantic-tradeoff::-webkit-slider-thumb {
    background: #f4b400;
    box-shadow: 0 0 0 0 rgba(244, 180, 0, 0.55);
    animation: sliderPulseTradeoff 0.52s ease-out;
  }

  input[type=range]::-moz-range-thumb {
    width: 13px; height: 13px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
  }
  input[type=range].semantic-good::-moz-range-thumb {
    background: #28a745;
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.55);
  }
  input[type=range].semantic-bad::-moz-range-thumb {
    background: #d93025;
    box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.55);
  }
  input[type=range].semantic-tradeoff::-moz-range-thumb {
    background: #f4b400;
    box-shadow: 0 0 0 0 rgba(244, 180, 0, 0.55);
  }

  @keyframes sliderPulseGood {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.55); }
    100% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
  }
  @keyframes sliderPulseBad {
    0% { box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.55); }
    100% { box-shadow: 0 0 0 10px rgba(217, 48, 37, 0); }
  }
  @keyframes sliderPulseTradeoff {
    0% { box-shadow: 0 0 0 0 rgba(244, 180, 0, 0.55); }
    100% { box-shadow: 0 0 0 10px rgba(244, 180, 0, 0); }
  }

  .presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .preset-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--mono);
    font-size: 10px;
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, color 0.15s;
    line-height: 1.3;
  }

  .preset-btn:hover {
    border-color: var(--accent);
    color: var(--text-bright);
  }

  .preset-btn.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-dim), white 70%);
    color: var(--text-bright);
    font-weight: 600;
  }

  .preset-btn .preset-name {
    display: block;
    font-weight: 500;
    color: var(--accent);
    font-size: 10px;
  }

  .preset-btn .preset-pinst {
    display: block;
    margin-top: 2px;
    font-size: 9px;
    color: var(--text-dim);
    letter-spacing: 0.02em;
  }

  .preset-btn.active .preset-pinst,
  .preset-btn:hover .preset-pinst {
    color: var(--accent);
  }

  .control-inline {
    margin-top: 0.6rem;
    font-size: 10px;
    color: var(--text-dim);
  }

  .control-inline label {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    cursor: pointer;
  }

  .control-inline select {
    margin-top: 0.35rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0.2rem 0.35rem;
    font-size: 10px;
    width: 100%;
  }

  .control-row.lens-dora {
    border-left: 3px solid var(--viz-handle);
    background: color-mix(in srgb, var(--surface), var(--viz-handle) 8%);
    padding-left: 0.45rem;
    border-radius: 4px;
  }

  .control-row.lens-latent {
    opacity: 0.55;
    filter: saturate(0.55);
  }

  .output-panel {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .output-primary {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
  }

  .output-score {
    flex: 0 0 auto;
  }

  .score-label {
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 0.2rem;
  }

  .score-value {
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    font-weight: 500;
    line-height: 1;
    color: var(--accent);
    transition: color 0.4s;
  }

  .score-value.warn { color: var(--warn); }
  .score-value.danger { color: var(--danger); }

  .score-unit {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 0.2rem;
  }

  .health-bars {
    flex: 1 1 200px;
  }

  .health-bar-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
  }

  .health-bar-label {
    width: 3.5rem;
    font-size: 10px;
    color: var(--text-dim);
    flex-shrink: 0;
  }

  .health-bar-track {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
  }

  .health-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.3s ease, background 0.3s;
  }

  .health-bar-fill.warn { background: var(--warn); }
  .health-bar-fill.danger { background: var(--danger); }

  .health-bar-val {
    width: 3.5rem;
    font-size: 10px;
    color: var(--text-dim);
    text-align: right;
    flex-shrink: 0;
  }

  .equation-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-dim);
    padding: 1.2rem 1.4rem;
    font-family: "Latin Modern Roman", "Times New Roman", serif;
  }

  .equation-hero {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
  }

  .equation-kicker {
    font-size: 15px;
    color: var(--accent);
    letter-spacing: 0.02em;
  }

  .equation-block h3 {
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0;
  }

  .equation-katex-area .katex-display {
    margin: 0.4rem 0;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .eq-main {
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface2), white 50%);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    margin-bottom: 0.6rem;
  }

  .eq-side-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .eq-side-card {
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface2), white 45%);
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
  }

  .eq-side-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 0.2rem;
    font-family: var(--mono);
  }

  .eq-meta {
    margin-top: 0.5rem;
    font-size: 10px;
    color: var(--text-dim);
    font-family: var(--mono);
  }

  .viz-mode {
    background: var(--surface);
    border: 1px solid var(--border);
  }

  .viz-mode-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
  }

  .viz-mode-tab {
    flex: 1;
    border: none;
    border-right: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    padding: 0.65rem 0.8rem;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .viz-mode-tab:last-child { border-right: none; }
  .viz-mode-tab.active {
    color: var(--text-bright);
    background: var(--surface);
    box-shadow: inset 0 -2px 0 var(--accent-dim);
  }

  .viz-mode-panel { display: none; padding: 1rem; }
  .viz-mode-panel.active { display: block; }

  .chart-section {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1.2rem;
  }

  .chart-section h3 {
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
  }

  .sweep-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 280px;
  }

  .sweep-tabs {
    background: var(--surface2);
    display: flex;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sweep-tabs::-webkit-scrollbar { display: none; }

  .sweep-tab {
    flex: 1 1 auto;
    padding: 0.55rem 0.8rem;
    font-family: var(--mono);
    font-size: 10px;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    border-bottom: 2px solid transparent;
    color: var(--text-dim);
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    line-height: 1.35;
  }
  .sweep-tab:last-child { border-right: none; }
  .sweep-tab .tab-sym {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 1px;
    transition: color 0.15s;
  }
  .sweep-tab:hover { background: var(--surface2); color: var(--text); }
  .sweep-tab.active {
    background: var(--surface);
    color: var(--text-bright);
    border-bottom-color: var(--accent);
  }
  .sweep-tab.active .tab-sym { color: var(--accent); }

  .sweep-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.9rem 1.2rem 0.7rem;
    gap: 0.5rem;
  }

  .sweep-title {
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
  }

  .sweep-thesis {
    font-size: 10px;
    color: var(--text-dim);
    font-style: italic;
    line-height: 1.4;
  }

  .cfr-toggle {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    font-size: 10px;
    color: var(--text-dim);
  }
  .cfr-toggle button {
    font-family: var(--mono);
    font-size: 10px;
    padding: 0.2rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
  }
  .cfr-toggle button.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--text-bright);
  }

  canvas#sparkline {
    width: 100%;
    height: 150px;
    display: block;
    flex-shrink: 0;
  }

  .chart-legend {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
  }

  .legend-item {
    font-size: 10px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .legend-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .diagnosis {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1.2rem 1.4rem;
    font-size: 12px;
    color: var(--text);
    line-height: 1.7;
    font-style: italic;
  }

  .diagnosis strong {
    color: var(--text-bright);
    font-style: normal;
  }

  .diagnosis .label {
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-style: normal;
    display: block;
    margin-bottom: 0.5rem;
  }

  footer {
    border-top: 1px solid var(--border);
    padding: 0.85rem clamp(1rem, 2vw, 2rem);
    font-size: clamp(9px, 0.9vw, 11px);
    color: var(--text-dim);
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: clamp(0.75rem, 1.75vw, 1.75rem);
  }

  .footer-meta {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: clamp(0.45rem, 1vw, 1.15rem);
    line-height: 1.45;
    white-space: nowrap;
  }

  .footer-meta a {
    color: var(--accent-dim);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-dim);
  }

  .footer-meta a:hover { color: var(--accent); border-color: var(--accent); }

  footer a {
    color: var(--accent-dim);
    text-decoration: none;
  }

  footer a:hover { color: var(--accent); }

  footer .paper-links {
    justify-content: flex-end;
    min-width: 0;
  }

  @media (max-width: 760px) {
    footer {
      grid-template-columns: minmax(0, 1fr);
      align-items: start;
      gap: 0.7rem;
    }

    footer .paper-links {
      padding-top: 0.65rem;
      border-top: 1px solid color-mix(in srgb, var(--border), white 35%);
      display: grid;
      grid-template-columns: repeat(2, minmax(0, max-content));
      justify-content: start;
      column-gap: 1.5rem;
      row-gap: 0.6rem;
    }
  }

  @media (max-width: 560px) {
    .footer-meta {
      display: grid;
      gap: 0.22rem;
      white-space: normal;
    }

    footer .paper-links {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      column-gap: 0.75rem;
    }

    .paper-links a,
    .paper-links button {
      justify-content: flex-start;
      white-space: normal;
    }
  }

  .tip {
    cursor: help;
    border-bottom: 1px dashed var(--text-dim);
  }

  .tdr-dynamics {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--warn);
    padding: 1rem 1.4rem;
  }

  .tdr-dynamics h3 {
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--warn);
    margin-bottom: 0.6rem;
  }

  .tdr-formula-note {
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 0.55rem;
    font-style: italic;
  }

  .tdr-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
  }

  .tdr-term {
    font-size: 11px;
    color: var(--text);
  }

  .tdr-term .tdr-sym { color: var(--warn); }
  .tdr-term .tdr-val { color: var(--text-bright); }

  .time-panel {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
  }

  .advanced-panel {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
  }

  .advanced-controls {
    border: 1px solid var(--border);
    background: var(--surface2);
    padding: 0.55rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
  }

  .advanced-control-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .advanced-series label {
    text-transform: none;
    letter-spacing: 0;
    font-size: 10px;
  }

  .advanced-controls select,
  .advanced-controls button {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0.22rem 0.45rem;
    font-size: 10px;
  }

  #advanced-canvas {
    width: 100%;
    height: 200px;
    border: 1px solid var(--border);
    background: white;
    cursor: ew-resize;
  }

  .time-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .time-row {
    display: grid;
    grid-template-columns: 9rem 1fr auto;
    align-items: center;
    gap: 0.5rem;
  }

  .time-row label,
  .time-actions label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .time-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .integration-step {
    font-size: 10px;
    color: var(--text-dim);
    border: 1px dashed var(--border);
    background: color-mix(in srgb, var(--surface2), white 45%);
    padding: 0.28rem 0.45rem;
    width: fit-content;
  }

  .integration-step.active {
    animation: integratePulse 0.9s ease-in-out infinite;
    color: var(--accent);
    border-color: var(--accent-dim);
  }

  @keyframes integratePulse {
    0% { box-shadow: 0 0 0 0 rgba(73, 160, 236, 0.25); }
    70% { box-shadow: 0 0 0 7px rgba(73, 160, 236, 0); }
    100% { box-shadow: 0 0 0 0 rgba(73, 160, 236, 0); }
  }

.time-actions button,
.control-actions button {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  padding: 0.35rem 0.6rem;
  font-size: 10px;
  cursor: pointer;
}

  .time-actions select {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0.2rem 0.4rem;
    font-size: 10px;
  }

  .time-val {
    font-size: 10px;
    color: var(--text-dim);
  }

  #sim-canvas {
    width: 100%;
    height: 180px;
    border: 1px solid var(--border);
    background: white;
  }

  .sim-readout {
    font-size: 11px;
    color: var(--text);
    border: 1px solid var(--border);
    background: var(--surface2);
    padding: 0.5rem 0.6rem;
  }

  .sim-ticker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.45rem;
  }

  .sim-assumption-banner {
    font-size: 10px;
    color: var(--text-dim);
    border: 1px solid var(--border);
    background: var(--surface2);
    padding: 0.45rem 0.6rem;
    line-height: 1.35;
  }

  .sim-ticker > div {
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 0.35rem 0.45rem;
    font-size: 11px;
    color: var(--text);
  }

  .ticker-label {
    color: var(--text-dim);
    font-size: 10px;
    margin-right: 0.3rem;
  }

.control-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.55rem;
}

  .state-chip {
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text-dim);
    padding: 0.45rem 0.6rem;
    font-size: 10px;
    letter-spacing: 0.01em;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .diag-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
  }

  .diag-card {
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 0.8rem;
    font-size: 11px;
    color: var(--text);
    line-height: 1.5;
  }

  .diag-card .label {
    display: block;
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
  }

#gum-tooltip {
  position: fixed;
  z-index: 55;
  max-width: 300px;
  padding: 0.45rem 0.6rem;
  background: var(--accent);
  color: white;
  font-size: 11px;
  line-height: 1.45;
  border-radius: 5px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

#gum-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-stack {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -42%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  z-index: 40;
  pointer-events: none;
}

.toast-stack.quiet {
  left: auto;
  top: auto;
  transform: none;
  right: 1rem;
  bottom: 1rem;
  align-items: flex-end;
}

.toast {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  background: var(--accent);
  color: white;
  padding: 0.7rem 0.95rem;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  max-width: min(88vw, 640px);
  text-align: center;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.toast-stack.quiet .toast {
  padding: 0.5rem 0.7rem;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 400;
  max-width: min(84vw, 440px);
  text-align: left;
  box-shadow: none;
}

.paper-modal-overlay[hidden] {
  display: none;
}

.paper-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.paper-modal {
  width: min(920px, 96vw);
  max-height: 88vh;
  overflow: hidden;
  border: 1px solid var(--border);
  background: white;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
}

.paper-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.paper-modal-head h2 {
  font-family: "Latin Modern Roman", "Times New Roman", serif;
  font-size: 1.05rem;
  color: var(--text-bright);
}

.paper-modal-close {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  padding: 0.3rem 0.55rem;
  font-size: 10px;
  cursor: pointer;
}

.paper-modal-body {
  padding: 0.9rem 1rem 1rem;
  overflow: auto;
  font-family: "Latin Modern Roman", "Times New Roman", serif;
  line-height: 1.55;
  color: var(--text);
}

.paper-modal-body h3 {
  font-size: 0.95rem;
  margin-top: 0.9rem;
  margin-bottom: 0.35rem;
  color: var(--text-bright);
}

.paper-modal-body p {
  margin: 0.35rem 0 0.65rem;
}

  .toast.visible {
    opacity: 1;
    transform: translateY(0);
  }

  @media (max-width: 1000px) {
    .eq-side-grid {
      grid-template-columns: 1fr;
    }
    .diag-grid {
      grid-template-columns: 1fr;
    }
    .time-row {
      grid-template-columns: 1fr;
      gap: 0.3rem;
    }
    .sim-ticker {
      grid-template-columns: 1fr;
    }
  }

/* Standalone README / presentation field guide
   ----------------------------------------------
   All documentation rules are scoped to .readme-page so this stylesheet can
   serve both GUT.html and field-guide.html without changing the explorer UI. */

body.readme-page {
  --readme-measure: 78ch;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--viz-primary), white 93%) 0, transparent 18rem),
    var(--surface);
  color: var(--text);
  font-family: "Roboto", Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

.readme-page .skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.55rem 0.8rem;
  background: var(--accent);
  color: white;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform 0.15s ease;
}

.readme-page .skip-link:focus {
  transform: translateY(0);
}

.readme-page .readme-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
  padding: 0.65rem max(1rem, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid color-mix(in srgb, var(--border), var(--accent) 10%);
  background: color-mix(in srgb, white, transparent 7%);
  box-shadow: 0 8px 24px rgba(11, 57, 84, 0.06);
  backdrop-filter: blur(12px);
}

.readme-page .readme-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.readme-page .readme-nav-mark {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2rem;
  flex: 0 0 auto;
  border-radius: 2px;
  background: var(--accent);
  color: white;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.readme-page .readme-nav-action {
  flex: 0 0 auto;
  padding: 0.38rem 0.62rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  text-decoration: none;
}

.readme-page .readme-nav-action:hover {
  color: var(--viz-compare);
}

.readme-page .readme-nav a:focus-visible,
.readme-page .github-markdown-content a:focus-visible {
  outline: 2px solid var(--viz-handle);
  outline-offset: 3px;
}

.readme-page .github-markdown-body {
  width: min(100% - 2rem, 960px);
  margin: clamp(1rem, 4vw, 3.5rem) auto;
  border: 1px solid color-mix(in srgb, var(--border), white 12%);
  background: var(--bg);
  box-shadow: 0 18px 50px rgba(34, 30, 39, 0.08);
}

.readme-page .github-markdown-content {
  max-width: var(--readme-measure);
  margin: 0 auto;
  padding: clamp(1.4rem, 5vw, 4.5rem);
}

.readme-page .github-markdown-content > :first-child {
  margin-top: 0;
}

.readme-page .github-markdown-content > :last-child {
  margin-bottom: 0;
}

.readme-page .github-markdown-content h1,
.readme-page .github-markdown-content h2,
.readme-page .github-markdown-content h3 {
  scroll-margin-top: 5rem;
  color: var(--text-bright);
}

.readme-page .github-markdown-content h1 {
  margin: 3.8rem 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent);
  font-family: "Roboto", Arial, Helvetica, sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.65rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.readme-page .github-markdown-content h1:first-of-type {
  position: relative;
  margin-bottom: 1.25rem;
  padding-top: 1.6rem;
  border-bottom-color: var(--viz-primary);
}

.readme-page .github-markdown-content h1:first-of-type::before {
  content: "GUM GRAPH (GUT) · FIELD GUIDE";
  position: absolute;
  top: 0;
  left: 0;
  color: var(--viz-compare);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.15em;
}

.readme-page .github-markdown-content h2 {
  margin: 3rem 0 0.8rem;
  font-family: "Roboto", Arial, Helvetica, sans-serif;
  font-size: clamp(1.3rem, 2.5vw, 1.75rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.readme-page .github-markdown-content h3 {
  margin: 2rem 0 0.55rem;
  font-family: "IBM Plex Sans", "Roboto", sans-serif;
  font-size: 1.03rem;
  font-weight: 500;
  line-height: 1.4;
}

.readme-page .github-markdown-content p {
  margin: 0 0 1rem;
}

.readme-page .github-markdown-content a {
  color: var(--accent);
  text-decoration-color: var(--accent-dim);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.readme-page .github-markdown-content a:hover {
  color: var(--viz-compare);
  text-decoration-color: currentColor;
}

.readme-page .github-markdown-content strong {
  color: var(--text-bright);
  font-weight: 600;
}

.readme-page .github-markdown-content ul,
.readme-page .github-markdown-content ol {
  margin: 0 0 1.2rem;
  padding-left: 1.5rem;
}

.readme-page .github-markdown-content li {
  margin: 0.38rem 0;
  padding-left: 0.2rem;
}

.readme-page .github-markdown-content li::marker {
  color: var(--viz-compare);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
}

.readme-page .github-markdown-content blockquote {
  position: relative;
  margin: 1.25rem 0 1.65rem;
  padding: 1rem 1.15rem 1rem 1.35rem;
  border-left: 4px solid var(--viz-handle);
  background: color-mix(in srgb, var(--warn), white 78%);
  color: color-mix(in srgb, var(--text), var(--accent) 12%);
  font-family: "IBM Plex Sans", "Roboto", sans-serif;
  font-size: 0.95rem;
  font-style: italic;
}

.readme-page .github-markdown-content blockquote p:last-child {
  margin-bottom: 0;
}

.readme-page .github-markdown-content hr {
  height: 1px;
  margin: 3.2rem 0;
  border: 0;
  background: linear-gradient(90deg, var(--viz-primary), var(--viz-compare), transparent);
}

.readme-page .github-markdown-content table {
  display: block;
  width: 100%;
  margin: 1.25rem 0 1.75rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-collapse: collapse;
  font-size: 0.88rem;
}

.readme-page .github-markdown-content th,
.readme-page .github-markdown-content td {
  min-width: 9rem;
  padding: 0.68rem 0.75rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.readme-page .github-markdown-content th {
  background: var(--accent);
  color: white;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.035em;
}

.readme-page .github-markdown-content tbody tr:nth-child(even) {
  background: var(--surface);
}

.readme-page .github-markdown-content code {
  padding: 0.12em 0.32em;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.86em;
}

@media (max-width: 600px) {
  .readme-page .readme-nav {
    min-height: 3.25rem;
  }

  .readme-page .readme-nav-brand > span:last-child {
    display: none;
  }

  .readme-page .github-markdown-body {
    width: 100%;
    margin: 0;
    border-right: 0;
    border-left: 0;
    box-shadow: none;
  }

  .readme-page .github-markdown-content h1 {
    margin-top: 3rem;
  }

  .readme-page .github-markdown-content h2 {
    margin-top: 2.4rem;
  }
}

/* Standalone posts (supplementary notes, errata, and similar essays)
   -------------------------------------------------------------------
   A .readme-page variant with a "middle" reading measure: wider than the
   field guide's abstract-width column (--readme-measure, 78ch) but narrower
   than the landing page's full-card width. Justified, hyphenated body prose
   (needs the page's lang="en") gives these a LaTeX-like feel. An abstract or
   introductory block stays at the narrow measure by wrapping it in
   .post-abstract.

   Tuning: --readme-measure is the body line width; --post-abstract-measure
   is the abstract line width. The card width is inherited from .readme-page
   (960px) and is intentionally left unchanged. */
body.readme-page.post-page {
  --readme-measure: 95ch;            /* ~15% wider than the 78ch narrow measure */
  --post-abstract-measure: 85ch;
}

.readme-page.post-page .github-markdown-content p {
  text-align: justify;
  text-wrap: pretty;
  hyphens: auto;
}

/* Abstract / intro block keeps the narrow measure and is centered within the
   body column, so it gets equal left/right inset relative to the section text
   below it (like a LaTeX abstract, which is indented on both sides).

   Note: --readme-measure is the content column's max-width *including* its
   side padding, so the actual text area is already narrower than 90ch. Using
   max-width:78ch here would exceed that text area and never apply. Instead we
   pull the abstract in from the body text width (100%) by the difference
   between the two measures (90ch - 78ch = 12ch) — a padding-independent delta,
   so the abstract stays exactly that much narrower whatever the padding, split
   evenly across both sides by the auto margins. */
.readme-page.post-page .github-markdown-content .post-abstract {
  max-width: calc(100% - (var(--readme-measure) - var(--post-abstract-measure)));
  margin-inline: auto;
}

/* On narrow (portrait phone) screens the column is already tight, so the fixed
   12ch inset leaves the abstract eye-crossingly narrow. Below the mobile
   breakpoint, let it fill the column like normal body text. */
@media (max-width: 600px) {
  .readme-page.post-page .github-markdown-content .post-abstract {
    max-width: none;
  }
}

/* Title + subtitle: an H2 immediately after the leading H1 is a subheading,
   not a new section, so group it tightly under the title instead of leaving
   the default 3rem section gap (which the two margins otherwise collapse to).
   Scoped to this exact pair via :has()/+, so the numbered section H2s and
   posts that open H1 -> paragraph (e.g. the errata) keep their normal spacing. */
.readme-page.post-page .github-markdown-content h1:first-of-type:has(+ h2) {
  margin-bottom: 0.3rem;
}

.readme-page.post-page .github-markdown-content h1:first-of-type + h2 {
  margin-top: 1rem;
  /* Subtitle sizing: a step up from H3 (1.03rem), well below the section
     H2s (clamp up to 1.75rem). Fixed rather than clamped since it's short. */
  font-size: 1.2rem;
}

#abstract {
  font-size: 1.2rem;
}

.abstract hr {
  mnargin: 2em;
}

/* Inline image-on-hover — a term that is NOT a link but reveals a small image
   when hovered or keyboard-focused (visual asides / jokes). A dotted underline
   signals it's interactive without implying navigation. Markup:
     <span class="img-hover" tabindex="0">term<span class="img-hover__pop">
       <img src="..." alt="..."></span></span> */
.readme-page .github-markdown-content .img-hover {
  position: relative;
  border-bottom: 1px dotted var(--accent-dim);
  cursor: help;
  outline: none;
}

.readme-page .github-markdown-content .img-hover:focus-visible {
  outline: 2px solid var(--viz-handle);
  outline-offset: 2px;
}

.readme-page .github-markdown-content .img-hover__pop {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%) translateY(4px);
  z-index: 60;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: 0 12px 28px rgba(34, 30, 39, 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.readme-page .github-markdown-content .img-hover__pop img {
  display: block;
  width: 240px;
  max-width: 60vw;
  height: auto;
  border-radius: 3px;
}

.readme-page .github-markdown-content .img-hover:hover .img-hover__pop,
.readme-page .github-markdown-content .img-hover:focus-within .img-hover__pop {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Inline term gloss — like .img-hover, but the popup is a toast-style text
   blurb (accent bubble, white text, mirroring the .toast styling) instead of
   an image. For defining jargon on first use without navigating anywhere.
   Markup:
     <span class="term-tip" tabindex="0">term<span class="term-tip__pop"
       role="tooltip">definition…</span></span> */
.readme-page .github-markdown-content .term-tip {
  position: relative;
  border-bottom: 2px dotted var(--accent-dim);
  cursor: help;
  outline: none;
}

.readme-page .github-markdown-content .term-tip:focus-visible {
  outline: 2px solid var(--viz-handle);
  outline-offset: 2px;
}

.readme-page .github-markdown-content .term-tip__pop {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  z-index: 60;
  width: max-content;
  max-width: min(320px, 80vw);
  padding: 0.6rem 0.8rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.5;
  text-align: left;
  text-wrap: pretty;
  hyphens: none;
  border-radius: 7px;
  box-shadow: 0 12px 28px rgba(34, 30, 39, 0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.readme-page .github-markdown-content .term-tip:hover .term-tip__pop,
.readme-page .github-markdown-content .term-tip:focus-within .term-tip__pop {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Live-KaTeX pages hide the content until math renders, avoiding a flash of raw
   LaTeX source. The class is set by an inline <head> script, so it is never
   applied when JS is disabled, and a failsafe timeout removes it if a script
   fails to load. */
.math-loading .github-markdown-content {
  visibility: hidden;
}

  @media (prefers-reduced-motion: reduce) {
  .readme-page *,
  .readme-page *::before,
  .readme-page *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
