@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&family=Lato:wght@300;400;700&display=swap');

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

/* Loading Screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  color: white;
}

.loading-content {
  text-align: center;
  animation: fadeIn 0.8s ease;
}

.loading-content h1 {
  font-size: 3em;
  margin-bottom: 30px;
  text-shadow: 0 0 30px rgba(255,220,150,0.5);
  font-family: 'Cinzel', serif;
}

.loading-spinner {
  width: 80px;
  height: 80px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top: 4px solid #d4a574;
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
  margin: 0 auto 30px;
}

.loading-content p {
  font-size: 1.3em;
  opacity: 0.8;
  font-family: 'Lato', sans-serif;
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

body {
  background: #0d1117;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Lato', Arial, sans-serif;
  overflow: hidden;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#renderer {
  width: 100%;
  height: 100%;
  position: relative;
}

#hint {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,220,150,0.9);
  font-size: 14px;
  text-align: center;
  width: 100%;
  z-index: 100;
}

/* ── Dialogue box (ÚNICA DEFINICIÓN) ── */
#dialogue-box {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(20px);
  border: 2px solid rgba(212, 165, 116, 0.3);
  border-radius: 20px;
  padding: 20px;
  width: 90%;
  max-width: 600px;
  box-shadow:
    0 20px 40px rgba(0,0,0,0.5),
    0 0 60px rgba(212, 165, 116, 0.1);
  z-index: 200;
  display: none;
}

#dialogue-box.active {
  display: block;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

#speaker-name {
  color: #d4a574;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
}

#dialogue-text {
  max-height: 250px;
  overflow-y: auto;
  margin-bottom: 15px;
  min-height: 60px;
  line-height: 1.6;
}

.message {
  padding: 12px 16px;
  margin: 8px 0;
  border-radius: 12px;
}

.message.user {
  background: rgba(102, 126, 234, 0.2);
  text-align: right;
  margin-left: 25%;
}

.message.npc {
  background: rgba(212, 165, 116, 0.2);
  margin-right: 25%;
}

#controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

#talkBtn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 30px;
  cursor: pointer;
}

#talkBtn:disabled {
  background: #666;
  cursor: not-allowed;
}

#talkBtn.listening {
  animation: pulse 1s infinite;
}

.btn-close {
  background: #d4a373;
  border: none;
  padding: 14px 28px;
  border-radius: 30px;
  cursor: pointer;
}