/* wafers — "waferworks 2001, matte edition"
   a periwinkle homage to the flat, lowercase, nerdy-personal-blog web of
   2001-2003: sharp corners, one-pixel borders, flat solid colors, dotted
   accents, hard offset shadows for depth — no gradients, no gloss. hover
   is a plain palette swap, the way it was in the day. */

:root {
  --peri-050: #f6f7fe;
  --peri-100: #eceefc;
  --peri-150: #dde2f9;
  --peri-200: #c9d1f6;
  --peri-300: #aab6ef;
  --peri-400: #8d9de9;
  --peri-500: #4352a5;
  --peri-600: #5b6bc8;
  --peri-700: #47539f;
  --peri-800: #3f4a93;
  --peri-900: #2c3260;
  --ink: #232742;
  --ink-strong: #171b33;
  --muted: #565d8a;
  --paper: #fcfbfa;
  --danger: #a83446;
  --danger-deep: #852233;
  --danger-wash: #f8e8eb;
  --sand-050: #fbf9f4;
  --sand-100: #f5eedc;
  --sand-200: #eee3c8;
  --sand-300: #dfcfab;
  --sand-400: #c4b184;
  --sand-700: #5c4e33;
  --paper-text: #f6f7fe;
  --lcd: #c9d1f6;
  --lcd-dim: #aab6ef;
  --heading: #374288;
  --link: #47539f;
  --link-hover: #232852;
  --status-ink: #2c3260;
  --strip-a: #47539f;
  --strip-b: #3f4a93;
  --accent-warm: #a6501e;
  --accent-amber: #cf7334;
  --accent-sage: #386b4a;
  --font: verdana, geneva, tahoma, sans-serif;
  --mono: "courier new", courier, monospace;
  --alarm: #ff93a4;
  --led: #386b4a;
  --ease-settle: cubic-bezier(0.2, 0.7, 0.3, 1);
  --ease-spring: linear(
    0, 0.186 2.1%, 0.529 4.3%, 0.987 7%, 1.092 8.4%, 1.127 9.8%,
    1.096 11.4%, 1.019 13.5%, 0.981 15.1%, 0.973 17%, 0.998 19.4%,
    1.004 21.9%, 0.996 25.4%, 1
  );
  --ease-pop: linear(0, 0.28 8%, 0.72 16%, 1.06 24%, 1.12 30%, 1.09 36%, 1.01 46%, 0.985 54%, 1);
}

* {
  box-sizing: border-box;
  border-radius: 0 !important;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font);
  font-size: 11pt;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(71, 83, 159, 0.085) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(rgba(71, 83, 159, 0.05) 1px, transparent 1px) 0 0 / 22px 66px,
    var(--peri-100);
  font-family: var(--font);
  line-height: 1.55;
  text-transform: lowercase;
  overflow-x: clip;
}

body,
button,
input,
output,
select,
textarea,
code {
  font-family: var(--font);
}

button,
input,
select,
textarea {
  font-size: 1rem;
}

button,
a,
input,
canvas {
  -webkit-tap-highlight-color: transparent;
}

::selection {
  color: var(--ink-strong);
  background: var(--peri-300);
}

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

a:hover {
  color: var(--link-hover);
  background: var(--peri-150);
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.1;
  color: var(--heading);
  font-weight: bold;
}

h1 {
  margin-bottom: 0.55rem;
  font-size: clamp(2.05rem, 5.5vw, 4.2rem);
  letter-spacing: -0.03em;
}

h2 {
  margin-bottom: 0.7rem;
  font-size: 1.4rem;
}

strong {
  font-weight: bold;
}

code {
  display: block;
  padding: 0.5rem 0.65rem;
  overflow-wrap: anywhere;
  color: var(--lcd);
  background: var(--peri-900);
  border: 1px solid var(--peri-900);
  font-family: var(--mono);
  font-weight: bold;
  letter-spacing: 0.08em;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: -100px;
  left: -100px;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--paper);
  background: var(--peri-900);
  outline: 1px solid var(--paper);
  overflow: hidden;
  white-space: nowrap;
}

.skip-link:focus {
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  min-height: 44px;
  min-width: 44px;
  padding: 0.65rem 0.9rem;
  overflow: visible;
  white-space: normal;
}

/* the page is one big beveled window sitting on the grid paper */

.site-shell {
  display: flex;
  flex-direction: column;
  width: min(100% - 32px, 1240px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--peri-900);
  box-shadow:
    inset 0 0 0 1px var(--paper),
    inset 0 0 0 2px var(--peri-200),
    10px 12px 0 rgba(71, 83, 159, 0.18);
}

.site-shell.wide {
  width: min(100% - 32px, 1240px);
}

.site-shell.wide .page-heading {
  max-width: none;
}

.site-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 108px;
  color: var(--paper);
  background: var(--peri-700);
  border-bottom: 1px solid var(--peri-900);
}

/* the artist palette runs under the titlebar like a strip of paint chips */

.paint-chip {
  position: relative;
  display: flex;
  height: 4px;
  background: var(--peri-900);
}

.paint-chip i {
  flex: 1;
}

