/* Hrefine's site. Colors are tokens, redefined for dark mode; the layout,
   code, and tab styles follow Ordable's and Chromarite's sites. */

:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --text: #17202b;
  --muted: #55606d;
  --border: #dbe1e8;
  --accent: #1f5fbf;
  --accent-2: #0b7a55;
  --code-bg: #f0f3f7;
  --keyword: #8a2be2;
  --string: #0f7a4a;
  --number: #b0461a;
  --comment: #6b7684;
  --type: #1d5fa8;
  --heading: var(--text);
  /* Answers: the browser's, the same, different, or refused. */
  --same: #0b7a55;
  --same-bg: #e9f7f0;
  --bad: #c0262d;
  --bad-bg: #fdecec;
  --reject: #8a5a00;
  --reject-bg: #fdf5e3;
  --browser-bg: #eaf1fc;
  --mark-bg: #ffe08a;
  color-scheme: light dark;
}

/* Layout rules like `display: flex` would otherwise show hidden elements. */
[hidden] {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141a;
    --surface: #171c23;
    --text: #e6ebf1;
    --muted: #a0abb8;
    --border: #2c3440;
    --accent: #79aef7;
    --accent-2: #6fdcae;
    --code-bg: #1c232c;
    --keyword: #c9a0ff;
    --string: #7fd4a4;
    --number: #f0a274;
    --comment: #8b97a5;
    --type: #8cc4ff;
    --same: #6fdcae;
    --same-bg: #15302a;
    --bad: #ff8a8f;
    --bad-bg: #3a1c1f;
    --reject: #f1c46b;
    --reject-bg: #352a14;
    --browser-bg: #18283e;
    --mark-bg: #6b5410;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1rem;
}

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

code,
pre,
input {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

code {
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  line-height: 1.2;
  color: var(--heading);
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.9rem;
}

h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.15rem;
}

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

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 1rem;
  top: 0.5rem;
  z-index: 10;
  background: var(--surface);
  padding: 0.25rem 0.5rem;
}

/* The top bar. */

.top {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  /* A strip of the two accents along the top. */
  background-image: linear-gradient(90deg, var(--accent), var(--accent-2));
  background-size: 100% 5px;
  background-repeat: no-repeat;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.5rem;
}

.brand {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand a {
  color: var(--text);
  text-decoration: none;
}

.bar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.95rem;
}

/* The opening: one URL and every parser's answer. */

.opening {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0 1.5rem;
}

.slogan {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.slogan strong {
  color: var(--text);
}

.opening h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: -0.015em;
}

.the-url {
  margin: 0 0 0.9rem;
}

.the-url code {
  display: inline-block;
  font-size: clamp(1.05rem, 3.2vw, 1.6rem);
  padding: 0.3rem 0.7rem;
  border-radius: 0.5rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
}

.answers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.5rem;
}

.answer {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  border-left-width: 5px;
  background: var(--surface);
  min-width: 0;
}

.answer .who {
  font-size: 0.85rem;
  color: var(--muted);
}

.answer .host {
  font-weight: 650;
  font-size: 1.05rem;
}

.answer .verdict {
  font-size: 0.85rem;
}

.hero-details {
  margin-top: 0.6rem;
  font-size: 0.9rem;
}

.hero-details summary {
  cursor: pointer;
  color: var(--accent);
}

.answer.browser {
  border-left-color: var(--accent);
  background: var(--browser-bg);
}

.answer[data-parser="hrefine"] {
  box-shadow: 0 0 0 2px var(--same) inset;
}

.same {
  --tone: var(--same);
  --tone-bg: var(--same-bg);
}

.differs {
  --tone: var(--bad);
  --tone-bg: var(--bad-bg);
}

.rejects {
  --tone: var(--reject);
  --tone-bg: var(--reject-bg);
}

.answer.same,
.answer.differs,
.answer.rejects {
  border-left-color: var(--tone);
  background: var(--tone-bg);
}

