/* Design tokens of the site itself: black, white and grey only. */
:root {
  color-scheme: light dark;
  --bg: #f6f5f1;
  --panel: #ffffff;
  --sunken: #eeece6;
  --ink: #1b1a17;
  --muted: #6a675f;
  --line: #dcd9d0;
  --accent: #1b1a17;
  --accent-ink: #ffffff;
  --accent-soft: #e9e7e0;
  --focus: #1b1a17;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 6px;
  --top: 52px;
  --gap: 20px;
  --page: 1440px;
}

/* Dark follows the system unless the visitor chose a theme with the switch
   in the header, which sets data-theme on the root element. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131312;
    --panel: #1c1c1a;
    --sunken: #262623;
    --ink: #eeede8;
    --muted: #9c998f;
    --line: #33322e;
    --accent: #eeede8;
    --accent-ink: #131312;
    --accent-soft: #2d2d2a;
    --focus: #eeede8;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131312;
  --panel: #1c1c1a;
  --sunken: #262623;
  --ink: #eeede8;
  --muted: #9c998f;
  --line: #33322e;
  --accent: #eeede8;
  --accent-ink: #131312;
  --accent-soft: #2d2d2a;
  --focus: #eeede8;
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* Element defaults and small shared helpers. */
* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--sans);
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

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

h1 {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 8px;
  font-weight: 600;
}

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

.box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.stack {
  display: grid;
  gap: 14px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.chip {
  font: 11px var(--mono);
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--sunken);
  color: var(--muted);
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 0;
  text-align: center;
}

/* Hidden until the script is ready. "keep" hides a thing but keeps its
   room, so the page does not jump when it appears. */
[x-cloak]:not([x-cloak="keep"]) {
  display: none !important;
}

[x-cloak="keep"] {
  visibility: hidden;
}

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

code {
  font-family: var(--mono);
}

/* Page shells: the centred page and the two-column style page. */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px var(--gap);
  padding: 14px var(--gap) var(--gap);
  height: calc(100dvh - var(--top));
  max-width: var(--page);
  margin: 0 auto;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    height: auto;
  }
  .side {
    overflow: visible;
  }
}

.hero {
  margin: 8px 0 22px;
}

.hero h1 {
  font-size: 34px;
  letter-spacing: -0.03em;
}

.hero p {
  margin: 10px 0 0;
  font-size: 16px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .hero h1 {
    font-size: 26px;
  }
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 13px;
}

.side > * {
  min-width: 0;
  flex: none;
}

.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: 28px var(--gap) 56px;
}

.page .lead {
  color: var(--muted);
  font-size: 15px;
  margin: 6px 0 22px;
}

/* Buttons. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  font: 600 13px var(--sans);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--muted);
}

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

.btn.primary:hover {
  opacity: 0.86;
}

.btn.big {
  height: 44px;
  padding: 0 22px;
  font-size: 15px;
}

.btn.small {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.btn.wide {
  width: 100%;
}

.btn[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}

/* Era index cards. */
.trio {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 1px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.trio a {
  display: block;
  min-height: 0;
  background: var(--sunken);
  overflow: hidden;
}

.trio a:first-child {
  grid-row: 1 / -1;
}

.trio:has(a:nth-child(4)) {
  grid-template-rows: repeat(3, minmax(0, 1fr));
}

.trio:has(a:nth-child(5)) {
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.trio a:only-child {
  grid-column: 1 / 3;
}

.trio img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  transition: transform 0.2s;
}

.trio a:hover img {
  transform: scale(1.03);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card .body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card .name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .meta {
  font: 11px var(--mono);
  color: var(--muted);
}

.card .foot {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  gap: 8px;
}

.card .foot .btn {
  flex: 1;
  height: 34px;
}

/* The colour editor: a bar in the side panel that opens a dialog. */
.colours-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.colours-bar .label {
  font-weight: 600;
}

.colours-bar .muted {
  margin-right: auto;
  font-size: 12px;
}

.editor {
  width: min(1320px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.35);
}

.editor::backdrop {
  background: rgb(0 0 0 / 0.5);
}

.editor form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 34px);
}

