/* css/style.css - Visual Novel Engine: Mass Effect Sci-Fi HUD */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;800&family=Rajdhani:wght@500;600;700&display=swap');

:root {
  --color-bg-dark: #040911;
  --color-hud-cyan: #00d8ff;
  --color-hud-cyan-dim: rgba(0, 216, 255, 0.25);
  --color-hud-blue: #0066cc;
  --color-hud-yellow: #ffd200;
  --color-paragon-blue: #00aaff;
  --color-renegade-red: #ff3344;
  --color-text-white: #eef6ff;
  --color-text-dim: #7f99b2;
  
  --font-title: 'Orbitron', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

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

/* ==========================================================================
   🎮 CONTAINER PRINCIPAL (CANVAS SCI-FI)
   ========================================================================== */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

/* Fundo Cenário */
#scene-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  filter: brightness(0.65) contrast(1.1);
  transition: filter 0.8s ease;
}

/* Overlay de Scanlines e Vinheta Mass Effect */
.scanlines-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    radial-gradient(circle at center, transparent 40%, rgba(0, 10, 25, 0.85) 100%);
  background-size: 100% 4px, 100% 100%;
  pointer-events: none;
  z-index: 1;
}

/* ==========================================================================
   🛰️ BARRA DE STATUS SUPERIOR (HUD)
   ========================================================================== */
#top-hud {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(3, 12, 24, 0.9) 0%, rgba(3, 12, 24, 0) 100%);
  border-bottom: 1px solid var(--color-hud-cyan-dim);
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-logo {
  font-family: var(--font-title);
  font-size: 13px;
  letter-spacing: 2.5px;
  color: var(--color-hud-cyan);
  background: rgba(0, 216, 255, 0.12);
  padding: 4px 10px;
  border-left: 3px solid var(--color-hud-cyan);
  text-shadow: 0 0 8px rgba(0, 216, 255, 0.6);
}

#chapter-title {
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--color-text-dim);
  text-transform: uppercase;
}

.hud-right {
  display: flex;
  gap: 12px;
}

.hud-btn {
  background: rgba(0, 25, 50, 0.6);
  border: 1px solid var(--color-hud-cyan-dim);
  color: var(--color-text-white);
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 1.5px;
  padding: 6px 14px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.hud-btn:hover {
  background: rgba(0, 216, 255, 0.25);
  border-color: var(--color-hud-cyan);
  box-shadow: 0 0 10px rgba(0, 216, 255, 0.5);
  color: #fff;
}

/* ==========================================================================
   🎭 PALCO DE PERSONAGENS (SOLO & DUO COM ILUMINAÇÃO DINÂMICA)
   ========================================================================== */
#stage {
  position: absolute;
  top: 50px;
  left: 0;
  width: 100%;
  height: calc(100% - 210px);
  z-index: 2;
  display: flex;
  pointer-events: none;
}

.portrait {
  position: absolute;
  bottom: 0;
  height: 82%;
  max-height: 720px;
  object-fit: contain;
  transition: filter 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 0.4s ease;
}

/* ILUMINAÇÃO DINÂMICA (SOMBRA VS FALA) */
.portrait.speaking {
  filter: brightness(1.05) saturate(1.1) drop-shadow(0 0 25px rgba(0, 216, 255, 0.45));
  opacity: 1;
  transform: scale(1.02);
  z-index: 4;
}

.portrait.dimmed {
  filter: brightness(0.35) saturate(0.55) contrast(1.1);
  opacity: 0.78;
  transform: scale(0.97);
  z-index: 2;
}

/* MODO SOLO: Centralizado */
#stage.mode-single #portrait-center {
  left: 50%;
  transform: translateX(-50%) scale(0.97);
}

#stage.mode-single #portrait-center.speaking {
  transform: translateX(-50%) scale(1.02);
}

/* MODO DUO: Esquerda & Direita */
#stage.mode-dual #portrait-left {
  left: 25%;
  transform: translateX(-50%) scale(0.97);
}

#stage.mode-dual #portrait-left.speaking {
  transform: translateX(-50%) scale(1.02);
}

#stage.mode-dual #portrait-right {
  left: 75%;
  transform: translateX(-50%) scale(0.97);
}

#stage.mode-dual #portrait-right.speaking {
  transform: translateX(-50%) scale(1.02);
}

/* MODO TRIO: Esquerda, Centro & Direita */
#stage.mode-trio .portrait {
  height: 76%;
  max-height: 680px;
}

#stage.mode-trio #portrait-left {
  left: 18%;
  transform: translateX(-50%) scale(0.96);
  z-index: 2;
}

#stage.mode-trio #portrait-left.speaking {
  transform: translateX(-50%) scale(1.02);
  z-index: 5;
}

