/*
 * Marc app. Set like the marketing site (site/styles.css) so the two read as one product:
 * a warm paper background, ink text, hairline rules, one orange accent, serif page
 * headings over system sans for everything you read and type. System font stacks only
 * (nothing to download) and nothing loaded from outside the app.
 *
 * Tokens keep the app's names; their values are the site's. Every text/background pair
 * meets WCAG AA in both color schemes (text >= 4.5:1; focus rings and form-control
 * borders >= 3:1); tests/browser/test_css.py checks the light and the dark palette.
 */

/* ---- Tokens ------------------------------------------------------------ */

:root {
  color-scheme: light dark;

  /* Site: --bg, --bg-sunk, --bg-elev, --ink, --ink-2, --ink-3, --line, --line-strong. */
  --bg: #faf8f4;
  --surface: #f3efe8;
  --paper: #ffffff;
  --text: #18181b;
  --text-soft: #44413b;
  --muted: #635f56;
  --line: #e4ded3;
  --line-strong: #b9b2a5;
  --border: #8a8478;
  --accent: #c2410c;
  --link: #18181b;
  --focus: #c2410c;
  --primary: #18181b;
  --primary-hover: #33333a;
  --primary-text: #faf8f4;
  --header-bg: rgb(250 248 244 / 0.86);

  /* Calm states: a tinted panel with a thin colored edge, never a loud box. */
  --danger: #b42318;
  --on-danger: #ffffff;
  --error-bg: #fbefec;
  /* Warnings are the site's number check: the editor's red pen (--pen) on sunk paper. */
  --warning-bg: #f3efe8;
  --warning-border: #c8102e;
  --warning-text: #18181b;
  --ok-bg: #eef3ec;
  --ok-border: #2f6b3a;
  --info-bg: #f3efe8;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, "New York", "Iowan Old Style", Charter, "Palatino Linotype", Palatino,
    Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius-sm: 0.5rem;
  --radius: 0.75rem;
  --radius-sheet: 0.375rem;
  --frame: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --measure: 46rem;
  --measure-wide: 60rem;
  --rule-gap: clamp(2rem, 1.6rem + 1.6vw, 3rem);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316;
    --surface: #18181c;
    --paper: #1c1c21;
    --text: #f1eee8;
    --text-soft: #cbc6bc;
    --muted: #a7a297;
    --line: #2d2c32;
    --line-strong: #4a4851;
    --border: #77737d;
    --accent: #ff9a62;
    --link: #f1eee8;
    --focus: #ff9a62;
    --primary: #f1eee8;
    --primary-hover: #ffffff;
    --primary-text: #131316;
    --header-bg: rgb(19 19 22 / 0.84);
    --danger: #ff8a80;
    --on-danger: #131316;
    --error-bg: #2a1a1a;
    --warning-bg: #18181c;
    --warning-border: #ff7a7a;
    --warning-text: #f1eee8;
    --ok-bg: #16211a;
    --ok-border: #5fae73;
    --info-bg: #1c1c21;
  }
}

/* ---- Base -------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  text-wrap: balance;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.125rem, 1.65rem + 2vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

h2 {
  margin: 2.25rem 0 0.6rem;
  font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h3 {
  margin: 1.5rem 0 0.4rem;
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

p {
  margin: 0.75rem 0;
  text-wrap: pretty;
}

a {
  color: var(--link);
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}

.lead {
  max-width: 38rem;
  margin: 0 0 1.5rem;
  color: var(--text-soft);
  font-family: var(--font-serif);
  font-size: clamp(1.1875rem, 1.1rem + 0.4vw, 1.3125rem);
  line-height: 1.5;
}

.muted {
  color: var(--muted);
}

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

/* ---- Focus and skip link --------------------------------------------- */

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

a:focus-visible {
  border-radius: 0.25rem;
}

main:focus {
  outline: none;
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.5rem;
}

/* ---- Header: the site's, with the app's nav and a small mode indicator ---- */

