@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0b0c10;
  font-family: 'Press Start 2P', monospace;
  color: #fff;
}

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

/* Crosshair central */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  pointer-events: none;
  z-index: 10;
}
#crosshair::before {
  content: '';
  position: absolute;
  top: 9px;
  left: 0;
  width: 20px;
  height: 2px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 2px #000;
}
#crosshair::after {
  content: '';
  position: absolute;
  left: 9px;
  top: 0;
  width: 2px;
  height: 20px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 2px #000;
}

/* HUD Principal */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
}

/* Top bar: estatísticas e bússola */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.stats-panel {
  background: rgba(18, 18, 28, 0.85);
  border: 3px solid #3f474e;
  border-radius: 4px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 4px 4px 0 #000;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  text-shadow: 2px 2px #000;
}

.badge-logo {
  height: 48px;
  filter: drop-shadow(2px 2px 0 #000);
}

.hearts-container {
  display: flex;
  gap: 4px;
}

.heart {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: #e74c3c;
  clip-path: polygon(50% 0%, 100% 35%, 82% 100%, 50% 80%, 18% 100%, 0% 35%);
  animation: pulse 1.5s infinite;
}
.heart.empty {
  background: #555;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Barra de Estamina e Alerta */
.bar-wrap {
  width: 180px;
  height: 14px;
  background: #111;
  border: 2px solid #555;
  position: relative;
  overflow: hidden;
}
.stamina-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #27ae60, #2ecc71);
  transition: width 0.1s linear;
}
.security-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f1c40f, #e74c3c);
  transition: width 0.2s ease;
}

/* Bússola centralizada */
.compass-box {
  background: rgba(15, 15, 25, 0.85);
  border: 3px solid #f1c40f;
  padding: 8px 14px;
  text-align: center;
  font-size: 11px;
  color: #f1c40f;
  text-shadow: 2px 2px #000;
  box-shadow: 4px 4px 0 #000;
}

/* Alertas na tela */
#event-toast {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(192, 57, 43, 0.95);
  border: 4px solid #fff;
  padding: 12px 24px;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 0 25px rgba(231, 76, 60, 0.9);
  color: #fff;
  display: none;
  animation: shake 0.4s infinite;
  pointer-events: none;
  max-width: 80%;
  line-height: 1.6;
}

@keyframes shake {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  25% { transform: translateX(calc(-50% - 4px)) rotate(-1deg); }
  75% { transform: translateX(calc(-50% + 4px)) rotate(1deg); }
}

/* Flash de dano / pisão no pé */
#damage-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, transparent 40%, rgba(231, 76, 60, 0.75) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 4;
}

/* Barra inferior de atalhos e inventário */
.bottom-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.quick-keys-hint {
  background: rgba(0,0,0,0.7);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 10px;
  color: #ddd;
}
.quick-keys-hint span {
  color: #f1c40f;
  font-weight: bold;
}

.hotbar {
  display: flex;
  background: rgba(40, 40, 40, 0.85);
  border: 3px solid #777;
  padding: 4px;
  gap: 6px;
  box-shadow: 4px 4px 0 #000;
}

.hotbar-slot {
  width: 54px;
  height: 54px;
  background: #2a2a2a;
  border: 2px solid #555;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}
.hotbar-slot.active {
  border-color: #f1c40f;
  background: #3a3a2a;
}
.hotbar-slot .slot-key {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 8px;
  color: #aaa;
}
.hotbar-slot .slot-icon {
  font-size: 20px;
}
.hotbar-slot .slot-count {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 9px;
  color: #fff;
  text-shadow: 1px 1px #000;
}

/* Efeito Ghostface e Suspense */
#ghostface-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.5s ease;
  background: radial-gradient(circle, transparent 30%, rgba(20, 0, 0, 0.8) 80%, rgba(100, 0, 0, 0.95) 100%);
}

