.tbg-gestures {
  color-scheme: dark;
  --canvas: #0d0e11;
  --text: #f4f3f1;
  --muted: #b6bac0;
  --line: #33353b;
  --gold: #dfc197;
  --gutter: clamp(20px, 5.6vw, 88px);
  --nav: var(--scene-head, 72px);
  --small-viewport: 100vh;
  --view: calc(var(--small-viewport) - var(--nav));
  --scroll-travel: 900px;
}

@supports (height: 100svh) {
  .tbg-gestures {
    --small-viewport: 100svh;
    --scroll-travel: clamp(790px, 115svh, 1100px);
  }
}

.tbg-gestures *, .tbg-gestures *::before, .tbg-gestures *::after { box-sizing: border-box; }
.tbg-gestures [hidden] { display: none !important; }
.tbg-gestures {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font: 400 16px/1.5 Exo2, system-ui, sans-serif;
}
.tbg-gestures button, .tbg-gestures summary { font: inherit; color: inherit; }
.tbg-gestures a { color: inherit; }
.tbg-gestures a:focus-visible, .tbg-gestures button:focus-visible, .tbg-gestures summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}
.tbg-gestures .back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 550;
}
.tbg-gestures .back span { color: var(--gold); }

.tbg-gestures .sequence {
  background: radial-gradient(ellipse at 66% 40%, #1e2025 0%, #121318 54%, var(--canvas) 88%);
}
.tbg-gestures .sequence[data-motion] { min-height: calc(var(--view) + var(--scroll-travel)); }
.tbg-gestures .stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  align-content: center;
  gap: 8px;
  min-height: var(--view);
  max-width: 1536px;
  margin-inline: auto;
  padding: clamp(21px, 3.4vh, 40px) var(--gutter) max(20px, env(safe-area-inset-bottom));
}
.tbg-gestures .sequence[data-motion] .stage { position: sticky; top: var(--nav); }
.tbg-gestures .intro { position: relative; z-index: 2; max-width: 560px; }
.tbg-gestures .eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  text-transform: uppercase;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 610;
  letter-spacing: .17em;
}
.tbg-gestures .demo-title, .tbg-gestures .setup-title {
  margin: 0;
  font-weight: 480;
  letter-spacing: -.042em;
  line-height: .99;
  text-wrap: balance;
}
.tbg-gestures .demo-title { font-size: clamp(37px, 10.4vw, 64px); }
.tbg-gestures .gesture-lead, .tbg-gestures .instruction-copy > p:last-child {
  max-width: 39ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 3.9vw, 19px);
  line-height: 1.43;
}

