/* Titration Curve Lab. Everything is scoped under .tc so site.css (loaded after this file) can't collide. */
.tc {
  --tc-ink: #14263a; --tc-muted: #4b6075; --tc-paper: #eef4f7; --tc-card: #ffffff; --tc-line: #cfdce4;
  --tc-accent: #0d6670; --tc-accent-ink: #ffffff; --tc-sun: #c9771a; --tc-soft: #f3f7f9; --tc-ok: #1f7a3d; --tc-no: #b3261e;
  --tc-shadow: 0 1px 2px rgba(16, 40, 60, .06), 0 8px 24px rgba(16, 40, 60, .07);
  color: var(--tc-ink); font: 16px/1.5 "Atkinson Hyperlegible", system-ui, sans-serif;
  background: radial-gradient(ellipse 90% 60% at 50% -10%, #dcebf3, var(--tc-paper) 70%);
  padding: 0 clamp(12px, 2vw, 28px) 56px; min-height: 70vh;
}
html[data-theme="dark"] .tc {
  --tc-ink: #e6eef3; --tc-muted: #aabdca; --tc-paper: #0f1b26; --tc-card: #172633; --tc-line: #33495a;
  --tc-accent: #3fb5a3; --tc-accent-ink: #062521; --tc-sun: #ffc46b; --tc-soft: #1d3040; --tc-ok: #7fdc9a; --tc-no: #ff9b93;
  --tc-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  background: radial-gradient(ellipse 90% 60% at 50% -10%, #19324a, var(--tc-paper) 70%);
}
.tc *, .tc *::before, .tc *::after { box-sizing: border-box; }
.tc [hidden] { display: none !important; }
.tc h1, .tc h2, .tc h3 { color: var(--tc-ink); font-family: inherit; }
.tc small { font-size: 16px; }
.tc a { color: var(--tc-accent); font-weight: 700; }
.tc-eyebrow { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .08em; color: var(--tc-accent); }
.tc-muted { color: var(--tc-muted); }
.tc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }

/* title bar */
.tc-bar { max-width: 1500px; margin: 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 10px 0 8px; }
.tc-titles { flex: 1 1 260px; }
.tc-bar h1 { margin: 0; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.1; }
.tc-level { padding: 4px 12px; border-radius: 999px; background: var(--tc-soft); border: 1px solid var(--tc-line); font-weight: 700; }
.tc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* buttons and fields */
.tc .tc-btn { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--tc-line); background: var(--tc-card); color: var(--tc-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tc .tc-btn:hover { border-color: var(--tc-accent); }
.tc .tc-btn:disabled { opacity: .5; cursor: not-allowed; }
.tc .tc-btn--pri { background: var(--tc-accent); border-color: var(--tc-accent); color: var(--tc-accent-ink); }
.tc .tc-btn--ghost { background: transparent; }
.tc button:focus-visible, .tc a:focus-visible, .tc input:focus-visible, .tc select:focus-visible, .tc textarea:focus-visible, .tc summary:focus-visible, .tc-table:focus-visible { outline: 3px solid #eaa33d; outline-offset: 2px; }
.tc select, .tc input[type=text] { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; border-radius: 8px; border: 1px solid var(--tc-line); background: var(--tc-card); color: var(--tc-ink); padding: 6px 10px; max-width: 100%; }
.tc input[type=range] { width: 100%; min-height: 44px; margin: 0; accent-color: var(--tc-accent); }

/* start card */
.tc-gate { max-width: 1500px; margin: 8px auto 0; padding: clamp(14px, 3vw, 36px); border-radius: 22px; background: linear-gradient(140deg, #12324a, #0d6670 55%, #c9477a); }
.tc-gate-card { max-width: 980px; margin: 0 auto; padding: clamp(18px, 3vw, 34px); border-radius: 18px; background: var(--tc-card); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.tc-gate-card h2 { font-size: clamp(26px, 3.4vw, 38px); margin: 6px 0; line-height: 1.15; }
.tc-gate-lede { font-size: 18px; color: var(--tc-muted); margin: 6px 0 0; }
.tc-gate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 12px; }
.tc-gate-grid button { appearance: none; text-align: left; font: inherit; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 2px solid var(--tc-line); border-radius: 14px; cursor: pointer; background: var(--tc-soft); color: var(--tc-ink); min-height: 44px; }
.tc-gate-grid button:hover { border-color: var(--tc-accent); }
.tc-gate-grid b { font-size: 19px; }
.tc-gate-grid span { color: var(--tc-muted); }

/* modes and tabs */
#workspace { max-width: 1500px; margin: 0 auto; }
.tc-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 0 8px; }
.tc-modes-label { font-weight: 800; margin-right: 4px; }
.tc-modes button { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 2px solid var(--tc-line); background: var(--tc-card); color: var(--tc-ink); cursor: pointer; }
.tc-modes button.is-on { border-color: var(--tc-accent); background: var(--tc-accent); color: var(--tc-accent-ink); }
.tc-modes-note { color: var(--tc-muted); }
.tc-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 10px; }
.tc-tabs button { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; white-space: nowrap; min-height: 44px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--tc-line); background: var(--tc-card); color: var(--tc-ink); cursor: pointer; }
.tc-tabs button.is-on { background: var(--tc-ink); color: var(--tc-card); border-color: var(--tc-ink); }

/* bench */
.tc-stage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.tc-stage--solo { grid-template-columns: minmax(0, 1fr); }
.tc-bench { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; background: var(--tc-card); border: 1px solid var(--tc-line); border-radius: 16px; padding: 12px; box-shadow: var(--tc-shadow); }
.tc-app { min-width: 0; display: grid; grid-template-columns: 380px 104px; gap: 8px; align-items: start; }
.tc-canvas-wrap { border-radius: 12px; overflow: hidden; border: 1px solid var(--tc-line); line-height: 0; background: var(--tc-soft); }
#scene { display: block; margin: 0 auto; }
.tc-buret { display: flex; flex-direction: column; gap: 6px; }
.tc-buret-label { font-weight: 800; line-height: 1.25; }
.tc .tc-buret .tc-btn { padding: 10px 4px; white-space: nowrap; }
.tc .tc-buret #newFlask { margin-top: 10px; }
.tc-plot { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tc-sw { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--tc-muted); vertical-align: -2px; background: transparent; }
.tc-graph h3 { margin: 0 0 4px; font-size: 16px; }
.tc-graph canvas, #bigCurve, #slopeChart { display: block; width: 100%; border-radius: 8px; }
.tc-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin-top: 4px; }
.tc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tc-dot { display: inline-block; width: 13px; height: 13px; border-radius: 50%; background: var(--tc-no); }
.tc-dot--rec { background: var(--tc-card); border: 2px solid var(--tc-accent); }
.tc-reader label { font-weight: 800; display: block; }
.tc-readout { margin: 0; padding: 6px 10px; border-left: 4px solid var(--tc-sun); background: var(--tc-soft); border-radius: 8px; min-height: 2.6em; }
.tc-record { margin: 0; }
.tc-controls { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 18px; padding-top: 10px; border-top: 1px solid var(--tc-line); }
.tc-ctl { display: flex; flex-direction: column; gap: 2px; font-weight: 700; min-width: 0; }
.tc-ctl output { font-weight: 800; color: var(--tc-accent); }
.tc-caption { grid-column: 1 / -1; margin: 0; color: var(--tc-muted); }
.tc-flash { animation: tcFlash 2.4s ease-out; border-radius: 10px; }
@keyframes tcFlash { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 184, 0, 0); } 15%, 55% { box-shadow: 0 0 0 5px #ffb800; } }

/* coach */
.tc-coach { background: var(--tc-card); border: 1px solid var(--tc-line); border-radius: 16px; padding: 12px 14px; box-shadow: var(--tc-shadow); min-width: 0; }
.tc-coach h2 { font-size: 19px; margin: 2px 0 4px; line-height: 1.25; }
.tc-coach h3 { font-size: 17px; margin: 12px 0 6px; }
.tc-goal { margin: 0 0 8px; }
.tc-next { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--tc-soft); border-left: 4px solid var(--tc-sun); }
.tc-next > b { color: var(--tc-sun); letter-spacing: .04em; text-transform: uppercase; }
.tc-next > #nextStep { font-weight: 800; font-size: 17px; }
.tc-next--done { border-left-color: var(--tc-ok); } .tc-next--done > b { color: var(--tc-ok); }
.tc-ask { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.tc-ask label { font-weight: 700; }
.tc-ask-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tc-ask-row input { width: 110px; } .tc-ask-row select { flex: 1 1 160px; min-width: 0; }
.tc-msg { min-height: 1.5em; margin: 8px 0; font-weight: 700; color: var(--tc-accent); }
.tc-steps { list-style: none; margin: 10px 0 0; padding: 0; }
.tc-steps li { padding: 3px 0; color: var(--tc-muted); }
.tc-steps li.done { color: var(--tc-ok); font-weight: 700; }
.tc-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.tc-cards li { border: 1px dashed var(--tc-line); border-radius: 10px; padding: 8px 10px; }
.tc-cards li span { display: block; color: var(--tc-muted); }
.tc-cards li.done { border-style: solid; border-color: var(--tc-ok); }

/* panels: pre-lab, notebook, CER, test */
.tc-panel { background: var(--tc-card); border: 1px solid var(--tc-line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--tc-shadow); }
.tc-panel h2 { margin: 4px 0 8px; font-size: 22px; line-height: 1.2; }
.tc-panel h3 { margin: 14px 0 6px; font-size: 18px; }
.tc-pre-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 8px 28px; }
.tc-pre-grid p { margin: 0 0 8px; }
.tc-term { color: var(--tc-accent); }
.tc-vocab { margin: 0; } .tc-vocab dt { font-weight: 800; } .tc-vocab dd { margin: 0 0 6px; color: var(--tc-muted); }
.tc-pred { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--tc-line); border-radius: 12px; padding: 12px; background: var(--tc-soft); }
.tc-pred label { font-weight: 700; }
.tc-pred .tc-msg { margin: 2px 0 0; }
.tc-safety { margin: 0; padding-left: 20px; }
.tc-links { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--tc-line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.tc-links b { white-space: nowrap; }
.tc-dialog .tc-links { display: block; }
.tc-data-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tc-data-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 22px; }
.tc-data-grid > div:last-child { max-width: 820px; }
.tc-table { overflow: auto; max-height: 360px; border: 1px solid var(--tc-line); border-radius: 10px; }
.tc table { width: 100%; border-collapse: collapse; font-size: 16px; }
.tc th, .tc td { padding: 7px 10px; border-bottom: 1px solid var(--tc-line); text-align: left; color: var(--tc-ink); vertical-align: top; }
.tc th { background: var(--tc-soft); font-weight: 800; }
.tc td.tc-empty { text-align: center; color: var(--tc-muted); }
.tc-cer-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tc-cer-head > div { flex: 1 1 320px; }
.tc-checklist { list-style: none; margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--tc-soft); flex: 1 1 320px; }
.tc-checklist li { padding: 2px 0; color: var(--tc-muted); }
.tc-checklist li.done { color: var(--tc-ok); font-weight: 700; }
.tc-pick { margin-top: 10px; }
.tc-pick summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; }
.tc-pick label { display: flex; gap: 8px; align-items: flex-start; padding: 10px 0; min-height: 44px; }
.tc-pick input { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 2px; accent-color: var(--tc-accent); }
.tc-pick .tc-msg { margin: 0; }
.tc-cer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.tc-cer-grid label { display: flex; flex-direction: column; font-weight: 800; }
.tc-cer-grid small { font-weight: 500; color: var(--tc-muted); }
.tc-cer-grid textarea { font: 16px/1.45 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 150px; padding: 10px; margin-top: 4px; border: 1px solid var(--tc-line); border-radius: 10px; background: var(--tc-card); color: var(--tc-ink); resize: vertical; }
.tc-turnin { margin-top: 12px; }
.tc-done { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--tc-ok); background: var(--tc-soft); }
.tc-done h3 { margin-top: 0; }
.tc-test { margin-top: 14px; max-width: 980px; }
.tc-test-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.tc-test-head h2 small { font-size: 18px; color: var(--tc-muted); }
.tc-progress { flex: 0 1 260px; height: 10px; background: var(--tc-soft); border-radius: 999px; overflow: hidden; border: 1px solid var(--tc-line); }
.tc-progress i { display: block; height: 100%; background: var(--tc-accent); }
.tc-tag { display: inline-block; margin: 8px 0 0; padding: 3px 10px; border-radius: 999px; background: #fff1d6; color: #6b4300; font-weight: 700; }
html[data-theme="dark"] .tc-tag { background: #4a3510; color: #ffe2a8; }
.tc-q { font-size: 19px; font-weight: 700; margin: 12px 0; }
.tc-q b { color: var(--tc-accent); }
.tc-run { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; }
.tc-choices { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.tc-choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 48px; border: 2px solid var(--tc-line); border-radius: 12px; cursor: pointer; background: var(--tc-card); position: relative; }
.tc-choice input { position: absolute; opacity: 0; pointer-events: none; }
.tc-choice:focus-within { outline: 3px solid #eaa33d; outline-offset: 2px; }
.tc-choice.is-picked { border-color: var(--tc-accent); background: var(--tc-soft); }
.tc-choice.ok { border-color: var(--tc-ok); } .tc-choice.no { border-color: var(--tc-no); }
.tc-choice em { margin-left: auto; font-style: normal; font-weight: 900; font-size: 20px; }
.tc-choice.ok em { color: var(--tc-ok); } .tc-choice.no em { color: var(--tc-no); }
.tc-letter { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--tc-soft); border: 1px solid var(--tc-line); }
.tc-choices:disabled .tc-choice { cursor: default; }
.tc-numrow { display: flex; flex-wrap: wrap; gap: 12px; }
.tc-numrow label { display: flex; flex-direction: column; font-weight: 700; gap: 2px; }
.tc-numrow input { width: 160px; }
.tc-explain { padding: 10px 12px; border-radius: 10px; background: var(--tc-soft); margin: 12px 0 0; }
.tc-explain.ok { border-left: 4px solid var(--tc-ok); } .tc-explain.no { border-left: 4px solid var(--tc-no); } .tc-explain--need { border-left: 4px solid var(--tc-sun); font-weight: 700; }
.tc-test-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.tc-test-nav .tc-btn--pri { margin-left: auto; }
.tc-review { padding-left: 26px; }
.tc-review li { margin: 10px 0; }
.tc-review li.ok > b { color: var(--tc-ok); } .tc-review li.no > b { color: var(--tc-no); }

/* dialogs */
.tc-dialog { max-width: 720px; width: calc(100vw - 32px); border: 0; border-radius: 16px; padding: 22px 26px; color: #14263a; background: #fff; box-shadow: 0 20px 70px rgba(0, 0, 0, .4); font: 16px/1.55 "Atkinson Hyperlegible", system-ui, sans-serif; }
html[data-theme="dark"] .tc-dialog { background: #172633; color: #e6eef3; }
html[data-theme="dark"] .tc-dialog a { color: #8fd6f0; }
.tc-dialog::backdrop { background: rgba(6, 21, 37, .7); }
.tc-dialog h2 { margin-top: 0; overflow: hidden; min-height: 44px; }
.tc-dialog .tc-links a { display: block; padding: 4px 0; }
.tc-dialog a { font-weight: 700; }
.tc-x { float: right; font-size: 28px; line-height: 1; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: inherit; cursor: pointer; }

/* responsive */
@media (max-width: 1180px) {
  .tc-stage { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .tc-bench { grid-template-columns: minmax(0, 1fr); }
  .tc-app { grid-template-columns: minmax(0, 420px) 104px; justify-content: center; }
  .tc-gate-grid, .tc-cer-grid, .tc-pre-grid, .tc-data-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .tc-app { grid-template-columns: minmax(0, 1fr); }
  .tc-buret { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tc-buret-label, .tc .tc-buret #newFlask { grid-column: 1 / -1; margin-top: 0; }
  .tc-tabs button { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) { .tc * { transition: none !important; animation: none !important; } }
@media print { .tc-bench, .tc-tabs, .tc-modes, .tc-actions, .tc-turnin { display: none !important; } }

/* the site's "Sign in to save your progress" chip docks here, in the page flow, so it never floats over the bench */
.tc-signin:empty { display: none; }
.tc-signin .tlg-signin-note { margin: 0; }

/* short labels on phones so the bench starts higher up the page */
.tc-narrow { display: none; }
@media (max-width: 560px) {
  .tc-wide { display: none; }
  .tc-narrow { display: inline; }
  .tc-modes-note { display: none; }
  .tc-bar { gap: 6px 8px; padding-top: 6px; }
  .tc .tc-actions .tc-btn { padding: 10px 12px; }
}
