:root {
  --bg: #3a3128;
  --surface: #241f1a;
  --text: #f3ecdc;
  --muted: #c4b8a4;
  --border: #110e0c;
  --accent: #e06a2c;
  --paper: #efe6d2;
  --pane: #0c0b0a;
  --steel: #c4bfb4;
  --pad: clamp(1.25rem, 4vw, 2.6rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: clip;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 236, 210, 0.06), transparent 18%),
    repeating-linear-gradient(
      90deg,
      transparent 0 47px,
      rgba(0, 0, 0, 0.07) 47px 48px
    ),
    var(--bg);
  color: var(--text);
  font-family: Outfit, sans-serif;
  font-size: 18px;
  line-height: 1.45;
  overflow-x: clip;
}

img, video, canvas { max-width: 100%; display: block; }
[hidden] { display: none !important; }

h1, h2 {
  font-family: Syne, sans-serif;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0;
}

a { color: var(--accent); text-underline-offset: 0.16em; }
a:hover { color: var(--text); }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 20;
  background: var(--paper);
  color: #1f1c18;
  padding: 0.5rem 0.8rem;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lamp {
  pointer-events: none;
  position: fixed;
  inset: 0 0 auto;
  height: 42vh;
  background: radial-gradient(ellipse at 50% -10%, rgba(255, 244, 220, 0.22), transparent 62%);
  z-index: 0;
}

