/* Thème violet et composition commune des écrans de préparation. */
:root {
  --selection: #F4E4FA;
  --selection-ink: #351C3B;
  --selection-line: #83508E;
  --selection-mark: #B8488E;
  --violet-start: #6C4175;
  --violet-mid: #4B2D59;
  --violet-end: #291A33;
  --apercu-surface: #362240;
  --apercu-ink: #FFF4FC;
  --apercu-chrono: #603A6D;
  --apercu-trait: #FFADD9;
  --apercu-voile: #36224052;
  --onglet-actif: #FFF8FE;
  --onglet-filet: var(--selection-line);
  --onglet-haut: var(--surface);
  --onglet-bas: var(--surface-3);
  --onglet-survol: var(--selection);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #52345E;
  --bg-deep: var(--violet-end);
  --surface: #3F284B;
  --surface-2: #4D3159;
  --surface-3: #63436C;
  --line: #98779F;
  --line-fort: #BC9BC2;
  --line-soft: #836289;
  --ink: #FFF4FC;
  --ink-2: #ECD8EE;
  --action: #FFADD9;
  --accent-ink: var(--selection-ink);
  --accent-soft: var(--surface-3);
  --action-text: var(--action);
  --shadow: none;
  --shadow-lift: none;
  --onglet-filet: #AA7BAD;
  --onglet-haut: #805288;
  --onglet-bas: #694372;
  --onglet-survol: #84548B;
}
html[data-theme="dark"] body {
  background: linear-gradient(165deg,var(--violet-start),var(--violet-mid) 49%,var(--violet-end) 87%) fixed;
}
html[data-theme="dark"] body:is([data-vue="settings"],[data-vue="exam"],[data-vue="stats"]) {
  isolation: isolate;
}
html[data-theme="dark"] body:is([data-vue="settings"],[data-vue="exam"],[data-vue="stats"])::before {
  display: block;
  inset: auto 0 0;
  height: min(54vh, 440px);
  background: url("art/bg-hero.jpg") center bottom / min(100%, 720px) auto no-repeat;
  -webkit-mask-image: linear-gradient(transparent, var(--ink) 65%);
  mask-image: linear-gradient(transparent, var(--ink) 65%);
  filter: grayscale(1);
  opacity: .23;
  pointer-events: none;
}
html[data-theme="dark"] .tabbar {
  background: var(--violet-end);
  border-width: 1px;
}
html[data-theme="dark"] .tabbar button.on {
  color: var(--action);
  background: transparent;
}
html[data-theme="dark"] .tabbar button.on::before { height: 2px }
html[data-theme="dark"] .btn.primary { background: var(--action); color: var(--selection-ink) }
html[data-theme="dark"] .btn.primary:disabled {
  background: var(--surface-3);
  color: var(--ink-2);
}

body:is([data-vue="settings"],[data-vue="exam"],[data-vue="stats"]) main > .topbar {
  margin-bottom: 6px;
}
body:is([data-vue="settings"],[data-vue="exam"],[data-vue="stats"]) .topbar .back {
  min-height: 44px;
}
body:is([data-vue="settings"],[data-vue="exam"],[data-vue="stats"]) main > .page-title {
  font-size: clamp(2rem, 9vw, 2.6rem);
  margin-bottom: 14px;
}

.reglages-onglets {
  display: flex;
  gap: 1px;
  align-items: stretch;
  margin: 0 0 18px;
}
.reglages-onglets button {
  position: relative;
  isolation: isolate;
  flex: 1 1 auto;
  min-height: 44px;
  min-width: 0;
  padding: 6px clamp(5px, 1.8vw, 12px) 8px;
  color: var(--ink);
  font: 400 clamp(.83rem, 4vw, 1.25rem) / 1.1 var(--f-display);
  letter-spacing: .035em;
  text-transform: uppercase;
}
.reglages-onglets button::before, .reglages-onglets button::after {
  content: "";
  position: absolute;
  inset: 3px 0;
  z-index: -1;
  clip-path: polygon(4px 0,100% 0,calc(100% - 9px) 100%,0 100%);
}
.reglages-onglets button::before {
  background: linear-gradient(var(--onglet-filet),var(--onglet-bas));
}
.reglages-onglets button::after {
  inset: 4px 1px;
  background: linear-gradient(var(--onglet-haut),var(--onglet-bas));
}
.reglages-onglets button[aria-selected="true"] { color: var(--selection-ink) }
.reglages-onglets button[aria-selected="true"]::before { background: var(--onglet-filet) }
.reglages-onglets button[aria-selected="true"]::after {
  background:
    linear-gradient(var(--selection-mark),var(--selection-mark)) 9px 100% / 18px 2px no-repeat,
    var(--onglet-actif);
}
.reglages-onglets button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
@media (hover:hover) {
  .reglages-onglets button[aria-selected="false"]:hover::after { background: var(--onglet-survol) }
}

