* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: #fff;
}

.white-room {
  display: grid;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
}

.signal-door {
  display: block;
  line-height: 0;
  cursor: pointer;
}

.signal-stack {
  position: relative;
  display: block;
  width: min(76vw, 390px);
  transition: transform 500ms ease;
}

.signal {
  display: block;
  width: 100%;
  height: auto;
}

.signal--inverse {
  position: absolute;
  inset: 0;
  opacity: 0;
  filter: invert(1) grayscale(1) contrast(1.08);
  clip-path: inset(22.4% 22.9% 35.4% 23.2% round 2.2%);
  transition: opacity 420ms ease;
}

.interrupted-screen {
  position: absolute;
  z-index: 2;
  top: 22.4%;
  right: 22.9%;
  bottom: 35.4%;
  left: 23.2%;
  display: grid;
  place-items: center;
  border-radius: 2.2%;
  background: #050505;
  color: #f5f5f5;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(6px, 1.8vw, 10px);
  line-height: 1;
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 420ms ease;
}

.signal-door:hover .signal-stack,
.signal-door:focus-visible .signal-stack {
  transform: scale(1.018);
}

.signal-door:hover .signal--inverse,
.signal-door:focus-visible .signal--inverse,
.is-interrupted .signal--inverse,
.is-interrupted .interrupted-screen {
  opacity: 1;
}

.signal-door:focus-visible {
  outline: 1px dotted #777;
  outline-offset: 14px;
}

