/* Page Élève – Calcul Mental */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #F4F6FB;
  --surface: #FFFFFF;
  --accent: #2A6FDB;
  --accent-mid: #4E8BEC;
  --text-1: #1B2438;
  --text-2: #5A6A82;
  --text-3: #7A8AA0;
  --border: #E8EDF4;
  --danger: #C4443C;
  --success: #1F9D6B;
}
[data-ss-theme="dark"] {
  --bg: #0B1220;
  --surface: #131C2E;
  --accent: #4E8BEC;
  --accent-mid: #6FA1EF;
  --text-1: #EAF0FB;
  --text-2: #A7B6CE;
  --text-3: #8FA0BE;
  --border: #243352;
}

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

body {
  font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
}

.screen { display: none; width: 100%; max-width: 480px; }
.screen.active { display: block; }

.card {
  background: var(--surface);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 8px 32px rgba(13,30,28,0.10);
  border: 1px solid var(--border);
}

h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
p.sub { color: var(--text-3); font-size: 0.92rem; margin-bottom: 22px; line-height: 1.45; }

label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }

input, select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1.05rem;
  font-family: inherit;
  margin-bottom: 16px;
  background: #fff;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,122,110,0.12);
}

.btn {
  display: block;
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: 0.15s;
  margin-top: 6px;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-mid); }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(26,122,110,0.25);
}
.btn-danger { background: #DC2626; color: white; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.choice-box { display: flex; gap: 12px; margin-bottom: 20px; }
.choice {
  flex: 1;
  padding: 16px 12px;
  border: 2px solid var(--border);
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: 0.15s;
}
.choice:hover { border-color: var(--accent); }
.choice.selected {
  border-color: var(--accent);
  background: #EAF1FC;
  color: var(--accent);
}

.code-big {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--accent);
  font-family: monospace;
  margin: 10px 0;
}

.waiting-icon { font-size: 2.6rem; text-align: center; margin: 18px 0; }
.pulse { animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.timer {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.timer.danger { color: var(--danger); }
.progress { font-size: 0.95rem; color: var(--text-3); font-weight: 600; }

.question-box {
  background: #EAF1FC;
  border: 1px solid rgba(26,122,110,0.15);
  border-radius: 16px;
  padding: 32px 16px;
  text-align: center;
  margin-bottom: 20px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.question-box .katex { font-size: 1.7rem !important; }

.question-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-3);
  font-style: italic;
  margin: -10px 0 16px;
}

.answer-input {
  font-size: 1.4rem;
  text-align: center;
  font-weight: 600;
}

.case-field { margin-bottom: 14px; }
.case-field label { text-align: center; }
.case-field input {
  font-size: 1.4rem;
  text-align: center;
  font-weight: 600;
}

.score-big {
  font-size: 2.8rem;
  font-weight: 700;
  text-align: center;
  color: var(--accent);
  margin: 12px 0 4px;
}

.ops-list { margin-top: 18px; max-height: 280px; overflow-y: auto; }
.op-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  gap: 12px;
}
.op-item .katex { font-size: 0.95rem !important; }
.op-ok { color: var(--success); font-weight: 600; white-space: nowrap; }
.op-ko { color: var(--danger); font-weight: 600; white-space: nowrap; }

.info-box {
  background: #EAF1FC;
  border: 1px solid rgba(26,122,110,0.2);
  border-radius: 12px;
  padding: 14px;
  font-size: 0.88rem;
  color: var(--text-2);
  margin-bottom: 16px;
  line-height: 1.45;
}
.error-msg {
  background: #FEE2E2;
  color: #991B1B;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  margin-bottom: 14px;
  display: none;
}
.logo {
  text-align: center;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 20px;
  font-size: 1.15rem;
}
.logo span { color: var(--text-1); }

/* ---- Sélecteur de langue (coin haut, page autonome sans le kit admin) ---- */
.lang-corner-btn {
  position: fixed; top: 14px; inset-inline-end: 14px; z-index: 60;
  width: 38px; height: 38px; border-radius: 999px;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(13,30,28,0.18);
}
.lang-overlay {
  position: fixed; inset: 0; background: rgba(13,30,28,.45);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 1rem;
}
.lang-overlay.open { display: flex; }
.lang-box {
  background: var(--surface); border-radius: 18px; padding: 22px;
  width: 100%; max-width: 320px; box-shadow: 0 8px 32px rgba(13,30,28,0.15);
}
.lang-box h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 14px; }
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lang-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px; border: 1px solid var(--border); border-radius: 12px;
  background: #fff; cursor: pointer; font-family: inherit; font-size: 0.85rem;
  color: var(--text-1); text-align: start;
}
.lang-btn:hover { border-color: var(--accent); }
.lang-btn.active { border-color: var(--accent); background: #EAF1FC; color: var(--accent); }
.lang-code {
  width: 28px; height: 20px; border-radius: 5px; flex-shrink: 0;
  background: var(--bg); color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700;
}
.lang-btn.active .lang-code { background: var(--accent); color: #fff; }

/* ---- RTL (dir="rtl" posé sur <html> par ss-i18n.js) ---- */
.op-item { text-align: start; }
