/* DB Design Studio: the "drafting table" look of SQL Behind the Scenes (graph paper, navy ink, highlighter). */
:root {
  --bg: #e7ecf0; --panel: #fbfcfd; --panel-2: #f0f3f6;
  --ink: #13213a; --ink-2: #3d4b62; --ink-3: #586579;
  --line: #c6d0d9; --line-2: #e0e6ec; --grid: rgb(19 33 58 / 7%);
  --accent: #2340c8; --accent-ink: #fff; --accent-soft: #e0e5fb;
  --err: #b02c2c; --err-soft: #f8e0de; --warn: #9a5b00; --warn-soft: #f7eacd; --hint: #2340c8;
  --mark: #ffe34d; --paper: #fbfcfd; --ok: #1d7a46;
  --mono: "Recursive", ui-monospace, Menlo, monospace;
  --sans: "Recursive", system-ui, sans-serif;
  --r: 6px;
}
/* the browser draws radios, checkboxes and selects in this scheme: follow the page's theme, not the system's
   (a Mac in dark mode with the page in light drew unchosen radios as filled dots) */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="dark"] {
  --bg: #0b1727; --panel: #102136; --panel-2: #14283f;
  --ink: #e6eef8; --ink-2: #b0c1d7; --ink-3: #8195b0;
  --line: #26405f; --line-2: #1b3049; --grid: rgb(140 185 255 / 8%);
  --accent: #93abff; --accent-ink: #0b1727; --accent-soft: #1f3468;
  --err: #ff8e88; --err-soft: #3c1d22; --warn: #f2b84b; --warn-soft: #3b3018; --hint: #93abff;
  --mark: #75610f; --paper: #0e1d30; --ok: #6fd39a;
}
* { box-sizing: border-box; }
html { font-size: clamp(15px, 1.05vw, 16px); } /* the smallest text (0.8125rem) stays at 12px or more */
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-variation-settings: "CASL" 0; min-height: 100vh; }
code, .er-card, .asg { font-family: var(--mono); font-variation-settings: "MONO" 1; }
button { font: inherit; color: inherit; }
.muted { color: var(--ink-3); }
.small { font-size: 0.8125rem; line-height: 1.45; }

.topbar { display: flex; align-items: center; gap: 1rem; padding: 0.625rem 1rem; border-bottom: 2px solid var(--ink); background: var(--panel); flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 1.125rem; font-weight: 700; flex: 1 1 auto; }
.topbar h1 small { font-weight: 400; color: var(--ink-3); font-size: 0.8125rem; margin-left: 0.5rem; }
.back { color: var(--ink-2); text-decoration: none; }
.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tabs button { border: 0; background: transparent; padding: 0.375rem 0.75rem; cursor: pointer; font-size: 0.8125rem; }
.tabs button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); font-weight: 600; }
.tabs button:disabled { color: var(--ink-3); cursor: default; }
.icon-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; min-width: 2.25rem; min-height: 2.25rem; cursor: pointer; }

.filebar { display: flex; gap: 0.375rem; align-items: center; flex-wrap: wrap; padding: 0.5rem 1rem; }
.doc-name { font: 600 0.9375rem var(--sans); border: 1px solid transparent; background: transparent; color: var(--ink); padding: 0.25rem 0.375rem; border-radius: var(--r); min-width: 12rem; }
.doc-name:hover, .doc-name:focus { border-color: var(--line); background: var(--panel); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 0.3125rem 0.625rem; min-height: 2rem; cursor: pointer; font-size: 0.8125rem; }
.btn:hover { border-color: var(--ink-3); }
.status { color: var(--ink-3); font-size: 0.8125rem; margin-left: 0.5rem; }

