/* ============================================================
   ENIGMA — shared design system
   Story pages: manila dossier paper. Machine page: black bakelite.
   Signature: the amber lampboard glow.
   ============================================================ */

/* ---------- Fonts ---------- */
@font-face {
  font-family: "Oswald";
  src: url("../fonts/oswald-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Oswald";
  src: url("../fonts/oswald-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("../fonts/courierprime-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("../fonts/courierprime-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/sourceserif-var.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/sourceserif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --manila: #e7dfc6;
  --manila-deep: #ddd2b2;
  --paper-line: #c9bd98;
  --ink: #2b2820;
  --ink-soft: #5f5949;
  --bakelite: #16130d;
  --bakelite-2: #211d15;
  --bakelite-3: #2c2719;
  --lamp: #f0a72b;
  --lamp-glow: #ffd98a;
  --lamp-dim: #4a3a1a;
  --feldgrau: #5b604c;
  --stamp: #9c3223;
  --brass: #b08d4a;
  --display: "Oswald", "Arial Narrow", sans-serif;
  --body: "Source Serif 4", Georgia, serif;
  --mono: "Courier Prime", "Courier New", monospace;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--manila);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.1875rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
/* faint horizontal ruling, like a codebook page */
body.dossier {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 31px,
    rgba(91, 96, 76, 0.07) 31px,
    rgba(91, 96, 76, 0.07) 32px
  );
}
img,
svg {
  max-width: 100%;
  height: auto;
}
a {
  color: inherit;
  text-decoration-color: var(--brass);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--stamp);
}
:focus-visible {
  outline: 3px solid var(--lamp);
  outline-offset: 2px;
  border-radius: 2px;
}
::selection {
  background: var(--lamp);
  color: var(--bakelite);
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0 0 0.5em;
}
h1 {
  font-size: clamp(2.4rem, 7vw, 4.2rem);
}
h2 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  margin-top: 2.2em;
}
h3 {
  font-size: 1.15rem;
  letter-spacing: 0.06em;
}
p {
  margin: 0 0 1em;
}
strong {
  font-weight: 600;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--feldgrau);
  display: block;
  margin-bottom: 0.9em;
}

/* ---------- Nav ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.7rem 1.25rem;
  background: var(--manila);
  border-bottom: 2px solid var(--ink);
}
.topnav .brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.topnav .brand .lampdot {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--lamp-glow), var(--lamp) 60%, #a86f12);
  box-shadow: 0 0 8px rgba(240, 167, 43, 0.8);
  vertical-align: baseline;
}
.topnav ul {
  display: flex;
  gap: 0.25rem 1.4rem;
  flex-wrap: wrap;
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
}
.topnav a:not(.brand) {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.2rem 0;
  border-bottom: 3px solid transparent;
}
.topnav a:not(.brand):hover {
  color: var(--ink);
}
.topnav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--lamp);
}

/* ---------- Dossier layout ---------- */
.file-head {
  max-width: 46rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 1rem;
  position: relative;
}
.file-head .dek {
  font-size: 1.35rem;
  font-style: italic;
  color: var(--ink-soft);
  max-width: 34em;
}
.stamp {
  display: inline-block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--stamp);
  border: 3px double var(--stamp);
  padding: 0.35em 0.9em 0.25em;
  transform: rotate(-3deg);
  opacity: 0.85;
  margin: 1rem 0;
}

main.dossier-body {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

/* marginal date labels on timeline-ish sections */
.datemark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  color: var(--stamp);
  display: block;
  margin-bottom: 0.2em;
}

/* "In plain words" kid sidebar */
.plain {
  border: 2px solid var(--feldgrau);
  border-left-width: 10px;
  background: rgba(91, 96, 76, 0.08);
  padding: 1rem 1.25rem;
  margin: 1.8rem 0;
}
.plain > .plain-tag {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--feldgrau);
  display: block;
  margin-bottom: 0.4em;
}
.plain p:last-child {
  margin-bottom: 0;
}

/* Try-it interactive boxes */
.tryit {
  border: 2px solid var(--ink);
  background: var(--manila-deep);
  padding: 1.25rem 1.25rem 1.5rem;
  margin: 2rem 0;
  box-shadow: 5px 5px 0 rgba(43, 40, 32, 0.25);
}
.tryit > .tryit-tag {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--stamp);
  display: block;
  margin-bottom: 0.6em;
}

