:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --primary: #1e88e5; --secondary: #0d47a1; --orange: #ff6d00;
  --success: #4caf50; --error: #f44336; --background: #f5f7fa;
  --surface: #fff; --text: #212b36; --dark-gray: #546e7a;
  --gray: #90a4ae; --light-gray: #cfd8dc; --border: #e5e8ec;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--background); color: var(--text); }
body { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(30,136,229,.28); outline-offset: 2px; }
#app { min-height: 100dvh; }
.app-shell { width: min(100%,560px); min-height: 100dvh; margin: 0 auto; padding-bottom: calc(82px + env(safe-area-inset-bottom)); background: var(--background); }
.page { padding: calc(10px + env(safe-area-inset-top)) 16px 34px; }

/* Accueil : mêmes proportions et hiérarchie que l'application Android. */
.trial-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 20px; padding: 10px 14px; border-radius: 10px; color: white; background: var(--secondary); }
.trial-banner.expired { background: var(--error); }
.trial-banner div { flex: 1; min-width: 0; }
.trial-banner strong, .trial-banner span { display: block; }
.trial-banner strong { margin-bottom: 2px; font-size: 12px; }
.trial-banner span { font-size: 10px; line-height: 13px; opacity: .95; }
.trial-banner button { flex: 0 0 auto; border: 0; border-radius: 8px; padding: 9px 12px; color: var(--secondary); background: white; font-size: 12px; font-weight: 800; }
.trial-banner.expired button { color: var(--error); }
.home-hero { text-align: center; }
.home-hero img { display: block; width: min(70vw,300px); height: clamp(125px,19vh,165px); margin: 12px auto 22px; object-fit: contain; }
.home-hero h1 { max-width: 440px; margin: 0 auto 12px; color: var(--text); font-size: clamp(25px,7vw,31px); line-height: 1.28; font-weight: 700; }
.home-hero p { max-width: 440px; margin: 0 auto 30px; color: var(--dark-gray); font-size: 18px; line-height: 24px; }
.home-hero p strong { color: var(--primary); }
.home-features { display: grid; gap: 12px; max-width: 430px; margin: 0 auto; }
.feature-card { display: flex; align-items: center; width: 100%; min-height: 76px; border: 0; border-radius: 12px; padding: 16px; text-align: left; color: var(--text); background: white; box-shadow: 0 2px 7px rgba(0,0,0,.1); }
.feature-icon { display: grid; flex: 0 0 44px; width: 44px; height: 44px; place-items: center; margin-right: 12px; border-radius: 50%; background: rgba(30,136,229,.1); font-size: 21px; }
.feature-card strong { font-size: 15px; font-weight: 600; }
.feature-copy { display: flex; flex-direction: column; }
.feature-copy small { margin-top: 3px; color: var(--orange); font-size: 12px; font-weight: 600; }

/* Barre d'onglets Android : Accueil et Statistiques. */
.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%); display: grid; grid-template-columns: repeat(2,1fr); width: min(100%,560px); min-height: 72px; padding: 6px 28px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: rgba(255,255,255,.98); }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; color: var(--gray); background: transparent; font-size: 12px; font-weight: 600; }
.nav-item img { width: 24px; height: 24px; object-fit: contain; opacity: .46; filter: grayscale(1); }
.nav-item.active { color: var(--primary); }
.nav-item.active img { opacity: 1; filter: none; }