#ghostface-warning {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  color: #ff3333;
  font-size: 14px;
  text-shadow: 2px 2px 10px #000;
  display: none;
  text-align: center;
}

/* Painel Lateral de Desafios Visíveis na Tela */
.challenges-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(18, 18, 28, 0.92);
  border: 3px solid #f1c40f;
  border-radius: 4px;
  padding: 12px 16px;
  width: 320px;
  box-shadow: 5px 5px 0 #000;
  pointer-events: auto;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.challenges-panel-header {
  font-size: 11px;
  color: #f1c40f;
  text-shadow: 2px 2px #000;
  border-bottom: 2px solid #555;
  padding-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.challenge-item {
  background: rgba(30, 30, 42, 0.85);
  border-left: 4px solid #555;
  padding: 8px 10px;
  font-size: 9px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.3s ease;
}

.challenge-item.danger {
  border-left-color: #e74c3c;
  background: rgba(80, 20, 20, 0.9);
  animation: pulse-border 1s infinite alternate;
}

.challenge-item.active {
  border-left-color: #f39c12;
  background: rgba(60, 45, 10, 0.85);
}

.challenge-item.safe {
  border-left-color: #2ecc71;
}

.challenge-title {
  font-weight: bold;
  color: #fff;
  display: flex;
  justify-content: space-between;
}

.challenge-status {
  font-size: 8px;
  color: #aaa;
}

@keyframes pulse-border {
  from { box-shadow: 0 0 4px #e74c3c; }
  to { box-shadow: 0 0 12px #e74c3c; }
}

/* Mini botões de teste rápido dos desafios */
.dev-triggers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}
.btn-trigger {
  background: #34495e;
  border: 2px solid #555;
  color: #f1c40f;
  font-size: 8px;
  padding: 5px 4px;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
}
.btn-trigger:hover {
  background: #e67e22;
  color: #fff;
}

/* Modais: Start, Game Over, Quiz */
.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.bienal-card {
  background: #2b2b36;
  border: 4px solid #fff;
  box-shadow: 8px 8px 0 #000;
  padding: 28px;
  max-width: 620px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #fff;
}

.bienal-card h1 {
  font-size: 18px;
  color: #f1c40f;
  text-shadow: 3px 3px 0 #000;
  line-height: 1.4;
}

.bienal-card h2 {
  font-size: 14px;
  color: #e74c3c;
  line-height: 1.4;
}

.bienal-card p {
  font-size: 11px;
  line-height: 1.6;
  color: #ddd;
}

.banner-preview {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  border: 2px solid #555;
  background: #111;
}

.bienal-btn {
  background: #4a69bd;
  color: #fff;
  border: 3px solid #1e3799;
  box-shadow: 4px 4px 0 #000;
  padding: 14px 20px;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.1s;
}
.bienal-btn:hover {
  background: #6a89cc;
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #000;
}
.bienal-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

.btn-danger {
  background: #c0392b;
  border-color: #78281f;
}
.btn-danger:hover {
  background: #e74c3c;
}

/* Quiz BookTok Modal */
.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.quiz-btn {
  background: #2c3e50;
  border: 3px solid #34495e;
  padding: 12px 8px;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  line-height: 1.4;
  cursor: pointer;
  transition: 0.1s;
}
.quiz-btn:hover {
  background: #e67e22;
  border-color: #d35400;
}

.quiz-timer-bar {
  width: 100%;
  height: 8px;
  background: #222;
  border: 1px solid #555;
  overflow: hidden;
}
.quiz-timer-fill {
  width: 100%;
  height: 100%;
  background: #e74c3c;
  transition: width 0.1s linear;
}

/* Balão flutuante de fala */
#speech-bubble {
  position: absolute;
  background: #fff;
  color: #000;
  border: 3px solid #000;
  padding: 10px 14px;
  font-size: 10px;
  max-width: 250px;
  box-shadow: 4px 4px 0 #000;
  pointer-events: none;
  display: none;
  z-index: 20;
  text-align: center;
}
