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

:root {
  --retro-bg: #0f0f1e;
  --retro-card: #1a1a2e;
  --retro-accent: #00ff41;
  --retro-secondary: #ff006e;
  --retro-blue: #00d9ff;
  --retro-yellow: #ffee00;
  --text: #ffffff;
  --muted: #a0a0a0;
}

* {
  box-sizing: border-box;
  image-rendering: pixelated;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  background: var(--retro-bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 12px;
  overflow-x: hidden;
  position: relative;
}

/* Scanlines effect */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1000;
}

/* CRT effect */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none;
  z-index: 999;
}

/* Floating pixels animation */
.pixel-float {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--retro-accent);
  pointer-events: none;
  z-index: 1;
  animation: float 4s infinite ease-in-out;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.3; }
  50% { transform: translateY(-100px) rotate(180deg); opacity: 1; }
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: var(--retro-card);
  border-bottom: 4px solid var(--retro-accent);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
}

.logo {
  font-size: 16px;
  color: var(--retro-accent);
  text-shadow: 2px 2px 0 var(--retro-secondary), 4px 4px 0 var(--retro-blue);
  animation: glitch 3s infinite;
}

@keyframes glitch {
  0%, 90%, 100% { transform: translate(0); }
  92% { transform: translate(-2px, 2px); }
  94% { transform: translate(2px, -2px); }
  96% { transform: translate(-2px, -2px); }
}

.main-nav {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.main-nav a {
  text-decoration: none;
  color: var(--retro-blue);
  font-size: 10px;
  transition: all 0.3s;
  padding: 5px;
  position: relative;
}

.main-nav a:hover {
  color: var(--retro-yellow);
  text-shadow: 0 0 10px var(--retro-yellow);
  animation: bounce 0.5s;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.btn {
  background: var(--retro-accent);
  color: var(--retro-bg);
  border: 3px solid var(--retro-accent);
  padding: 12px 20px;
  border-radius: 0;
  cursor: pointer;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  transition: all 0.2s;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
  position: relative;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  background: var(--retro-yellow);
  border-color: var(--retro-yellow);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.btn:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.5);
}

.btn-secondary {
  background: var(--retro-secondary);
  border-color: var(--retro-secondary);
}

.btn-secondary:hover {
  background: var(--retro-blue);
  border-color: var(--retro-blue);
}

.card {
  max-width: 900px;
  margin: 20px auto;
  background: var(--retro-card);
  padding: 25px;
  border: 3px solid var(--retro-blue);
  box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
  position: relative;
  transition: all 0.3s ease;
  animation: slideInFromBottom 0.6s ease-out;
}

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

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 30px rgba(0, 217, 255, 0.6);
  border-color: var(--retro-accent);
}

.card::after {
  content: "▶";
  position: absolute;
  top: 15px;
  right: 15px;
  color: var(--retro-accent);
  font-size: 18px;
  animation: bounceArrow 1s infinite;
}

