/* Mode Problèmes (Probleme screen): the statement card, the operation QCM,
   the calculation, the answer sentence and the bar diagram (DS BarDiagram). */

.problem {
  flex-grow: 1;
  display: flex;
  gap: var(--space-12);
  align-items: flex-start;
  padding: var(--space-10, 40px) 0;
  flex-wrap: wrap;
  animation: exercise-in 200ms ease-out;
}
.problem[data-stage="calc"], .problem[data-stage="done"] { animation: none; }
@media (prefers-reduced-motion: reduce) { .problem { animation: none; } }
.problem__main { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-6); }

.problem__statement {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.problem__statement-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.problem__statement-head .label, .problem__aside-head .label { color: var(--ink-muted); }
.problem__text { margin: 0; font-size: 26px; line-height: 38px; font-weight: 700; }

.listen-pill {
  height: 44px;
  padding: 0 var(--space-4);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}
.listen-pill[hidden] { display: none; }
.listen-pill svg { width: 22px; height: 22px; stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.listen-pill:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

.problem__stage { display: flex; flex-direction: column; gap: var(--space-4); }
.problem__question { margin: 0; font-size: 26px; line-height: 32px; font-weight: 700; }
.choices--operation { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choices--operation:focus-visible { outline: 3px solid var(--info); outline-offset: 4px; border-radius: var(--radius-md); }
.choice--operation { min-height: 80px; }
.choice--operation .num-choice { font-size: 32px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.choice--operation .choice__key { width: 32px; height: 32px; font-family: var(--font-sans); font-size: 16px; font-weight: 800; color: var(--ink-muted); }
.choice__label--words { font-size: 22px; }
.choice--selected, .choice--operation:focus { background: var(--brand-soft); border-color: var(--brand); }
.choice--selected .choice__key, .choice--operation:focus .choice__key { background: var(--surface-raised); }
.problem__op-form { display: flex; flex-direction: column; gap: var(--space-4); }
.problem__op-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.feedback--small { font-size: 18px; line-height: 24px; max-width: 520px; align-items: flex-start; }
.feedback--small .icon { width: 24px; height: 24px; flex: none; }

/* Answered steps: « 188 + 75 = 263 billes » */
.problem-step { display: flex; flex-direction: column; gap: var(--space-3); }
.problem-step__line { margin: 0; display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; font-size: 22px; line-height: 30px; font-weight: 800; }
.problem-step__line .icon { width: 28px; height: 28px; stroke-width: 3; }
.problem-step__line .num { font-size: 26px; }
.problem-step__line--right { color: var(--success); }
.problem-step__line--info { color: var(--info); background: var(--info-soft); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.given-answers--small { justify-content: flex-start; font-size: 24px; }
.hint--problem { max-width: none; }

/* « Calcule » */
.problem__stage--calc { align-items: flex-start; }
.problem__calc { align-self: stretch; display: flex; justify-content: center; padding: var(--space-4) 0; }
/* The problem column is narrower than the Calcul screen: the line stays on one row, unit included. */
.problem__calc .exercise__expression { --size: 72px; gap: var(--space-4) var(--space-6); flex-wrap: nowrap; white-space: nowrap; }
.problem__calc .exercise__line--md .exercise__expression { --size: 56px; }
.problem__stage--calc .exercise__feedback { align-self: stretch; }

/* The answer sentence */
.problem-answer {
  background: var(--surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-6);
}
.problem-answer__sentence { margin: 0; font-size: 32px; line-height: 42px; font-weight: 800; }
.problem-answer .icon { width: 24px; height: 24px; stroke-width: 2.5; }

/* Schéma */
.problem__aside { flex: 0 1 420px; min-width: 300px; display: flex; flex-direction: column; gap: var(--space-4); }
.problem__aside-head { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.btn--diagram { height: 56px; border-radius: var(--radius-md); font-size: 18px; padding: 0 var(--space-6); }
.btn--diagram.btn--ghost { height: 40px; font-size: 15px; padding: 0 14px; margin-left: auto; }
.problem__diagram { display: flex; flex-direction: column; gap: var(--space-4); }
.problem__diagram[hidden] { display: none; }
.problem__diagram-note { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ink-muted); }

.bar-diagram {
  background: var(--info-soft);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px 12px;
  align-items: end;
  font-family: var(--font-num);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bar-diagram--named { grid-template-columns: 64px minmax(0, 1fr); }
.bar-diagram__name { font-family: var(--font-sans); font-size: 18px; font-weight: 800; align-self: end; line-height: 56px; overflow: hidden; text-overflow: ellipsis; }
.bar-diagram__bar { min-width: fit-content; display: flex; flex-direction: column; gap: var(--space-1); }
.bar-diagram__total {
  border: 2px solid var(--info);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  height: 12px;
  margin: 18px 4px 0;
  position: relative;
  text-align: center;
}
.bar-diagram__total span { position: relative; top: -18px; background: var(--info-soft); padding: 0 var(--space-2); font-size: 18px; line-height: 22px; }
.bar-diagram__total--unknown span { color: var(--brand); }
.bar-diagram__segments { display: flex; gap: 4px; height: 56px; }
.bar-diagram__segment {
  flex-basis: 0;
  min-width: 56px;
  background: var(--surface-raised);
  border: 2px solid var(--info);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 0 var(--space-1);
  font-size: 20px;
}
.bar-diagram__segment--unknown { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.bar-diagram__segment--diff { background: var(--brand-soft); border-color: var(--brand); }
.bar-diagram__segment--empty { background: transparent; border-style: dashed; border-color: var(--line-strong); }
.bar-diagram--equal .bar-diagram__segment { min-width: 36px; font-size: 18px; }
.bar-diagram__caption { font-family: var(--font-sans); font-size: 16px; font-weight: 700; color: var(--brand); }

/* « Je fais un tableau » */
.pair-table { display: grid; grid-template-columns: repeat(var(--cols), 44px); gap: 4px; background: var(--info-soft); padding: var(--space-4); border-radius: var(--radius-md); width: fit-content; }
.pair-table__cell { width: 44px; height: 44px; border: 2px solid var(--info); border-radius: 6px; background: var(--surface-raised); color: var(--success); font-size: 22px; font-weight: 800; cursor: pointer; padding: 0; }
.pair-table__cell[aria-pressed="true"] { background: var(--success-soft); border-color: var(--success); }

/* « Poser »: the posed grid under the calculation */
.poser { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.poser__grid[hidden] { display: none; }

/* CP modelling aid (11.12 « objets »): the numbers of the bar diagram drawn as DS Figure dots, tens bars and
   cubes, on the diagram's `info-soft` ground; the number sought is a `brand-soft` « ? » group. */
.problem-objects {
  background: var(--info-soft);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.problem-objects__bar { display: flex; flex-direction: column; gap: var(--space-2); }
.problem-objects__name { font-size: 18px; font-weight: 800; }
.problem-objects__groups { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.problem-objects__group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 56px;
  min-height: 72px;
  padding: 10px;
  box-sizing: border-box;
  background: var(--surface-raised);
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
}
.problem-objects__group--unknown {
  justify-content: center;
  background: var(--brand-soft);
  border: 2px dashed var(--brand);
}
.problem-objects__mystery { font-family: var(--font-num); font-size: 30px; font-weight: 700; color: var(--brand-strong); }
.problem-objects__drawing { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.problem-objects__drawing:has(.figure__bar) { flex-direction: row; align-items: flex-end; }
.problem-objects__drawing .figure__dots { display: flex; gap: 6px; }
.problem-objects__drawing .figure__dot { width: 18px; height: 18px; border-width: 1.5px; }
.problem-objects__drawing .figure__cube { width: 12px; height: 12px; border-width: 1px; border-radius: 2px; }
.problem-objects__drawing .figure__loose { grid-template-columns: repeat(2, 12px); gap: 2px; }
.problem-objects__value { font-size: 22px; font-weight: 700; }
.problem-objects__total, .problem-objects__caption { font-size: 20px; font-weight: 700; }
.problem-objects__caption { font-family: var(--font-num); color: var(--brand-strong); }