/* big pull-fact */
.pullfact {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.4rem, 3.5vw, 1.9rem);
  line-height: 1.3;
  text-transform: none;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  padding: 1.1em 0;
  margin: 2.2rem 0;
}
.pullfact .who {
  display: block;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.9em;
}

/* portrait/figure cards */
figure.card {
  border: 2px solid var(--ink);
  background: var(--manila-deep);
  margin: 2rem 0;
  padding: 0;
}
figure.card figcaption {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 0.75rem 1rem;
  border-top: 2px solid var(--ink);
}

/* next-file footer link */
.nextfile {
  display: block;
  margin: 4rem 0 0;
  border: 2px solid var(--ink);
  background: var(--manila-deep);
  padding: 1.3rem 1.5rem;
  text-decoration: none;
  box-shadow: 5px 5px 0 rgba(43, 40, 32, 0.25);
}
.nextfile:hover {
  background: var(--lamp-glow);
  color: var(--ink);
}
.nextfile .nf-tag {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--stamp);
  display: block;
}
.nextfile .nf-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  text-transform: uppercase;
}

/* footer */
.sitefoot {
  border-top: 2px solid var(--ink);
  padding: 1.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  text-align: center;
}
body.machine-room .sitefoot {
  border-top-color: var(--bakelite-3);
  color: #8c8672;
}

/* ============================================================
   Lampboard + keyboard components (shared: home hero & machine)
   ============================================================ */
