/* Visual style shared with the concurrency.sim app (EpiModel blue). */
:root {
  --bg: #f0f5f9;
  --card: #ffffff;
  --border: #dee2e6;
  --rule: #e8eef3;
  --text: #444444;
  --muted: #666666;
  --blue: #4682b4;
  --blue-dark: #3a6f99;
  --teal: #1a6b54;
  --g1: #2f6ea3;
  --g2: #c0392b;
  --warn-bg: #fff6e0;
  --warn-border: #e8c46a;
  --err-bg: #fdecea;
  --err-border: #e3a29b;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }
html { font-size: 14px; }
body {
  margin: 0;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
.page { max-width: 1240px; margin: 0 auto; padding: 0 16px 16px; }
a { color: var(--blue-dark); text-decoration: none; }
a:hover { color: var(--teal); text-decoration: underline; }

.app-header {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
  color: #fff;
  padding: 1.6rem 2rem;
  margin: 0 -16px 1.25rem;
  border-radius: 0 0 8px 8px;
}
.app-header h1 { font-size: 1.9rem; font-weight: 700; margin: 0 0 0.3rem; line-height: 1.2; }
.app-header p { font-size: 1.1rem; margin: 0; opacity: 0.92; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
  margin: 0 0 1.1rem;
}
.card h2 {
  font-size: 1.2rem; font-weight: 600; color: var(--teal);
  margin: 0 0 0.75rem; padding-bottom: 0.45rem; border-bottom: 2px solid var(--rule);
}
.card p { margin: 0 0 0.7rem; }
.card p:last-child { margin-bottom: 0; }
.card strong { color: var(--teal); }

.intro, .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.intro .card, .two-col .card { margin-bottom: 1.1rem; }

.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 1.1rem; align-items: start; }

/* Controls */
.controls { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.controls h3 {
  font-size: 1.02rem; font-weight: 600; color: var(--teal);
  margin: 1.1rem 0 0.35rem;
}
.field { margin: 0 0 0.7rem; }
.field label { display: block; font-weight: 600; font-size: 0.92rem; color: var(--blue-dark); margin-bottom: 0.15rem; }
.field .row { display: flex; align-items: center; gap: 0.5rem; }
.field input[type="range"] { flex: 1; min-width: 0; accent-color: var(--blue); }
.field input[type="number"] {
  width: 5.6rem; padding: 0.25rem 0.4rem; font: inherit; font-size: 0.92rem;
  border: 1px solid #c9d2da; border-radius: 4px; color: var(--text); background: #fff;
}
.field.wide input[type="number"] { width: 100%; }
.field .help { font-size: 0.8rem; color: var(--muted); margin-top: 0.1rem; }
.field input:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.hint { font-size: 0.82rem; color: var(--muted); margin: -0.3rem 0 0.6rem; }
.hint.bad { color: var(--g2); font-weight: 600; }

.btn-primary, .btn-secondary {
  font: inherit; cursor: pointer; border-radius: 5px; padding: 0.5rem 0.8rem;
}
.btn-primary {
  width: 100%; background: var(--blue); border: 1px solid var(--blue-dark); color: #fff;
  font-weight: 600; font-size: 1rem;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-secondary {
  background: #fff; border: 1px solid #c9d2da; color: var(--blue-dark); font-size: 0.88rem; font-weight: 600;
}
.btn-secondary:hover { border-color: var(--blue); }
.btn-secondary.small { padding: 0.3rem 0.6rem; font-size: 0.82rem; }
.btn-row { display: flex; gap: 0.5rem; margin: 0.4rem 0 0.2rem; }
.btn-row .btn-secondary { flex: 1; }
.check { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; margin: 0.55rem 0 0.2rem; color: var(--text); }

/* Output */
.stale-note, .error-note {
  border-radius: 6px; padding: 0.6rem 0.9rem; margin: 0 0 1rem; font-size: 0.95rem;
}
.stale-note { background: var(--warn-bg); border: 1px solid var(--warn-border); }
.error-note { background: var(--err-bg); border: 1px solid var(--err-border); color: #8a2a20; }
.output.is-stale .plots, .output.is-stale .results { opacity: 0.55; transition: opacity 0.15s; }

.plots { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.plot-card { margin: 0 0 1.1rem; padding: 0.9rem 1rem 0.6rem; }
.plot-card figcaption { font-weight: 600; color: var(--teal); font-size: 1.05rem; margin-bottom: 0.2rem; }
.plot-card .unit { font-weight: 400; color: var(--muted); font-size: 0.88rem; }
.plot { position: relative; width: 100%; aspect-ratio: 4 / 3; min-height: 230px; }
.plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.plot .axis text { fill: #6b7680; font-size: 11px; }
.plot .axis line, .plot .axis path { stroke: #b9c3cc; }
.plot .grid line { stroke: #edf1f4; }
.plot .axis-title { fill: #555; font-size: 12px; }
.line { fill: none; stroke-width: 2.4; }
.line.g1 { stroke: var(--g1); }
.line.g2 { stroke: var(--g2); stroke-dasharray: 7 4; }
.plot .cursor { stroke: #9aa6b1; stroke-width: 1; }
.plot .dot.g1 { fill: var(--g1); }
.plot .dot.g2 { fill: var(--g2); }
.legend { display: flex; gap: 1.1rem; font-size: 0.85rem; color: #555; margin-top: 0.25rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend svg { width: 26px; height: 10px; }
.tip {
  position: absolute; pointer-events: none; background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border); border-radius: 5px; padding: 0.3rem 0.5rem; font-size: 0.8rem;
  box-shadow: var(--shadow); white-space: nowrap; transform: translate(10px, -50%);
}
.tip b { color: var(--teal); }

.results-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 2px solid var(--rule); margin-bottom: 0.8rem; }
.results-head h2 { border: 0; margin: 0; padding-bottom: 0.45rem; }
.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; align-items: start; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tbl caption { text-align: left; font-size: 0.85rem; color: var(--muted); padding-bottom: 0.35rem; }
.tbl th, .tbl td { padding: 0.4rem 0.5rem; text-align: right; border-bottom: 1px solid #eef1f4; font-variant-numeric: tabular-nums; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl thead th { color: var(--blue-dark); font-weight: 600; font-size: 0.85rem; border-bottom: 2px solid var(--rule); }
.tbl td.g1 { color: var(--g1); font-weight: 600; }
.tbl td.g2 { color: var(--g2); font-weight: 600; }
.tbl tr.ratio td { color: var(--muted); font-size: 0.88rem; }
.tbl.mix td.diag { background: #fdf7d8; }

.prose h3 { font-size: 1.02rem; color: var(--blue-dark); margin: 1rem 0 0.3rem; }
.prose .eq { background: #f6f8fa; border-radius: 6px; padding: 0.55rem 0.8rem; font-family: "Cambria Math", "STIX Two Math", Georgia, serif; font-size: 1rem; overflow-x: auto; }
.refs { padding-left: 1.1rem; margin: 0; }
.refs li { margin-bottom: 0.45rem; font-size: 0.92rem; }

.app-footer { text-align: center; color: var(--muted); font-size: 0.9rem; padding: 0.6rem 1rem 1.2rem; }
.app-footer p { margin: 0.3rem 0; }
.app-footer .authors { color: #555; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #263544; color: #fff; padding: 0.55rem 1rem; border-radius: 6px; font-size: 0.9rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .controls { position: static; max-height: none; }
  .plots, .results-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .intro, .two-col { grid-template-columns: 1fr; }
  .app-header { padding: 1.2rem 1.1rem; }
  .app-header h1 { font-size: 1.5rem; }
}
@media print {
  .controls, .btn-secondary, .stale-note { display: none; }
  .layout { grid-template-columns: 1fr; }
}