.answer .verdict,
.compare .verdict,
.legend .key {
  color: var(--tone, var(--muted));
}

.answer.differs .host code {
  text-decoration: underline wavy var(--bad);
  text-underline-offset: 0.2em;
}

.none {
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
}

.punch {
  margin: 1rem 0 0.4rem;
  font-size: clamp(1.1rem, 2.6vw, 1.35rem);
  font-weight: 650;
}

.lead {
  margin: 0;
  max-width: 50rem;
  color: var(--muted);
}

.proof-point {
  color: var(--text);
}

/* A tab or newline in a URL, shown as \t or \n. */
.ctl {
  color: var(--bad);
  font-weight: 700;
  outline: 1px dotted var(--bad);
  border-radius: 0.15rem;
  margin: 0 0.05em;
}

/* Sections. */

main > section {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
}

.small-note {
  font-size: 0.9rem;
  color: var(--muted);
}

button {
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 1rem;
}

.examples button,
.small,
.try {
  font-size: 0.85rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.examples button {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.examples button:hover,
.small:hover,
.try:hover,
.tabs button:hover {
  border-color: var(--accent);
}

.fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 0.75rem;
}

.field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

.field input {
  width: 100%;
  font-size: 1.05rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.field input:focus {
  border-color: var(--accent);
}

.insert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin: 0.5rem 0 1.25rem;
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.verdicts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.verdict-box {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: 0.5rem;
  background: var(--surface);
}

.verdict-box.same,
.verdict-box.differs,
.verdict-box.rejects {
  border-left-color: var(--tone);
}

#hrefine-verdict {
  border-left-color: var(--same);
}

#browser-verdict {
  border-left-color: var(--accent);
}

.verdict-box .who {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.verdict-box .what {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
}

.verdict-box .what .display-line {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.verdict-box .what .display-line code {
  color: var(--text);
}

.verdict-box .what .host-line {
  display: block;
  font-size: 1.25rem;
  font-weight: 650;
}

.live {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--same-bg);
  color: var(--same);
  font-weight: 700;
  vertical-align: 0.1em;
}

.agree-note {
  display: block;
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 0 2rem;
}

.table-scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.35rem 0.6rem 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

thead th {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

tbody th {
  font-weight: 600;
  white-space: nowrap;
}

.parts td {
  overflow-wrap: anywhere;
}

.parts tr.diff td {
  background: var(--bad-bg);
}

.parts .typed th {
  font-style: italic;
}

.parts .row-note {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
}

.marked {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  padding: 0.4rem 0.6rem;
  background: var(--code-bg);
  border-radius: 0.4rem;
}

.marked:empty {
  display: none;
}

.marked mark {
  background: var(--mark-bg);
  color: inherit;
  border-radius: 0.15rem;
  outline: 1px solid var(--reject);
}

.errors {
  padding-left: 1.4rem;
  margin: 0.5rem 0;
}

.errors code {
  font-weight: 600;
}

.recorded {
  margin-top: 1.5rem;
}

.limit {
  max-width: 48rem;
  padding: 0.6rem 0.8rem;
  border-left: 4px solid var(--reject);
  background: var(--reject-bg);
  border-radius: 0.3rem;
}

/* The gallery. */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.25rem;
  font-size: 0.9rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--surface);
  min-width: 0;
}

.card h3 {
  margin: 0 0 0.4rem;
}

.card-input {
  margin: 0;
}

.card-input code {
  font-size: 1.05rem;
  padding: 0.1rem 0.4rem;
  background: var(--code-bg);
  border-radius: 0.3rem;
}

.base {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.explain {
  margin: 0.6rem 0;
  font-size: 0.95rem;
}

.tally {
  margin: 0 0 0.5rem;
  font-weight: 600;
  color: var(--bad);
}

.tally.agree {
  color: var(--reject);
}

.card details {
  margin-bottom: 0.75rem;
}

/* An open card takes the whole row, so its table has room. */
.card:has(details[open]) {
  grid-column: 1 / -1;
}

.card summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
}

