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

:root {
  --bg-dark: #0a0a0a;
  --bg-mid: #1a1a1a;
  --bg-light: #2a2a2a;
  --lcd-fg: #3a6a2a;
  --lcd-bg: #1a2a12;
  --lcd-bright-fg: #5aff3a;
  --lcd-bright-bg: #2a4a1a;
  --glow-cyan: #00ffcc;
  --scp-red: #cc0000;
  --amber: #ccaa00;
  --amber-dim: #997700;
  --text: #c0c0b0;
  --text-dim: #808070;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --font-typewriter: 'Special Elite', 'Courier New', monospace;
}

html, body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

body {
  position: relative;
}

#scanlines {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9998;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
}

#noise-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9997;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  animation: noiseShift 0.3s steps(3) infinite;
}

@keyframes noiseShift {
  0% { transform: translate(0,0); }
  33% { transform: translate(-5px, 3px); }
  66% { transform: translate(3px, -2px); }
  100% { transform: translate(0,0); }
}

/* HEADER */
#header {
  background: var(--bg-mid);
  border-bottom: 2px solid var(--scp-red);
  padding: 12px 20px;
  position: relative;
  overflow: hidden;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.logo-ascii {
  font-size: 7px;
  line-height: 1.1;
  color: var(--scp-red);
  white-space: pre;
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.header-text {
  position: relative;
  flex: 1;
}

.classified-watermark {
  position: absolute;
  top: -5px;
  right: 0;
  font-size: 40px;
  font-weight: 700;
  color: rgba(204, 0, 0, 0.08);
  transform: rotate(-8deg);
  letter-spacing: 12px;
  pointer-events: none;
  user-select: none;
}

h1 {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: #e0e0d0;
  letter-spacing: 1px;
}

h1 .subtitle {
  font-weight: 300;
  color: var(--text-dim);
  font-size: 14px;
}

.clearance {
  font-size: 11px;
  color: var(--scp-red);
  letter-spacing: 3px;
  margin-top: 2px;
  font-weight: 500;
}

/* MAIN */
#main-content {
  display: flex;
  gap: 24px;
  max-width: 1400px;
  margin: 20px auto;
  padding: 0 20px;
  align-items: flex-start;
}

/* ARTIFACT ZONE */
#artifact-zone {
  flex: 0 0 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: sticky;
  top: 20px;
}

#mug-container {
  position: relative;
  width: 340px;
  height: 420px;
}

#mug-canvas {
  width: 340px;
  height: 420px;
  display: block;
}

#channel-glow {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 200px;
  border: 1px solid rgba(0, 255, 204, 0.15);
  border-radius: 4px;
  box-shadow: 
    0 0 15px rgba(0, 255, 204, 0.05),
    inset 0 0 15px rgba(0, 255, 204, 0.03);
  pointer-events: none;
  animation: channelPulse 3s ease-in-out infinite;
}

@keyframes channelPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1.0; }
}

#button-container {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#game-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #3a3a3a, #1a1a1a 60%, #0a0a0a);
  border: 3px solid #2a2a2a;
  cursor: pointer;
  position: relative;
  box-shadow: 
    0 4px 12px rgba(0,0,0,0.8),
    inset 0 2px 4px rgba(255,255,255,0.05);
  transition: transform 0.05s, box-shadow 0.05s;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

#game-button:active, #game-button.pressed {
  transform: scale(0.94) translateY(2px);
  box-shadow: 
    0 1px 4px rgba(0,0,0,0.8),
    inset 0 2px 8px rgba(0,0,0,0.5);
}

.button-inner {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #2a2a2a, #111);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid #333;
}

.button-label {
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--text-dim);
  text-transform: uppercase;
}

#score-display {
  margin-top: 12px;
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--amber);
  font-weight: 500;
}

#high-score-mini {
  color: var(--amber-dim);
}

/* DOCUMENT ZONE */
#document-zone {
  flex: 1;
  min-width: 0;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 8px;
}

#document-zone::-webkit-scrollbar {
  width: 6px;
}
#document-zone::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
#document-zone::-webkit-scrollbar-thumb {
  background: var(--bg-light);
  border-radius: 3px;
}

.doc-section {
  background: var(--bg-mid);
  border: 1px solid #2a2a2a;
  border-left: 3px solid var(--scp-red);
  padding: 16px;
  margin-bottom: 12px;
}

.doc-header-bar {
  background: var(--scp-red);
  color: #fff;
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: 3px;
  font-weight: 700;
  margin: -16px -16px 12px -16px;
}

.doc-field {
  margin-bottom: 4px;
  font-size: 13px;
}

.doc-field strong {
  color: #d0d0c0;
}

.strikethrough {
  text-decoration: line-through;
  opacity: 0.5;
  margin-left: 8px;
}

.euclid {
  color: var(--amber);
  font-size: 11px;
}

