/* حديقة النجوم — Jardin des Étoiles
   Thème « nuit féerique » de la maquette validée : ciel étoilé, lanternes dorées, cartes illustrées. */

:root {
  --violet: #6c47e0;
  --violet-d: #4a2bb5;
  --violet-l: #f1ebff;
  --gold: #f4c24f;
  --gold-l: #ffe7a3;
  --gold-d: #b88626;
  --ink: #2a1d4f;
  --muted: #6d6290;
  --panel: rgba(255, 253, 255, 0.97);
  --line: #e6dcfb;
  --red: #e0324b;
  --r: 22px;
  --shadow: 0 14px 36px rgba(8, 4, 40, 0.32);
  --font: 'Baloo Bhaijaan 2', 'Segoe UI', Tahoma, 'Noto Sans Arabic', 'Geeza Pro', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #0b1036; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.45;
  background: linear-gradient(180deg, #0b1036 0%, #1d1a5f 36%, #43277f 70%, #6a3a98 100%) fixed;
}
button, input, select, textarea { font: inherit; }
img, svg { max-width: 100%; }
a { color: inherit; }
[hidden] { display: none !important; }
.hint, .muted, small, .modal p, .toast, .info-box small, .landing p { unicode-bidi: plaintext; }
.t-en { display: block; font-size: 0.62em; font-weight: 700; opacity: 0.8; }
.t-ar { display: block; }

/* ---------- Décor (fixe, purement visuel) ---------- */
.decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.decor .stars, .gems-sky {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1.6px 1.6px at 20px 30px, #fffbe6 50%, transparent 55%),
    radial-gradient(1px 1px at 90px 120px, #fff 50%, transparent 55%),
    radial-gradient(2.2px 2.2px at 160px 60px, #ffe9a8 50%, transparent 55%),
    radial-gradient(1px 1px at 230px 170px, #fff 50%, transparent 55%),
    radial-gradient(1.4px 1.4px at 300px 95px, #fff 50%, transparent 55%),
    radial-gradient(1.8px 1.8px at 60px 200px, #fff6c9 50%, transparent 55%);
  background-size: 340px 230px;
  animation: twinkle 5s ease-in-out infinite alternate;
}
.art-moon { position: absolute; top: 2.2rem; left: 24%; width: 86px; filter: drop-shadow(0 0 22px #ffe7a3aa); }
.art-mosque { position: absolute; top: 3.2rem; left: 1.5%; width: 250px; opacity: 0.92; }
.art-lantern { position: absolute; top: -8px; width: 46px; transform-origin: 50% 0; animation: swing 6s ease-in-out infinite alternate; filter: drop-shadow(0 0 14px #ffcf5a88); }
.art-lantern.l1 { left: 13%; }
.art-lantern.l2 { left: 19%; top: -34px; width: 36px; animation-delay: -2s; }
.art-lantern.l3 { right: 4%; }
.art-lantern.l4 { right: 10%; top: -30px; width: 38px; animation-delay: -3s; }
.art-garden { position: absolute; bottom: 0; left: 0; width: 100%; height: 120px; }
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes swing { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }

.frame { position: relative; z-index: 1; width: min(1360px, calc(100% - 24px)); margin: 0 auto; padding-bottom: 150px; }

/* ---------- En-tête ---------- */
.site-head { display: flex; justify-content: center; align-items: flex-start; position: relative; min-height: 118px; }
.plaque {
  display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--gold-l);
  background: radial-gradient(circle at 50% 0, #3a2a92, #1b1558 72%);
  border: 3px solid var(--gold); border-top: 0; border-radius: 0 0 46px 46px;
  padding: 4px 40px 10px; box-shadow: 0 10px 30px #0009, inset 0 0 0 2px #ffffff22;
}
.plaque-ar {
  font-size: clamp(30px, 4.6vw, 54px); font-weight: 800; line-height: 1.15;
  background: linear-gradient(#fff6cf, #f4c24f 60%, #d9982c); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.plaque-fr { font-size: clamp(16px, 2vw, 24px); font-weight: 700; color: #fff; }
.ribbon {
  margin-top: 4px; background: linear-gradient(#fff4d8, #f3d58e); color: #3c2a0d; border-radius: 10px; padding: 2px 16px;
  font-weight: 800; font-size: 15px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 4px 0 var(--gold-d);
}
.ribbon span { font-size: 12px; font-weight: 600; }
.welcome {
  position: absolute; top: 14px; inset-inline-start: 0; display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none;
  background: #1b1558e6; border: 2px solid var(--gold); padding: 6px 18px; border-radius: 999px; box-shadow: var(--shadow);
}
.welcome b { font-size: 18px; }
.welcome .fr { color: #e9e2ff; }

/* Libellés bilingues : arabe au-dessus, français dessous */
.bi { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.2; vertical-align: middle; }
.bi .fr { font-size: 0.68em; font-weight: 600; opacity: 0.85; }
.page-title .bi, .panel h2 .bi, .modal h2 .bi, .label .bi, .live-panel h2 .bi { align-items: flex-start; }

/* ---------- Navigation ---------- */
.main-nav {
  display: flex; justify-content: center; gap: 4px; background: #fffdfd; border-radius: 999px; padding: 6px;
  margin: 14px auto 18px; width: fit-content; max-width: 100%; box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  display: flex; align-items: center; gap: 8px; padding: 7px 16px; border-radius: 999px; color: var(--ink);
  text-decoration: none; white-space: nowrap; font-weight: 800; font-size: 17px;
}
.main-nav a .ico { font-size: 24px; }
.main-nav a .fr { color: var(--muted); }
.main-nav a.active { background: linear-gradient(135deg, #8b5cf6, #5b2fd6); color: #fff; box-shadow: 0 6px 16px #5b2fd666; }
.main-nav a.active .fr { color: #efe7ff; opacity: 1; }

.page-title { color: #fff; text-shadow: 0 2px 10px #000a; margin: 6px 0 14px; font-size: clamp(26px, 3.5vw, 38px); }
main > .hint, main > .row .hint { color: #e5dcff; }

/* ---------- Composants ---------- */
.panel { background: var(--panel); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); border: 1px solid #fff; margin-bottom: 18px; }
.panel h2 { margin: 0 0 12px; font-size: 24px; }
.panel h3 { margin: 12px 0 8px; }
.hint { color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.space { justify-content: space-between; flex-wrap: wrap; }
.row.end { justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.row.center { justify-content: center; flex-wrap: wrap; }
hr { border: 0; border-top: 2px dashed var(--line); margin: 16px 0; }

.btn {
  display: inline-block; text-align: center; border: 0; border-radius: 16px; padding: 10px 18px; font-weight: 800; font-size: 17px;
  cursor: pointer; text-decoration: none; color: #fff; background: var(--violet); box-shadow: 0 6px 16px #2a1d4f2e;
  transition: transform 0.12s, filter 0.12s; line-height: 1.25; min-height: 44px;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn.primary { background: linear-gradient(135deg, #8b5cf6, #5b2fd6); }
.btn.gold { background: linear-gradient(135deg, #ffd978, #e3a733); color: #3b2400; }
.btn.green { background: linear-gradient(135deg, #34d399, #0f9b5c); }
.btn.danger { background: linear-gradient(135deg, #ff5d6c, #d7193a); box-shadow: 0 8px 22px #d7193a55; }
.btn.ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.btn.small { font-size: 14px; padding: 6px 12px; min-height: 38px; border-radius: 12px; }
.btn.block { display: block; width: 100%; }
.btn.huge { font-size: 26px; padding: 14px 22px; width: 100%; border-radius: 20px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
body.busy { cursor: progress; }

input, select, textarea {
  display: block; width: 100%; font-size: 18px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: #fff; color: var(--ink); margin-top: 4px;
}
textarea { line-height: 1.6; min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #8b5cf6; outline: none; box-shadow: 0 0 0 3px #8b5cf640; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.label { display: block; font-weight: 800; margin: 10px 0 4px; }
.code-input { font-size: 30px; text-align: center; letter-spacing: 0.3em; direction: ltr; max-width: 270px; display: inline-block; }

.banner { background: #fff7d6; color: #5c4300; border: 2px solid var(--gold); border-radius: 16px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 12px; font-weight: 800; font-size: 14px; background: var(--violet-l); color: var(--ink); }
.badge.active { background: #dcfce7; color: #166534; }
.badge.finished { background: #eef2f7; color: #475569; }
.badge.style-gems { background: #2a1474; color: var(--gold-l); }
.badge.style-noor { background: #ffe3f0; color: #9d174d; }
.chip { display: inline-block; background: #ffffffe0; color: var(--ink); border-radius: 999px; padding: 4px 14px; font-weight: 800; font-size: 14px; text-decoration: none; }
.chip.pm { display: flex; align-items: center; justify-content: center; gap: 4px; }
.chip.pm b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--violet); color: #fff; margin: 0 6px; vertical-align: middle; }

/* ---------- Accueil ---------- */
.home-grid { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px; align-items: start; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.game-card {
  position: relative; border-radius: 26px; padding: 14px 14px 18px; text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 10px; border: 3px solid var(--gold); box-shadow: var(--shadow), inset 0 0 0 3px #ffffff33; overflow: hidden;
}
.game-card.gems { background: radial-gradient(circle at 50% 18%, #8e5bff 0%, #4b23b5 55%, #2a1474 100%); color: #fff; }
.game-card.noor { background: radial-gradient(circle at 50% 10%, #fff 0%, #ffd6ea 45%, #ff9cc9 100%); color: #5a1736; }
.game-card.wheel { background: radial-gradient(circle at 50% 12%, #f2fff6 0%, #a7ecc4 52%, #2fae6e 100%); color: #10462a; }
.card-art { width: 100%; display: flex; justify-content: center; align-items: center; }
.card-art > svg { width: 100%; height: auto; max-height: 210px; }
.card-plaque {
  background: linear-gradient(#4a1f86, #2d1160); color: var(--gold-l); border: 2px solid var(--gold); border-radius: 18px;
  padding: 2px 22px 6px; margin-top: -14px; box-shadow: 0 6px 0 #1a0b3a55; position: relative;
}
.card-plaque h2 { margin: 0; font-size: 30px; line-height: 1.25; }
.card-plaque span { display: block; color: #fff; font-weight: 700; font-size: 14px; }
.noor .card-plaque { background: linear-gradient(#fffaf0, #ffe6b3); color: #6b1238; }
.noor .card-plaque span { color: #6b1238; }
.wheel .card-plaque { background: linear-gradient(#fffaf0, #ffe6b3); color: #0f5132; }
.wheel .card-plaque span { color: #0f5132; }
.card-desc { margin: 0; font-weight: 800; font-size: 18px; }
.btn.play { width: 100%; font-size: 22px; padding: 8px 14px; border-radius: 999px; border: 3px solid #ffffff99; margin-top: auto; }
.btn.play.gems { background: linear-gradient(#8b5cf6, #4c1fd1); }
.btn.play.noor { background: linear-gradient(#ff6aa8, #d81b6a); }
.btn.play.wheel { background: linear-gradient(#34c77b, #13894e); }
.btn.small.play { width: auto; font-size: 14px; padding: 6px 12px; border-width: 2px; }

.group-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--violet-l); border-radius: 999px; padding: 6px 16px; font-weight: 800; margin: 10px 0; }
.group-pill.big { font-size: 22px; background: #fff; box-shadow: var(--shadow); }

.quick { display: grid; gap: 10px; }
.quick-btn {
  display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 10px; background: var(--panel); border-radius: 18px;
  padding: 8px 12px; text-decoration: none; color: var(--ink); font-weight: 800; box-shadow: var(--shadow); border: 2px solid #fff;
}
.quick-btn .bi { align-items: flex-start; }
.quick-btn .q-ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #8b5cf6, #5b2fd6); color: #fff; font-size: 22px; }
.quick-btn em { background: var(--violet-l); border-radius: 99px; padding: 0 10px; font-style: normal; }
.info-box { background: #eef6ff; border-radius: 18px; padding: 12px 14px; font-weight: 800; box-shadow: var(--shadow); }
.info-box .bi { align-items: flex-start; }
.info-box.finish { background: linear-gradient(#fff5f6, #ffe1e6); border: 2px solid #ffb3c0; }
.info-box .btn { margin-top: 10px; }
.info-box small { display: block; margin-top: 6px; color: var(--muted); font-weight: 600; }

.bottom-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: var(--panel); border-radius: 999px; padding: 8px; margin: 18px auto 0; max-width: 1040px; box-shadow: var(--shadow); }
.bottom-bar > * { display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; font-weight: 800; font-size: 16px; color: var(--ink); text-decoration: none; padding: 8px; border-radius: 999px; cursor: pointer; }
.bottom-bar > *:hover { background: var(--violet-l); }

/* ---------- Page publique ---------- */
.landing { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; margin-top: 18px; }
.landing h1 { font-size: 26px; margin: 0 0 8px; }
.landing .row { margin-top: 14px; flex-wrap: wrap; }
.landing-art { display: flex; gap: 10px; margin-top: 14px; }
.landing-art svg { width: 50%; height: auto; }
.join-card form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Bibliothèque / éditeur ---------- */
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; margin-bottom: 18px; }
.quiz-card { display: flex; gap: 12px; background: var(--panel); border-radius: 20px; padding: 14px; box-shadow: var(--shadow); }
.quiz-cover { flex: none; width: 70px; height: 70px; border-radius: 18px; display: grid; place-items: center; font-size: 36px; }
.quiz-card.gems .quiz-cover { background: linear-gradient(135deg, #4b23b5, #1b1558); }
.quiz-card.noor .quiz-cover { background: linear-gradient(135deg, #ffd6ea, #ffeef6); }
.quiz-body { flex: 1; min-width: 0; }
.quiz-body h3 { margin: 0 0 4px; font-size: 19px; overflow-wrap: anywhere; }
.quiz-body p { margin: 0 0 8px; }
.quiz-body .bi { display: inline; }
.editor { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.codebox { background: #241c4f; color: #f6f0ff; border-radius: 14px; padding: 12px; font-size: 14px; white-space: pre-wrap; text-align: left; margin: 6px 0; }
.preview .ok { color: #15803d; font-weight: 800; }
.preview .err { color: #be123c; font-weight: 800; background: #fff1f2; border-radius: 12px; padding: 8px 12px; }
.preview-list { max-height: 280px; overflow: auto; padding-inline-start: 22px; }
.preview-list li { margin-bottom: 6px; }
.preview-list .good { display: block; color: #15803d; font-weight: 700; }
.preview-list small { color: var(--muted); }

/* ---------- Roue des pétales ---------- */
.flower-wrap { position: relative; width: 470px; max-width: 100%; aspect-ratio: 1 / 1; margin: 0 auto; }
.flower-wrap > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.flower-rotor { transform-origin: 50% 50%; will-change: transform; }
.flower-rotor text { font-family: var(--font); font-weight: 800; fill: #3d2560; paint-order: stroke; stroke: #ffffffcc; stroke-width: 5px; }
.petal.used ellipse { opacity: 0.42; }
.petal.used text { opacity: 0.65; }
.flower-heart {
  position: absolute; inset: 0; margin: auto; width: 25%; height: 25%; border-radius: 50%; display: grid; place-items: center;
  font-size: clamp(20px, 5vw, 44px); background: radial-gradient(circle at 35% 30%, #fff8c9, #f4c24f 60%, #d18f1f);
  border: 5px solid #fff; box-shadow: 0 8px 20px #0003; color: #fff;
}
.flower-wrap.mini { width: 230px; }
.flower-wrap.mini .flower-heart { color: #8a5200; font-size: 26px; border-width: 4px; }
.flower-wrap.empty { display: grid; place-items: center; text-align: center; font-weight: 800; aspect-ratio: auto; min-height: 160px; }
.wheel-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(290px, 0.75fr); gap: 18px; align-items: start; }
.wheel-stage { position: relative; padding-top: 38px; text-align: center; background: radial-gradient(circle at 50% 45%, #fff 0%, #f6f0ff 60%, #e9dcff 100%); }
.pin { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); font-size: 40px; line-height: 1; color: var(--red); z-index: 3; filter: drop-shadow(0 3px 2px #0004); }
.pm-btn { position: absolute; bottom: 16px; width: 58px; height: 58px; border-radius: 50%; border: 3px solid #fff; font-size: 34px; font-weight: 800; color: #fff; box-shadow: 0 6px 14px #0003; cursor: pointer; line-height: 1; }
.pm-btn.minus { inset-inline-end: 16px; background: linear-gradient(#a78bfa, #6d28d9); }
.pm-btn.plus { inset-inline-start: 16px; background: linear-gradient(#34d399, #059669); }
.winner { font-size: clamp(26px, 4vw, 40px); font-weight: 800; color: #b0247a; min-height: 1.6em; margin-top: 8px; }
.count { text-align: center; font-weight: 700; }
.petal-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; max-height: 340px; overflow: auto; }
.petal-list li { display: flex; justify-content: space-between; align-items: center; background: var(--violet-l); border-radius: 14px; padding: 4px 10px; font-weight: 800; font-size: 18px; }
.petal-list li.done { opacity: 0.6; }
.petal-list.flash { animation: flash 0.8s 2; }
.tiny-btn { border: 0; background: #fff; border-radius: 10px; min-width: 40px; height: 40px; font-size: 18px; margin-inline-start: 4px; cursor: pointer; }
.pick-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.pick-names .btn { font-size: 19px; }
@keyframes flash { 50% { box-shadow: 0 0 0 4px var(--gold); border-radius: 14px; } }

/* ---------- Salle (enseignante) ---------- */
.room-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; background: var(--panel); border-radius: var(--r); padding: 14px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.room-head h1 { margin: 6px 0 2px; font-size: clamp(22px, 3vw, 34px); overflow-wrap: anywhere; }
.room-head p { margin: 0; }
.room-grid { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.join-panel { text-align: center; }
.code-big { font-size: clamp(44px, 8vw, 84px); font-weight: 800; letter-spacing: 0.12em; color: var(--violet-d); text-align: center; line-height: 1.1; }
.qr-box { display: grid; place-items: center; margin: 6px auto; }
.qr { width: min(230px, 70vw); height: auto; border-radius: 16px; box-shadow: 0 6px 18px #0002; }
.live-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.live-list li { display: grid; grid-template-columns: 32px 30px minmax(0, 1fr) 110px 52px 64px; align-items: center; gap: 8px; background: var(--violet-l); border-radius: 14px; padding: 8px 12px; font-weight: 800; font-size: 18px; }
.live-list li.muted { display: block; }
.live-list .rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--violet); color: #fff; font-size: 15px; }
.live-list .pf { font-size: 22px; }
.bar { height: 10px; background: #fff; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #34d399, #8b5cf6); }
.prog { color: var(--muted); font-size: 15px; text-align: center; }
.pts { font-weight: 800; color: var(--violet-d); text-align: end; }
.key-panel summary { cursor: pointer; font-weight: 800; font-size: 18px; }
.table-wrap { overflow-x: auto; }
table.results { border-collapse: collapse; width: 100%; font-size: 15px; }
.results th, .results td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.results td.m.good { color: #15803d; font-weight: 800; }
.results td.m.bad { color: #be123c; font-weight: 800; }
.key-list { padding-inline-start: 24px; display: grid; gap: 10px; }
.key-list li { background: #fff; border-radius: 14px; padding: 8px 12px; border: 1px solid var(--line); }
.k-q { font-weight: 800; }
.k-en { display: block; font-size: 13px; color: var(--muted); }
.k-a { display: block; color: #15803d; font-weight: 800; }
.k-x { display: block; font-size: 14px; color: #6b4e00; background: #fff8dc; border-radius: 10px; padding: 4px 8px; margin-top: 4px; }
.tag { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 8px; margin-inline-end: 6px; font-weight: 800; background: #eef2f7; }
.tag.good { background: #dcfce7; color: #15803d; }
.tag.bad { background: #ffe4e6; color: #be123c; }
.tag.late { background: #fef3c7; }
.celebrate { position: relative; overflow: hidden; text-align: center; }
.room-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.room-list li { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 8px 12px; flex-wrap: wrap; }
.r-ico { font-size: 28px; }
.r-main { flex: 1; min-width: 180px; }
.r-main small { display: block; color: var(--muted); }
.pick-quiz { list-style: none; padding: 0; display: grid; gap: 8px; }
.pick-quiz li { display: flex; align-items: center; gap: 10px; background: var(--violet-l); border-radius: 14px; padding: 8px 12px; }
.pick-quiz li span { flex: 1; font-weight: 800; overflow-wrap: anywhere; }
.pick-list { display: grid; gap: 6px; padding-inline-start: 28px; font-size: 20px; }
.pick-list small { color: var(--muted); font-size: 13px; }
.space-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

/* Podium et célébration (seulement après « Terminer » de l'enseignante) */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 14px 0; direction: ltr; }
.step { display: flex; flex-direction: column; align-items: center; width: min(130px, 30vw); gap: 2px; }
.step b { font-size: 18px; text-align: center; overflow-wrap: anywhere; }
.step .block { width: 100%; border-radius: 14px 14px 0 0; background: linear-gradient(#ffe08a, #e0a43a); color: #5a3a00; font-size: 28px; font-weight: 800; display: grid; place-items: center; }
.step.s1 .block { height: 120px; }
.step.s2 .block { height: 86px; background: linear-gradient(#eef2f7, #b8c2d0); }
.step.s3 .block { height: 64px; background: linear-gradient(#ffd2b0, #d98b4f); }
.medal { font-size: 34px; }
.step .pf { font-size: 26px; }
.step .pts { text-align: center; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti span { position: absolute; top: -12%; font-size: 26px; animation: fall linear infinite; }
.confetti.static { position: static; font-size: 30px; }
@keyframes fall { to { transform: translateY(130vh) rotate(360deg); } }

/* ---------- Écrans élèves (sans défilement pendant les questions) ---------- */
body.student { background: #0b1036; }
body.student.theme-noor { background: #fff6fb; }
.arena { min-height: 100vh; min-height: 100dvh; position: relative; overflow: hidden; }
.arena.scroll { overflow: visible; }
.play-inner { position: relative; z-index: 1; width: min(920px, 100%); margin: 0 auto; padding: 10px 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 100vh; min-height: 100dvh; }
.arena.scroll .play-inner { min-height: 0; }
.theme-gems.arena { background: radial-gradient(circle at 75% 8%, #3c2a8c 0%, transparent 42%), linear-gradient(180deg, #0b1036, #251a63 60%, #3e2378); color: #fff; }
.theme-noor.arena { background: linear-gradient(180deg, #fff6fb 0%, #ffe8f3 48%, #e6fbef 100%); color: var(--ink); }
.garden-bg { position: absolute; bottom: 0; left: 0; right: 0; height: 110px; opacity: 0.85; pointer-events: none; }
.garden-bg svg { width: 100%; height: 100%; }
.play-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.play-title { flex: 1; text-align: center; font-size: 18px; min-width: 120px; }
.me { background: #ffffff2b; border-radius: 999px; padding: 4px 12px; font-weight: 800; }
.theme-noor .me { background: #fff; box-shadow: 0 4px 12px #ff8fbf33; }
.progress { height: 8px; background: #ffffff3a; border-radius: 99px; overflow: hidden; }
.theme-noor .progress, .theme-noor .timer-bar { background: #ffd6e8; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #f4c24f, #ff8fc4); }
.timer-row { display: flex; justify-content: space-between; align-items: center; font-weight: 800; gap: 8px; }
.timer-row .bi { align-items: flex-start; }
.timer { font-size: 24px; white-space: nowrap; }
.timer.low { color: #ff5d7a; }
.timer-bar { height: 10px; border-radius: 99px; background: #ffffff2e; overflow: hidden; }
.timer-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #34d399, #f4c24f); border-radius: 99px; }
.question-box { border-radius: 26px; padding: clamp(14px, 3vh, 30px) 18px; text-align: center; }
.theme-gems .question-box { background: linear-gradient(135deg, #2c2a78e8, #4a2a8ce8); border: 2px solid var(--gold); box-shadow: 0 0 30px #f4c24f33; }
.theme-noor .question-box { background: #fff; border: 3px solid #ffc2dc; box-shadow: 0 10px 30px #ff8fbf33; }
.q-ar { margin: 0; font-size: clamp(22px, 4.2vw, 40px); line-height: 1.55; overflow-wrap: anywhere; }
.q-en { margin: 6px 0 0; opacity: 0.85; font-size: clamp(14px, 2vw, 18px); }
.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding-bottom: 64px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
.choice {
  display: flex; align-items: center; gap: 12px; min-height: clamp(72px, 13vh, 130px); padding: 12px 16px; border: 3px solid transparent;
  cursor: pointer; text-align: start; transition: transform 0.12s, opacity 0.2s; width: 100%;
}
.theme-gems .choice { background: linear-gradient(160deg, #ffffff, #e3ebff); color: #23185e; border-radius: 60px 48px 56px 44px / 50px 58px 46px 54px; box-shadow: 0 8px 0 #9fb3ff66; }
.theme-noor .choice { background: #fff; color: #4a1f3a; border-color: #ffd0e4; box-shadow: 0 8px 0 #ffb3d166; border-radius: 30px 30px 30px 10px; }
.choice:hover:not(:disabled) { transform: translateY(-2px); }
.choice:disabled { cursor: default; opacity: 0.8; }
.choice.picked { outline: 4px solid var(--gold); opacity: 1; }
.gem { flex: none; width: 42px; height: 42px; display: grid; place-items: center; color: #fff; font-weight: 800; clip-path: polygon(50% 0, 100% 38%, 80% 100%, 20% 100%, 0 38%); }
.gem.g0 { background: linear-gradient(#ff7aa8, #e11d63); }
.gem.g1 { background: linear-gradient(#7cc8ff, #1d74e1); }
.gem.g2 { background: linear-gradient(#7cf0b0, #13a35a); }
.gem.g3 { background: linear-gradient(#c9a2ff, #7b3fe4); }
.theme-noor .gem { clip-path: none; border-radius: 50% 50% 50% 8px; }
.c-text { display: flex; flex-direction: column; min-width: 0; }
.c-ar { font-size: clamp(18px, 3vw, 26px); font-weight: 800; overflow-wrap: anywhere; }
.c-en { font-size: 13px; opacity: 0.75; }
.feedback { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 180%); padding: 12px 28px; border-radius: 999px; font-size: 24px; font-weight: 800; transition: transform 0.25s; z-index: 30; text-align: center; }
.feedback.show { transform: translate(-50%, 0); }
.feedback.good { background: #16a34a; color: #fff; }
.feedback.bad { background: #db2777; color: #fff; }
.feedback.late { background: #f59e0b; color: #2b1900; }
.shake { animation: shake 0.4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.play-card { background: #ffffffef; color: var(--ink); border-radius: 26px; padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.play-card.center { text-align: center; margin-top: 20px; }
.play-card.join { max-width: 540px; margin: 16px auto; text-align: center; }
.play-card.join form { text-align: start; }
.join-art svg { width: 150px; height: auto; }
.join-title { font-size: 20px; font-weight: 800; margin: 6px 0; overflow-wrap: anywhere; }
.flower-pick { display: grid; grid-template-columns: repeat(6, minmax(0, 54px)); gap: 6px; justify-content: center; margin-bottom: 14px; }
.flower-pick label { position: relative; }
.flower-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.flower-pick span { display: grid; place-items: center; width: 100%; aspect-ratio: 1 / 1; font-size: 30px; border-radius: 18px; background: #fff; border: 3px solid var(--line); cursor: pointer; }
.flower-pick input:checked + span { border-color: var(--violet); box-shadow: 0 0 0 3px #8b5cf655; transform: scale(1.06); }
.flower-pick input:focus-visible + span { outline: 3px solid var(--gold); }
.big-emoji { font-size: 72px; }
.score-line { font-size: 20px; font-weight: 800; }
.waiting .wait { font-size: 20px; font-weight: 800; color: var(--violet-d); }
.dots i { display: inline-block; width: 12px; height: 12px; margin: 4px; border-radius: 50%; background: var(--violet); animation: bounce 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 50% { transform: translateY(-8px); } }
.play-card.watch { text-align: center; }
.play-card.watch .wheel-stage { position: relative; padding-top: 38px; background: none; }
.play-card.final h1, .play-card.final h2 { text-align: center; }

/* ---------- Fenêtres, messages ---------- */
.modal-backdrop { position: fixed; inset: 0; background: #0b1036b8; z-index: 50; }
.modal { position: fixed; z-index: 51; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 24px)); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border-radius: 24px; padding: 20px; box-shadow: var(--shadow); color: var(--ink); }
.modal.wide { width: min(760px, calc(100% - 24px)); }
.modal h2 { margin-top: 0; }
.share-text { font-size: 15px; }
.toast { visibility: hidden; opacity: 0; position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 200%); background: #2a1d4f; color: #fff; padding: 12px 22px; border-radius: 16px; z-index: 60; max-width: min(92vw, 560px); text-align: center; font-weight: 700; transition: transform 0.25s, opacity 0.25s, visibility 0.25s; box-shadow: var(--shadow); }
.toast.show { transform: translate(-50%, 0); visibility: visible; opacity: 1; }
.toast.error { background: #b4153a; }
body.offline::before { content: '📡 Connexion perdue… nouvel essai automatique'; position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: #f59e0b; color: #2b1900; text-align: center; font-weight: 800; padding: 4px; }
.site-foot { text-align: center; color: #e9e2ffcc; font-size: 13px; margin: 26px 0 0; }
.loading, .fatal { min-height: 80vh; display: grid; place-content: center; text-align: center; color: #fff; }
.loading .big { font-size: 80px; animation: float 3s ease-in-out infinite; }
.fatal a { color: var(--gold-l); }
@keyframes float { 50% { transform: translateY(-10px); } }
.print-head { display: none; }

/* Mode projection (plein écran) : seulement le jeu, sans en-tête ni menus */
html:fullscreen .site-head, html:fullscreen .main-nav, html:fullscreen .banner, html:fullscreen .site-foot,
html:fullscreen .art-mosque, html:fullscreen .art-lantern { display: none; }
html:fullscreen .frame { padding-top: 12px; padding-bottom: 40px; }

/* ---------- Adaptation tablette / téléphone ---------- */
@media (max-width: 1180px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-grid .cards { order: -1; }
  .home-grid .quick { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
  .art-lantern.l2, .art-lantern.l4 { display: none; }
}
@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .wheel-layout, .room-grid, .editor, .space-grid, .landing { grid-template-columns: 1fr; }
  .art-mosque { display: none; }
  .art-moon { left: 6%; width: 60px; }
}
@media (max-width: 640px) {
  .home-grid, .cards { grid-template-columns: 1fr; }
  .home-grid .quick { grid-template-columns: 1fr; }
  .site-head { flex-direction: column; align-items: center; min-height: 0; }
  .welcome { position: static; margin-top: 8px; }
  .plaque { padding: 4px 18px 8px; }
  .main-nav { justify-content: flex-start; border-radius: 22px; width: 100%; }
  .main-nav a { padding: 6px 10px; font-size: 15px; }
  .bottom-bar { grid-template-columns: 1fr 1fr; border-radius: 22px; }
  .choices { grid-template-columns: 1fr; gap: 9px; }
  .choice { min-height: 62px; padding: 8px 12px; }
  .live-list li { grid-template-columns: 30px 26px minmax(0, 1fr) 46px 56px; font-size: 16px; }
  .live-list .bar { display: none; }
  .art-lantern { display: none; }
  .frame { padding-bottom: 110px; }
  .panel { padding: 14px; }
  .btn.huge { font-size: 22px; }
  .quiz-grid { grid-template-columns: 1fr; }
}
@media (max-height: 640px) {
  .question-box { padding: 10px 14px; }
  .q-ar { font-size: clamp(20px, 3.4vw, 30px); }
  .choice { min-height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .confetti span { display: none; }
}

/* ---------- Impression / PDF des résultats ---------- */
@media print {
  @page { margin: 14mm; }
  body, body.student { background: #fff !important; color: #000; }
  .decor, .site-head, .main-nav, .site-foot, .bottom-bar, .no-print, .btn, .modal-backdrop, .toast, .banner,
  .room-grid, .room-head .row, .confetti, .key-panel, body.offline::before { display: none !important; }
  body.modal-open .frame { display: none !important; }
  .modal { position: static; transform: none; box-shadow: none; width: 100%; max-height: none; padding: 0; }
  .frame { width: 100%; padding: 0; }
  .panel, .room-head { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .print-head { display: block; font-size: 12pt; margin-bottom: 8px; }
  table.results { font-size: 10pt; }
  .key-list li { break-inside: avoid; }
}