.lampboard,
.keyrows {
  display: grid;
  gap: 0.45rem;
  justify-content: center;
}
.lamprow,
.keyrow {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
}
/* QWERTZ stagger like the real machine */
.lamprow:nth-child(2) {
  padding: 0 1.4rem;
}
.lamp {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.05rem;
  color: #6b6350;
  background: radial-gradient(circle at 38% 32%, #3a352a, #23201731 70%), #262218;
  border: 2px solid #0c0a06;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
  transition: all 120ms ease;
  user-select: none;
}
.lamp.lit {
  color: var(--bakelite);
  background: radial-gradient(circle at 40% 32%, #fff3d0, var(--lamp-glow) 45%, var(--lamp) 80%);
  border-color: #7a5a15;
  box-shadow:
    0 0 14px 4px rgba(240, 167, 43, 0.55),
    inset 0 1px 2px rgba(255, 255, 255, 0.6);
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
}
.key {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.05rem;
  color: #ded7c2;
  background: radial-gradient(circle at 40% 30%, #4a443633, transparent 70%), #332d20;
  border: 2px solid #0c0a06;
  box-shadow:
    0 3px 0 #0c0a06,
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: transform 60ms ease, box-shadow 60ms ease;
  padding: 0;
}
.key:hover {
  background: radial-gradient(circle at 40% 30%, #5a543f44, transparent 70%), #3d3628;
}
.key:active,
.key.pressed {
  transform: translateY(3px);
  box-shadow:
    0 0 0 #0c0a06,
    inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

/* panel that holds lampboard/keyboard on manila pages */
.bakelite-panel {
  background: linear-gradient(160deg, var(--bakelite-2), var(--bakelite));
  border: 3px solid #0c0a06;
  border-radius: 10px;
  padding: 1.5rem 1rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 24px rgba(22, 19, 13, 0.45);
}

/* ============================================================
   Home hero
   ============================================================ */
.hero {
  max-width: 62rem;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 3rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(3rem, 10vw, 6.5rem);
  letter-spacing: 0.12em;
  margin-bottom: 0.15em;
}
.hero .dek {
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  font-style: italic;
  color: var(--ink-soft);
  max-width: 36em;
  margin: 0 auto 2.2rem;
}
.hero-machine {
  max-width: 40rem;
  margin: 0 auto;
  text-align: left;
}
.hero-machine .heroinput {
  width: 100%;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 0.8rem 1rem;
  border: 2px solid var(--ink);
  background: #f4efdd;
  color: var(--ink);
  margin-bottom: 1rem;
}
.hero-machine .heroinput::placeholder {
  color: #9a927c;
  letter-spacing: 0.12em;
}
.hero-out {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.3em;
  text-align: center;
  color: var(--lamp-glow);
  min-height: 1.6em;
  margin: 1.2rem 0 0;
  word-break: break-all;
  text-shadow: 0 0 10px rgba(240, 167, 43, 0.6);
}
.hero-note {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 1rem;
}

/* section cards on home */
.filecards {
  max-width: 62rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem;
}
.filecard {
  border: 2px solid var(--ink);
  background: var(--manila-deep);
  padding: 1.4rem 1.4rem 1.6rem;
  text-decoration: none;
  box-shadow: 5px 5px 0 rgba(43, 40, 32, 0.25);
  transition: transform 120ms ease, box-shadow 120ms ease;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.filecard:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 rgba(43, 40, 32, 0.3);
  color: var(--ink);
}
.filecard .fc-tag {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--stamp);
}
.filecard h2 {
  margin: 0;
  font-size: 1.45rem;
}
.filecard p {
  margin: 0;
  font-size: 1rem;
  color: var(--ink-soft);
}

/* ============================================================
   Mini-demo widgets (how-it-works)
   ============================================================ */
.demo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}
.demo-out {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.18em;
}
.btn {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.55em 1.1em;
  border: 2px solid var(--ink);
  background: var(--manila);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(43, 40, 32, 0.3);
}
.btn:hover {
  background: var(--lamp-glow);
}
.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}
input.demo-input,
select.demo-select {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.5em 0.7em;
  border: 2px solid var(--ink);
  background: #f4efdd;
  color: var(--ink);
}

/* alphabet strip used in cipher demos */
.alphastrip {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0.6rem 0;
}
.alphastrip span {
  width: 1.6em;
  text-align: center;
  padding: 0.15em 0;
  background: rgba(43, 40, 32, 0.06);
  border: 1px solid var(--paper-line);
}
.alphastrip span.hot {
  background: var(--lamp);
  color: var(--bakelite);
  border-color: #7a5a15;
}

/* ============================================================
   Machine room (machine.html) — dark theme
   ============================================================ */
body.machine-room {
  background: var(--bakelite);
  color: #e8e2cf;
}
body.machine-room .topnav {
  background: var(--bakelite);
  border-bottom-color: var(--bakelite-3);
}
body.machine-room .topnav .brand,
body.machine-room .topnav a:not(.brand):hover {
  color: #e8e2cf;
}
body.machine-room .topnav a:not(.brand) {
  color: #8c8672;
}
body.machine-room .topnav a[aria-current="page"] {
  color: var(--lamp-glow);
  border-bottom-color: var(--lamp);
}
body.machine-room .eyebrow {
  color: var(--brass);
}
body.machine-room a {
  text-decoration-color: var(--brass);
}
body.machine-room a:hover {
  color: var(--lamp-glow);
}

.machine-wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: 2.5rem 1rem 5rem;
}
.machine-wrap .intro {
  max-width: 44rem;
  margin: 0 auto 2rem;
  text-align: center;
}
.machine-wrap .intro .dek {
  font-style: italic;
  color: #b5ad93;
}

/* machine chassis */
.chassis {
  background: linear-gradient(165deg, var(--bakelite-3), var(--bakelite-2) 40%, var(--bakelite));
  border: 3px solid #060503;
  border-radius: 14px;
  padding: 1.5rem 1.25rem 2rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 16px 40px rgba(0, 0, 0, 0.6);
}
.chassis-section {
  margin-bottom: 1.6rem;
}
.chassis-label {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--brass);
  text-align: center;
  display: block;
  margin-bottom: 0.7rem;
}

/* rotor windows */
.rotorbank {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
  flex-wrap: wrap;
}
.rotorunit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}
.rotorunit .r-name {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #8c8672;
  text-transform: uppercase;
}
.rotor-window {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0d0b07;
  border: 2px solid var(--brass);
  border-radius: 6px;
  overflow: hidden;
}
.rotor-window .r-letter {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.7rem;
  color: #f2ecd8;
  width: 2.4em;
  text-align: center;
  padding: 0.15em 0;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 30%, transparent 70%, rgba(0, 0, 0, 0.55)),
    #1a150c;
}
.rotor-window .r-ghost {
  font-family: var(--display);
  font-size: 0.85rem;
  color: #574f3a;
  padding: 0.05em 0;
}
.rotor-btns {
  display: flex;
  gap: 0.4rem;
}
.rotor-btns button {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  width: 2rem;
  height: 1.6rem;
  background: var(--bakelite-3);
  color: var(--brass);
  border: 1px solid var(--brass);
  border-radius: 4px;
  cursor: pointer;
}
.rotor-btns button:hover {
  background: var(--brass);
  color: var(--bakelite);
}
.rotorunit select {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--bakelite-3);
  color: #e8e2cf;
  border: 1px solid var(--brass);
  border-radius: 4px;
  padding: 0.2em 0.4em;
}

