/* Soft Clay tokens, from the server's docs/bonsai-design-tokens.html, as the
   admin dashboard has them. --muted is that page's reading gray: ink-dim is
   too light for a table's text. */
:root {
  color-scheme: light dark;
  --ground: #e7efe0;
  --surface: #fffefb;
  --tint: #eaf2e4;
  --track: #e3ecdc;
  --ink: #33463a;
  --dim: #93a595;
  --muted: #6b736c;
  --fern: #4f7d5c;
  --fern-text: #f2f8ef;
  --soil: #e8e4cf;
  --bark: #6e6749;
  --garnet: #a33b32;
  --garnet-line: #edd3ce;
  /* Not in the Soft Clay tokens: the admin dashboard's yellow, for a state that waits. */
  --amber: #7a5a00;
  --amber-fill: #f3e6bf;
  /* The levels of a tree's graph, from its first steps to its last. */
  --level-0: #b86b00;
  --level-1: #17843f;
  --level-2: #0465af;
  --level-3: #8b306a;
  --shadow-raised: 0 2px 3px rgba(70, 96, 74, .06), 0 8px 20px rgba(70, 96, 74, .10);
  --shadow-chip: 0 1px 2px rgba(70, 96, 74, .10), 0 3px 8px rgba(70, 96, 74, .10);
  --shadow-pressed: inset 0 1px 2px rgba(0, 0, 0, .12);
  --radius-card: 20px;
  --radius-control: 14px;
  --rounded: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --rail: 208px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #1a211b;
    --surface: #242c25;
    --tint: #2c362d;
    --track: #2c362d;
    --ink: #e8ece6;
    --dim: #8d9a8e;
    --muted: #9aa39b;
    --fern: #7fae8f;
    --fern-text: #152018;
    --soil: #302e20;
    --bark: #aba37e;
    --garnet: #de8078;
    --garnet-line: #4a322e;
    --amber: #e2b84f;
    --amber-fill: #3d3319;
    --level-0: #c5770f;
    --level-1: #54b66e;
    --level-2: #59aaf8;
    --level-3: #ef8bc5;
    --shadow-raised: 0 2px 3px rgba(0, 0, 0, .25), 0 8px 20px rgba(0, 0, 0, .30);
    --shadow-chip: 0 1px 2px rgba(0, 0, 0, .25), 0 3px 8px rgba(0, 0, 0, .28);
    --shadow-pressed: inset 0 1px 2px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* A double tap never zooms, and a tap acts at once. Pinch zoom stays. */
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, sans-serif;
}

h1, h2, h3, button, .tag, .pill, .wordmark, .row-title, #nav a, .parent {
  font-family: var(--rounded);
}

h1 { font-size: 28px; font-weight: 800; line-height: 1.15; margin: 0; text-wrap: balance; }
h2 { font-size: 17px; font-weight: 800; margin: 10px 0 0; }
h3 { font-size: 15px; font-weight: 800; margin: 0; }
p { margin: 0; }
a { color: var(--fern); }
code, pre { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--fern); outline-offset: 2px; }

/* Controls: a press shows, and a long press selects no text. */
button, summary, .pill, #nav a, .wordmark, [role=button], [role=option] {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

button:active:not(:disabled), summary:active, .pill:active, #nav a:active, [role=button]:active {
  opacity: .65;
}

/* ------------------------------------------------------------ controls */

button {
  font-size: 15px;
  font-weight: 800;
  border: 0;
  border-radius: var(--radius-control);
  padding: 11px 18px;
  min-height: 44px;
  cursor: pointer;
}

button:disabled { opacity: .6; cursor: default; }
.primary { background: var(--fern); color: var(--fern-text); }
.secondary { background: var(--tint); color: var(--fern); }
/* tint never sits on the ground: a second action outside a card is raised. */
.raised { background: var(--surface); color: var(--fern); box-shadow: var(--shadow-chip); }
.destructive { background: var(--surface); color: var(--garnet); border: 1.5px solid var(--garnet-line); }
.ghost { background: none; color: var(--muted); font-weight: 600; }

