/*
 * App styles.
 * Colours come from the --edu-… CSS variables set by js/themes.js
 * according to the selected palette. The values here are only a fallback (light palette).
 */
:root {
  --edu-bg: #F6F7F9;
  --edu-surface: #FFFFFF;
  --edu-text: #15181D;
  --edu-muted: #5A6270;
  --edu-border: #E2E5EA;
  --edu-primary: #0E7470;
  --edu-on-primary: #FFFFFF;
  --edu-one: #C62828;
  --edu-zero: #1E5BC6;

  /* Tinted background (set by themes.js per palette) – tables, info boxes, highlights. Never grey. */
  --edu-tint: #DCF1EE;
  --edu-tint-line: #0E7470;
  --edu-table-line: #9FD0CA;

  /* Derived colours */
  --edu-primary-soft: var(--edu-tint);
  --edu-draft-bg: #FFF1DC;
  --edu-draft-text: #8A4B00;
  --edu-planned-bg: color-mix(in srgb, var(--edu-muted) 14%, var(--edu-surface));

  --edu-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --edu-font-heading: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --edu-radius: 18px;
  --edu-radius-small: 12px;
}

html[data-palette='dark'],
html[data-palette='hc-dark'] {
  --edu-draft-bg: #3D2A0A;
  --edu-draft-text: #FFCF8A;
}