.paint-chip i:nth-child(1) { background: #262b4a; }
.paint-chip i:nth-child(2) { background: #47539f; }
.paint-chip i:nth-child(3) { background: #7484dd; }
.paint-chip i:nth-child(4) { background: #c9d1f6; }
.paint-chip i:nth-child(5) { background: #266a78; }
.paint-chip i:nth-child(6) { background: #4f7a57; }
.paint-chip i:nth-child(7) { background: #a49a45; }
.paint-chip i:nth-child(8) { background: #d37b43; }
.paint-chip i:nth-child(9) { background: #a9484f; }
.paint-chip i:nth-child(10) { background: #8e4f76; }
.paint-chip i:nth-child(11) { background: #5d463b; }
.paint-chip i:nth-child(12) { background: #151515; }
.paint-chip i:nth-child(13) { background: #6f6b64; }
.paint-chip i:nth-child(14) { background: #c9c2b3; }
.paint-chip i:nth-child(15) { background: #f0e8d4; }
.paint-chip i:nth-child(16) { background: #fffdf6; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 260px;
  padding: 1.05rem 1.4rem;
  color: var(--paper-text);
  text-decoration: none;
}

.brand:hover {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.07);
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-copy strong {
  color: var(--paper-text);
  font-size: 2.1rem;
  font-weight: bold;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.brand-copy small {
  margin-top: 0.42rem;
  color: var(--paper-text);
  font-size: 0.74rem;
  font-weight: bold;
  letter-spacing: 0.05em;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 18px);
  grid-template-rows: repeat(2, 18px);
  width: 40px;
  height: 40px;
  padding: 1px;
  background: var(--paper);
  border: 1px solid var(--peri-900);
  gap: 1px;
}

.brand-mark i:nth-child(1),
.brand-mark i:nth-child(4) {
  background: var(--peri-500);
}

.brand-mark i:nth-child(2),
.brand-mark i:nth-child(3) {
  background: var(--peri-900);
}

.brand-image {
  width: auto;
  max-width: 124px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
}

/* navigation sits on the titlebar like a row of folder tabs */

.site-header nav {
  display: flex;
  align-items: flex-end;
  margin-left: auto;
  padding: 0;
}

.site-header .nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header .nav-links li {
  display: flex;
}

.site-header nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  margin-bottom: -1px;
  padding: 0.45rem 1rem 0.5rem;
  color: var(--ink-strong);
  background: var(--peri-300);
  border: 1px solid var(--peri-900);
  border-bottom-color: var(--peri-900);
  font-size: 0.82rem;
  font-weight: bold;
  letter-spacing: 0.03em;
  text-decoration: none;
}

/* the 2002 way: hover is nothing but a palette swap, instantly */

.site-header nav a:hover {
  color: var(--ink-strong);
  background: var(--peri-200);
}

.site-header nav a.selected {
  position: relative;
  z-index: 1;
  color: var(--ink-strong);
  background: var(--paper);
  border-bottom-color: var(--paper);
}

/* the lights switch lives in the tab row, dashed to read as a control */

.site-header .theme-item {
  display: flex;
  align-items: flex-end;
  margin-left: 0.5rem;
}

.site-header .theme-item form {
  display: flex;
  height: auto;
}

.site-header .theme-item button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  min-width: 44px;
  margin-bottom: -1px;
  padding: 0.45rem 0.85rem 0.5rem;
  color: var(--ink-strong);
  background: var(--peri-150);
  border: 1px dashed var(--peri-900);
  border-bottom-color: var(--peri-900);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: bold;
  letter-spacing: 0.03em;
}

.site-header .theme-item button:hover {
  color: var(--peri-900);
  background: var(--peri-200);
}

main {
  flex: 1;
  padding: clamp(1.5rem, 5vw, 3.4rem);
}

.page-grid {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 2.25fr) minmax(220px, 0.8fr);
}

.page-grid main {
  flex: none;
}

.page-grid aside {
  padding: 2.2rem 1.35rem;
  background: var(--sand-100);
  border-left: 1px solid var(--peri-900);
  box-shadow: inset 1px 0 0 var(--paper);
}

.side-block {
  margin-bottom: 2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px dotted var(--sand-400);
}

.side-block:last-child {
  border-bottom: 0;
}

.side-block h2 {
  margin: -0.45rem -0.45rem 0.85rem;
  padding: 0.32rem 0.55rem;
  color: var(--paper-text);
  background: var(--strip-a);
  border: 1px solid var(--peri-900);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

.side-block p {
  color: var(--sand-700);
  font-size: 0.86rem;
}

.tally {
  margin: 0;
}

.tally div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.43rem 0;
  border-bottom: 1px dotted var(--sand-400);
}

.tally div:last-child {
  border-bottom: 0;
}

.tally dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.tally dd {
  margin: 0;
  color: var(--heading);
  font-size: 1.45rem;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

.intro {
  max-width: 700px;
  padding-bottom: 3.4rem;
}

.kicker {
  display: inline-block;
  margin-bottom: 0.7rem;
  padding: 0.22rem 0.65rem;
  color: #ffffff;
  background: var(--accent-warm);
  border: 1px solid var(--peri-900);
  box-shadow: 2px 2px 0 var(--peri-900);
  font-size: 0.74rem;
  font-weight: bold;
  letter-spacing: 0.09em;
}

.lede {
  max-width: 640px;
  margin: 1.3rem 0 1.8rem;
  color: var(--ink);
  font-size: 1.08rem;
}

.actions,
.submission-actions,
.review-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem;
}

/* beveled buttons: raised at rest, sunken while pressed */

.button,
button.button,
.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.9rem;
  color: var(--ink-strong);
  background: var(--peri-200);
  border: 1px solid var(--peri-700);
  cursor: pointer;
  font-weight: bold;
  line-height: 1.25;
  text-decoration: none;
}

.button:hover,
.tool-button:hover {
  color: var(--ink-strong);
  background: var(--peri-300);
}

.button:active,
.tool-button:active {
  background: var(--peri-400);
  transform: translate(1px, 1px);
}

.button.primary,
button.primary {
  color: var(--paper);
  background: var(--peri-600);
  border-color: var(--peri-900);
  box-shadow: 2px 2px 0 var(--peri-200);
}

.button.primary:hover,
button.primary:hover {
  color: var(--paper);
  background: var(--peri-700);
}

.button.primary:active,
button.primary:active {
  background: var(--peri-700);
  transform: translate(1px, 1px);
}

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

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

.button.danger:active {
  color: var(--paper);
  background: var(--danger-deep);
  transform: translate(1px, 1px);
}

.button:disabled,
button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.5);
  opacity: 0.55;
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.35rem 0.5rem;
  color: var(--link);
  font-size: 0.92rem;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.text-link:hover {
  color: var(--link-hover);
  background: none;
  text-decoration-style: solid;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.35rem 0.55rem;
  color: var(--link);
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 0.92rem;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.link-button:hover {
  color: var(--link-hover);
  background: none;
  text-decoration-style: solid;
}

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

.link-button.danger-link:hover {
  color: var(--danger-deep);
}

.rule-section {
  max-width: 720px;
  margin-top: 2.2rem;
}

.rule-section > h2 {
  display: block;
  margin: 0 0 0.95rem;
  padding: 0.35rem 0.7rem;
  color: var(--paper-text);
  background: var(--strip-a);
  border: 1px solid var(--peri-900);
  font-size: 1.12rem;
  letter-spacing: 0.04em;
}

.page-heading {
  max-width: 720px;
  margin-bottom: 2.8rem;
  padding-bottom: 1.3rem;
  border-bottom: 1px solid var(--peri-900);
  box-shadow: 0 3px 0 -1px var(--peri-300);
}

.page-heading h1 {
  font-size: clamp(2.3rem, 5.5vw, 4rem);
}

.page-heading p:last-child {
  max-width: 620px;
  color: var(--muted);
}

.numbered-rules ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rules;
}

.numbered-rules li {
  position: relative;
  min-height: 3.5rem;
  padding: 0.7rem 0 0.9rem 3.4rem;
  border-bottom: 1px dotted var(--peri-300);
  counter-increment: rules;
}

.numbered-rules li::before {
  position: absolute;
  top: 0.65rem;
  left: 0;
  width: 2.3rem;
  padding: 0.22rem 0;
  color: #ffffff;
  background: var(--peri-600);
  border: 1px solid var(--peri-900);
  box-shadow: 2px 2px 0 var(--peri-200);
  content: counter(rules);
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.gallery-grid + p {
  margin-top: 1.2rem;
}

.rule-section.sand-block {
  padding: 0 1.2rem 1.2rem;
  background: var(--sand-100);
  border: 1px solid var(--sand-400);
}

.rule-section.sand-block p {
  color: var(--sand-700);
}

.comic-card {
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--peri-900);
  box-shadow:
    inset 0 0 0 1px var(--paper),
    inset 0 0 0 2px var(--peri-200),
    5px 5px 0 rgba(91, 107, 200, 0.35);
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.comic-card:hover,
.comic-card:focus-visible {
  color: var(--ink);
  background: var(--paper);
  transform: translate(-2px, -2px);
  box-shadow:
    inset 0 0 0 1px var(--paper),
    inset 0 0 0 2px var(--peri-300),
    8px 8px 0 rgba(91, 107, 200, 0.42);
}

.filmstrip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 2px;
  background: var(--paper);
  border-bottom: 1px solid var(--peri-900);
}

.filmstrip img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--peri-100);
}

.comic-card-title {
  display: block;
  padding: 0.6rem 0.75rem 0.2rem;
  color: var(--link);
  background: var(--peri-050);
  font-size: 0.9rem;
  font-weight: bold;
  line-height: 1.3;
}

.comic-card-meta {
  display: block;
  padding: 0 0.75rem 0.65rem;
  color: var(--muted);
  background: var(--peri-050);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
}

.comic-card:hover .comic-card-title {
  color: var(--link-hover);
  text-decoration: underline;
}

.empty-state {
  max-width: 600px;
  padding: 2rem;
  background: var(--sand-100);
  border: 1px solid var(--sand-400);
}

/* dialogs: double-framed windows with a hard drop shadow, centered in the frame */

main:has(> .gate-card),
main:has(> .wait-card) {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.gate-card,
.wait-card {
  position: relative;
  max-width: 660px;
  margin: 1rem auto;
  padding: clamp(1.4rem, 5vw, 3.2rem);
  background: var(--paper);
  border: 2px solid var(--peri-900);
  box-shadow:
    inset 0 0 0 1px var(--paper),
    inset 0 0 0 2px var(--peri-200),
    inset 0 6px 0 -3px var(--peri-300),
    8px 10px 0 rgba(71, 83, 159, 0.28);
}

.gate-card h1,
.wait-card h1 {
  font-size: clamp(2.1rem, 6vw, 3.8rem);
}

.stack-form {
  display: grid;
  gap: 0.55rem;
  margin-top: 1.7rem;
}

.stack-form .button {
  justify-self: start;
  margin-top: 0.5rem;
}

.stack-form small {
  color: var(--muted);
  font-size: 0.76rem;
}

label,
legend {
  color: var(--heading);
  font-size: 0.86rem;
  font-weight: bold;
}

/* sunken fields, in the tradition of every 2001 form */

input[type="text"],
input[type="password"],
input:not([type]) {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.62rem;
  color: var(--ink-strong);
  background: var(--paper);
  border: 1px solid var(--peri-700);
}

input:focus {
  border-color: var(--peri-900);
  outline: 2px dotted var(--peri-600);
  outline-offset: 1px;
}

button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 2px dotted var(--peri-900);
  outline-offset: 2px;
}

input:user-invalid,
input.invalid {
  background: var(--danger-wash);
  border-color: var(--danger);
  outline: 1px dotted var(--danger);
  outline-offset: 1px;
}

.quiet-form {
  margin-top: 1.5rem;
}

.form-error {
  min-height: 1.4rem;
  margin: 0.8rem 0;
  color: var(--danger);
  font-weight: bold;
}

.notice {
  max-width: 860px;
  margin: 0 auto 2rem;
  padding: 0.9rem 1rem;
  background: var(--peri-100);
  border: 1px solid var(--peri-700);
  box-shadow:
    inset 0 0 0 1px var(--paper),
    inset 0 0 0 2px var(--peri-200),
    inset 4px 0 0 var(--peri-500);
}

.comic-heading {
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

.comic-strip {
  display: grid;
  justify-content: center;
  gap: 2.7rem;
}

/* panels settle into place as they scroll in; browsers without scroll-driven
   timelines simply show them, which is a fine way to read a comic */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) and (animation-range: entry) {
    .comic-strip .comic-panel {
      animation: panel-develop linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 55%;
    }

    @keyframes panel-develop {
      from {
        transform: translateY(16px);
        opacity: 0.2;
      }
    }
  }
}

.comic-panel {
  width: min(500px, 100%);
  margin: 0;
}

.comic-panel img,
.review-panel img {
  width: 100%;
  height: auto;
  background: var(--paper);
  border: 1px solid var(--peri-900);
  box-shadow:
    inset 0 0 0 1px var(--paper),
    0 0 0 1px var(--peri-300),
    5px 5px 0 rgba(91, 107, 200, 0.3);
}

.comic-panel figcaption,
.review-panel figcaption {
  padding: 0.52rem 0.15rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.comic-panel figcaption::before,
.review-panel figcaption::before {
  content: "· ";
  color: var(--peri-500);
}

/* reading position: a sticky row of ten little squares */

.panel-tracker {
  position: sticky;
  z-index: 6;
  top: 0;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  max-width: 440px;
  gap: 4px;
  margin: 0 auto 1.5rem;
  padding: 8px 12px;
  background: var(--paper);
  border: 1px solid var(--peri-900);
  box-shadow: 2px 2px 0 var(--peri-200);
}

.panel-tracker i {
  aspect-ratio: 1;
  background: var(--peri-100);
  border: 1px solid var(--peri-300);
}

.panel-tracker i.current {
  background: var(--peri-700);
  border-color: var(--peri-900);
}

@media (max-width: 760px) {
  .panel-tracker {
    max-width: none;
    margin: -1.4rem -1.4rem 1.4rem;
    padding: 7px 10px;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: 0 2px 0 rgba(71, 83, 159, 0.16);
  }
}

/* the reveal moment: a freshly sent panel deserves confetti made of squares */

.thanks-card {
  position: relative;
  overflow: hidden;
}

.pixel-confetti {
  position: absolute;
  top: -14px;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .pixel-confetti {
    animation: confetti-fall 1.9s steps(7, end) forwards;
  }

  @keyframes confetti-fall {
    from {
      transform: translateY(0);
      opacity: 1;
    }

    85% {
      opacity: 1;
    }

    to {
      transform: translateY(300px);
      opacity: 0;
    }
  }
}

.back-link {
  margin: 3rem auto 0;
  text-align: center;
}

/* the drawing desk */

.draw-app {
  max-width: 1120px;
  margin: 0 auto;
}

.draw-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--peri-900);
  box-shadow: 0 3px 0 -1px var(--peri-300);
}

.draw-heading h1 {
  margin: 0;
  font-size: clamp(2.15rem, 5.5vw, 3.8rem);
}

/* the countdown reads like a little lcd panel */

.timer-box {
  position: relative;
  min-width: 190px;
  padding: 0.6rem 0.8rem 0.7rem;
  overflow: hidden;
  color: var(--peri-200);
  background: var(--peri-900);
  border: 1px solid var(--peri-900);
  box-shadow: 2px 2px 0 var(--peri-200);
  text-align: right;
}

/* faint scanlines, like any respectable lcd of the era */
.timer-box::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(29, 34, 64, 0.22) 0 1px,
    transparent 1px 3px
  );
}

.timer-box > span {
  display: block;
  color: var(--lcd-dim);
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.09em;
}

.timer-box strong {
  display: block;
  min-height: 2rem;
  color: var(--lcd);
  font-size: 1.8rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.timer-box small {
  display: block;
  margin-top: 0.3rem;
  color: var(--lcd-dim);
  font-size: 0.64rem;
  line-height: 1.35;
}

/* final minute: the lcd shifts to alarm red and blinks, hard */
.timer-box.low strong {
  color: var(--alarm);
}

.timer-box.low {
  border-color: var(--alarm);
  box-shadow: 2px 2px 0 var(--alarm);
}

.timer-box.up strong {
  color: var(--alarm);
}

.timer-box.up {
  border-color: var(--alarm);
}

@media (prefers-reduced-motion: no-preference) {
  .timer-box.low strong,
  .timer-box.up strong {
    animation: lcd-blink 1s steps(2, jump-none) infinite;
  }

  @keyframes lcd-blink {
    50% {
      opacity: 0.5;
    }
  }

  .timer-extension {
    animation: lcd-in 0.4s var(--ease-pop) backwards;
  }

  @keyframes lcd-in {
    from {
      transform: translateY(4px);
      opacity: 0;
    }
  }
}

.timer-extension {
  padding: 0;
  color: var(--lcd-dim);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: bold;
  text-decoration: underline dotted;
  text-underline-offset: 0.22em;
}

.timer-extension:hover {
  color: var(--paper);
  background: none;
  text-decoration-style: solid;
}

.draw-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 500px));
  align-items: start;
  justify-content: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
}

.panel-column {
  min-width: 0;
}

.panel-column > header {
  display: flex;
  align-items: center;
  min-height: 3.25rem;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid var(--peri-700);
}

.panel-column > header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.section-number {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  margin-right: 0.65rem;
  place-items: center;
  color: #ffffff;
  background: var(--peri-600);
  border: 1px solid var(--peri-900);
  box-shadow: 2px 2px 0 var(--peri-200);
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

.previous-panel,
.canvas-frame {
  width: 100%;
  aspect-ratio: 1;
  background: var(--paper);
  border: 1px solid var(--peri-900);
  box-shadow:
    0 0 0 1px var(--paper),
    0 0 0 2px var(--peri-300),
    5px 5px 0 rgba(91, 107, 200, 0.3);
}

.canvas-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.canvas-frame canvas.erasing {
  cursor: cell;
}

/* the brush preview ring: shows the true size of the mark you are about to make */

.brush-cursor {
  position: absolute;
  top: 0;
  left: 0;
  translate: -50% -50%;
  pointer-events: none;
  border: 1px solid var(--peri-900);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.85);
}

.brush-cursor::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  content: "";
  background: var(--peri-900);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
  translate: -50% -50%;
}

.brush-cursor.erasing {
  border-style: dashed;
}

.handoff {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--sand-200);
  border: 1px solid var(--sand-400);
}