input, textarea {
  font: inherit;
  /* iOS zooms the page when a field with smaller text gets focus. */
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-control);
  padding: 11px 13px;
  min-height: 44px;
  box-shadow: var(--shadow-chip);
}

textarea { resize: vertical; min-height: 44px; }
input[type=checkbox] { min-height: 0; width: 20px; height: 20px; padding: 0; box-shadow: none; accent-color: var(--fern); }
/* A change that the server did not take. */
[aria-invalid=true] { outline: 2px solid var(--garnet); outline-offset: 2px; }

/* A button that reads as a link, inside a sentence. */
button.link { min-height: 0; padding: 0; background: none; color: var(--fern); font: inherit; font-weight: 600; text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-head { display: flex; align-items: center; gap: 6px; min-height: 22px; }
/* A text takes the width of its field, not the width that the browser gives it. */
.field :is(input:not([type=checkbox]), textarea) { width: 100%; min-width: 0; }
.field-head > :first-child { font-size: 13px; font-weight: 700; color: var(--muted); }
/* On a card, a field is a shade under the card, not a second raised layer. */
:is(.card, dialog) :is(input, textarea, .dropdown-button) { background: var(--tint); box-shadow: none; }
/* A text that is as tall as what it holds, where the browser can do that. */
textarea[rows="1"] { field-sizing: content; max-height: 160px; }

/* The "?" beside a label, and the note that it shows. */
button.help {
  flex: none;
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  font-size: 12px;
  background: var(--track);
  color: var(--muted);
}

/* The note of a "?" is a speech bubble over the page, in bark on the green
   of the fields. Its "?" has the same bark while it shows, so the two read
   as one. */
button.help:has(+ :popover-open) { background: var(--bark); color: var(--soil); }

.help-note {
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  overflow: visible;
  width: max-content;
  max-width: min(280px, calc(100vw - 16px));
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--bark);
  color: var(--soil);
  box-shadow: var(--shadow-raised);
}

/* The tail: a corner of a square that points at the "?". */
.help-note::after {
  content: "";
  position: absolute;
  left: calc(var(--tail) - 7px);
  bottom: -6px;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  rotate: 45deg;
  background: inherit;
}

.help-note.under::after { bottom: auto; top: -6px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* A button in a row of a table. */
button.small { min-height: 32px; padding: 4px 12px; font-size: 13px; }
td:has(button.small) { text-align: right; padding-block: 6px; }

/* The invitation of a coach: the field and its button on one line. */
.invite { display: flex; align-items: flex-end; gap: 10px; max-width: 520px; }
.invite .field { flex: 1; }

/* A count that opens its list, such as a tree's learners. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 11px 0 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  background: var(--tint);
  color: var(--fern);
}

.pill svg { width: 16px; height: 16px; }
@media (hover: hover) {
  .pill:hover { background: var(--fern); color: var(--fern-text); }
}

/* A value from a list or of the user's own: the text, and under it the
   way back to the list. */
.pick-or-type { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pick-or-type button.link { align-self: flex-start; font-size: 13px; }

/* ------------------------------------------------------------ dropdown */

.dropdown { min-width: 0; }
.dropdown[aria-invalid=true] { border-radius: var(--radius-control); }

.dropdown-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0 13px;
  font: inherit;
  font-size: 16px;
  text-align: left;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-chip);
}

.dropdown-face { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* The arrow: it turns up while the list is open. */
.dropdown-button::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin: -4px 2px 0;
  border: solid var(--muted);
  border-width: 0 2px 2px 0;
  rotate: 45deg;
  transition: rotate .15s;
}

.dropdown:has(:popover-open) .dropdown-button::after { rotate: 225deg; margin-top: 4px; }

.dropdown-list {
  position: fixed;
  inset: auto;
  max-width: calc(100vw - 16px);
  margin: 0;
  border: 0;
  padding: 6px;
  border-radius: 16px;
  overflow-y: auto;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-raised);
}