.tbg-gestures .studio {
  position: relative;
  isolation: isolate;
  --studio-height: clamp(255px, calc(var(--small-viewport) * .43), 425px);
  width: 100%;
  height: var(--studio-height);
  align-self: center;
  margin: 0;
}
.tbg-gestures .studio::before {
  position: absolute;
  z-index: -1;
  inset: 3% -5% -3% 5%;
  content: "";
  background: radial-gradient(ellipse at 62% 42%, #79808735, #656a7320 30%, #1a1e2500 66%);
  pointer-events: none;
}
.tbg-gestures .screen {
  position: absolute;
  z-index: 3;
  left: 0;
  top: 42%;
  width: 41%;
  max-width: 308px;
}
.tbg-gestures .screen-caption {
  display: block;
  margin-bottom: 7px;
  color: #c7c9ce;
  font-size: 12px;
  line-height: 1.25;
}
.tbg-gestures .screen-control {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;
}
.tbg-gestures .screen-art {
  display: block;
  width: 100%;
  overflow: visible;
  filter: drop-shadow(0 16px 20px #0008);
}
.tbg-gestures .hand-frames {
  transform: translate(var(--hand-offset-x, 0px), var(--hand-offset-y, 0px));
}
.tbg-gestures .touch-pose { display: none; }
.tbg-gestures [data-gesture="3"] [data-fingers="3"],
.tbg-gestures [data-gesture="4"] [data-fingers="4"],
.tbg-gestures [data-gesture="5"] [data-fingers="5"] { display: inline; }
.tbg-gestures .touches { opacity: var(--contact, 0); }

.tbg-gestures .car {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: -2%;
  width: min(65%, calc(var(--studio-height) * 498 / 816));
  aspect-ratio: 498 / 816;
  transform: translateY(-50%);
  pointer-events: none;
}
.tbg-gestures .car::before {
  position: absolute;
  inset: 8% 18% 4% 22%;
  border-radius: 35%;
  background: #000b;
  filter: blur(13px);
  transform: translate(7px, 9px);
  content: "";
}
.tbg-gestures .car-poster, .tbg-gestures .car-frames {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.tbg-gestures .car-poster { object-fit: fill; }
.tbg-gestures .car-frames[hidden] { display: none; }
.tbg-gestures [data-car-frame]:not([data-car-frame="closed"]) .car-poster { visibility: hidden; }
.tbg-gestures .signal, .tbg-gestures .hotspots { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tbg-gestures .signal { z-index: 1; overflow: visible; }
.tbg-gestures .signal-guide, .tbg-gestures .signal-trace {
  fill: none;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.tbg-gestures .signal-guide { stroke: #b5b8c2; opacity: .24; }
.tbg-gestures .signal-trace {
  stroke: #e9c89b;
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--signal, 0));
  opacity: var(--signal-light, 0);
}
.tbg-gestures .signal-point { fill: #fff0d5; opacity: var(--point-light, 0); }
.tbg-gestures .hotspots { z-index: 4; }
.tbg-gestures .hotspot {
  position: absolute;
  top: var(--y, 50%);
  left: var(--x, 50%);
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.tbg-gestures [data-ready] .hotspot { display: grid; }
.tbg-gestures .hotspot span {
  display: block;
  position: relative;
  width: 13px;
  height: 13px;
  border: 1px solid #8e9199;
  border-radius: 50%;
  background: #181a1f;
  box-shadow: 0 0 0 3px #13141885;
}
.tbg-gestures .hotspot span::after {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #a6a7ad;
  content: "";
}
.tbg-gestures .hotspot[aria-pressed="true"] span {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px #dfc19735, 0 0 calc(3px + var(--open, 0) * 8px) #eacb8e80;
}
.tbg-gestures .hotspot[aria-pressed="true"] span::after { background: #ffedcb; }
@media (hover: hover) {
  .tbg-gestures .hotspot:hover span { border-color: var(--gold); }
  .tbg-gestures .screen-control:hover .screen-art { filter: drop-shadow(0 12px 17px #000a) brightness(1.08); }
}

.tbg-gestures .response { position: relative; z-index: 5; }
.tbg-gestures .result {
  min-height: 58px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.tbg-gestures .status-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  transform: translateY(-2px);
}
.tbg-gestures [data-phase="result"] .status-dot { background: var(--gold); box-shadow: 0 0 8px #e7b97160; }
.tbg-gestures .door-name, .tbg-gestures .state-text { margin: 0; }
.tbg-gestures .door-name { font-size: 18px; line-height: 1.25; font-weight: 590; }
.tbg-gestures .state-text { margin-top: 4px; font-size: 14px; line-height: 1.32; color: var(--muted); }
.tbg-gestures .gesture-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.tbg-gestures .gesture-buttons button {
  min-height: 48px;
  border: 1px solid #ffffff22;
  border-radius: 3px;
  background: #1b1d22;
  color: #d1d3d8;
  padding: 5px 3px;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.15;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}
.tbg-gestures .gesture-buttons b {
  margin-right: 2px;
  font-size: 19px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}
.tbg-gestures .gesture-buttons button[aria-pressed="true"] {
  border-color: #a99476;
  background: #2c2823;
  color: #f6ead9;
}
.tbg-gestures .hint {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.tbg-gestures .sequence:not([data-motion]) .hint-scroll,
.tbg-gestures .sequence[data-motion] .hint-tap { display: none; }
.tbg-gestures .hint svg {
  flex: none;
  width: 16px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.tbg-gestures .instruction {
  padding: clamp(62px, 10vw, 136px) var(--gutter) 32px;
  border-top: 1px solid var(--line);
  background: #111216;
}
.tbg-gestures .instruction-copy, .tbg-gestures details, .tbg-gestures .back, .tbg-gestures .credits { max-width: 1050px; margin-inline: auto; }
.tbg-gestures .setup-title { font-size: clamp(36px, 8.5vw, 64px); }
.tbg-gestures .instruction-copy > p:last-child { max-width: 54ch; }
.tbg-gestures details {
  margin-top: 26px;
  border-block: 1px solid var(--line);
}
.tbg-gestures summary {
  min-height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  list-style: none;
  cursor: pointer;
  font-size: 17px;
  font-weight: 570;
}
.tbg-gestures summary::-webkit-details-marker { display: none; }
.tbg-gestures summary::after { content: "+"; color: var(--gold); font-size: 22px; font-weight: 400; }
.tbg-gestures details[open] summary::after { content: "−"; }
.tbg-gestures .steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 28px;
  padding: 10px 0 24px;
}
.tbg-gestures .step h4 { margin: 0 0 7px; font-size: 19px; font-weight: 570; }
.tbg-gestures .step p { margin: 0 0 14px; color: var(--muted); font-size: 16px; }
.tbg-gestures .step img { display: block; width: min(100%, 310px); height: auto; border-radius: 10px; }
.tbg-gestures .back { display: flex; width: fit-content; margin: 18px auto 0; }
.tbg-gestures .credits {
  padding: 20px var(--gutter) max(22px, env(safe-area-inset-bottom));
  text-align: center;
  color: #a9abb2;
  font-size: 12px;
}

@media (max-width: 360px) {
  .tbg-gestures .demo-title { font-size: 35px; }
  .tbg-gestures .stage { padding-block-start: 16px; gap: 6px; }
  .tbg-gestures .studio { --studio-height: clamp(214px, calc(var(--small-viewport) * .40), 325px); }
  .tbg-gestures .result { min-height: 55px; }
  .tbg-gestures .state-text { font-size: 13px; }
}
@media (min-width: 760px) {
  .tbg-gestures .stage {
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    grid-template-rows: 1fr 1fr;
    gap: 20px clamp(24px, 4.5vw, 76px);
    align-items: end;
  }
  .tbg-gestures .intro { grid-column: 1; grid-row: 1; }
  .tbg-gestures .intro .demo-title { font-size: clamp(36px, 4.6vw, 81px); text-wrap: wrap; }
  .tbg-gestures .studio { grid-column: 2; grid-row: 1 / 3; --studio-height: clamp(360px, calc(var(--small-viewport) * .68), 640px); }
  .tbg-gestures .screen-caption { font-size: 14px; }
  .tbg-gestures .screen { top: 40%; }
  .tbg-gestures .car { right: 0; }
  .tbg-gestures .response { grid-column: 1; grid-row: 2; align-self: start; max-width: 450px; margin-top: 10px; }
  .tbg-gestures .door-name { font-size: 22px; }
  .tbg-gestures .state-text { font-size: 16px; }
  .tbg-gestures .result { min-height: 72px; }
  .tbg-gestures .gesture-buttons button { font-size: 15px; }
  .tbg-gestures .hint { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .tbg-gestures .hint { display: none; }
}

.tbg-gestures,
.tbg-gestures .sequence,
.tbg-gestures .instruction { scroll-margin-top: var(--nav); }
.tbg-gestures .sequence { overflow-anchor: none; }

@media (max-width: 360px) {
  .tbg-gestures .studio {
    --studio-height: clamp(200px, calc(var(--small-viewport) * .375), 325px);
  }
}

.tbg-gestures .gesture-detail {fill:none;stroke:#a8b5c0;stroke-width:1;stroke-opacity:.46;stroke-linecap:round;stroke-linejoin:round;}
.tbg-gestures .gesture-outline {vector-effect:non-scaling-stroke;}