#stage.mode-trio #portrait-center {
  left: 50%;
  transform: translateX(-50%) scale(0.96);
  z-index: 3;
}

#stage.mode-trio #portrait-center.speaking {
  transform: translateX(-50%) scale(1.02);
  z-index: 5;
}

#stage.mode-trio #portrait-right {
  left: 82%;
  transform: translateX(-50%) scale(0.96);
  z-index: 2;
}

#stage.mode-trio #portrait-right.speaking {
  transform: translateX(-50%) scale(1.02);
  z-index: 5;
}

/* ==========================================================================
   💬 CAIXA DE DIÁLOGO
   ========================================================================== */
#dialogue-layer {
  position: relative;
  z-index: 10;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0 40px 24px 40px;
}

#dialogue-box {
  position: relative;
  width: 100%;
  max-width: 980px;
  min-height: 140px;
  background: rgba(5, 14, 26, 0.88);
  border: 1px solid var(--color-hud-cyan);
  box-shadow: 
    0 0 20px rgba(0, 216, 255, 0.2),
    inset 0 0 15px rgba(0, 216, 255, 0.08);
  backdrop-filter: blur(8px);
  padding: 18px 28px;
  cursor: pointer;
  clip-path: polygon(
    0 12px, 12px 0,
    calc(100% - 12px) 0, 100% 12px,
    100% calc(100% - 12px), calc(100% - 12px) 100%,
    12px 100%, 0 calc(100% - 12px)
  );
  transition: border-color 0.2s, box-shadow 0.2s;
}

#dialogue-box:hover {
  border-color: #55e6ff;
  box-shadow: 0 0 25px rgba(0, 216, 255, 0.35);
}

.speaker-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--color-hud-cyan-dim);
  padding-bottom: 6px;
}

#speaker-name {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--color-hud-cyan);
  text-shadow: 0 0 10px rgba(0, 216, 255, 0.6);
  text-transform: uppercase;
}

#speaker-title {
  font-size: 14px;
  color: var(--color-text-dim);
  letter-spacing: 1px;
}

#dialogue-text {
  font-size: 21px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: 0.8px;
  color: var(--color-text-white);
  min-height: 58px;
}

#advance-prompt {
  position: absolute;
  right: 24px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--color-hud-cyan);
  opacity: 0;
  transition: opacity 0.3s;
}

#advance-prompt.visible {
  opacity: 0.9;
  animation: pulsePrompt 1.4s infinite ease-in-out;
}

.prompt-arrow {
  display: inline-block;
  font-size: 14px;
}

@keyframes pulsePrompt {
  0%, 100% { transform: translateX(0); opacity: 0.5; }
  50% { transform: translateX(4px); opacity: 1; }
}

/* ==========================================================================
   ⚡ INTERRUPTS MORAIS SEM TIMER (PARAGON / RENEGADE - ICONS ONLY)
   ========================================================================== */
.interrupt-btn {
  position: absolute;
  bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  background: rgba(3, 10, 22, 0.92);
  backdrop-filter: blur(10px);
  cursor: pointer;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.92);
  transition: opacity 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              box-shadow 0.25s ease,
              background 0.25s ease;
}

.interrupt-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.interrupt-icon-box {
  width: 66px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.interrupt-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease, filter 0.2s ease;
}

/* PARAGON (Azul - Canto Inferior Esquerdo ao lado da Caixa de Diálogo) */
#interrupt-paragon {
  left: max(16px, calc(50% - 490px - 106px));
  border: 1.5px solid var(--color-paragon-blue);
  box-shadow: 0 0 20px rgba(0, 170, 255, 0.45), inset 0 0 12px rgba(0, 170, 255, 0.2);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}

#interrupt-paragon .interrupt-icon-box img {
  filter: drop-shadow(0 0 8px rgba(0, 170, 255, 0.75));
}

#interrupt-paragon:hover {
  background: rgba(0, 132, 255, 0.28);
  box-shadow: 0 0 32px rgba(0, 170, 255, 0.95), inset 0 0 18px rgba(0, 170, 255, 0.45);
  transform: translateY(-2px) scale(1.08);
}

#interrupt-paragon.visible {
  animation: interruptPulseParagon 1.8s infinite ease-in-out;
}

@keyframes interruptPulseParagon {
  0%, 100% {
    box-shadow: 0 0 18px rgba(0, 170, 255, 0.4), inset 0 0 10px rgba(0, 170, 255, 0.15);
  }
  50% {
    box-shadow: 0 0 32px rgba(0, 170, 255, 0.9), inset 0 0 16px rgba(0, 170, 255, 0.35);
  }
}