.handoff p {
  margin-bottom: 0.35rem;
  color: var(--sand-700);
  font-size: 0.78rem;
}

.handoff ol {
  margin: 0;
  padding-left: 1.3rem;
}

.handoff li {
  margin-bottom: 0.15rem;
  font-weight: bold;
}

.blank-message {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  padding: 3rem;
  place-content: center;
  background:
    linear-gradient(90deg, transparent 49.7%, var(--peri-200) 50%, transparent 50.3%),
    linear-gradient(transparent 49.7%, var(--peri-200) 50%, transparent 50.3%),
    var(--peri-050);
  border: 1px solid var(--peri-300);
  text-align: center;
}

.blank-message p:first-child {
  color: var(--peri-700);
  font-size: 1.7rem;
  font-weight: bold;
}

.blank-message p:last-child {
  color: var(--muted);
  font-size: 0.92rem;
}

.tools {
  margin-top: 0;
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.85rem;
  background: var(--peri-050);
  border: 1px solid var(--peri-700);
  box-shadow: inset 0 0 0 1px var(--paper), inset 0 0 0 2px var(--peri-200);
}

.tool-kbd {
  display: inline-block;
  margin-left: 0.2rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  opacity: 0.75;
}

.desk-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.leave-desk-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.35rem 0.65rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: underline dotted;
}

