.expandable-video-shell {
  position: relative;
}

[data-expandable-video] {
  cursor: zoom-in;
}

.video-expand-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(7, 17, 23, 0.78);
  color: #fff;
  font: 500 20px/1 sans-serif;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.video-expand-button:hover,
.video-expand-button:focus-visible {
  border-color: #fff;
  background: rgba(0, 125, 206, 0.92);
  outline: none;
}

.inline-evidence-layout {
  position: relative;
  display: grid;
  height: clamp(340px, 36vw, 500px);
  min-width: 0;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.82fr);
  overflow: hidden;
  background: #081116;
}

.engineering-history-media .inline-evidence-layout {
  height: var(--comparison-inline-height, 430px);
}

.real-world-video .inline-evidence-layout {
  height: clamp(390px, 42vw, 520px);
}

.inline-evidence-layout.is-trace-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.physical-video-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #030608;
}

.physical-video-stage video {
  display: block;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  object-fit: contain;
}

.inline-tool-trace {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-left: 1px solid rgba(20, 39, 53, 0.14);
  background:
    linear-gradient(rgba(0, 125, 206, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 125, 206, 0.035) 1px, transparent 1px),
    #f7fbfd;
  background-size: 24px 24px;
}

.inline-tool-trace[hidden] {
  display: none;
}

.inline-tool-trace > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(20, 39, 53, 0.12);
  background: rgba(255, 255, 255, 0.95);
}

.inline-tool-trace > header strong,
.inline-tool-trace > header small {
  display: block;
}

.inline-tool-trace > header strong {
  color: #142735;
  font: 620 15px/1.3 "Noto Sans SC", "PingFang SC", sans-serif;
}

.inline-tool-trace > header small {
  margin-top: 5px;
  color: #6e7d84;
  font: 650 10px/1.35 "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.inline-tool-trace > header button,
.inline-tool-restore {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(20, 39, 53, 0.18);
  border-radius: 50%;
  background: #fff;
  color: #41545f;
  font: 500 22px/1 sans-serif;
  cursor: pointer;
}

.inline-tool-trace > header button:hover,
.inline-tool-trace > header button:focus-visible,
.inline-tool-restore:hover,
.inline-tool-restore:focus-visible {
  border-color: #007dce;
  color: #007dce;
  outline: none;
}

.inline-tool-steps {
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: rgba(0, 125, 206, 0.42) transparent;
}

.inline-tool-steps li {
  border-bottom: 1px solid rgba(20, 39, 53, 0.09);
}

.inline-tool-steps button {
  display: grid;
  width: 100%;
  grid-template-columns: 43px minmax(0, 1fr);
  gap: 9px;
  padding: 9px 14px;
  border: 0;
  background: transparent;
  color: #41545f;
  text-align: left;
  cursor: pointer;
}

.inline-tool-steps time {
  padding-top: 2px;
  color: #8a969c;
  font: 600 10px/1.3 "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.inline-tool-steps button > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.inline-tool-steps strong {
  color: #142735;
  font: 620 11px/1.3 "Noto Sans SC", "PingFang SC", sans-serif;
}

.inline-tool-steps small {
  color: #6e7d84;
  font: 500 10px/1.3 "Noto Sans SC", "PingFang SC", sans-serif;
}

.inline-tool-steps code {
  color: #007dce;
  font: 650 11px/1.3 "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  overflow-wrap: anywhere;
}

.inline-tool-steps li[data-status="retry"] code {
  color: #ef562c;
}

.inline-tool-steps li[data-status="live"] code {
  color: #00a9d0;
}

.inline-tool-steps li.is-active button {
  background: rgba(0, 125, 206, 0.11);
  box-shadow: inset 3px 0 #00bfe8;
}

.inline-tool-steps li.is-active time {
  color: #007dce;
}

.inline-tool-steps button:hover,
.inline-tool-steps button:focus-visible {
  background: rgba(0, 125, 206, 0.08);
  outline: none;
}

.inline-tool-restore {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.94);
}

.inline-tool-restore[hidden] {
  display: none;
}