.dropdown-list [role=option] {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  /* A long name wraps in the list, and does not run off a narrow screen. */
  overflow-wrap: anywhere;
  cursor: pointer;
}

/* The option that the keys or the pointer are on. */
.dropdown-list [role=option]:focus { outline: none; background: var(--tint); }
@media (hover: hover) {
  .dropdown-list [role=option]:hover { background: var(--tint); }
}

.dropdown-list [aria-selected=true] { color: var(--fern); font-weight: 700; }
.dropdown-list [aria-selected=true]::after { content: "✓"; margin-left: auto; padding-left: 12px; }

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--soil);
  color: var(--bark);
}

.tag.good { background: var(--tint); color: var(--fern); }
.tag.bad { background: var(--garnet-line); color: var(--garnet); }
.tag.review { background: var(--amber-fill); color: var(--amber); }

/* --------------------------------------------------------------- shell */

#shell {
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  display: grid;
  grid-template: "top top" auto "nav screen" 1fr / var(--rail) minmax(0, 1fr);
  min-height: 100dvh;
}

#top {
  grid-area: top;
  /* The brand sits in the middle, whatever the width of the two sides. */
  display: grid;
  align-items: center;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  padding: calc(12px + env(safe-area-inset-top)) 22px 4px;
}

.wordmark { white-space: nowrap; }

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
}

.wordmark img { border-radius: 9px; }

#nav {
  grid-area: nav;
  align-self: start;
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 6px 22px 16px;
}

#nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-control);
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

#nav svg { width: 22px; height: 22px; flex: none; }

#nav a[aria-current] {
  background: var(--surface);
  box-shadow: var(--shadow-chip);
  color: var(--fern);
  font-weight: 800;
}

#screen { grid-area: screen; padding: 12px 32px 48px 16px; }
/* Loading shows as a bar on the top edge, so it moves nothing. It stays
   clear for a moment, so a fast answer shows no bar at all. */
#screen.busy::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 3px;
  background: var(--fern);
  opacity: 0;
  animation: loading .8s .2s ease-in-out infinite alternate;
}

@keyframes loading {
  from { opacity: .3; }
  to { opacity: 1; }
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack > * { min-width: 0; }

.screen-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.screen-head input[type=search] { flex: 0 1 280px; min-width: 0; }

.parent { font-size: 13px; font-weight: 700; text-decoration: none; align-self: flex-start; }

/* ------------------------------------------------------------- content */

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  box-shadow: var(--shadow-raised);
}

article.card { display: flex; flex-direction: column; gap: 8px; }

.banner {
  background: var(--surface);
  border-radius: var(--radius-control);
  border-left: 4px solid var(--dim);
  padding: 10px 13px;
  box-shadow: var(--shadow-chip);
}

.banner.error { border-left-color: var(--garnet); }
.banner.review { background: var(--amber-fill); color: var(--amber); border-left-color: var(--amber); font-weight: 600; }
.banner button { display: block; margin-top: 10px; }

.empty { color: var(--muted); padding: 22px 0; }
.meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 76ch; }

.row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 22px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-raised);
}

table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 14px 8px; white-space: nowrap; }
td { padding: 10px 14px; border-top: 1px solid var(--track); vertical-align: top; white-space: nowrap; }
.long { white-space: normal; min-width: 200px; }
.number { text-align: right; font-variant-numeric: tabular-nums; }

details > summary { cursor: pointer; color: var(--fern); font-weight: 600; min-height: 44px; align-content: center; }

/* A table's rows as cards, on a phone. A tap opens the rest of the row. */
.cards { display: none; flex-direction: column; gap: 8px; }

.row-card {
  background: var(--surface);
  border-radius: var(--radius-control);
  padding: 4px 13px;
  box-shadow: var(--shadow-chip);
}

