@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@400;600;800&display=swap');

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

:root {
  --sky: #0a0e1a;
  --sky2: #0d1b3e;
  --blue: #1e90ff;
  --cyan: #00d4ff;
  --orange: #ff6b00;
  --red: #ff2244;
  --green: #00ff88;
  --yellow: #ffe600;
  --purple: #9b59b6;
  --gold: #ffd700;
  --white: #f0f4ff;
  --panel: rgba(10,20,50,0.85);
  --border: rgba(0,212,255,0.3);
}

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--sky);
  font-family: 'Exo 2', sans-serif;
  color: var(--white);
}

#app { width: 100%; height: 100%; position: relative; overflow: hidden; }

#bgCanvas {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}

/* ── SCREENS ── */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 10;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease;
  overflow-y: auto; padding: 20px;
}
.screen.active { opacity: 1; pointer-events: all; }

/* ── INTRO ── */
.intro-content {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center;
}
.title-badge {
  background: var(--red); color: #fff;
  font-family: 'Orbitron', sans-serif; font-size: 11px; letter-spacing: 4px;
  padding: 4px 14px; border-radius: 2px; font-weight: 700;
}
.game-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(48px, 10vw, 96px);
  font-weight: 900; line-height: 0.9;
  color: var(--white);
  text-shadow: 0 0 30px var(--cyan), 0 0 60px var(--blue);
}
.game-title span {
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan), 0 0 50px var(--blue);
}
.subtitle {
  font-family: 'Orbitron', sans-serif; font-size: 14px;
  letter-spacing: 6px; color: var(--cyan); opacity: 0.8;
}
.jet-showcase { margin: 10px 0; }
.tagline { font-size: 13px; opacity: 0.6; letter-spacing: 2px; }

/* ── BUTTONS ── */
.btn {
  font-family: 'Orbitron', sans-serif; font-weight: 700;
  border: none; cursor: pointer; border-radius: 6px;
  padding: 12px 28px; font-size: 14px; letter-spacing: 2px;
  transition: transform 0.1s, box-shadow 0.2s;
  text-transform: uppercase;
}
.btn:active { transform: scale(0.95); }
.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #000;
  box-shadow: 0 0 20px rgba(0,212,255,0.5);
}
.btn-primary:hover { box-shadow: 0 0 35px rgba(0,212,255,0.9); transform: translateY(-2px); }
.btn-danger {
  background: linear-gradient(135deg, var(--red), var(--orange));
  color: #fff;
  box-shadow: 0 0 20px rgba(255,34,68,0.5);
}
.btn-danger:hover { box-shadow: 0 0 35px rgba(255,34,68,0.9); transform: translateY(-2px); }
.btn-warning {
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  color: #000;
  box-shadow: 0 0 20px rgba(255,230,0,0.5);
}
.btn-warning:hover { box-shadow: 0 0 35px rgba(255,230,0,0.9); transform: translateY(-2px); }
.btn-secondary {
  background: rgba(255,255,255,0.1); color: var(--white);
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-secondary:hover { background: rgba(255,255,255,0.2); }
.btn-huge { font-size: 18px; padding: 16px 40px; border-radius: 8px; }
.btn-row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.pulse { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 20px rgba(0,212,255,0.5); }
  50% { box-shadow: 0 0 50px rgba(0,212,255,1), 0 0 80px rgba(0,212,255,0.5); }
}

/* ── JET SELECT ── */
.screen-header { text-align: center; margin-bottom: 24px; }
.screen-header h2 {
  font-family: 'Orbitron', sans-serif; font-size: 32px;
  color: var(--cyan); text-shadow: 0 0 15px var(--cyan);
}
.screen-header p { opacity: 0.6; letter-spacing: 3px; font-size: 13px; margin-top: 6px; }
.switch-jet-warning {
  max-width: 640px; margin: -8px 0 20px; padding: 12px 18px;
  background: rgba(255,34,68,0.16); border: 1px solid rgba(255,34,68,0.55);
  border-radius: 8px; color: var(--white); text-align: center;
  font-family: 'Orbitron', sans-serif; font-size: 13px; line-height: 1.45;
  box-shadow: 0 0 20px rgba(255,34,68,0.22);
}