.card .try {
  align-self: flex-start;
  margin-top: auto;
}

/* The look-alike hosts card: each host, as typed and as shown. */
.hosts-card .card-input .to {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Never broken at a hyphen of xn--. */
.hosts-card .card-input code {
  white-space: nowrap;
}

.shown-hosts {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.shown-hosts li {
  --tone: var(--same);
  --tone-bg: var(--same-bg);
  padding: 0.4rem 0.6rem;
  border-left: 3px solid var(--tone);
  border-radius: 0.3rem;
  background: var(--tone-bg);
  font-size: 0.9rem;
}

.shown-hosts li.kept {
  --tone: var(--bad);
  --tone-bg: var(--bad-bg);
}

.shown-hosts .pair {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.4rem;
}

.shown-hosts code {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.shown-hosts .to {
  color: var(--muted);
}

.shown-hosts .shown-as {
  font-weight: 600;
}

.shown-hosts .tag {
  display: block;
  color: var(--tone);
  font-size: 0.8rem;
  font-weight: 600;
}

.shown-hosts .note {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.hosts-card .why {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
}

.compare {
  font-size: 0.82rem;
  margin-top: 0.4rem;
}

.compare .reads code,
.compare .error {
  overflow-wrap: anywhere;
}

.compare .reads {
  min-width: 10rem;
}

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

.compare tr.browser th,
.compare tr.browser td {
  background: var(--browser-bg);
}

.compare tr.differs .host code {
  color: var(--bad);
  font-weight: 700;
}

/* The table of more disagreements. */

.more-table {
  font-size: 0.85rem;
}

.more-table .group th {
  padding-top: 1rem;
  font-size: 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

.more-table th[scope="row"] {
  font-weight: 400;
  text-align: left;
  min-width: 16rem;
  max-width: 28rem;
  white-space: normal;
}

.more-try {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.more-try code {
  overflow-wrap: anywhere;
}

.more-try:hover code,
.more-try:focus-visible code {
  text-decoration: underline;
}

.more-table .base {
  display: block;
}

.more-note {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
}

.more-table .browser-reads {
  background: var(--browser-bg);
  overflow-wrap: anywhere;
  min-width: 8rem;
}

.more-table .who-col {
  font-size: 0.78rem;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  vertical-align: bottom;
}

.more-table .mark {
  text-align: center;
  font-weight: 700;
  color: var(--tone, var(--muted));
  background: var(--tone-bg, transparent);
}

/* The fix and the proof. */

.steps {
  padding-left: 1.2rem;
  max-width: 52rem;
}

.steps li {
  margin: 0.25rem 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 1rem 0 0.4rem;
}

.tabs button {
  font-size: 0.9rem;
  padding: 0.3rem 0.8rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  background: var(--surface);
}

.tabs button[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

.code-from,
.run {
  margin: 0.3rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

pre.source,
pre.output {
  margin: 0.4rem 0 1rem;
  padding: 0.9rem 1rem;
  border-radius: 0.5rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

.tour-source {
  max-height: 28rem;
}

pre.output {
  max-height: 22rem;
}

.tok-comment {
  color: var(--comment);
  font-style: italic;
}

.tok-string {
  color: var(--string);
}

.tok-number {
  color: var(--number);
}

.tok-keyword {
  color: var(--keyword);
}

.tok-type {
  color: var(--type);
}

.proof-table {
  max-width: 40rem;
}

.proof-table .n {
  white-space: nowrap;
}

.numbers {
  padding-left: 1.2rem;
}

.primary {
  padding: 0.4rem 1rem;
  border-radius: 0.4rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--surface);
  font-weight: 600;
}

/* Secondary: outlined, as where the button switches to JavaScript first. */
.primary.outline {
  background: transparent;
  color: var(--accent);
}

.primary:disabled {
  opacity: 0.5;
  cursor: default;
}

.tour-run {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.versions {
  padding-left: 1.2rem;
  font-size: 0.95rem;
}

footer {
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* The WPT scoreboard: plain numbers, live and from the build. */

.scoreboard {
  margin-top: 1.5rem;
}

.scoreboard > p {
  max-width: 52rem;
}

.scores {
  list-style: none;
  margin: 0.75rem 0 0.5rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.5rem;
}

.score {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-left-color: var(--accent);
  border-radius: 0.5rem;
  background: var(--surface);
  min-width: 0;
}

.score .who {
  font-size: 0.85rem;
  color: var(--muted);
}

.tally-num {
  font-size: 1.35rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.score.reference {
  border-left-color: var(--border);
  background: var(--code-bg);
}

.score-run {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  margin: 0.5rem 0;
}

.score-run button:disabled {
  opacity: 0.5;
  cursor: default;
}

.misses {
  margin: 0.4rem 0;
}

.misses > summary,
.misses li summary {
  cursor: pointer;
  color: var(--accent);
}

.misses ol {
  margin: 0.4rem 0;
  padding-left: 1.6rem;
  font-size: 0.9rem;
}

.misses li {
  margin: 0.2rem 0;
  overflow-wrap: anywhere;
}

.miss-base {
  margin-left: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.misses dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.15rem 0.75rem;
  margin: 0.3rem 0 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--code-bg);
  border-radius: 0.4rem;
}

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

.misses dd {
  margin: 0;
  min-width: 0;
}

.misses dd ul {
  margin: 0;
  padding-left: 1rem;
}

/* Narrow tables: each row stacked, its labels over or beside its values,
   by the width the table has, not the screen's. */

.table-scroll {
  container-type: inline-size;
}

@container (max-width: 30rem) {
  .compare thead {
    /* Kept for screen readers; a block, so it clips its row. */
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .compare,
  .compare tbody {
    display: block;
  }

  /* The parser and its verdict, then its host and what it reads. */
  .compare tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "who verdict" "host host" "reads reads";
    gap: 0 0.6rem;
    padding: 0.4rem 0.4rem;
    border-bottom: 1px solid var(--border);
  }

  .compare th,
  .compare td {
    padding: 0;
    border: 0;
  }

  .compare th {
    grid-area: who;
  }

  .compare .verdict {
    grid-area: verdict;
  }

  .compare .host {
    grid-area: host;
  }

  .compare .reads {
    grid-area: reads;
    min-width: 0;
  }

  .compare tr.browser {
    background: var(--browser-bg);
  }

  .compare td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--muted);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  }
}

@container (max-width: 40rem) {
  .more-table thead {
    /* Kept for screen readers; a block, so it clips its row. */
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .more-table,
  .more-table tbody,
  .more-table .group,
  .more-table .group th {
    display: block;
  }

  /* The input and its note, what browsers read, then a mark for each
     parser, its name over it. */
  .more-table .more-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(3.2rem, 1fr));
    gap: 0.2rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
  }

  .more-table .more-row > th,
  .more-table .more-row > .browser-reads {
    grid-column: 1 / -1;
    min-width: 0;
    max-width: none;
    padding: 0;
    border: 0;
  }

  .more-table .browser-reads {
    padding: 0.15rem 0.4rem;
    border-radius: 0.3rem;
  }

  .more-table .browser-reads::before {
    content: attr(data-label) " ";
    color: var(--muted);
  }

  .more-table .mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.15rem 0.1rem;
    border: 0;
    border-radius: 0.3rem;
  }

  .more-table .mark::before {
    content: attr(data-who);
    font-size: 0.68rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--text);
    text-align: center;
  }
}

/* Phones: one column. */

@media (max-width: 44rem) {
  body {
    font-size: 16px;
  }

  .fields,
  .verdicts,
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .answers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .answers {
    gap: 0.35rem;
  }

  /* One line for the name, one for the host, and the verdict as its icon
     in the corner, its words kept for screen readers. */
  .answer {
    position: relative;
    padding: 0.3rem 1.6rem 0.3rem 0.5rem;
  }

  .answer .who {
    font-size: 0.78rem;
  }

  .answer .host {
    font-size: 0.92rem;
  }

  .answer .verdict {
    position: absolute;
    top: 0.25rem;
    right: 0.45rem;
    font-size: 1rem;
    font-weight: 700;
  }

  .answer .verdict-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .opening {
    padding-top: 0.6rem;
  }

  .slogan {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  /* A miss's details: each label over its value. */
  .misses dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .misses dd + dt {
    margin-top: 0.3rem;
  }
}

/* Dev mode: a switch, badges over the parts of the page with code behind
   them, and a card per badge (devmode.js). */
.dev-toggle {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 1rem 0.5rem 0.55rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.12);
  cursor: pointer;
}

.dev-toggle:hover {
  border-color: var(--accent);
}

.dev-icon {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  transition: color 0.2s, background 0.2s;
}

.dev-toggle[aria-pressed="true"] .dev-icon {
  color: var(--bg);
  background: var(--accent);
}

.dev-layer {
  position: absolute;
  top: 0;
  left: 0;
  /* Below an open card, so no badge shows inside it. */
  z-index: 24;
}

.dev-badge {
  position: absolute;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 50%;
  box-shadow: 0 2px 10px color-mix(in oklab, var(--accent) 45%, transparent);
  cursor: pointer;
  animation: dev-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
  transition: transform 0.15s;
}

.dev-badge:nth-child(2) { animation-delay: 30ms; }
.dev-badge:nth-child(3) { animation-delay: 60ms; }
.dev-badge:nth-child(4) { animation-delay: 90ms; }
.dev-badge:nth-child(5) { animation-delay: 120ms; }
.dev-badge:nth-child(6) { animation-delay: 150ms; }
.dev-badge:nth-child(7) { animation-delay: 180ms; }
.dev-badge:nth-child(8) { animation-delay: 210ms; }
.dev-badge:nth-child(9) { animation-delay: 240ms; }

.dev-badge:hover,
.dev-badge[aria-expanded="true"] {
  transform: scale(1.15);
}

.dev-badge:focus-visible,
.dev-toggle:focus-visible,
.dev-card button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.dev-card {
  position: absolute;
  z-index: 25;
  width: min(32rem, calc(100vw - 2rem));
  padding: 1rem 1.1rem 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.18), 0 2px 8px rgb(0 0 0 / 0.08);
  animation: dev-rise 0.18s ease-out backwards;
}

.dev-card:focus {
  outline: none;
}

@keyframes dev-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.dev-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.dev-card h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--heading);
}

.dev-close {
  margin: -0.35rem -0.4rem 0 0;
  width: 2rem;
  height: 2rem;
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.dev-close:hover {
  color: var(--text);
  background: var(--code-bg);
}

.dev-about {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.dev-languages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
}

.dev-languages button {
  padding: 0.15rem 0.6rem;
  font: inherit;
  font-size: 0.78rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.dev-languages button:hover {
  border-color: var(--accent);
}

.dev-languages button[aria-pressed="true"] {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.dev-code {
  margin: 0;
  padding: 0.75rem 0.85rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.55;
  background: var(--code-bg);
  border-radius: 8px;
}

.dev-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.dev-tour {
  padding: 0;
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* Phones: the switch shrinks to its icon, the page leaves room to scroll
   anything clear of it, and the card is a sheet along the bottom, above
   the switch. */
@media (max-width: 640px) {
  .dev-toggle {
    padding: 0.35rem;
  }

  .dev-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  body {
    padding-bottom: 4rem;
  }

  .dev-card {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: 60vh;
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dev-badge,
  .dev-card {
    animation: none;
  }
}

.dev-about code {
  font-size: 0.85em;
  color: var(--text);
  padding: 0.05em 0.3em;
  background: var(--code-bg);
  border-radius: 4px;
}