.editor header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.editor header h2 {
  font-size: 18px;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}

.editor header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* Groups flow into balanced columns; a group never splits across two. */
.editor .groups {
  columns: 4 270px;
  column-gap: 30px;
  padding: 18px 20px 8px;
  overflow-y: auto;
}

.editor fieldset {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  min-width: 0;
  break-inside: avoid;
}

.editor legend {
  padding: 0 0 5px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.editor footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
}

.editor footer .grow {
  flex: 1;
}

/* One colour on one line: a square swatch, its name, its value, a reset. */
.colour {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 150px 24px;
  align-items: center;
  gap: 9px;
  height: 32px;
}

.colour .pick {
  display: block;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  overflow: hidden;
}

.colour .pick::-webkit-color-swatch-wrapper {
  padding: 0;
}

.colour .pick::-webkit-color-swatch {
  border: 0;
}

.colour .pick::-moz-color-swatch {
  border: 0;
}

.colour .pick:disabled {
  opacity: 0.4;
  cursor: default;
}

.colour label {
  display: contents;
}

.colour label span {
  font-size: 13px;
  color: var(--muted);
  text-transform: capitalize;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.colour .value {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  font: 12px var(--mono);
}

.colour .value:focus {
  outline: 2px solid var(--focus);
  outline-offset: 0;
}

.colour .value:disabled {
  color: var(--muted);
}

.colour .undo {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  visibility: hidden;
}

.colour .undo:hover {
  background: var(--sunken);
  color: var(--ink);
}

.colour .undo svg {
  display: block;
  width: 14px;
  height: 14px;
}

.colour.is-custom .undo {
  visibility: visible;
}

.colour.is-custom label span {
  color: var(--ink);
  font-weight: 600;
}

/* The documentation page: a sticky list of sections beside one column. */
.docs {
  display: grid;
  grid-template-columns: 200px minmax(0, 820px);
  gap: 56px;
  align-items: start;
}

.toc {
  position: sticky;
  top: calc(var(--top) + 28px);
  display: grid;
  gap: 2px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.toc a {
  padding: 6px 10px;
  border-radius: 5px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.toc a:hover, .toc a[aria-current] {
  color: var(--ink);
}

/* The marker slides along the rule to the section being read. */
.toc .marker {
  position: absolute;
  left: -1px;
  top: 0;
  width: 2px;
  height: 0;
  background: var(--ink);
  transition: transform 0.2s ease, height 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .toc .marker, .toc a {
    transition: none;
  }
}

@media (max-width: 900px) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .toc {
    display: none;
  }
}

.doc section {
  margin-top: 44px;
  scroll-margin-top: calc(var(--top) + 20px);
}

.doc h1 {
  font-size: 34px;
  letter-spacing: -0.03em;
}

.doc h2 {
  font-size: 20px;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 10px;
}

.doc h3 {
  font-size: 15px;
  margin: 0 0 6px;
}

.doc p, .doc dd {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 12px;
}

.doc .lead {
  font-size: 17px;
  color: var(--muted);
  margin: 12px 0 0;
}

.doc code {
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--sunken);
}

.doc pre {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  overflow-x: auto;
}

.doc pre code {
  padding: 0;
  background: none;
  font-size: 13px;
  line-height: 1.6;
}

/* How to use it: three plain lines, each led by its verb. */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  padding: 0 0 10px;
  font-size: 15px;
  line-height: 1.6;
}

.steps li:last-child {
  padding-bottom: 0;
}

/* Definitions: a name beside what it is, row after row. */
.defs {
  margin: 16px 0;
  border-top: 1px solid var(--line);
}

.defs div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.defs dt {
  font-weight: 600;
}

.defs dt code {
  font-size: 13px;
  background: none;
  padding: 0;
}