.leave-desk-btn:hover {
  color: var(--danger);
  background: var(--danger-wash);
}

.previous-panel-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--peri-050);
  border: 1px solid var(--peri-300);
}

.previous-panel-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.previous-panel-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem;
  background: var(--sand-100);
  border: 1px dashed var(--peri-400);
  text-align: center;
}

.previous-panel-fallback p {
  margin: 0;
  color: var(--sand-700);
  font-size: 0.9rem;
}

.rescue-box {
  padding: 1rem 1.2rem;
  margin-top: 1rem;
  background: var(--sand-100);
  border: 1px solid var(--sand-400);
  box-shadow: 2px 2px 0 var(--sand-300);
}

.rescue-title {
  font-weight: bold;
  color: var(--heading);
  margin-bottom: 0.35rem;
}

.rescue-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.code-copy-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.6rem 0;
}

.code-copy-row code {
  margin: 0;
  display: inline-block;
}

.copy-code-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
}

.field-invalid,
input.invalid {
  border-color: var(--danger) !important;
  background: var(--danger-wash) !important;
}

.tool-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.48rem;
  margin-bottom: 0.8rem;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

.tool-button.selected {
  color: var(--peri-900);
  background: var(--peri-300);
  border-color: var(--peri-900);
  box-shadow:
    inset 1px 1px 3px rgba(44, 50, 96, 0.45),
    inset -1px -1px 0 rgba(255, 255, 255, 0.55);
}

.tool-button.danger-quiet {
  color: #942036;
}

.size-row label {
  min-width: 104px;
}

.size-row output {
  display: inline-block;
  min-width: 1.5rem;
  color: var(--ink-strong);
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

input[type="range"] {
  width: min(240px, 100%);
  height: 44px;
  cursor: pointer;
  accent-color: var(--peri-600);
}

.palette {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  margin-bottom: 0.8rem;
  background: var(--peri-700);
  border: 1px solid var(--peri-900);
}

.swatch {
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--peri-300);
  border-bottom: 1px solid var(--peri-300);
  cursor: pointer;
}

.swatch:hover {
  position: relative;
  box-shadow: inset 0 0 0 2px var(--paper);
}

.swatch.selected {
  position: relative;
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 5px var(--peri-900);
}