/* RENEGADE (Vermelho - Canto Inferior Direito ao lado da Caixa de Diálogo) */
#interrupt-renegade {
  right: max(16px, calc(50% - 490px - 106px));
  border: 1.5px solid var(--color-renegade-red);
  box-shadow: 0 0 20px rgba(255, 51, 68, 0.45), inset 0 0 12px rgba(255, 51, 68, 0.2);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

#interrupt-renegade .interrupt-icon-box img {
  filter: drop-shadow(0 0 6px rgba(255, 51, 68, 0.7));
}

#interrupt-renegade:hover {
  background: rgba(255, 51, 68, 0.28);
  box-shadow: 0 0 28px rgba(255, 51, 68, 0.9), inset 0 0 16px rgba(255, 51, 68, 0.4);
  transform: translateY(-2px) scale(1.08);
}

#interrupt-renegade.visible {
  animation: interruptPulseRenegade 1.8s infinite ease-in-out;
}

@keyframes interruptPulseRenegade {
  0%, 100% {
    box-shadow: 0 0 16px rgba(255, 51, 68, 0.4), inset 0 0 8px rgba(255, 51, 68, 0.15);
  }
  50% {
    box-shadow: 0 0 28px rgba(255, 51, 68, 0.85), inset 0 0 14px rgba(255, 51, 68, 0.35);
  }
}

/* ==========================================================================
   📜 BALDUR'S GATE STYLE DIALOGUE CHOICE LIST
   ========================================================================== */
#choice-container {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: calc(100% - 80px);
  max-width: 980px;
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#choice-container.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

#choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(4, 13, 26, 0.94);
  border: 1px solid var(--color-hud-cyan);
  box-shadow: 0 0 25px rgba(0, 216, 255, 0.25), inset 0 0 15px rgba(0, 216, 255, 0.08);
  backdrop-filter: blur(12px);
  padding: 16px 20px;
  clip-path: polygon(
    0 10px, 10px 0,
    calc(100% - 10px) 0, 100% 10px,
    100% calc(100% - 10px), calc(100% - 10px) 100%,
    10px 100%, 0 calc(100% - 10px)
  );
}

.choice-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  background: rgba(8, 22, 42, 0.6);
  border: 1px solid rgba(0, 216, 255, 0.2);
  border-left: 3px solid rgba(0, 216, 255, 0.4);
  padding: 10px 16px;
  color: var(--color-text-white);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: 2px;
}

.choice-item:hover {
  background: rgba(0, 216, 255, 0.2);
  border-color: var(--color-hud-cyan);
  border-left: 4px solid var(--color-hud-cyan);
  box-shadow: 0 0 15px rgba(0, 216, 255, 0.4);
  transform: translateX(6px);
  color: #fff;
}

.choice-num {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-hud-cyan);
  letter-spacing: 1px;
  flex-shrink: 0;
}

.choice-text {
  flex-grow: 1;
  letter-spacing: 0.5px;
}

/* Opções já exploradas */
.choice-item.read {
  opacity: 0.65;
  color: #8da4be;
  border-left-color: rgba(120, 150, 180, 0.3);
}

/* Opções bloqueadas por requisitos de contador (showLocked) */
.choice-item.locked {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.7);
}

/* Opções com alinhamento moral (Renegade / Paragon) no menu de escolhas */
.choice-item[data-alignment="renegade"] {
  border-color: rgba(255, 51, 68, 0.35);
  border-left: 3px solid var(--color-renegade-red);
}

.choice-item[data-alignment="renegade"] .choice-num {
  color: var(--color-renegade-red);
  text-shadow: 0 0 8px rgba(255, 51, 68, 0.6);
}

.choice-item[data-alignment="renegade"]:hover:not(.locked) {
  background: rgba(255, 51, 68, 0.22);
  border-color: var(--color-renegade-red);
  border-left-color: #ff5566;
  box-shadow: 0 0 16px rgba(255, 51, 68, 0.45);
}

.choice-item[data-alignment="paragon"] {
  border-color: rgba(0, 170, 255, 0.35);
  border-left: 3px solid var(--color-paragon-blue);
}

.choice-item[data-alignment="paragon"] .choice-num {
  color: var(--color-paragon-blue);
  text-shadow: 0 0 8px rgba(0, 170, 255, 0.6);
}

.choice-item[data-alignment="paragon"]:hover:not(.locked) {
  background: rgba(0, 170, 255, 0.22);
  border-color: var(--color-paragon-blue);
  border-left-color: #33bbff;
  box-shadow: 0 0 16px rgba(0, 170, 255, 0.45);
}

.choice-req-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 13px;
  font-family: var(--font-title);
  letter-spacing: 0.5px;
  opacity: 0.85;
  color: #ff8899;
}

