/* =========================================================
   ESTILO GÓTICO NIGHTMARE - CATHERINE PUZZLE 3D (ULTRA POLISHED)
   ========================================================= */

:root {
  --bg-abyss: #070913;
  --accent-pink: #ff2a70;
  --accent-purple: #9d4edd;
  --accent-gold: #ffd166;
  --accent-cyan: #00f0ff;
  --danger-crimson: #ff003c;
  --text-light: #f8f9fa;
  --text-muted: #8d99ae;
  --glass-bg: rgba(13, 17, 34, 0.78);
  --glass-border: rgba(255, 42, 112, 0.35);
  --glass-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.65);
  --font-title: 'Cinzel', serif;
  --font-ui: 'Rajdhani', sans-serif;
  --font-digital: 'VT323', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-abyss);
  font-family: var(--font-ui);
  color: var(--text-light);
}

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

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

/* =========================================================
   VINHETA DE PERIGO
   ========================================================= */
#danger-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 0 100px rgba(255, 0, 60, 0);
  transition: box-shadow 0.3s ease;
}

#danger-vignette.danger-active {
  animation: pulseDanger 0.8s infinite alternate;
}

@keyframes pulseDanger {
  0% { box-shadow: inset 0 0 70px rgba(255, 0, 60, 0.35); }
  100% { box-shadow: inset 0 0 160px rgba(255, 0, 60, 0.9); }
}

/* =========================================================
   HUD SUPERIOR
   ========================================================= */
#game-hud {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 94%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  z-index: 10;
  pointer-events: none;
}

.hud-box {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 18px;
  box-shadow: var(--glass-glow);
  pointer-events: auto;
}

.hud-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.hud-value {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 42, 112, 0.6);
}

.hud-value.highlight {
  color: var(--accent-gold);
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.8);
}

/* Barra de Medidor de Colapso */
.collapse-meter-box {
  flex: 1;
  max-width: 360px;
}

.collapse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.hud-timer {
  font-family: var(--font-digital);
  font-size: 1.4rem;
  color: var(--accent-pink);
  letter-spacing: 1px;
}

.meter-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.meter-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink), var(--danger-crimson));
  border-radius: 5px;
  transition: width 0.1s linear;
  box-shadow: 0 0 12px var(--accent-pink);
}

/* Combo Chain Box */
.combo-meter-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 140px;
}

.combo-text {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--accent-cyan);
  text-shadow: 0 0 12px var(--accent-cyan);
  transition: transform 0.15s ease;
}

.combo-text.pop {
  transform: scale(1.25);
  color: var(--accent-gold);
  text-shadow: 0 0 16px var(--accent-gold);
}

.combo-chain-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}

.combo-chain-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-gold));
  transition: width 0.08s linear;
}

/* Estatísticas agrupadas */
.stats-box {
  display: flex;
  gap: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* =========================================================
   DICAS DE TECLADO / AÇÕES NO CENTRO INFERIOR
   ========================================================= */
#action-prompts {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  z-index: 10;
  pointer-events: none;
}

.prompt-chip {
  background: rgba(13, 17, 34, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-light);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: all 0.12s ease;
}

.prompt-chip.key-active {
  background: rgba(255, 42, 112, 0.4);
  border-color: var(--accent-pink);
  box-shadow: 0 0 15px var(--accent-pink);
  transform: scale(1.05);
}

.prompt-chip.active-action {
  border-color: var(--accent-pink);
  box-shadow: 0 0 15px rgba(255, 42, 112, 0.5);
  background: rgba(40, 10, 25, 0.85);
}

kbd {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-right: 4px;
}

/* =========================================================
   MENU LATERAL RÁPIDO
   ========================================================= */
#quick-menu {
  position: absolute;
  right: 20px;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.icon-btn {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.icon-btn:hover {
  background: var(--accent-pink);
  border-color: var(--accent-pink);
  box-shadow: 0 0 15px var(--accent-pink);
  transform: translateY(-2px);
}

/* =========================================================
   CONTROLES TOUCH (MOBILE / TABLET)
   ========================================================= */
#mobile-controls {
  position: absolute;
  bottom: 15px;
  left: 0;
  width: 100%;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 20px;
  box-sizing: border-box;
  z-index: 15;
  pointer-events: none;
}

