/* CotralQuiz - app joueur. Charte Cotral : Inter (fallback Arial), sans gras, fond sombre. */
:root {
  --bleu-chat: #003366;
  --bleu-nuit: #001B36;
  --bleu-logo: #005BA6;
  --gris-clair: #DADADC;
  --cyan: #28B9D0;
  --bleu-gris: #8FA9B8;
  --blanc: #FFFFFF;
  --surface: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .22);
  --success: #2D9B1E;
  --error: #D0102B;
  --flame: #FF7A1A;
  --rouge: #D0102B;
  --bleu: #1C6FD1;
  --jaune: #D9A400;
  --vert: #2D9B1E;
  --font: 'Inter', Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bleu-nuit);
  color: var(--blanc);
  font-family: var(--font);
  font-weight: 300;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior: none;
  background: radial-gradient(ellipse at top, var(--bleu-chat), var(--bleu-nuit) 70%) var(--bleu-nuit);
  user-select: none;
  -webkit-user-select: none;
}

.top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  min-height: 48px;
}
.logo { height: 21px; width: auto; }
.app-name { font-size: 18px; font-weight: 200; color: var(--cyan); margin-left: 6px; }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 8px; font-weight: 400; min-width: 0; }
.me .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.me .avatar { font-size: 22px; line-height: 1; }
.me .score { background: var(--blanc); color: var(--bleu-chat); padding: 3px 10px; border-radius: 4px; }

.lisere {
  height: 5px;
  flex: none;
  background: linear-gradient(to right,
    var(--gris-clair) 0 50%, var(--bleu-chat) 50% 75%, var(--bleu-logo) 75% 100%);
}

.banner { background: var(--blanc); color: var(--bleu-chat); text-align: center; padding: 8px; font-size: 14px; }

main { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ----- Messages ----- */
.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 12px;
}
.center h1 { font-size: 30px; font-weight: 200; margin: 8px 0 0; }
.center p { font-size: 17px; color: var(--gris-clair); margin: 0; line-height: 1.45; }
.icon { width: 80px; height: 80px; color: var(--cyan); }
.big-avatar { font-size: 72px; line-height: 1; }
svg.flame { width: 1.1em; height: 1.1em; fill: var(--flame); vertical-align: -0.18em; }

/* ----- Rejoindre ----- */
form.join {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}
form.join h1 { font-size: 28px; font-weight: 200; margin: 0 0 8px; }
label, .label { font-size: 14px; color: var(--cyan); display: flex; flex-direction: column; gap: 6px; }
input {
  font: inherit;
  font-size: 22px;
  font-weight: 300;
  color: var(--blanc);
  background: rgba(0, 0, 0, .25);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
input:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(40, 185, 208, .3); }
input.pin { letter-spacing: 6px; }
.error { color: #FF8A80; font-size: 15px; min-height: 1em; margin: 0; }
button.primary {
  font: inherit;
  font-size: 20px;
  font-weight: 400;
  padding: 16px;
  border: 0;
  border-radius: 6px;
  background: var(--bleu-logo);
  color: var(--blanc);
}
button.primary:disabled { opacity: .5; }

/* ----- Réponses ----- */
.pad { flex: 1; display: flex; flex-direction: column; padding: 8px; gap: 8px; min-height: 0; }
.pad-head { display: flex; justify-content: space-between; padding: 4px 6px; font-size: 16px; }
.pad-head .timer { font-weight: 400; }
.grid { flex: 1; display: grid; gap: 10px; min-height: 0; }
.grid.four { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.grid.three { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.grid.two { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.choice {
  border: 0;
  border-radius: 10px;
  color: var(--blanc);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 26px;
  font-weight: 400;
  transition: transform .08s;
}
.choice:active { transform: scale(.96); }
.choice svg { width: 72px; height: 72px; fill: var(--blanc); }
.c0 { background: var(--rouge); }
.c1 { background: var(--bleu); }
.c2 { background: var(--jaune); }
.c3 { background: var(--vert); }

.chosen { padding: 28px; border-radius: 12px; display: flex; }
.chosen svg { width: 72px; height: 72px; fill: var(--blanc); }

/* ----- Résultat ----- */
.result { color: var(--blanc); }
.result.ok { background: var(--success); }
.result.ko { background: var(--error); }
.result.none { background: #3D5566; }
.result .icon { color: var(--blanc); width: 96px; height: 96px; }
.result h1 { font-weight: 300; font-size: 34px; }
.result p { color: var(--blanc); }
.result .points { font-size: 28px; font-weight: 400; }

.pop { animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ----- Bonne réponse (après un raté) ----- */
.answer-key { margin-top: 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.answer-key > span { font-size: 15px; opacity: .9; }
.answer-key .keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.answer-key .key {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: 8px; border: 1px solid rgba(255, 255, 255, .7); font-size: 16px;
}
.answer-key .key svg { width: 26px; height: 26px; fill: var(--blanc); }

/* ----- Partie ouverte ailleurs ----- */
.actions { display: flex; justify-content: center; padding: 0 24px 24px; }

/* ----- Avatar et RGPD (rejoindre) ----- */
.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.avatars button {
  font-size: 26px; line-height: 1; padding: 6px 0; border-radius: 8px; border: 1px solid transparent;
  background: var(--surface); cursor: pointer;
}
.avatars button.on { border-color: var(--cyan); background: rgba(40, 185, 208, .25); }
.privacy { font-size: 12px; color: var(--bleu-gris); margin: 0; line-height: 1.4; }

/* ----- Avis de fin de partie ----- */
.feedback { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; margin-top: 16px; padding: 16px; border-radius: 10px; background: var(--surface); }
.feedback h2 { font-size: 18px; font-weight: 300; margin: 0; }
.rating { display: flex; justify-content: center; gap: 6px; }
.rating button { font-size: 36px; background: none; border: 0; color: rgba(255, 255, 255, .3); padding: 2px 4px; cursor: pointer; }
.rating button.on { color: #FFC23D; }
textarea {
  font: inherit; font-size: 16px; color: var(--blanc); background: rgba(0, 0, 0, .25); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 12px; min-height: 70px; resize: none; outline: none; user-select: text; -webkit-user-select: text;
}

/* ----- Choix de l'équipe ----- */
.teams { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.teams button {
  font: inherit; font-size: 17px; color: var(--blanc); background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 10px 16px; cursor: pointer;
}
.teams button.on { border-color: var(--cyan); background: rgba(40, 185, 208, .3); }