.row-card > .face {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 8px 22px 8px 0;
  position: relative;
  list-style: none;
  color: var(--ink);
  font-weight: 400;
}

.row-card > .face::-webkit-details-marker { display: none; }

.row-card > .face::after {
  content: "›";
  position: absolute;
  right: 2px;
  top: 8px;
  font-size: 20px;
  line-height: 1;
  color: var(--dim);
}

.row-card[open] > .face::after { rotate: 90deg; }
.row-card[role=button], tr[role=button] { cursor: pointer; }
.row-card .facts { grid-template-columns: 9.5em minmax(0, 1fr); }
.row-card > .facts { padding: 8px 0 10px; border-top: 1px solid var(--track); }
.row-card .facts:empty { display: none; }
pre { margin: 0; padding: 12px; overflow-x: auto; background: var(--tint); border-radius: var(--radius-control); }

/* ----------------------------------------------------------- tree graph */

.graph { position: relative; }
.graph > svg { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.graph path { fill: none; stroke: var(--level); stroke-width: 3; }
.graph circle { fill: var(--level); stroke: var(--ground); stroke-width: 2; }
.graph svg.dimmed path:not(.on), .graph svg.dimmed circle:not(.on) { opacity: .25; }
.graph path.on { stroke-width: 5; }

.level-0 { --level: var(--level-0); }
.level-1 { --level: var(--level-1); }
.level-2 { --level: var(--level-2); }
.level-3 { --level: var(--level-3); }

.legend { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--level); }

/* ------------------------------------------------------------ overlays */

dialog {
  border: 0;
  border-radius: var(--radius-card);
  padding: 16px;
  width: min(400px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-raised);
}

dialog::backdrop { background: rgba(20, 26, 22, .45); }
dialog form { display: flex; flex-direction: column; gap: 8px; }
dialog button { width: 100%; }
dialog h2 { margin: 0; }
dialog p { margin-bottom: 6px; }

/* A popover: the browser shows it above an open dialog. */
#toast {
  inset: auto auto 22px 50%;
  translate: -50% 0;
  margin: 0;
  border: 0;
  border-left: 4px solid var(--dim);
  padding: 10px 13px;
  overflow: visible;
  color: var(--ink);
  width: max-content;
  max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-raised);
}

/* --------------------------------------------------------------- phone */

@media (max-width: 760px) {
  #shell { grid-template: "top" auto "screen" 1fr / minmax(0, 1fr); }
  #top { padding: calc(8px + env(safe-area-inset-top)) 8px 0 16px; }
  #screen { padding: 8px 16px calc(104px + env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; }
  .table-wrap { display: none; }
  .cards { display: flex; }

  /* The app's floating tab bar. */
  #nav {
    position: fixed;
    top: auto;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 5;
    flex-direction: row;
    gap: 0;
    padding: 6px 4px;
    background: var(--surface);
    border-radius: 22px;
    box-shadow: var(--shadow-raised);
  }

  #nav a {
    flex: 1 0 52px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px 0;
    font-size: 10px;
  }

  #nav a[aria-current] { background: none; box-shadow: none; }
  /* The top bar keeps the brand and the sign-out: the names give way. */
  .wordmark span, #user { display: none; }
  #top { grid-template-columns: auto minmax(0, 1fr) auto; }
  #toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  dialog { margin-bottom: 16px; }
}

/* -------------------------------------------------------------- session */

/* Signed out, the page is the sign-in card alone. */
.signed-out #nav, .signed-out #brand, .signed-out .account { display: none; }
#shell.signed-out { grid-template: "top" auto "screen" 1fr / minmax(0, 1fr); }
.sign-in { max-width: 420px; margin: 6vh auto 0; text-align: center; }

/* The code is dark on white in both themes: a scanner needs that. */
.qr { align-self: center; width: min(260px, 100%); aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--track); }
.qr svg { display: block; width: 100%; height: 100%; }

.account { justify-self: end; display: flex; align-items: center; gap: 4px; white-space: nowrap; }

