:root {
  color-scheme: dark;
  --black: #020201;
  --monitor: #0a0803;
  --amber: #e1a24b;
  --amber-bright: #ffd27a;
  --amber-dim: #8d622d;
  --signal: #c9d3c7;
  --danger: #b77059;
  font-family: "Courier New", Courier, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--black);
}

body {
  min-height: 100vh;
  margin: 0;
  background: #000;
}

button,
input {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.terminal-page {
  overflow: hidden;
}

.scene {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 46%, rgba(95, 55, 17, 0.1), transparent 44%),
    #000;
}

.scene::after {
  position: fixed;
  z-index: 4;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, 0.48) 75%, #000 110%);
  content: "";
  pointer-events: none;
}

.computer-wrap {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  opacity: 0;
  animation: scene-in 2.6s 0.35s ease-out forwards;
}

.computer-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}

.monitor {
  position: absolute;
  top: 20.2%;
  left: 29.5%;
  width: 40.3%;
  height: 30.8%;
  overflow: hidden;
  background: transparent;
  color: var(--amber);
  text-shadow: 0 0 0.45em rgba(225, 162, 75, 0.42);
  transition: filter 180ms ease, background-color 180ms ease;
}

.monitor::before {
  position: absolute;
  z-index: 5;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 195, 100, 0.025) 0 1px, transparent 1px 4px);
  content: "";
  pointer-events: none;
}

.monitor::after {
  position: absolute;
  z-index: 6;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 191, 86, 0.025), transparent);
  content: "";
  opacity: 0.45;
  pointer-events: none;
  animation: crt-flicker 6s steps(1) infinite;
}

.monitor.is-transferring {
  background-color: transparent;
  filter: brightness(1.08) saturate(0.9);
}

.monitor-noise {
  position: absolute;
  z-index: 3;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
  pointer-events: none;
  animation: noise-shift 0.25s steps(2) infinite;
}

.boot-panel,
.recovered-panel {
  position: absolute;
  z-index: 2;
  inset: 0;
}

.boot-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8% 9%;
  letter-spacing: 0.12em;
  font-size: clamp(8px, 0.85vw, 17px);
  opacity: 0;
}

.boot-panel.is-active {
  animation: panel-in 0.55s ease forwards;
}

.boot-panel p {
  margin: 0;
}

.system-label {
  color: var(--amber-bright);
  font-size: 1.18em;
}

.recovery-label {
  margin-top: 1.35em !important;
  color: var(--amber-dim);
  font-size: 0.82em;
}

.progress-track {
  height: 0.48em;
  margin-top: 2.3em;
  overflow: hidden;
  border: 1px solid rgba(225, 162, 75, 0.48);
  background: rgba(225, 162, 75, 0.05);
}

.progress-fill {
  width: 100%;
  height: 100%;
  background: var(--amber);
  box-shadow: 0 0 0.8em rgba(255, 193, 93, 0.58);
  transform: scaleX(0);
  transform-origin: left center;
}

.progress-value {
  margin-top: 0.8em !important;
  align-self: flex-end;
  font-size: 0.74em;
}

.boot-panel.is-complete {
  animation: panel-out 0.55s ease forwards;
}

.recovered-panel {
  display: grid;
  grid-template-columns: 48% 52%;
  grid-template-rows: auto 1fr auto;
  padding: 5.5% 7% 5%;
  opacity: 0;
}

.recovered-panel.is-visible {
  animation: panel-in 0.8s ease forwards;
}

.recovered-title {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--amber-bright);
  letter-spacing: 0.12em;
  font-size: clamp(7px, 0.72vw, 14px);
}

.file-object {
  display: grid;
  min-width: 0;
  place-items: center;
}

.recovered-link {
  display: block;
  width: 79%;
  cursor: default;
  outline: none;
  text-decoration: none;
  user-select: none;
  -webkit-user-drag: element;
}

.recovered-logo {
  display: block;
  width: 100%;
  height: auto;
  filter: sepia(1) saturate(1.35) hue-rotate(345deg) brightness(0.9) drop-shadow(0 0 0.65em rgba(222, 159, 70, 0.25));
  opacity: 0;
  user-select: none;
  -webkit-user-drag: none;
  animation: logo-recover 1.05s 0.35s steps(1, end) forwards;
}

.recovered-link:active {
  cursor: default;
}

