/* Layout idea: the 3D room fills the frame; a thin strip at the bottom carries the hint, the camera spots and the tape controls. */
:root {
  color-scheme: dark;
  --bg: #0c1114;
  --ink: #e9eef0;
  --muted: #93a1a8;
  --line: rgba(255, 255, 255, 0.22);
  --accent: #e0a81e;
  --f: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f);
  overflow: hidden;
}
#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#gl.drag {
  cursor: grabbing;
}
#gl.hot {
  cursor: pointer;
}
.hud {
  z-index: 4;
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  flex-wrap: wrap;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  text-shadow: 0 1px 3px #000;
}
.hud nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: auto;
}
button {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--ink);
  background: rgba(8, 12, 14, 0.7);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 11px;
  cursor: pointer;
}
button:hover {
  background: var(--ink);
  color: #0c1114;
}
button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
button[aria-pressed="true"]:hover {
  color: #0c1114;
}
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button[hidden] {
  display: none;
}
#vig {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 46%, transparent 52%, rgba(2, 5, 7, 0.62) 100%);
}
#msg {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}
#tip {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  background: #fff;
  color: #111;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  opacity: 0;
  transform: translate(14px, 16px);
  white-space: nowrap;
}
#tip.on {
  opacity: 1;
}
#boot {
  position: fixed;
  inset: 0;
  z-index: 3;
  background: #04060c;
  overflow: hidden;
  transition: opacity 0.9s;
}
#boot.gone {
  opacity: 0;
  pointer-events: none;
}
body.loading .menu,
body.loading .hud nav {
  opacity: 0.3;
  pointer-events: none;
}
#boot img {
  position: absolute;
  display: block;
  max-width: none;
  user-select: none;
  pointer-events: none;
}
#bootBarImg {
  clip-path: inset(0 100% 0 0);
}
#credits {
  border: 1px solid rgba(214, 222, 236, 0.3);
  background: #0a0d16;
  color: #d6deec;
  padding: 26px 28px;
  max-width: min(560px, 90vw);
  font-family: var(--f);
  font-size: 14px;
  line-height: 1.55;
  border-radius: 4px;
}
#credits::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
#credits h2 {
  margin: 0 0 10px;
  font-family: "VT323", var(--f);
  font-size: 34px;
  letter-spacing: 0.12em;
  font-weight: 400;
}
#credits h3 {
  margin: 14px 0 2px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8fa0c0;
  font-weight: 400;
}
#credits p {
  margin: 0;
}
#credits a {
  color: #9dffd6;
}
#credits form {
  margin-top: 18px;
  text-align: right;
}
.top {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 24px;
  pointer-events: none;
  z-index: 4;
}
.top > * {
  pointer-events: auto;
}
.name {
  font-family: "Archivo Black", Impact, "Arial Black", sans-serif;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: #f4efe6;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}
.menu {
  display: flex;
  gap: 26px;
}
.menu button {
  font-family: "VT323", var(--f);
  font-size: 30px;
  letter-spacing: 0.14em;
  background: none;
  border: 0;
  border-radius: 3px;
  padding: 0 6px;
  color: rgba(214, 222, 236, 0.62);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}
.menu button:hover {
  color: #fff;
  background: none;
}
.menu button[aria-current="true"] {
  background: #f4efe6;
  color: #141414;
  text-shadow: none;
}
.hud .keys {
  opacity: 0.85;
}
#pad {
  --lh: clamp(26px, 3.7vh, 40px);
  position: fixed;
  z-index: 6;
  right: max(14px, 3vw);
  top: max(78px, 10vh);
  width: clamp(300px, 42vw, 600px);
  max-height: calc(100vh - max(78px, 10vh) - 74px);
  overflow-y: auto;
  scrollbar-width: none;
  transform-origin: 70% 40%;
  transform: perspective(1600px) translate(40px, 30px) rotateY(-14deg) rotateZ(4deg);
  opacity: 0;
  visibility: hidden;
  transition:
    transform 0.45s cubic-bezier(0.25, 1.25, 0.5, 1),
    opacity 0.3s,
    visibility 0.3s;
  background:
    linear-gradient(
      90deg,
      transparent 0 calc(3.2 * var(--lh) - 2px),
      rgba(196, 74, 58, 0.55) calc(3.2 * var(--lh) - 2px) calc(3.2 * var(--lh)),
      transparent calc(3.2 * var(--lh))
    ),
    repeating-linear-gradient(
        180deg,
        transparent 0 calc(var(--lh) - 1px),
        rgba(98, 108, 140, 0.3) calc(var(--lh) - 1px) var(--lh)
      )
      0 0/100% var(--lh),
    linear-gradient(170deg, #e2c487, #d5b273 60%, #cfa967);
  color: #1d1912;
  padding: var(--lh) 5% var(--lh) 0;
  border-radius: 2px;
  box-shadow:
    0 34px 80px rgba(0, 0, 0, 0.6),
    0 3px 0 #b8955a;
  font-family: "Caveat", "Bradley Hand", cursive;
  line-height: var(--lh);
}
#pad::-webkit-scrollbar {
  display: none;
}
#pad,
#pad.open {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  right: auto !important;
  bottom: auto !important;
  width: 1px !important;
  height: 1px !important;
  max-height: none !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%);
  transform: none !important;
  transition: none !important;
}
#pad.open {
  transform: perspective(1600px) rotateY(-7deg) rotateZ(1.2deg);
  opacity: 1;
  visibility: visible;
}
#pad .ln {
  display: grid;
  grid-template-columns: calc(3.2 * var(--lh)) 1fr auto;
  align-items: end;
  min-height: var(--lh);
}
#pad .ln > :first-child {
  justify-self: center;
  font-size: calc(0.72 * var(--lh));
}
#pad .head {
  height: calc(2 * var(--lh));
  align-items: end;
}
#pad h2 {
  margin: 0;
  font-size: calc(2.1 * var(--lh));
  line-height: calc(2 * var(--lh));
  font-weight: 700;
  border-bottom: 3px solid rgba(196, 74, 58, 0.7);
  justify-self: start;
  padding-right: 8px;
}
#padStatus {
  font-size: calc(0.8 * var(--lh));
  color: #4a3c26;
  align-self: end;
  white-space: nowrap;
}
#padNow .co {
  font-size: calc(1.5 * var(--lh));
  line-height: calc(1.6 * var(--lh));
  font-weight: 700;
}
#padNow .desc {
  grid-column: 2/4;
  font-size: calc(0.86 * var(--lh));
  line-height: var(--lh);
}
#pad h3 {
  grid-column: 2;
  margin: 0;
  font-size: calc(0.95 * var(--lh));
  color: #b23f2c;
  font-weight: 700;
}
#pad ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
#pad li button {
  width: 100%;
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
#pad li button .nm {
  font-size: calc(0.9 * var(--lh));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#pad li button .yr,
