/* Demonstração animada: palco 16:9 contido, legendas e controles fora da imagem, capítulos ao
 * lado no desktop e abaixo em tablet/celular. Tokens, molduras e botões da interface atual. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tour { background: radial-gradient(110% 70% at 80% 0%, #3a1648 0%, transparent 55%), var(--void); }
.tour-intro { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: clamp(16px, 2vw, 24px) max(16px, 4vw) 12px; }
.tour-intro h1 { font-size: clamp(28px, 3.2vw, 44px); text-shadow: 0 4px 0 #000; }
.tour-notice { justify-self: start; font: 600 15px/1.3 var(--display); color: var(--amber); border: 2px solid var(--amber); padding: 6px 10px; background: rgba(23, 10, 31, .7); }

.tour-player { display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 22vw, 300px); gap: 18px; padding: 8px max(16px, 4vw) 28px; align-items: start; }
.tour-main { display: grid; gap: 10px; min-width: 0; }
/* palco limitado pela altura da janela: legenda e controles cabem sem rolar em 1440×900 */
.tour-stage { position: relative; width: min(100%, calc((100dvh - 330px) * 16 / 9)); min-width: min(100%, 320px); justify-self: center; aspect-ratio: 16 / 9; background: #0c0511; border: 3px solid var(--plum-2); box-shadow: 0 0 0 3px #0c0511, 0 18px 40px rgba(0, 0, 0, .5); display: grid; place-items: center; overflow: hidden; }
.tour-stage canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.tour-status { position: absolute; left: 12px; right: 12px; bottom: 12px; margin: 0; padding: 10px 12px; background: rgba(23, 10, 31, .92); border: 2px solid var(--amber); color: var(--bone); font-size: 15px; }
.tour-player.is-error .tour-stage { background: repeating-linear-gradient(135deg, #160a1e 0 12px, #1d0d27 12px 24px); }

.tour-captions { display: grid; gap: 6px; min-height: 5.4em; align-content: start; padding: 10px 14px; background: var(--plum); border: 2px solid var(--plum-2); }
.tour-legenda { font: 600 clamp(18px, 2vw, 24px)/1.25 var(--display); color: var(--bone); }
.tour-sub { font-size: 14.5px; color: var(--cyan); min-height: 1.4em; }
.tour-sub[data-kind="curva"], .tour-sub[data-kind="manual"] { color: var(--toxic); }
.tour-sub[data-kind="iria"] { color: var(--cyan); }
.tour-sub[data-kind="tanque"] { color: var(--flesh); }

.tour-controls { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.tour-controls .btn { min-width: 7.5em; }
.tour-bar { position: relative; flex: 1 1 220px; height: 22px; cursor: pointer; touch-action: none; }
.tour-bar .track { position: absolute; left: 0; right: 0; top: 7px; height: 8px; background: #12061a; border: 2px solid #5a2a66; }
.tour-bar .fill { position: absolute; left: 0; top: 7px; height: 8px; width: 0; background: var(--toxic); }
.tour-bar .marks i { position: absolute; top: 4px; width: 2px; height: 14px; background: var(--bone-dim); opacity: .55; }
.tour-bar .knob { position: absolute; top: 2px; left: 0; width: 12px; height: 18px; margin-left: -6px; background: var(--bone); box-shadow: 0 2px 0 #000; }
.tour-bar:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
.tour-bar[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.tour-time { font: 600 16px/1 var(--display); color: var(--bone-dim); min-width: 7.2ch; text-align: right; }

.tour-end { display: grid; gap: 10px; padding: 14px; border: 2px solid var(--toxic); background: rgba(16, 32, 15, .85); }
.tour-end p { font: 600 20px/1.2 var(--display); }

.tour-chapters { background: var(--plum); border: 2px solid var(--plum-2); max-height: min(70vh, 640px); overflow-y: auto; }
.tour-chapters ol { list-style: none; margin: 0; padding: 6px; display: grid; gap: 4px; counter-reset: cap; }
.tour-chapters button { width: 100%; display: grid; grid-template-columns: 3.6em 1fr; gap: 8px; align-items: baseline; text-align: left; background: none; border: 2px solid transparent; color: var(--bone-dim); font: 500 15px/1.25 var(--body); padding: 8px 8px; cursor: pointer; }
.tour-chapters button .num { font: 600 14px/1 var(--display); color: var(--cyan); }
@media (hover: hover) { .tour-chapters button:hover { color: var(--bone); border-color: var(--plum-2); } }
.tour-chapters button[aria-current="step"] { color: var(--bone); border-color: var(--toxic); background: rgba(184, 255, 60, .07); }

.tour-desc { display: grid; gap: 10px; padding: 0 max(16px, 4vw) 36px; max-width: 980px; }
.tour-desc .leg { max-width: 70ch; }
.tour-desc h2 { font-size: clamp(22px, 2.4vw, 30px); color: var(--cyan); }
.tour-desc p { max-width: 70ch; color: var(--bone); }

.tour-roteiro { display: grid; gap: 18px; padding: 40px max(16px, 4vw) 56px; background: #201028; }
.tour-roteiro h2 { font-size: clamp(30px, 4vw, 46px); color: var(--toxic); }
.tour-roteiro ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tour-roteiro li { display: grid; gap: 6px; align-content: start; padding: 14px; background: rgba(0, 0, 0, .25); border: 2px solid var(--plum-2); }
.tour-roteiro h3 { font-size: 20px; }
.tour-roteiro h3 .num { color: var(--cyan); margin-right: 6px; }
.tour-roteiro .roteiro-legenda { font: 600 16px/1.3 var(--display); color: var(--amber); }
.tour-roteiro li p:last-child { color: var(--bone-dim); font-size: 15px; }
/* cada capítulo é um <details> (acordeão no celular); no desktop fica aberto, sem marcador e com
   o mesmo espaçamento de antes */
.tour-roteiro summary { list-style: none; cursor: pointer; margin-bottom: 6px; }
.tour-roteiro summary::-webkit-details-marker { display: none; }
.tour-roteiro details > p + p { margin-top: 6px; }

@media (max-width: 1099px) {
  .tour-player { grid-template-columns: 1fr; }
  .tour-chapters { max-height: none; }
  .tour-chapters ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tour-roteiro ol { grid-template-columns: 1fr; }
  .tour-controls .btn { min-width: 0; flex: 1 1 auto; }
  .tour-bar { flex-basis: 100%; order: 3; }
  .tour-time { order: 2; }
  .tour-captions { min-height: 6.6em; }
  /* capítulos: faixa horizontal de ponta a ponta; player.js traz o capítulo atual para o centro */
  .tour-chapters { margin-inline: calc(-1 * max(16px, 4vw)); border-inline: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: max(16px, 4vw); scrollbar-width: thin; scrollbar-color: var(--plum-2) transparent; }
  .tour-chapters ol { display: flex; width: max-content; gap: 6px; padding: 8px max(16px, 4vw); }
  .tour-chapters li { flex: 0 0 auto; scroll-snap-align: center; }
  .tour-chapters button { width: 9.5em; height: 100%; grid-template-columns: 1fr; align-content: start; align-items: start; gap: 4px; }
}
/* celular em pé: o palco vai de ponta a ponta, como a câmera da landing */
@media (max-width: 640px) and (orientation: portrait) {
  .tour-stage { width: auto; min-width: 0; justify-self: stretch; margin-inline: calc(-1 * max(16px, 4vw)); border-inline: 0; box-shadow: none; }
}
/* toque: área de 44 px na barra; trilho, marcas e botão recentralizados (meio em 22 px) */
@media (pointer: coarse) {
  .tour-bar { height: 44px; }
  .tour-bar .track, .tour-bar .fill { top: 18px; }
  .tour-bar .marks i { top: 15px; }
  .tour-bar .knob { top: 10px; width: 16px; height: 24px; margin-left: -8px; }
}
/* celular deitado: palco medido pela altura da tela, legenda e controles ao lado */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1099px) {
  .tour-intro { padding-block: 10px 6px; }
  .tour-intro h1 { font-size: 24px; }
  .tour-main {
    grid-template-columns: minmax(0, calc((100vh - 24px) * 16 / 9)) minmax(220px, 1fr);
    grid-template-columns: minmax(0, calc((100dvh - 24px) * 16 / 9)) minmax(220px, 1fr);
    column-gap: 16px; align-items: start;
  }
  .tour-stage { grid-column: 1; grid-row: 1 / span 3; width: 100%; min-width: 0; justify-self: stretch; }
  .tour-captions, .tour-controls, .tour-end { grid-column: 2; }
  .tour-captions { min-height: 0; }
}
/* modo app: a legenda fica de ponta a ponta sob o palco, como a faixa de um monitor */
@media (max-width: 640px) and (orientation: portrait) {
  .tour-captions { margin-inline: calc(-1 * max(16px, 4vw)); padding-inline: max(16px, 4vw); border-inline: 0; }
}
/* 320–420 px: Reproduzir e Reiniciar numa linha; barra e tempo na outra. A legenda reserva
   altura para os controles não pularem quando o texto muda de tamanho. */
@media (max-width: 420px) {
  .tour-controls .btn { flex: 1 1 40%; }
  .tour-bar { flex: 1 1 60%; order: 3; }
  .tour-time { flex: 0 0 auto; order: 4; min-width: 0; font-size: 14px; }
  .tour-legenda { font-size: 17px; }
  .tour-sub { font-size: 13.5px; }
  .tour-captions { min-height: 8.6em; }
}
/* modo app: o roteiro vira índice de capítulos que abre um por um (mobile-ui.js recolhe ao abrir) */
@media (max-width: 640px) and (orientation: portrait) {
  .tour-roteiro ol { gap: 0; margin-inline: calc(-1 * max(16px, 4vw)); border-top: 2px solid var(--plum-2); }
  .tour-roteiro li { display: block; padding: 0 max(16px, 4vw); background: none; border: 0; border-bottom: 2px solid var(--plum-2); }
  .tour-roteiro summary { margin: 0; }
  .tour-roteiro h3 { font-size: 17px; }
  .tour-roteiro details[open] { padding-bottom: 14px; }
}
