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

:root {
  --green:       #00ff41;
  --green-dim:   #005512;
  --green-dark:  #003308;
  --bg:          #0d0d0d;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--green);
  font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: default;
}

/* ── Domain label ───────────────────────────────────────────── */
#domain {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--green-dim);
  letter-spacing: 0.3em;
  white-space: nowrap;
  transition: color 0.5s ease, font-size 0.5s ease, letter-spacing 0.5s ease;
}

/* ── Message area ───────────────────────────────────────────── */
#message-area {
  position: fixed;
  top: 4rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
}

#message {
  background: var(--bg);
  border: 1px solid var(--green-dim);
  padding: 0.75rem 1.25rem;
  font-size: 0.8rem;
  line-height: 1.8;
  max-width: min(600px, 90vw);
  white-space: pre-wrap;
  text-align: left;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#message.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Blinking cursor ────────────────────────────────────────── */
#terminal {
  display: flex;
  align-items: center;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
}

#prompt {
  color: var(--green-dim);
}

#cursor {
  animation: blink 1s step-end infinite;
  cursor: pointer;
}

#cursor:hover {
  color: #ffffff;
}

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

/* ── Progress bar ───────────────────────────────────────────── */
#progress-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--green);
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 0.5s ease;
  white-space: nowrap;
}

#progress-bar.visible {
  opacity: 1;
}

#progress-bar.pulse {
  animation: progress-pulse 0.6s ease;
}

@keyframes progress-pulse {
  0%   { transform: translateX(-50%) scale(1);    color: var(--green); }
  40%  { transform: translateX(-50%) scale(1.06); color: #ffffff; }
  100% { transform: translateX(-50%) scale(1);    color: var(--green); }
}

/* ── Custom context menu ────────────────────────────────────── */
#context-menu {
  position: fixed;
  display: none;
  background: var(--bg);
  border: 1px solid var(--green);
  z-index: 1000;
  min-width: 200px;
}

#context-menu.visible {
  display: block;
}

#context-option {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--green);
}

#context-option:hover {
  background: var(--green);
  color: var(--bg);
}

/* ── Matrix rain canvas ─────────────────────────────────────── */
#matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  display: none;
  z-index: 500;
}

#matrix-canvas.visible {
  display: block;
}

/* ── BSOD ───────────────────────────────────────────────────── */
#bsod {
  position: fixed;
  inset: 0;
  background: #0000aa;
  color: #ffffff;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 900;
  text-align: center;
  gap: 1rem;
  padding: 2rem;
}

#bsod.visible {
  display: flex;
}

#bsod-sad {
  font-size: 5rem;
  line-height: 1;
  margin-bottom: 1rem;
}

#bsod p {
  font-size: 1rem;
  line-height: 1.8;
  max-width: 480px;
}

#bsod-pct {
  margin-top: 1.5rem;
  font-size: 1.2rem;
}

/* ── Final reveal ───────────────────────────────────────────── */
#final-reveal {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 950;
  text-align: center;
}

#final-reveal.visible {
  display: flex;
  animation: fade-in 1.2s ease;
}

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

#final-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

#fireworks {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--green);
  min-height: 7em;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
}

#final-text {
  font-size: 1.1rem;
  line-height: 2.4;
  color: var(--green);
}

#final-progress {
  font-size: 0.72rem;
  color: var(--green-dim);
  letter-spacing: 0.08em;
}