body[data-vue="settings"] .reglages-panneau.stack { gap: 10px }
.reglages-panneau[hidden] { display: none }
.reglages-panneau > .small { margin: 0 }
.reglages-titre {
  margin: 10px 0 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.reglages-ligne {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 49px;
  width: 100%;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.reglages-ligne > :first-child {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 650;
}
.reglages-ligne > b, .reglages-etat {
  color: var(--ink-2);
  font-size: .9rem;
  text-align: right;
}
.reglages-selection {
  border: 1px solid var(--selection-line);
  border-radius: 6px;
  background: var(--selection);
  color: var(--selection-ink);
}
.reglages-selection > b, .reglages-selection .reglages-etat { color: inherit }
.reglages-switch {
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 44px;
  flex: 0 0 auto;
}
.reglages-switch > .toggle { display: block }
.reglages-selection .reglages-switch > .toggle { border-color: var(--selection-line) }
.reglages-selection .reglages-switch > .toggle.on { background: var(--selection-mark) }
.reglages-selection .reglages-switch:focus-visible { outline-color: var(--selection-ink) }
.reglages-champ { justify-content: space-between; flex-wrap: wrap }
.reglages-champ input {
  width: auto;
  min-width: min(100%, 9rem);
  max-width: 100%;
  min-height: 44px;
  font-size: 1rem;
}
.reglages-voix {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
}
.reglages-voix > .btn, .apercu-voix.btn {
  font: 700 .94rem / 1.25 var(--f-body);
  text-transform: none;
  min-height: 44px;
  white-space: normal;
  box-shadow: none;
}
.reglages-voix > .btn[aria-pressed="true"] {
  background: var(--selection);
  color: var(--selection-ink);
  border-color: var(--selection-line);
}
.apercu-voix.btn {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
}
.apercu-voix .pict { width: 18px; height: 18px; stroke: currentColor; fill: none }

body[data-vue="exam"] .examen-briefing.stack { gap: 9px }
.examen-briefing p { margin: 0 }
.briefing-format { font-size: .9rem; color: var(--ink-2) }
.briefing-chiffres {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  border-block: 1px solid var(--line);
  padding-block: 9px;
  text-align: center;
}
.briefing-chiffres > div { padding: 0 4px }
.briefing-chiffres > div + div { border-inline-start: 1px solid var(--line) }
.briefing-chiffres strong { display: block; font: 750 1.25rem var(--f-mono) }
.briefing-chiffres strong small { font-size: .85em }
.briefing-chiffres div > span { font-size: .78rem; color: var(--ink-2) }
.briefing-apercu { display: grid; gap: 9px }
.briefing-apercu .h2, .reglages-titre, .progres-missions > section > .h2 {
  font: 400 1.13rem / 1.25 var(--f-display);
  text-transform: uppercase;
}
.briefing-apercu .h2 { margin: 0 }
.briefing-ecran {
  min-height: 118px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0,1.55fr) minmax(0,1fr);
  gap: 8px;
  border: 1px solid var(--selection-line);
  border-radius: var(--radius);
  background: var(--apercu-surface);
  color: var(--apercu-ink);
}
.briefing-visuel {
  display: flex;
  align-items: flex-start;
  background:
    linear-gradient(var(--apercu-voile),var(--apercu-voile)),
    var(--apercu-surface) url("art/bg-hero.jpg") center 56% / cover;
  border-radius: 6px;
  overflow: hidden;
}
.briefing-visuel > span {
  margin: 6px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--apercu-surface);
  font-size: .75rem;
}
.briefing-chrono {
  display: grid;
  align-content: center;
  justify-items: center;
  min-width: 0;
  gap: 6px;
  padding: 6px 3px;
  border-radius: 6px;
  border: 1px solid var(--apercu-trait);
  background: var(--apercu-chrono);
  font-size: .75rem;
  text-align: center;
}
.briefing-cadran {
  display: grid;
  place-items: center;
  width: min(100%, 3.5rem);
  aspect-ratio: 1;
  border: 3px solid var(--line-fort);
  border-radius: 50%;
  font-size: .97rem;
  font-weight: 750;
}
.examen-briefing:has([aria-checked="false"]) .briefing-cadran {
  border-color: var(--apercu-trait);
  border-inline-start-color: var(--line-fort);
}
.briefing-etapes { font-size: .95rem; font-weight: 700 }
.examen-briefing .briefing-graves {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  padding: 10px;
}
.briefing-graves > span {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  min-height: 24px;
  background: var(--grave);
  color: var(--selection-ink);
  border-radius: 4px;
  font-weight: 800;
}
.briefing-graves p { font-size: .84rem; color: var(--ink-2) }
.briefing-rappel { line-height: 1.35 }
.briefing-lancer {
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  white-space: normal;
}

