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

body {
  background: #0a0a0a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: monospace;
  overflow: hidden;
}

#game-container {
  position: relative;
  width: 768px;
  height: 576px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 3px solid #333;
}

#game-canvas {
  display: block;
  background: #0f0f0f;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#game-canvas.hidden {
  display: none;
}

/* Part 2 terminal overlay */
#terminal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  color: #00ff00;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#terminal-overlay.hidden {
  display: none;
}

#terminal-output {
  flex: 1;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.4;
}

#terminal-input-line {
  display: flex;
  align-items: center;
  margin-top: 8px;
  border-top: 1px solid #004400;
  padding-top: 8px;
}

#terminal-input-line span {
  color: #00ff00;
  margin-right: 8px;
}

#terminal-input {
  background: transparent;
  border: none;
  color: #00ff00;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  flex: 1;
  outline: none;
  caret-color: #00ff00;
}

/* Part 3 three.js container */
#three-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#three-container.hidden {
  display: none;
}

#three-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* HUD */
#hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 100;
}

#hud-stage {
  color: #fff;
  font-size: 12px;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;
  font-family: monospace;
}

#hud-info {
  color: #fff;
  font-size: 12px;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;
  font-family: monospace;
}

/* Chat dialog box (Part 1) */
#chat-dialog {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.92);
  border-top: 3px solid #fff;
  color: #fff;
  font-family: monospace;
  font-size: 14px;
  padding: 12px 16px;
  min-height: 100px;
  z-index: 50;
}

#chat-dialog.hidden {
  display: none;
}

#chat-dialog .speaker {
  color: #ffcc00;
  font-weight: bold;
  margin-bottom: 4px;
}

#chat-dialog .message {
  line-height: 1.5;
}

#chat-dialog .prompt {
  margin-top: 8px;
  color: #aaa;
  font-size: 12px;
}

#chat-dialog input {
  background: transparent;
  border: none;
  border-bottom: 1px solid #555;
  color: #fff;
  font-family: monospace;
  font-size: 14px;
  width: 100%;
  margin-top: 4px;
  outline: none;
  padding: 4px 0;
}

/* Part 3 chat overlay */
#social-chat {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.85);
  border-top: 2px solid #666;
  color: #fff;
  font-family: monospace;
  font-size: 13px;
  max-height: 200px;
  z-index: 50;
}

#social-chat.hidden {
  display: none;
}

#social-chat-log {
  padding: 8px;
  max-height: 150px;
  overflow-y: auto;
}

#social-chat-input {
  display: flex;
  border-top: 1px solid #444;
  padding: 6px 8px;
}

#social-chat-input input {
  background: transparent;
  border: none;
  color: #fff;
  font-family: monospace;
  font-size: 13px;
  flex: 1;
  outline: none;
}

/* Transition effect */
.fade-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.fade-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Castle interior room UI */
#room-ui {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #555;
  border-radius: 4px;
  color: #fff;
  font-family: monospace;
  font-size: 12px;
  padding: 8px 16px;
  z-index: 60;
  text-align: center;
}

#room-ui.hidden {
  display: none;
}

#room-ui .room-header {
  color: #ffcc00;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 6px;
}

#room-ui .room-controls {
  display: flex;
  gap: 16px;
  color: #aaa;
  font-size: 11px;
}

/* Castle notification toast */
#castle-notification {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid #ffcc00;
  border-radius: 4px;
  color: #ffcc00;
  font-family: monospace;
  font-size: 13px;
  padding: 8px 20px;
  z-index: 70;
  transition: opacity 0.5s;
  pointer-events: none;
}

#castle-notification.hidden {
  opacity: 0;
}

#castle-notification.visible {
  opacity: 1;
}
