* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: #04050d;
  color: #eee;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

/* ---------- Jeu ---------- */
#stage {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: none;          /* les doigts pilotent les vaisseaux, pas le défilement */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#rotate { display: none; margin: 1.2em 1em 0; color: #9aa6d6; text-align: center; }
@media (orientation: portrait) and (pointer: coarse) {
  #rotate { display: block; }
}

#game {
  display: block;
  width: min(100vw, 150vh);
  width: min(100vw, 150dvh);
  height: auto;
  aspect-ratio: 3 / 2;
  background: #070a1a;
  border-radius: 6px;
  box-shadow: 0 0 40px rgba(80, 120, 255, 0.25);
}

/* ---------- Mode leçon ---------- */
body.lesson-mode {
  background: #dfe6ee;
  color: #1d2433;
  overflow: auto;
}

body.lesson-mode #stage { display: none; }

#lesson[hidden] { display: none; }

#lesson {
  min-height: 100vh;
  padding: 28px 16px 40px;
}

.paper {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  padding: 30px 44px 26px 92px;
  background: #fff repeating-linear-gradient(to bottom, transparent 0 31px, #d9e6f6 31px 32px);
  border-radius: 4px;
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.15);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 32px;
}

.paper::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 66px;
  width: 2px;
  background: #f19ab0;
}

.paper-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15px;
  color: #4a5670;
}

.subject {
  display: inline-block;
  margin-top: 12px;
  padding: 0 12px;
  border-radius: 12px;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 14px;
  font-weight: bold;
  line-height: 26px;
  color: #fff;
  background: #2f6fd6;
}

.subject.fr { background: #c2410c; }

.paper h1 {
  margin: 6px 0 10px;
  font-size: 30px;
  line-height: 44px;
  color: #b3122f;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.paper h2 {
  margin: 18px 0 4px;
  font-size: 20px;
  color: #1f4fa3;
}

.paper p { margin: 0 0 8px; }
.paper ul { margin: 0 0 8px; padding-left: 22px; }

.rule {
  padding: 4px 16px 8px;
  border: 2px solid #9cc0f0;
  border-radius: 8px;
  background: rgba(233, 243, 255, 0.85);
}

.examples .ex { color: #146c2e; }

.paper table {
  border-collapse: collapse;
  margin: 6px 0 10px;
  background: #fff;
}

.paper th, .paper td {
  border: 1px solid #9aa9c2;
  padding: 0 10px;
  text-align: center;
}

.paper th { background: #eef3fb; }

#quiz-question { font-weight: bold; }

#quiz-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 8px 0 12px;
}

#quiz-choices button {
  padding: 8px 14px;
  font: inherit;
  font-size: 17px;
  line-height: 24px;
  text-align: left;
  color: #1d2433;
  background: #f7f9fc;
  border: 2px solid #b8c5da;
  border-radius: 8px;
  cursor: pointer;
}

#quiz-choices button:hover:not(:disabled) {
  border-color: #2f6fd6;
  background: #eef4ff;
}

#quiz-choices button:disabled { cursor: default; }

#quiz-choices button .num {
  display: inline-block;
  width: 24px;
  font-weight: bold;
  color: #2f6fd6;
}

#quiz-choices button.good {
  border-color: #1a9c4a;
  background: #dcf7e5;
}

#quiz-choices button.bad {
  border-color: #d33a3a;
  background: #fde2e2;
}

#quiz-feedback .ok { color: #137a3a; font-weight: bold; }
#quiz-feedback .ko { color: #b42323; font-weight: bold; }
#quiz-feedback .explain { font-style: italic; color: #34405a; }
#quiz-feedback .bonus { color: #a16207; font-weight: bold; }
#quiz-feedback .malus { color: #7e22ce; font-weight: bold; }
#quiz-feedback .bonus.off { color: #7a8599; font-weight: normal; }

.paper-foot {
  margin-top: 18px;
  font-size: 13px;
  color: #8a94a8;
}

.discreet {
  float: right;
  color: #c9d0dc;
}

@media (max-width: 600px) {
  .paper { padding: 20px 16px 20px 40px; }
  .paper::before { left: 26px; }
}
