/*
  @rt/tools: the side panel and the tools in it.

  Colours and type come from the page's Evergreen tokens when it has them
  (the portal, the test app, the Library: --paper, --ink, --accent ...) and
  fall back to the same values when it does not (the public site), so one
  stylesheet serves every host. One green only: the ramp in
  packages/rt-design/green.css. Selected states are fills, never an edge.
*/

/* ── tokens ─────────────────────────────────────────────────────────────── */

.rtt, .rtt-dock-col, .rtt-split {
  --rtt-paper: var(--sheet, var(--paper, #fbf9f4));
  --rtt-deep: var(--paper-deep, #f3efe6);
  --rtt-edge: var(--paper-deep-edge, #e7e1d4);
  --rtt-ink: var(--ink, #1a1a1a);
  --rtt-text: var(--text, #2c2c2c);
  --rtt-muted: var(--muted, #56554f);
  --rtt-faint: var(--faint, #66645d);
  --rtt-quat: var(--quaternary, #a29e95);
  --rtt-rule: var(--rule, #e4dfd3);
  --rtt-accent: var(--accent, #1d4023);
  --rtt-accent-fill: var(--accent-fill, #1d4023);
  --rtt-accent-hover: var(--accent-hover, #27552f);
  --rtt-accent-wash: var(--accent-wash, #eff5f0);
  --rtt-on-accent: var(--on-accent, #ffffff);
  --rtt-danger: var(--danger, #ac2a20);
  --rtt-elev: var(--elev-sheet, 0 24px 60px -24px rgba(0, 0, 0, 0.5));
  --rtt-r: var(--r-sheet, 10px);
  --rtt-r-key: 8px;
  --rtt-font: var(--font-ui, 'SF Pro', -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
  --rtt-font-display: var(--font-display, 'PP Editorial Old', Georgia, serif);
  --rtt-dur: var(--dur, 160ms);
  --rtt-grip: var(--on-ground-muted, rgba(127, 127, 127, 0.55));
  /* Curves: the green first, then hues that are not green. */
  --rtt-c1: #1d4023; --rtt-c2: #27466b; --rtt-c3: #a2542f; --rtt-c4: #6a5aa3; --rtt-c5: #a8761c; --rtt-c6: #4a4a48;
  --rtt-grid: rgba(20, 20, 20, 0.09); --rtt-grid-minor: rgba(20, 20, 20, 0.04); --rtt-axis: #2f322f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.rtt, .rtt-dock-col, .rtt-split) {
    --rtt-paper: var(--sheet, var(--paper, #181b19)); --rtt-deep: var(--paper-deep, #1f2320); --rtt-edge: var(--paper-deep-edge, #2b302c);
    --rtt-ink: var(--ink, #f2efe7); --rtt-text: var(--text, #dfdcd4); --rtt-muted: var(--muted, #b0aca2); --rtt-faint: var(--faint, #9a968c);
    --rtt-quat: var(--quaternary, #5d5a54); --rtt-rule: var(--rule, #2c302d);
    --rtt-accent: var(--accent, #93c098); --rtt-accent-fill: var(--accent-fill, #397243); --rtt-accent-hover: var(--accent-hover, #4b8253);
    --rtt-accent-wash: var(--accent-wash, #102313); --rtt-danger: var(--danger, #f2918a);
    --rtt-c1: #93c098; --rtt-c2: #8fb3ea; --rtt-c3: #ee9583; --rtt-c4: #b4a5ea; --rtt-c5: #e2b462; --rtt-c6: #cfcac0;
    --rtt-grid: rgba(242, 239, 231, 0.10); --rtt-grid-minor: rgba(242, 239, 231, 0.045); --rtt-axis: rgba(242, 239, 231, 0.78);
  }
}
:root[data-theme="dark"] :is(.rtt, .rtt-dock-col, .rtt-split) {
  --rtt-paper: var(--sheet, var(--paper, #181b19)); --rtt-deep: var(--paper-deep, #1f2320); --rtt-edge: var(--paper-deep-edge, #2b302c);
  --rtt-ink: var(--ink, #f2efe7); --rtt-text: var(--text, #dfdcd4); --rtt-muted: var(--muted, #b0aca2); --rtt-faint: var(--faint, #9a968c);
  --rtt-quat: var(--quaternary, #5d5a54); --rtt-rule: var(--rule, #2c302d);
  --rtt-accent: var(--accent, #93c098); --rtt-accent-fill: var(--accent-fill, #397243); --rtt-accent-hover: var(--accent-hover, #4b8253);
  --rtt-accent-wash: var(--accent-wash, #102313); --rtt-danger: var(--danger, #f2918a);
  --rtt-c1: #93c098; --rtt-c2: #8fb3ea; --rtt-c3: #ee9583; --rtt-c4: #b4a5ea; --rtt-c5: #e2b462; --rtt-c6: #cfcac0;
  --rtt-grid: rgba(242, 239, 231, 0.10); --rtt-grid-minor: rgba(242, 239, 231, 0.045); --rtt-axis: rgba(242, 239, 231, 0.78);
}

.rtt { font-synthesis: none; font-family: var(--rtt-font); color: var(--rtt-text); -webkit-font-smoothing: antialiased; overflow-wrap: normal; word-break: normal; hyphens: none; }
:where(.rtt) *, :where(.rtt) *::before, :where(.rtt) *::after { box-sizing: border-box; }
/* Zero specificity, so every button's own font and colour win. */
:where(.rtt) :where(button) { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rtt :focus-visible { outline: 2px solid var(--rtt-accent); outline-offset: 2px; }
.rtt [hidden] { display: none !important; }
.rtt-link { border: 0; background: none; padding: 0; font: 400 12px/16px var(--rtt-font); color: var(--rtt-muted); text-decoration: underline transparent; text-underline-offset: 3px; }
.rtt-link:hover { color: var(--rtt-ink); text-decoration-color: currentColor; }

/* ── the split: the page's content and the dock column ───────────────────── */

.rtt-split { display: flex; align-items: stretch; min-width: 0; min-height: 0; }
.rtt-split-main { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.rtt-dock-col {
  --rtt-dock-gap: 16px;
  flex: none; position: relative; width: 0; min-height: 0; overflow: hidden;
  transition: width 260ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.rtt-dock-col[data-open]:not([data-sheet]) { width: calc(var(--rtt-dock-w, 420px) + 2 * var(--rtt-dock-gap)); }
.rtt-dock-col:not(.is-ready), .rtt-dock-col.is-dragging, .rtt-dock-col.is-still { transition: none; }
.rtt-dock-col:not([data-open]) .rtt-dock { visibility: hidden; transition: visibility 0s 260ms; }

.rtt-dock {
  position: absolute; top: 0; bottom: var(--rtt-dock-gap); right: var(--rtt-dock-gap);
  width: var(--rtt-dock-w, 420px);
  display: flex; flex-direction: column; min-height: 0;
  background: var(--rtt-paper); color: var(--rtt-text);
  border-radius: var(--rtt-r); box-shadow: var(--rtt-elev);
}

/* The grip: the gap between the content and the card, a short pill in the middle. */
.rtt-dock-grip {
  position: absolute; left: 0; top: 0; bottom: var(--rtt-dock-gap); width: var(--rtt-dock-gap);
  cursor: col-resize; touch-action: none; z-index: 1;
}
.rtt-dock-grip::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 36px; margin: -18px 0 0 -2px;
  border-radius: 2px; background: var(--rtt-grip); opacity: 0.55; transition: opacity var(--rtt-dur), height var(--rtt-dur);
}
.rtt-dock-grip:hover::after, .rtt-dock-col.is-dragging .rtt-dock-grip::after, .rtt-dock-grip:focus-visible::after { opacity: 1; height: 48px; margin-top: -24px; }
.rtt-dock-grip:focus-visible { outline: none; }
.rtt-dock-handle { display: none; }

.rtt-dock-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 14px; }
.rtt-dock-head.is-single::before {
  content: attr(data-single); flex: 1;
  font: 400 19px/22px var(--rtt-font-display); letter-spacing: -0.01em; color: var(--rtt-ink);
}
.rtt-tabs, .rtt-seg {
  flex: 0 1 auto; display: inline-flex; gap: 2px; padding: 3px; min-width: 0;
  background: var(--rtt-deep); border-radius: 999px;
}
.rtt-tabs { margin-right: auto; }
.rtt-tab, .rtt-seg button {
  height: 26px; padding: 0 11px; border: 0; border-radius: 999px; background: transparent;
  font: 500 12px/1 var(--rtt-font); letter-spacing: -0.005em; color: var(--rtt-muted); white-space: nowrap;
  transition: background var(--rtt-dur), color var(--rtt-dur), box-shadow var(--rtt-dur);
}
.rtt-tab:hover, .rtt-seg button:hover { color: var(--rtt-ink); }
.rtt-tab[aria-selected="true"], .rtt-seg button[aria-checked="true"] {
  background: var(--rtt-paper); color: var(--rtt-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}
.rtt-dock-close {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 0; border-radius: 999px; background: transparent; color: var(--rtt-muted);
}
.rtt-dock-close:hover { background: var(--rtt-deep); color: var(--rtt-ink); }
.rtt-dock-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0 14px 14px; }
.rtt-dock-head > .rtt-seg { flex: none; }
/* Three tabs and the calculator's Basic and Scientific do not share one line on a narrow card (a phone's sheet, a
   student with math and chemistry both): the switch takes a line of its own under the tabs. */
.rtt-dock-head { flex-wrap: wrap; row-gap: 8px; container-type: inline-size; }
@container (max-width: 540px) {
  .rtt-dock-head:has(.rtt-tab:not([hidden]) ~ .rtt-tab:not([hidden]) ~ .rtt-tab:not([hidden])) > .rtt-seg { order: 3; flex: 1 0 100%; }
  .rtt-dock-head:has(.rtt-tab:not([hidden]) ~ .rtt-tab:not([hidden]) ~ .rtt-tab:not([hidden])) > .rtt-seg button { flex: 1; }
}
.rtt-dock-head > .rtt-seg button { height: 24px; padding: 0 9px; font-size: 11.5px; }
.rtt-dock-head.is-single > .rtt-seg { order: 0; }
.rtt-pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.rtt-pane > .rtt { flex: 1 1 auto; min-height: 0; }

/* ── the sheet: phones ──────────────────────────────────────────────────── */

.rtt-dock-col[data-sheet] {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10050; width: auto; overflow: visible;
  height: calc(var(--rtt-sheet-frac, 0.5) * 100vh);
  height: calc(var(--rtt-sheet-frac, 0.5) * 100dvh);
  transform: translateY(105%); visibility: hidden;
  transition: transform 300ms cubic-bezier(0.2, 0.7, 0.2, 1), height 260ms cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s 300ms;
}
.rtt-dock-col[data-sheet][data-open] { transform: none; visibility: visible; transition: transform 300ms cubic-bezier(0.2, 0.7, 0.2, 1), height 260ms cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s; }
.rtt-dock-col[data-sheet].is-dragging { transition: none; }
.rtt-dock-col[data-sheet] .rtt-dock {
  inset: 0; width: auto; border-radius: 14px 14px 0 0;
  box-shadow: 0 -10px 40px -14px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.rtt-dock-col[data-sheet] .rtt-dock-grip { display: none; }
.rtt-dock-col[data-sheet] .rtt-dock-handle {
  display: block; flex: none; height: 18px; margin-bottom: -8px; cursor: grab; touch-action: none; position: relative;
}
.rtt-dock-col[data-sheet] .rtt-dock-handle::after {
  content: ''; position: absolute; left: 50%; top: 7px; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--rtt-quat);
}
.rtt-dock-col[data-sheet] .rtt-dock-head { padding-top: 8px; padding-bottom: 8px; }
.rtt-dock-col[data-sheet] .rtt-pane { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.rtt-dock-col[data-sheet] .rtt-basic, .rtt-dock-col[data-sheet] .rtt-sci { --rtt-key-h: clamp(34px, 5dvh, 42px); }

@media (prefers-reduced-motion: reduce) {
  .rtt-dock-col, .rtt-dock-col[data-sheet], .rtt-dock-col[data-sheet][data-open] { transition: none; }
}

/* ── keys, shared ───────────────────────────────────────────────────────── */

.rtt-key {
  min-width: 0; height: 100%; min-height: 34px; padding: 0 2px;
  border: 0; border-radius: var(--rtt-r-key);
  background: var(--rtt-deep); color: var(--rtt-ink);
  font: 400 14px/1 var(--rtt-font); font-variant-numeric: tabular-nums lining-nums;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: background var(--rtt-dur), transform 80ms;
}
.rtt-key:hover { background: color-mix(in srgb, var(--rtt-ink) 7%, var(--rtt-deep)); }
.rtt-key:active { transform: scale(0.97); }
.rtt-key.is-num { background: var(--rtt-paper); box-shadow: inset 0 0 0 1px var(--rtt-edge); font-size: 17px; font-weight: 400; }
.rtt-key.is-num:hover { background: var(--rtt-deep); }
.rtt-key.is-fn { font-size: 13.5px; }
.rtt-key.is-op { font-size: 19px; font-weight: 300; }
.rtt-key.is-mod { font-size: 12.5px; color: var(--rtt-muted); }
.rtt-key.is-mod.is-on { background: var(--rtt-accent-wash); color: var(--rtt-accent); }
.rtt-key.is-eq { background: var(--rtt-accent-fill); color: var(--rtt-on-accent); font-size: 20px; font-weight: 300; }
.rtt-key.is-eq:hover { background: var(--rtt-accent-hover); }
@media (prefers-reduced-motion: reduce) { .rtt-key:active { transform: none; } }

/* ── the calculator: one display and one pad, basic or scientific ────────── */

.rtt-basic, .rtt-sci { --rtt-key-h: clamp(34px, 5.2vh, 44px); --rtt-key-gap: 6px; }
/* The calculator itself is the container: the pad rearranges by the width it is given, not by the window, and where a
   page gives it a fixed height (the public site's calculator) it scrolls instead of spilling. */
.rtt-sci { container-type: inline-size; overflow-y: auto; max-height: 100%; overscroll-behavior: contain; }
.rtt-dock-body { overflow-y: auto; }
.rtt-basic { display: flex; flex-direction: column; gap: 10px; max-width: 340px; width: 100%; margin: 0 auto; outline: none; }
.rtt-basic-screen, .rtt-sci-screen {
  display: block; padding: 10px 14px 10px; min-height: 64px;
  background: var(--rtt-deep); border-radius: var(--rtt-r-key); color: var(--rtt-ink);
  font-variant-numeric: tabular-nums lining-nums;
}
.rtt-basic-screen { font: 300 34px/44px var(--rtt-font); letter-spacing: -0.01em; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtt-basic-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: var(--rtt-key-h); gap: var(--rtt-key-gap); }
.rtt-basic .rtt-key.is-wide { grid-column: span 2; }

.rtt-sci { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.rtt-sci-meta { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
.rtt-sci-meta-end { display: inline-flex; gap: 12px; align-items: center; }
.rtt-sci-angle { display: inline-flex; gap: 2px; padding: 2px; background: var(--rtt-deep); border-radius: 999px; }
.rtt-sci-mode {
  height: 22px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent;
  font: 600 11px/1 var(--rtt-font); letter-spacing: 0.04em; color: var(--rtt-muted);
}
.rtt-sci-mode:hover { color: var(--rtt-ink); }
.rtt-sci-mode[aria-pressed="true"] { background: var(--rtt-accent-fill); color: var(--rtt-on-accent); }

/* The display: at most two earlier lines, then what is being typed, typeset, and its answer. */
.rtt-sci-screen { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.rtt-sci-hist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; max-height: 62px; overflow-y: auto; overscroll-behavior: contain; }
.rtt-sci-hist:empty { display: none; }
.rtt-sci-hist > li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 1px 0; }
.rtt-sci-hist button { border: 0; background: none; padding: 0 4px; border-radius: 5px; max-width: 100%; }
.rtt-sci-hist button:hover { background: var(--rtt-edge); }
.rtt-sci-h-expr { font: 400 13px/20px var(--rtt-font); color: var(--rtt-muted); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rtt-sci-h-res { flex: none; font: 400 13px/20px var(--rtt-font); color: var(--rtt-ink); text-align: right; font-variant-numeric: tabular-nums lining-nums; }
.rtt-sci-line { min-height: 46px; display: flex; align-items: center; justify-content: flex-end; font: 400 20px/1.3 var(--rtt-font); color: var(--rtt-ink); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.rtt-sci-line > * { flex: none; }
.rtt-sci-line::-webkit-scrollbar { display: none; }
.rtt-sci-line .katex { font-size: 1.1em; }
.rtt-sci-preview { display: block; min-height: 30px; text-align: right; font: 300 22px/26px var(--rtt-font); color: var(--rtt-ink); font-variant-numeric: tabular-nums lining-nums; }
.rtt-sci-preview .katex { font-size: 1em; }
.rtt-sci-preview.is-error { color: var(--rtt-danger); text-align: left; font: 400 13px/18px var(--rtt-font); }
.rtt-sci sup { font-size: 0.68em; line-height: 0; vertical-align: 0.38em; }
.rtt-sci sub { font-size: 0.68em; line-height: 0; }
/* The line typed into is the real input (the keyboard, the caret and the selection are the browser's); it is a thin strip
   under the typeset line, so a laptop keeps typing and a phone keeps the on-screen keys. */
.rtt-sci-input {
  width: 100%; height: 34px; padding: 0 12px; border: 1px solid transparent; border-radius: var(--rtt-r-key);
  background: var(--rtt-deep); color: var(--rtt-ink);
  font: 400 15px/1 var(--rtt-font); letter-spacing: -0.005em; font-variant-numeric: tabular-nums lining-nums;
  -webkit-appearance: none; appearance: none;
}
.rtt-sci-input::placeholder { color: var(--rtt-faint); font-size: 14px; }
.rtt-sci-input:focus { outline: none; border-color: var(--rtt-accent); }

/* The pad: the function block (4 across), the number block (4 across, the same keys as the basic pad), then the extras
   (6 across) under them; once the calculator is wide the extras stand beside. */
.rtt-sci-pad { flex: none; display: grid; gap: var(--rtt-key-gap); grid-template-columns: minmax(0, 1fr); }
.rtt-pad-fn, .rtt-pad-num, .rtt-pad-more { display: grid; gap: var(--rtt-key-gap); grid-auto-rows: var(--rtt-key-h); }
.rtt-pad-fn, .rtt-pad-num { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rtt-pad-more { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.rtt-pad-fn { grid-auto-rows: calc(var(--rtt-key-h) - 6px); }
.rtt-pad-num .rtt-key.is-wide3 { grid-column: span 2; }
.rtt-sci[data-more="off"] .rtt-pad-more { display: none; }
/* Wide (a calculator given half a screen): the functions, the numbers and, when on, the extras stand side by side, so the
   whole pad is half as tall and the question above it keeps its room. */
@container (min-width: 400px) {
  .rtt-sci-pad { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .rtt-pad-fn { grid-auto-rows: var(--rtt-key-h); }
  .rtt-pad-more { grid-column: 1 / -1; }
}
@container (min-width: 640px) {
  .rtt-sci[data-more="on"] .rtt-sci-pad { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.9fr); }
  .rtt-sci[data-more="on"] .rtt-pad-more { grid-column: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.rtt-key .katex { font-size: 1.08em; }
.rtt-key.is-eq.is-wide3 { font-size: 20px; }
.rtt-sci-h-res .rtt-frac, .rtt-sci-h-expr .rtt-frac { font-size: 0.85em; }

/* ── grapher ────────────────────────────────────────────────────────────── */

.rtt-graph-wrap { container-type: inline-size; display: flex; flex-direction: column; min-height: 0; }
.rtt-graph { flex: 1 1 auto; min-height: 0; display: grid; grid-template-rows: auto minmax(180px, 1fr); gap: 10px; }
.rtt-g-list { min-height: 0; max-height: 38vh; overflow-y: auto; display: flex; flex-direction: column; overscroll-behavior: contain; }
@container (min-width: 640px) {
  .rtt-graph { grid-template-columns: minmax(220px, 34%) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 14px; }
  .rtt-g-list { max-height: none; }
}
.rtt-g-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rtt-g-row {
  --c: var(--rtt-c1);
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: 2px 6px;
  padding: 4px 4px 4px 6px; border-radius: var(--rtt-r-key);
  transition: background var(--rtt-dur);
}
.rtt-g-row[data-color="1"] { --c: var(--rtt-c2); } .rtt-g-row[data-color="2"] { --c: var(--rtt-c3); }
.rtt-g-row[data-color="3"] { --c: var(--rtt-c4); } .rtt-g-row[data-color="4"] { --c: var(--rtt-c5); } .rtt-g-row[data-color="5"] { --c: var(--rtt-c6); }
.rtt-g-row:focus-within, .rtt-g-row.is-selected { background: var(--rtt-deep); }
.rtt-g-swatch { width: 22px; height: 30px; border: 0; padding: 0; background: none; display: grid; place-items: center; }
.rtt-g-swatch.is-none { visibility: hidden; }
.rtt-g-swatch::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); transition: background var(--rtt-dur); }
.rtt-g-row.is-hidden .rtt-g-swatch::before { background: transparent; }
.rtt-g-field { min-width: 0; display: flex; flex-direction: column; }
.rtt-g-input {
  width: 100%; height: 30px; padding: 0 2px; border: 0; background: transparent; color: var(--rtt-ink);
  font: 400 15px/30px var(--rtt-font); letter-spacing: -0.005em; -webkit-appearance: none; appearance: none;
}
.rtt-g-input:focus { outline: none; }
.rtt-g-line { position: relative; min-width: 0; }
.rtt-g-math {
  position: absolute; inset: 0; display: none; padding: 0 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: text;
  font: 400 15.5px/30px var(--rtt-font); color: var(--rtt-ink); font-variant-numeric: lining-nums;
}
.rtt-sci i, .rtt-g-math i { font-family: var(--rtt-font-display); font-size: 1.12em; font-style: italic; letter-spacing: 0.01em; padding-right: 0.04em; }
.rtt-g-math sup { font-size: 0.74em; line-height: 0; vertical-align: 0.4em; margin: 0 0.06em 0 0.09em; font-variant-numeric: lining-nums; }
.rtt-g-math i + sup { margin-left: 0.05em; }
.rtt-g-math sup i { font-size: 1em; }
.rtt-g-math sub { font-size: 0.7em; line-height: 0; }
.rtt-g-math .rtt-where { color: var(--rtt-muted); }
.rtt-sqrt { white-space: nowrap; }
.rtt-rad { display: inline-block; border-top: 1px solid currentColor; padding: 0.05em 0.1em 0 0.06em; margin-left: -0.04em; line-height: 1.15; }
.rtt-frac { display: inline-flex; flex-direction: column; align-items: stretch; vertical-align: middle; margin: 0 0.12em; font-size: 0.8em; line-height: 1.12; text-align: center; }
.rtt-frac > span { display: block; padding: 0 0.18em; white-space: nowrap; }
.rtt-frac > span:first-child { border-bottom: 1px solid currentColor; }
.rtt-sci-h-res .rtt-frac, .rtt-sci-h-expr .rtt-frac { font-size: 0.85em; }
.rtt-g-row.has-math:not(:focus-within) .rtt-g-math { display: block; }
.rtt-g-row.has-math:not(:focus-within) .rtt-g-input { color: transparent; }
.rtt-g-row.is-hidden .rtt-g-math { color: var(--rtt-muted); }
.rtt-g-input::placeholder { color: var(--rtt-faint); font-weight: 300; }
.rtt-g-row.is-hidden .rtt-g-input { color: var(--rtt-muted); }
.rtt-g-note { font: 400 12px/16px var(--rtt-font); color: var(--rtt-muted); padding: 0 2px; font-variant-numeric: tabular-nums; }
.rtt-g-note:empty { display: none; }
.rtt-g-note.is-error { color: var(--rtt-danger); }
.rtt-g-note sup { font-size: 0.7em; line-height: 0; }
.rtt-g-acts { display: flex; align-items: center; height: 30px; opacity: 0; transition: opacity var(--rtt-dur); }
.rtt-g-row:hover .rtt-g-acts, .rtt-g-row:focus-within .rtt-g-acts, .rtt-g-row.is-selected .rtt-g-acts { opacity: 1; }
@media (hover: none) { .rtt-g-acts { opacity: 1; } }
.rtt-g-icon {
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; background: none; color: var(--rtt-muted);
}
.rtt-g-icon:hover { color: var(--rtt-ink); background: color-mix(in srgb, var(--rtt-ink) 6%, transparent); }
.rtt-g-extra:empty { display: none; }
.rtt-g-slider { display: flex; align-items: center; gap: 6px; padding: 0 0 2px; margin-top: -2px; }
.rtt-g-play { flex: none; }
.rtt-g-bound {
  flex: none; width: 46px; height: 24px; padding: 0 4px; border: 0; border-radius: 5px; background: var(--rtt-paper);
  font: 400 12px/24px var(--rtt-font); color: var(--rtt-muted); text-align: center; font-variant-numeric: tabular-nums;
}
.rtt-g-bound:focus { outline: 1px solid var(--rtt-accent); color: var(--rtt-ink); }
.rtt-g-range {
  flex: 1 1 auto; min-width: 60px; height: 24px; margin: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.rtt-g-range::-webkit-slider-runnable-track { height: 2px; border-radius: 1px; background: var(--rtt-edge); }
.rtt-g-range::-moz-range-track { height: 2px; border-radius: 1px; background: var(--rtt-edge); }
.rtt-g-range::-moz-range-progress { height: 2px; border-radius: 1px; background: var(--rtt-accent-fill); }
.rtt-g-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -6px; border: 0; border-radius: 50%;
  background: var(--rtt-accent-fill); box-shadow: 0 0 0 2px var(--rtt-paper), 0 1px 3px rgba(0, 0, 0, 0.25);
}
.rtt-g-range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--rtt-accent-fill); box-shadow: 0 0 0 2px var(--rtt-paper), 0 1px 3px rgba(0, 0, 0, 0.25); }
.rtt-g-range:focus-visible { outline: none; }
.rtt-g-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--rtt-paper), 0 0 0 4px var(--rtt-accent); }
.rtt-g-table { margin: 4px 0 6px; border-collapse: collapse; font: 400 12.5px/18px var(--rtt-font); font-variant-numeric: tabular-nums lining-nums; color: var(--rtt-ink); }
.rtt-g-table th { font-weight: 500; font-style: italic; color: var(--rtt-muted); text-align: right; padding: 0 14px 3px 0; }
.rtt-g-table td { text-align: right; padding: 1px 14px 1px 0; }
.rtt-g-keys { display: none; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; padding: 8px 0 2px; position: sticky; bottom: 0; background: var(--rtt-paper); }
.rtt-g-keys .rtt-key { height: 30px; min-height: 30px; font-size: 13px; }
.rtt-g-list:focus-within .rtt-g-keys { display: grid; }
@media (hover: hover) and (pointer: fine) { .rtt-g-list:focus-within .rtt-g-keys { display: none; } }

.rtt-g-stage {
  position: relative; min-height: 0; border-radius: var(--rtt-r-key); overflow: hidden;
  background: var(--rtt-paper); box-shadow: inset 0 0 0 1px var(--rtt-rule);
}
.rtt-g-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.rtt-g-canvas:active { cursor: grabbing; }
.rtt-g-canvas:focus-visible { outline: 2px solid var(--rtt-accent); outline-offset: -2px; }
.rtt-g-ctl { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 4px; }
.rtt-g-btn {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; color: var(--rtt-muted);
  background: color-mix(in srgb, var(--rtt-paper) 88%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
}
.rtt-g-btn:hover { color: var(--rtt-ink); }
.rtt-g-btn[aria-pressed="true"], .rtt-g-btn[aria-expanded="true"] { color: var(--rtt-accent); }
.rtt-g-btn:focus-visible { outline: 2px solid var(--rtt-accent); outline-offset: 1px; }
.rtt-g-pop {
  position: absolute; z-index: 3; top: 8px; right: 46px; width: min(272px, calc(100% - 62px)); max-height: calc(100% - 16px); overflow: auto;
  padding: 14px 14px 12px; border-radius: 12px; background: var(--rtt-paper); color: var(--rtt-ink);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16), 0 0 0 0.5px rgba(0, 0, 0, 0.1);
  font: 400 12.5px/1.3 var(--rtt-font); display: grid; gap: 10px;
}
.rtt-g-pop[hidden] { display: none; }
.rtt-g-field-row { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; }
.rtt-g-field-row[hidden] { display: none; }
.rtt-g-pop-label { color: var(--rtt-muted); }
.rtt-g-seg { display: flex; padding: 2px; border-radius: 8px; background: var(--rtt-deep); }
.rtt-g-seg button { flex: 1; min-height: 26px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--rtt-muted); font: inherit; white-space: nowrap; }
.rtt-g-seg button.is-on { background: var(--rtt-paper); color: var(--rtt-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.rtt-g-checks { display: grid; gap: 2px; }
.rtt-g-check { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 0; border: 0; background: transparent; color: var(--rtt-text); font: inherit; text-align: left; }
.rtt-g-box { width: 15px; height: 15px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--rtt-quat); display: inline-block; position: relative; }
.rtt-g-check[aria-checked="true"] .rtt-g-box { background: var(--rtt-accent-fill); box-shadow: none; }
.rtt-g-check[aria-checked="true"] .rtt-g-box::after { content: ''; position: absolute; left: 4.5px; top: 2px; width: 4px; height: 8px; border: solid var(--rtt-on-accent); border-width: 0 1.5px 1.5px 0; transform: rotate(40deg); }
.rtt-g-pop-note { margin: 0; color: var(--rtt-faint); font-size: 11.5px; }
.rtt-g-pop-note:empty { display: none; }
.rtt-g-pop-acts { display: flex; gap: 8px; }
.rtt-g-pop-go, .rtt-g-pop-alt { flex: 1; min-height: 32px; padding: 0 10px; border: 0; border-radius: 8px; font: 500 12.5px var(--rtt-font); }
.rtt-g-pop-go { background: var(--rtt-accent-fill); color: var(--rtt-on-accent); }
.rtt-g-pop-go:hover { background: var(--rtt-accent-hover); }
.rtt-g-pop-alt { background: var(--rtt-deep); color: var(--rtt-text); }
.rtt-g-pop button:focus-visible { outline: 2px solid var(--rtt-accent); outline-offset: 1px; }
.rtt-g-angle { font: 500 10px/1 var(--rtt-font); letter-spacing: 0.01em; }
.rtt-g-angle[hidden] { display: none; }
.rtt-g-label {
  position: absolute; left: 0; top: 0; pointer-events: none; white-space: nowrap;
  padding: 4px 8px; border-radius: 6px; background: var(--rtt-paper); color: var(--rtt-ink);
  font: 400 12.5px/16px var(--rtt-font); font-variant-numeric: tabular-nums lining-nums;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}

/* ── periodic table ─────────────────────────────────────────────────────── */

.rtt-pt { container-type: inline-size; }

/* Ported unchanged from assessment/components/run/periodic-table.css (Michael: "stunning"); tokens read through --rtt-*. */
.rtt-pt { --rtt-ground-pt: var(--ground, #1d4023); }

.pt-scrim {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: color-mix(in srgb, var(--rtt-ground-pt) 70%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: pt-fade 160ms ease-out;
}
@keyframes pt-fade { from { opacity: 0; } to { opacity: 1; } }

.pt-panel {
  width: 100%; max-width: 1180px; max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column; gap: 18px;
  padding: 26px 30px 24px;
  background: var(--rtt-paper); color: var(--rtt-text);
  border-radius: 14px; box-shadow: var(--rtt-elev);
  font-family: var(--rtt-font);
  overflow: hidden;
}

/* Its own window (app/periodic-table): the panel is the whole window. */
.pt-window { position: fixed; inset: 0; z-index: 99999; display: flex; background: var(--rtt-paper); }
.pt-window .pt-panel { max-width: none; max-height: none; height: 100dvh; border-radius: 0; box-shadow: none; }
.pt-window .pt-grid { --tile-h: clamp(40px, calc((100dvh - 230px) / 9.4), 72px); }

/* ── head: title, Find, pop out, close ── */

.pt-head { display: flex; align-items: center; gap: 16px; }
.pt-head .pt-pop { margin-right: -8px; }
.pt-head h2 {
  margin: 0; flex: 1;
  font-family: var(--rtt-font-display); font-weight: 400; font-size: 26px; line-height: 1.1; letter-spacing: -0.01em;
  color: var(--rtt-ink);
}
.pt-find input {
  width: 168px; height: 32px; padding: 0 12px;
  font: 300 14px/1 var(--rtt-font); color: var(--rtt-ink);
  background: var(--rtt-deep); border: 1px solid transparent; border-radius: 999px;
  -webkit-appearance: none; appearance: none;
}
.pt-find input::placeholder { color: var(--rtt-faint); }
.pt-find input:focus { outline: none; border-color: var(--rtt-accent); }
.pt-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 999px; border: 0;
  background: var(--rtt-deep); color: var(--rtt-muted); cursor: pointer;
}
.pt-close:hover { color: var(--rtt-ink); }
.pt-close:focus-visible { outline: 2px solid var(--rtt-accent); outline-offset: 2px; }

/* ── the table ── */

.pt-scroll { overflow: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
.pt-grid {
  display: grid;
  /* Tiles as tall as the screen allows, so the whole table fits without scrolling. */
  --tile-h: clamp(44px, calc((100dvh - 290px) / 9.4), 66px);
  grid-template-columns: 14px repeat(18, minmax(44px, 1fr));
  grid-template-rows: 16px repeat(7, var(--tile-h)) 10px repeat(2, var(--tile-h));
  gap: 3px;
  min-width: 860px;
}
.pt-group, .pt-period {
  font-size: 10px; font-weight: 400; color: var(--rtt-faint);
  font-variant-numeric: tabular-nums; line-height: 1;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 3px;
}
.pt-group { grid-row: 1; }
.pt-period { grid-column: 1; align-items: center; justify-content: flex-start; padding: 0; }

.pt-el {
  --hue: var(--rtt-quat);
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 3px 2px;
  border: 0; border-radius: 5px; cursor: pointer;
  background: color-mix(in srgb, var(--hue) 24%, var(--rtt-paper));
  color: var(--rtt-ink); font-family: var(--rtt-font);
  transition: opacity var(--dur, 160ms) ease, transform var(--dur, 160ms) ease, box-shadow var(--dur, 160ms) ease;
}
.pt-el .n { position: absolute; top: 3px; left: 5px; font-size: 9.5px; font-weight: 400; color: var(--rtt-muted); font-variant-numeric: tabular-nums; }
.pt-el .s { font-size: 18px; font-weight: 500; line-height: 1; letter-spacing: -0.01em; margin-top: 6px; }
.pt-el .nm { font-size: 8.5px; font-weight: 300; line-height: 1.1; white-space: nowrap; color: var(--rtt-text); }
/* Every name in full, never clipped: a tile is a size container, and its name (--nw, the name's width in em)
   is set to fill at most 97% of the tile, between 5.75px and 8.5px. Every tile is the same width, so where even the
   longest name would drop under 5.75px, all the names hide together; the element card still shows it. */
.pt-el { container-type: inline-size; }
@supports (width: 1cqi) { .pt-el .nm { font-size: clamp(5.75px, calc(97cqi / var(--nw, 6.6)), 8.5px); line-height: 9.35px; } }
@supports not (width: 1cqi) { .pt-el .nm { display: none; } }
@container (max-width: 38.9px) { .pt-el .nm { display: none; } }
.pt-el .m { font-size: 8.5px; font-weight: 300; line-height: 1.1; color: var(--rtt-muted); font-variant-numeric: tabular-nums; }
.pt-el:hover { transform: scale(1.06); z-index: 1; box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.35); }
.pt-el:focus-visible { outline: 2px solid var(--rtt-accent); outline-offset: 1px; z-index: 1; }
.pt-el.is-picked { box-shadow: inset 0 0 0 1.5px var(--rtt-accent); }
.pt-el.is-dim { opacity: 0.22; }

/* ── family tints ── */

.f-alkali     { --hue: #c4643f; }
.f-alkaline   { --hue: #c89a3c; }
.f-transition { --hue: #6f8fae; }
.f-post       { --hue: #8a86b4; }
.f-metalloid  { --hue: #8c9a4e; }
.f-nonmetal   { --hue: #3f8a5c; }
.f-halogen    { --hue: #3a8f95; }
.f-noble      { --hue: #a06b9a; }
.f-lanthanide { --hue: #c27d95; }
.f-actinide   { --hue: #94785e; }
.f-unknown    { --hue: #9a968c; }

/* ── the card for the element in focus ── */

/* Groups 3 to 12 of periods 1 to 3: the open space ptable.com uses. contain keeps the card from stretching the rows. */
.pt-card-wide { grid-column: 4 / 14; grid-row: 2 / 5; padding: 0 12px 12px; min-width: 0; contain: size; }
.pt-card-narrow { display: none; }

.pt-card { display: flex; gap: 18px; align-items: stretch; height: 100%; min-height: 0; }
.pt-card.is-empty { align-items: center; justify-content: center; }
.pt-card.is-empty p { margin: 0; font-size: 13px; font-weight: 300; color: var(--rtt-faint); }
.pt-big {
  flex: none; aspect-ratio: 1 / 1.08; height: 100%; min-height: 112px; max-height: 150px;
  position: relative; display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--hue, var(--rtt-quat)) 24%, var(--rtt-paper));
}
.pt-big .n { position: absolute; top: 8px; left: 10px; font-size: 13px; font-weight: 400; color: var(--rtt-muted); font-variant-numeric: tabular-nums; }
.pt-big .s { font-family: var(--rtt-font-display); font-weight: 400; font-size: 54px; line-height: 1; color: var(--rtt-ink); }
.pt-facts { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.pt-facts .nm { margin: 0; font-family: var(--rtt-font-display); font-weight: 400; font-size: 24px; line-height: 1.1; color: var(--rtt-ink); }
.pt-facts dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: 4px 28px; }
.pt-facts dl div { display: contents; }
.pt-facts dt { font-size: 12px; font-weight: 300; color: var(--rtt-muted); white-space: nowrap; }
.pt-facts dd { margin: 0; font-size: 13px; font-weight: 400; color: var(--rtt-ink); font-variant-numeric: tabular-nums; }
.pt-facts dd sup { font-size: 0.7em; line-height: 0; }
.pt-facts .pred { color: var(--rtt-faint); font-weight: 300; }

/* ── the key ── */

.pt-key { list-style: none; margin: 0; padding: 0 0 0 10px; display: flex; flex-wrap: wrap; gap: 2px; }
.pt-key button {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 9px 0 8px;
  font: 300 12px/1 var(--rtt-font); color: var(--rtt-text);
  background: transparent; border: 0; border-radius: 999px; cursor: pointer;
}
.pt-key button i { width: 10px; height: 10px; border-radius: 3px; background: color-mix(in srgb, var(--hue) 55%, var(--rtt-paper)); }
.pt-key button:hover, .pt-key button.is-on { background: var(--rtt-deep); color: var(--rtt-ink); }
.pt-key button:focus-visible { outline: 2px solid var(--rtt-accent); outline-offset: 1px; }

/* ── narrow (a phone, or the dock): the card above, the table below it.
   The same tiles, tints and key; only the layout changes. A container query,
   so the dock gets this at any screen size. ── */

@media (max-width: 760px) {
  .pt-scrim { padding: 0; }
  .pt-scrim .pt-panel { max-height: none; height: 100dvh; border-radius: 0; padding: 18px 16px 16px; gap: 14px; }
}

@container (max-width: 760px) {
  .pt-head h2 { font-size: 22px; }
  .pt-find input { width: 120px; }
  .pt-pop { display: none; }
  .pt-card-wide { display: none; }
  .pt-card-narrow { display: block; flex: none; height: 132px; }
  .pt-card { gap: 14px; }
  .pt-big { min-height: 0; height: 132px; }
  .pt-big .s { font-size: 40px; }
  .pt-facts { gap: 6px; }
  .pt-facts .nm { font-size: 20px; }
  .pt-facts dl { grid-template-columns: auto 1fr; gap: 1px 14px; }
  .pt-facts dt { font-size: 11.5px; }
  .pt-facts dd { font-size: 12.5px; }
  .pt-grid { --tile-h: 46px; grid-template-columns: 12px repeat(18, 42px); min-width: 0; }
  .pt-el .nm { display: none; }
  .pt-el .n { top: 2px; left: 4px; font-size: 8px; }
  .pt-el .s { font-size: 16px; margin-top: 8px; }
  .pt-el:hover { transform: none; box-shadow: none; }
  .pt-key { flex: none; padding: 0; }
  .pt-key button { white-space: nowrap; height: 26px; font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .pt-scrim { animation: none; }
  .pt-el { transition: none; }
  .pt-el:hover { transform: none; }
}


/* ── the first-run tour ── */

/* The root is the positioning box for the spotlight and the note. */
.pt-scrim, .pt-window { position: fixed; }
.pt-tour { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.pt-spot {
  position: absolute; border-radius: 9px;
  box-shadow: 0 0 0 2px var(--rtt-accent), 0 0 0 9999px rgba(8, 18, 11, 0.42);
  transition: left 260ms ease, top 260ms ease, width 260ms ease, height 260ms ease;
}
.pt-spot.is-none { left: 50%; top: 50%; width: 0; height: 0; box-shadow: 0 0 0 9999px rgba(8, 18, 11, 0.42); }
.pt-note {
  position: absolute; pointer-events: auto;
  padding: 16px 18px 14px;
  background: var(--rtt-paper); color: var(--rtt-text);
  border-radius: 12px; box-shadow: var(--rtt-elev);
  transition: left 260ms ease, top 260ms ease;
  animation: pt-fade 200ms ease-out;
}
.pt-note .t { margin: 0 0 4px; font-family: var(--rtt-font-display); font-weight: 400; font-size: 20px; line-height: 1.15; color: var(--rtt-ink); }
.pt-note .b { margin: 0 0 14px; font-size: 14px; font-weight: 300; line-height: 1.45; }
.pt-note .row { display: flex; align-items: center; gap: 14px; }
.pt-note .count { flex: 1; font-size: 12px; font-weight: 300; color: var(--rtt-faint); font-variant-numeric: tabular-nums; }
.pt-note .skip { border: 0; background: none; padding: 0; font: 300 13px/1 var(--rtt-font); color: var(--rtt-muted); cursor: pointer; }
.pt-note .skip:hover { color: var(--rtt-ink); }
.pt-note .next {
  height: 30px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--rtt-accent-fill); color: var(--rtt-on-accent); font: 400 13px/1 var(--rtt-font);
}
.pt-note .next:hover { background: var(--rtt-accent-hover); }
.pt-note button:focus-visible { outline: 2px solid var(--rtt-accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .pt-spot, .pt-note { transition: none; animation: none; } }

/* ── the table in the dock ── */

.rtt-pt.pt-mode-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pt-mode-panel > .pt-panel { max-width: none; max-height: none; flex: 1 1 auto; min-height: 0; padding: 0; gap: 12px; background: transparent; border-radius: 0; box-shadow: none; overflow: visible; }
.pt-mode-panel .pt-head { gap: 10px; }
.pt-mode-panel .pt-spacer { flex: 1; }
.pt-mode-panel .pt-scroll { flex: none; }
.rtt-pane-periodic { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
/* The tour's spotlight and note are placed within the table's own box. */
.rtt-pt.pt-mode-panel { position: relative; }
/* In the dock the whole table fits the width: the same tiles, smaller, symbol and number. */
@container (max-width: 760px) {
  .pt-mode-panel .pt-grid { --tile-h: 34px; grid-template-columns: 10px repeat(18, minmax(0, 1fr)); gap: 2px; }
  .pt-mode-panel .pt-el { border-radius: 4px; padding: 1px; }
  .pt-mode-panel .pt-el .s { font-size: 13px; margin-top: 7px; }
  .pt-mode-panel .pt-el .n { top: 1px; left: 2px; font-size: 7.5px; }
  .pt-mode-panel .pt-el .m { display: none; }
  .pt-mode-panel .pt-period, .pt-mode-panel .pt-group { font-size: 8.5px; }
  .pt-mode-panel .pt-key { gap: 0; }
  .pt-mode-panel .pt-key button { height: 24px; padding: 0 7px 0 6px; font-size: 11px; gap: 5px; }
}
@container (max-width: 420px) {
  .pt-mode-panel .pt-grid { --tile-h: 28px; }
  .pt-mode-panel .pt-el .s { font-size: 11.5px; margin-top: 4px; }
  .pt-mode-panel .pt-el .n { display: none; }
}

/* ── the panels layout (dock/panels.ts): a card for each tool ──────────────── */

.rtt-panel-head { justify-content: flex-start; }
.rtt-panel-title { flex: 1 1 auto; margin: 0; font: 400 19px/22px var(--rtt-font-display); letter-spacing: -0.01em; color: var(--rtt-ink); }
.rtt-panel-head > .rtt-seg { flex: none; }
.rtt-panel-body { overflow-y: auto; overscroll-behavior: contain; }
.rtt-panels-right { display: contents; }
.rtt-panels-right[hidden] { display: none; }
.rtt-panel[hidden] { display: none; }

/* Calculator alone: the column it always was. */
.rtt-split[data-panels="column"] .rtt-panels-col[data-open] { --rtt-dock-w: 440px; }
.rtt-split[data-panels="column"] .rtt-panels-col .rtt-panel[data-panel="calc"] { position: absolute; }

/* A graph or a sheet is open: the page takes about 35% and the cards the other 65%. The graph fills the column; the
   calculator, when open, sits under it. */
.rtt-split[data-panels="grid"] { display: grid; grid-template-columns: minmax(0, 35fr) minmax(0, 65fr); grid-template-rows: minmax(0, 1fr) auto; }
.rtt-split[data-panels="grid"] > .rtt-split-main { grid-column: 1; grid-row: 1 / -1; }
.rtt-split[data-panels="grid"] > .rtt-split-dock { display: contents; width: auto; transition: none; }
.rtt-split[data-panels="grid"] .rtt-panel { position: relative; inset: auto; width: auto; min-height: 0; }
.rtt-split[data-panels="grid"] .rtt-panels-right { display: flex; flex-direction: column; gap: var(--rtt-dock-gap, 16px); grid-column: 2; grid-row: 1; min-height: 0; padding: 0 var(--rtt-dock-gap, 16px) var(--rtt-dock-gap, 16px) var(--rtt-dock-gap, 16px); }
.rtt-split[data-panels="grid"] .rtt-panels-right[hidden] { display: none; }
.rtt-split[data-panels="grid"] .rtt-panels-right .rtt-panel { flex: 1 1 0; }
.rtt-split[data-panels="grid"] .rtt-panel[data-panel="calc"] { grid-column: 2; grid-row: 2; margin: 0 var(--rtt-dock-gap, 16px) var(--rtt-dock-gap, 16px); max-height: 46dvh; }
.rtt-split[data-panels="grid"] .rtt-panel[data-panel="graph"] .rtt-panel-body { overflow: hidden; }

/* The sheet's contents, stacked. */
.rtt-panels-col[data-sheet] { display: block; }
.rtt-panels-col[data-sheet] .rtt-dock-handle { position: sticky; top: 0; z-index: 2; background: var(--rtt-paper); border-radius: 14px 14px 0 0; height: 22px; margin: 0; }
.rtt-panels-col[data-sheet] { overflow-y: auto; background: var(--rtt-paper); border-radius: 14px 14px 0 0; box-shadow: 0 -10px 40px -14px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(0, 0, 0, 0.06); padding-bottom: env(safe-area-inset-bottom, 0px); overscroll-behavior: contain; }
.rtt-panels-col[data-sheet] .rtt-panels-right { display: block; }
.rtt-panels-col[data-sheet] .rtt-panel { position: relative; inset: auto; width: auto; box-shadow: none; border-radius: 0; background: transparent; }
.rtt-panels-col[data-sheet] .rtt-panel + .rtt-panel, .rtt-panels-col[data-sheet] .rtt-panels-right > .rtt-panel { border-top: 1px solid var(--rtt-rule); }
.rtt-panels-col[data-sheet] .rtt-panel-body { overflow: visible; }
.rtt-panels-col[data-sheet] .rtt-panel[data-panel="graph"] .rtt-panel-body { height: min(60dvh, 420px); }
.rtt-panels-col[data-sheet] .rtt-panel[data-panel="ref"] .rtt-panel-body { height: 70dvh; }

/* The reference sheet. */
.rtt-panel[data-panel="ref"] .rtt-panel-body { padding: 0 14px 14px; display: flex; flex-direction: column; overflow: hidden; }
.rtt-ref-frame { flex: 1 1 auto; width: 100%; min-height: 0; border: 0; border-radius: var(--rtt-r-key); background: var(--rtt-deep); }
.rtt-ref-note { margin: 0; padding: 8px 2px; font: 400 14px/20px var(--rtt-font); color: var(--rtt-muted); }
.rtt-panel-body > .rtt-graph-wrap, .rtt-panel-body > .rtt-pane { flex: 1 1 auto; min-height: 0; }

/* A card in a window of its own fills it. */
.rtt-popout { background: var(--paper, #fbf9f4); }
.rtt-panel.is-popped { position: fixed; inset: 0; width: auto; height: auto; max-height: none; margin: 0; border-radius: 0; box-shadow: none; }
.rtt-panel.is-popped .rtt-pop { display: none; }
.rtt-panel.is-popped .rtt-panel-body { overflow-y: auto; }

/* ── the graph card: the graph is the card ─────────────────────────────────
   The expressions float over the top left in a menu that folds away to a small button; the whole card is canvas.
   The expand button lifts the card over the page to fill the screen (Esc brings it back). */
.rtt-panel.is-floating .rtt-panel-body { position: relative; padding: 0; }
.rtt-panel.is-floating .rtt-graph-wrap, .rtt-panel.is-floating .rtt-graph { position: static; display: block; height: 100%; }
.rtt-panel.is-floating .rtt-g-stage { position: absolute; inset: 0; border-radius: 0 0 var(--rtt-r) var(--rtt-r); }
.rtt-panel.is-floating .rtt-g-list {
  position: absolute; z-index: 4; top: 52px; left: 12px; width: min(320px, calc(100% - 24px)); max-height: calc(100% - 76px);
  padding: 6px 6px 4px; background: color-mix(in srgb, var(--rtt-paper) 94%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2);
  border-radius: 12px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 14px 34px -14px rgba(0, 0, 0, 0.35);
}
.rtt-panel.is-floating[data-menu="closed"] .rtt-g-list { display: none; }
.rtt-g-menu-btn {
  position: absolute; z-index: 5; top: 8px; left: 12px; height: 34px; padding: 0 12px 0 14px; display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; background: var(--rtt-accent-fill); color: var(--rtt-on-accent); font: 500 13px/1 var(--rtt-font);
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.5);
}
.rtt-g-menu-btn:hover { background: var(--rtt-accent-hover); }
.rtt-g-menu-btn svg { transition: transform var(--rtt-dur); transform: rotate(-90deg); }
.rtt-g-menu-btn[aria-expanded="false"] svg { transform: rotate(90deg); }
.rtt-panel:not(.is-floating) .rtt-g-menu-btn { display: none; }
.rtt-panel[data-panel="graph"].is-full {
  position: fixed; inset: 10px; z-index: 10040; width: auto; height: auto; max-height: none; margin: 0;
}
.rtt-panel.is-popped .rtt-expand { display: none; }
@media (max-width: 899.98px) { .rtt-panels-col[data-sheet] .rtt-panel.is-floating .rtt-g-list { top: 48px; max-height: calc(100% - 70px); } }

/* No scrollbars in the panels: what scrolls (a long list of expressions) still does, but nothing draws a bar. */
.rtt-panel, .rtt-panel .rtt-panel-body, .rtt-panel .rtt-sci, .rtt-panel .rtt-pane, .rtt-panel .rtt-g-list, .rtt-panel .rtt-sci-hist, .rtt-panels-col { scrollbar-width: none; -ms-overflow-style: none; }
.rtt-panel::-webkit-scrollbar, .rtt-panel *::-webkit-scrollbar, .rtt-panels-col::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* ── the calculator folded away while a graph is up ─────────────────────────
   An icon in the corner of the screen; it opens a condensed calculator (the keys a student wants beside a graph). */
.rtt-mini-btn { display: none; }
.rtt-split[data-panels="grid"] .rtt-panel[data-panel="calc"].is-mini {
  position: fixed; z-index: 10030; right: 28px; bottom: 28px; left: auto; top: auto; margin: 0; width: 56px; height: 56px; max-height: none;
  border-radius: 999px; overflow: hidden; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
  background: var(--rtt-accent-fill); color: var(--rtt-on-accent);
}
.rtt-split[data-panels="grid"] .rtt-panel[data-panel="calc"].is-mini .rtt-mini-btn {
  display: grid; place-items: center; position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: none; color: inherit; cursor: pointer; z-index: 3;
}
.rtt-split[data-panels="grid"] .rtt-panel[data-panel="calc"].is-mini:not(.is-mini-open) > :not(.rtt-mini-btn) { visibility: hidden; }
.rtt-split[data-panels="grid"] .rtt-panel[data-panel="calc"].is-mini.is-mini-open {
  width: min(344px, calc(100vw - 56px)); height: auto; max-height: calc(100dvh - 96px); border-radius: 18px;
  background: var(--rtt-paper); color: var(--rtt-text);
}
.rtt-panel[data-panel="calc"].is-mini-open { --rtt-key-h: 34px; }
.rtt-panel.is-mini-open .rtt-sci-hist, .rtt-panel.is-mini-open .rtt-pad-more, .rtt-panel.is-mini-open .rtt-sci-meta-end, .rtt-panel.is-mini-open .rtt-pop { display: none !important; }
.rtt-panel.is-mini-open .rtt-sci-screen { min-height: 0; padding: 6px 12px; }
.rtt-panel.is-mini-open .rtt-sci-line { min-height: 36px; font-size: 18px; }
.rtt-panel.is-mini-open .rtt-sci-preview { min-height: 26px; font-size: 18px; }
/* The condensed function block: brackets, sin cos tan, pi, e, x squared, x to the y, root, log, ln. */
.rtt-panel.is-mini-open .rtt-pad-fn { grid-auto-rows: var(--rtt-key-h); }
.rtt-panel.is-mini-open .rtt-pad-fn > :is(:nth-child(3), :nth-child(4), :nth-child(9), :nth-child(10), :nth-child(11), :nth-child(14), :nth-child(16), :nth-child(18), :nth-child(19), :nth-child(20), :nth-child(23), :nth-child(24)) { display: none; }
.rtt-panel.is-mini-open .rtt-sci-pad { grid-template-columns: minmax(0, 1fr) !important; }
.rtt-panel.is-mini-open .rtt-dock-head { padding: 10px 10px 6px 14px; }
.rtt-panel.is-mini-open .rtt-panel-title { font-size: 17px; }

/* ── every card fits the space it is given ─────────────────────────────────
   Each card measures itself (not the window): the header, the graph's tools and the floating menu all scale down. */
.rtt-panel { container-type: inline-size; container-name: rttcard; }
@container rttcard (max-width: 520px) {
  .rtt-panel-title { font-size: 17px; }
  .rtt-panel-head { padding: 10px 8px 6px 12px; gap: 6px; }
  .rtt-panel-head .rtt-dock-close { width: 28px; height: 28px; }
  .rtt-panel-head > .rtt-seg button { padding: 0 8px; font-size: 11px; }
}
@container rttcard (max-width: 400px) {
  .rtt-g-menu-btn { height: 30px; padding: 0 10px; font-size: 12px; }
  .rtt-panel.is-floating .rtt-g-list { top: 46px; width: calc(100% - 24px); max-height: 52%; }
  .rtt-panel.is-floating .rtt-g-ctl { transform: scale(0.88); transform-origin: top right; }
  .rtt-panel-body { padding-left: 10px; padding-right: 10px; }
}
.rtt-panel[data-panel="ref"] .rtt-panel-body { padding-left: 10px; padding-right: 10px; }
@container rttcard (max-width: 360px) {
  .rtt-key { font-size: 12.5px; }
  .rtt-key.is-op, .rtt-key.is-eq { font-size: 17px; }
}

/* The split is a grid in every panels state, so its columns can glide from one layout to the next (panels.ts, morph). */
.rtt-split[data-panels] { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); }
.rtt-split[data-panels] > .rtt-split-main { grid-column: 1; grid-row: 1; }
.rtt-split[data-panels] > .rtt-split-dock { grid-column: 2; grid-row: 1; }
.rtt-split[data-panels="sheet"] { display: flex; }
.rtt-split[data-panels="grid"] { grid-template-columns: minmax(0, 35fr) minmax(0, 65fr); grid-template-rows: minmax(0, 1fr) auto; }
.rtt-split[data-panels="grid"] > .rtt-split-main { grid-row: 1 / -1; }

/* The editable table of values: x and y cells, a dot on the graph for each filled line. */
.rtt-g-tablerow { align-items: start; }
.rtt-g-edit { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rtt-g-edit th { font: 400 13px/22px var(--rtt-font); color: var(--rtt-muted); text-align: left; padding: 4px 6px 2px; }
.rtt-g-edit th:last-child, .rtt-g-edit td:last-child { width: 26px; }
.rtt-g-edit td { padding: 1px 3px 1px 0; }
.rtt-g-cell { width: 100%; height: 30px; padding: 0 8px; border: 1px solid var(--rtt-edge); border-radius: 6px; background: var(--rtt-paper); color: var(--rtt-ink); font: 400 14px/30px var(--rtt-font); font-variant-numeric: tabular-nums lining-nums; -webkit-appearance: none; appearance: none; }
.rtt-g-cell:focus { outline: none; border-color: var(--rtt-accent); }
.rtt-g-cell-end { text-align: center; }
.rtt-g-add { display: inline-flex; align-items: center; gap: 8px; margin: 6px 4px 4px; height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--rtt-deep); color: var(--rtt-muted); font: 500 12.5px/1 var(--rtt-font); align-self: flex-start; }
.rtt-g-add:hover { color: var(--rtt-ink); background: color-mix(in srgb, var(--rtt-ink) 7%, var(--rtt-deep)); }
.rtt-g-tablerow .rtt-g-acts { opacity: 1; }
