/* ==========================================================================
   toefl-exam.css — Compléments TOEFL iBT de l'interface d'examen
   --------------------------------------------------------------------------
   Chargée APRÈS toeic/css/toeic-exam.css (socle commun « tx- ») et
   toefl-ibt.css. Préfixe « tl- » pour ce qui est propre au TOEFL ; quelques
   classes historiques (toefl-letter-box, bs-slot, toefl-word-chip) sont
   recadrées pour l'écran d'examen. Pas d'emoji, pas de dégradé décoratif.
   Créé le 2026-10-12.
   ========================================================================== */

/* La coque TOEFL reprend la typographie sobre du socle (et non DM Sans). */
.tl-exam, .tl-exam button, .tl-exam input, .tl-exam textarea { font-family: var(--tx-font); }
.tl-exam .tx-bar { background: var(--tx-navy); }
.tl-exam .tx-btn { background: #f6f7f9; box-shadow: none; }
.tl-exam .tx-btn:hover { background: #eceff3; }
.tl-exam .tx-btn--primary { background: var(--tx-blue); }
.tl-exam .tx-btn--primary:hover { background: #2862a6; }

.tl-intro-text { max-width: 640px; margin: 0 auto 10px; }
.tl-exam .tx-directions b { font-size: .8rem; }

/* ---------- Reading : documents ---------- */
.tl-doc { font-family: var(--tx-serif); }
.tl-doc__author { font-family: var(--tx-font); font-size: .9rem; color: var(--tx-ink-2); margin: -.3em 0 .8em; }
.tl-mail { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 0 0 12px; padding: 0 0 10px;
  border-bottom: 1px solid var(--tx-line-soft); font: .92rem/1.45 var(--tx-font); }
.tl-mail dt { font-weight: 700; color: var(--tx-ink-2); }
.tl-mail dd { margin: 0; overflow-wrap: anywhere; }
.tl-doc--social-media-post {  }
.tl-doc--notice .tx-doc__title { text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Complete the Words ---------- */
.tl-cw { font-family: var(--tx-serif); font-size: 1.08rem; line-height: 2.5; max-width: 900px; }
.tl-exam .toefl-blank-group { display: inline; white-space: nowrap; background: none; border: 0; padding: 0; margin: 0; }
.tl-exam .toefl-letter-boxes { display: inline-flex; vertical-align: baseline; border: 0; box-shadow: none; padding: 0; margin: 0 1px; gap: 2px; }
.tl-exam .toefl-letter-box {
  width: 1.15em; height: 1.55em; padding: 0; margin: 0; text-align: center;
  font: inherit; line-height: 1; color: var(--tx-ink); background: #fff;
  border: 0; border-bottom: 2px solid #7d8796; border-radius: 0; box-shadow: none; outline: none;
}
.tl-exam .toefl-letter-box:first-child { border-left: 0; }
.tl-exam .toefl-letter-box:focus { border-bottom-color: var(--tx-blue); background: var(--tx-blue-soft); }
.tl-exam .toefl-letter-box.filled { border-bottom-color: var(--tx-navy); background: #fff; color: var(--tx-ink); }
.tl-exam .toefl-blank-group.tx-q { background: none; border: 0; padding: 0; margin: 0; border-radius: 0; }

/* ---------- Listening / Speaking : scène ---------- */
.tl-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 18px 0 14px;
  padding: 20px; background: #fff; border: 1px solid var(--tx-line); border-radius: var(--tx-radius); }
.tl-figure svg { display: block; max-width: 100%; height: auto; }
.tl-status { min-height: 1.4em; margin: 0; font-weight: 700; color: var(--tx-ink-2); letter-spacing: .02em; }
.tl-status.is-listen { color: var(--tx-navy); }
.tl-status.is-speak { color: var(--tx-ink); }
.tl-status.is-error { color: var(--tx-red); font-weight: 400; }
.tl-qtask { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--tx-ink-2); margin: 0 0 10px; }

/* Réponse cachée tant que l'enregistrement n'est pas terminé. */
[data-tl-step="response"] .tl-answer,
[data-tl-step="question"] .tx-opts { visibility: hidden; }
[data-tl-step].is-answering .tl-answer,
[data-tl-step].is-answering .tx-opts { visibility: visible; }
[data-tl-step="question"] .tx-q { margin-top: 12px; padding: 16px 20px; }
[data-tl-step="question"] .tx-q__stem { font-size: 1.05rem; }

/* ---------- Speaking ---------- */
.tl-dir-card { max-width: 760px; margin: 4vh auto 0; }
.tl-context { color: var(--tx-ink-2); font-style: italic; }
.tl-exam [data-tl-step="speak"] .tx-timeboxes { margin-top: 6px; }

/* ---------- Writing ---------- */
.tl-wr-prompt { min-width: 0; }
.tl-wr-answer { min-width: 0; }
.tl-situation { margin: 0 0 10px; }
.tl-task-intro { margin: 0 0 6px; font-weight: 700; }
.tl-bullets { margin: 0 0 10px; padding-left: 1.3em; }
.tl-bullets li { margin: 0 0 4px; }
.tl-task-note { font-size: .9rem; color: var(--tx-ink-2); }
.tl-mailhead { background: #fff; border: 1px solid var(--tx-line); border-bottom: 0; padding: 8px 12px; font-size: .92rem; border-radius: var(--tx-radius) var(--tx-radius) 0 0; }
.tl-mailhead + .tx-wtool { border-radius: 0; }
.tl-exam textarea.tl-textarea { min-height: 300px; }

.tl-post { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--tx-line-soft); border-radius: var(--tx-radius); padding: 12px 14px; margin: 0 0 10px; }
.tl-post--prof { border-color: var(--tx-line); background: #f7f9fc; }
.tl-avatar { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #e3e8ef; }
.tl-post__name { font-weight: 700; margin: 0 0 4px; }
.tl-post p { margin: 0; }

/* Build a Sentence */
.tl-bas { padding: 22px 24px; }
.tl-bas__context, .tl-bas__reply { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 14px; }
.tl-bas__context p { margin: 0; padding-top: 4px; font-size: 1.05rem; }
.tl-bas__who { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: #fff; background: #8fa3bf; }
.tl-bas__reply .tl-bas__who { background: var(--tx-navy); }
.tl-exam .bs-frame { display: block; font-size: 1.05rem; line-height: 2.6; padding: 0; background: none; border: 0; box-shadow: none; }
.tl-exam .bs-gap { display: inline-block; margin: 0 2px; }
.tl-exam .bs-slot {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  min-width: 92px; height: 34px; padding: 0 10px; margin: 2px 0;
  background: #fff; border: 1px dashed #8a96a8; border-radius: 3px; cursor: pointer; color: var(--tx-ink);
}
.tl-exam .bs-slot.bs-slot-full { border-style: solid; border-color: var(--tx-navy); background: var(--tx-blue-soft); }
.tl-exam .bs-slot.bs-slot-over, .tl-exam .bs-slot.bs-tap-selected { outline: 2px solid var(--tx-blue); outline-offset: 1px; }
.tl-exam .bs-slot-txt { font-weight: 700; }
.tl-exam .toefl-wordbank { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0 44px; padding: 12px; background: #f4f6f9; border: 1px solid var(--tx-line-soft); border-radius: var(--tx-radius); min-height: 58px; }
.tl-exam .toefl-word-chip {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; cursor: pointer; user-select: none;
  font-weight: 700; color: var(--tx-ink); background: #fff; border: 1px solid #9aa5b4; border-radius: 3px; box-shadow: none;
}
.tl-exam .toefl-word-chip:hover { border-color: var(--tx-navy); background: #fff; color: var(--tx-ink); transform: none; }
.tl-exam .toefl-word-chip:focus-visible, .tl-exam .bs-slot:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
.tl-exam .toefl-word-chip.used { visibility: hidden; }

@media (max-width: 860px) {
  .tl-exam .toefl-wordbank { margin-left: 0; }
  .tl-cw { font-size: 1rem; line-height: 2.4; }
  .tl-exam .bs-slot { min-width: 70px; }
}
@media print { .tl-exam { display: none; } }
.tl-exam .tl-intro-text, .tl-exam .tx-start-panel p { font-weight: 400; }
/* toefl-ibt.css met les paragraphes en gras : on revient à un texte normal.
   v4c (30/11/2026) : paragraphes justifiés, césure automatique ; Complete the Words reste
   aligné à gauche et sans césure (mots à compléter). */
.tl-exam p, .tl-exam li { font-weight: 400; text-align: justify; -webkit-hyphens: auto; hyphens: auto; letter-spacing: normal; }
.tl-exam dd { font-weight: 400; text-align: left; letter-spacing: normal; }
.tl-exam .tl-cw, .tl-exam .tl-cw p { text-align: left; -webkit-hyphens: manual; hyphens: manual; }
.tl-exam .tx-doc p, .tl-exam .tl-doc p { margin: 0 0 .75em; line-height: 1.6; font-size: 1rem; color: #111; }
.tl-exam .tx-q__stem, .tl-exam .tl-post__name, .tl-exam .tl-task-intro { font-weight: 700; }
.tl-stage { padding: 14px 20px 10px; margin: 14px 0 12px; }
.tl-figure svg { width: 180px; height: 90px; }
.tl-exam .bs-slot .bs-slot-txt { color: var(--tx-ink); }
.tl-exam .toefl-word-chip.used { display: none; }
.tl-exam .tx-test-picker p, .tl-exam .tx-start-panel .tx-note, .tl-exam .tx-start-panel .tx-resume { text-align: center; }

/* v5 (30/11/2026) : « Start again » dans la barre d'examen (toefl-shell.js), discret, sans couleur. */
.tl-exam .tl-restart { margin: 0; padding: 3px 10px; font: 400 .8rem/1.2 var(--tx-font); color: #fff; opacity: .75;
  background: transparent; border: 1px solid rgba(255, 255, 255, .45); border-radius: 3px; cursor: pointer; white-space: nowrap; }
.tl-exam .tl-restart:hover, .tl-exam .tl-restart:focus-visible { opacity: 1; }
.tl-exam .tl-restart:focus-visible { outline: 2px solid #f2b705; outline-offset: 2px; }
@media (max-width: 560px) { .tl-exam .tl-restart { padding: 2px 6px; font-size: .72rem; } }

/* v7 (30/11/2026) : Try again / Continue sous la scène (Speaking ; Listening : style en ligne inchangé). */
.tl-exam [data-tl-step] .tl-retry { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 12px; }

/* ── Boîte de dialogue intégrée (remplace confirm/alert du navigateur) ── */
.tl-dialog-backdrop { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(15, 23, 42, .45); }
.tl-dialog { width: min(460px, 100%); box-sizing: border-box; background: #fff; color: #1a2340; border: 1px solid #c9d2e3;
  border-radius: 4px; box-shadow: 0 8px 28px rgba(15, 23, 42, .25); padding: 22px 22px 18px; font-weight: 400; text-align: left; }
.tl-dialog__msg { margin: 0 0 18px; font-size: 1rem; line-height: 1.5; }
.tl-dialog__btns { display: flex; justify-content: flex-end; gap: 10px; }
.tl-dialog__btns .tx-btn { min-width: 104px; }
/* v9 (30/11/2026) : barre d'examen sur téléphone. Sous 480 px, le compteur, le minuteur,
   « Start again » et la croix (≈ 320 px) repoussaient le nom de l'examen, qui chevauchait
   le compteur. Le nom disparaît (comme le nom de section sous 860 px) ; les commandes
   occupent toute la largeur. Sous 360 px : pictogramme du minuteur masqué, écarts réduits.
   « Start again » : zone de toucher portée à 32 px de haut, aspect inchangé. */
@media (max-width: 480px) {
  .tl-exam .tx-bar { grid-template-columns: minmax(0, 1fr); padding: 6px 10px; }
  .tl-exam .tx-bar__left { display: none; }
  .tl-exam .tx-bar__right { justify-content: space-between; gap: 8px; }
  .tl-exam .tl-restart { min-height: 32px; }
}
@media (max-width: 360px) {
  .tl-exam .tx-bar__right { gap: 6px; }
  .tl-exam .tx-timer { min-width: 0; padding: 3px 7px; }
  .tl-exam .tx-timer__icon { display: none; }
  .tl-exam .tx-counter { font-size: .75rem; }
}