.swatch-0 { background: #262b4a; }
.swatch-1 { background: #47539f; }
.swatch-2 { background: #7484dd; }
.swatch-3 { background: #c9d1f6; }
.swatch-4 { background: #266a78; }
.swatch-5 { background: #4f7a57; }
.swatch-6 { background: #a49a45; }
.swatch-7 { background: #d37b43; }
.swatch-8 { background: #a9484f; }
.swatch-9 { background: #8e4f76; }
.swatch-10 { background: #5d463b; }
.swatch-11 { background: #151515; }
.swatch-12 { background: #6f6b64; }
.swatch-13 { background: #c9c2b3; }
.swatch-14 { background: #f0e8d4; }
.swatch-15 { background: #fffdf6; }

.color-row {
  margin-bottom: 0;
}

.color-row input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--peri-700);
  cursor: pointer;
}

.hex-label {
  margin-left: 0.5rem;
}

.color-row input[type="text"] {
  width: 6.8rem;
  min-height: 44px;
  font-family: var(--mono);
  font-weight: bold;
  letter-spacing: 0.05em;
}

/* the submission card: one last beveled form panel */

.submission-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(300px, 1.35fr);
  gap: 1.5rem;
  margin-top: 3.2rem;
  padding: 1.4rem;
  background: var(--paper);
  border: 2px solid var(--peri-900);
  box-shadow:
    inset 0 0 0 1px var(--paper),
    inset 0 0 0 2px var(--peri-200),
    inset 0 6px 0 -3px var(--peri-300),
    6px 7px 0 rgba(71, 83, 159, 0.25);
}

.field-group,
.phrase-fields {
  display: grid;
  align-content: start;
  gap: 0.4rem;
}

.field-group small {
  color: var(--muted);
  font-size: 0.72rem;
}

.phrase-fields {
  grid-template-columns: 90px 1fr;
  margin: 0;
  padding: 0.55rem 0.9rem 0.9rem;
  border: 1px solid var(--peri-300);
  box-shadow: inset 0 0 0 1px var(--paper);
}

.phrase-fields legend {
  padding: 0 0.4em;
  font-size: 0.86rem;
}

.phrase-fields label {
  align-self: center;
}

.submission-card .form-error,
.submission-actions {
  grid-column: 1 / -1;
}

.submission-actions {
  padding-top: 1rem;
  border-top: 1px dotted var(--peri-300);
}

.busy-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
  margin: 2rem 0;
}

.busy-slot {
  aspect-ratio: 1;
  background:
    linear-gradient(135deg, transparent 43%, var(--peri-050) 44%, var(--peri-050) 56%, transparent 57%),
    var(--peri-400);
  border: 1px solid var(--peri-900);
}

.queue-position {
  padding: 0.7rem 0;
  border-top: 1px dotted var(--peri-300);
  border-bottom: 1px dotted var(--peri-300);
}

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

/* the back room */

.admin-heading {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  max-width: none;
}

.admin-heading h1 {
  grid-column: 2;
  margin-bottom: 0;
  text-align: center;
}

.admin-heading form {
  grid-column: 3;
  justify-self: end;
}

/* the kicker is a direct grid item here, so it blockifies and stretches —
   pin it back to its content width */
.admin-heading .kicker {
  justify-self: start;
  width: fit-content;
}

.admin-counts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 0 2rem;
  border: 1px solid var(--peri-900);
  box-shadow: 4px 4px 0 rgba(91, 107, 200, 0.3);
}

.admin-counts div {
  padding: 0.8rem;
  background: var(--peri-050);
  border-right: 1px solid var(--peri-300);
}

.admin-counts div:last-child {
  border-right: 0;
}

.admin-counts dt {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.admin-counts dd {
  margin: 0;
  color: var(--heading);
  font-size: 2rem;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
}

.admin-block {
  margin-bottom: 1.2rem;
  padding: 1rem;
  background: var(--paper);
  border: 1px solid var(--peri-700);
  box-shadow: inset 0 0 0 1px var(--paper), inset 0 0 0 2px var(--peri-200);
}

.admin-block h2 {
  display: block;
  margin: -1rem -1rem 0.85rem;
  padding: 0.32rem 0.6rem;
  color: var(--paper-text);
  background: var(--strip-a);
  border-bottom: 1px solid var(--peri-900);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

.admin-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-list li {
  padding: 0.55rem 0;
  border-bottom: 1px dotted var(--peri-300);
}

.leases-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.inline-form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.inline-form label {
  flex-basis: 100%;
}

.inline-form input {
  width: min(340px, 100%);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--peri-700);
  font-size: 0.8rem;
}

th,
td {
  padding: 0.55rem;
  border: 1px solid var(--peri-300);
  text-align: left;
}

th {
  color: var(--paper-text);
  background: var(--strip-a);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
}

tbody tr:nth-child(even) {
  background: var(--peri-050);
}

tbody tr:hover {
  background: var(--peri-100);
}

.invite-flash code {
  margin: 0.7rem 0;
  color: var(--sand-700);
  background: var(--sand-100);
  border: 1px dashed var(--sand-400);
  box-shadow: none;
  letter-spacing: 0.14em;
}

.invite-flash p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.review-actions {
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--peri-050);
  border: 1px solid var(--peri-700);
  box-shadow: inset 0 0 0 1px var(--paper), inset 0 0 0 2px var(--peri-200);
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 500px));
  justify-content: center;
  gap: 2rem;
}

.review-panel {
  margin: 0;
}

/* the status bar */

footer {
  padding: 0.7rem 1.4rem;
  color: var(--status-ink);
  background: var(--peri-200);
  border-top: 1px solid var(--peri-900);
  font-size: 0.74rem;
}

footer p {
  margin: 0;
}

footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.2rem 0.35rem;
  color: var(--status-ink);
  font-weight: bold;
}

footer a:hover {
  color: var(--ink-strong);
  background: var(--paper);
}

/* a little status led, because every 2001 status bar had one */

footer .led {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.55em;
  background: var(--led);
  border: 1px solid var(--peri-900);
}

.kicker::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.55em;
  background: var(--paper-text);
  content: "";
}

/* ————— the wafer is alive: motion, always first paint to final rest ————— */

@media (prefers-reduced-motion: no-preference) {
  /* the grid paper breathes, one tile per age */
  body {
    animation: grid-drift 160s linear infinite alternate;
  }

  @keyframes grid-drift {
    to {
      background-position: 22px 66px, 22px 66px;
    }
  }

  /* everything lands in a quick staggered settle when a page opens */
  .site-header {
    animation: settle 0.34s var(--ease-settle) backwards;
  }

  .paint-chip {
    animation: fade-in 0.3s ease-out 0.1s backwards;
  }

  main > * {
    animation: rise 0.42s var(--ease-settle) backwards;
  }

  main > *:nth-child(2) { animation-delay: 0.05s; }
  main > *:nth-child(3) { animation-delay: 0.1s; }
  main > *:nth-child(4) { animation-delay: 0.15s; }
  main > *:nth-child(5) { animation-delay: 0.2s; }
  main > *:nth-child(6) { animation-delay: 0.25s; }

  .page-grid aside > * {
    animation: rise 0.42s var(--ease-settle) 0.18s backwards;
  }

  .page-grid aside > *:nth-child(2) { animation-delay: 0.26s; }
  .page-grid aside > *:nth-child(3) { animation-delay: 0.34s; }

  footer {
    animation: fade-in 0.5s ease-out 0.24s backwards;
  }

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

  @keyframes rise {
    from {
      transform: translateY(9px);
      opacity: 0;
    }
  }

  @keyframes fade-in {
    from {
      opacity: 0;
    }
  }

  /* the status lights blink in their sleep */
  .kicker::before {
    animation: led-breathe 2.4s ease-in-out infinite;
  }

  footer .led {
    animation: led-breathe 2.4s ease-in-out 1.2s infinite;
  }

  @keyframes led-breathe {
    50% {
      opacity: 0.45;
    }
  }

  /* buttons press with a little spring in the step */
  .button,
  .tool-button {
    transition:
      transform 0.3s var(--ease-spring),
      box-shadow 0.3s var(--ease-spring),
      background-color 0.14s ease;
  }

  .button.primary:hover:not(:disabled) {
    box-shadow: 3px 3px 0 var(--peri-200);
  }

  .button:active:not(:disabled),
  .tool-button:active:not(:disabled) {
    transition-duration: 0.06s;
  }

  /* picking a color stamps it onto the palette */
  .swatch.selected {
    animation: stamp 0.45s var(--ease-pop);
  }

  .queue-position strong.tick {
    display: inline-block;
    animation: stamp 0.45s var(--ease-pop);
  }

  @keyframes stamp {
    0% {
      box-shadow: inset 0 0 0 5px var(--paper), 0 0 0 3px var(--peri-600);
      filter: brightness(1.25);
    }
    100% {
      box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 5px var(--peri-900);
      filter: brightness(1);
    }
  }

  /* hovering a card runs a light down its filmstrip */
  .comic-card .filmstrip img {
    transition: filter 0.18s ease;
  }

  .comic-card:hover .filmstrip img,
  .comic-card:focus-visible .filmstrip img {
    filter: saturate(1.3) brightness(1.07);
  }

  .comic-card:hover .filmstrip img:nth-child(2),
  .comic-card:focus-visible .filmstrip img:nth-child(2) { transition-delay: 30ms; }
  .comic-card:hover .filmstrip img:nth-child(3),
  .comic-card:focus-visible .filmstrip img:nth-child(3) { transition-delay: 60ms; }
  .comic-card:hover .filmstrip img:nth-child(4),
  .comic-card:focus-visible .filmstrip img:nth-child(4) { transition-delay: 90ms; }
  .comic-card:hover .filmstrip img:nth-child(5),
  .comic-card:focus-visible .filmstrip img:nth-child(5) { transition-delay: 120ms; }
  .comic-card:hover .filmstrip img:nth-child(6),
  .comic-card:focus-visible .filmstrip img:nth-child(6) { transition-delay: 150ms; }
  .comic-card:hover .filmstrip img:nth-child(7),
  .comic-card:focus-visible .filmstrip img:nth-child(7) { transition-delay: 180ms; }
  .comic-card:hover .filmstrip img:nth-child(8),
  .comic-card:focus-visible .filmstrip img:nth-child(8) { transition-delay: 210ms; }
  .comic-card:hover .filmstrip img:nth-child(9),
  .comic-card:focus-visible .filmstrip img:nth-child(9) { transition-delay: 240ms; }
  .comic-card:hover .filmstrip img:nth-child(10),
  .comic-card:focus-visible .filmstrip img:nth-child(10) { transition-delay: 270ms; }

  /* occupied desks pulse one after another, like lights on a patch panel */
  .busy-slot {
    animation: slot-wave 2.6s linear infinite;
  }

  .busy-slot:nth-child(2) { animation-delay: 0.52s; }
  .busy-slot:nth-child(3) { animation-delay: 1.04s; }
  .busy-slot:nth-child(4) { animation-delay: 1.56s; }
  .busy-slot:nth-child(5) { animation-delay: 2.08s; }

  @keyframes slot-wave {
    12% {
      filter: brightness(1.65);
    }

    30% {
      filter: brightness(1);
    }
  }
}

@media (max-width: 980px) {
  .draw-grid,
  .review-grid {
    grid-template-columns: minmax(0, 500px);
  }

  .submission-card {
    grid-template-columns: 1fr;
  }

  .submission-card .form-error,
  .submission-actions {
    grid-column: auto;
  }

  .blank-message {
    min-height: 280px;
    aspect-ratio: auto;
  }
}

@media (max-width: 760px) {
  html {
    font-size: 16px;
  }

  .site-shell,
  .site-shell.wide {
    width: 100%;
    border-right: 0;
    border-left: 0;
    box-shadow: none;
  }

  .site-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand theme"
      "nav   nav";
    min-height: 0;
    padding: 0;
  }

  .brand {
    grid-area: brand;
    min-width: 0;
    padding: 0.6rem 0.9rem;
  }

  .brand-copy strong {
    font-size: 1.6rem;
  }

  .site-header .theme-item {
    grid-area: theme;
    display: flex;
    align-items: center;
    padding: 0.5rem 0.8rem;
    border-left: 0;
  }

  .site-header .theme-item form {
    height: auto;
  }

  .site-header .theme-item button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 44px;
    min-width: 44px;
    padding: 0.35rem 0.65rem;
    color: var(--ink-strong);
    background: var(--peri-150);
    border: 1px dashed var(--peri-900);
    font-size: 0.76rem;
  }

  /* the pixel glyph is a desktop affordance; the cell is too tight for it */
  .site-header .theme-item .theme-glyph {
    display: none;
  }

  .site-header .theme-item button:hover {
    background: var(--peri-200);
    color: var(--peri-900);
  }

  .site-header nav {
    grid-area: nav;
    display: block;
    width: 100%;
    margin-left: 0;
    padding: 0;
    background: var(--peri-050);
    border-top: 1px solid var(--peri-900);
  }

  .site-header .nav-links {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .site-header .nav-links li {
    display: block;
    min-width: 0;
  }

  .site-header nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    margin-bottom: 0;
    padding: 0.55rem 0.2rem;
    color: var(--peri-700);
    background: var(--peri-100);
    border: 0;
    border-right: 1px solid var(--peri-300);
    text-align: center;
    font-size: 0.82rem;
  }

  .site-header .nav-links li:last-child a {
    border-right: 0;
  }

  .site-header nav a:hover {
    color: var(--peri-900);
    background: var(--peri-150);
  }

  .site-header nav a.selected {
    color: var(--paper);
    background: var(--peri-700);
    border-bottom: 3px solid var(--peri-900);
  }

  .page-grid {
    grid-template-columns: 1fr;
  }

  .page-grid aside {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    border-top: 1px solid var(--peri-900);
    border-left: 0;
  }

  main {
    padding: 1.4rem;
  }

  .intro {
    padding-bottom: 1.6rem;
  }

  .rule-section {
    margin-top: 1.6rem;
  }

  .draw-heading {
    display: block;
  }

  .timer-box {
    width: 100%;
    margin-top: 1rem;
    text-align: left;
  }

  .tool-row {
    gap: 0.55rem;
  }

  .tool-button {
    min-height: 2.75rem;
    padding: 0.45rem 0.8rem;
  }

  .palette {
    grid-template-columns: repeat(8, 1fr);
  }

  .admin-counts {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-counts div {
    border-bottom: 1px solid var(--peri-300);
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .page-grid aside {
    grid-template-columns: 1fr;
  }

  .brand-copy strong {
    font-size: 1.8rem;
  }

  .palette {
    grid-template-columns: repeat(4, 1fr);
  }

  .phrase-fields {
    grid-template-columns: 1fr;
  }

  .phrase-fields legend {
    margin-bottom: 0.5rem;
  }

  .submission-actions,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .submission-actions .button,
  .actions .button {
    width: 100%;
    text-align: center;
  }

  .admin-counts {
    grid-template-columns: 1fr;
  }
}

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

/* after dark: moonlit desk. every surface stays tinted periwinkle-ink —
   no gray blacks, no olive drift. the sand family becomes candlelight:
   the one warm pool on the page, so paper-note semantics still read. */

html.dark {
  --paper: #1c213d;
  --ink: #d6dbf5;
  --ink-strong: #eef0fd;
  --muted: #9aa4d0;
  --peri-050: #232852;
  --peri-100: #171b36;
  --peri-150: #363e74;
  --peri-200: #45508f;
  --peri-300: #5a66ab;
  --peri-400: #7484dd;
  --peri-500: #9daaf0;
  --peri-600: #6b7bd8;
  --peri-700: #505ea9;
  --peri-800: #435099;
  --peri-900: #10132a;
  --heading: #c4cefc;
  --link: #aab6ef;
  --link-hover: #ffffff;
  --status-ink: #d6dbf5;
  --danger: #f0a3b0;
  --danger-deep: #d98a99;
  --danger-wash: #3a2530;
  --sand-050: #202645;
  --sand-100: #222949;
  --sand-200: #2a335a;
  --sand-300: #394474;
  --sand-400: #4a5792;
  --sand-700: #e8c078;
  --accent-warm: #d97538;
  --accent-amber: #e89b4f;
  --accent-sage: #52a370;
}

html.dark body {
  background:
    linear-gradient(90deg, rgba(170, 182, 239, 0.09) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(rgba(170, 182, 239, 0.05) 1px, transparent 1px) 0 0 / 22px 66px,
    var(--peri-100);
}

html.dark .site-shell {
  border-color: #10132a;
  box-shadow:
    inset 0 0 0 1px var(--peri-150),
    inset 0 0 0 2px var(--peri-200),
    10px 12px 0 rgba(0, 0, 0, 0.45);
}

/* the titlebar keeps its periwinkle all the way down — moonlit, not blacked out */

html.dark .site-header {
  background: #4553a4;
}

html.dark .skip-link {
  color: var(--ink-strong);
}

html.dark .site-header nav a,
html.dark .site-header .theme-item button {
  color: var(--ink-strong);
  background: var(--peri-300);
}

/* night rule: hovers brighten, never dim */

html.dark .site-header nav a:hover,
html.dark .site-header .theme-item button:hover {
  color: #ffffff;
  background: #6a76bd;
}

html.dark .site-header nav a.selected {
  color: var(--ink-strong);
  background: var(--paper);
  border-bottom-color: var(--paper);
}

html.dark .button,
html.dark .tool-button {
  background: #39437e;
}

html.dark .button:hover,
html.dark .tool-button:hover {
  background: #45508f;
}

html.dark .button:active,
html.dark .tool-button:active {
  background: #2e3765;
}

html.dark .button.primary,
html.dark button.primary {
  background: #5b6bc8;
  color: #ffffff;
  box-shadow: 2px 2px 0 var(--peri-300);
}

html.dark .button.primary:hover,
html.dark button.primary:hover {
  background: #6e7dd6;
  color: #ffffff;
}

html.dark .button.primary:active,
html.dark button.primary:active {
  background: #4a58b0;
}

html.dark .button.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
  box-shadow: none;
}

html.dark .button.danger:hover {
  background: var(--danger);
  color: #241016;
}

html.dark .button.danger:active {
  background: var(--danger-deep);
  color: #241016;
}

html.dark .comic-card {
  box-shadow:
    inset 0 0 0 1px var(--peri-150),
    inset 0 0 0 2px var(--peri-200),
    5px 5px 0 rgba(0, 0, 0, 0.5);
}

html.dark .comic-card:hover,
html.dark .comic-card:focus-visible {
  box-shadow:
    inset 0 0 0 1px var(--peri-300),
    inset 0 0 0 2px var(--peri-300),
    8px 8px 0 rgba(0, 0, 0, 0.55);
}

html.dark .comic-panel img,
html.dark .review-panel img {
  box-shadow:
    inset 0 0 0 1px var(--peri-150),
    0 0 0 1px var(--peri-300),
    5px 5px 0 rgba(0, 0, 0, 0.45);
}

html.dark .tool-button.selected {
  color: var(--ink-strong);
}

html.dark code {
  background: #14172e;
  border-color: #45508f;
}

html.dark footer .led {
  background: #7dc492;
}

html.dark .timer-box {
  border-color: #10132a;
  box-shadow: 2px 2px 0 var(--peri-300);
}

html.dark .timer-box::after {
  background: repeating-linear-gradient(
    0deg,
    rgba(16, 19, 42, 0.4) 0 1px,
    transparent 1px 3px
  );
}

html.dark .blank-message p:first-child {
  color: #8d9de9;
}

html.dark .gate-card,
html.dark .wait-card,
html.dark .submission-card {
  border-color: #10132a;
}

html.dark input:focus {
  border-color: var(--peri-300);
  outline-color: #c9d1f6;
}

html.dark button:focus-visible,
html.dark a:focus-visible,
html.dark canvas:focus-visible {
  outline-color: #c9d1f6;
}

html.dark .kicker {
  color: #10132a;
  background: var(--accent-warm);
}

html.dark .section-number {
  color: #ffffff;
  background: var(--peri-700);
}

html.dark .tool-button.danger-quiet {
  color: #ffb3c0;
}

@media (max-width: 760px) {
  html.dark .site-header nav a,
  html.dark .site-header .theme-item button {
    color: var(--link);
    background: var(--peri-100);
  }

  html.dark .site-header nav a:hover,
  html.dark .site-header .theme-item button:hover {
    color: var(--link-hover);
    background: var(--peri-150);
  }

  html.dark .site-header nav a.selected {
    color: #ffffff;
    background: #4553a4;
  }
}

/* the lights switch carries a pixel moon (offer dark) or pixel sun (offer
   light), drawn in box-shadow pixels so no icon font or svg is needed */

.theme-glyph {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 0.45em;
  vertical-align: -0.12em;
}

.theme-glyph::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 2px;
  box-shadow:
    2px 0 currentColor, 4px 0 currentColor,
    0 2px currentColor, 2px 2px currentColor,
    0 4px currentColor, 2px 4px currentColor,
    0 6px currentColor, 2px 6px currentColor,
    0 8px currentColor, 2px 8px currentColor,
    2px 10px currentColor, 4px 10px currentColor;
}

html.dark .theme-glyph::before {
  box-shadow:
    4px 0 currentColor, 6px 0 currentColor,
    2px 2px currentColor, 8px 2px currentColor,
    0 4px currentColor, 2px 4px currentColor, 4px 4px currentColor,
    6px 4px currentColor, 8px 4px currentColor, 10px 4px currentColor,
    0 6px currentColor, 2px 6px currentColor, 4px 6px currentColor,
    6px 6px currentColor, 8px 6px currentColor, 10px 6px currentColor,
    2px 8px currentColor, 8px 8px currentColor,
    4px 10px currentColor, 6px 10px currentColor;
}

/* keep the tab wide enough that "lights off" and "lights on" occupy the
   same chrome — the header must not breathe when the label changes.
   desktop only: the mobile nav is an equal-width 5-column grid */
@media (min-width: 761px) {
  .site-header .theme-item button {
    min-width: 6.9rem;
    text-align: center;
  }
}

/* pages cross-fade into each other where the browser supports it;
   everywhere else the load is instant, which is also fine */

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

/* The desk uses the same visual language with space reserved for the artwork. */
.drawing-page .site-header { min-height: 72px; }
.drawing-page .brand { padding: 0.4rem 1rem; }
.drawing-page .brand-image { width: 48px; height: 48px; }
.drawing-page .brand-copy strong { font-size: 1.65rem; }
.drawing-page main { padding: 1rem 1.5rem 2rem; }
.drawing-page .draw-heading { margin: 0 0 0.8rem; padding-bottom: 0.6rem; align-items: center; }
.drawing-page .draw-heading h1 { font-size: 1.8rem; margin: 0; }
.drawing-page .draw-heading .kicker { display: none; }
.drawing-page .desk-status { flex-direction: row; align-items: center; }
.drawing-page .timer-box { padding: 0.35rem 0.7rem; min-width: 100px; }
.drawing-page .timer-box strong { font-size: 1.35rem; min-height: 0; }
.drawing-page .timer-box small { max-width: 170px; }
.drawing-page .timer-extension { min-height: 44px; }
.draft-status { margin: 0 0 0.4rem; color: var(--muted); font-size: 0.75rem; }
.drawing-page .draw-grid { grid-template-columns: minmax(0, 500px) minmax(0, 500px) 180px; gap: 1rem; }
.drawing-page .panel-column > header { min-height: 2.3rem; margin-bottom: 0.5rem; }
.drawing-page .panel-column > header h2 { font-size: 0.95rem; }
.drawing-page .section-number { width: 1.7rem; height: 1.7rem; }
.drawing-page .tools { padding: 0.5rem; margin: 2.8rem 0 0; }
.drawing-page .tool-kbd { display: none; }
.drawing-page .mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem; }
.drawing-page .tool-button { min-width: 44px; min-height: 44px; padding: 0.3rem; margin: 0; }
.drawing-page .size-row { display: block; margin: 0.4rem 0; }
.drawing-page .size-row input { width: 100%; min-height: 44px; }
.extra-tools summary { min-height: 44px; padding: 0.6rem; cursor: pointer; font-weight: bold; }
.extra-tools summary:focus-visible { outline: 2px dotted var(--link); outline-offset: 2px; }
.drawing-page .palette { grid-template-columns: repeat(3, 1fr); gap: 2px; }
.drawing-page .swatch { min-height: 44px; min-width: 44px; aspect-ratio: 1; }
.drawing-page .color-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.drawing-page .color-row label { flex-basis: 100%; }
.drawing-page .color-row input { max-width: 100%; min-height: 44px; }
.drawing-page .submission-card { margin-top: 1.4rem; }
.desk-tabs { display: none; }
.draft-recovery { margin: 1.5rem auto; max-width: 760px; padding: 1rem; border: 1px solid var(--peri-300); }
.saved-draft { padding: 0.8rem 0; border-top: 1px solid var(--peri-300); }
.saved-draft .button { margin: 0.2rem; }
.saved-draft .draft-state { display: block; margin-bottom: 0.25rem; color: var(--muted); }

@media (max-width: 1000px) {
  .drawing-page main { padding: 0.8rem 1rem 1.5rem; }
  .drawing-page .draw-grid { grid-template-columns: 1fr 1fr; }
  .drawing-page .tools { grid-column: 1 / -1; grid-row: 1; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: start; }
  .drawing-page .mode-row { display: flex; flex-wrap: wrap; }
  .drawing-page .tool-button { padding: 0.3rem 0.6rem; }
  .drawing-page .size-row { margin: 0; display: flex; align-items: center; gap: 0.5rem; }
  .drawing-page .size-row input { width: 100px; }
  .drawing-page .extra-tools { flex: 1 0 100%; }
  .drawing-page .palette { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .drawing-page .swatch { aspect-ratio: auto; }
  .drawing-page .color-row label { flex-basis: auto; }
}
@media (max-width: 760px) {
  .drawing-page .brand-copy small { display: none; }
  .drawing-page .draw-heading { gap: 0.5rem; }
  .drawing-page .draw-heading h1 { font-size: 1.25rem; }
  .drawing-page .timer-box small { display: none; }
  .drawing-page .desk-status { gap: 0.2rem; }
  .drawing-page .leave-desk-btn { padding: 0.25rem; }
  .drawing-page .draw-grid { display: flex; flex-direction: column; gap: 0.65rem; }
  .drawing-page .panel-column, .drawing-page .tools { width: 100%; }
  .drawing-page .tools { order: -1; }
  .drawing-page .extra-tools { flex: 1 0 auto; }
  .drawing-page .extra-tools[open] { flex-basis: 100%; }
  .drawing-page .palette { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .desk-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.6rem; }
  .desk-tabs button { min-height: 44px; flex: 1; padding: 0.4rem; border: 1px solid var(--peri-300); background: var(--peri-100); color: var(--ink); }
  .desk-tabs button[aria-pressed="true"] { background: var(--peri-700); color: #fff; }
  [data-view="drawing"] .previous-column,
  [data-view="previous"] .canvas-column,
  [data-view="previous"] .tools { display: none; }
  .drawing-page .handoff { margin-top: 0.6rem; }
}
@media (max-width: 760px) {
  .drawing-page .draw-heading { display: flex; justify-content: space-between; }
  .drawing-page .desk-status { flex: 0 0 auto; }
  .drawing-page .timer-box { width: auto; min-width: 78px; max-width: 140px; }
  .drawing-page .mode-row { margin: 0; }
}
