/* Dwaalsteen - Dwalen (Sisyphus Engine) Styling */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0b0f14;
  color: #e2e8f0;
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

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

/* Minimal HUD Overlay */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud.dimmed {
  opacity: 0;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: auto;
}

.hud-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: lowercase;
}

.brand-link {
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.brand-link:hover {
  color: #38bdf8;
}

.sep {
  color: #475569;
}

.sub {
  color: #38bdf8;
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
}

.hud-controls {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(30, 41, 59, 0.85);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

.hidden {
  display: none !important;
}

/* Bottom status & toast */
.hud-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
}

.event-toast {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  color: #f1f5f9;
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  animation: toastFadeIn 0.4s ease forwards;
  transition: opacity 0.5s ease;
}

.hud-hint {
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.6);
  letter-spacing: 0.04em;
  font-family: "JetBrains Mono", monospace;
}

@keyframes toastFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Item Selector Chips in Top Bar */
.hud-item-selector {
  display: flex;
  gap: 0.3rem;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px;
  border-radius: 9px;
}

.btn-item {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.btn-item:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
}

.btn-item.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

@media (max-width: 640px) {
  .hud-top {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .hud-item-selector {
    order: 3;
    width: 100%;
    justify-content: center;
  }
}

/* Spreekballon boven De Drager (3D tracked) */
.speech-bubble {
  position: fixed;
  z-index: 35;
  max-width: 260px;
  min-width: 130px;
  background: rgba(255, 253, 248, 0.96);
  border: 2px solid #1e293b;
  border-radius: 13px;
  padding: 8px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: translate(-50%, -100%) translateY(-10px) scale(0.85);
  transform-origin: bottom center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease-out, transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #0f172a;
}

.speech-bubble.visible {
  opacity: 1;
  transform: translate(-50%, -100%) translateY(-14px) scale(1);
}

.speech-bubble-text {
  font-size: 0.85rem;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
  word-wrap: break-word;
}

.speech-bubble-tail {
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid #1e293b;
}

.speech-bubble-tail::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: -7px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid rgba(255, 253, 248, 0.96);
}
