:root {
  --bg: var(--craie-paper, #f7f4ed);
  --panel: #fffefa;
  --ink: var(--craie-ink, #273e35);
  --muted: #4d6571;
  --line: #ccd7d5;
  --accent: var(--craie-accent, #365e4e);
  --accent-soft: #e8eee5;
  --lime: var(--craie-sage, #dfe7dc);
  --coral: var(--craie-clay, #d7a58b);
  --red: #d63a3a;
  --black: #23272f;
  --hint: #526a42;
  --ok: #27734f;
  --node: 42px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-body, "Atkinson Hyperlegible Next", system-ui, sans-serif);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

button,
select {
  font: inherit;
}

a { text-underline-offset: 0.2em; }

::selection { background: var(--lime); color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.sr-only,
.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 3000;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
}

main:focus { outline: none; }

/* ---------- En-tête ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  padding: 20px 24px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 17px;
}

.brand span {
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  order: 3;
  width: 100%;
  gap: 6px;
}

.pills button {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 9px 14px;
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
}

.pills button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.pills button:hover:not(.active),
.seg button:hover:not(.active) {
  background: var(--accent-soft);
  color: var(--ink);
}

/* ---------- Mise en page ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  padding: 24px;
  max-width: 1680px;
  margin: 0 auto;
  align-items: start;
}

@media (max-width: 1050px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

main {
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.spacer {
  flex: 1;
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
}

.seg button {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  min-height: 38px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
}

.seg button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

#options label {
  color: var(--muted);
  margin-right: 6px;
}

#options select {
  font: inherit;
  padding: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 9px 12px;
  min-height: 42px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--ink);
}

.btn:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--bg);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover:not(:disabled) { background: #294b3c; border-color: #294b3c; }

.btn:active:not(:disabled),
.pills button:active,
.seg button:active { transform: translateY(1px); }

.stats {
  color: var(--muted);
  font-size: 13px;
  margin-right: 4px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Énoncé et bac ---------- */
.prompt-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  border-bottom: 0;
  padding: 16px;
  flex-wrap: wrap;
}

.prompt {
  flex: 1;
  font-size: 15px;
  min-width: min(240px, 100%);
}

.prompt .sub {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.tray {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tray-label {
  color: var(--muted);
  font-size: 13px;
}

.chip {
  width: var(--node);
  height: var(--node);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.chip.queued {
  opacity: 0.35;
  cursor: default;
  transform: scale(0.85);
}

/* ---------- Scène ---------- */
.stage-wrap {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0 0 10px 10px;
  overflow-x: auto;
  overflow-y: hidden;
}

.stage {
  position: relative;
  min-height: 380px;
  margin: 0 auto;
}

.edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.edges line {
  stroke: #9aa2b1;
  stroke-width: 2;
}

.edges line.null-edge {
  stroke: #d5d9e1;
  stroke-dasharray: 4 4;
}

.node {
  position: absolute;
  width: var(--node);
  height: var(--node);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  user-select: none;
  touch-action: none;
  cursor: grab;
  transition: left 0.45s ease, top 0.45s ease, background-color 0.3s, box-shadow 0.3s, opacity 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  animation: pop 0.3s ease;
  z-index: 2;
}

@keyframes pop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}

.red {
  background: var(--red);
  color: #fff;
}

.black {
  background: var(--black);
  color: #fff;
}

.neutral {
  background: var(--accent-soft);
  color: var(--ink);
  border: 2px solid var(--accent);
}

.node.db {
  background: var(--black);
  color: #fff;
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--black), 0 3px 10px rgba(0, 0, 0, 0.3);
}

.node.nil {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 9px;
  cursor: default;
}

.node.marked {
  outline: 3px dashed #f08c00;
  outline-offset: 4px;
}

.node.visited {
  opacity: 0.5;
}

.node[data-order]::after {
  content: attr(data-order);
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--ok);
  color: #fff;
  font-size: 11px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 0 5px;
}

.node.ghost {
  opacity: 0.6;
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

.node.hint,
.slot.hint {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px var(--hint);
  }
  50% {
    box-shadow: 0 0 0 9px rgba(245, 179, 1, 0.25);
  }
}

.node.dragging {
  opacity: 0.25;
}

.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  transform: scale(1.12);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  animation: none;
  transition: none;
}

.drop-over {
  outline: 3px solid var(--accent) !important;
  outline-offset: 4px;
}

/* Pointeurs NULL et cases vides */
.slot {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--black);
  opacity: 0.85;
  z-index: 1;
}

.slot.drop {
  width: 26px;
  height: 26px;
  background: #fff;
  border: 2px dashed #8c94a6;
  opacity: 1;
  transition: transform 0.15s, border-color 0.15s;
}

.slot.drop.round {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

body.is-dragging .slot.drop {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.slot.drop.drop-over {
  transform: scale(1.25);
}

.trash {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 110px;
  height: 64px;
  border: 2px dashed #c3c8d3;
  border-radius: 10px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  background: #fafbfc;
  z-index: 3;
}

body.is-dragging .trash {
  border-color: var(--red);
  color: var(--red);
}

.trash.drop-over {
  background: #fdecec;
}

/* ---------- Tableau du heap ---------- */
.heap-array {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 10px;
  overflow-x: auto;
}

.heap-array .cell {
  min-width: 40px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 6px;
}

.heap-array .cell b {
  display: block;
  font-size: 15px;
}

.heap-array .cell small {
  color: var(--muted);
  font-size: 11px;
}

.heap-array .cell.hint {
  border-color: var(--hint);
  background: #fff8e1;
}

/* ---------- Bas de page : indice et journal ---------- */
.bottom {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 760px) {
  .bottom {
    grid-template-columns: minmax(0, 1fr);
  }
}

.hint-box,
.log-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 110px;
}

.hint-btn {
  background: var(--lime);
  border-color: transparent;
}

.hint-btn:hover:not(:disabled) { background: #d0ddcc; border-color: var(--hint); }

.hint-content {
  margin-top: 10px;
  line-height: 1.5;
}

.hint-content h4 {
  margin: 0 0 4px;
}

.hint-content ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.done-box h4 {
  color: var(--ok);
  font-size: 16px;
}

#logTitle {
  margin: 0 0 6px;
  font-size: 14px;
}

#logTitle,
.hint-content h4,
.sidebar h2,
.modal-card h2 {
  font-family: var(--font-display, "Bricolage Grotesque", sans-serif);
}

#log {
  margin: 0;
  padding-left: 20px;
  max-height: 180px;
  overflow-y: auto;
  color: var(--muted);
  line-height: 1.6;
}

#log li:last-child {
  color: var(--ink);
  font-weight: 600;
}

#log .log-empty { list-style: none; color: var(--muted); font-weight: 400; }

/* ---------- Panneau latéral ---------- */
.sidebar {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

@media (max-width: 1050px) {
  .sidebar {
    position: static;
    max-height: none;
  }
}

.sidebar h2 {
  margin: 0 0 10px;
  font-size: 17px;
}

.sidebar h3 {
  margin: 0 0 6px;
  font-size: 13px;
}

.sidebar h3.section {
  margin: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-size: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
  transition: background 0.25s, border-color 0.25s;
}

.card h4 {
  margin: 0 0 4px;
  font-size: 13px;
}

.card p {
  margin: 4px 0;
  line-height: 1.45;
}

.card ul {
  margin: 4px 0 0;
  padding-left: 18px;
  line-height: 1.5;
}

.card.props {
  background: var(--bg);
}

.card.active,
.card li.active {
  background: #f0f6d9;
  border-color: var(--hint);
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.tip {
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.r {
  color: var(--red);
  font-weight: 600;
}

.ops {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  font-size: 13px;
}

.ops td {
  padding: 3px 6px;
  border-bottom: 1px solid var(--line);
}

.ops td:last-child {
  text-align: right;
  font-family: ui-monospace, Consolas, monospace;
}

.gestures {
  margin-top: 14px;
  background: var(--bg);
}

/* ---------- Fenêtre d'erreur, menu, toast ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(23, 62, 80, 0.42);
  display: grid;
  place-items: center;
  z-index: 2000;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  background: var(--panel);
  border-radius: 12px;
  padding: 20px 22px;
  max-width: 480px;
  width: calc(100% - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  border-top: 5px solid var(--coral);
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.modal-card p {
  line-height: 1.55;
  margin: 8px 0;
}

.modal-card .situation {
  background: var(--bg);
  border-radius: 6px;
  padding: 6px 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.menu {
  position: fixed;
  z-index: 1500;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  padding: 4px;
  min-width: 190px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
}

.menu[hidden] {
  display: none;
}

.menu .menu-title {
  padding: 6px 10px 4px;
  font-size: 12px;
  color: var(--muted);
}

.menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 7px 10px;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
}

.menu button:hover:not(:disabled) {
  background: var(--accent-soft);
}

.menu button:disabled {
  opacity: 0.4;
  cursor: default;
}

.menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.swatch.db {
  background: var(--black);
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--black);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 2500;
  max-width: calc(100% - 32px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.good {
  background: var(--ok);
}

/* ---------- Tris ---------- */
.node.cell {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  border: 2px solid #b9c0ce;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.node.cell.sorted {
  background: #e6f6ec;
  border-color: var(--ok);
}

.node.cell.cur {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.node.cell.pivot {
  border-color: #c2410c;
  background: #fff1e6;
}

.node.cell.inactive {
  opacity: 0.35;
}

.node.cell.head {
  border-color: var(--accent);
  border-width: 3px;
}

.edges text {
  font: 12px var(--font-body, "Atkinson Hyperlegible Next", system-ui, sans-serif);
  fill: var(--muted);
}

.edges .mark {
  font-weight: 700;
  font-size: 13px;
  fill: var(--accent);
}

.edges .pivot-mark {
  fill: #c2410c;
}

.edges .row-label {
  font-size: 12px;
  fill: var(--ok);
  font-weight: 600;
}

.edges .hole {
  fill: none;
  stroke: #c3c8d3;
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.edges .bound {
  stroke: var(--ok);
  stroke-width: 3;
}

.edges .bracket {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.edges .bracket.done {
  stroke: var(--ok);
}

.skip-btn {
  background: #f4f5f8;
}

.skip-btn.hint {
  animation: pulse 1.2s ease-in-out infinite;
}

.heap-array.info {
  display: block;
  line-height: 1.6;
}

.arr-strip {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.cell-mini {
  min-width: 40px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
}

.cell-mini b {
  display: block;
}

.cell-mini small {
  color: var(--muted);
  font-size: 11px;
}

.cell-mini.done {
  background: #e6f6ec;
  border-color: #9fd8b5;
}

.ops.sorts th {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  padding: 3px 4px;
}

.ops.sorts td {
  text-align: center;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  padding: 3px 4px;
}

.ops.sorts td:first-child {
  text-align: left;
  font-family: inherit;
  font-size: 12.5px;
}

/* ---------- MinMax ---------- */
.node.gnode {
  width: 56px;
  height: 50px;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.node.gnode svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.node.gnode polygon {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linejoin: round;
  transition: fill 0.3s, stroke 0.3s;
}

.node.gnode.max polygon {
  fill: #eef0ff;
}

.node.gnode.min polygon {
  fill: #fff1f1;
}

.node.gnode.known polygon {
  stroke: var(--accent);
}

.node.gnode.hint {
  animation: none;
}

.node.gnode.hint polygon {
  stroke: var(--hint);
  stroke-width: 5;
}

.gval {
  position: relative;
  font-size: 15px;
  font-weight: 700;
}

.gval.up {
  top: 7px;
}

.gval.down {
  top: -6px;
}

.gname {
  position: absolute;
  left: -16px;
  top: -6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.node.gleaf {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #fff;
  border: 2px solid #b9c0ce;
  color: var(--ink);
  box-shadow: none;
}

.node.pruned {
  opacity: 0.3;
}

.edges line.cut {
  stroke: var(--red);
  stroke-dasharray: 5 4;
}

.edges line.chosen {
  stroke: var(--accent);
  stroke-width: 3;
}

.edges line.faded {
  opacity: 0.3;
}

.edges .cut-mark {
  font-size: 18px;
  fill: var(--red);
}

.legend {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Graphes ---------- */
.node.gvert {
  width: 46px;
  height: 46px;
  background: #fff;
  border: 2.5px solid var(--ink);
  color: var(--ink);
}

.node.gvert.src {
  border-color: var(--accent);
}

.node.gvert.goal {
  border-style: double;
  border-width: 5px;
}

.node.gvert.open {
  background: #fff8e1;
}

.node.gvert.done {
  background: #e6f6ec;
  border-color: var(--ok);
}

.node.gvert.current {
  box-shadow: 0 0 0 4px var(--accent);
}

.glabel {
  font-size: 16px;
  font-weight: 700;
}

.gbadge {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
}

.gh {
  position: absolute;
  top: -16px;
  right: -22px;
  font-size: 11px;
  font-weight: 600;
  color: #7c3aed;
}

.edges line.gedge {
  stroke: #b8bfcc;
}

.edges line.tree {
  stroke: var(--accent);
  stroke-width: 4;
}

.edges text.w {
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink);
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 5px;
}

.gtable {
  border-collapse: collapse;
  font-size: 13px;
}

.gtable th,
.gtable td {
  border: 1px solid var(--line);
  padding: 3px 9px;
  text-align: center;
}

.gtable td:first-child {
  color: var(--muted);
  text-align: left;
}

/* ---------- Marque, langue, pied de page ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}

.brand .logo {
  width: 28px;
  height: 28px;
}

.brand #brandName {
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  font-family: var(--font-display, "Bricolage Grotesque", sans-serif);
  font-size: 24px;
}

.brand .tag {
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
  margin-left: 4px;
}

@media (max-width: 700px) {
  .brand .tag {
    display: none;
  }
}

.learn-link {
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  padding: 9px 12px;
  min-height: 42px;
  border-radius: 8px;
}

.learn-link:hover {
  background: var(--accent-soft);
}

.lang-switch {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 9px 12px;
  min-height: 42px;
  border-radius: 8px;
}

.lang-switch:hover {
  background: var(--accent-soft);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  padding: 18px 16px 28px;
  color: var(--muted);
  font-size: 13px;
}

.footer a {
  color: var(--accent);
}

/* ---------- Publicité ---------- */
.ad-box {
  margin-top: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px 10px 10px;
  background: var(--panel);
  min-height: 120px;
}

.ad-bottom {
  min-height: 110px;
}

.ad-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

@media (max-width: 700px) {
  .topbar { padding: 16px; gap: 12px; }
  .layout { padding: 16px; gap: 16px; }
  .pills { gap: 6px; }
  .pills button { padding: 8px 10px; }
  .toolbar { gap: 8px; }
  .seg { width: 100%; }
  .spacer { display: none; }
  .stats { flex-basis: 100%; }
  .prompt-row { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