.media-lightbox {
  width: min(1480px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(20, 39, 53, 0.18);
  border-radius: 8px;
  background: #fff;
  color: #142735;
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.45);
}

.media-lightbox::backdrop {
  background: rgba(4, 10, 14, 0.84);
  backdrop-filter: blur(5px);
}

.media-lightbox-shell {
  position: relative;
  display: grid;
  max-height: calc(100vh - 48px);
  grid-template-rows: minmax(0, 1fr) auto;
}

.media-lightbox-stage {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  background: #081116;
}

.media-lightbox[data-trace-open="true"] .media-lightbox-stage {
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.8fr);
}

.media-lightbox video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 124px);
  background: #030608;
  object-fit: contain;
}

.media-tool-trace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  max-height: calc(100vh - 124px);
  overflow: hidden;
  border-left: 1px solid rgba(20, 39, 53, 0.14);
  background:
    linear-gradient(rgba(0, 125, 206, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 125, 206, 0.035) 1px, transparent 1px),
    #f7fbfd;
  background-size: 24px 24px;
}

.media-tool-trace[hidden] {
  display: none;
}

.media-tool-trace > header {
  padding: 20px 22px 17px;
  border-bottom: 1px solid rgba(20, 39, 53, 0.12);
  background: rgba(255, 255, 255, 0.94);
}

.media-tool-trace > header > span {
  display: block;
  color: #007dce;
  font: 700 11px/1.2 "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  text-transform: uppercase;
}

.media-tool-trace > header > strong {
  display: block;
  margin-top: 9px;
  color: #142735;
  font: 620 20px/1.28 "Noto Sans SC", "PingFang SC", sans-serif;
}

.media-tool-trace > header > small {
  display: block;
  margin-top: 7px;
  color: #739300;
  font: 650 11px/1.35 "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.media-tool-trace > header > p {
  margin: 9px 0 0;
  color: #6e7d84;
  font: 400 13px/1.55 "Noto Sans SC", "PingFang SC", sans-serif;
}

.media-tool-steps code {
  color: #007dce;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.media-tool-steps {
  display: grid;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: rgba(0, 125, 206, 0.42) transparent;
}

.media-tool-steps li {
  border-bottom: 1px solid rgba(20, 39, 53, 0.09);
}

.media-tool-steps button {
  display: grid;
  width: 100%;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 13px;
  padding: 12px 22px;
  border: 0;
  background: transparent;
  color: #41545f;
  text-align: left;
  cursor: pointer;
}

.media-tool-steps time {
  padding-top: 2px;
  color: #8a969c;
  font: 600 11px/1.3 "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.media-tool-steps button > span {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.media-tool-steps button > span > strong {
  color: #142735;
  font: 620 12px/1.35 "Noto Sans SC", "PingFang SC", sans-serif;
}

.media-tool-steps small {
  color: #6e7d84;
  font: 500 11px/1.35 "Noto Sans SC", "PingFang SC", sans-serif;
}