.section-title {
  font-size: 12px;
  letter-spacing: 3px;
  font-weight: 700;
  color: var(--amber);
  border-bottom: 1px solid #333;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

/* TELEMETRY */
.telemetry-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.telemetry-item {
  position: relative;
}

.telemetry-item label {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}

.meter-bar {
  height: 8px;
  background: #111;
  border: 1px solid #333;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 2px;
}

.meter-fill {
  height: 100%;
  background: var(--amber);
  transition: width 0.3s;
  width: 12%;
}

.meter-fill.lcd {
  background: var(--lcd-fg);
}

.telemetry-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--amber);
  font-family: var(--font-mono);
}

.telemetry-value.caffeine {
  color: #88aa66;
}

.telemetry-value.ai-index {
  color: var(--glow-cyan);
}

.telemetry-note {
  font-size: 10px;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

.warning-flash {
  background: var(--scp-red);
  color: #fff;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  animation: flashWarn 0.2s infinite alternate;
  margin-top: 4px;
}

@keyframes flashWarn {
  0% { opacity: 1; }
  100% { opacity: 0.5; }
}

.hidden {
  display: none !important;
}

/* CONTAINMENT */
.containment-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-label {
  font-size: 12px;
  letter-spacing: 2px;
  font-weight: 700;
}

.status-active {
  color: #00ff66;
  font-weight: 700;
  font-size: 14px;
}

.status-inactive {
  color: var(--scp-red);
  font-weight: 700;
  font-size: 14px;
  animation: flashWarn 0.3s infinite alternate;
}

.toggle-btn {
  background: var(--bg-light);
  border: 1px solid #444;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-btn:hover {
  background: #3a3a3a;
}

.faraday-warning {
  background: rgba(204, 0, 0, 0.15);
  border: 2px solid var(--scp-red);
  color: var(--scp-red);
  padding: 8px;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  animation: flashWarn 0.5s infinite alternate;
}

/* FARADAY OFF - doc border */
.faraday-off #document-zone .doc-section {
  border-color: var(--scp-red);
}

/* DOC TEXT */
.doc-text {
  font-family: var(--font-typewriter);
  font-size: 13px;
  line-height: 1.7;
  color: #b0b0a0;
}

.redacted {
  background: #111;
  color: #111;
  padding: 0 4px;
  cursor: pointer;
  user-select: none;
  border-radius: 1px;
  transition: background 0.3s;
}

.redacted:hover {
  background: #222;
  color: #222;
}

/* ADDENDA */
.addendum {
  background: rgba(0,0,0,0.3);
  border: 1px solid #222;
  padding: 12px;
  margin-bottom: 8px;
}

.addendum.locked {
  opacity: 0.5;
  border-style: dashed;
}

.addendum.unlocked {
  opacity: 1;
  border-color: var(--amber-dim);
  border-style: solid;
}

.addendum-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 6px;
}

.addendum-text {
  font-family: var(--font-typewriter);
  font-size: 12px;
  line-height: 1.6;
  color: #999;
}

/* FOOTER */
#footer {
  text-align: center;
  padding: 20px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid #222;
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 20px;
}

#footer a {
  color: var(--amber-dim);
  text-decoration: none;
}

#footer a:hover {
  color: var(--amber);
}

/* 914 OVERLAY */
#overlay-914 {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #000;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#overlay-914 .overlay-text {
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--lcd-fg);
  text-align: center;
  line-height: 2;
  letter-spacing: 4px;
  animation: glitchText 0.1s steps(2) infinite;
}

@keyframes glitchText {
  0% { transform: translate(0,0) skew(0); }
  25% { transform: translate(-2px, 1px) skew(0.5deg); }
  50% { transform: translate(1px, -1px) skew(-0.3deg); }
  75% { transform: translate(2px, 0) skew(0.2deg); }
  100% { transform: translate(0,0) skew(0); }
}

/* RESPONSIVE */
@media (max-width: 900px) {
  #main-content {
    flex-direction: column;
    align-items: center;
  }
  
  #artifact-zone {
    position: static;
    flex: none;
    width: 100%;
    max-width: 400px;
  }

  #mug-container {
    width: 100%;
    max-width: 340px;
    height: auto;
    aspect-ratio: 340/420;
  }

  #mug-canvas {
    width: 100%;
    height: 100%;
  }
  
  #document-zone {
    max-height: none;
    overflow: visible;
    width: 100%;
  }

  .logo-ascii {
    font-size: 5px;
  }

  h1 {
    font-size: 14px;
  }

  h1 .subtitle {
    display: block;
    font-size: 11px;
  }

  .classified-watermark {
    font-size: 24px;
  }

  #game-button {
    width: 100px;
    height: 100px;
  }
  
  .button-inner {
    width: 64px;
    height: 64px;
  }
}

@media (max-width: 500px) {
  .logo-ascii {
    display: none;
  }
  
  #mug-container {
    width: 280px;
    height: 346px;
  }

  #channel-glow {
    width: 200px;
    height: 160px;
    top: 66px;
  }
}