.text-file,
.layer-file {
  min-height: 100svh;
  padding: 22px 28px 36px;
  overflow-x: auto;
  background: #fff;
  color: #111;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.file-header,
.layer-header {
  display: flex;
  justify-content: space-between;
  min-width: 660px;
  padding-bottom: 8px;
  border-bottom: 1px solid #111;
  letter-spacing: 0.08em;
}

.file-body,
.layer-body {
  width: max-content;
  min-width: 620px;
  margin: 48px auto 0;
}

.layer-body {
  width: min(680px, max-content);
  margin-top: 64px;
}

.file-path,
.file-note,
.live-line,
.layer-path,
.layer-note,
.log-line,
.sequence-row,
.future-line {
  margin: 0;
}

.file-note,
.layer-note {
  margin-top: 4px;
  color: #777;
}

.file-body pre {
  margin: 30px 0 20px;
  font: inherit;
  line-height: 1.22;
}

.live-line {
  letter-spacing: 0.14em;
}

.edge-girl-link {
  position: fixed;
  z-index: 0;
  bottom: -168px;
  left: -152px;
  width: clamp(330px, 46vw, 610px);
  line-height: 0;
  opacity: 0.32;
  filter: grayscale(1) contrast(1.18);
  transition: opacity 700ms ease, filter 700ms ease;
}

.edge-girl {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.edge-girl-link:hover,
.edge-girl-link:focus-visible {
  opacity: 0.5;
  filter: grayscale(1) contrast(1.4);
}

.edge-girl-link:focus-visible {
  outline: 1px dotted #777;
  outline-offset: -90px;
}

.file-header,
.file-body,
.return-link {
  position: relative;
  z-index: 1;
}

.cursor {
  display: inline-block;
  animation: cursor-blink 1.1s steps(1, end) infinite;
}

.return-link,
.layer-return {
  position: fixed;
  z-index: 3;
  right: 28px;
  bottom: 23px;
  color: #777;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  text-decoration: none;
}

.return-link:hover,
.return-link:focus-visible,
.layer-return:hover,
.layer-return:focus-visible {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.log-block {
  margin-top: 54px;
}

.log-line {
  min-height: 1.5em;
  margin-top: 9px;
  color: #555;
}

.log-line:nth-child(2) {
  margin-left: 31px;
}

.log-line:nth-child(3) {
  margin-left: 13px;
}

.small-drawing {
  margin: 38px 0 0;
  color: #333;
  font: inherit;
  line-height: 1.2;
}

.sequence-row {
  display: flex;
  align-items: center;
  gap: 1.1em;
  margin-top: 50px;
  padding: 15px 0;
  border-top: 1px dotted #bbb;
  border-bottom: 1px dotted #bbb;
  letter-spacing: 0.12em;
}

.missing-term,
.fracture-link {
  color: #111;
  text-decoration: none;
}

.missing-term {
  display: inline-block;
  min-width: 72px;
  padding: 0 4px;
  animation: missing-pulse 2.6s steps(1, end) infinite;
}

.missing-term:hover,
.missing-term:focus-visible,
.fracture-link:hover,
.fracture-link:focus-visible {
  color: #fff;
  background: #111;
  outline: none;
}

.operator-note {
  margin: 18px 0 0;
  color: #777;
}

.tomorrow-body {
  position: relative;
  min-height: 510px;
}

.future-fragments {
  position: relative;
  height: 285px;
  margin-top: 55px;
}

.future-line {
  position: absolute;
  color: #777;
}

.future-line:nth-child(1) {
  top: 0;
  left: 34px;
}

.future-line:nth-child(2) {
  top: 74px;
  left: 264px;
}

.future-line:nth-child(3) {
  top: 154px;
  left: 81px;
}

.future-line:nth-child(4) {
  top: 230px;
  left: 350px;
}

.already-seen {
  margin: 0 0 0 112px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.fracture-link {
  display: inline-block;
  margin: 58px 0 0 414px;
  padding: 2px 4px;
  color: #777;
  letter-spacing: 0.08em;
}

.afterimage {
  min-height: 100svh;
  overflow: hidden;
  background: #050505;
  color: #f4f4f4;
  font-family: "Courier New", Courier, monospace;
}

.afterimage::before {
  position: fixed;
  z-index: 4;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 3px, rgb(255 255 255 / 4%) 4px);
  pointer-events: none;
  content: "";
}

.afterimage-shell {
  position: relative;
  min-width: 680px;
  min-height: 100svh;
  padding: 22px 28px 34px;
}

.afterimage-header {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid #f4f4f4;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.afterimage-body {
  position: relative;
  width: 680px;
  margin: 7vh auto 0;
}

.fault-code {
  color: #8a8a8a;
  font-size: 11px;
  white-space: pre;
}

.ghost-stack {
  position: relative;
  width: max-content;
  margin: 7vh auto 0;
}

.ghost-girl {
  position: relative;
  z-index: 2;
  margin: 0;
  color: #f5f5f5;
  font: 12px/1.06 "Courier New", Courier, monospace;
  animation: signal-tear 5.3s steps(1, end) infinite;
}

.ghost-girl--echo {
  position: absolute;
  z-index: 1;
  inset: 0;
  color: #707070;
  opacity: 0.56;
  transform: translate(7px, -3px);
  animation: echo-slip 3.7s steps(1, end) infinite;
}

.glitch-title {
  position: relative;
  width: max-content;
  margin: 46px auto 0;
  font-size: clamp(15px, 2vw, 21px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  animation: title-flicker 4.9s steps(1, end) infinite;
}

.glitch-title::before,
.glitch-title::after {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: #777;
  content: attr(data-echo);
  pointer-events: none;
}

.glitch-title::before {
  clip-path: inset(0 0 56% 0);
  transform: translate(-3px, 0);
}

.glitch-title::after {
  clip-path: inset(63% 0 0 0);
  transform: translate(4px, 0);
}

.answer {
  margin: 18px 0 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.35em;
}

.looking-back {
  margin: 42px 0 0;
  color: #8a8a8a;
  text-align: center;
  font-size: 11px;
}

.number-ribbon {
  position: fixed;
  right: -52px;
  bottom: 76px;
  color: #5f5f5f;
  font-size: 10px;
  letter-spacing: 0.28em;
  transform: rotate(-90deg);
  transform-origin: center;
}

.source-link {
  position: fixed;
  z-index: 5;
  right: 28px;
  bottom: 23px;
  color: #aaa;
  font-size: 11px;
  text-decoration: none;
}

.source-link:hover,
.source-link:focus-visible {
  color: #050505;
  background: #f4f4f4;
  outline: none;
}

@keyframes cursor-blink {
  0%,
  52% {
    opacity: 1;
  }
  53%,
  100% {
    opacity: 0;
  }
}

@keyframes missing-pulse {
  0%,
  81% {
    background: transparent;
  }
  82%,
  87% {
    background: #eee;
  }
  88%,
  100% {
    background: transparent;
  }
}

@keyframes signal-tear {
  0%,
  83%,
  100% {
    transform: translate(0);
  }
  84% {
    transform: translate(-8px, 1px);
  }
  85% {
    transform: translate(5px, -1px);
  }
  87% {
    transform: translate(0);
  }
}

@keyframes echo-slip {
  0%,
  72%,
  100% {
    opacity: 0.28;
    transform: translate(7px, -3px);
  }
  73% {
    opacity: 0.7;
    transform: translate(-11px, 2px);
  }
  76% {
    opacity: 0.16;
    transform: translate(14px, -1px);
  }
}

@keyframes title-flicker {
  0%,
  89%,
  92%,
  100% {
    opacity: 1;
  }
  90% {
    opacity: 0.3;
  }
  91% {
    opacity: 0.72;
  }
}

@media (max-width: 700px) {
  .signal-stack {
    width: min(86vw, 390px);
  }

  .text-file,
  .layer-file {
    padding: 16px 16px 88px;
    overflow-x: hidden;
    font-size: clamp(9px, 2.5vw, 11px);
  }

  .file-header,
  .layer-header {
    min-width: 0;
    width: 100%;
    gap: 18px;
  }

  .file-body,
  .layer-body {
    width: 100%;
    min-width: 0;
    max-width: 680px;
    margin-top: 34px;
  }

  .file-body {
    max-width: 620px;
  }

  .file-body pre {
    max-width: 100%;
    overflow: hidden;
    font-size: clamp(6px, 2.05vw, 9px);
  }

  .layer-path,
  .layer-note,
  .operator-note {
    overflow-wrap: anywhere;
  }

  .log-line:nth-child(2) {
    margin-left: 18px;
  }

  .log-line:nth-child(3) {
    margin-left: 7px;
  }

  .small-drawing {
    max-width: 100%;
    overflow: hidden;
    font-size: clamp(7px, 2.15vw, 10px);
  }

  .sequence-row {
    flex-wrap: wrap;
    gap: 8px 15px;
    max-width: 100%;
    margin-top: 38px;
    letter-spacing: 0.08em;
  }

  .missing-term {
    display: inline-flex;
    min-width: 82px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    margin: -9px 0;
  }

  .tomorrow-body {
    min-height: 0;
  }

  .future-fragments {
    display: flex;
    height: auto;
    flex-direction: column;
    gap: 30px;
    margin-top: 48px;
  }

  .future-line:nth-child(1),
  .future-line:nth-child(2),
  .future-line:nth-child(3),
  .future-line:nth-child(4) {
    position: static;
    inset: auto;
  }

  .future-line:nth-child(2) {
    margin-left: 14%;
  }

  .future-line:nth-child(3) {
    margin-left: 5%;
  }

  .future-line:nth-child(4) {
    margin-left: 19%;
  }

  .already-seen {
    margin: 58px 0 0;
    text-align: center;
  }

  .fracture-link {
    display: flex;
    width: max-content;
    min-height: 44px;
    align-items: center;
    margin: 42px 7% 0 auto;
    padding: 8px 10px;
  }

  .return-link,
  .layer-return {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 8px 10px;
    background: rgb(255 255 255 / 90%);
  }

  .edge-girl-link {
    bottom: -72px;
    left: -78px;
    width: min(82vw, 330px);
    opacity: 0.24;
  }

  .afterimage-shell {
    width: 100%;
    min-width: 0;
    padding: 16px 16px 88px;
  }

  .afterimage-body {
    width: 100%;
    margin-top: 5vh;
  }

  .afterimage-header {
    gap: 18px;
    font-size: clamp(9px, 2.5vw, 11px);
  }

  .fault-code {
    font-size: clamp(8px, 2.35vw, 10px);
  }

  .ghost-stack {
    max-width: 100%;
    margin-top: 6vh;
  }

  .ghost-girl {
    font-size: clamp(7px, 2.15vw, 10px);
  }

  .glitch-title {
    max-width: 100%;
    margin-top: 38px;
    text-align: center;
    font-size: clamp(12px, 3.7vw, 17px);
    letter-spacing: 0.12em;
  }

  .looking-back {
    max-width: 260px;
    margin-right: auto;
    margin-left: auto;
    line-height: 1.6;
  }

  .number-ribbon {
    right: -78px;
    opacity: 0.72;
  }

  .afterimage .source-link {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 8px 10px;
    color: #ccc;
    background: rgb(5 5 5 / 92%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .signal-stack,
  .signal--inverse,
  .interrupted-screen,
  .edge-girl-link {
    transition: none;
  }

  .cursor,
  .missing-term,
  .ghost-girl,
  .ghost-girl--echo,
  .glitch-title {
    animation: none;
  }
}