.wrap {
  width: 100%;
  max-width: var(--frame);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header {
  position: relative;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header {
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
  }
}

/* Phones: brand and tools on the first row, the nav wraps on the second (as on the site). */
.header-row {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "brand tools"
    "nav nav";
  align-items: center;
  justify-content: space-between;
  column-gap: 1rem;
  padding-block: 0.75rem 0.25rem;
}

.header-row:not(:has(.site-nav)) {
  padding-block: 0.75rem;
}

.site-name {
  grid-area: brand;
  margin: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark,
.login-mark {
  display: block;
  flex: none;
  width: 30px;
  height: 30px;
  color: var(--text);
}

.brand-mark .mark-stroke,
.login-mark .mark-stroke {
  stroke: var(--bg);
}

.brand-mark .mark-accent,
.login-mark .mark-accent {
  fill: var(--accent);
}

.site-nav {
  grid-area: nav;
  min-width: 0;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--text-soft);
  font-size: 0.9375rem;
  font-weight: 550;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

.header-tools {
  grid-area: tools;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 1rem;
  min-width: 0;
}

/* "● Live" / "○ Offline": the full sentence is the screen-reader text and the tooltip. */
.mode {
  margin: 0;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.8125rem;
  font-weight: 550;
  line-height: 1.4;
  white-space: nowrap;
}

.mode-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: default;
}

.mode-dot {
  display: inline-block;
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--muted);
}

.mode-offline .mode-dot {
  border: 1.5px solid var(--muted);
  background: transparent;
}

.mode-live .mode-dot {
  background: var(--accent);
}