.file-object.is-leaving .recovered-logo {
  animation: file-leave 0.45s ease forwards;
}

.file-data {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.8em;
  margin: 0;
  font-size: clamp(6px, 0.58vw, 12px);
  letter-spacing: 0.08em;
}

.file-data div {
  display: grid;
  grid-template-columns: 44% 56%;
}

.file-data dt {
  color: var(--amber-dim);
}

.file-data dd {
  margin: 0;
  color: var(--amber-bright);
}

.terminal-line {
  grid-column: 1 / -1;
  margin: 0;
  font-size: clamp(6px, 0.56vw, 11px);
  letter-spacing: 0.055em;
  white-space: nowrap;
}

.cursor {
  color: var(--amber-bright);
  animation: cursor-blink 0.85s steps(1) infinite;
}

.node-sync {
  position: fixed;
  z-index: 5;
  top: 50%;
  right: clamp(16px, 2.5vw, 48px);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: flex-end;
  color: rgba(220, 174, 103, 0.43);
  font-size: clamp(7px, 0.55vw, 10px);
  letter-spacing: 0.16em;
  opacity: 0;
  animation: node-in 1s 3.5s ease forwards;
}

.qr-frame {
  position: relative;
  display: block;
  width: clamp(72px, 6.2vw, 104px);
  aspect-ratio: 1;
  border: 1px solid rgba(220, 174, 103, 0.24);
  background:
    linear-gradient(90deg, rgba(220, 174, 103, 0.12) 1px, transparent 1px) 0 0 / 25% 100%,
    linear-gradient(rgba(220, 174, 103, 0.12) 1px, transparent 1px) 0 0 / 100% 25%;
}

.qr-frame::before,
.qr-frame::after {
  position: absolute;
  width: 28%;
  height: 28%;
  content: "";
}

.qr-frame::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid rgba(225, 162, 75, 0.7);
  border-left: 1px solid rgba(225, 162, 75, 0.7);
}

.qr-frame::after {
  right: -1px;
  bottom: -1px;
  border-right: 1px solid rgba(225, 162, 75, 0.7);
  border-bottom: 1px solid rgba(225, 162, 75, 0.7);
}

.qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.82;
}

.mobile-block {
  display: none;
}

.signal-page,
.access-page {
  color: var(--signal);
  background:
    linear-gradient(rgba(255, 255, 255, 0.012), rgba(255, 255, 255, 0.012)),
    #030504;
}

.signal-page::before,
.access-page::before {
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(205, 220, 204, 0.018) 3px 4px),
    radial-gradient(circle at 50% 20%, rgba(104, 132, 102, 0.07), transparent 55%);
  content: "";
  pointer-events: none;
}

.signal-main {
  position: relative;
  width: min(100% - 2.5rem, 760px);
  margin: 0 auto;
  padding: clamp(4rem, 10vw, 8rem) 0;
}

.signal-main h1 {
  margin: 0 0 4rem;
  color: #e0e6de;
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  font-weight: 400;
  letter-spacing: 0.16em;
}

.riddles {
  display: grid;
  gap: 3rem;
}

.riddle h2 {
  margin: 0 0 1rem;
  color: #7f9180;
  font-size: 1rem;
  font-weight: 400;
}

.riddle p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 3.2vw, 1.18rem);
  line-height: 1.85;
  white-space: pre-line;
}

.access-main {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  text-align: center;
}

.access-main h1 {
  margin: 0 0 2.5rem;
  color: #dbe2d9;
  font-size: clamp(1rem, 4vw, 1.35rem);
  font-weight: 400;
  letter-spacing: 0.16em;
}

.code-entry {
  position: relative;
  width: min(88vw, 330px);
}

.code-input {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  opacity: 0;
  caret-color: transparent;
  cursor: text;
}

.code-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.9rem, 5vw, 1.7rem);
  pointer-events: none;
}

.code-slot {
  display: grid;
  height: 3.5rem;
  place-items: center;
  border-bottom: 1px solid #718071;
  color: #e6ece4;
  font-size: 1.7rem;
  text-shadow: 0 0 0.6rem rgba(190, 219, 187, 0.3);
}

.code-entry:focus-within .code-slot {
  border-bottom-color: #b8c7b6;
}

.access-result {
  min-height: 1.5em;
  margin: 2rem 0 0;
  color: #a9bca8;
  letter-spacing: 0.13em;
}