/* plugboard */
.plugboard {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 0.5rem 0.35rem;
  justify-items: center;
  max-width: 34rem;
  margin: 0 auto;
}
.plug {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.85rem;
  color: #ded7c2;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.15rem;
}
.plug .socket {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #3a352a, #0d0b07 70%);
  border: 2px solid #4a4436;
  transition: all 100ms ease;
}
.plug:hover .socket {
  border-color: var(--brass);
}
.plug.pending .socket {
  border-color: var(--lamp);
  box-shadow: 0 0 8px rgba(240, 167, 43, 0.7);
}
.plug.paired .socket {
  background: radial-gradient(circle at 40% 35%, var(--pairclr, var(--brass)), #0d0b07 85%);
  border-color: var(--pairclr, var(--brass));
}
.plug .pairtag {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--pairclr, transparent);
  min-height: 0.9em;
  line-height: 1;
}

/* tape output */
.tape {
  background: #f4efdd;
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  padding: 0.9rem 1.1rem;
  border: 2px solid #060503;
  border-radius: 3px;
  min-height: 3.1em;
  word-break: break-all;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
}
.tape .tape-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  margin-bottom: 0.3em;
}
.tape-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.4rem;
}
@media (max-width: 40rem) {
  .tape-row {
    grid-template-columns: 1fr;
  }
}

/* signal path panel */
.pathpanel {
  margin-top: 2.5rem;
  border: 1px solid var(--bakelite-3);
  border-radius: 10px;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
}
.pathpanel h2 {
  font-size: 1.2rem;
  margin-top: 0;
  color: var(--brass);
}
.path-explain {
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.7;
  color: #cfc8ad;
  min-height: 3.4em;
}
.path-explain .hotletter {
  color: var(--lamp-glow);
  font-weight: 700;
}
#pathsvg text {
  font-family: var(--mono);
  font-weight: 700;
}

/* signal-path flow diagram */
.flowgrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(4.6rem, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
  min-width: 30rem;
}
.flowcell {
  border: 1px solid var(--bakelite-3);
  border-radius: 6px;
  padding: 0.45rem 0.3rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.25);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.flowcell .fc-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8c8672;
  margin-bottom: 0.2em;
}
.flowcell .fc-letter {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  color: #574f3a;
}
.flowcell.on {
  border-color: var(--lamp);
  box-shadow: 0 0 10px rgba(240, 167, 43, 0.35) inset;
}
.flowcell.on .fc-letter {
  color: var(--lamp-glow);
  text-shadow: 0 0 8px rgba(240, 167, 43, 0.7);
}
.flowcell.reflectorcell {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* machine controls row */
.machine-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin: 1.2rem 0 0;
}
.btn.dark {
  background: var(--bakelite-3);
  color: #e8e2cf;
  border-color: var(--brass);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
}
.btn.dark:hover {
  background: var(--brass);
  color: var(--bakelite);
}

/* challenge box on machine page */
.challenge {
  margin-top: 2.5rem;
  border: 2px solid var(--brass);
  border-radius: 10px;
  padding: 1.5rem;
}
.challenge h2 {
  color: var(--lamp-glow);
  margin-top: 0;
  font-size: 1.4rem;
}
.challenge .cmsg {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  color: var(--lamp-glow);
  word-break: break-all;
}
.challenge table {
  font-family: var(--mono);
  font-size: 0.9rem;
  border-collapse: collapse;
  margin: 1rem 0;
}
.challenge td {
  padding: 0.2em 1.2em 0.2em 0;
  color: #cfc8ad;
}
.challenge td:first-child {
  color: var(--brass);
  font-weight: 700;
}

/* ---------- responsive ---------- */
@media (max-width: 40rem) {
  body {
    font-size: 1.06rem;
  }
  .lamp,
  .key {
    width: 2.05rem;
    height: 2.05rem;
    font-size: 0.85rem;
  }
  .lamprow:nth-child(2) {
    padding: 0 1.1rem;
  }
  .plugboard {
    grid-template-columns: repeat(9, 1fr);
  }
}

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