/* Trainux : mise en forme commune au site et à la console.
   Reprend la feuille de style du site d'origine : cartes blanches arrondies, ombre douce.
   Les couleurs propres à chaque partie sont dans site.css et admin.css. */

:root {
  --accent: #8c0000;
  --accent-dark: #300000;
  --text: #222;
  --muted: #666;
  --line: #ddd;
  --good: #1b6e2d;
  --bad: #a11212;
  --partial: #8a5a00;
}

* { box-sizing: border-box; }

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  line-height: 1.45;
}

.wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 10px;
  flex: 1;
}

/* En-tête : le logo est le fichier public/logo.png. Pour le changer, remplacer ce fichier
   (PNG, 512 Kio au plus) et relancer les services. */
.welcome-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(1, 1, 1, 0.25);
  text-align: center;
  margin: 10px auto 0;
  padding: 10px; /* même marge blanche des quatre côtés du logo */
  font-size: 20px;
  font-weight: bold;
}
.welcome-box a { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 14px; }
.welcome-box img { display: block; height: auto; }

.menu-box, .card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.menu-box {
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
}
.menu-box { gap: 8px; }
.menu-box .who { margin-right: 8px; }
.menu-box form { margin: 0 0 0 auto; }
.menu-box .lang { margin-left: auto; }
.menu-box .lang + form { margin-left: 0; }

/* Menu principal de la console : une grille de gros boutons. */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.menu-grid a.button { padding: 14px 16px; font-size: 17px; font-weight: bold; }
.menu-grid a.button span { display: block; font-size: 13px; font-weight: normal; opacity: 0.85; margin-top: 4px; }
.card { padding: 20px 30px 26px; }

footer { text-align: center; color: #fff; padding: 20px; }

h1 { font-size: 24px; margin: 0 0 14px; }
h2 { font-size: 18px; margin: 22px 0 8px; }
h3 { font-size: 16px; margin: 18px 0 6px; }
a { color: var(--accent); }
.note { color: var(--muted); font-size: 14px; }
.status { color: var(--muted); margin-top: 0; }
.timer { font-size: 18px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.partial { color: var(--partial); }

[role="alert"] {
  background: #fdecec;
  border-left: 4px solid var(--bad);
  color: var(--bad);
  padding: 8px 12px;
  border-radius: 6px;
}
ul[role="alert"] { padding-left: 30px; }
[role="status"] {
  background: #eaf6ec;
  border-left: 4px solid var(--good);
  color: var(--good);
  padding: 8px 12px;
  border-radius: 6px;
}

table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: #f4f4f4; }
tr.self td { background: #fff4d6; font-weight: bold; }

label { display: inline-block; margin-right: 12px; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid #bbb;
  border-radius: 6px;
  max-width: 100%;
}
textarea { width: 100%; }
textarea.code { font-family: ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace; font-size: 14px; white-space: pre; overflow-x: auto; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; }

button, a.button {
  display: inline-block;
  font: inherit;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  padding: 7px 16px;
  cursor: pointer;
  text-decoration: none;
}
button:hover, a.button:hover { background: var(--accent-dark); }
button.secondary { background: #777; }
button.secondary:hover { background: #555; }
a.button.small { padding: 4px 10px; font-size: 13px; }
form { margin: 10px 0; }

/* Questions et réponses : ce sont souvent des commandes, donc police à chasse fixe. */
pre, code, .mono, .choice label {
  font-family: "DejaVu Sans Mono", "Liberation Mono", Consolas, Menlo, monospace;
}
pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0; }
pre.terminal {
  background: #1b1b1b;
  color: #e6e6e6;
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 15px;
}
pre.plain { background: #f4f4f4; padding: 10px 12px; border-radius: 8px; font-family: inherit; }
code { background: #f0f0f0; padding: 1px 5px; border-radius: 4px; }
.choice { margin: 6px 0; }
.choice label { display: block; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.choice label:hover { background: #f7f7f7; }
ul.choices, ul.achievements { list-style: none; padding-left: 0; }
ul.choices li, ul.achievements li { padding: 5px 0; border-bottom: 1px solid var(--line); }
ul.achievements li { color: var(--text); }
ul.achievements li.good strong { color: var(--good); }

@media (max-width: 600px) {
  .card { padding: 14px; }
  .menu-grid { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
}

/* Cartouche du joueur, en haut à droite : pseudo, niveau et rang. Un clic ouvre le menu.
   C'est l'élément <details> du navigateur : aucun script n'est nécessaire. */
.badge { position: relative; margin-left: auto; }
.menu-box .lang + .badge { margin-left: 0; }
.badge summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 5px 34px 5px 14px;
  border: 2px solid var(--accent);
  border-radius: 10px;
  background: #fff;
  position: relative;
  user-select: none;
}
.badge summary::-webkit-details-marker { display: none; }
.badge summary::after {
  content: "▾";
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
}
.badge[open] summary::after { content: "▴"; }
.badge summary:hover, .badge[open] summary { background: #f6eaea; }
.badge .who-name { font-size: 16px; }
.badge .who-stats { font-size: 12px; color: var(--muted); }
.badge .dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 190px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  padding: 6px;
  z-index: 20;
}
.badge .dropdown form { margin: 0; }
.badge .dropdown .note { margin: 4px 10px 8px; }
.badge .item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.badge .item:hover { background: #f0f0f0; color: var(--accent); }

/* Boutons à cocher (catégories du quizz) : semi-transparents, verts une fois cochés. */
fieldset.toggles { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; }
.toggle { margin: 0; position: relative; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle span {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
  font-weight: bold; /* même graisse cochée ou non : le bouton ne change pas de largeur */
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.toggle:hover span { background: rgba(0, 0, 0, 0.2); }
.toggle input:checked + span { background: #04c464; border-color: #04c464; color: #fff; }
.toggle input:focus-visible + span { outline: 3px solid #222; outline-offset: 2px; }

/* --- Mise en page commune ajoutée avec la refonte de novembre 2026 --- */
.center { text-align: center; }
.note.block { display: block; margin-top: 6px; }
button.wide { min-width: 220px; padding: 10px 20px; font-size: 16px; }
a.button.current, a.button.small.current { background: var(--accent-dark); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); }

/* Formulaire en colonne : une étiquette au-dessus de chaque champ. */
form.stacked label { display: block; margin: 0 0 12px; font-weight: bold; }
form.stacked input[type="text"], form.stacked input[type="password"] { display: block; width: 100%; margin-top: 4px; font-weight: normal; }

/* Titre d'une boîte avec un élément aligné à droite (choix de la langue). */
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.box-head h1 { margin: 0; }

/* Page « nue » (connexion) : grand logo, une seule boîte étroite et centrée. */
.welcome-box.big { padding: 14px; margin-top: 40px; }
.welcome-box.big img { width: 480px; max-width: 100%; height: auto; }
.card.narrow { width: 100%; max-width: 440px; margin: 0 auto; }