.defs dd {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* The anatomy of an ID: its pieces side by side, each with a caption. */
.anatomy {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.anatomy span {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.anatomy b {
  font: 600 18px var(--mono);
}

.anatomy i {
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}

.anatomy .opt {
  border-style: dashed;
  background: none;
}

.ways {
  display: grid;
  gap: 14px;
}

.way {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  min-width: 0;
}

.way p {
  font-size: 14px;
  color: var(--muted);
}

.way p:last-child {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .defs div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .doc h1 {
    font-size: 26px;
  }
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 14px;
}

.doc th, .doc td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.5;
}

.doc th {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}

.doc td:first-child {
  white-space: nowrap;
}

/* On a phone the anatomy becomes a list, a piece beside its caption, and
   each table row a block: the address, then what it returns. */
@media (max-width: 720px) {
  .doc section {
    margin-top: 36px;
  }
  .anatomy {
    display: grid;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
  }
  .anatomy span {
    grid-template-columns: 84px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: none;
  }
  .anatomy span:last-child {
    border-bottom: 0;
  }
  .anatomy b {
    font-size: 15px;
    white-space: nowrap;
  }
  .anatomy i {
    font-size: 13px;
  }
  .doc table, .doc tbody, .doc tr, .doc td {
    display: block;
  }
  .doc thead {
    display: none;
  }
  .doc table {
    border-top: 1px solid var(--line);
  }
  .doc tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .doc td {
    padding: 0;
    border: 0;
  }
  .doc td:first-child {
    margin-bottom: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .doc td:last-child {
    color: var(--muted);
  }
  .doc code {
    overflow-wrap: anywhere;
  }
}

/* Era cards on the home page: a radio button dressed as a card. */
@media (max-width: 720px) {
  .eras {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
  .section-head {
    flex-wrap: wrap;
    gap: 2px 12px;
  }
}

.eras {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.era {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}

.era:hover {
  border-color: var(--muted);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgb(0 0 0 / 0.1);
}

.era input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.era:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.era:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.thumb {
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--sunken);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.thumb.mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  background: var(--line);
}

.thumb.mosaic img {
  min-height: 0;
}

.era .text {
  padding: 11px 13px 13px;
  display: grid;
  gap: 3px;
}

.era .name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.25;
}

.era .years {
  color: var(--muted);
  font: 12px var(--mono);
}

.era .tick {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: none;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.25);
}

.era:has(input:checked) .tick {
  display: grid;
}

/* "Any era" is the form's reset button: it shows as chosen while no era is. */
button.era {
  width: 100%;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
}

.eras:not(:has(input:checked)) .era.any {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.eras:not(:has(input:checked)) .era.any .tick {
  display: grid;
}

/* The heart: saves a style in this browser. */
.heart {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.heart:hover {
  border-color: var(--muted);
  color: var(--ink);
}

.heart svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.heart[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--ink);
}

.heart[aria-pressed="true"] svg {
  fill: currentColor;
}

/* The footer: the name and one line, centred; one row on a wide screen,
   stacked on a phone. The style page fills the window on a wide screen, so
   it has none there. */
.bottom {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.bottom .in {
  max-width: var(--page);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  padding: 18px var(--gap);
  text-align: center;
}

.bottom .name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bottom .name svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--ink);
}

.bottom b {
  color: var(--ink);
  font-weight: 600;
}

@media (min-width: 961px) {
  .app + .bottom {
    display: none;
  }
}

@media (max-width: 720px) {
  .bottom .in {
    flex-direction: column;
  }
}

/* The sticky top bar: brand, navigation, repository link. */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--top);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.top .in {
  height: 100%;
  max-width: var(--page);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 var(--gap);
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 500 17px var(--sans);
  color: var(--muted);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.brand b {
  font-weight: 700;
  color: var(--ink);
}

.brand svg {
  width: 22px;
  height: 22px;
  color: var(--ink);
  flex: none;
}

.top nav {
  display: flex;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.top nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  white-space: nowrap;
  border-radius: 4px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.top nav a:hover, .top nav a[aria-current] {
  color: var(--ink);
  background: var(--sunken);
}

.top .tools {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 2px;
}

.top .tools a, .top .tools button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.top .tools a:hover, .top .tools button:hover {
  color: var(--ink);
  background: var(--sunken);
}

.top .tools svg {
  width: 20px;
  height: 20px;
}

/* On a phone the navigation leaves the bar and floats at the bottom. */
@media (max-width: 720px) {
  .top .in {
    display: flex;
  }
  .top .tools {
    margin-left: auto;
  }
  .top nav {
    position: fixed;
    z-index: 30;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    gap: 2px;
    padding: 5px;
    overflow: visible;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.28);
  }
  .top nav a {
    height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 14px;
  }
  .top nav a[aria-current] {
    background: var(--accent);
    color: var(--accent-ink);
  }
  body {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }
}

/* The install bar: three commands behind tabs, one visible at a time. */
.install {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px 8px 8px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.install h2 {
  margin: 0;
  flex: none;
}

.install .segmented {
  flex: none;
  width: 280px;
  height: 36px;
}

.install .get {
  flex: none;
}

.install .get svg {
  width: 15px;
  height: 15px;
}

.install .pane {
  display: none;
  flex: 1;
  min-width: 0;
}

.install:has(#t-plugin:checked) .pane.plugin,
.install:has(#t-curl:checked) .pane.curl,
.install:has(#t-id:checked) .pane.id,
.install:has(#t-link:checked) .pane.link {
  display: block;
}

.line {
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  overflow: hidden;
}

.line .note code {
  padding: 0;
  font-size: 12px;
}

.line > code {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  font: 13px/1.4 var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  align-self: center;
}

.line .note {
  flex: none;
  align-self: center;
  padding: 0 12px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.line button {
  flex: none;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--sunken);
  color: var(--ink);
  padding: 0 16px;
  font: 600 12px var(--sans);
  cursor: pointer;
}

.line button:hover {
  background: var(--line);
}

@media (max-width: 1100px) {
  .line .note {
    display: none;
  }
}

@media (max-width: 720px) {
  .install {
    flex-wrap: wrap;
    padding: 10px;
  }
  .install h2 {
    display: none;
  }
  .install .segmented {
    flex: 1 1 100%;
    width: auto;
  }
  .install .pane {
    flex: 1 1 100%;
  }
  .install .get {
    flex: 1 1 100%;
  }
}

/* The specimen preview: a window at the design width, scaled to fit. */
.window {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.window .bar {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 12px var(--mono);
}

.window .bar .id {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.window .dots {
  display: flex;
  gap: 6px;
  flex: none;
}

.window .dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

.window .bar .name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.window .bar a {
  grid-column: 3;
  justify-self: end;
  color: var(--muted);
  white-space: nowrap;
}

.stage {
  flex: 1;
  min-height: 420px;
  overflow: hidden;
  background: var(--sunken);
  display: flex;
  justify-content: center;
}

.stage iframe {
  border: 0;
  background: none;
  flex: none;
  width: 100%;
  height: 100%;
  transform-origin: top center;
}

/* Stacked under the install bar on narrow windows, the stage needs a height
   of its own: it must not grow with the frame it scales. */
@media (max-width: 960px) {
  .stage {
    flex: none;
    min-height: 0;
    height: min(72vw, 46dvh);
  }
}

/* There the window stays in view while the controls scroll under it. */
@media (max-width: 960px) and (min-height: 560px) {
  .window {
    position: sticky;
    top: calc(var(--top) + 8px);
    z-index: 6;
    box-shadow: 0 -12px 0 var(--bg), 0 10px 24px rgb(0 0 0 / 0.16);
  }
}

/* Desktop, tablet and phone: three small toggles in the window bar. */
.window .bar .devices {
  grid-column: 2;
  display: inline-flex;
  padding: 2px;
  border-radius: 5px;
  background: var(--sunken);
}

.devices button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.devices button:hover {
  color: var(--ink);
}

.devices button[aria-pressed="true"] {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
}

.devices svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 720px) {
  .window .bar .devices, .window .bar a .long {
    display: none;
  }
}

/* A span of years: two range inputs on one track. Only the handles take
   the pointer, so both can be reached. */
.range {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  max-width: 620px;
  padding: 0 6px;
}

.range .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.range output {
  flex: none;
  min-width: 96px;
  font: 13px var(--mono);
  font-variant-numeric: tabular-nums;
}

.range .track {
  position: relative;
  flex: 1;
  min-width: 120px;
  height: 42px;
}

.range .track::before, .range .fill {
  content: "";
  position: absolute;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
}

.range .track::before {
  left: 0;
  right: 0;
  background: var(--sunken);
}

.range .fill {
  background: var(--ink);
}

.range input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
}

.range input::-webkit-slider-runnable-track {
  height: 4px;
  background: none;
}

.range input::-moz-range-track {
  height: 4px;
  background: none;
}

.range input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--panel);
  cursor: grab;
}

.range input::-moz-range-thumb {
  pointer-events: auto;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--panel);
  cursor: grab;
}

.range input:focus-visible {
  outline: none;
}

.range input:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.range input:focus-visible::-moz-range-thumb {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.toolbar .count {
  margin-left: auto;
  padding: 0 8px;
  color: var(--muted);
  font: 12px/42px var(--mono);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.toolbar .btn.small {
  min-width: 0;
  height: 30px;
}

.cards > .card[hidden] {
  display: none;
}

/* On a phone: the years and the count in one row, the slider under them. */
@media (max-width: 720px) {
  .toolbar:has(.range) {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 2px 10px;
    padding: 12px 14px 8px;
  }
  .range {
    display: contents;
  }
  .range .label {
    display: none;
  }
  .range output {
    grid-area: 1 / 1;
    font-size: 12px;
    color: var(--muted);
  }
  .toolbar:has(.range) .btn.small {
    grid-area: 1 / 2;
    margin: 0;
  }
  .toolbar:has(.range) .count {
    grid-area: 1 / 3;
    margin: 0;
    padding: 0;
    line-height: 32px;
  }
  .toolbar:has(.range) .btn.small {
    min-height: 32px;
    height: 32px;
  }
  .range .track {
    grid-area: 2 / 1 / 3 / -1;
  }
}

/* Saved styles: cards drawn live from each style's specimen. */
.saved {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.saved .card {
  position: relative;
}

.saved .thumb.live {
  display: flex;
  justify-content: center;
  aspect-ratio: 16 / 10;
}

.saved .thumb.live iframe {
  flex: none;
  border: 0;
  background: none;
  transform-origin: top center;
  pointer-events: none;
}

/* The link covers the whole card, picture included. */
.saved .cover {
  display: grid;
  gap: 3px;
  padding: 12px 14px 14px;
  text-align: center;
  color: inherit;
  text-decoration: none;
}

.saved .cover::before {
  content: "";
  position: absolute;
  inset: 0;
}

.saved .cover .name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.saved .cover .id {
  font: 12px var(--mono);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved .card:hover {
  border-color: var(--muted);
}

.saved .heart {
  position: absolute;
  top: 8px;
  right: 8px;
}

.empty {
  padding: 48px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}

.empty p {
  margin: 0 0 14px;
}

/* On a phone: the count above, the filter across the full width. */
@media (max-width: 720px) {
  .toolbar:has(.cselect):has(.count) {
    display: grid;
    gap: 10px;
    padding: 12px 14px 14px;
  }
  .toolbar:has(.cselect):has(.count) .count {
    grid-row: 1;
    justify-self: end;
    margin: 0;
    padding: 0;
    line-height: 16px;
  }
}

/* Segmented control: radio buttons side by side. */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  background: var(--sunken);
  border-radius: 6px;
  height: 38px;
}

.segmented label {
  position: relative;
  padding: 0 12px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.segmented label:has(input:checked) {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
}

.segmented label:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* Custom select: a disclosure holding radio buttons. It opens, selects and
   submits without script; the script only closes it after a choice. */

/* A select never grows with what is chosen in it: long choices are cut. */
.cselect {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.cselect > summary {
  list-style: none;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  cursor: pointer;
  font-weight: 500;
  user-select: none;
}

.cselect > summary::-webkit-details-marker {
  display: none;
}

.cselect > summary:hover {
  border-color: var(--muted);
}

.cselect > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.12s;
  flex: none;
}

.cselect[open] > summary {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.cselect[open] > summary::after {
  transform: rotate(225deg);
  margin-top: 3px;
}

.cselect > summary .values {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* With several chosen the chips scroll sideways instead of being cut. */
.cselect.multi > summary .values {
  overflow-x: auto;
  text-overflow: clip;
  scrollbar-width: none;
  padding: 6px 0;
}

.cselect.multi > summary .values::-webkit-scrollbar {
  display: none;
}

.cselect > summary .value {
  display: none;
}

/* Several choices: each is a small chip, a number says how many, and the
   placeholder shows when there is none. */
.cselect.multi > summary .value {
  margin-right: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--sunken);
  font-size: 13px;
}

.cselect > summary .none {
  display: none;
  font-style: normal;
  color: var(--muted);
}

.cselect.multi:not(:has(.menu input:checked)) > summary .none {
  display: inline;
}

.cselect > summary .n {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 11px/20px var(--mono);
  text-align: center;
}

.cselect > summary .clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.cselect > summary .clear:hover {
  background: var(--sunken);
  color: var(--ink);
}

.cselect > summary .clear svg {
  width: 12px;
  height: 12px;
}

.cselect .menu .clear-all {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font: 600 12px var(--sans);
  text-align: left;
  cursor: pointer;
}

.cselect .menu .clear-all:hover {
  background: var(--sunken);
  color: var(--ink);
}

.cselect .menu {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.18);
}

.cselect .menu .filter {
  width: 100%;
  height: 32px;
  margin-bottom: 4px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  font: 13px var(--sans);
}

.cselect .menu .filter:focus {
  outline: 2px solid var(--focus);
  outline-offset: 0;
}

.cselect .menu label[hidden], .cselect .menu label.absent {
  display: none;
}

.cselect .menu label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 30px;
  border-radius: 4px;
  cursor: pointer;
}

.cselect .menu label:hover, .cselect .menu label:has(input:focus-visible) {
  background: var(--sunken);
}

.cselect .menu input[type="radio"], .cselect .menu input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.cselect .menu label:has(input:checked) {
  font-weight: 600;
}

.cselect .menu label:has(input:checked)::before {
  content: "✓";
  position: absolute;
  left: 10px;
  color: var(--accent);
}

.cselect .menu small {
  margin-left: auto;
  color: var(--muted);
  font: 11px var(--mono);
}

/* The summary shows the chosen option: the nth value for the nth checked
   radio, so it is right before any script runs. Up to 40 options. */
.cselect:has(.menu label:nth-of-type(1) input:checked) > summary .value:nth-of-type(2),
.cselect:has(.menu label:nth-of-type(2) input:checked) > summary .value:nth-of-type(3),
.cselect:has(.menu label:nth-of-type(3) input:checked) > summary .value:nth-of-type(4),
.cselect:has(.menu label:nth-of-type(4) input:checked) > summary .value:nth-of-type(5),
.cselect:has(.menu label:nth-of-type(5) input:checked) > summary .value:nth-of-type(6),
.cselect:has(.menu label:nth-of-type(6) input:checked) > summary .value:nth-of-type(7),
.cselect:has(.menu label:nth-of-type(7) input:checked) > summary .value:nth-of-type(8),
.cselect:has(.menu label:nth-of-type(8) input:checked) > summary .value:nth-of-type(9),
.cselect:has(.menu label:nth-of-type(9) input:checked) > summary .value:nth-of-type(10),
.cselect:has(.menu label:nth-of-type(10) input:checked) > summary .value:nth-of-type(11),
.cselect:has(.menu label:nth-of-type(11) input:checked) > summary .value:nth-of-type(12),
.cselect:has(.menu label:nth-of-type(12) input:checked) > summary .value:nth-of-type(13),
.cselect:has(.menu label:nth-of-type(13) input:checked) > summary .value:nth-of-type(14),
.cselect:has(.menu label:nth-of-type(14) input:checked) > summary .value:nth-of-type(15),
.cselect:has(.menu label:nth-of-type(15) input:checked) > summary .value:nth-of-type(16),
.cselect:has(.menu label:nth-of-type(16) input:checked) > summary .value:nth-of-type(17),
.cselect:has(.menu label:nth-of-type(17) input:checked) > summary .value:nth-of-type(18),
.cselect:has(.menu label:nth-of-type(18) input:checked) > summary .value:nth-of-type(19),
.cselect:has(.menu label:nth-of-type(19) input:checked) > summary .value:nth-of-type(20),
.cselect:has(.menu label:nth-of-type(20) input:checked) > summary .value:nth-of-type(21),
.cselect:has(.menu label:nth-of-type(21) input:checked) > summary .value:nth-of-type(22),
.cselect:has(.menu label:nth-of-type(22) input:checked) > summary .value:nth-of-type(23),
.cselect:has(.menu label:nth-of-type(23) input:checked) > summary .value:nth-of-type(24),
.cselect:has(.menu label:nth-of-type(24) input:checked) > summary .value:nth-of-type(25),
.cselect:has(.menu label:nth-of-type(25) input:checked) > summary .value:nth-of-type(26),
.cselect:has(.menu label:nth-of-type(26) input:checked) > summary .value:nth-of-type(27),
.cselect:has(.menu label:nth-of-type(27) input:checked) > summary .value:nth-of-type(28),
.cselect:has(.menu label:nth-of-type(28) input:checked) > summary .value:nth-of-type(29),
.cselect:has(.menu label:nth-of-type(29) input:checked) > summary .value:nth-of-type(30),
.cselect:has(.menu label:nth-of-type(30) input:checked) > summary .value:nth-of-type(31),
.cselect:has(.menu label:nth-of-type(31) input:checked) > summary .value:nth-of-type(32),
.cselect:has(.menu label:nth-of-type(32) input:checked) > summary .value:nth-of-type(33),
.cselect:has(.menu label:nth-of-type(33) input:checked) > summary .value:nth-of-type(34),
.cselect:has(.menu label:nth-of-type(34) input:checked) > summary .value:nth-of-type(35),
.cselect:has(.menu label:nth-of-type(35) input:checked) > summary .value:nth-of-type(36),
.cselect:has(.menu label:nth-of-type(36) input:checked) > summary .value:nth-of-type(37),
.cselect:has(.menu label:nth-of-type(37) input:checked) > summary .value:nth-of-type(38),
.cselect:has(.menu label:nth-of-type(38) input:checked) > summary .value:nth-of-type(39),
.cselect:has(.menu label:nth-of-type(39) input:checked) > summary .value:nth-of-type(40),
.cselect:has(.menu label:nth-of-type(40) input:checked) > summary .value:nth-of-type(41) {
  display: inline;
}

/* Skeletons: where a picture or a specimen is still loading, its place
   shows a slow grey shimmer. What loads paints over it. */
.thumb, .trio a, .stage {
  background: linear-gradient(100deg, var(--sunken) 30%, var(--line) 50%, var(--sunken) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.6s linear infinite;
}

.thumb.mosaic {
  background: var(--line);
  animation: none;
}

.thumb.mosaic img {
  background: var(--sunken);
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -50% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thumb, .trio a, .stage {
    animation: none;
  }
}

/* The saved page draws its cards with script; until then three empty cards
   hold their place. */
.saved-wait {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.saved-wait i {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.saved-wait i::before {
  content: "";
  display: block;
  aspect-ratio: 16 / 10;
  background: linear-gradient(100deg, var(--sunken) 30%, var(--line) 50%, var(--sunken) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.6s linear infinite;
}

.saved-wait i::after {
  content: "";
  display: block;
  height: 62px;
}

@media (scripting: none) {
  .saved-wait {
    display: none;
  }
}

/* The side panel of the style page. */
.sub {
  color: var(--muted);
  margin-top: 3px;
}

.crumbs {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

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

.parts {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.part {
  display: grid;
  grid-template-columns: 1fr auto auto;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.part:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.part .label {
  font-weight: 600;
}

.part .label small {
  font: 12px var(--mono);
  color: var(--muted);
  font-weight: 400;
  margin-left: 6px;
}

.keep {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  user-select: none;
}

.keep:hover {
  border-color: var(--muted);
}

.keep input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.keep::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}

.keep .on {
  display: none;
}

.keep:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.keep:has(input:checked)::before {
  background: currentColor;
}

.keep:has(input:checked) .on {
  display: inline;
}

.keep:has(input:checked) .off {
  display: none;
}

.keep:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.switch + .switch {
  margin-top: -6px;
}

.switch > .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.switch .cselect {
  flex: 1;
  min-width: 0;
}

.switch .btn {
  height: 38px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

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

.title .heart {
  margin-left: auto;
}

/* What the era is, as a tooltip on its name. It spans the panel, so it
   cannot reach past the edge of the screen. */
.title {
  position: relative;
}

.title h1 {
  cursor: help;
}

.title .tip {
  position: absolute;
  z-index: 15;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.18);
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.12s;
}

.title h1:hover + .tip, .title h1:focus-visible + .tip {
  visibility: visible;
  opacity: 1;
}

/* Previous and next: two joined round-ended buttons. */
.stepper {
  display: inline-flex;
}

.step {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.step:first-child {
  border-radius: 14px 0 0 14px;
  padding-left: 2px;
}

.step:last-child {
  border-radius: 0 14px 14px 0;
  margin-left: -1px;
  padding-right: 2px;
}

.step:hover {
  border-color: var(--muted);
  position: relative;
}

.step svg {
  width: 14px;
  height: 14px;
}

.step[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}

.part .stepper {
  grid-column: 3;
}

/* Regenerate's form: the eras and page types it picks among, then the parts. */
.regen {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.regen > .box {
  margin-top: 6px;
}

.hint.keys {
  margin-top: 8px;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  font: 11px var(--mono);
  text-align: center;
}

@media (pointer: coarse) {
  .hint.keys {
    display: none;
  }
}

/* The options bar on the home page. */
.toolbar {
  position: sticky;
  top: calc(var(--top) + 10px);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 28px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.08);
}

.toolbar .cselect {
  flex: none;
  width: 320px;
}

.toolbar .totals {
  margin-left: auto;
  padding-right: 8px;
  color: var(--muted);
  font: 12px/42px var(--mono);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.toolbar .btn {
  min-width: 180px;
  height: 42px;
}

.toolbar .cselect > summary {
  height: 42px;
}

@media (max-width: 1080px) {
  .toolbar .totals {
    display: none;
  }
  .toolbar .btn {
    margin-left: auto;
  }
}

@media (max-width: 720px) {
  .toolbar {
    position: relative;
    top: auto;
    padding: 12px;
  }
  .toolbar .cselect {
    flex: 1 1 100%;
  }
  .toolbar .btn {
    flex: 1 1 100%;
  }
}

/* Phones and other touch screens: every control is large enough for a
   finger, 44px or close to it. */
@media (max-width: 720px), (pointer: coarse) {
  .btn {
    min-height: 44px;
  }
  .btn.small {
    min-height: 40px;
    padding: 0 14px;
    font-size: 13px;
  }
  .cselect > summary {
    height: 48px;
    font-size: 15px;
  }
  .cselect .menu label {
    min-height: 46px;
    font-size: 15px;
  }
  .cselect .menu .filter {
    height: 42px;
    font-size: 16px;
  }
  .segmented {
    height: 46px;
  }
  .part {
    min-height: 56px;
    gap: 8px;
    padding: 6px 8px 6px 10px;
  }
  .part .label {
    white-space: nowrap;
  }
  .part .label small {
    margin-left: 3px;
  }
  .keep {
    height: 42px;
    padding: 0 10px;
    font-size: 13px;
  }
  .step {
    width: 42px;
    height: 42px;
  }
  .step:first-child {
    border-radius: 21px 0 0 21px;
  }
  .step:last-child {
    border-radius: 0 21px 21px 0;
  }
  .step svg {
    width: 16px;
    height: 16px;
  }
  .heart {
    width: 44px;
    height: 44px;
  }
  .top .tools a, .top .tools button {
    width: 44px;
    height: 44px;
  }
  .line {
    min-height: 46px;
  }
  .line button {
    padding: 0 18px;
    font-size: 13px;
  }
  .window .bar {
    height: 48px;
  }
  .window .bar a {
    padding: 12px 0;
  }
  .range .track {
    height: 46px;
  }
  .range input::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
    margin-top: -11px;
  }
  .range input::-moz-range-thumb {
    width: 26px;
    height: 26px;
  }
  .card .foot .btn {
    height: 44px;
  }
}

