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

body {
  overflow: hidden;
  background: #0a0a0a;
  font-family: 'VT323', monospace;
  cursor: none;
  user-select: none;
}

#scene-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
}

#scene-container canvas {
  display: block;
}

/* HUD */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#hud-top-left {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #88ff88;
  text-shadow: 0 0 8px #00ff0066;
}

#scp-logo {
  font-size: 36px;
  color: #ff4444;
  text-shadow: 0 0 12px #ff000088;
  animation: pulse-red 2s ease-in-out infinite;
}

@keyframes pulse-red {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; text-shadow: 0 0 20px #ff0000cc; }
}

#site-info {
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 1px;
}

#hud-top-right {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #88ff88;
  font-size: 18px;
  text-shadow: 0 0 8px #00ff0066;
}

#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff88;
  font-size: 24px;
  font-family: monospace;
  text-shadow: 0 0 4px #ffffff44;
}

#interaction-hint {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  color: #ffff88;
  font-size: 18px;
  text-shadow: 0 0 8px #ffff0044;
  animation: hint-pulse 1.5s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Hotbar */
#hotbar {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
}

#hotbar-items {
  display: flex;
  gap: 4px;
}

.hotbar-slot {
  width: 48px;
  height: 48px;
  background: #1a1a1a;
  border: 2px solid #555;
  image-rendering: pixelated;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.hotbar-slot .slot-color {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}

.hotbar-slot .slot-label {
  position: absolute;
  bottom: -16px;
  font-size: 10px;
  color: #aaa;
  white-space: nowrap;
  font-family: 'VT323', monospace;
}

/* Terminal Overlay */
#terminal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#terminal {
  width: 520px;
  max-width: 92vw;
  background: #0a0f0a;
  border: 3px solid #1a3a1a;
  border-radius: 8px;
  padding: 32px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 60px #00ff0022, inset 0 0 60px #00220022;
}

#scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 0, 0.03) 2px,
    rgba(0, 255, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 1;
  animation: scanline-flicker 0.1s infinite;
}

@keyframes scanline-flicker {
  0% { opacity: 1; }
  50% { opacity: 0.97; }
  100% { opacity: 1; }
}

#terminal-content {
  position: relative;
  z-index: 2;
}

#terminal-header {
  color: #00ff00;
  font-size: 22px;
  margin-bottom: 8px;
  text-shadow: 0 0 10px #00ff0088;
}

#terminal-sub {
  color: #00cc00;
  font-size: 18px;
  margin-bottom: 20px;
}

#input-line {
  display: flex;
  align-items: center;
  background: #050a05;
  border: 1px solid #1a3a1a;
  padding: 8px 12px;
  margin-bottom: 16px;
}

#input-line .prompt {
  color: #00ff00;
  font-size: 22px;
  margin-right: 4px;
}

#substance-input {
  background: transparent;
  border: none;
  color: #00ff00;
  font-family: 'VT323', monospace;
  font-size: 22px;
  outline: none;
  flex: 1;
  caret-color: #00ff00;
  text-shadow: 0 0 6px #00ff0066;
}

#substance-input::placeholder {
  color: #004400;
}

#dispense-btn {
  display: block;
  width: 100%;
  background: #0a1a0a;
  border: 2px solid #00ff00;
  color: #00ff00;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  padding: 12px;
  cursor: pointer;
  text-shadow: 0 0 8px #00ff0066;
  transition: all 0.15s;
  pointer-events: all;
}

#dispense-btn:hover {
  background: #00ff00;
  color: #000;
  box-shadow: 0 0 30px #00ff0066;
}

#dispense-btn:active {
  transform: scale(0.97);
}

#terminal-examples {
  margin-top: 16px;
  color: #006600;
  font-size: 14px;
  line-height: 1.6;
}

/* Log Panel */
#log-toggle {
  position: fixed;
  top: 60px;
  right: 16px;
  background: #1a1a1a;
  color: #88ff88;
  border: 1px solid #333;
  padding: 8px 14px;
  font-family: 'VT323', monospace;
  font-size: 16px;
  cursor: pointer;
  z-index: 20;
  pointer-events: all;
}

#log-toggle:hover {
  background: #2a2a2a;
}

#log-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 90vw;
  height: 100%;
  background: #0d0d0d;
  border-left: 2px solid #333;
  z-index: 50;
  overflow-y: auto;
  padding: 24px;
  color: #cccccc;
}

#log-panel h2 {
  color: #ff4444;
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  margin-bottom: 12px;
}

#log-panel h3 {
  color: #88ff88;
  font-size: 20px;
  margin: 12px 0 8px;
}

#log-panel p {
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.scp-class {
  color: #ffaa00;
}

#log-panel hr {
  border: none;
  border-top: 1px solid #333;
  margin: 16px 0;
}

.log-entry {
  background: #111;
  border: 1px solid #222;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 14px;
}

.log-entry .log-time {
  color: #666;
  font-size: 12px;
}

.log-entry .log-substance {
  color: #88ff88;
}

.log-entry .log-warning {
  color: #ff4444;
  font-size: 12px;
  margin-top: 4px;
}

#log-close {
  display: block;
  width: 100%;
  background: #1a0a0a;
  border: 1px solid #ff4444;
  color: #ff4444;
  font-family: 'VT323', monospace;
  font-size: 18px;
  padding: 10px;
  cursor: pointer;
  margin-top: 16px;
}

/* Effect overlay */
#effect-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  transition: background 0.5s;
}

/* Achievement */
#achievement {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a0a3a;
  border: 2px solid #8844ff;
  color: #ddaaff;
  padding: 12px 24px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  z-index: 30;
  text-align: center;
  box-shadow: 0 0 20px #8844ff44;
  animation: achievement-in 0.5s ease-out;
}

@keyframes achievement-in {
  from { top: -60px; opacity: 0; }
  to { top: 60px; opacity: 1; }
}

/* Mobile */
#mobile-controls {
  position: fixed;
  bottom: 80px;
  left: 0;
  width: 100%;
  z-index: 15;
  pointer-events: none;
}

#joystick-area {
  position: absolute;
  bottom: 0;
  left: 24px;
  pointer-events: all;
}

#joystick-base {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.2);
  position: relative;
}

#joystick-stick {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#mobile-interact {
  position: absolute;
  bottom: 0;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 255, 0, 0.2);
  border: 2px solid #00ff00;
  color: #00ff00;
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  pointer-events: all;
  cursor: pointer;
}

#footer {
  position: fixed;
  bottom: 2px;
  right: 8px;
  color: #333;
  font-family: 'VT323', monospace;
  font-size: 12px;
  z-index: 10;
  pointer-events: all;
}

#footer a {
  color: #555;
  text-decoration: none;
}

#footer a:hover {
  color: #888;
}

.hidden {
  display: none !important;
}

/* Screen shake */
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-8px, 4px); }
  20% { transform: translate(6px, -6px); }
  30% { transform: translate(-4px, 8px); }
  40% { transform: translate(8px, -2px); }
  50% { transform: translate(-6px, 6px); }
  60% { transform: translate(4px, -8px); }
  70% { transform: translate(-8px, 2px); }
  80% { transform: translate(6px, 6px); }
  90% { transform: translate(-2px, -4px); }
}

.screen-shake {
  animation: shake 0.5s ease-in-out;
}

.screen-shake-heavy {
  animation: shake 1s ease-in-out;
}