*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #e53e3e;
  --primary-dim: rgba(229,62,62,0.12);
  --primary-glow: rgba(229,62,62,0.4);
  --gold: #f6c90e;
  --accent: #fc8181;
  --bg: #0a0a0a;
  --bg-card: #111111;
  --bg-raised: #1a1a1a;
  --border: rgba(255,255,255,0.07);
  --border-lit: rgba(229,62,62,0.35);
  --text: #f0f0f0;
  --text-muted: #6b6b6b;
  --text-sub: #9a9a9a;
  --mono: 'Space Mono', monospace;
  --sans: 'DM Sans', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.bg-mesh { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.bg-mesh::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(229,62,62,0.055) 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 20% 80%, rgba(246,201,14,0.03) 0%, transparent 55%),
    radial-gradient(ellipse 50% 50% at 80% 20%, rgba(229,62,62,0.03) 0%, transparent 60%);
}
.bg-mesh::after {
  content: '';
  position: absolute; inset: -50%; width: 200%; height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.022;
}

.grid-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, rgba(0,0,0,0.6) 0%, transparent 100%);
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}
.a1 { animation: fade-up 0.7s ease both 0.05s; }
.a2 { animation: fade-up 0.7s ease both 0.14s; }
.a3 { animation: fade-up 0.7s ease both 0.22s; }
.a4 { animation: fade-up 0.7s ease both 0.30s; }
.a5 { animation: fade-up 0.7s ease both 0.38s; }
.a6 { animation: fade-up 0.7s ease both 0.44s; }
.a7 { animation: fade-up 0.7s ease both 0.50s; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 0.68rem; color: var(--gold);
  border: 1px solid rgba(246,201,14,0.28); background: rgba(246,201,14,0.07);
  padding: 5px 16px; border-radius: 40px;
  margin-bottom: 28px; letter-spacing: 0.1em; text-transform: uppercase;
}
.eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--gold);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.err-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 0.68rem; color: var(--primary);
  border: 1px solid rgba(229,62,62,0.28); background: rgba(229,62,62,0.07);
  padding: 5px 16px; border-radius: 40px;
  margin-bottom: 28px; letter-spacing: 0.1em; text-transform: uppercase;
}

#page-retired, #page-error {
  display: none; position: relative; z-index: 1;
  min-height: 100vh; flex-direction: column;
}

.hero {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 72px 64px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.hero-left { display: flex; flex-direction: column; align-items: flex-start; }

.hero-headline {
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 700; letter-spacing: -0.05em; line-height: 1.08; margin-bottom: 20px;
}
.hero-headline em { font-style: normal; color: var(--primary); }

.hero-msg {
  font-size: 0.95rem; color: var(--text-sub); line-height: 1.85;
  font-weight: 300; max-width: 380px;
}

.err-code {
  font-family: var(--mono); font-size: clamp(4rem, 10vw, 7rem);
  font-weight: 700; letter-spacing: -0.06em; line-height: 1;
  background: linear-gradient(180deg, #2a2a2a 0%, #161616 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  position: relative; margin-bottom: 8px; display: block;
}
.err-code::after {
  content: attr(data-text); position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(229,62,62,0.2) 0%, transparent 60%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.terminal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.terminal-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-dot.red { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green { background: #28c840; }
.terminal-title {
  font-family: var(--mono); font-size: 0.62rem; color: var(--text-muted);
  letter-spacing: 0.08em; margin-left: auto; margin-right: auto;
}

.terminal-body {
  padding: 20px 22px;
  font-family: var(--mono); font-size: 0.75rem;
  line-height: 1.8; color: var(--text-sub);
  min-height: 200px;
}

.t-line { display: flex; gap: 8px; }
.t-prompt { color: var(--primary); flex-shrink: 0; }
.t-cmd { color: var(--text-sub); }
.t-out { color: var(--text-muted); padding-left: 16px; }
.t-key { color: var(--gold); }
.t-val { color: var(--text); }
.t-err { color: var(--primary); }
.t-cursor {
  display: inline-block; width: 7px; height: 13px;
  background: var(--primary); margin-left: 2px; vertical-align: middle;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

.err-info-row {
  width: 100%; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(3,1fr);
}
.err-info-cell { padding: 28px 32px; text-align: center; border-right: 1px solid var(--border); }
.err-info-cell:last-child { border-right: none; }
.err-info-cell-label { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.err-info-cell-val { font-size: 0.9rem; color: var(--text-sub); }
.err-info-cell-val.mono { font-family: var(--mono); font-size: 0.78rem; color: var(--primary); }

.err-actions { padding: 56px 48px; max-width: 1100px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; align-items: center; }
.err-actions-label { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 20px; }
.err-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 0.72rem; color: var(--text);
  text-decoration: none; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--primary); border: 1px solid var(--primary);
  padding: 14px 28px; border-radius: 40px; transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 0.72rem; color: var(--text-sub);
  text-decoration: none; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 14px 28px; border-radius: 40px; transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover { border-color: rgba(255,255,255,0.15); color: var(--text); }
.btn-primary svg, .btn-secondary svg { width: 12px; height: 12px; flex-shrink: 0; }

.err-footer {
  margin-top: auto; width: 100%; border-top: 1px solid var(--border); padding: 28px 48px;
  display: flex; align-items: center; justify-content: space-between;
}
.err-footer-note { font-family: var(--mono); font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.08em; }
.err-footer-note strong { color: var(--text-sub); font-weight: 400; }

@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; padding: 48px 24px; gap: 32px; }
  .hero-headline { font-size: clamp(2rem, 8vw, 2.8rem); }
  .err-info-row { grid-template-columns: 1fr; }
  .err-info-cell { border-right: none; border-bottom: 1px solid var(--border); }
  .err-info-cell:last-child { border-bottom: none; }
  .err-actions { padding: 40px 20px; }
  .err-footer { padding: 20px; flex-direction: column; gap: 12px; }
}
@media (max-width: 480px) {
  .err-buttons { flex-direction: column; width: 100%; }
  .btn-primary, .btn-secondary { justify-content: center; }
}