/* Liste des catégories Android. */
.screen-header { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; padding-top: 7px; }
.screen-header h1 { grid-column: 2; margin: 0; color: var(--primary); text-align: center; font-size: 23px; line-height: 30px; }
.round-back { display: grid; width: 50px; height: 50px; place-items: center; border: 0; border-radius: 50%; background: white; box-shadow: 0 3px 10px rgba(0,0,0,.16); }
.round-back img { width: 25px; height: 25px; object-fit: contain; }
.screen-subtitle { max-width: 420px; margin: 12px auto 26px; color: var(--dark-gray); text-align: center; font-size: 16px; line-height: 22px; }
.category-list { display: grid; gap: 22px; }
.category { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 20px; width: 100%; min-height: 96px; padding: 20px; border: 1px solid rgba(229,232,236,.2); border-radius: 24px; color: var(--text); text-align: left; background: white; box-shadow: 0 3px 11px rgba(0,0,0,.09); }
.category-icon { position: relative; display: grid; width: 54px; height: 54px; place-items: center; overflow: hidden; border-radius: 50%; background: rgba(30,136,229,.08); }
.category-icon > img { width: 34px; height: 34px; object-fit: contain; }
.category-icon i { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.5); font-style: normal; font-size: 24px; }
.category strong, .category small { display: block; }
.category strong { overflow: hidden; margin-bottom: 2px; font-size: 15px; line-height: 20px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.category small { color: var(--primary); font-size: 12px; font-weight: 700; }
.category-end { color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: .5px; }
.category-end img { width: 20px; height: 20px; opacity: .7; }
.category.locked { border: 2px dashed var(--gray); opacity: .7; box-shadow: none; }
.category.locked strong { color: var(--gray); }
.category.locked small { color: var(--orange); }

/* Question d'entraînement ou d'examen. */
.quiz-screen { width: min(100%,560px); min-height: 100dvh; margin: 0 auto; padding-top: env(safe-area-inset-top); background: var(--background); }
.quiz-top { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; padding: 16px 16px 8px; }
.round-back.close { width: 50px; height: 50px; }
.live-stats { display: grid; grid-template-columns: 1fr 1px 1fr; align-items: center; min-height: 78px; padding: 12px 14px; border: 1px solid #111; border-radius: 9px; }
.live-stats > div { display: flex; align-items: center; justify-content: center; gap: 9px; }
.live-stats img { width: 28px; height: 28px; object-fit: contain; }
.live-stats span { display: flex; flex-direction: column; }
.live-stats strong { font-size: 14px; }
.live-stats small { margin-top: 2px; color: var(--dark-gray); font-size: 11px; }
.live-stats > i { width: 1px; height: 44px; background: var(--border); }
.quiz-page { position: relative; padding: 16px 0 115px; }
.question-card { width: 90%; margin: 0 auto 12px; padding: 14px 13px; border-radius: 12px; background: white; box-shadow: 2px 2px 8px rgba(0,0,0,.28); }
.question-heading { display: flex; flex-wrap: wrap; align-items: center; min-height: 30px; color: var(--gray); }
.question-heading > span { font-size: 14px; font-style: italic; }
.question-heading > em { margin-left: 3px; font-size: 9px; }
.question-heading > strong { margin-left: 8px; font-size: 18px; font-weight: 400; }
.question-heading > strong small { font-size: 12px; }
.question-heading .speak { display: grid; width: 30px; height: 30px; margin-left: 10px; place-items: center; border: 0; border-radius: 50%; background: transparent; }
.question-heading .speak img { width: 24px; height: 24px; }
.question-heading > b { margin-left: auto; color: var(--secondary); font-size: 12px; }
.question-divider { width: 80%; margin: 2px 0 10px; border-top: 1px solid var(--border); }
.question-text { margin: 0; color: var(--dark-gray); font-size: 16px; line-height: 22px; text-align: justify; }
.question-image { display: block; width: 100%; max-height: 190px; margin: 7px auto 0; object-fit: contain; }
.options { display: grid; gap: 12px; width: 90%; margin: 0 auto; padding: 5px 0; }
.option { width: 100%; min-height: 54px; padding: 12px; border: 1px solid #111; border-radius: 12px; color: #1976d2; text-align: left; background: white; font-size: 15px; line-height: 22px; font-weight: 600; }
.option.selected { border-color: var(--primary); color: white; background: var(--primary); }
.option.correct { border-color: green; color: white; background: green; }
.option.wrong { border-color: var(--error); color: white; background: var(--error); }
.floating-action { position: fixed; z-index: 20; right: max(20px,calc((100vw - 560px)/2 + 20px)); bottom: calc(20px + env(safe-area-inset-bottom)); padding: 5px 10px; border-radius: 25px; background: rgba(255,255,255,.9); box-shadow: 0 2px 7px rgba(0,0,0,.25); }
.floating-action button { min-width: 94px; min-height: 47px; border: 0; border-radius: 12px; padding: 11px 18px; color: white; background: var(--primary); font-weight: 700; }
.feedback-scrim { position: fixed; z-index: 40; inset: 0; background: rgba(0,0,0,.55); }
.feedback-sheet { position: fixed; z-index: 41; left: 50%; bottom: 0; transform: translateX(-50%); display: flex; align-items: center; justify-content: space-between; gap: 16px; width: min(100%,560px); min-height: 105px; padding: 22px 25px calc(22px + env(safe-area-inset-bottom)); color: white; background: var(--error); }
.feedback-sheet.good { background: #12a84d; }
.feedback-sheet strong { font-size: 17px; line-height: 23px; }
.feedback-sheet button { min-width: 105px; border: 0; border-radius: 10px; padding: 14px 18px; color: #128b42; background: white; font-weight: 800; }
.feedback-sheet.bad button { color: var(--error); }

/* Résultat Android. */
.result-screen { width: min(100%,560px); min-height: 100dvh; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top)) 24px 30px; background: var(--background); }
.result-screen > h1 { margin: 12px 0 26px; color: var(--text); text-align: center; font-size: 19px; font-weight: 600; }
.score-circle { display: flex; flex-direction: column; align-items: center; justify-content: center; width: min(45vw,160px); height: min(45vw,160px); margin: 0 auto; border: 3px solid var(--score-color); border-radius: 50%; background: white; box-shadow: 0 6px 16px rgba(0,0,0,.15); }
.score-circle > span { margin-bottom: 8px; color: var(--gray); font-size: 14px; }
.score-circle > strong { color: var(--score-color); font-size: 40px; font-weight: 800; }
.score-circle > strong small { margin-left: 4px; font-size: 16px; font-weight: 600; }
.result-screen > h2 { margin: 34px 0 24px; color: var(--dark-gray); text-align: center; font-size: 14px; letter-spacing: 1px; }
.result-stats { display: grid; grid-template-columns: 1fr 1px 1fr; align-items: center; padding: 24px; border-radius: 18px; background: white; box-shadow: 0 3px 9px rgba(0,0,0,.08); }
.result-stats > div { display: grid; justify-items: center; }
.result-stats img { width: 34px; height: 34px; margin-bottom: 7px; object-fit: contain; }
.result-stats strong { font-size: 15px; }
.result-stats span { margin-top: 4px; color: var(--dark-gray); text-align: center; font-size: 12px; }
.result-stats > i { width: 1px; height: 74px; background: var(--border); }
.result-actions { display: grid; gap: 10px; margin-top: 27px; }
.result-actions button { display: flex; align-items: center; width: 100%; min-height: 58px; border: 1.5px solid; border-radius: 14px; padding: 6px 18px; color: white; text-align: left; font-size: 16px; font-weight: 700; }
.result-actions button span { display: grid; width: 40px; height: 40px; margin-right: 14px; place-items: center; border-radius: 50%; background: rgba(255,255,255,.13); font-size: 22px; }
.correction-action { border-color: var(--success)!important; background: var(--success); }
.home-action { border-color: var(--primary)!important; background: var(--primary); }
.correction-modal { position: fixed; z-index: 60; inset: 0; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.55); }
.correction-panel { width: min(100%,560px); max-height: 88dvh; overflow: hidden; border-radius: 24px 24px 0 0; background: var(--background); }
.correction-panel header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; background: white; }
.correction-panel header h2 { margin: 0; color: var(--primary); }
.correction-panel header button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: #edf2f7; font-size: 26px; }
.correction-list { display: grid; gap: 12px; max-height: calc(88dvh - 76px); overflow: auto; padding: 16px; }
.correction-item { padding: 15px; border-left: 5px solid var(--error); border-radius: 10px; background: white; }
.correction-item.ok { border-left-color: var(--success); }
.correction-item p { margin: 7px 0; color: var(--dark-gray); }
.correction-item small { color: var(--primary); }

/* Activation : reproduction des composants Android AuthLogo/AuthForm. */
.auth-screen { position: relative; width: min(100%,560px); min-height: 100dvh; margin: 0 auto; overflow: hidden; background: url('/assets/fond1.jpg') center/cover; }
.auth-overlay { position: absolute; inset: 0; background: rgba(255,255,255,.92); }
.auth-content { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; min-height: 100dvh; padding: calc(24px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom)); }
.auth-content > .round-back { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 16px; }
.auth-logo { margin-bottom: 36px; padding: 16px 0; text-align: center; }
.auth-logo h1 { margin: 0; color: var(--secondary); font-size: 34px; font-weight: 900; letter-spacing: 2px; }
.auth-logo h1 span { color: var(--primary); }
.auth-logo i { display: block; width: 80px; height: 3px; margin: 8px auto 12px; border-radius: 2px; background: var(--primary); }
.auth-logo p { margin: 8px 0 0; color: var(--dark-gray); font-size: 14px; }
.auth-card { width: 100%; margin: 0 auto 24px; padding: 24px; border-radius: 16px; background: white; box-shadow: 0 12px 16px rgba(0,0,0,.08); }
.auth-card label { display: block; margin: 0 0 8px 4px; color: var(--text); font-size: 14px; font-weight: 600; }
.auth-card input { width: 100%; height: 56px; border: 1.5px solid var(--border); border-radius: 12px; padding: 0 16px; color: var(--text); background: var(--background); font-size: 16px; font-weight: 500; }
.auth-card .second-label { margin-top: 18px; }
.auth-primary, .auth-outline, .auth-support { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 400px; min-height: 56px; margin-inline: auto; border-radius: 12px; padding: 12px 16px; text-align: center; text-decoration: none; font-weight: 700; }
.auth-primary { border: 0; color: white; background: var(--primary); box-shadow: 0 8px 10px rgba(30,136,229,.3); font-size: 16px; letter-spacing: .5px; }
.auth-outline { margin-top: 16px; border: 1.5px solid var(--primary); color: var(--primary); background: white; font-size: 14px; }
.auth-support { min-height: 50px; margin-top: 12px; border: 1px solid var(--light-gray); color: var(--primary); background: white; font-size: 14px; font-weight: 600; }
.auth-outline span, .auth-support span { margin-right: 10px; font-size: 18px; }
.device-note { max-width: 400px; margin: 18px auto 0; color: var(--dark-gray); text-align: center; font-size: 12px; line-height: 17px; }