.account {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.participant-id {
  color: var(--text-soft);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.account .link-button {
  min-height: 2.75rem;
  color: var(--text-soft);
  font-size: 0.9375rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}

.account .link-button:hover:not(:disabled) {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

/* On small screens the account id is read out but not shown (the row has no room). */
@media (max-width: 69.99rem) {
  .account-id {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
}

/* Drafting unavailable: a slim notice under the header, never a configuration detail. */
.header-notice {
  border-top: 1px solid var(--line);
  background: var(--error-bg);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.45;
}

.header-notice p {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-block: 0;
  padding-block: 0.5rem;
}

.header-notice .mode-dot {
  background: var(--danger);
}

/* Small phones: a tighter nav so the four links usually fit on one line. */
@media (max-width: 29.99rem) {
  .site-nav ul {
    gap: 0 1rem;
  }

  .site-nav a {
    font-size: 0.875rem;
  }
}

/* 360px phones: tighter again, so the nav stays one row (the header two, as on the site). */
@media (max-width: 23.99rem) {
  .site-nav ul {
    gap: 0 0.875rem;
  }

  .site-nav a {
    font-size: 0.8125rem;
  }
}

/* Sticky from 48rem, as on the site. The scroll padding keeps focused controls and anchor
   targets clear of it (WCAG 2.4.11): the header has two rows until 56rem, one after. */
@media (min-width: 48rem) {
  html {
    scroll-padding-top: 8.5rem;
  }

  .site-header {
    position: sticky;
    top: 0;
  }
}

@media (min-width: 56rem) {
  html {
    scroll-padding-top: 6rem;
  }

  .header-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand nav tools";
    column-gap: 1.75rem;
    min-height: 4.25rem;
    padding-block: 0.5rem;
  }

  .site-nav ul {
    justify-content: flex-end;
    gap: 0 1.75rem;
  }
}

.noscript {
  margin-block: 0;
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

/* ---- Page column ---------------------------------------------------------- */

/* One readable column, left-aligned with the brand like the site's pages: content-box,
   so --measure is the text width and the gutters sit outside it. */
main {
  display: block;
  flex: 1 0 auto;
  box-sizing: content-box;
  max-width: var(--measure);
  margin: 0 0 0 max(0px, (100% - var(--frame)) / 2);
  padding: clamp(2rem, 1.25rem + 3vw, 3.5rem) var(--gutter) clamp(3.5rem, 2.5rem + 4vw, 6rem);
}

/* Lists get more room; the form above the list keeps the reading measure, while the rules
   between sections all run the page's full width. */
main[data-page="samples"] {
  max-width: var(--measure-wide);
}

main[data-page="samples"] > :not(section),
main[data-page="samples"] > section:not([aria-labelledby="list-heading"]) > * {
  max-width: var(--measure);
}

/* Sections after the opening are divided by a hairline rule, as on the site. */
main > section:not(.warnings, .question, .notice-section),
main > h2 {
  margin-top: var(--rule-gap);
  padding-top: var(--rule-gap);
  border-top: 1px solid var(--line);
}

/* ...except a section that opens the page right under its heading. */
main > h1 + .status + .error-box + section,
#draft-section,
#brief-section {
  margin-top: 1.5rem;
  padding-top: 0;
  border-top: 0;
}

main > section > h2:first-child {
  margin-top: 0;
}

main > .notice-section {
  margin-top: 2rem;
}

/* A form right under a section heading does not need a second rule. */
h2 + form > fieldset:first-child {
  margin-top: 1rem;
  padding-top: 0;
  border-top: 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 0.9375rem;
}

.site-footer p {
  margin-block: 0;
  padding-block: 1.75rem 2rem;
}

/* ---- Sign-in: centered and minimal ------------------------------------------ */

main[data-page="login"] {
  max-width: 24rem;
  margin-inline: auto;
  padding-top: clamp(2.5rem, 1.5rem + 6vw, 6rem);
}

main[data-page="login"] .login-mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 1.25rem;
}

main[data-page="login"] h1 {
  margin-bottom: 0.6rem;
  font-size: clamp(1.875rem, 1.6rem + 1.2vw, 2.375rem);
  text-align: center;
}

main[data-page="login"] .lead {
  margin: 0 auto 1.75rem;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 1rem;
  text-align: center;
}

main[data-page="login"] button[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
}

main[data-page="login"] form > .muted:last-child {
  margin-top: 1.5rem;
  text-align: center;
}

/* ---- Forms ------------------------------------------------------------- */

form {
  margin: 0;
}

label,
legend {
  font-weight: 600;
}

.field {
  margin-block: 1.25rem;
}

.field > label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1rem;
  line-height: 1.4;
}

.hint {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.5;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

/* Text fields focus in ink: the accent ring sits too close to the error red. */
input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
input[type="password"]:focus-visible,
input[type="number"]:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-color: var(--text);
}

input[type="number"] {
  max-width: 9rem;
}

textarea {
  min-height: 5.5rem;
  resize: vertical;
}

input:disabled,
textarea:disabled,
select:disabled {
  background: var(--surface);
  color: var(--muted);
  cursor: not-allowed;
}

/* Groups read as sub-sections: a hairline above, the legend as their small heading. */
fieldset {
  min-width: 0;
  margin: 2rem 0 0;
  padding: 1.25rem 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

legend {
  float: left;
  width: 100%;
  margin: 0 0 0.6rem;
  padding: 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.4;
}

legend + * {
  clear: both;
}

/* Only groups of several fields (the task form's); single questions keep the label style.
   The bottom margin is needed: the floated legend's clearance eats the next field's. */
form > fieldset:has(> .field) > legend {
  margin-bottom: 0.75rem;
  font-family: var(--font-serif);
  font-size: 1.3125rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

fieldset fieldset legend {
  font-size: 0.9375rem;
}

.checkbox,
.radio {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.7rem;
  align-items: start;
  margin-block: 0.7rem;
}

.checkbox input,
.radio input {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0.22rem 0 0;
  accent-color: var(--primary);
}

.checkbox label,
.radio label {
  font-weight: 400;
}

.checkbox .hint,
.radio .hint,
.checkbox .field-error,
.radio .field-error {
  grid-column: 2;
  margin: 0;
}

[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: inset 0 0 0 1px var(--danger);
}

.field-error {
  margin: 0.4rem 0 0;
  color: var(--danger);
  font-size: 0.9375rem;
  font-weight: 600;
}

form > button[type="submit"] {
  margin-top: 0.75rem;
}

/* ---- Buttons: the site's dark primary and outlined secondary ---------------- */

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-text);
  font: 600 0.9375rem/1.2 var(--font-sans);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms var(--ease-out),
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

button:active:not(:disabled),
.button-link:active {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

.button-danger {
  background: var(--danger);
  color: var(--on-danger);
}

@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled),
  .button-link:hover {
    background: var(--primary-hover);
  }

  .button-secondary:hover:not(:disabled) {
    background: var(--surface);
    border-color: var(--muted);
  }

  .button-danger:hover:not(:disabled) {
    background: var(--danger);
    filter: brightness(0.92);
  }
}

/* Text actions inside sentences ("Use an access code instead", "Sign out"). */
.link-button {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.link-button:hover:not(:disabled) {
  background: none;
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}

.link-button:active:not(:disabled) {
  transform: none;
}

.small {
  min-height: 2.25rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.875rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-block: 1rem;
}

/* ---- Status, errors, notices: small and calm --------------------------------- */

.status:not(:empty),
.error-box:not(:empty) {
  margin-block: 1rem;
  padding: 0.65rem 0.9rem;
  border-left: 3px solid var(--ok-border);
  background: var(--ok-bg);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.error-box:not(:empty) {
  border-left-color: var(--danger);
  background: var(--error-bg);
}

.status p,
.error-box p {
  margin: 0.2rem 0;
}

.status ul,
.error-box ul {
  margin: 0.25rem 0;
  padding-left: 1.25rem;
}

.error-box .actions {
  margin-block: 0.6rem 0.2rem;
}

.notice {
  margin-block: 1rem 1.5rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--line-strong);
  background: var(--info-bg);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.warning-note {
  margin-block: 0.75rem;
  padding: 0.55rem 0.85rem;
  border-left: 3px solid var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.question {
  margin-block: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  background: var(--paper);
}

.question h2,
.question h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 650;
  letter-spacing: 0;
}

.question p {
  margin: 0.5rem 0 0;
}

.question-text {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.4;
}

/* ---- The draft: a sheet of paper, its actions along the bottom edge ----------- */

.draft-card {
  margin-top: 1.25rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sheet);
  background: var(--paper);
}

.draft-text {
  padding: clamp(1.1rem, 0.8rem + 1.5vw, 1.75rem);
  font-size: 1.0625rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.draft-actions {
  margin: 0;
  padding: 0.75rem clamp(1.1rem, 0.8rem + 1.5vw, 1.75rem);
  border-top: 1px solid var(--line);
}

.copy-status {
  color: var(--muted);
  font-size: 0.875rem;
}

/* "Back to the brief" is page navigation, not part of the revision form above it. */
#draft-nav {
  margin-top: var(--rule-gap);
  padding-top: var(--rule-gap);
  border-top: 1px solid var(--line);
}

/* Warnings stay apart from the draft and read as a margin note, not an alarm. */
.warnings {
  margin-block: 1.75rem;
  padding: 0.85rem 1.1rem;
  border-left: 3px solid var(--warning-border);
  background: var(--warning-bg);
  color: var(--text-soft);
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* Nothing to check: a neutral edge, not the red pen. */
.warnings:has(#no-warnings:not([hidden])) {
  border-left-color: var(--line-strong);
}

.warnings h2 {
  margin: 0 0 0.2rem;
  color: var(--warning-text);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 650;
  letter-spacing: 0;
}

.warnings p {
  margin: 0.3rem 0;
}

.warnings ul {
  margin: 0.4rem 0;
  padding-left: 1.15rem;
}

.warnings li {
  color: var(--warning-text);
}

.warnings li::marker {
  color: var(--warning-border);
}

.warnings li + li {
  margin-top: 0.25rem;
}

.used-list {
  margin: 0.75rem 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.used-list > li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.used-list p {
  margin: 0.2rem 0 0;
  font-size: 0.875rem;
}

/* ---- Samples, examples, briefs --------------------------------------------- */

.sample-list,
.example-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sample-list > li,
.example-list > li {
  margin-block: 1rem;
  padding: 1.1rem 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sheet);
  background: var(--paper);
}

.sample-list > li > h3,
.example-list > li > h3 {
  margin: 0 0 0.75rem;
}

.example-list > li > p {
  margin: 0.3rem 0;
  font-size: 0.9375rem;
}

.sample-body {
  padding: 0.85rem 1rem;
  border-radius: 0.25rem;
  background: var(--surface);
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sample-list fieldset,
.example-list fieldset {
  margin-top: 1rem;
  padding-top: 0.75rem;
}

.sample-list legend {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.sample-list .checkbox,
.example-list .checkbox {
  margin-block: 0.45rem;
  font-size: 0.9375rem;
}

.delete-area {
  margin-top: 0.75rem;
}

/* Wide screens: the message on the left, its details and controls beside it. */
@media (min-width: 60rem) {
  .sample-list > li {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    grid-template-rows: auto auto auto auto auto auto 1fr;
    column-gap: 1.75rem;
    align-items: start;
  }

  .sample-list > li > h3 {
    grid-column: 1 / -1;
  }

  .sample-list > li > .sample-body {
    grid-column: 1;
    grid-row: 2 / -1;
  }

  .sample-list > li > :not(h3, .sample-body) {
    grid-column: 2;
  }

  .sample-list > li > dl.meta {
    margin-top: 0;
  }

  .sample-list > li > fieldset {
    margin-top: 0.25rem;
  }
}

dl.meta,
dl.details {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.25rem 1rem;
  margin: 0.9rem 0;
}

dl.meta {
  font-size: 0.875rem;
  line-height: 1.45;
}

dl.meta dt,
dl.details dt {
  color: var(--muted);
  font-weight: 500;
}

dl.meta dd,
dl.details dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

dl.details dd ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* The brief as typed, like the site's picture of it: a paper sheet, values in a
   typewriter face. */
#brief-details {
  margin: 0 0 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sheet);
  background: var(--paper);
  font-size: 0.875rem;
  line-height: 1.5;
  align-items: baseline;
}

#brief-details dd {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
}

#brief-facts li::marker {
  color: var(--accent);
  font-family: var(--font-serif);
  font-weight: 500;
}

.confirm {
  margin-block: 0.5rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--error-bg);
  font-size: 0.9375rem;
}

