/* ===== TP sur visite 3D (s'ajoute à visite.css) ===== */
.tpv [hidden] { display: none !important; }
/* barre des zones en TP : entre la carte de consigne (à gauche) et la barre d'outils (à droite), pour que ses deux flèches restent visibles */
.tpv .vis-bottom { left: 470px; right: 86px; bottom: 58px; justify-content: flex-end; }
.tpv:not(.is-running) .vis-bottom, .tpv:not(.is-running) .vis-help { visibility: hidden; }

/* repères accrochés à la scène */
.tpv-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.tpv-mark { position: absolute; left: 0; top: 0; will-change: transform; }
.tpv-mark { font: 800 .8rem/1 var(--head); color: #fff; white-space: nowrap; }
.tpv-mark.is-pad { translate: -50% -50%; padding: 7px 11px; border-radius: 9px; background: rgba(6, 26, 71, .82); box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .6); font-size: .72rem; font-weight: 700; transition: background-color .2s; }
.tpv-mark.is-pad.is-busy { background: rgba(0, 120, 190, .88); }
.tpv-mark.is-pad.is-over { background: var(--orange); }
.tpv-mark.is-good, .tpv-mark.is-hint, .tpv-mark.is-found, .tpv-mark.is-miss { translate: -50% -50%; display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px; border-radius: 999px; border: 3px solid #fff; box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .55); animation: tpv-pop .35s cubic-bezier(.2, 1.5, .4, 1) both; }
.tpv-mark.is-good { background: #1fa463; }
.tpv-mark.is-hint { background: var(--orange); translate: -50% -130%; }
.tpv-mark.is-found { background: var(--orange); font-size: .95rem; }
.tpv-mark.is-miss { background: #c6283a; min-width: 30px; height: 30px; }
@keyframes tpv-pop { from { scale: .3; opacity: 0; } }

/* chrono et avancement */
.tpv-hud { pointer-events: auto; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 18px; min-width: 300px; padding: 12px 18px; border-radius: 14px; color: #eef2f9; box-shadow: 0 14px 30px -16px rgba(0, 0, 0, .55); }
.tpv-timer span { display: block; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.tpv-timer b { font: 800 1.45rem/1.1 var(--head); color: #fff; font-variant-numeric: tabular-nums; }
.tpv-hud.is-low .tpv-timer b { color: #ff8a8a; }
.tpv-prog { display: grid; gap: 7px; font-size: .82rem; }

/* consigne */
.tpv-task { position: absolute; z-index: 4; left: 20px; bottom: 44px; width: min(430px, calc(100% - 40px)); max-height: calc(100% - 170px); overflow-y: auto; padding: 18px 20px; border-radius: 18px; background: #fff; color: var(--text); box-shadow: 0 24px 50px -20px rgba(4, 18, 47, .6); }
.tpv-step { font: 700 .7rem/1.2 var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--orange); margin-bottom: 6px; }
.tpv-ask { font-size: 1.3rem; font-weight: 800; line-height: 1.25; color: var(--navy); }
.tpv-hint { margin-top: 8px; font-size: .86rem; line-height: 1.5; color: var(--muted); }
.tpv-fb { min-height: 0; margin-top: 10px; font: 700 .88rem/1.45 var(--head); color: var(--navy); }
.tpv-fb:empty { display: none; }
.tpv-fb.is-good { color: #12804a; }
.tpv-fb.is-bad { color: #c23a1e; }
.tpv-fb.is-pop { animation: tpv-fb .3s ease-out; }
@keyframes tpv-fb { from { opacity: 0; transform: translateY(4px); } }
.tpv-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tpv-btn, .tpv-btn-ghost { border: 0; cursor: pointer; font: 700 .84rem/1 var(--head); padding: 12px 16px; border-radius: 12px; }
.tpv-btn { color: #fff; background: linear-gradient(135deg, #ff7a12, var(--orange-600)); box-shadow: 0 12px 26px -12px rgba(255, 106, 0, .8); margin-left: auto; }
.tpv-btn-ghost { border: 1.5px solid #c9d3e6; background: #fff; color: var(--navy); }
.tpv-btn-ghost:hover { border-color: var(--navy); }
.tpv-choices { display: grid; gap: 8px; margin-top: 12px; }
.tpv-opt { display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%; padding: 11px 12px; border-radius: 12px; border: 1.5px solid #d6deee; background: #f7f9fd; color: var(--navy); font: 600 .86rem/1.4 var(--body); cursor: pointer; transition: border-color .2s, background-color .2s; }
.tpv-opt:hover:not(:disabled) { border-color: var(--navy); }
.tpv-box { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; border: 2px solid #9fb0cf; background: #fff; }
.tpv-opt-single .tpv-box { border-radius: 50%; }
.tpv-opt[aria-pressed="true"] { border-color: var(--orange); background: #fff4ec; }
.tpv-opt[aria-pressed="true"] .tpv-box { border-color: var(--orange); background: var(--orange); box-shadow: inset 0 0 0 3px #fff; }
.tpv-opt:disabled { cursor: default; opacity: .75; }
.tpv-opt.is-good { opacity: 1; border-color: #1fa463; background: #eafaf1; }
.tpv-opt.is-good .tpv-box { border-color: #1fa463; background: #1fa463; box-shadow: inset 0 0 0 3px #fff; }
.tpv-opt.is-bad { opacity: 1; border-color: #d2452a; background: #fdeeea; }
.tpv-done-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tpv-chip { border: 1.5px solid #d6deee; background: #fff; color: var(--navy); font: 700 .78rem/1 var(--head); padding: 9px 12px; border-radius: 999px; cursor: pointer; }
.tpv-chip:hover { border-color: var(--navy); }
.tpv-chip.is-on { border-color: var(--orange); background: #fff4ec; color: var(--orange-600); }
.tpv-chip.is-on::before { content: "✓ "; }

/* accueil du TP */
.tpv-intro, .tpv-result { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; padding: 24px; overflow-y: auto; background: radial-gradient(80% 90% at 70% 20%, rgba(20, 58, 133, .72), rgba(4, 18, 47, .9)); }
.tpv-intro-box, .tpv-result-box { width: min(620px, 100%); padding: 30px 32px; border-radius: 24px; background: #fff; color: var(--text); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .7); }
.tpv-kicker { font: 700 .72rem/1.3 var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--orange-ink); margin-bottom: 8px; }
.tpv-intro-box h2 { font-size: 1.75rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.tpv-lead { margin-top: 10px; font-size: .98rem; line-height: 1.6; }
.tpv-rules { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.tpv-rules li { position: relative; padding-left: 26px; font-size: .9rem; line-height: 1.5; }
.tpv-rules li::before { content: "✓"; position: absolute; left: 0; top: 1px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #fff0e5; color: var(--orange-600); font-size: .7rem; font-weight: 800; }
.tpv-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tpv-meta span { padding: 8px 12px; border-radius: 10px; background: #eef3fb; font-size: .82rem; color: #5d6883; }
.tpv-meta b { font-family: var(--head); color: var(--navy); }
.tpv-go { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 22px; }
.tpv-go .btn[disabled] { opacity: .7; cursor: progress; }
.tpv-link { font: 700 .86rem/1.3 var(--head); color: var(--navy); }
.tpv-small { margin-top: 14px; font-size: .76rem; color: var(--muted); }

/* compte rendu */
.tpv-result { place-items: start center; }
.tpv-result-box { width: min(820px, 100%); margin: auto 0; }
.tpv-score { display: grid; grid-template-columns: 1fr 1.2fr; gap: 26px; align-items: center; }
.tpv-score-num { font: 800 1.3rem/1 var(--head); color: var(--muted); margin: 4px 0 10px; }
.tpv-score-num b { font-size: 3.4rem; color: var(--navy); }
.tpv-score p { font-size: .92rem; line-height: 1.5; }
.tpv-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.tpv-bars li { display: grid; grid-template-columns: 1fr 90px auto; gap: 10px; align-items: center; font-size: .86rem; font-weight: 600; color: var(--navy); }
.tpv-bars b { font-family: var(--head); white-space: nowrap; }
.tpv-bars .is-pen { color: #c23a1e; }
.tpv-bar { height: 8px; border-radius: 6px; background: #e6ecf6; overflow: hidden; }
.tpv-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #1fa463, #48c98a); }
.tpv-bar i.is-low { background: linear-gradient(90deg, var(--orange-600), #ff9a3c); }
.tpv-corr { margin-top: 24px; padding-top: 20px; border-top: 1px solid #e3e9f4; }
.tpv-corr h3 { font-size: 1rem; color: var(--navy); margin-bottom: 10px; }
.tpv-corr-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #e3e9f4; }
.tpv-corr-ic { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: .78rem; font-weight: 800; color: #fff; background: #1fa463; }
.is-ko .tpv-corr-ic { background: #d2452a; }
.tpv-corr-row b { font-family: var(--head); color: var(--navy); font-size: .9rem; }
.tpv-corr-row p { font-size: .84rem; line-height: 1.5; margin-top: 2px; }
.tpv-corr-note { font-weight: 700; color: var(--muted); }
.is-ko .tpv-corr-note { color: #c23a1e; }
.tpv-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

@media (max-width: 900px) {
  .tpv .vis-bottom { left: 10px; right: 10px; bottom: auto; top: 160px; justify-content: center; }
  .tpv-hud { min-width: 0; }
  .tpv-task { left: 10px; right: 10px; bottom: 10px; width: auto; max-height: 46%; padding: 14px 16px; }
  .tpv-ask { font-size: 1.1rem; }
  .tpv-intro-box, .tpv-result-box { padding: 22px 20px; }
  .tpv-intro-box h2 { font-size: 1.35rem; }
  .tpv-score { grid-template-columns: 1fr; }
}

/* consigne repliable : il reste l'étape, la question et le retour */
.tpv-task .vis-fold { top: 10px; right: 10px; }
.tpv-task.is-folded :is(.tpv-hint, .tpv-choices, .tpv-act) { display: none; }
.tpv-task.is-folded .tpv-ask { font-size: 1.05rem; }
@media (max-width: 900px) {
  .tpv.is-running .vis-rot { display: none; }
  .tpv .vis-tools { top: 300px; }
}

/* procédure en séquence : étapes déjà faites */
.tpv-trail { margin: 12px 0 0; padding: 0 0 0 22px; display: grid; gap: 3px; font-size: .8rem; color: var(--muted); max-height: 140px; overflow-y: auto; }
.tpv-trail li::marker { font-weight: 800; color: var(--navy); }
.tpv-trail b { font-family: var(--head); color: var(--navy); }
.tpv-trail li.is-ok b::after { content: " ✓"; color: #12804a; }
.tpv-trail li.is-half b::after { content: " ½"; color: var(--orange-600); }
.tpv-trail li.is-ko b::after { content: " ✗"; color: #c23a1e; }
.tpv-task.is-folded .tpv-trail { display: none; }
.tpv-opt:disabled { transition: none; }

/* Format « document à remplir » (form) : la fiche à droite, les pièces consultées dans la consigne */
.tpv-form { position: absolute; z-index: 4; right: 20px; top: 92px; bottom: 96px; width: min(400px, calc(100% - 490px)); min-width: 320px; display: flex; flex-direction: column; border-radius: 18px; background: #fffdf8; color: var(--text); box-shadow: 0 24px 50px -20px rgba(4, 18, 47, .6); overflow: hidden; }
.tpv-form-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 2px solid var(--navy); background: #fff; }
.tpv-form-head h2 { font-size: 1.2rem; font-weight: 800; color: var(--navy); line-height: 1.2; margin: 2px 0 4px; }
.tpv-form-head .tpv-small { margin: 0; }
.tpv-form-close { display: none; }
.tpv-form-body { flex: 1; overflow-y: auto; padding: 6px 18px 12px; }
.tpv-f-sec { border: 0; margin: 12px 0 0; padding: 0; }
.tpv-f-sec legend { padding: 0 0 6px; font: 800 .74rem/1.3 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--orange-ink, #b84a00); }
.tpv-f { padding: 9px 0; border-top: 1px dashed #d6deee; }
.tpv-f.is-inline { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.tpv-f-lab { margin: 0 0 6px; font: 700 .86rem/1.35 var(--body); color: var(--navy); }
.tpv-f.is-inline .tpv-f-lab { margin: 0; }
.tpv-f-help { grid-column: 1 / -1; margin: 4px 0 0; font-size: .78rem; color: #5b6475; }
.tpv-f-num { display: inline-flex; align-items: center; gap: 6px; }
.tpv-f-num input, .tpv-f select { width: 7.5em; padding: 7px 9px; border: 1.5px solid #c9d3e6; border-radius: 9px; background: #fff; color: var(--navy); font: 700 .95rem/1.2 var(--body); text-align: right; }
.tpv-f select { width: auto; min-width: 7.5em; text-align: left; }
.tpv-f-num input:focus, .tpv-f select:focus { outline: 2px solid var(--orange); outline-offset: 1px; border-color: var(--orange); }
.tpv-f-unit { min-width: 2.6em; font: 600 .82rem/1 var(--body); color: #5b6475; }
.tpv-f .tpv-choices { margin-top: 4px; gap: 6px; }
.tpv-f .tpv-opt { padding: 8px 10px; font-size: .82rem; }
.tpv-form-foot { padding: 12px 18px; border-top: 1px solid #e3e8f2; background: #fff; text-align: right; }
.tpv-form-open { display: none; }
.tpv-piece { margin-top: 10px; overflow-x: auto; border: 1px solid #d6deee; border-radius: 10px; background: #fffdf8; }
.tpv-piece table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.tpv-piece th, .tpv-piece td { padding: 6px 9px; border-bottom: 1px solid #edf0f6; text-align: left; color: var(--navy); }
.tpv-piece th { font-weight: 700; }
.tpv-piece td { font-weight: 600; }
.tpv-piece tr:first-child > * { background: #f2f5fb; }
.tpv-piece-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: .78rem; color: #5b6475; }
.tpv-task.is-folded :is(.tpv-piece, .tpv-piece-list) { display: none; }
@media (max-width: 1100px) {
  .tpv-form { left: 10px; right: 10px; top: 10px; bottom: 10px; width: auto; min-width: 0; z-index: 6; display: none; }
  .tpv-form.is-open { display: flex; }
  .tpv-form-close, .tpv-form-open { display: inline-flex; }
}
