Annuaire › Code ouvert
Code publié par son auteur, en lecture seule. « Copier dans mon espace » crée un nouveau site à vous (non publié) que vous pouvez modifier librement.
css/style.css · 5.2 Ko
/* ============================================================
Fichier : css/style.css
Rôle : apparence du quiz (mobile d'abord).
Dépend de : index.html et js/ui.js (qui crée des éléments avec
les classes .choix__bouton, .niveau, etc.).
============================================================ */
/* ----- 1. Variables ----- */
:root {
--fond: #eef3f1;
--carte: #ffffff;
--texte: #1b2a2f;
--texte-doux: #46555a;
--accent: #0b6e6e;
--accent-fonce: #084a4a;
--bon: #1b6e2d;
--bon-fond: #e3f4e6;
--mauvais: #a32121;
--mauvais-fond: #fbe7e7;
--bordure: #b9c7c4;
}
/* ----- 2. Base ----- */
*, *::before, *::after { box-sizing: border-box; }
body {
margin: 0; background: var(--fond); color: var(--texte);
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; /* polices système : aucune ressource externe */
line-height: 1.5;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.aide { color: var(--texte-doux); font-size: .9rem; }
[hidden] { display: none !important; } /* garantit que l'attribut hidden l'emporte sur tout display */
/* Focus bien visible pour la navigation au clavier */
:focus-visible { outline: 3px solid #b45309; outline-offset: 2px; }
h2:focus { outline: none; } /* le titre reçoit le focus par programme : pas besoin d'un cadre */
/* ----- 3. En-tête ----- */
.entete { position: relative; background: var(--accent-fonce); color: #fff; }
.entete__image { display: block; width: 100%; height: 130px; object-fit: cover; opacity: .45; }
.entete__texte { position: absolute; inset: 0; padding: 0 16px; display: flex; flex-direction: column; justify-content: center; gap: 6px; text-shadow: 0 1px 4px rgba(0,0,0,.85); }
.entete h1 { margin: 0; font-size: 1.5rem; }
.option-son { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.option-son input { width: 20px; height: 20px; }
/* ----- 4. Mise en page ----- */
.page { max-width: 640px; margin: 0 auto; padding: 16px; }
.carte { background: var(--carte); border: 1px solid var(--bordure); border-radius: 10px; padding: 16px; }
.carte h2 { margin-top: 0; font-size: 1.3rem; }
.pied { text-align: center; color: var(--texte-doux); padding: 16px; font-size: .9rem; }
/* ----- 5. Écran d'accueil ----- */
.niveaux { border: 1px solid var(--bordure); border-radius: 8px; margin: 0 0 16px; padding: 8px 12px 12px; }
.niveaux legend { font-weight: 700; padding: 0 6px; }
.niveau { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; }
.niveau:hover { background: #e6f2f2; }
.niveau input { width: 20px; height: 20px; flex: none; }
.niveau small { display: block; color: var(--texte-doux); }
.meilleurs { list-style: none; margin: 0 0 8px; padding: 0; }
.meilleurs li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--bordure); }
/* ----- 6. Écran de question ----- */
.infos { display: flex; justify-content: space-between; font-weight: 700; color: var(--texte-doux); }
.minuteur { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.minuteur progress { flex: 1; height: 14px; accent-color: var(--accent); }
.minuteur span { min-width: 3.5em; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.minuteur.urgent span { color: var(--mauvais); }
.minuteur.urgent progress { accent-color: var(--mauvais); }
.choix { display: grid; gap: 10px; margin: 12px 0; }
.choix__bouton {
font: inherit; text-align: left; cursor: pointer; width: 100%;
padding: 12px; border-radius: 8px; border: 2px solid var(--bordure);
background: #fff; color: var(--texte); overflow-wrap: anywhere;
}
.choix__bouton:hover:not(:disabled) { border-color: var(--accent); background: #e6f2f2; }
.choix__bouton:disabled { cursor: default; }
/* Après la réponse : la couleur ne suffit pas, on ajoute aussi un symbole (voir ui.js) */
.choix__bouton.bonne { border-color: var(--bon); background: var(--bon-fond); font-weight: 700; }
.choix__bouton.mauvaise { border-color: var(--mauvais); background: var(--mauvais-fond); }
.retour { border-left: 6px solid var(--accent); background: #f1f7f7; padding: 8px 12px; border-radius: 6px; margin: 12px 0; }
.retour.ok { border-color: var(--bon); background: var(--bon-fond); }
.retour.ko { border-color: var(--mauvais); background: var(--mauvais-fond); }
/* ----- 7. Écran de fin ----- */
.gros { font-size: 1.3rem; font-weight: 700; }
.record { font-weight: 700; color: var(--bon); }
/* ----- 8. Boutons ----- */
.bouton {
font: inherit; font-weight: 700; cursor: pointer; padding: 10px 18px;
border-radius: 8px; border: 2px solid var(--accent); background: var(--accent); color: #fff;
}
.bouton:hover { background: var(--accent-fonce); }
.bouton--discret { background: #fff; color: var(--accent-fonce); }
.bouton--discret:hover { background: #e6f2f2; }
/* ----- 9. Réduction des animations : on respecte le choix de l'utilisateur ----- */
@media (prefers-reduced-motion: reduce) {
* { transition: none !important; animation: none !important; }
}
@media (min-width: 700px) {
.entete h1 { font-size: 2rem; }
.entete__texte { padding: 0 calc((100% - 640px) / 2 + 16px); }
}