/* ==========================================================================
/* ==========================================================================
   📂 CHAPTERS SCREEN & TERMINAL
   ========================================================================== */
#chapter-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  background: rgba(2, 6, 14, 0.95);
  backdrop-filter: blur(16px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#chapter-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-box.chapter-terminal {
  width: 100%;
  max-width: 760px;
  background: rgba(4, 13, 26, 0.97);
  border: 1px solid var(--color-hud-cyan);
  box-shadow: 
    0 0 40px rgba(0, 216, 255, 0.28),
    inset 0 0 25px rgba(0, 216, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  clip-path: polygon(
    0 14px, 14px 0,
    calc(100% - 14px) 0, 100% 14px,
    100% calc(100% - 14px), calc(100% - 14px) 100%,
    14px 100%, 0 calc(100% - 14px)
  );
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: linear-gradient(90deg, rgba(0, 216, 255, 0.15) 0%, rgba(3, 10, 22, 0.6) 100%);
  border-bottom: 1px solid var(--color-hud-cyan-dim);
}

.modal-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chapter-content {
  padding: 36px 40px 42px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.story-title {
  font-family: var(--font-title);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--color-text-white);
  line-height: 1.35;
  text-shadow: 0 0 16px rgba(0, 216, 255, 0.4);
  margin: 0;
}

.chapters-heading {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-hud-cyan);
  border-bottom: 1px solid rgba(0, 216, 255, 0.25);
  padding-bottom: 8px;
  margin: 4px 0 0 0;
}

.chapters-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.chapter-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(8, 22, 42, 0.65);
  border: 1px solid rgba(0, 216, 255, 0.2);
  border-left: 4px solid rgba(0, 216, 255, 0.35);
  padding: 14px 20px;
  border-radius: 2px;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  width: 100%;
  color: var(--color-text-white);
}

.chapter-row.playable {
  cursor: pointer;
  border-color: rgba(0, 216, 255, 0.45);
  border-left-color: var(--color-hud-cyan);
}

.chapter-row.playable:hover {
  background: rgba(0, 216, 255, 0.22);
  border-color: var(--color-hud-cyan);
  border-left-color: #ffffff;
  box-shadow: 0 0 20px rgba(0, 216, 255, 0.45);
  transform: translateX(6px);
}

.chapter-row.active {
  border-color: var(--color-hud-cyan);
  border-left-color: var(--color-hud-yellow);
  background: rgba(0, 216, 255, 0.14);
}

.chapter-row.locked {
  opacity: 0.55;
  border-left-color: rgba(120, 150, 180, 0.25);
  cursor: not-allowed;
}

.chapter-row-num {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-hud-cyan);
  letter-spacing: 1px;
  flex-shrink: 0;
  min-width: 24px;
}

.chapter-row-title {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-text-white);
  flex-grow: 1;
}

.chapter-row.playable:hover .chapter-row-title {
  color: #ffffff;
}

.chapter-row-badge {
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 1.5px;
  padding: 4px 12px;
  border-radius: 2px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.badge-play {
  background: rgba(0, 216, 255, 0.2);
  border: 1px solid var(--color-hud-cyan);
  color: var(--color-hud-cyan);
  text-shadow: 0 0 8px rgba(0, 216, 255, 0.5);
  transition: all 0.2s ease;
}

.chapter-row.playable:hover .badge-play {
  background: var(--color-hud-cyan);
  color: #030a16;
  font-weight: 700;
  box-shadow: 0 0 14px var(--color-hud-cyan);
}

.badge-coming-soon {
  background: rgba(120, 150, 180, 0.12);
  border: 1px solid rgba(120, 150, 180, 0.25);
  color: #8da4be;
}

/* Responsividade Básica */
@media (max-width: 1220px) {
  #interrupt-paragon {
    left: 20px;
    bottom: calc(140px + 36px);
  }
  #interrupt-renegade {
    right: 20px;
    bottom: calc(140px + 36px);
  }
}

@media (max-width: 900px) {
  #dialogue-layer {
    padding: 0 16px 16px 16px;
  }
  #choice-container {
    bottom: 16px;
    width: calc(100% - 32px);
  }
  #interrupt-paragon {
    left: 16px;
    bottom: calc(130px + 28px);
    width: 68px;
    height: 68px;
  }
  #interrupt-renegade {
    right: 16px;
    bottom: calc(130px + 28px);
    width: 68px;
    height: 68px;
  }
  .interrupt-icon-box {
    width: 50px;
    height: 50px;
  }
  #dialogue-text {
    font-size: 18px;
  }
  .choice-item {
    font-size: 16px;
    padding: 8px 12px;
  }
  .modal-content {
    grid-template-columns: 1fr;
  }
  .story-cover-box {
    height: 140px;
  }
}