@media (max-width: 900px), (hover: none) {
  #mobile-controls {
    display: flex;
  }
  #action-prompts {
    display: none;
  }
}

.dpad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
}

.dpad-middle {
  display: flex;
  align-items: center;
}

.dpad-btn {
  width: 54px;
  height: 54px;
  background: rgba(20, 24, 45, 0.85);
  border: 2px solid rgba(255, 42, 112, 0.4);
  color: #fff;
  font-size: 1.4rem;
  font-weight: bold;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0,0,0,0.6);
  touch-action: none;
}

.dpad-btn:active {
  background: var(--accent-pink);
  transform: scale(0.92);
}

.dpad-center {
  width: 50px;
  height: 50px;
  background: rgba(10, 12, 25, 0.5);
  border-radius: 8px;
}

.action-buttons-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: auto;
}

.action-btn {
  width: 120px;
  padding: 10px;
  background: linear-gradient(135deg, rgba(255, 42, 112, 0.8), rgba(157, 78, 221, 0.8));
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-ui);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(255, 42, 112, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.action-btn span {
  font-size: 1.1rem;
  font-weight: 900;
}

.action-btn small {
  font-size: 0.7rem;
  opacity: 0.85;
}

.action-btn:active {
  transform: scale(0.95);
  box-shadow: 0 0 20px #fff;
}

.extra-touch-actions {
  display: flex;
  gap: 8px;
}

.small-action-btn {
  padding: 6px 12px;
  background: rgba(30, 35, 60, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--accent-gold);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

/* =========================================================
   TOASTS / AVISOS FLUTUANTES
   ========================================================= */
#toast-container {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 20;
  pointer-events: none;
}

.toast {
  background: rgba(255, 42, 112, 0.9);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 1px;
  padding: 8px 24px;
  border-radius: 20px;
  box-shadow: 0 0 20px rgba(255, 42, 112, 0.8);
  animation: toastFade 2.2s forwards;
}

@keyframes toastFade {
  0% { opacity: 0; transform: translateY(-10px) scale(0.9); }
  15% { opacity: 1; transform: translateY(0) scale(1); }
  80% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-20px) scale(0.9); }
}

/* =========================================================
   MODAIS E TELAS OVERLAY
   ========================================================= */
.modal-backdrop, .overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 18, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  transition: opacity 0.3s ease;
}

.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.modal-content, .overlay-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 30px;
  width: 90%;
  max-width: 580px;
  box-shadow: 0 0 45px rgba(255, 42, 112, 0.35);
  color: var(--text-light);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 42, 112, 0.3);
  padding-bottom: 10px;
}

.modal-header h2 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--accent-pink);
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
}

.close-modal:hover {
  color: #fff;
}

.technique-card {
  background: rgba(255, 255, 255, 0.05);
  border-left: 4px solid var(--accent-pink);
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.technique-card h3 {
  font-size: 1.05rem;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.technique-card p {
  font-size: 0.9rem;
  line-height: 1.4;
  color: #d1d5db;
}

/* Grid de Estágios com Badges de Recorde */
.stages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 15px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 5px;
}

.stage-card-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-light);
  position: relative;
}

.stage-card-btn:hover {
  border-color: var(--accent-pink);
  background: rgba(255, 42, 112, 0.2);
  transform: translateY(-2px);
}

.stage-card-btn h4 {
  font-family: var(--font-title);
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.stage-card-btn p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stage-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 209, 102, 0.2);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 0.75rem;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 12px;
}

/* Telas de Game Over & Vitória */
.overlay-card {
  text-align: center;
  max-width: 480px;
}

.game-over-card {
  border-color: var(--danger-crimson);
  box-shadow: 0 0 50px rgba(255, 0, 60, 0.5);
}

.glitch-text {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--danger-crimson);
  text-shadow: 0 0 15px rgba(255, 0, 60, 0.8);
  margin-bottom: 8px;
}

.victory-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--accent-gold);
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.8);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 25px;
}

.death-stats, .clear-stats-grid {
  margin-bottom: 25px;
}

