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

:root {
  --bg: #111;
  --fg: #eee;
  --accent: #D42A2A;
  --overlay-bg: rgba(255, 255, 255, 0.03);
  --error-bg: #e74c3c;
  --error-fg: #fff;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, sans-serif;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
}

#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  z-index: 10;
  background: var(--overlay-bg);
  cursor: pointer;
  color: var(--fg);
  border: 3px dashed var(--accent);
  margin: 1rem;
  border-radius: 1rem;
}

#overlay p {
  font-size: 1.5rem;
}

#overlay h1 {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

#overlay.hidden { display: none; }

#overlay .privacy-note {
  font-size: 0.8rem;
  opacity: 0.5;
  text-align: center;
}

#overlay .copyright {
  position: absolute;
  bottom: 0.5rem;
  font-size: 0.55rem;
  opacity: 0.35;
  text-align: center;
  width: 100%;
}

#overlay .copyright a {
  color: inherit;
  text-decoration: none;
}

#overlay .copyright a:hover {
  text-decoration: underline;
}

#spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 20;
  display: flex;
  gap: 0.5rem;
  transform: translate(-50%, -50%);
}

#spinner.hidden { display: none; }

#spinner span {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 0.8s ease-in-out infinite;
}

#spinner span:nth-child(2) { animation-delay: 0.15s; }
#spinner span:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

#error {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--error-bg);
  color: var(--error-fg);
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.9rem;
}

#error.hidden { display: none; }

#panel {
  position: fixed;
  z-index: 5;
  min-width: 200px;
  max-width: 400px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.6rem 0.8rem;
  font-family: monospace;
  font-size: 0.8rem;
  line-height: 1.3;
  white-space: pre-wrap;
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid #FFD700;
  border-radius: 0.3rem;
  pointer-events: none;
}

#panel.hidden { display: none; }

#panel-connector {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
}

#panel-connector.hidden { display: none; }

.map-copyright {
  position: fixed;
  bottom: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  font-size: 0.55rem;
  opacity: 0.35;
  color: #eee;
  pointer-events: auto;
  display: none;
}

#overlay.hidden ~ .map-copyright {
  display: block;
}

.map-copyright a {
  color: inherit;
  text-decoration: none;
}

.map-copyright a:hover {
  text-decoration: underline;
}

#compass {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 20;
  pointer-events: none;
}

#panel .room-name  { color: #55FFFF; }
#panel .room-coords { color: #555555; }
#panel .room-items { color: #00AAAA; display: block; }
#panel .room-creatures { color: #FF55FF; display: block; }
#panel .room-creatures .also-label { color: #AA00AA; }
#panel .monster-neutral { color: #00AAAA; }
#panel .room-exits { color: #00AA00; display: block; }