.studio { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) 20rem; grid-template-rows: minmax(0, 1fr); gap: 0.75rem; padding: 0 1rem 1rem; height: calc(100vh - 7.5rem); min-height: 30rem; }
.tools { display: flex; flex-direction: column; gap: 0.25rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.375rem; overflow: auto; }
.tools button { display: flex; flex-direction: column; align-items: center; gap: 0.125rem; border: 1px solid transparent; background: transparent; border-radius: var(--r); padding: 0.1875rem 0.25rem; cursor: pointer; font-size: 0.8125rem; color: var(--ink-2); }
.tools button:hover { background: var(--panel-2); }
.tools button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.tools hr { border: 0; border-top: 1px solid var(--line-2); margin: 0.25rem 0; }
.ti { display: block; width: 2.5rem; height: 1.25rem; margin: 0 auto 0.125rem; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; overflow: visible; }
.ti text { fill: var(--ink); stroke: none; font: 600 11px var(--font, sans-serif); }

.paper-wrap { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.paper-hint { margin: 0 0 0.375rem; font-size: 0.8125rem; color: var(--ink-3); min-height: 1.2em; }
.paper { position: relative; flex: 1; min-height: 0; overflow: hidden; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 8px; background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 20px 20px; }
/* the ER tab's endless canvas only: its one SVG fills the paper and the camera pans it. The Normalization and
   Relational algebra panes reuse .paper for the look, but their diagrams keep their own size and the pane scrolls. */
#paper > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
.paper.norm-out { overflow: auto; }
.paper.mode-create svg { cursor: crosshair; }
.paper.mode-link svg { cursor: alias; }
.inline-name { position: absolute; font: 600 0.875rem var(--sans); border: 2px solid var(--accent); border-radius: 4px; padding: 0.125rem 0.25rem; background: var(--panel); color: var(--ink); text-align: center; z-index: 2; }

/* the drawing */
.er-shape, .er-inner { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.er-inner { fill: none; stroke-width: 1.2; }
.er-shape.is-derived { stroke-dasharray: 5 4; }
.er-name { font: 600 14px var(--sans); fill: var(--ink); pointer-events: none; }
.er-attr .er-name, .er-rel .er-name, .er-composite .er-name { font-weight: 500; font-size: 13px; }
.er-attr .er-name { font-size: 12px; }
.er-name.is-key { text-decoration: underline; }
.er-name.is-partial { text-decoration: underline dashed; }
.er-spec .er-name { font-size: 15px; }
.er-node { cursor: move; }
.er-stroke { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.er-double-outer { fill: none; stroke: var(--ink); stroke-width: 5; }
.er-double-inner { fill: none; stroke: var(--paper); stroke-width: 2; }
.er-subset { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.er-hit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; }
.er-card { font-size: 12px; fill: var(--ink-2); cursor: pointer; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; }
.er-node.is-sel .er-shape { stroke: var(--accent); stroke-width: 2.5; }
.er-line.is-sel .er-stroke { stroke: var(--accent); stroke-width: 2.5; }
.er-node.is-pending .er-shape { fill: var(--accent-soft); }
.er-node.is-error .er-shape { stroke: var(--err); }
.er-node.is-warn .er-shape { stroke: var(--warn); }
.er-line.is-error .er-stroke { stroke: var(--err); stroke-dasharray: 6 4; }
.er-line.is-warn .er-stroke { stroke: var(--warn); }
.er-card.is-error { fill: var(--err); }
.er-node.is-trace .er-shape { fill: var(--mark); }
.er-line.is-trace .er-stroke { stroke-width: 3; }

/* side panels */
.side { display: flex; flex-direction: column; gap: 0.75rem; overflow: auto; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; }
.panel h2 { margin: 0 0 0.5rem; font-size: 0.875rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.panel summary { cursor: pointer; font-weight: 600; font-size: 0.875rem; padding: 0.25rem 0; }
.count { font-weight: 400; color: var(--ink-3); text-transform: none; letter-spacing: 0; }
.inspector label { display: block; font-size: 0.8125rem; color: var(--ink-3); margin: 0.5rem 0 0.125rem; }
.inspector input[type=text], .inspector select { width: 100%; font: inherit; font-size: 0.875rem; padding: 0.3125rem 0.4375rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--ink); }
.inspector .row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; font-size: 0.8125rem; }
.inspector .row label { display: inline-flex; gap: 0.25rem; align-items: center; margin: 0; color: var(--ink-2); font-size: 0.8125rem; }
.inspector .reads { margin: 0.5rem 0 0; padding: 0.5rem; background: var(--panel-2); border-radius: var(--r); font-size: 0.8125rem; line-height: 1.45; }
.inspector .del { margin-top: 0.75rem; color: var(--err); }
.chips { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.25rem; }
.chips button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; padding: 0.0625rem 0.5rem; font: 0.8125rem var(--mono); cursor: pointer; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.375rem; }
.checks li { font-size: 0.8125rem; line-height: 1.4; padding: 0.375rem 0.5rem 0.375rem 0.625rem; border-left: 3px solid var(--line); background: var(--panel-2); border-radius: 0 var(--r) var(--r) 0; cursor: pointer; }
.checks li.is-error { border-left-color: var(--err); }
.checks li.is-warn { border-left-color: var(--warn); }
.checks li.is-hint { border-left-color: var(--hint); }
.checks li b { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: .04em; margin-right: 0.25rem; }
.checks li.is-error b { color: var(--err); } .checks li.is-warn b { color: var(--warn); } .checks li.is-hint b { color: var(--hint); }
.checks .ok { cursor: default; border-left-color: var(--hint); }

/* review */
.btn-primary { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.rv-row { display: flex; gap: 0.375rem; margin: 0.5rem 0; }
.rv-row select { flex: 1; min-width: 0; font: inherit; font-size: 0.8125rem; padding: 0.25rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin: 0.25rem 0 0.5rem; }
.seg button { border: 0; background: transparent; padding: 0.25rem 0.625rem; font-size: 0.8125rem; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); font-weight: 600; }
.rv-summary { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.5rem; }
.rv-chip { font-size: 0.8125rem; padding: 0.0625rem 0.5rem; border-radius: 999px; border: 1px solid currentColor; background: transparent; cursor: pointer; }
.rv-chip[aria-pressed="false"] { opacity: 0.45; }
.v-error { color: var(--err); } .v-choice { color: var(--warn); } .v-equivalent { color: var(--hint); } .v-same { color: var(--ok); }
.checks li.v-error { border-left-color: var(--err); } .checks li.v-choice { border-left-color: var(--warn); }
.checks li.v-equivalent { border-left-color: var(--hint); } .checks li.v-same { border-left-color: var(--ok); }
.rv-list li { color: var(--ink); }
.rv-source { position: absolute; left: 0.75rem; bottom: 0.75rem; z-index: 3; max-width: min(36rem, calc(100% - 1.5rem)); max-height: 45%; overflow: auto;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r); background: var(--panel);
  box-shadow: 0 4px 16px rgb(19 33 58 / 14%); font-size: 0.875rem; line-height: 1.5; color: var(--ink); }