.clear-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.clear-stat-box {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-name {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.stat-value {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: bold;
}

.grade-box {
  grid-column: span 2;
  background: rgba(255, 209, 102, 0.1);
  border-color: var(--accent-gold);
}

.grade-s {
  color: var(--accent-gold);
  font-size: 1.8rem;
  text-shadow: 0 0 15px rgba(255, 209, 102, 0.9);
}

.overlay-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  margin-top: 16px;
}

.overlay-buttons .bracket-btn {
  width: 100%;
  padding: 15px 24px;
  font-size: 1.15rem;
  min-height: 54px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================
   INTERFACE DE SELEÇÃO DE BOTÃO (ESTÁTICO/CINZA vs SELECIONADO NEON)
   ========================================================= */
.bracket-btn, .primary-btn, .secondary-btn, .lang-card-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  outline: none;
  border-radius: 10px;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);

  /* Estado Padrão Não-Selecionado: Dim, Cinza, Estático, Sem Brilho e Sem Animação */
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #7e8b9b;
  opacity: 0.6;
  box-shadow: none;
  transform: none;
  animation: none;
}

/* Colchetes ficam totalmente ocultos quando o botão NÃO está selecionado */
.bracket-btn .bracket-l,
.bracket-btn .bracket-r,
.lang-card-btn .bracket-l,
.lang-card-btn .bracket-r {
  font-family: 'VT323', monospace;
  font-size: 1.4em;
  line-height: 1;
  display: none;
  pointer-events: none;
}

/* Estado SELECIONADO ATIVO (Foco Único, Iluminado, Pulsante e com Colchetes) */
.bracket-btn.btn-selected,
.primary-btn.btn-selected,
.secondary-btn.btn-selected,
.lang-card-btn.btn-selected {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.32), rgba(255, 42, 112, 0.32)) !important;
  border: 2px solid #00f0ff !important;
  color: #ffffff !important;
  opacity: 1.0 !important;
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.85), inset 0 0 16px rgba(0, 240, 255, 0.45) !important;
  animation: btnPulseGlow 1.3s infinite ease-in-out alternate !important;
}

/* Mostra e anima os colchetes APENAS no botão ativo selecionado */
.bracket-btn.btn-selected .bracket-l,
.lang-card-btn.btn-selected .bracket-l {
  display: inline-block !important;
  opacity: 1 !important;
  color: #00f0ff !important;
  text-shadow: 0 0 15px #00f0ff, 0 0 25px #00f0ff !important;
  animation: bracketLeftPulse 0.9s infinite ease-in-out alternate !important;
}

.bracket-btn.btn-selected .bracket-r,
.lang-card-btn.btn-selected .bracket-r {
  display: inline-block !important;
  opacity: 1 !important;
  color: #00f0ff !important;
  text-shadow: 0 0 15px #00f0ff, 0 0 25px #00f0ff !important;
  animation: bracketRightPulse 0.9s infinite ease-in-out alternate !important;
}

@keyframes btnPulseGlow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.5), inset 0 0 8px rgba(0, 240, 255, 0.3);
    border-color: rgba(0, 240, 255, 0.7);
  }
  100% {
    transform: scale(1.04);
    box-shadow: 0 0 32px rgba(0, 240, 255, 0.95), 0 0 40px rgba(255, 42, 112, 0.5), inset 0 0 20px rgba(0, 240, 255, 0.6);
    border-color: #00f0ff;
  }
}

@keyframes bracketLeftPulse {
  0% {
    transform: translateX(0px);
    text-shadow: 0 0 8px #00f0ff;
  }
  100% {
    transform: translateX(-5px);
    text-shadow: 0 0 20px #00f0ff, 0 0 35px #00f0ff;
  }
}

@keyframes bracketRightPulse {
  0% {
    transform: translateX(0px);
    text-shadow: 0 0 8px #00f0ff;
  }
  100% {
    transform: translateX(5px);
    text-shadow: 0 0 20px #00f0ff, 0 0 35px #00f0ff;
  }
}

/* Botão de Próximo Estágio Integrado no HUD */
.next-stage-box {
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.hud-action-btn {
  background: rgba(13, 17, 34, 0.92);
  border: 1.5px solid var(--accent-cyan);
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 0.95rem;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  cursor: pointer;
}

/* Modal de Seleção de Idiomas */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  padding: 10px 0;
}