html[data-palette='hc-light'] { --edu-draft-bg: #FFFFFF; --edu-draft-text: #000000; }
html[data-palette='hc-dark']  { --edu-draft-bg: #000000; --edu-draft-text: #FFFFFF; }

body {
  margin: 0;
  background: var(--edu-bg);
  color: var(--edu-text);
  font-family: var(--edu-font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/*
 * RULE: no text in the app may be smaller than 16 px.
 * Many Quasar components have a smaller default font, so it is raised here.
 * New styles never use a font-size below 16px.
 */
.q-btn, .q-item, .q-item__label, .q-item__label--caption, .q-item__label--header,
.q-field, .q-field__native, .q-field__label, .q-field__bottom, .q-field__messages,
.q-btn-toggle .q-btn, .q-toggle__label, .q-checkbox__label, .q-radio__label,
.q-tooltip, .q-badge, .q-chip, .q-tab__label, .q-notification__message,
.q-dialog__message, .q-menu, .q-table, .q-table th, .q-table td {
  font-size: 16px;
}

/* Quasar recolours the background in dark mode – restore the palette colours */
body.body--dark { background: var(--edu-bg); color: var(--edu-text); }

a { color: var(--edu-primary); text-decoration: none; }

/*
 * RULE: paragraph text is justified.
 * Hyphenation prevents large gaps between words on a narrow mobile screen.
 * Exceptions: table cells, buttons, headings and centred empty states.
 */
p, .edu-md li, .edu-card-text, .edu-task-prompt, .edu-feedback-text, .edu-setting-hint, .edu-lead {
  text-align: justify; hyphens: auto; -webkit-hyphens: auto;
}
.edu-empty p, .edu-empty .edu-lead { text-align: center; }

/* Quasar buttons in the primary colour: text in the contrasting palette colour */
.q-btn.bg-primary { color: var(--edu-on-primary) !important; }

/* Visible focus for keyboard navigation */
:focus-visible { outline: 3px solid var(--edu-primary); outline-offset: 2px; }

.edu-visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Header ---------- */
.edu-header {
  background: var(--edu-surface) !important;
  color: var(--edu-text) !important;
  border-bottom: 1px solid var(--edu-border);
}
.edu-toolbar { min-height: 64px; padding: 0 16px 0 8px; gap: 8px; }
.edu-brand { display: flex; align-items: center; gap: 12px; color: var(--edu-text); min-width: 0; }
.edu-brand-name {
  font-family: var(--edu-font-heading); font-weight: 600; font-size: 19px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* App version: always visible, inverted colours of the current palette (text colour as background) */
.edu-version {
  flex: none; padding: 2px 8px; border-radius: 6px; line-height: 1.3;
  font: 600 16px var(--edu-font-mono); letter-spacing: 0;
  background: var(--edu-text); color: var(--edu-surface);
}
.edu-tool-btn { border-radius: 10px; min-height: 44px; }
.edu-tool-btn--active { background: var(--edu-primary-soft); color: var(--edu-primary); }

/* ---------- Left drawer ---------- */
.edu-drawer .q-drawer__content, .q-drawer { background: var(--edu-surface); color: var(--edu-text); }
.edu-drawer .q-item { min-height: 52px; color: var(--edu-text); }
.edu-drawer-heading {
  font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; color: var(--edu-muted);
  padding-top: 20px;
}
.edu-drawer-caption { color: var(--edu-muted); }
.edu-drawer-head {
  height: 64px; box-sizing: border-box; padding: 0 8px 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-bottom: 1px solid var(--edu-border);
}
/* Active item: highlighted background and a bar on the left (readable in high contrast too) */
.edu-drawer-active {
  background: var(--edu-primary-soft); color: var(--edu-text) !important; font-weight: 600;
  box-shadow: inset 4px 0 0 var(--edu-primary);
}
.edu-drawer-icon {
  width: 40px; height: 40px; border-radius: 10px; color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Page and content ---------- */
.edu-page { padding: 40px 16px 48px; }
.edu-container { max-width: 1216px; margin: 0 auto; display: flex; flex-direction: column; gap: 40px; }
.edu-section { display: flex; flex-direction: column; gap: 16px; }

.edu-h1 {
  margin: 0; font-family: var(--edu-font-heading); font-weight: 700;
  font-size: 40px; line-height: 1.15; letter-spacing: -0.5px;
}
.edu-lead { margin: 0; font-size: 17px; line-height: 1.5; color: var(--edu-muted); max-width: 640px; }
.edu-section-title {
  margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--edu-muted);
}

.edu-hero { display: flex; flex-direction: column; gap: 20px; }
.edu-search { max-width: 640px; }
.edu-search .q-field__control { border-radius: 14px; background: var(--edu-surface); height: 52px; }
.edu-search .q-field__native { font-size: 16px; color: var(--edu-text); }

/* ---------- Cards ---------- */
.edu-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.edu-card {
  display: flex; flex-direction: column; gap: 14px; padding: 24px;
  background: var(--edu-surface); color: var(--edu-text);
  border: 1px solid var(--edu-border); border-radius: var(--edu-radius);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
a.edu-card:hover { border-color: var(--edu-primary); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06); }
a.edu-card:active { transform: scale(0.99); }

.edu-card-icon {
  width: 52px; height: 52px; border-radius: 14px; color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
}
.edu-card-title { font-family: var(--edu-font-heading); font-size: 22px; font-weight: 600; }
.edu-card-text { font-size: 16px; color: var(--edu-muted); line-height: 1.45; }
.edu-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 16px; color: var(--edu-muted); margin-top: auto;
}
.edu-card-link { color: var(--edu-primary); font-weight: 600; display: flex; align-items: center; gap: 2px; }

.edu-card-placeholder {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px;
  padding: 24px; min-height: 160px; text-align: center;
  border: 2px dashed var(--edu-border); border-radius: var(--edu-radius); color: var(--edu-muted);
}

/* Topic card */
.edu-topic-card { padding: 20px; gap: 10px; }
.edu-topic-card--planned { opacity: 0.7; }
.edu-topic-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.edu-topic-glyph { font-family: var(--edu-font-heading); font-size: 22px; font-weight: 700; color: var(--edu-primary); }
.edu-topic-card--planned .edu-topic-glyph { color: var(--edu-muted); }
.edu-topic-title { font-size: 17px; font-weight: 600; }
.edu-topic-path { font-size: 16px; color: var(--edu-muted); }

/* Status badges */
.edu-badge {
  font-size: 16px; font-weight: 600; padding: 4px 10px; border-radius: 10px; white-space: nowrap;
}
.edu-badge--planned { background: var(--edu-planned-bg); color: var(--edu-text); }
html[data-palette^='hc'] .edu-badge { border: 1px solid currentColor; }

/* Chips (recently opened, favourites) */
.edu-chips { display: flex; flex-wrap: wrap; gap: 12px; }
.edu-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px;
  background: var(--edu-surface); color: var(--edu-text);
  border: 1px solid var(--edu-border); border-radius: 22px; font-size: 16px;
}
.edu-chip:hover { border-color: var(--edu-primary); }
.edu-chip .q-icon { color: var(--edu-muted); }
.edu-chip--favorite .q-icon { color: #E0A100; }

/* Empty state / simple pages */
.edu-empty { text-align: center; padding: 64px 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* ---------- Settings ---------- */
.edu-settings-card { width: 600px; max-width: 100vw; background: var(--edu-surface); color: var(--edu-text); }
.edu-settings-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px 24px; }
.edu-settings-title { font-family: var(--edu-font-heading); font-size: 22px; font-weight: 700; flex-grow: 1; margin: 0; }
.edu-settings-section { padding: 12px 24px 20px; display: flex; flex-direction: column; gap: 14px; }
.edu-settings-section + .edu-settings-section { border-top: 1px solid var(--edu-border); }
.edu-settings-section h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; color: var(--edu-muted); }
.edu-setting { display: flex; flex-direction: column; gap: 8px; }
.edu-setting-label { font-size: 16px; font-weight: 500; }
.edu-setting-hint { font-size: 16px; color: var(--edu-muted); line-height: 1.45; }
.edu-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
/* A label with a long hint takes the free space, the control stays on the right */
.edu-setting-row > .edu-setting { flex: 1 1 200px; min-width: 0; }

.edu-toggle-group { border: 1px solid var(--edu-border); border-radius: 10px; }
.edu-toggle-group .q-btn { min-height: 40px; }

/* Palette picker: tiles with a small preview */
.edu-palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.edu-palette-tile {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 48px;
  border: 2px solid var(--edu-border); border-radius: var(--edu-radius-small);
  background: var(--edu-surface); color: var(--edu-text); cursor: pointer;
  font: 500 16px var(--edu-font); text-align: left;
}
.edu-palette-tile[aria-pressed='true'] { border-color: var(--edu-primary); background: var(--edu-primary-soft); }
.edu-swatch {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; position: relative; overflow: hidden;
  border: 1px solid rgba(128, 128, 128, 0.5);
}
.edu-swatch span { position: absolute; }

/* Logic level colour picker */
.edu-level-option { display: flex; align-items: center; gap: 8px; }
.edu-level-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; color: #FFFFFF; font-weight: 700; font-size: 16px;
}

/* ---------- Mobile ---------- */
@media (max-width: 599px) {
  .edu-page { padding: 24px 16px 40px; }
  .edu-container { gap: 28px; }
  .edu-h1 { font-size: 28px; }
  .edu-lead { font-size: 16px; }
  .edu-toolbar { padding: 0 4px; gap: 0; }
  .edu-brand-name { font-size: 17px; }
  .edu-brand { gap: 8px; }
  .edu-card { padding: 18px; }
  .edu-grid { grid-template-columns: 1fr; gap: 14px; }
  .edu-card-placeholder { min-height: 0; padding: 16px; }
  .edu-settings-section { padding: 12px 16px 20px; }
  .edu-settings-head { padding: 12px 8px 4px 16px; }
}

/* =====================================================================
 * Subject and topic page
 * ===================================================================== */
:root {
  --edu-font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  /* Feedback colours: green = correct, orange = wrong (red and blue belong to logic levels) */
  --edu-ok: #1E7F4F;
  --edu-bad: #B35400;
}
html[data-palette='dark'], html[data-palette='hc-dark'] { --edu-ok: #4CC38A; --edu-bad: #FFA351; }

.edu-page-head { display: flex; flex-direction: column; gap: 12px; }
.edu-breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--edu-muted); font-size: 16px; }
.edu-breadcrumbs a { color: var(--edu-primary); font-weight: 500; }
.edu-breadcrumbs a:hover { text-decoration: underline; }
.edu-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.edu-crumb-subject { display: inline-flex; align-items: center; }
.edu-crumb-back { display: none; }
.edu-favorite--on { color: #E0A100; }

.edu-topic-page { gap: 24px; }
.edu-tabs { border-bottom: 1px solid var(--edu-border); color: var(--edu-muted); }
.edu-tabs .q-tab { min-height: 52px; padding: 0 18px; }
.edu-tabs .q-tab__label { font-size: 16px; font-weight: 600; }
.edu-tabs .q-tab--active { color: var(--edu-text); }
.edu-tabs .q-tab__indicator { height: 3px; background: var(--edu-primary); }
.edu-tab-panel { display: flex; flex-direction: column; gap: 24px; }

/* Panel (content card inside a topic) */
.edu-panel {
  background: var(--edu-surface); color: var(--edu-text);
  border: 1px solid var(--edu-border); border-radius: var(--edu-radius);
  padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0;
}
.edu-panel-title { margin: 0; font-family: var(--edu-font-heading); font-size: 22px; font-weight: 600; line-height: 1.25; }
.edu-panel-lead { margin: 0; color: var(--edu-muted); line-height: 1.5; }
.edu-field-group { display: flex; flex-direction: column; gap: 6px; }
/* A toggle under a wider label must not stretch to the label width (empty strip on the right) */
.edu-field-group > .edu-toggle-group { align-self: flex-start; max-width: 100%; }
.edu-field-label { font-size: 16px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--edu-muted); }
.edu-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 28px; }
.edu-mono { font-family: var(--edu-font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Theory (Markdown) ---------- */
.edu-md { max-width: 800px; font-size: 17px; line-height: 1.65; }
.edu-md h2 { font-family: var(--edu-font-heading); font-size: 26px; font-weight: 700; line-height: 1.25; margin: 40px 0 12px; }
.edu-md h2:first-child { margin-top: 0; }
.edu-md h3 { font-family: var(--edu-font-heading); font-size: 20px; font-weight: 600; margin: 28px 0 8px; }
.edu-md h4 { font-size: 17px; font-weight: 700; margin: 20px 0 6px; }
.edu-md p, .edu-md ul, .edu-md ol { margin: 0 0 14px; }
.edu-md li { margin-bottom: 4px; }
.edu-md code, .edu-md kbd {
  font-family: var(--edu-font-mono); font-size: 16px; padding: 1px 6px; border-radius: 6px;
  background: var(--edu-primary-soft); white-space: nowrap;
}
.edu-md kbd { border: 1px solid var(--edu-border); background: var(--edu-surface); }
.edu-md-code {
  font-family: var(--edu-font-mono); font-size: 16px; line-height: 1.5; margin: 0 0 16px;
  padding: 14px 16px; border-radius: var(--edu-radius-small); overflow-x: auto;
  background: var(--edu-tint); border: 1px solid var(--edu-tint-line);
}
.edu-md-code code { background: none; padding: 0; white-space: pre; }
.edu-md-table { overflow-x: auto; margin: 0 0 16px; }
.edu-md table { border-collapse: collapse; font-size: 16px; min-width: 50%; }
.edu-md th, .edu-md td { border: 1px solid var(--edu-table-line); padding: 6px 12px; text-align: left; vertical-align: top; }
.edu-md th { background: var(--edu-tint); font-weight: 700; }
.edu-md-note {
  margin: 0 0 16px; padding: 14px 18px; border-left: 5px solid var(--edu-tint-line);
  background: var(--edu-tint); border-radius: 0 var(--edu-radius-small) var(--edu-radius-small) 0;
}
.edu-md-note > :last-child, .edu-md-note > .edu-explain-body > :last-child { margin-bottom: 0; }

/* ---------- Collapsible explanation boxes (see js/components/ExplainBox.js) ----------
 * The box keeps its own look (class of the topic); the body copies the box layout,
 * the button sits in the top right corner. Double class = beats the single class of the box. */
.edu-explain.edu-explain { position: relative; padding-right: 56px; }
.edu-explain-body {
  display: inherit; flex-direction: inherit; flex-wrap: inherit; align-items: inherit;
  justify-content: inherit; gap: inherit; flex: 1 1 auto; min-width: 0; width: 100%;
}
.edu-explain-btn {
  position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 10px;
  background: transparent; color: var(--edu-primary); cursor: pointer;
}
.edu-explain-btn .q-icon { font-size: 28px; }
.edu-explain-btn:hover { background: var(--edu-surface); }
.edu-explain-btn:focus-visible { outline: 3px solid var(--edu-primary); outline-offset: -3px; }
/* Closed: only the first line, its end fades out; a click on the box opens it */
.edu-explain.is-closed { cursor: pointer; }
.edu-explain.is-closed > .edu-explain-body {
  overflow: hidden;   /* max-height is measured in JS (EDU.fitExplainBody) */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent);
}
.edu-md .one { color: var(--edu-one); font-weight: 700; }
.edu-md .zero { color: var(--edu-zero); font-weight: 700; }

/* ---------- Bits (0/1 buttons in logic level colours) ---------- */
.edu-bit {
  width: 100%; min-width: 0; height: 48px; padding: 0; border-radius: 10px; border: 2px solid;
  font: 700 22px var(--edu-font-mono); cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.edu-bit--1 { background: var(--edu-one); border-color: var(--edu-one); color: #FFFFFF; }
.edu-bit--0 { background: var(--edu-surface); border-color: var(--edu-zero); color: var(--edu-zero); }
html[data-palette='dark'] .edu-bit--1, html[data-palette='hc-dark'] .edu-bit--1 { color: #000000; }
.edu-bit:hover { filter: brightness(1.08); }
.edu-bit:disabled { cursor: default; filter: none; }

/* ---------- Practice ---------- */
.edu-practice { display: flex; flex-direction: column; gap: 20px; max-width: 860px; }
.edu-practice-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 24px; }
.edu-practice-type { min-width: 260px; flex: 1 1 260px; max-width: 420px; }
.edu-task { gap: 20px; }
.edu-task-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.edu-task-type { font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--edu-muted); }
.edu-task-code {
  font: 16px var(--edu-font); color: var(--edu-muted); background: none; border: 1px dashed var(--edu-border);
  border-radius: 10px; padding: 6px 12px; cursor: pointer;
}
.edu-task-code strong { font-family: var(--edu-font-mono); color: var(--edu-text); }
.edu-task-prompt { font-size: 20px; line-height: 1.55; }
.edu-task-prompt p { margin: 0 0 8px; }
.edu-task-answer { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.edu-task-input { flex: 1 1 240px; max-width: 420px; }
.edu-task-input .q-field__native { font-family: var(--edu-font-mono); font-size: 20px; }
.edu-task-actions { display: flex; justify-content: flex-end; }
.edu-task-interactive { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* Character or code in a task prompt */
.edu-token {
  display: inline-block; min-width: 1.6em; padding: 0 8px; text-align: center;
  font-family: var(--edu-font-mono); font-weight: 700;
  background: var(--edu-primary-soft); border: 1px solid var(--edu-border); border-radius: 8px;
}
.edu-word { font-family: var(--edu-font-mono); font-weight: 700; letter-spacing: 2px; white-space: nowrap; }
.edu-word .one { color: var(--edu-one); }
.edu-word .zero { color: var(--edu-zero); }
.edu-word .par { text-decoration: underline 3px var(--edu-primary); text-underline-offset: 5px; }
.edu-word .hidden-bit { color: var(--edu-text); background: var(--edu-primary-soft); border-radius: 4px; padding: 0 2px; }

.edu-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.edu-choice {
  min-height: 52px; padding: 10px 18px; text-align: left; line-height: 1.35;
  font: 500 17px var(--edu-font); color: var(--edu-text); background: var(--edu-surface);
  border: 2px solid var(--edu-border); border-radius: var(--edu-radius-small); cursor: pointer;
}
.edu-choice:hover:not(:disabled) { border-color: var(--edu-primary); background: var(--edu-primary-soft); }
.edu-choice:disabled { cursor: default; }
.edu-choice--correct { border-color: var(--edu-ok); box-shadow: inset 0 0 0 1px var(--edu-ok); }
.edu-choice--wrong { border-color: var(--edu-bad); border-style: dashed; }
.edu-choice--dim { opacity: 0.6; }

.edu-feedback { border-left: 6px solid; border-radius: 0 var(--edu-radius-small) var(--edu-radius-small) 0; padding: 14px 18px; }
.edu-feedback--ok { border-color: var(--edu-ok); background: color-mix(in srgb, var(--edu-ok) 12%, var(--edu-surface)); }
.edu-feedback--bad { border-color: var(--edu-bad); background: color-mix(in srgb, var(--edu-bad) 12%, var(--edu-surface)); }
.edu-feedback-head { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.edu-feedback--ok .edu-feedback-head { color: var(--edu-ok); }
.edu-feedback--bad .edu-feedback-head { color: var(--edu-bad); }
.edu-feedback-text { line-height: 1.55; }
.edu-feedback-text p { margin: 0 0 6px; }
.edu-feedback-text table { border-collapse: collapse; margin: 6px 0; }
.edu-feedback-text td, .edu-feedback-text th { border: 1px solid var(--edu-table-line); padding: 4px 10px; font-family: var(--edu-font-mono); background: var(--edu-surface); }
.edu-feedback-text th { background: var(--edu-tint); }

/* ---------- Truth tables (shared by all topics) ----------
   Standing rule: truth tables are always wide. On a phone they fill the whole width
   of their container; cells never get narrower than on a computer.
   Topics only colour them (.lf-tt, .ba-table, .km-table …); sizes are here.
   "table.edu-truth" is more specific than the topic rules, so it always wins. */
table.edu-truth { border-collapse: collapse; }
table.edu-truth th, table.edu-truth td { min-width: 64px; padding: 8px 24px; text-align: center; vertical-align: middle; }

.edu-practice-footer { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
.edu-practice-stats { display: flex; flex-direction: column; gap: 4px; color: var(--edu-muted); padding-top: 8px; }
.edu-open-code { display: flex; gap: 8px; align-items: flex-start; }
.edu-open-code .q-field { width: 200px; }
.edu-open-code .q-btn { min-height: 40px; }

@media (max-width: 599px) {
  .edu-panel { padding: 16px; border-radius: var(--edu-radius-small); }
  /* Truth tables and Markdown tables over the full width (horizontal padding smaller, the cells are wider anyway) */
  table.edu-truth, .edu-md-table > table { width: 100%; }
  table.edu-truth th, table.edu-truth td { padding: 8px 10px; }
  .edu-md { font-size: 16px; }
  .edu-md h2 { font-size: 22px; }
  .edu-task-prompt { font-size: 18px; }
  .edu-tabs .q-tab { padding: 0 12px; }
  .edu-tabs .q-tab__icon { display: none; }   /* on mobile the three tabs fit only without icons */
  /* Topic header: less vertical space */
  .edu-topic-page { gap: 16px; }
  .edu-page:has(.edu-topic-page) { padding-top: 12px; }
  .edu-topic-page .edu-page-head { gap: 4px; }
  .edu-topic-page .edu-h1 { font-size: 24px; }
  .edu-topic-page .edu-title-row { gap: 8px; flex-wrap: nowrap; }
  .edu-crumb-extra { display: none; }
  .edu-crumb-back { display: inline; margin-left: -6px; }
  .edu-practice-type { min-width: 0; max-width: none; }
  .edu-open-code { width: 100%; }
  .edu-open-code .q-field { flex: 1; width: auto; }
}
