:root {
  color-scheme: light dark;
  --page: light-dark(#fdfdfc, #181a1c);
  --text: light-dark(#272a2d, #e1e3e6);
  --border: light-dark(#dbdddf, #42464b);
  --code: light-dark(#f4f5f6, #202428);
  --link: light-dark(#205b8d, #9ac9f4);
  --code-muted: light-dark(#56616d, #b4bec8);
  --code-keyword: light-dark(#692ca0, #dfb8fd);
  --code-symbol: light-dark(#125b80, #a4d4fa);
  --code-literal: light-dark(#326133, #b6dfaa);
  scroll-padding-top: 6rem;
}

body {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1rem;
  background: var(--page);
  color: var(--text);
  font: 1rem/1.6 system-ui, sans-serif;
}

header, footer {
  padding: .75rem 0;
}

header {
  position: sticky;
  z-index: 1;
  top: 0;
  background: var(--page);
  border-bottom: 1px solid var(--border);
}

footer {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
}

a {
  color: var(--link);
  text-underline-offset: .14em;
}

h1, h2 {
  line-height: 1.15;
}

h2 {
  margin-top: 1.6em;
}

.example {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .75rem;
  align-items: start;
}

.example pre {
  margin: 0;
  font-size: .875rem;
}

.c-source {
  max-height: 25rem;
  overflow: auto;
}

.c-source {
  counter-reset: code-line;
  tab-size: 4;
  line-height: 1.55;
}

.c-source code {
  white-space: pre;
}

.c-canvas-view {
  position: relative;
  overflow: hidden;
  background: #1d2431;
  border: 1px solid var(--border);
  border-radius: .25rem;
}

.c-canvas-view canvas {
  display: block;
  width: 100%;
  max-height: 25rem;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: text;
  touch-action: pan-y pinch-zoom;
}

/* The visible bar is rendered by RMGui. Only this hit lane opts out of
   vertical page panning, so a touch can drag the vertical thumb. */
.c-vertical-hit {
  position: absolute;
  inset: 0 0 0 auto;
  touch-action: none;
}

.c-copy-menu {
  position: fixed;
  z-index: 2;
  inset: 0 auto auto 0;
  margin: 0;
  padding: .2rem;
  background: var(--page);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: .25rem;
}

.c-copy-menu button {
  display: block;
  padding: .3rem .7rem;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.c-copy-buffer {
  position: fixed;
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.c-copy-menu button:hover,
.c-copy-menu button:focus-visible {
  background: var(--code);
}

/* Leave the original text available to assistive technology. */
.c-source.c-canvas-source {
  position: absolute;
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  pointer-events: none;
}

.c-line {
  counter-increment: code-line;
}

.c-line::before {
  content: counter(code-line);
  display: inline-block;
  width: 2ch;
  padding-right: 1ch;
  margin-right: 1ch;
  border-right: 1px solid var(--border);
  color: var(--code-muted);
  text-align: right;
  user-select: none;
}

.c-keyword { color: var(--code-keyword); }
.c-symbol { color: var(--code-symbol); }
.c-literal { color: var(--code-literal); }
.c-comment { color: var(--code-muted); }

@media (min-width: 56rem) {
  .example {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  }
}

p, li {
  max-width: 72ch;
}

pre {
  overflow-x: auto;
  padding: .65rem;
  background: var(--code);
  border: 1px solid var(--border);
  border-radius: .25rem;
}

.specimen {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: .25rem;
}

.reward-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  touch-action: manipulation;
}

.reward-canvas:focus-visible,
.specimen:focus-visible {
  outline: 2px solid Highlight;
  outline-offset: 3px;
}

.specimen[data-specimen="button"] {
  touch-action: manipulation;
}

.specimen[data-specimen="slider"],
.specimen[data-specimen="rich-text"] {
  touch-action: pan-y;
}

.specimen[data-specimen="rich-text"] {
  cursor: text;
}

.specimen.link-hover {
  cursor: pointer;
}

.reward-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
}

.reward-stats {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .25rem 1rem;
}

.reward-stats dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