.lang-card-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 16px 20px;
  color: var(--text-light);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.lang-card-btn .flag-icon {
  font-size: 1.5rem;
}

.lang-card-btn.active-lang {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

/* =========================================================
   CANVAS DE CONFETTI (por trás do card de vitória)
   ========================================================= */
#confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

#stage-clear-screen .overlay-card {
  position: relative;
  z-index: 1;
}

/* =========================================================
   SISTEMA DE ESTRELAS (1-3) NA TELA DE VITÓRIA
   ========================================================= */
.star-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 6px 0 2px;
}

.star {
  font-size: 3.2rem;
  color: #333a55;
  text-shadow: none;
  transition: color 0.15s ease, text-shadow 0.15s ease, transform 0.15s ease;
  display: inline-block;
  transform: scale(0.7);
  opacity: 0.3;
}

.star.lit {
  color: #ffd166;
  text-shadow:
    0 0 14px rgba(255, 209, 102, 0.9),
    0 0 36px rgba(255, 180, 0, 0.7);
  transform: scale(1.18);
  opacity: 1;
}

.star.lit.gold-star {
  color: #ffe566;
  text-shadow:
    0 0 10px #fff,
    0 0 22px #ffd166,
    0 0 48px rgba(255, 200, 0, 0.9);
  animation: starPulse 1.2s infinite alternate ease-in-out;
}