.jet-cards {
  display: flex; gap: 24px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 24px;
}
.jet-card {
  background: var(--panel); border: 2px solid var(--border);
  border-radius: 16px; width: 260px; cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
.jet-card:hover {
  transform: translateY(-6px);
  border-color: var(--cyan);
  box-shadow: 0 0 30px rgba(0,212,255,0.4);
}
.jet-card-canvas { display: block; background: linear-gradient(180deg, #0a1628 0%, #0d2348 100%); }
.jet-card-body { padding: 16px; }
.jet-card-body h3 {
  font-family: 'Orbitron', sans-serif; font-size: 16px;
  margin-bottom: 12px; color: var(--yellow);
}
.jet-stats { margin-bottom: 10px; }
.stat-row {
  display: flex; justify-content: space-between;
  font-size: 12px; padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.stat-row.bonus span:last-child { color: var(--green); font-weight: 700; }
.stat-row.penalty span:last-child { color: var(--red); font-weight: 700; }
.jet-desc { font-size: 12px; opacity: 0.7; line-height: 1.5; }

.specials-info {
  text-align: center; padding: 16px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; min-width: 300px;
}
.specials-info h4 {
  font-family: 'Orbitron', sans-serif; font-size: 13px;
  color: var(--yellow); margin-bottom: 10px;
}

/* ── LEVEL START ── */
.level-banner {
  text-align: center; margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(30,144,255,0.15), rgba(0,212,255,0.05));
  border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 40px;
}
.level-number {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(36px, 8vw, 64px); font-weight: 900;
  color: var(--cyan); text-shadow: 0 0 20px var(--cyan);
}
.level-subtitle {
  font-size: 14px; letter-spacing: 4px; opacity: 0.7; margin-top: 6px;
}
.scenario-reveal {
  text-align: center; margin: 16px 0;
  animation: fadeIn 0.5s ease;
}
.scenario-text {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(18px, 4vw, 28px); font-weight: 700;
  color: var(--yellow); text-shadow: 0 0 15px var(--yellow);
  margin-bottom: 16px;
}
.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

.specials-equip {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; text-align: center;
  margin-top: 16px; max-width: 500px; width: 100%;
}
.specials-equip h4 {
  font-family: 'Orbitron', sans-serif; color: var(--yellow); margin-bottom: 12px;
}

/* ── COMBAT ── */
#screen-combat { justify-content: flex-start; }
.combat-hud {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: rgba(0,0,0,0.5);
  border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.hud-label { font-size: 10px; letter-spacing: 3px; opacity: 0.6; }
.hud-value { font-family: 'Orbitron', sans-serif; font-size: 20px; color: var(--cyan); font-weight: 700; }
.combat-title {
  font-family: 'Orbitron', sans-serif; font-size: 22px;
  color: var(--yellow); text-shadow: 0 0 10px var(--yellow);
}

.combat-arena {
  position: relative;
  flex: 0 0 auto;
  border-radius: 12px; overflow: hidden;
  border: 2px solid var(--border);
  box-shadow: 0 0 30px rgba(0,212,255,0.2);
  margin-bottom: 20px;
}
#combatCanvas {
  display: block;
  width: min(700px, calc(100vw - 48px));
  height: auto;
  aspect-ratio: 2 / 1;
}
.mission-failed-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 24px;
  background: radial-gradient(circle at center, rgba(50,0,8,0.62), rgba(0,0,0,0.18) 62%, rgba(0,0,0,0));
  pointer-events: none;
  animation: missionFailIn 0.35s ease both;
}
.mission-failed-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(34px, 7vw, 72px); font-weight: 900;
  color: var(--red);
  text-shadow: 0 0 18px var(--red), 0 0 45px rgba(255,34,68,0.75);
}
.mission-failed-detail {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(13px, 2vw, 18px); color: var(--white);
  text-shadow: 0 2px 8px #000;
  max-width: 560px;
}
.mission-failed-actions {
  display: flex; gap: 12px; justify-content: center; align-items: flex-start;
  flex-wrap: wrap; margin-top: 8px; pointer-events: auto;
}
.mission-failed-actions .result-secondary-row {
  flex-basis: 100%;
  display: flex; justify-content: center;
}
.mission-failed-actions .btn-small {
  padding: 8px 16px;
  font-size: 11px;
}
@keyframes missionFailIn {
  from { opacity: 0; transform: scale(1.08); }
  to { opacity: 1; transform: scale(1); }
}

.dice-section {
  display: flex; gap: 16px; justify-content: center; align-items: flex-start;
  margin-bottom: 16px; flex-wrap: wrap; width: 100%; max-width: 700px;
}
.dice-panel {
  flex: 1; min-width: 200px; max-width: 280px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; text-align: center;
}
.dice-panel h4 { font-family: 'Orbitron', sans-serif; font-size: 13px; margin-bottom: 10px; }
.dice-display { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; min-height: 50px; }
.die {
  width: 48px; height: 48px; background: linear-gradient(135deg, #1e3a5f, #2d5a8e);
  border: 2px solid var(--cyan); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', sans-serif; font-size: 22px; font-weight: 900;
  color: var(--white); position: relative;
  box-shadow: 0 0 10px rgba(0,212,255,0.3);
}
.die.rolling { animation: diceRoll 0.5s ease-in-out; }
.die.enemy-die { border-color: var(--red); background: linear-gradient(135deg, #5f1e1e, #8e2d2d); }
@keyframes diceRoll {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(1.2); }
  50% { transform: rotate(180deg) scale(0.9); }
  75% { transform: rotate(270deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

.roll-total {
  font-family: 'Orbitron', sans-serif; font-size: 32px; font-weight: 900;
  margin-top: 8px; color: var(--yellow);
}
.modifier-display { font-size: 13px; opacity: 0.8; margin-top: 4px; }
.vs-badge {
  font-family: 'Orbitron', sans-serif; font-size: 28px; font-weight: 900;
  color: var(--red); text-shadow: 0 0 15px var(--red);
  align-self: center; min-width: 60px; text-align: center;
}

.roll-btn-area { text-align: center; margin: 12px 0; }

.combat-result {
  text-align: center; padding: 20px;
  background: var(--panel); border: 2px solid var(--border);
  border-radius: 16px; margin-top: 16px; width: 100%; max-width: 600px;
  animation: fadeIn 0.4s ease;
}
.result-text {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(20px, 5vw, 36px); font-weight: 900;
  margin: 12px 0;
}
.result-text.win { color: var(--green); text-shadow: 0 0 20px var(--green); }
.result-text.lose { color: var(--red); text-shadow: 0 0 20px var(--red); }
.result-text.tie { color: var(--yellow); text-shadow: 0 0 20px var(--yellow); }
.result-actions { margin-top: 16px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.result-actions .result-secondary-row {
  flex-basis: 100%;
  display: flex; justify-content: center;
  margin-top: 4px;
}
.result-actions .btn-small {
  padding: 8px 16px;
  font-size: 11px;
}
.repick-action {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.repick-warning {
  max-width: 300px;
  color: var(--yellow);
  font-size: 12px;
  line-height: 1.35;
}

#result-anim-area { font-size: 60px; min-height: 70px; }

.specials-in-combat {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 12px;
}
.special-btn {
  background: rgba(255,165,0,0.15); border: 1px solid var(--orange);
  border-radius: 8px; padding: 8px 16px; cursor: pointer;
  font-family: 'Orbitron', sans-serif; font-size: 12px; color: var(--yellow);
  transition: all 0.2s;
}
.special-btn:hover { background: rgba(255,165,0,0.3); }
.special-btn.used { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }

/* ── REWARD ── */
.reward-container {
  text-align: center; max-width: 600px; width: 100%;
  background: var(--panel); border: 2px solid var(--border);
  border-radius: 20px; padding: 30px;
}
.reward-container h2 {
  font-family: 'Orbitron', sans-serif; font-size: 32px;
  color: var(--yellow); text-shadow: 0 0 20px var(--yellow);
  margin-bottom: 8px;
}
.reward-dice { font-size: 80px; margin: 16px 0; animation: bounceIn 0.5s ease; }
@keyframes bounceIn {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.reward-outcome {
  font-family: 'Orbitron', sans-serif; font-size: 18px;
  margin: 16px 0; color: var(--cyan);
}
.special-cards { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
.special-card {
  background: rgba(255,255,255,0.05); border: 2px solid var(--border);
  border-radius: 12px; padding: 20px; width: 160px; cursor: pointer;
  transition: all 0.2s; text-align: center;
}
.special-card:hover { border-color: var(--yellow); transform: translateY(-4px); box-shadow: 0 0 20px rgba(255,230,0,0.4); }
.special-icon { font-size: 48px; margin-bottom: 8px; }
.special-card h4 { font-family: 'Orbitron', sans-serif; font-size: 13px; color: var(--yellow); margin-bottom: 6px; }
.special-card p { font-size: 11px; opacity: 0.7; line-height: 1.4; }

/* ── GAME OVER ── */
.game-over-content {
  text-align: center; max-width: 500px;
  background: var(--panel); border: 2px solid rgba(255,34,68,0.3);
  border-radius: 20px; padding: 30px;
}
.game-over-content h2 {
  font-family: 'Orbitron', sans-serif; font-size: 36px;
  color: var(--red); text-shadow: 0 0 20px var(--red);
  margin: 16px 0 8px;
}
.specials-lost {
  background: rgba(255,34,68,0.1); border: 1px solid rgba(255,34,68,0.3);
  border-radius: 8px; padding: 10px; margin: 12px 0; font-size: 13px;
}
.retry-specials { margin: 12px 0; }

/* ── VICTORY ── */
#screen-victory { position: relative; overflow: hidden; }
.victory-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 16px;
  background: rgba(0,0,0,0.4);
}
.victory-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(48px, 12vw, 100px); font-weight: 900;
  color: var(--gold); text-shadow: 0 0 30px var(--gold), 0 0 60px var(--yellow);
  animation: victoryPulse 1s ease-in-out infinite;
}
@keyframes victoryPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.victory-sub { font-size: 18px; letter-spacing: 4px; opacity: 0.9; }
.fireworks-text {
  font-family: 'Orbitron', sans-serif; font-size: 16px;
  letter-spacing: 4px; color: var(--cyan);
}

/* ── TOAST ── */
#toast-container {
  position: fixed; top: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1000;
}
.toast {
  background: rgba(10,20,50,0.95); border: 1px solid var(--cyan);
  border-radius: 8px; padding: 12px 20px;
  font-family: 'Orbitron', sans-serif; font-size: 13px; color: var(--white);
  animation: slideIn 0.3s ease, fadeOut 0.5s ease 2.5s forwards;
  box-shadow: 0 0 20px rgba(0,212,255,0.3);
}
@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ── FEEDBACK ── */
.feedback-button {
  position: fixed; right: 18px; bottom: 18px; z-index: 900;
  border: 1px solid rgba(0,212,255,0.45); border-radius: 6px;
  background: rgba(10,20,50,0.92); color: var(--white);
  font-family: 'Orbitron', sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: 1px; padding: 10px 14px; cursor: pointer;
  box-shadow: 0 0 18px rgba(0,212,255,0.25);
}
.feedback-button:hover { border-color: var(--cyan); box-shadow: 0 0 26px rgba(0,212,255,0.45); }
.feedback-modal {
  position: fixed; inset: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(0,0,0,0.55);
}
.feedback-card {
  position: relative; width: min(420px, 100%);
  background: rgba(10,20,50,0.96); border: 1px solid var(--border);
  border-radius: 10px; padding: 24px;
  box-shadow: 0 0 35px rgba(0,212,255,0.22);
}
.feedback-card h3 {
  font-family: 'Orbitron', sans-serif; color: var(--cyan);
  font-size: 20px; margin-bottom: 16px;
}
.feedback-card label {
  display: block; margin: 12px 0 6px;
  font-family: 'Orbitron', sans-serif; font-size: 11px; color: var(--yellow);
}
.feedback-card input,
.feedback-card textarea {
  width: 100%; border: 1px solid rgba(0,212,255,0.35); border-radius: 6px;
  background: rgba(0,0,0,0.28); color: var(--white);
  font: 14px 'Exo 2', sans-serif; padding: 10px 12px;
}
.feedback-card textarea { resize: vertical; min-height: 120px; }
.feedback-card input:focus,
.feedback-card textarea:focus {
  outline: none; border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0,212,255,0.18);
}
.feedback-card .btn { width: 100%; margin-top: 16px; }
.feedback-close {
  position: absolute; top: 10px; right: 12px;
  border: none; background: transparent; color: var(--white);
  font-size: 24px; line-height: 1; cursor: pointer; opacity: 0.75;
}
.feedback-close:hover { opacity: 1; }

/* ── LIVE STATS ── */
.stats-counter {
  position: fixed; left: 18px; bottom: 18px; z-index: 850;
  min-width: 240px; padding: 12px 14px;
  background: rgba(10,20,50,0.82); border: 1px solid rgba(0,212,255,0.28);
  border-radius: 8px; color: rgba(240,244,255,0.82);
  font-size: 12px; line-height: 1.55;
  box-shadow: 0 0 18px rgba(0,212,255,0.16);
  opacity: 1; transform: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.stats-counter.stats-hidden {
  opacity: 0;
  transform: translateY(12px);
}
.stats-counter span {
  font-family: 'Orbitron', sans-serif;
  color: var(--cyan); font-weight: 700;
}

/* ── SPECIALS BADGES ── */
.special-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,165,0,0.15); border: 1px solid var(--orange);
  border-radius: 20px; padding: 4px 12px; font-size: 12px; margin: 4px;
}

/* ── EQUIP LIST ── */
.equip-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px; margin: 6px 0;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 8px;
}
.equip-item.selected { border-color: var(--yellow); background: rgba(255,230,0,0.1); }
.equip-item button { font-size: 12px; padding: 4px 12px; }

/* scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: var(--cyan); border-radius: 3px; }