.media-tool-steps button > span > span {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.media-tool-steps em {
  flex: 0 0 auto;
  color: #8a969c;
  font: 650 10px/1.35 "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-style: normal;
}

.media-tool-steps code {
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.media-tool-steps li[data-status="retry"] code {
  color: #ef562c;
}

.media-tool-steps li[data-status="live"] code {
  color: #00bfe8;
}

.media-tool-steps li.is-active button {
  background: rgba(0, 125, 206, 0.11);
  box-shadow: inset 3px 0 #00bfe8;
}

.media-tool-steps li.is-active time {
  color: #007dce;
}

.media-tool-steps button:hover,
.media-tool-steps button:focus-visible {
  background: rgba(0, 125, 206, 0.08);
  outline: none;
}

.media-lightbox footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px 16px 22px;
  border-top: 1px solid rgba(20, 39, 53, 0.14);
  background: #fff;
}

.media-lightbox h2 {
  margin: 0;
  color: #142735;
  font: 600 18px/1.35 "Noto Sans SC", "PingFang SC", sans-serif;
}

.media-tool-toggle {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(0, 125, 206, 0.34);
  border-radius: 6px;
  background: #fff;
  color: #142735;
  cursor: pointer;
}

.media-tool-toggle[hidden] {
  display: none;
}

.media-tool-toggle:disabled {
  cursor: wait;
  opacity: 0.55;
}

.media-tool-toggle > span {
  color: #007dce;
  font: 700 13px/1 "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.media-tool-toggle > b {
  font: 650 13px/1 "Noto Sans SC", "PingFang SC", sans-serif;
}

.media-tool-toggle[aria-expanded="true"],
.media-tool-toggle:hover,
.media-tool-toggle:focus-visible {
  border-color: #007dce;
  background: #007dce;
  color: #fff;
  outline: none;
}

.media-tool-toggle[aria-expanded="true"] > span,
.media-tool-toggle:hover > span,
.media-tool-toggle:focus-visible > span {
  color: #fff;
}

.media-lightbox-close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(20, 39, 53, 0.26);
  border-radius: 50%;
  background: #fff;
  color: #142735;
  font: 300 27px/1 sans-serif;
  cursor: pointer;
}

.media-lightbox-close:hover,
.media-lightbox-close:focus-visible {
  border-color: #007dce;
  background: #007dce;
  color: #fff;
  outline: none;
}

@media (max-width: 980px) {
  .media-lightbox[data-trace-open="true"] .media-lightbox-stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(220px, 50vh) minmax(260px, 1fr);
    overflow: hidden;
  }

  .media-tool-trace {
    max-height: none;
    border-top: 1px solid rgba(20, 39, 53, 0.14);
    border-left: 0;
  }

  .media-tool-steps {
    max-height: 300px;
  }

  .media-lightbox[data-trace-open="true"] video {
    max-height: 50vh;
  }
}

@media (max-width: 700px) {
  .inline-evidence-layout,
  .engineering-history-media .inline-evidence-layout,
  .real-world-video .inline-evidence-layout {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(280px, 48vh);
  }

  .physical-video-stage {
    aspect-ratio: 16 / 9;
  }

  .inline-tool-trace {
    border-top: 1px solid rgba(20, 39, 53, 0.14);
    border-left: 0;
  }

  .inline-evidence-layout.is-trace-hidden {
    grid-template-rows: auto;
  }

  .media-lightbox {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .media-lightbox[data-trace-open="true"] .media-lightbox-stage {
    grid-template-rows: minmax(180px, 30vh) minmax(0, 1fr);
  }

  .media-lightbox[data-trace-open="true"] video {
    max-height: 30vh;
  }

  .media-lightbox-shell {
    max-height: calc(100vh - 20px);
  }

  .media-lightbox video {
    max-height: calc(100vh - 134px);
  }

  .media-lightbox footer {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 13px 14px 14px;
  }

  .media-tool-toggle {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    width: 100%;
  }

  .media-lightbox-close {
    grid-column: 2;
    grid-row: 1;
  }

  .media-tool-trace > header > p {
    display: none;
  }

  .media-tool-trace > header {
    padding-right: 16px;
    padding-left: 16px;
  }

  .media-tool-steps button {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (max-width: 360px) and (max-height: 640px) {
  .media-lightbox[data-trace-open="true"] .media-lightbox-stage {
    grid-template-rows: minmax(140px, 26vh) minmax(0, 1fr);
  }

  .media-lightbox[data-trace-open="true"] video {
    max-height: 26vh;
  }

  .media-tool-trace > header {
    padding: 10px 12px 9px;
  }

  .media-tool-trace > header > strong {
    margin-top: 4px;
    font-size: 15px;
  }

  .media-tool-trace > header > small {
    margin-top: 4px;
  }

  .media-tool-trace > header > p {
    display: none;
  }

  .media-lightbox footer {
    gap: 8px;
    padding: 8px 10px 9px;
  }

  .media-lightbox h2 {
    font-size: 14px;
  }

  .media-tool-toggle {
    min-height: 32px;
  }

  .media-lightbox-close {
    width: 34px;
    height: 34px;
  }
}