@keyframes bounceArrow {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

.card h2 {
  color: var(--retro-yellow);
  font-size: 16px;
  margin-bottom: 15px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

section {
  scroll-margin-top: 90px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  z-index: 500;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hidden {
  display: none !important;
}

.modal-content {
  width: 100%;
  max-width: 720px;
  background: var(--retro-card);
  padding: 25px;
  border: 5px solid var(--retro-accent);
  position: relative;
  box-shadow: 0 0 50px rgba(0, 255, 65, 0.8), inset 0 0 30px rgba(0, 0, 0, 0.7);
  animation: slideIn 0.4s;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes slideIn {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.close {
  position: absolute;
  right: 15px;
  top: 15px;
  background: var(--retro-secondary);
  border: 3px solid var(--retro-secondary);
  font-size: 20px;
  cursor: pointer;
  color: white;
  width: 40px;
  height: 40px;
  font-family: 'Press Start 2P', monospace;
  transition: all 0.2s;
}

.close:hover {
  background: var(--retro-yellow);
  border-color: var(--retro-yellow);
  color: var(--retro-bg);
  transform: rotate(90deg);
}

#quiz-title {
  font-size: 14px;
  color: var(--retro-accent);
  text-align: center;
  margin-bottom: 20px;
  text-shadow: 2px 2px 0 var(--retro-secondary);
}

.quiz-info {
  display: flex;
  gap: 15px;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--retro-blue);
  flex-wrap: wrap;
}

.quiz-info div {
  color: var(--retro-blue);
  font-size: 10px;
}

.quiz-info span {
  color: var(--retro-yellow);
}

#question-text {
  font-size: 12px;
  line-height: 1.8;
  color: white;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  border-left: 4px solid var(--retro-accent);
  margin-bottom: 20px;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.choice {
  padding: 15px;
  border: 3px solid var(--retro-blue);
  cursor: pointer;
  background: rgba(0, 217, 255, 0.1);
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: white;
  transition: all 0.2s;
  position: relative;
  text-align: left;
}

.choice::before {
  content: "▶";
  position: absolute;
  left: -20px;
  opacity: 0;
  transition: all 0.2s;
  color: var(--retro-yellow);
}

.choice:hover {
  background: rgba(0, 217, 255, 0.3);
  border-color: var(--retro-yellow);
  transform: translateX(5px);
}

.choice:hover::before {
  opacity: 1;
  left: 5px;
}

.choice.correct {
  background: rgba(0, 255, 65, 0.3);
  border-color: var(--retro-accent);
  animation: correctPulse 0.5s;
}

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

.choice.wrong {
  background: rgba(255, 0, 110, 0.3);
  border-color: var(--retro-secondary);
  animation: shake 0.5s;
}

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

.choice:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.result {
  margin-top: 20px;
  padding: 20px;
  background: rgba(255, 238, 0, 0.2);
  border: 3px solid var(--retro-yellow);
  font-size: 11px;
  text-align: center;
  animation: slideIn 0.5s;
}

.result strong {
  color: var(--retro-accent);
  font-size: 14px;
  display: block;
  margin-bottom: 15px;
}

.quiz-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}

/* Chapter Content Styles */
.chapter-content {
  max-width: 900px;
  margin: 20px auto;
  padding: 30px;
  background: var(--retro-card);
  border: 4px solid var(--retro-accent);
  box-shadow: 0 0 30px rgba(0, 255, 65, 0.4);
  animation: slideIn 0.5s;
}

.chapter-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--retro-blue);
}

.chapter-header h1 {
  font-size: 20px;
  color: var(--retro-accent);
  text-shadow: 3px 3px 0 var(--retro-secondary);
  margin-bottom: 10px;
  animation: pulse 2s infinite;
}

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

.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin: 30px 0;
  gap: 15px;
  flex-wrap: wrap;
}

.lesson-box {
  background: rgba(0, 0, 0, 0.5);
  border: 3px solid var(--retro-blue);
  padding: 20px;
  margin: 20px 0;
  transition: all 0.3s;
}

.lesson-box:hover {
  border-color: var(--retro-yellow);
  transform: translateX(5px);
}

.lesson-box h3 {
  color: var(--retro-yellow);
  font-size: 14px;
  margin-bottom: 15px;
}

.lesson-box ul {
  list-style: none;
  padding-left: 20px;
}

.lesson-box li::before {
  content: "▶ ";
  color: var(--retro-accent);
  margin-right: 10px;
}

.tip-box {
  background: rgba(0, 255, 65, 0.1);
  border: 3px solid var(--retro-accent);
  padding: 20px;
  margin: 20px 0;
  position: relative;
}

.tip-box::before {
  content: "💡 ASTUCE";
  position: absolute;
  top: -15px;
  left: 20px;
  background: var(--retro-card);
  padding: 5px 15px;
  color: var(--retro-accent);
  font-size: 10px;
}

.warning-box {
  background: rgba(255, 0, 110, 0.1);
  border: 3px solid var(--retro-secondary);
  padding: 20px;
  margin: 20px 0;
  position: relative;
}

.warning-box::before {
  content: "⚠ ATTENTION";
  position: absolute;
  top: -15px;
  left: 20px;
  background: var(--retro-card);
  padding: 5px 15px;
  color: var(--retro-secondary);
  font-size: 10px;
}

.site-footer {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  font-size: 8px;
  border-top: 4px solid var(--retro-accent);
  margin-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    font-size: 10px;
  }
  
  .logo {
    font-size: 12px;
  }
  
  .main-nav a {
    font-size: 8px;
  }
  
  .btn {
    font-size: 8px;
    padding: 10px 15px;
  }

  .chapter-content {
    padding: 20px;
  }

  .chapter-header h1 {
    font-size: 16px;
  }
}