.rule {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.2rem;
  min-height: 4.4rem;
  padding: 0.7rem var(--pad) 0.55rem;
  background:
    linear-gradient(180deg, #d8d3c8, var(--steel) 38%, #9e998e);
  color: #1a1814;
  border-bottom: 3px solid var(--border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

.rule::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  background: repeating-linear-gradient(
    90deg,
    #1a1814 0 1px,
    transparent 1px 8px,
    #1a1814 8px 9px,
    transparent 9px 16px
  );
  opacity: 0.55;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: Syne, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  color: #1a1814;
  text-decoration: none;
  margin-bottom: 0.35rem;
}
.brand img {
  width: 36px;
  height: 36px;
  border: 1px solid #1a1814;
}

.ticks {
  display: flex;
  flex: 1;
  justify-content: space-between;
  list-style: none;
  margin: 0 0 0.85rem 2rem;
  padding: 0;
  font-family: Syne, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.bench {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(22rem, 34rem) minmax(18rem, 1fr);
  justify-content: start;
  align-items: start;
  gap: 1.25rem 2.4rem;
  max-width: 74rem;
  padding: 1.6rem var(--pad) 2.4rem;
}

.copy { grid-column: 1 / -1; }
.copy h1 {
  font-size: clamp(2rem, 4.6vw, 3.35rem);
  line-height: 0.95;
  max-width: 14ch;
}
.deck {
  margin: 0.85rem 0 0;
  color: var(--muted);
  max-width: 42ch;
}

.stage { display: contents; }

.well {
  grid-column: 1;
  width: 100%;
  min-width: 0;
  background: linear-gradient(180deg, #2c2722, var(--surface));
  padding: 0.7rem;
  border: 2px solid var(--border);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 14px 0 rgba(16, 12, 8, 0.35);
}

.cap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.1rem 0.35rem 0.55rem;
  font-family: Syne, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.cap p { margin: 0; }
.cap-led {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
#led {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #5a3a32;
}
.well.is-live #led {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 106, 44, 0.28);
}

.pane {
  position: relative;
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(180deg, rgba(255, 236, 210, 0.08), transparent 28%),
    var(--pane);
  overflow: hidden;
  border: 3px solid #070605;
  box-shadow: inset 0 16px 36px rgba(0, 0, 0, 0.55);
}
.pane::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: 1px dashed rgba(243, 236, 220, 0.18);
  pointer-events: none;
  z-index: 0;
}
.well.is-live .pane::after { display: none; }

.pane video,
.pane #still,
.pane canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pane canvas { pointer-events: none; }

.frost {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  margin: 0;
  font-family: Syne, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: rgba(243, 236, 220, 0.55);
}
.well.is-live .frost { display: none; }
.well.is-hit .pane { outline: 2px solid var(--accent); outline-offset: -2px; }
.well.is-make #still {
  object-fit: contain;
  background: var(--paper);
  padding: 8%;
}

.board {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  grid-column: 2;
  align-self: start;
  min-width: 0;
  padding-top: 2.15rem;
}

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.key,
.key-ghost {
  font-family: Syne, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.key {
  background: var(--accent);
  color: #1a120c;
}
.key:hover {
  transform: translateY(-2px);
  box-shadow: 4px 5px 0 rgba(16, 12, 8, 0.45);
}
.key-ghost {
  background: transparent;
  color: var(--text);
  border-color: #6d6458;
}
.key-ghost:hover { border-color: var(--text); }

.make {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-width: 28rem;
}
.make input {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 44px;
  padding: 0.45rem 0.7rem;
  border: 2px solid var(--border);
  background: #161310;
  color: var(--text);
  font: inherit;
}
.make input::placeholder { color: #7a7166; }

.status {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.hint {
  margin: 0;
  max-width: 32ch;
  color: #9d9283;
  font-size: 0.92rem;
}

.out {
  grid-column: 1 / -1;
  margin-top: 0.4rem;
  max-width: 42rem;
}
.idle {
  margin: 0;
  color: var(--muted);
}

.slip {
  background: var(--paper);
  color: #1f1c18;
  padding: 0.9rem 1rem 1rem;
  border: 2px solid var(--border);
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0 27px,
    rgba(31, 28, 24, 0.08) 27px 28px
  );
}
.slip-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  font-family: Syne, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.slip-body {
  margin: 0.55rem 0 0;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}
.slip-extra {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.7rem;
  margin: 0.6rem 0 0;
  font-size: 0.95rem;
}
.slip-extra dt { color: #6a6156; }
.slip-extra dd { margin: 0; overflow-wrap: anywhere; }
.slip-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}
.slip-acts .key,
.slip-acts .key-ghost { min-height: 40px; padding: 0.4rem 0.75rem; font-size: 0.95rem; }
.slip-acts .key-ghost {
  background: transparent;
  color: #1f1c18;
  border-color: #cbbca3;
}

.logwrap {
  grid-column: 1 / -1;
  margin-top: 0.6rem;
}
.log-head {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.log-head p {
  margin: 0;
  font-family: Syne, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.log-head .key-ghost {
  background: transparent;
  color: var(--text);
  border-color: #6d6458;
}

.notes {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
  max-width: 36rem;
}
.notes li {
  background: var(--surface);
  border-left: 4px solid var(--accent);
  padding: 0.65rem 0.8rem;
  font-size: 0.92rem;
}
.notes .k {
  margin: 0;
  font-family: Syne, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.notes p { margin: 0.3rem 0 0; overflow-wrap: anywhere; }

.plaque {
  position: relative;
  z-index: 1;
  margin: 0 var(--pad);
  padding: 1.2rem 0 2.4rem;
  border-top: 1px solid rgba(243, 236, 220, 0.16);
  color: var(--muted);
  font-size: 0.92rem;
}
.plaque p { margin: 0 0 0.35rem; }
.plaque .req { overflow-wrap: anywhere; max-width: 42rem; }
.plaque nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.55rem;
}
.plaque a { color: var(--muted); }

.dochead {
  padding: 1rem var(--pad);
  border-bottom: 1px solid rgba(243, 236, 220, 0.16);
}
.dochead a {
  font-family: Syne, sans-serif;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.doc {
  max-width: 40rem;
  margin: 1.6rem var(--pad) 3rem;
  padding: 1.4rem 1.3rem 1.6rem;
  background: var(--paper);
  color: #1f1c18;
  border: 2px solid var(--border);
}
.doc h1 { font-size: 2.1rem; margin-bottom: 0.8rem; color: #1f1c18; }
.doc a { color: #a43d12; }

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

@media (max-width: 860px) {
  .ticks { display: none; }
  .bench { grid-template-columns: 1fr; }
  .copy h1 { max-width: none; }
  .well { max-width: 26rem; }
  .board {
    grid-column: 1;
    grid-row: auto;
    padding-top: 0;
  }
  .keys .key,
  .keys .key-ghost,
  .make .key { width: 100%; }
  .make input { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
