/* ═══════════════════════════════════════════
   Cloud Minigame Journey — style.css
   Aegis Cloud · Wesley Alexandre · Kiro AI
═══════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700;800&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #000;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* ── TELAS ─────────────────────────────── */
.screen {
  display: none;
  width: 100%;
  max-width: 1000px;
  height: 100vh;
  flex-direction: column;
  background: #050505;
  border: 1px solid #222;
}
.screen.active { display: flex; }

/* ── SPLASH ─────────────────────────────── */
#screen-splash {
  justify-content: center;
  align-items: center;
}
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding: 40px;
}
.splash-logo { text-align: center; }
.logo-icon { font-size: 64px; animation: pulse 2s infinite; }
.logo-title {
  font-size: 2em;
  font-weight: 800;
  letter-spacing: 4px;
  margin: 10px 0 5px;
}
.logo-sub { color: #666; letter-spacing: 2px; font-size: 0.85em; }

.loading-area { width: 300px; text-align: center; }
#loading-bar {
  width: 100%;
  height: 4px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}
#loading-fill {
  height: 100%;
  background: #fff;
  width: 0%;
  transition: width 0.1s linear;
}
#loading-text { color: #555; font-size: 0.8em; letter-spacing: 1px; }

.splash-credits {
  color: #333;
  font-size: 0.75em;
  text-align: center;
}
.splash-credits a { color: #444; text-decoration: none; }
.splash-credits a:hover { color: #fff; }

/* ── MENU ─────────────────────────────── */
#screen-menu {
  justify-content: center;
  align-items: center;
}
.menu-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 40px;
}
.menu-logo { text-align: center; }
.menu-logo h1 { font-size: 1.8em; font-weight: 800; letter-spacing: 3px; margin: 10px 0 8px; }
.menu-logo p { color: #555; font-size: 0.85em; }

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 320px;
}
.menu-btn {
  padding: 16px 24px;
  background: transparent;
  border: 1px solid #444;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
}
.menu-btn:hover { background: #fff; color: #000; border-color: #fff; }
.menu-btn.primary { border-color: #fff; }
.menu-credits { color: #333; font-size: 0.75em; letter-spacing: 1px; }

/* ── SELEÇÃO DE NÍVEL ─────────────────── */
#screen-levels {
  justify-content: center;
  align-items: center;
}
.levels-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 40px;
  width: 100%;
}
.levels-content h2 { letter-spacing: 4px; font-size: 1.2em; color: #888; }
.levels-grid {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.level-card {
  width: 200px;
  padding: 25px 20px;
  border: 1px solid #333;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.level-card.unlocked:hover { border-color: #fff; background: #111; }
.level-card.locked { opacity: 0.4; cursor: not-allowed; }
.level-lock {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 16px;
}
.level-number { font-size: 2.5em; font-weight: 800; color: #333; margin-bottom: 5px; }
.level-icon { font-size: 2em; margin-bottom: 10px; }
.level-card h3 { font-size: 0.95em; margin-bottom: 5px; letter-spacing: 1px; }
.level-card p { color: #555; font-size: 0.8em; margin-bottom: 12px; }
.level-meta { display: flex; flex-direction: column; gap: 3px; color: #444; font-size: 0.75em; margin-bottom: 12px; }
.level-stars { font-size: 1.2em; color: #FF9900; letter-spacing: 4px; }

.back-btn {
  padding: 12px 24px;
  background: transparent;
  border: 1px solid #333;
  color: #666;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s;
}
.back-btn:hover { border-color: #fff; color: #fff; }

/* ── JOGO ─────────────────────────────── */
#screen-game {
  flex-direction: column;
  height: 100vh;
  position: relative;
}

/* Status Bar */
#status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #0a0a0a;
  border-bottom: 1px solid #1a1a1a;
  font-size: 12px;
  letter-spacing: 1px;
  flex-shrink: 0;
}
.status-item { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.status-label { color: #444; font-size: 0.75em; }
#hud-level, #hud-score, #hud-streak { font-weight: 700; font-size: 1.1em; }

/* Barra de Energia RPG */
.energy-item { min-width: 160px; }
#energy-bar-container { display: flex; align-items: center; gap: 8px; }
#energy-track {
  position: relative;
  width: 120px;
  height: 8px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  overflow: visible;
}
#energy-negative {
  position: absolute;
  left: 0;
  top: 12px;
  font-size: 9px;
  color: #f00;
}
#energy-zero {
  position: absolute;
  left: 30%;
  top: 12px;
  font-size: 9px;
  color: #555;
  transform: translateX(-50%);
}
#energy-marker {
  position: absolute;
  top: -8px;
  left: 30%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #fff;
  transition: left 0.3s ease, color 0.3s;
}
#energy-value { font-weight: 700; font-size: 1em; min-width: 24px; text-align: center; }

/* SVG */
#game-svg { flex: 1; width: 100%; cursor: none; }

/* Elementos do labirinto */
.wall { fill: #fff; }
.door-group { cursor: not-allowed; }
.door-rect {
  fill: #111;
  stroke: #FF9900;
  stroke-width: 2;
  transition: fill 0.2s;
}
.door-group:hover .door-rect { fill: #1a1200; }
.door-text { fill: #FF9900; font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.door-answered .door-rect { fill: #0a1a0a; stroke: #0f0; opacity: 0.4; }
.goal-circle { fill: none; stroke: #FF9900; stroke-width: 2; animation: pulse 2s infinite; }
.goal-text { fill: #FF9900; font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 700; }

@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* Modal de Questão */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal-content {
  background: #0a0a0a;
  border: 1px solid #333;
  padding: 30px;
  max-width: 580px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-header { margin-bottom: 20px; }
.modal-domain {
  font-size: 0.7em;
  letter-spacing: 3px;
  color: #FF9900;
  margin-bottom: 6px;
}
.modal-header h2 { font-size: 1em; letter-spacing: 2px; margin-bottom: 12px; }

/* Timer Bar */
#timer-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}
#timer-bar-fill {
  flex: 1;
  height: 4px;
  background: #fff;
  transform-origin: left;
  transition: width linear;
}
#timer-value { font-size: 0.85em; color: #888; min-width: 28px; text-align: right; }

#question-text {
  font-size: 0.95em;
  line-height: 1.7;
  margin-bottom: 20px;
  color: #ddd;
}
#options-container { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  padding: 14px 18px;
  background: transparent;
  border: 1px solid #2a2a2a;
  color: #ccc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.option-btn:hover:not(:disabled) { background: #fff; color: #000; border-color: #fff; transform: translateX(6px); }
.option-btn:disabled { cursor: not-allowed; }
.option-btn.correct { background: #0a2a0a; border-color: #0f0; color: #0f0; }
.option-btn.wrong { background: #2a0a0a; border-color: #f00; color: #f00; animation: shake 0.4s; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

#feedback {
  margin-top: 16px;
  padding: 14px 18px;
  font-size: 0.82em;
  line-height: 1.6;
  border-left: 3px solid;
}
#feedback.hidden { display: none; }
#feedback.correct { border-color: #0f0; background: rgba(0,255,0,0.05); color: #8f8; }
#feedback.wrong { border-color: #f00; background: rgba(255,0,0,0.05); color: #f88; }

#streak-indicator {
  margin-top: 12px;
  text-align: center;
  font-size: 0.9em;
  color: #FF9900;
  animation: pulse 1s infinite;
}
#streak-indicator.hidden { display: none; }

/* Controles Mobile */
#mobile-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px;
  background: #0a0a0a;
  border-top: 1px solid #1a1a1a;
  flex-shrink: 0;
}
.dir-row { display: flex; gap: 6px; }
.dir-btn {
  width: 52px;
  height: 52px;
  background: #111;
  border: 1px solid #333;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.1s;
}
.dir-btn:active { background: #fff; color: #000; transform: scale(0.95); }

/* ── VITÓRIA DE NÍVEL ─────────────────── */
#screen-level-win {
  justify-content: center;
  align-items: center;
}
.win-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px;
  text-align: center;
}
.win-trophy { font-size: 64px; }
.win-content h1 { font-size: 1.8em; letter-spacing: 4px; }
.win-stars { font-size: 2em; color: #FF9900; letter-spacing: 8px; }
.win-score { font-size: 1.4em; font-weight: 800; }
.win-stats { color: #555; font-size: 0.85em; line-height: 1.8; }
.win-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

/* ── GAME OVER ─────────────────────────── */
#screen-gameover {
  justify-content: center;
  align-items: center;
}
.gameover-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px;
  text-align: center;
}
.gameover-title {
  font-size: 3em;
  font-weight: 800;
  letter-spacing: 6px;
  color: #f00;
  animation: blink 1s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
#gameover-score { font-size: 1.4em; font-weight: 800; }
.study-tip {
  border: 1px solid #333;
  padding: 16px 20px;
  max-width: 400px;
  font-size: 0.82em;
  line-height: 1.7;
  color: #888;
  text-align: left;
}

/* ── RANKING ─────────────────────────── */
#screen-ranking {
  justify-content: center;
  align-items: center;
}
.ranking-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px;
  width: 100%;
  max-width: 500px;
}
.ranking-content h2 { letter-spacing: 3px; }
#ranking-list { width: 100%; }
.ranking-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #1a1a1a;
  font-size: 0.9em;
}
.ranking-item:first-child { color: #FF9900; }
.ranking-empty { color: #333; text-align: center; padding: 30px; font-size: 0.85em; }

/* ── COMO JOGAR ─────────────────────── */
#screen-howtoplay {
  justify-content: center;
  align-items: center;
}
.howtoplay-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 40px;
  max-width: 560px;
  width: 100%;
}
.howtoplay-content h2 { letter-spacing: 3px; margin-bottom: 10px; }
.howtoplay-items { display: flex; flex-direction: column; gap: 14px; }
.howtoplay-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 0.88em;
  color: #aaa;
  line-height: 1.5;
}
.key-hint {
  background: #111;
  border: 1px solid #333;
  padding: 3px 8px;
  font-size: 0.85em;
  white-space: nowrap;
  color: #fff;
  flex-shrink: 0;
}

/* ── CRÉDITOS ESTILO ATARI ─────────────── */
#screen-credits {
  justify-content: center;
  align-items: center;
  background: #000;
}
.credits-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
#credits-scroll {
  flex: 1;
  overflow: hidden;
  position: relative;
}
#credits-scroll > * {
  animation: scrollCredits 20s linear forwards;
}
@keyframes scrollCredits {
  from { transform: translateY(100vh); }
  to   { transform: translateY(-100%); }
}
.credits-spacer { height: 60vh; }
.credits-block {
  text-align: center;
  padding: 40px 20px;
  border-bottom: 1px solid #111;
}
.credits-big { font-size: 3em; margin-bottom: 10px; }
.credits-title { font-size: 1.6em; font-weight: 800; letter-spacing: 6px; margin-bottom: 8px; }
.credits-sub { color: #555; letter-spacing: 2px; font-size: 0.85em; }
.credits-label { color: #444; font-size: 0.75em; letter-spacing: 3px; margin-bottom: 12px; }
.credits-name { font-size: 1.3em; font-weight: 700; letter-spacing: 3px; margin-bottom: 4px; }
.credits-url { color: #555; font-size: 0.85em; }
.credits-item { color: #888; font-size: 0.9em; margin: 4px 0; }
.credits-score { font-size: 2.5em; font-weight: 800; letter-spacing: 6px; color: #FF9900; }

.credits-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: #000;
  border-top: 1px solid #111;
  flex-shrink: 0;
}

/* ── PARTÍCULAS ─────────────────────── */
.particle { opacity: 0.8; }

/* ── RESPONSIVO ─────────────────────── */
@media (max-width: 768px) {
  #mobile-controls { display: flex; }
  .logo-title { font-size: 1.4em; }
  .levels-grid { flex-direction: column; align-items: center; }
  .level-card { width: 280px; }
  #status-bar { font-size: 10px; padding: 8px 12px; }
  .modal-content { padding: 20px; }
}

#btn-pause {
  background: none;
  border: 1px solid #444;
  color: #fff;
  font-size: 1.1em;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: border-color 0.2s;
}
#btn-pause:hover { border-color: #FF9900; color: #FF9900; }

#pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}
#pause-overlay.hidden { display: none; }

.pause-menu {
  background: #0d1117;
  border: 1px solid #FF9900;
  border-radius: 12px;
  padding: 40px 50px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pause-menu h2 { color: #FF9900; margin-bottom: 10px; font-family: 'JetBrains Mono', monospace; }

.pause-divider { border-top: 1px solid #1e2a3a; margin: 4px 0; }
.pause-link { display: block; text-decoration: none; text-align: center; color: #888; border-color: #333; }
.pause-link:hover { color: #fff; border-color: #666; }

/* ── SOBRE O JOGO ─────────────────────── */
#screen-about { justify-content: center; align-items: center; overflow-y: auto; }
.about-content { max-width: 600px; margin: 0 auto; padding: 40px 20px; font-family: 'Segoe UI', sans-serif; }
.about-content h2 { color: #FF9900; font-family: 'JetBrains Mono', monospace; text-align: center; margin-bottom: 30px; }
.about-section { background: #0d1117; border: 1px solid #1e2a3a; border-radius: 10px; padding: 18px 22px; margin-bottom: 16px; }
.about-section h3 { color: #FF9900; font-size: 0.85em; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.about-section p { color: #ccc; font-size: 0.9em; line-height: 1.6; margin: 4px 0; }
.about-link { display: inline-block; margin-top: 8px; color: #FF9900; text-decoration: none; font-size: 0.85em; border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.about-link:hover { border-color: #FF9900; }