.confirm p {
  margin: 0 0 0.25rem;
}

.confirm .actions {
  margin-block: 0.5rem 0;
}

.facts-list {
  margin: 0.5rem 0 1rem;
  padding: 0;
  list-style: none;
}

.fact-row {
  margin-block: 0.75rem;
}

.fact-row > label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.9375rem;
}

.fact-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.fact-controls input {
  flex: 1 1 14rem;
  width: auto;
}

/* Home: next steps as numbered rows between hairlines that run the column's full width.
   Not a grid: each item mixes text and links, which would become separate grid items. */
.steps {
  margin: 1rem 0 1.5rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 0.85rem 0 0.85rem 2.25rem;
  border-bottom: 1px solid var(--line);
  counter-increment: step;
}

.steps li:first-child {
  border-top: 1px solid var(--line);
}

.steps li::before {
  content: counter(step) ".";
  position: absolute;
  top: 0.85rem;
  left: 0;
  color: var(--accent);
  font: 500 1.25rem/1.36 var(--font-serif);
}

summary {
  font-weight: 600;
  cursor: pointer;
}

summary::marker {
  color: var(--muted);
}

details {
  margin-block: 0.5rem;
}

details .sample-body {
  margin-top: 0.5rem;
}

@media (max-width: 34rem) {
  dl.details {
    grid-template-columns: 1fr;
    gap: 0;
  }

  dl.details dd {
    margin-bottom: 0.5rem;
  }

  dl.meta {
    column-gap: 0.75rem;
  }

  .sample-list > li,
  .example-list > li {
    padding: 1rem;
  }

  .sample-body {
    padding: 0.75rem 0.85rem;
  }
}

/* ---- Motion and forced colors ------------------------------------------------ */

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

  button:active:not(:disabled),
  .button-link:active {
    transform: none;
  }
}

@media (forced-colors: active) {
  button,
  .button-link {
    border-color: ButtonText;
  }

  .link-button {
    border: 0;
  }

  .mode-dot {
    border: 1px solid CanvasText;
  }
}