.progres-indice-etat {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}
.progres-indice-etat > strong { font-size: clamp(1.5rem,8vw,2.25rem) }
.progres-indice-etat .btn {
  min-height: 44px;
  font: 700 .87rem / 1.2 var(--f-body);
  text-transform: none;
  box-shadow: none;
}
#progres-bilan:not([hidden]) { margin-top: 12px }
#progres-bilan[hidden] { display: none }
.progres-fiches {
  display: grid;
  gap: 8px;
}
.progres-fiche {
  display: grid;
  gap: 4px;
  position: relative;
  min-width: 0;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.progres-fiche:has(input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.progres-fiche:has(input:checked) {
  color: var(--selection-ink);
  background: var(--selection);
  border-color: var(--selection-line);
}
.progres-fiche-statut {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: .95rem;
}
.progres-fiche-statut b { min-width: 0; overflow-wrap: anywhere }
.progres-fiche-statut strong { white-space: nowrap }
.progres-fiche .bar {
  height: 5px;
  background: var(--surface-3);
  border: 0;
}
.progres-fiche .bar > i { background: var(--mission-ton) }
.progres-fiche:has(input:checked) .bar { background: color-mix(in srgb, var(--selection-line) 24%,var(--selection)) }
.progres-fiche:has(input:checked) .bar > i { background: var(--selection-mark) }
.progres-commande[hidden] { display: none }
.progres-commande { margin-top: 12px }
.progres-lancer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  white-space: normal;
  text-align: left;
}
.progres-lancer svg { width: 18px; height: 18px }
html[data-theme="dark"] body :is(.progres-lancer,.briefing-lancer).btn.primary,
html[data-theme="dark"] body[data-entrainement="1"][data-vue="run"] #validate {
  font: 750 1rem / 1.2 var(--f-body);
  text-transform: none;
  min-height: 48px;
  box-shadow: none;
}

html[data-theme="dark"] body[data-vue="run"][data-entrainement="1"] :is(.qtext,.xrep) {
  background: transparent;
  border: 0;
  box-shadow: none;
}
body[data-vue="run"][data-entrainement="1"] .xpos {
  font: 400 clamp(1.15rem,5vw,1.8rem) / 1.15 var(--f-display);
  text-transform: uppercase;
}
body[data-vue="run"][data-entrainement="1"] .xpos .mono { font-family: inherit }
body[data-vue="run"][data-entrainement="1"] .xtitre .eyebrow {
  font: 650 .84rem / 1.2 var(--f-body);
  text-transform: none;
  color: var(--ink-2);
}
body[data-vue="run"][data-entrainement="1"] .opt.sel:not(.right,.wrong) {
  background: var(--selection);
  color: var(--selection-ink);
  border-color: var(--selection-line);
}
body[data-vue="run"][data-entrainement="1"] .opt.sel:not(.right,.wrong) .k {
  background: var(--action);
  color: var(--selection-ink);
  border-color: var(--selection-line);
}