@keyframes starPulse {
  0%  { text-shadow: 0 0 10px #fff, 0 0 22px #ffd166, 0 0 48px rgba(255,200,0,0.9); transform: scale(1.18); }
  100%{ text-shadow: 0 0 22px #fff, 0 0 44px #ffd166, 0 0 80px rgba(255,200,0,1.0); transform: scale(1.3); }
}

@keyframes starPop {
  0%  { transform: scale(0.2); opacity: 0; }
  60% { transform: scale(1.45); opacity: 1; }
  80% { transform: scale(0.95); }
  100%{ transform: scale(1.18); }
}

.star.lit {
  animation: starPop 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.star.lit.gold-star {
  animation: starPop 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards,
             starPulse 1.2s 0.4s infinite alternate ease-in-out;
}

.star-label {
  text-align: center;
  font-family: var(--font-title);
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
  min-height: 1.4em;
  color: var(--accent-gold);
  text-shadow: 0 0 12px rgba(255, 209, 102, 0.5);
}

/* =========================================================
   TELA INICIAL (TITLE SCREEN)
   ========================================================= */
#title-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at 50% 60%, #0d1428 0%, #070913 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow: hidden;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#title-screen.title-exit {
  opacity: 0;
  transform: scale(1.08);
  pointer-events: none;
}

.title-bg-particles {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.title-particle {
  position: absolute;
  border-radius: 50%;
  background: var(--accent-pink);
  animation: floatParticle linear infinite;
  box-shadow: 0 0 8px var(--accent-pink);
}

@keyframes floatParticle {
  0%   { transform: translateY(0) scale(1); opacity: 0.3; }
  50%  { transform: translateY(-80px) scale(1.3); opacity: 0.7; }
  100% { transform: translateY(-180px) scale(0.5); opacity: 0; }
}

.title-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  animation: titleFadeIn 0.8s ease both;
}

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

.title-logo-area {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.title-eyecatch {
  font-size: 4.5rem;
  animation: castlePulse 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 42, 112, 0.8));
}

@keyframes castlePulse {
  0%, 100% { transform: scale(1) translateY(0); filter: drop-shadow(0 0 20px rgba(255,42,112,0.8)); }
  50%       { transform: scale(1.06) translateY(-6px); filter: drop-shadow(0 0 36px rgba(255,42,112,1.0)); }
}

.title-game-name {
  font-family: var(--font-title);
  font-size: clamp(2.4rem, 8vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--accent-pink);
  text-shadow:
    0 0 14px rgba(255, 42, 112, 0.8),
    0 0 40px rgba(255, 42, 112, 0.4),
    0 2px 0 #000;
  animation: titleGlow 2.5s ease-in-out infinite alternate;
  line-height: 1;
}

@keyframes titleGlow {
  from { text-shadow: 0 0 14px rgba(255,42,112,0.8), 0 0 40px rgba(255,42,112,0.4); }
  to   { text-shadow: 0 0 28px rgba(255,42,112,1.0), 0 0 70px rgba(255,42,112,0.7), 0 0 100px rgba(255,0,60,0.3); }
}

.title-game-sub {
  font-family: var(--font-title);
  font-size: clamp(0.75rem, 2.5vw, 1rem);
  letter-spacing: 0.35em;
  color: var(--accent-cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
  margin-top: 4px;
}

.title-version-badge {
  font-family: var(--font-digital);
  font-size: 0.9rem;
  background: rgba(255, 42, 112, 0.18);
  border: 1px solid rgba(255, 42, 112, 0.4);
  border-radius: 20px;
  padding: 3px 14px;
  color: var(--accent-pink);
  letter-spacing: 0.1em;
  margin-top: 6px;
}

.title-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

.title-btn {
  background: rgba(13, 17, 34, 0.7);
  border: 1px solid rgba(255, 42, 112, 0.3);
  border-radius: 10px;
  color: var(--text-light);
  font-family: var(--font-title);
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  padding: 14px 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  transition: all 0.2s ease;
  opacity: 0.65;
}

.title-btn .bracket-l,
.title-btn .bracket-r {
  opacity: 0;
  color: var(--accent-cyan);
  transition: opacity 0.2s ease;
  font-size: 1.3rem;
}

.title-btn.btn-selected {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 22px rgba(0, 240, 255, 0.25), inset 0 0 12px rgba(0, 240, 255, 0.05);
  color: var(--accent-cyan);
  opacity: 1;
  animation: bracketPulse 1.2s ease-in-out infinite alternate;
}

.title-btn.btn-selected .bracket-l,
.title-btn.btn-selected .bracket-r {
  opacity: 1;
  animation: bracketBlink 1.2s ease-in-out infinite alternate;
}

.title-btn:not(.btn-selected):hover {
  border-color: rgba(255,42,112,0.5);
  opacity: 0.85;
}

.title-hint {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  animation: hintBlink 2s ease-in-out infinite;
  text-align: center;
}

@keyframes hintBlink {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* =========================================================
   MODAL DE OPÇÕES (da Title Screen)
   ========================================================= */
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  gap: 14px;
  flex-wrap: wrap;
}

.option-label {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--text-light);
  letter-spacing: 0.08em;
}

.option-toggle-btn {
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 8px;
  color: var(--accent-cyan);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 8px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-toggle-btn:hover {
  background: rgba(0, 240, 255, 0.22);
}

.option-lang-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.opt-lang-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: var(--text-light);
  font-size: 0.9rem;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.opt-lang-btn.active-opt-lang {
  border-color: var(--accent-cyan);
  background: rgba(0,240,255,0.15);
  color: var(--accent-cyan);
}

/* =========================================================
   MODAL DE CRÉDITOS
   ========================================================= */
.credits-modal {
  max-width: 420px;
}

.credits-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 0;
}

.credit-block {
  text-align: center;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.credit-block:last-child { border-bottom: none; }

.credit-eyecatch {
  font-size: 2.8rem;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 12px rgba(255,42,112,0.7));
}

.credits-title-game {
  font-family: var(--font-title);
  font-size: 1.5rem;
  color: var(--accent-pink);
  text-shadow: 0 0 14px rgba(255,42,112,0.6);
  line-height: 1.3;
  margin-bottom: 4px;
}

.credits-title-game span {
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--accent-cyan);
  display: block;
  margin-top: 4px;
}

.credits-version {
  font-family: var(--font-digital);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.credit-role {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.credit-name {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--text-light);
}

.credit-contact {
  background: rgba(255, 42, 112, 0.07);
  border: 1px solid rgba(255, 42, 112, 0.2);
  border-radius: 10px;
  padding: 14px 20px;
}

.credit-email {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-decoration: none;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(0,240,255,0.3);
  transition: color 0.2s ease;
}

.credit-email:hover { color: var(--accent-gold); }

.credits-footer {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* Responsivo Mobile — Title Screen */
@media (max-width: 480px) {
  .title-eyecatch { font-size: 3rem; }
  .title-game-name { font-size: 2.2rem; }
  .title-btn { font-size: 0.9rem; padding: 12px 16px; }
}
