/* Brake Even Garage TV lives in the cabinet. Episodes use YouTube's native player. */
#tourVideoPane { color: #eaf3ef; font: 1rem/1.4 system-ui, sans-serif; }
.tour-cabinet[data-mode=garage] .tour-pitwall #tourVideoPane { max-width: none; }
.tour-tv-browse {
  min-width: 0;
  overflow: hidden;
  background: #111e23;
  border: 1px solid #4f666b;
  border-radius: .28rem;
}
.tour-tv-brand, .tour-tv-library, .tour-tv-watchbar, .tour-tv-links {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
.tour-tv-brand {
  background: #1a292e; border-bottom: 1px solid #40555a; gap: .5rem;
  padding: .6rem .75rem;
}
#road-rally .tour-tv-brand h3, #road-rally .tour-tv-library h4,
#road-rally #tourTvViewerTitle {
  margin: 0; font-family: system-ui,sans-serif; text-transform: none; text-shadow: none;
}
#road-rally .tour-tv-brand h3 { color: #f6f7eb; font-size: 1rem; letter-spacing: -.015em; }
.tour-tv-emblem {
  display: grid; place-items: center; width: 1.65rem; height: 1.08rem; border-radius: .26rem;
  color: #fff; background: #b52e28; font: 700 .67rem/1 system-ui,sans-serif;
}
.tour-tv-brand a, .tour-tv-library a, .tour-tv-links a { color: #aee5df; text-decoration: underline; text-underline-offset: .18em; }
.tour-tv-brand a { margin-left: auto; font-size: .82rem; }
.tour-tv-brand .tour-tv-subscribe { display: inline-flex; align-items: center; min-height: 2.75rem; }
#tourVideoPane .tour-tv-subscribe { color: #ffda8f; font-weight: 700; }
#tourVideoPane .tour-tv-feature {
  display: block; width: 100%; padding: 0; border: 0; border-radius: 0;
  color: inherit; background: #152329; text-align: left; box-shadow: none;
  text-transform: none; letter-spacing: normal; white-space: normal;
}
.tour-tv-feature:hover .tour-tv-open { background: #ffe29d; }
.tour-tv-cover { display: block; position: relative; aspect-ratio: 16/8; background: #131c20; overflow: hidden; }
.tour-tv-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tour-tv-cover b, .tour-tv-episodes small {
  position: absolute; right: .4rem; bottom: .4rem; background: #0b121ae8; color: #fff; padding: .15rem .35rem;
  border-radius: .2rem; font: 700 .8rem/1.1 ui-monospace,Consolas,monospace;
}
.tour-tv-feature-copy { display: grid; gap: .32rem; align-content: start; padding: .65rem .8rem .8rem; }
.tour-tv-feature-copy small { font: 700 .74rem/1.25 ui-monospace,Consolas,monospace; color: #9eddd4; text-transform: uppercase; letter-spacing: .07em; }
#tourTvName { font: 750 clamp(1.05rem,2vw,1.4rem)/1.17 system-ui,sans-serif; color: #fff6d7; text-wrap: pretty; }
#tourTvDescription { color: #ccdad9; font: 400 .88rem/1.4 system-ui,sans-serif; }
.tour-tv-open {
  width: fit-content; margin-top: .2rem; background: #f0c16a; color: #1d2423;
  border-radius: .2rem; padding: .36rem .65rem; font: 760 .85rem/1.25 system-ui,sans-serif;
}
.tour-tv-library { border-top: 1px solid #3e5458; padding: .55rem .75rem .4rem; justify-content: space-between; }
#road-rally .tour-tv-library h4 { color: #e7f1e9; font-size: .88rem; }
.tour-tv-library a { font-size: .82rem; }
.tour-tv-episodes {
  display: flex; gap: .45rem; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: #688986 #111e23;
  padding: 0 .7rem .65rem;
}
#tourTvEpisodes button {
  position: relative; display: grid; grid-template-rows: auto 1fr; flex: 0 0 clamp(8.3rem,31%,11.6rem);
  min-width: 0; padding: 0; border: 1px solid #3f5559; border-radius: .2rem;
  background: #1a2a2f; color: #e3efeb; text-align: left; box-shadow: none;
  text-transform: none; letter-spacing: normal; white-space: normal; scroll-snap-align: start;
}
#tourTvEpisodes button:hover, #tourTvEpisodes button:focus-visible { border-color: #d9b56a; }
#tourTvEpisodes img { width: 100%; aspect-ratio: 16/8.5; display: block; object-fit: cover; background: #10171c; }
#tourTvEpisodes span { padding: .35rem .42rem .45rem; font: 650 .82rem/1.25 system-ui,sans-serif; }
#tourTvEpisodes small { right: .23rem; bottom: auto; top: .2rem; font-size: .7rem; }
.tour-cabinet button[data-tour-watch] {
  display: inline-flex; align-items: center; gap: .45rem; width: fit-content; max-width: 100%; min-height: 2.8rem;
  margin-inline: auto; padding: .26rem .5rem .26rem .26rem; border: 1px solid #667475; color: #edf5ec;
  background: #1b2a2f; text-align: left; text-transform: none; white-space: normal; letter-spacing: normal;
}
[data-tour-watch] > img { flex: none; width: 3.8rem; aspect-ratio: 16/9; object-fit: cover; border-radius: .14rem; }
[data-tour-watch] > span { min-width: 0; display: grid; gap: .12rem; }
[data-tour-watch] small { font: 600 .7rem/1 ui-monospace,Consolas,monospace; color: #a8dcd4; }
[data-tour-watch] strong { font: 700 .86rem/1.15 system-ui,sans-serif; color: #fff1c7; }
#tourTvViewer {
  overflow: auto; overscroll-behavior: contain; box-sizing: border-box;
  width: min(56rem,calc(100vw - 2rem)); max-width: 100%; max-height: 96dvh;
  margin: auto; padding: 0; border: 1px solid #708888; border-radius: .45rem;
  background: #122126; color: #eff9ee; box-shadow: 0 1rem 5rem #0009;
}
#tourTvViewer::backdrop { background: #061014ed; }
#tourTvViewer:not([open]) { display: none; }
#tourTvViewer:modal { position: fixed; inset: 0; }
.tour-tv-watchbar { padding: .48rem .75rem; justify-content: space-between; background: #213337; }
.tour-tv-watchbar > span { font: 750 .84rem/1.3 ui-monospace,Consolas,monospace; letter-spacing: .06em; text-transform: uppercase; }
#tourTvViewer button, #tourTvViewer a { font: 650 .9rem/1.2 system-ui,sans-serif; text-transform: none; letter-spacing: normal; }
#tourTvReturn { min-height: 40px; background: #ebc071; color: #141f20; border: 0; padding: .45rem .75rem; }
#tourTvViewer #tourVideoPlayer {
  position: relative; width: 100%; height: auto; min-height: 200px; min-width: 0; aspect-ratio: 16/9;
  max-height: 72dvh; overflow: hidden; background: #050b0c;
}
#tourTvViewer #tourVideoPlayer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.tour-tv-watchinfo { display: grid; gap: .45rem; padding: .75rem; }
#road-rally #tourTvViewerTitle { color: #fcf3d7; font-size: clamp(1rem,2vw,1.5rem); line-height: 1.2; }
.tour-tv-links { gap: .3rem 1.1rem; }
.tour-tv-links > * { display: inline-flex; align-items: center; min-height: 2.5rem; }
#tourTvError { font: .9rem/1.4 system-ui,sans-serif; margin: 0; color: #f2c581; }
#tourVideoPane[data-playing=true] .tour-tv-browse { display: none; }
#tourVideoPane[data-playing=true] #tourTvViewer[open]:not(:modal) {
  position: static; inset: auto; width: 100%; max-height: none; box-shadow: none;
}
#tourVideoPane[data-playing=true] .tour-tv-watchbar { padding: .25rem .4rem; }
#tourVideoPane[data-playing=true] .tour-tv-watchinfo { padding: .4rem; }
#tourVideoPane[data-playing=true] .tour-tv-links { gap: .3rem .6rem; }
#tourVideoPane[data-playing=true] #tourTvViewerTitle { font-size: .86rem; }
@media (max-width:699px), (max-height:550px) {
  .tour-cabinet:is([data-mode=pit],[data-mode=result],[data-mode=paused]) .tour-tv-browse { display: none; }
  .tour-cabinet:is([data-mode=pit],[data-mode=result],[data-mode=paused]) #tourVideoPane:not([data-playing=true]) { display: contents; }
  .tour-cabinet:is([data-mode=pit],[data-mode=result],[data-mode=paused]) .tour-layout:has(#tourVideoPane:not([hidden],[data-playing=true])) {
    grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr);
  }
  #tourTvViewer:modal { width: 100%; max-height: 100dvh; border-radius: .15rem; }
  #tourTvViewer:modal .tour-tv-watchbar { padding: max(.45rem, env(safe-area-inset-top)) max(.65rem,env(safe-area-inset-right)) .45rem max(.65rem,env(safe-area-inset-left)); }
  #tourTvViewer:modal .tour-tv-watchinfo { padding-bottom: max(.55rem,env(safe-area-inset-bottom)); }
  [data-tour-watch] > img { width: 3.25rem; }
}
@media (orientation:landscape) and (max-height:550px) {
  #tourTvViewer:modal { height: 100dvh; display: grid; grid-template-columns: minmax(0, 2.8fr) minmax(12rem, 1fr); grid-template-rows: auto 1fr; }
  #tourTvViewer:modal .tour-tv-watchbar { grid-column: 1/-1; }
  #tourTvViewer:modal #tourVideoPlayer { width: 100%; min-height: 0; height: 100%; max-height: none; aspect-ratio: auto; }
  #tourTvViewer:modal .tour-tv-watchinfo { align-self: start; }
}
#tourTvLaunchTitle { display: none; }
.tour-cabinet[data-mode=garage] #tourVideoToggle {
  color: #ffdd98; border-color: #a48149; background: #332f26;
}
.tour-cabinet[data-mode=garage] #tourVideoToggle::before { content: '▶ '; font-size: .75em; }
.tour-cabinet[data-mode=garage] #tourTvLaunchTitle { display: inline; }
.tour-cabinet[data-mode=garage] .tour-tv-launch-name { display: none; }


@media (orientation:landscape) and (min-width:720px) and (min-height:340px) and (max-height:550px) {
  .tour-cabinet:is(:fullscreen,:-webkit-full-screen,.tour-immersive):not([data-mode=garage]):has(#tourVideoPane[data-playing=true]) {
    display: grid;
    grid-template-columns: minmax(0,1fr) clamp(15rem,36vw,24rem);
    grid-template-rows: auto auto minmax(0,1fr) auto auto auto;
    grid-template-areas: "bar bar" "status tv" "road tv" "goal tv" "dials tv" "controls tv";
  }
  .tour-cabinet:is(:fullscreen,:-webkit-full-screen,.tour-immersive):has(#tourVideoPane[data-playing=true]):not([data-mode=garage]) {
    & > .tour-bar { grid-area: bar; }
    & > .tour-run-mode { grid-area: status; }
    & > .tour-layout { display: contents; }
    & .tour-screen { grid-area: road; }
    & > .tour-challenge-hud { grid-area: goal; }
    & > .tour-instruments { grid-area: dials; }
    & > .tour-inputs { grid-area: controls; }
    & #tourVideoPane { grid-area: tv; justify-self: stretch; width: 100%; max-width: 100%; max-height: 100%; padding: 3px; }
  }
  #tourVideoPane[data-playing=true] #tourTvViewer { border-radius: 2px; }
  #tourVideoPane[data-playing=true] .tour-tv-watchbar { padding: .15rem .35rem; }
  #tourVideoPane[data-playing=true] #tourTvReturn { min-height: 30px; padding: .2rem .45rem; font-size: .76rem; }
  #tourVideoPane[data-playing=true] #tourVideoPlayer { min-width: 200px; min-height: 200px; max-height: 58dvh; }
  #tourVideoPane[data-playing=true] .tour-tv-watchinfo { padding: .2rem .35rem; gap: 0; }
  #tourVideoPane[data-playing=true] #tourTvViewerTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
  #tourVideoPane[data-playing=true] .tour-tv-links a { min-height: 1.65rem; font-size: .75rem; }
}