/* The brand that the screens work on: the largest control of the top bar. */
#brand { min-width: 0; }
#brand .dropdown-button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  font-family: var(--rounded);
  font-size: 17px;
  font-weight: 800;
  box-shadow: var(--shadow-raised);
}

/* -------------------------------------------------------------- builder */

/* The tree's own settings, across the top. */
.head-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.head-row .actions { margin-left: auto; align-items: center; }
.head-row .parent { align-self: center; }
.head-fields { display: grid; grid-template-columns: 2fr 1fr 1fr 2fr; gap: 12px; align-items: start; }
.publish-checks summary { min-height: 32px; }

/* The steps, and the card of the selected step. Each is as long as it
   needs, and the page scrolls. The card starts on the line of the first
   step: the room over it is empty. */
.builder {
  display: grid;
  grid-template: "head ." auto "steps card" auto / minmax(0, 1.2fr) minmax(360px, 1fr);
  gap: 12px 20px;
  align-items: start;
}

.steps-head { grid-area: head; }
.steps-head h2 { margin: 0; }
.steps-pane { grid-area: steps; min-width: 0; }
.card-pane { grid-area: card; }
.card-title { display: flex; align-items: center; gap: 8px; margin: 0; }
.pair { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; align-items: start; }
.times { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; }
.times input { width: 100%; }
.times[aria-invalid=true] { border-radius: var(--radius-control); }
/* The time of the step: a number that the page counts, not a field. */
.total { display: flex; align-items: center; min-height: 44px; padding: 0 13px; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* A step's level, in the color that its dot and its lines have in the graph. */
.level-dot { flex: none; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--level, var(--dim)); }

/* A list field: one text for each entry, with its number and its minus. */
.entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: entry; }
.entries li { display: flex; align-items: flex-start; gap: 6px; counter-increment: entry; }
.entries li::before { content: counter(entry) "."; flex: none; width: 1.7em; padding-top: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.entries textarea { flex: 1; min-width: 0; }

/* The round plus and minus. The sign is drawn as bars in the middle of the
   circle: a "+" of a font sits off its middle. */
.round {
  flex: none;
  display: inline-block;
  width: 32px;
  height: 32px;
  min-height: 0;
  margin-top: 6px;
  padding: 0;
  border-radius: 50%;
  color: var(--fern);
  background: var(--tint) center no-repeat;
}

.round.minus { background-image: linear-gradient(currentColor, currentColor); background-size: 12px 2px; }

.round.plus {
  background-image: linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor);
  background-size: 12px 2px, 2px 12px;
}

button.add { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 0; padding: 0; background: none; color: var(--fern); font-size: 14px; }
button.add .round { margin-top: 0; }

.checks { display: flex; flex-direction: column; max-height: 220px; overflow-y: auto; border-radius: var(--radius-control); background: var(--tint); padding: 4px 12px; }
.checks label { display: flex; align-items: center; gap: 10px; min-height: 40px; }

ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
ul.plain .tag { margin-left: 6px; }

.steps { display: flex; flex-direction: column; gap: 8px; }

button.step {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 14px;
  text-align: left;
  font-weight: 400;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-chip);
}

button.step .row-title { font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
button.step .meta { margin-left: auto; white-space: nowrap; }

/* The selected step is filled, as the current tab of the app is. Its dot
   gets a ring, so a green dot shows on the green. */
button.step[aria-pressed=true] { background: var(--fern); color: var(--fern-text); box-shadow: var(--shadow-pressed); }
button.step[aria-pressed=true] .meta { color: var(--fern-text); }
button.step[aria-pressed=true] .level-dot { box-shadow: 0 0 0 2px var(--fern-text); }

/* A dialog with a form is wider than a question. */
dialog:has(.field) { width: min(520px, calc(100vw - 32px)); }

@media (max-width: 1180px) {
  .builder { grid-template: "head" auto "steps" auto "card" auto / minmax(0, 1fr); }
  .head-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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