/* Statistiques dans la palette Android. */
.section-title { margin: 12px 0 18px; text-align: center; }
.section-title h2 { margin: 0; color: var(--primary); font-size: 24px; }
.section-title p, .eyebrow { color: var(--dark-gray); }
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.stat { padding: 18px 8px; border-radius: 14px; text-align: center; background: white; box-shadow: 0 2px 7px rgba(0,0,0,.08); }
.stat strong, .stat span { display: block; }
.stat strong { color: var(--primary); font-size: 20px; }
.stat span { margin-top: 5px; color: var(--dark-gray); font-size: 12px; }
.access-panel { overflow: hidden; margin-top: 18px; border-radius: 20px; background: white; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.access-header { padding: 25px 22px; color: white; background: var(--primary); }
.access-header h1 { margin: 4px 0 8px; }
.access-header p { margin: 0; line-height: 1.5; }
.access-header .eyebrow { color: white; opacity: .85; }
.access-body { padding: 22px; }
.field { margin-bottom: 15px; }
.field label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 700; }
.field input { width: 100%; min-height: 52px; border: 1px solid var(--light-gray); border-radius: 12px; padding: 12px 14px; color: var(--text); background: white; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; border: 0; border-radius: 12px; padding: 12px 18px; color: white; background: var(--primary); font-weight: 800; text-decoration: none; }
.btn.orange { background: var(--orange); }
.btn:disabled { opacity: .55; }
.notice { margin: 14px 0; border-radius: 12px; padding: 13px; color: #174f88; background: #eef6ff; font-size: 14px; line-height: 1.45; }
.notice.error { color: #8a2525; background: #ffeded; }
.notice.success { color: #0d6939; background: #e9f8f0; }
.recovery-box { margin-top: 18px; border: 2px dashed var(--primary); border-radius: 14px; padding: 16px; text-align: center; background: #f6fbff; }
.recovery-box p { margin: 0 0 12px; color: var(--text); font-size: 13px; line-height: 1.45; }
.recovery-box p:last-child { margin: 12px 0 0; color: var(--dark-gray); }
.recovery-box code { display: block; margin: 8px 0 14px; color: var(--secondary); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: clamp(19px, 6vw, 25px); font-weight: 900; letter-spacing: 1.5px; user-select: all; }
.copy-key { min-height: 44px; border: 0; border-radius: 10px; padding: 9px 16px; color: white; background: var(--primary); font-weight: 800; }
.empty, .loading-card { padding: 30px 20px; border-radius: 18px; text-align: center; background: white; }
.splash { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 18px; color: var(--dark-gray); }
.splash img { width: 110px; height: 110px; object-fit: contain; }
.loader { width: 38px; height: 38px; border: 4px solid #d8e8f7; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 80; left: 50%; bottom: 94px; transform: translateX(-50%); width: min(420px,calc(100% - 28px)); padding: 13px 16px; border-radius: 14px; color: white; background: #14263c; box-shadow: 0 6px 20px rgba(0,0,0,.2); text-align: center; }

@media (min-width: 561px) {
  body { background: #e8edf3; }
  .app-shell, .quiz-screen, .result-screen { box-shadow: 0 0 28px rgba(25,45,70,.1); }
}
@media (max-height: 720px) {
  .home-hero img { height: 105px; margin-bottom: 10px; }
  .home-hero p { margin-bottom: 18px; }
  .feature-card { min-height: 66px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms!important; transition-duration: .01ms!important; }
}