.rv-source .rv-close { position: absolute; top: 0.25rem; right: 0.25rem; min-width: 1.75rem; min-height: 1.75rem; border: 0; background: none; color: var(--ink-2); cursor: pointer; font-size: 1rem; }
.rv-source p { margin: 0.25rem 0; }
.rv-source .rv-note { color: var(--ink-2); padding-left: 0.75rem; border-left: 2px solid var(--line); }
.rv-list li b { text-transform: uppercase; font-size: 0.8125rem; letter-spacing: 0.04em; margin-right: 0.25rem; }
.rv-list li.is-on { outline: 2px solid var(--accent); }
.refs { display: block; margin-top: 0.25rem; font-size: 0.8125rem; color: var(--ink-3); }
.refs button { border: 0; background: var(--panel); border-radius: 4px; padding: 0 0.25rem; margin-left: 0.125rem; font: 0.8125rem var(--mono); color: var(--accent); cursor: pointer; }
.desc { margin: 0; padding-left: 1.75rem; font-size: 0.8125rem; line-height: 1.45; }
.desc li { padding: 0.125rem 0.25rem; border-radius: 4px; cursor: pointer; }
.desc li:hover { background: var(--panel-2); }
.desc li.is-on { background: var(--mark); color: #13213a; }
.weak { list-style: none; margin: 0; padding: 0; font-size: 0.8125rem; }
.weak li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.25rem 0; border-bottom: 1px solid var(--line-2); }
.weak li span:last-child { color: var(--err); font-weight: 600; }
.paper.is-key { background-color: var(--panel-2); }
.paper.is-key .er-node { cursor: pointer; }

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; height: auto; }
  .tools { flex-direction: row; flex-wrap: wrap; justify-content: center; overflow: visible; }
  .tools button { min-width: 4.25rem; min-height: 2.75rem; }
  .tabs button, .btn, .icon-btn, .norm-steps button, .seg button, .zoom-ctl button { min-height: 2.75rem; }
  .tabs button { padding: 0.5rem 0.875rem; }
  .zoom-ctl button { min-width: 2.75rem; }
  html { font-size: 16px; } /* phones: 2.75rem targets are 44px */
  .back { display: inline-block; padding: 0.75rem 0; }
  .doc-name { min-height: 2.75rem; }
  .panel summary, .ra-cx summary { padding: 0.625rem 0; }
  .tools .zoom-ctl button { min-width: 2.75rem; }
  .norm-steps button { min-width: 2.75rem; }
  /* the theme switch sits beside "Study aids" so the tabs keep the whole row */
  .topbar { position: relative; }
  #themeBtn { position: absolute; top: 0.5rem; right: 1rem; min-width: 2.75rem; min-height: 2.75rem; }
  .tools hr { display: none; }
  .paper { height: 70vh; }
  #paper { flex: none; } /* its SVG is absolute (endless canvas), so flex: 1 in the stacked layout left it 0px tall */
}