#pad .row .yr {
  font-size: calc(0.8 * var(--lh));
}
#pad li button:hover .nm,
#pad li button:focus-visible .nm {
  text-decoration: underline;
  text-decoration-color: rgba(196, 74, 58, 0.7);
  text-underline-offset: 4px;
}
#pad .num {
  display: inline-block;
  width: calc(1.25 * var(--lh));
  height: calc(0.95 * var(--lh));
  line-height: calc(0.95 * var(--lh));
  text-align: center;
  border-radius: 50%;
  border: 2px solid transparent;
}
#pad [aria-current="true"] .num,
#padNow .num {
  border-color: rgba(196, 74, 58, 0.8);
  color: #9a3324;
}
#pad .sp {
  height: var(--lh);
}
#kbd {
  position: fixed;
  left: -200px;
  top: 0;
  width: 10px;
  height: 10px;
  opacity: 0;
}
@media (max-width: 760px) {
  .top {
    padding: 12px 14px;
  }
  .name {
    font-size: 15px;
  }
  .menu {
    gap: 10px;
  }
  .menu button {
    font-size: 22px;
  }
}
@media (max-width: 900px) {
  #pad {
    --lh: clamp(20px, 3vh, 30px);
    width: 54vw;
  }
  #padNow .co {
    font-size: calc(1.25 * var(--lh));
  }
}
@media (max-width: 560px) {
  #pad {
    --lh: 26px;
    width: auto;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 62px;
    max-height: 56vh;
  }
}
@media (max-width: 760px) {
  .hud {
    font-size: 11px;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    justify-content: flex-end;
  }
  #hint {
    display: none;
  }
  .hud nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
  }
  .hud button {
    padding: 9px 10px;
    min-height: 38px;
  }
  .top {
    padding-top: max(12px, env(safe-area-inset-top));
  }
  #credits {
    font-size: 13px;
    padding: 20px;
  }
}
@media (max-width: 420px) {
  .name {
    font-size: 13px;
  }
  .menu {
    gap: 4px;
  }
  .menu button {
    font-size: 20px;
    letter-spacing: 0.08em;
    padding: 0 4px;
  }
}
@media (pointer: coarse) {
  #tip {
    display: none;
  }
  .menu button {
    min-height: 40px;
  }
}
html,
body {
  overscroll-behavior: none;
}
#tSel {
  position: fixed;
  z-index: 2;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  color: transparent;
  font-family: "VT323", monospace;
  white-space: pre;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
  scrollbar-width: none;
  overscroll-behavior: contain;
}
#tSel::-webkit-scrollbar {
  display: none;
}
#tSel div::selection {
  background: rgba(157, 255, 214, 0.38);
  color: transparent;
}
html.reading,
html.reading body {
  height: auto;
  overflow: visible;
  overscroll-behavior: auto;
  background: #f6f4ef;
  color: #16150f;
}
html.reading .top,
html.reading .hud,
html.reading #boot,
html.reading #msg,
html.reading #tip,
html.reading #pad,
html.reading #kbd,
html.reading #vig,
html.reading #gl,
html.reading #tSel {
  display: none !important;
}
#read {
  display: none;
}
html.reading #read {
  display: block;
  font-family: "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --line: #d9d6cd;
  --dim: #5c5a52;
}
html.reading.dark,
html.reading.dark body {
  background: #141412;
  color: #eeece4;
}
html.reading.dark #read {
  --line: #33322d;
  --dim: #a3a198;
}
#read header {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 22px 26px;
  font-family: var(--mono);
}
#read header b {
  font-family: "Archivo Black", Impact, sans-serif;
  font-size: 21px;
  letter-spacing: 0.04em;
  margin-right: auto;
}
#read header a {
  color: var(--dim);
  text-decoration: none;
  font-size: 17px;
  letter-spacing: 0.12em;
  padding: 4px 8px;
  border-radius: 4px;
}
#read header a[aria-current="true"] {
  background: currentColor;
}
#read header a[aria-current="true"] span {
  color: #f6f4ef;
}
html.reading.dark #read header a[aria-current="true"] span {
  color: #141412;
}
#read header button {
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.12em;
  color: inherit;
  background: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
  text-transform: none;
}
#read main {
  max-width: 820px;
  margin: 0 auto;
  padding: 60px 26px 110px;
}
#read h1 {
  font-size: clamp(44px, 7vw, 68px);
  line-height: 1.05;
  margin: 40px 0 14px;
  font-weight: 700;
}
#read .lede {
  font-size: clamp(21px, 2.6vw, 28px);
  line-height: 1.4;
  margin: 0 0 22px;
  color: inherit;
  opacity: 0.86;
}
#read .more {
  font-family: var(--mono);
  font-size: 16px;
  color: inherit;
  text-underline-offset: 5px;
}
#read hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 48px 0;
}
#read figure {
  margin: 0;
}
#read figure img {
  display: block;
  width: 100%;
  border-radius: 6px;
  cursor: pointer;
}
#read h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 30px;
  margin: 64px 0 18px;
  font-weight: 700;
}
#read .job {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 20px;
}
#read .job h3 {
  margin: 0;
  font-size: 26px;
  font-weight: 400;
}
#read .job time {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--dim);
  align-self: center;
}
#read .job p {
  grid-column: 1;
  margin: 0;
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  color: var(--dim);
  max-width: 560px;
}
#read .on {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  font-size: 20px;
}
#read .on a {
  color: inherit;
  text-underline-offset: 5px;
}
#read .on span {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--dim);
  align-self: center;
}
#read .about p {
  font-size: 22px;
  line-height: 1.55;
  margin: 0 0 24px;
  opacity: 0.9;
}
#read .about h2 {
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 26px;
  margin: 44px 0 12px;
}
@media (max-width: 640px) {
  #read header {
    gap: 10px;
    padding: 16px;
    flex-wrap: wrap;
  }
  #read header b {
    font-size: 16px;
    flex-basis: 100%;
  }
  #read header a {
    font-size: 15px;
    padding: 4px 5px;
  }
  #read main {
    padding: 20px 18px 80px;
  }
  #read .job {
    grid-template-columns: 1fr;
  }
}
#msg.fatal {
  z-index: 7;
  pointer-events: auto;
  background: var(--bg);
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  text-align: center;
}
#msg.fatal a {
  color: var(--accent);
}