.access-result.is-denied {
  color: var(--danger);
}

.final-message {
  width: min(100%, 650px);
  margin-top: 2.8rem;
  color: #cbd4c9;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 3.5vw, 1.14rem);
  line-height: 1.8;
  animation: panel-in 1s ease both;
}

.final-message p {
  margin: 0 0 1rem;
}

@keyframes scene-in {
  from { opacity: 0; filter: brightness(0.35); }
  to { opacity: 1; filter: brightness(1); }
}

@keyframes panel-out {
  to { opacity: 0; transform: scale(0.99); }
}

@keyframes panel-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes logo-recover {
  0%, 18% { opacity: 0; transform: translateX(-1.5%); clip-path: inset(18% 0 65% 0); }
  19%, 42% { opacity: 0.55; transform: translateX(1%); clip-path: inset(52% 0 28% 0); }
  43%, 64% { opacity: 0.28; transform: translateX(-0.5%); clip-path: inset(8% 0 12% 0); }
  65%, 82% { opacity: 0.75; transform: translateX(0.5%); clip-path: inset(0); }
  83%, 100% { opacity: 0.9; transform: translateX(0); clip-path: inset(0); }
}

@keyframes file-leave {
  to { opacity: 0.08; transform: scale(0.86) translateY(-10%); filter: blur(2px) sepia(1); }
}

@keyframes cursor-blink {
  50% { opacity: 0; }
}

@keyframes crt-flicker {
  0%, 95%, 100% { opacity: 0.42; }
  96% { opacity: 0.18; }
  97% { opacity: 0.58; }
}

@keyframes noise-shift {
  0% { transform: translate3d(-2%, 1%, 0); }
  50% { transform: translate3d(2%, -1%, 0); }
  100% { transform: translate3d(0, 2%, 0); }
}

@keyframes node-in {
  to { opacity: 1; }
}

@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  .terminal-page {
    overflow: auto;
  }

  .scene {
    display: none;
  }

  .mobile-block {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    color: #b99155;
    background:
      repeating-linear-gradient(0deg, transparent 0 3px, rgba(225, 162, 75, 0.025) 3px 4px),
      #030201;
    font-size: clamp(0.72rem, 3.4vw, 0.95rem);
    letter-spacing: 0.1em;
    line-height: 1.7;
  }

  .mobile-block p {
    margin: 0 0 0.7rem;
  }
}

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


/* Final polish: QR is baked into computer.webp, so the old HTML QR marker is disabled. */
.node-sync {
  display: none !important;
  pointer-events: none !important;
}

/* The monitor is only a positioning layer now: no filled rectangle over the in-game screen. */
.monitor {
  background: transparent !important;
}

.monitor.is-transferring {
  background-color: transparent !important;
  filter: brightness(1.08) saturate(0.9);
}

/* Final final polish: remove all monitor overlay layers.
   The monitor remains only as an invisible positioning container for text, logo, and boot animation. */
.monitor,
.monitor.is-transferring {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  filter: none !important;
}

.monitor::before,
.monitor::after,
.monitor.is-transferring::before,
.monitor.is-transferring::after {
  display: none !important;
  content: none !important;
  background: none !important;
  opacity: 0 !important;
  box-shadow: none !important;
}

.monitor-noise {
  display: none !important;
  opacity: 0 !important;
  background: none !important;
  animation: none !important;
}

/* Keep drag feedback only in text and logo, without any screen-wide rectangle. */
.monitor.is-transferring .file-data,
.monitor.is-transferring .terminal-line {
  text-shadow: 0 0 0.65em rgba(255, 210, 122, 0.45);
}

.monitor.is-transferring .recovered-title {
  text-shadow: 0 0 0.5em rgba(255, 210, 122, 0.35);
}
.drag-ghost {
  cursor: default !important;
}

.drag-ghost .recovered-logo {
  opacity: 0.9 !important;
  animation: none !important;
  filter: sepia(1) saturate(1.35) hue-rotate(345deg) brightness(0.9)
    drop-shadow(0 0 0.65em rgba(222, 159, 70, 0.25));
}
.recovered-link,
.recovered-link:hover,
.recovered-link:active,
.recovered-logo,
.recovered-logo:hover,
.recovered-logo:active {
  cursor: default !important;
}