/* ---- normalization lab ---- */
.normlab { display: grid; grid-template-columns: 24rem minmax(0, 1fr) 20rem; gap: 0.75rem; padding: 0.5rem 1rem 1rem; height: calc(100vh - 4rem); min-height: 30rem; }
.normlab[hidden] { display: none; }
.norm-edit { display: flex; flex-direction: column; min-height: 0; margin: 0; }
.norm-edit.is-dim textarea { opacity: 0.5; }
.norm-edit-head { display: flex; gap: 0.375rem; align-items: center; }
.norm-edit-head h2 { flex: 1; margin: 0; }
#normText { flex: 1; min-height: 12rem; margin-top: 0.5rem; resize: none; font: 0.78rem/1.5 var(--mono); font-variation-settings: "MONO" 1; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 0.5rem; white-space: pre; tab-size: 2; }
.norm-help p { margin: 0.375rem 0; }
.norm-canvas { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.norm-out { padding: 0.75rem 1rem 1.5rem; }
.norm-out.is-key { outline: 3px solid var(--mark); outline-offset: -3px; }
.norm-empty { padding: 1rem; }
.norm-stage h3 { font-size: 1rem; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; margin: 1rem 0 0.25rem; }
.norm-stage:first-child h3 { margin-top: 0; }
.norm-table { margin: 0.25rem 0 0.75rem; cursor: pointer; }
.norm-table figcaption { font-size: 0.8125rem; margin-bottom: 0.125rem; }
.nf-chip { font: 600 0.8125rem var(--mono); font-variation-settings: "MONO" 1; padding: 0 0.375rem; border-radius: 999px; border: 1px solid currentColor; }
.nf-chip.ok { color: var(--ok); }
.nf-chip.bad { color: var(--err); }
.dep-wrap { overflow-x: auto; }
.dep, .decomp { display: block; }
.dep-attr rect { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; }
.dep-attr text { font: 500 12px var(--mono); font-variation-settings: "MONO" 1; fill: var(--ink); }
.dep-attr.is-pk text { font-weight: 700; text-decoration: underline; }
.dep-attr.is-bad rect { stroke: var(--err); stroke-width: 2; fill: var(--err-soft); }
.dep-line { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.dep-head { fill: var(--ink); }
.dep-label { font: 12px var(--sans); fill: var(--ink-2); paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.dep-label.is-wrong { fill: var(--warn); font-weight: 600; }
.dep-dep.is-derived .dep-line { stroke-dasharray: 4 3; }
.dep-dep.is-derived .dep-label { font-style: italic; }
.dep-dep.has-ln:hover .dep-line { stroke: var(--accent); }
.decomp-name { font: 700 13px var(--sans); fill: var(--ink); }
.decomp-stage { font: italic 600 13px var(--sans); fill: var(--ink-3); }
@media (max-width: 900px) {
  .normlab { grid-template-columns: 1fr; height: auto; }
  #normText { min-height: 16rem; }
  .norm-out { min-height: 20rem; }
}
[hidden] { display: none !important; }

/* (min, max) ↔ the words that state it (key view, local only) */
:root { --says-0: #d9480f; --says-1: #2b8a3e; --says-2: #1971c2; --says-3: #ae3ec9; --says-4: #c2255c; --says-5: #0c8599; --says-6: #b08800; --says-7: #5f3dc4; }
.er-card.says { font-weight: 700; }
.says-bg { fill-opacity: 0.16; stroke: none; }
.says-0.says-bg { fill: var(--says-0); } .er-card.says-0 { fill: var(--says-0); } mark.says-0 { background: color-mix(in srgb, var(--says-0) 18%, transparent); color: inherit; box-shadow: inset 0 -2px var(--says-0); }
.says-1.says-bg { fill: var(--says-1); } .er-card.says-1 { fill: var(--says-1); } mark.says-1 { background: color-mix(in srgb, var(--says-1) 18%, transparent); color: inherit; box-shadow: inset 0 -2px var(--says-1); }
.says-2.says-bg { fill: var(--says-2); } .er-card.says-2 { fill: var(--says-2); } mark.says-2 { background: color-mix(in srgb, var(--says-2) 18%, transparent); color: inherit; box-shadow: inset 0 -2px var(--says-2); }
.says-3.says-bg { fill: var(--says-3); } .er-card.says-3 { fill: var(--says-3); } mark.says-3 { background: color-mix(in srgb, var(--says-3) 18%, transparent); color: inherit; box-shadow: inset 0 -2px var(--says-3); }
.says-4.says-bg { fill: var(--says-4); } .er-card.says-4 { fill: var(--says-4); } mark.says-4 { background: color-mix(in srgb, var(--says-4) 18%, transparent); color: inherit; box-shadow: inset 0 -2px var(--says-4); }
.says-5.says-bg { fill: var(--says-5); } .er-card.says-5 { fill: var(--says-5); } mark.says-5 { background: color-mix(in srgb, var(--says-5) 18%, transparent); color: inherit; box-shadow: inset 0 -2px var(--says-5); }
.says-6.says-bg { fill: var(--says-6); } .er-card.says-6 { fill: var(--says-6); } mark.says-6 { background: color-mix(in srgb, var(--says-6) 18%, transparent); color: inherit; box-shadow: inset 0 -2px var(--says-6); }
.says-7.says-bg { fill: var(--says-7); } .er-card.says-7 { fill: var(--says-7); } mark.says-7 { background: color-mix(in srgb, var(--says-7) 18%, transparent); color: inherit; box-shadow: inset 0 -2px var(--says-7); }
mark.says { padding: 0 0.125rem; border-radius: 3px; }
.asg { white-space: pre-wrap; font: 0.8125rem/1.5 var(--mono); max-height: 60vh; overflow: auto; margin: 0.5rem 0 0; }
:root[data-theme="dark"] { --says-0: #ff922b; --says-1: #69db7c; --says-2: #74c0fc; --says-3: #e599f7; --says-4: #f783ac; --says-5: #66d9e8; --says-6: #ffd43b; --says-7: #b197fc; }

.sign-in { font-size: 0.8125rem; color: var(--muted, inherit); text-decoration: none; padding: 0.25rem 0.5rem; border-radius: 6px; white-space: nowrap; }
.sign-in:hover { text-decoration: underline; }

.paper.mode-pan svg, .paper.can-pan svg { cursor: grab; }
.paper.is-panning svg { cursor: grabbing; }

/* step by step */
.norm-steps { position: sticky; top: -0.75rem; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; margin: -0.75rem -1rem 0.75rem; padding: 0.5rem 1rem; background: var(--panel, var(--bg)); border-bottom: 1px solid var(--line); }
.norm-steps button { font: inherit; font-size: 0.8125rem; padding: 0.25rem 0.625rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); cursor: pointer; }
.norm-steps button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); font-weight: 600; border-color: var(--accent); }
.norm-steps button:disabled { opacity: 0.4; cursor: default; }
.norm-steps .muted { margin-left: 0.5rem; }
.norm-steps-sep { width: 0.75rem; }
.norm-step-note { margin: 0.25rem 0 1rem; padding: 0.5rem 0.75rem; border-left: 3px solid var(--accent); background: var(--panel-2); font-size: 0.875rem; line-height: 1.5; }
.norm-step-note p { margin: 0 0 0.25rem; } .norm-step-note ul { margin: 0; padding-left: 1.25rem; }
.decomp-name.is-new { fill: var(--accent); }
.decomp-stage.is-now { fill: var(--accent); font-style: normal; }

/* the assignment beside the work */
.asg-actions { display: flex; gap: 0.375rem; margin-top: 0.5rem; flex-wrap: wrap; }
.asg-float { position: fixed; z-index: 50; right: 1.5rem; top: 6rem; width: min(34rem, calc(100vw - 2rem)); height: min(36rem, calc(100vh - 8rem)); min-width: 16rem; min-height: 10rem;
  display: flex; flex-direction: column; resize: both; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgb(0 0 0 / 0.22); }
.asg-float[hidden] { display: none !important; }
.asg-float-head { display: flex; align-items: center; gap: 0.375rem; padding: 0.375rem 0.5rem 0.375rem 0.75rem; border-bottom: 1px solid var(--line); background: var(--panel-2); cursor: move; user-select: none; touch-action: none; }
.asg-float-title { flex: 1; font-size: 0.8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asg-float-btn { font: inherit; font-size: 0.8125rem; padding: 0.125rem 0.5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); cursor: pointer; }
.asg-float-body { flex: 1; max-height: none; margin: 0; padding: 0.75rem 1rem; overflow: auto; }
.asg-table { display: block; white-space: pre; overflow-x: auto; font-size: 0.8125rem; padding-bottom: 0.25rem; }

.zoom-ctl { display: flex; justify-content: center; gap: 0.125rem; margin: 0.25rem 0; }
.zoom-ctl button { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 1.75rem; min-height: 1.75rem; padding: 0.125rem 0.25rem; font: inherit; font-size: 0.8125rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); cursor: pointer; }
.zoom-ctl #zoomPct { min-width: 2.75rem; font-variant-numeric: tabular-nums; }

/* ---- Relational algebra tab ---- */
#raText { min-height: 7rem; flex: 0 0 auto; height: 9rem; margin-top: 0.5rem; resize: vertical; font: 0.85rem/1.55 var(--mono); font-variation-settings: "MONO" 1; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 0.5rem; }
#raText[readonly] { background: var(--grid-bg, var(--paper)); opacity: 0.85; }
.ra-palette { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.5rem; }
.ra-palette button { min-width: 1.9rem; padding: 0.125rem 0.375rem; font: 1rem/1.4 var(--mono); font-variation-settings: "MONO" 1; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); cursor: pointer; }
.ra-palette button:hover { border-color: var(--ink); }
.ra-err { margin: 0.5rem 0 0; font-size: 0.8125rem; color: var(--err); }
.ra-err .linkish { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.ra-db { display: flex; gap: 0.375rem; align-items: center; margin-top: 0.625rem; }
.ra-db select, #raExamples { flex: 1; min-width: 0; font: inherit; font-size: 0.8125rem; padding: 0.25rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--ink); }
#raExamples { flex: 0 1 12rem; }
.ra-schema { list-style: none; padding: 0; margin: 0.375rem 0 0; overflow-y: auto; min-height: 0; flex: 1; }
.ra-schema li { margin: 0 0 0.25rem; line-height: 1.45; }
.ra-schema [data-ins] { cursor: pointer; border-radius: 3px; }
.ra-schema [data-ins]:hover { background: var(--mark); }
.ra-schema span[data-ins] { font-family: var(--mono); font-variation-settings: "MONO" 1; font-size: 0.8125rem; }
.ra-stepno { font-variant-numeric: tabular-nums; min-width: 6.5rem; text-align: center; font-size: 0.8125rem; }
.ra-tree { display: block; margin: 0 auto; overflow: visible; }
.ra-edge { stroke: var(--ink); stroke-width: 1.2; fill: none; opacity: 0.55; }
.ra-node { cursor: pointer; }
.ra-node rect { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; }
.ra-node.is-rel rect { stroke-width: 1.8; }
.ra-node.is-focus rect { fill: var(--mark); stroke-width: 2; }
.ra-node.is-warn rect { stroke: var(--err); stroke-dasharray: 4 3; }
.ra-node.is-later { opacity: 0.28; }
.ra-node text { fill: var(--ink); font: 13px var(--mono); font-variation-settings: "MONO" 1; }
.ra-node .ra-op { font-weight: 700; font-size: 15px; }
.ra-node .ra-sub { font-size: 12px; }
.ra-node .ra-count { font-size: 12px; fill: var(--ink-3); }
.ra-node:focus-visible rect { outline: none; stroke-width: 2.5; }
.norm-stage h3 .ra-op { font-family: var(--mono); font-variation-settings: "MONO" 1; }
.norm-stage h3 sub { font-family: var(--mono); font-variation-settings: "MONO" 1; font-weight: 400; font-size: 0.75em; }
.ra-note { font-size: 0.8125rem; margin: 0 0 0.5rem; }
.ra-note.is-warn { color: var(--err); }
.ra-table-wrap { overflow-x: auto; max-width: 100%; }
.ra-table { border-collapse: collapse; font: 0.78rem/1.4 var(--mono); font-variation-settings: "MONO" 1; background: var(--paper); }
.ra-table th, .ra-table td { border: 1px solid var(--line); padding: 0.125rem 0.5rem; text-align: left; white-space: nowrap; }
.ra-table th { background: var(--accent-soft); font-weight: 600; }
.ra-table td.num { text-align: right; }
.ra-table td.is-null::after { content: "null"; opacity: 0.4; font-style: italic; }
.ra-cx { margin-top: 0.375rem; }
.ra-cx summary { cursor: pointer; font-size: 0.8125rem; }
.ra-out.is-key, #raOut.is-key { outline: 2px dashed var(--line); outline-offset: -4px; }
@media (max-width: 900px) { #raText { height: 7rem; } }
#raOut { overflow: auto; }
#raOut svg.ra-tree { position: static; inset: auto; width: auto; height: auto; max-width: none; touch-action: auto; user-select: auto; }
.weak li.weak-other { color: var(--ink-3); font-size: 0.8125rem; border-bottom: 0; }
