/* =============================
   Variables
============================= */
:root {
  --crt-green: #77ff66;
  --bg: #000;
  --font: "Courier New", monospace;
}

/* =============================
   Base Page Styles
============================= */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  background-color: var(--bg);
  color: var(--crt-green);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =============================
   Page Container
============================= */
.page {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: visible;
  animation: crtShake 0.25s infinite;
  filter: contrast(1.1) brightness(0.95);
}

/* =============================
   Content Area
============================= */
.content {
  position: relative;
  width: min(1100px, 95vw);
  margin: 0 auto;
  padding: 36px;
  box-sizing: border-box;
}

h1 {
  font-size: 2.2rem;
  margin: 0 0 8px 0;
}

.info {
  font-size: 1.2rem;
  margin: 10px 0;
}

ul {
  margin: 10px 0 60px 20px;
  padding-left: 0;
  font-size: 1.05rem;
}

ul li::before {
  content: "› ";
}

/* =============================
   Organelle Image
============================= */
#organelle-image {
  position: absolute;
  top: 36px;
  right: 36px;
  width: 220px;
  height: auto;
  border: 2px solid var(--crt-green);
  background: rgba(0, 0, 0, 0.2);
  padding: 6px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* =============================
   Return Button
============================= */
#return-btn {
  position: fixed;
  left: 50%;
  bottom: 36px; /* buffer from bottom */
  transform: translateX(-50%);
  background: none;
  border: none;
  color: var(--crt-green);
  font-family: var(--font);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  white-space: nowrap;
}

#return-btn:hover {
  text-decoration: underline;
}

/* =============================
   Typing Blocks
============================= */
.typed-block {
  min-height: 1.4em;
  white-space: pre;
}

.cursor {
  display: inline-block;
  width: 10px;
  height: 1.1em;
  background: var(--crt-green);
  margin-left: 6px;
  animation: blink 0.8s infinite;
  vertical-align: middle;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* =============================
   CRT Shake Animation
============================= */
@keyframes crtShake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(0.3px, -0.3px); }
  50% { transform: translate(-0.3px, 0.3px); }
  75% { transform: translate(0.3px, 0.3px); }
}

/* =============================
   Crash Overlay
============================= */
.crash-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none; /* revealed when crash triggers */
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.crash-white {
  position: absolute;
  inset: 0;
  background: white;
  transition: background 0.25s ease;
  z-index: 1;
}

.crash-content {
  position: relative;
  z-index: 2;
  color: var(--crt-green);
  font-family: var(--font);
  text-align: center;
  pointer-events: none;
  width: 90%;
  max-width: 1200px;
}

.crash-line {
  font-size: 1.25rem;
  line-height: 1.4rem;
  opacity: 0;
  text-shadow: 0 0 16px rgba(119, 255, 102, 0.6),
               0 0 2px rgba(119, 255, 102, 0.25);
}

.fragment {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 40%;
  font-size: 1.15rem;
  opacity: 0;
  mix-blend-mode: screen;
}

.fatal {
  margin-top: 12px;
  font-size: 1.6rem;
  font-weight: bold;
  letter-spacing: 1px;
  opacity: 0;
}

.hint {
  margin-top: 8px;
  font-size: 1rem;
  opacity: 0;
}

.visible { opacity: 1; transition: opacity 0.12s linear; }
.burst { opacity: 1; transition: opacity 0.06s linear; }
.glitch { letter-spacing: 1px; filter: blur(0.4px) contrast(1.2); }

/* =============================
   CRT Shutdown Animation
============================= */
@keyframes crtShutdown {
  0% { transform: scaleY(1); opacity: 1; }
  90% { transform: scaleY(0.02); opacity: 1; }
  100% { transform: scaleY(0); opacity: 0; }
}

.shutdown {
  animation: crtShutdown 0.7s forwards;
  transform-origin: center;
}

/* =============================
   Responsive tweaks
============================= */
@media (max-width: 700px) {
  #organelle-image { width: 140px; right: 14px; top: 14px; }
  h1 { font-size: 1.4rem; }
  .info { font-size: 1rem; }
  .crash-line { font-size: 1rem; }
  .fatal { font-size: 1.2rem; }
}
