/* Retain the native stages, charts and chapter layouts. One compact navigation row. */
body.showcase { --shell-header: 0px; }
body.showcase header.app-header,
body.showcase #viewer-bindings,
body.showcase #workspaceHeading > .button,
body.showcase #jobBanner,
body.showcase #pipelineProgress,
body.showcase [data-profile-edit],
body.showcase #cameraButton,
body.showcase .profile-coverage-toggle[hidden] {display:none!important}
body.showcase #welcome[hidden] {display:none!important}
body.showcase #welcome:not([hidden]) {display:grid!important;align-content:center;justify-items:center;gap:12px;min-height:45vh;color:#24445c}
body.showcase #showcase-load-retry:not([hidden]) {padding:.4rem .85rem;border:1px solid #a5c6dd;border-radius:.55rem;color:#12517d;background:white;cursor:pointer}
body.showcase[data-module=profile] > main {padding-top:0!important;margin-top:0!important}
body.showcase[data-module=profile] > main > #showcase-nav.profile-contextbar {
  position:sticky!important;top:0!important;display:grid!important;
  grid-template-columns:auto minmax(0,max-content) minmax(82px,1fr) auto!important;
  grid-template-rows:auto;align-items:center;gap:clamp(8px,1.35vw,24px)!important;
  padding:0 clamp(12px,1.55vw,28px)!important;height:52px!important;min-height:52px!important;
  background:rgba(250,253,255,.96);border-bottom:1px solid #d6e5f0;z-index:60;
}
.showcase .topbar .shell-brand {grid-column:1;grid-row:1;display:flex;align-items:center;gap:7px;min-width:0}
.showcase .shell-brand .app-logo {display:inline-flex;align-items:center;gap:6px;white-space:nowrap;color:#133854;text-decoration:none;font-weight:740;font-size:17px}
.showcase .shell-brand .app-logo svg {width:27px;height:27px;color:#087eb9}
.showcase .topbar .shell-brand,.showcase .topbar .shell-brand .app-logo {height:36px;padding:0}
.showcase .shell-brand .shell-toggle {width:29px;height:30px;display:grid;place-items:center;background:transparent;color:#376784;border:0;border-radius:6px;cursor:pointer}
.showcase .shell-brand .shell-toggle svg {width:18px;height:18px}
body.showcase #showcase-nav > .experience-tabs {grid-column:2;align-items:center;overflow-x:auto;scrollbar-width:none}
body.showcase .profile-contextbar > .profile-match-heading {grid-column:3;max-width:100%;justify-self:center;text-align:center}
body.showcase .profile-contextbar #matchTitle {font-size:clamp(14px,1.16vw,20px)!important;line-height:1.3!important;letter-spacing:-.025em}
.showcase #showcase-language {grid-column:4;grid-row:1;justify-self:end;display:flex}
.showcase #showcase-language .yqzx-language {position:static;margin:0}
.showcase #moduleSidebar {top:52px!important}
.showcase .shell-resizer {top:52px!important}
.showcase #tacticalInsights .ti-toolbar {align-items:center}
.showcase .cs-story-nav {scroll-margin-top:54px}
.showcase button:focus-visible,.showcase a:focus-visible,.showcase select:focus-visible {outline:2px solid #167bbd;outline-offset:2px}
@media(max-width:1150px){
  .showcase .shell-brand .app-logo span {display:none}
  body.showcase .profile-contextbar > .experience-tabs button {padding-inline:7px;font-size:14px}
}
@media(max-width:850px){
  body.showcase[data-module=profile] > main > #showcase-nav.profile-contextbar {
    grid-template-columns:auto minmax(0,1fr) auto!important;grid-template-rows:38px 36px;
    height:76px!important;min-height:76px!important;gap:0 9px!important;padding-inline:10px!important;
  }
  body.showcase .profile-contextbar > .profile-match-heading {grid-column:2;grid-row:1}
  body.showcase #showcase-nav > .experience-tabs {grid-column:1/-1!important;grid-row:2!important;align-self:center;justify-self:stretch;display:flex;justify-content:safe center;width:100%!important;max-width:100%!important;transform:none!important;margin:0!important}
  body.showcase .profile-contextbar > .experience-tabs button {height:32px;min-height:32px}
  .showcase #showcase-language {grid-column:3}
  .showcase #moduleSidebar,.showcase .shell-resizer {top:76px!important}
  body.showcase .video-card .video-stage:not(:fullscreen):not(.is-window-fullscreen) {width:100%!important;max-width:100%!important;height:auto!important;min-height:0!important;aspect-ratio:16/9;margin:0!important}
  body.showcase .video-card .video-stage:not(:fullscreen):not(.is-window-fullscreen) #matchVideo {position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
}
@media(prefers-reduced-motion:reduce){.showcase .experience-motion-rail:before{transition:none!important}}

/* Keep editing choices next to the existing modes; the film owns the width below. */
.showcase #tacticalInsights .ti-clip-picker {
  display:flex;align-items:center;gap:8px;min-width:0;max-width:420px;margin-inline-start:auto;
}
.showcase #tacticalInsights .ti-clip-picker[hidden],
.showcase #tacticalInsights .ti-opportunities {display:none}
.showcase #tacticalInsights .ti-clip-picker span {color:#50677c;font-size:13px;white-space:nowrap}
.showcase #tacticalInsights .ti-clip-picker select {
  min-width:0;max-width:100%;height:32px;padding:2px 8px;border:1px solid #cbdbe8;border-radius:7px;
  background:#fff;color:#153f60;font-family:inherit;font-size:14px;font-weight:600;line-height:1.3;
}
.showcase #tacticalInsights .ti-clip-picker select:focus-visible,
.showcase #tacticalInsights .ti-clip-mark:focus-visible {outline:2px solid #087bbe;outline-offset:2px}
.showcase #tacticalInsights .ti-ticks {z-index:3;left:8px;right:8px;pointer-events:none}
.showcase #tacticalInsights .ti-clip-band {position:absolute;top:6px;height:2px;min-width:2px;background:#148fc382;border-radius:2px;pointer-events:none}
.showcase #tacticalInsights .ti-clip-mark {
  position:absolute;top:-3px;transform:translateX(-50%);pointer-events:auto;min-height:0!important;
  height:11px!important;width:16px!important;padding:0!important;border:0;background:transparent;display:grid;place-items:center;
}
.showcase #tacticalInsights .ti-clip-mark::after {
  content:"";width:6px;height:6px;transform:rotate(45deg);background:#008dcc;border:1px solid #fff;border-radius:1px;
}
.showcase #tacticalInsights .ti-clip-mark[aria-current=true]::after {background:#0060ab;box-shadow:0 0 0 1px #0060ab}
.showcase #tacticalInsights .ti-clip-footage {display:none}
.showcase #tacticalInsights[data-clip-phase=footage] .ti-clip-footage {
  display:flex;gap:10px;align-items:center;flex-wrap:wrap;color:#435f74;font-size:14px;
}
.showcase #tacticalInsights .ti-clip-footage button {color:#076ba6;background:transparent;border:0;font:inherit;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.showcase #tacticalInsights[data-clip-phase=footage] :is(.tx-readout,.tx-options,.ti-metrics,.ti-stage-head,.tx-comparison-bars,.tx-feature-key,.tx-hint,.tx-rail-head,.tx-action-row,.tx-route-control,.ti-analysis) {visibility:hidden}
@media(max-width:900px){
  .showcase #tacticalInsights .ti-toolbar {flex-wrap:wrap;height:auto;flex-basis:auto}
  .showcase #tacticalInsights .ti-clip-picker {max-width:100%;flex:1 1 240px;margin-inline-start:0}
  .showcase #tacticalInsights .ti-clip-picker select {max-width:calc(100% - 70px);flex:1}
}
@media(max-width:600px){
  .showcase #tacticalInsights .ti-toolbar {align-content:flex-start;row-gap:6px}
  .showcase #tacticalInsights .ti-clip-picker {flex:1 0 100%;margin-block:0}
  .showcase #tacticalInsights .ti-clip-picker span {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  .showcase #tacticalInsights .ti-clip-picker select {max-width:100%;width:100%}
}

/* Size the film and pitch first. The analysis below them follows its own content. */
@media (max-width: 900px) {
  .showcase #tacticalInsights .ti-stage,
  .showcase #tacticalInsights .ti-stage .ti-screens {
    height: auto;
    min-height: 0;
    flex: none;
    grid-template-rows: auto auto;
  }
  .showcase #tacticalInsights .tx-viewports {
    aspect-ratio: 16 / 9;
  }
  .showcase #tacticalInsights[data-experience=detail] .tx-viewports {
    aspect-ratio: auto;
    grid-template-rows: auto;
  }
  .showcase #tacticalInsights[data-experience=detail] .tx-viewports > .ti-screen {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
  .showcase #tacticalInsights .tx-rail,
  .showcase #tacticalInsights .tx-rail-body {
    height: auto;
    overflow: visible;
    scrollbar-gutter: auto;
  }
}

@media (max-width: 850px) {
  body.showcase[data-module=profile] > main {
    width: 100%;
    margin-inline: 0 !important;
  }
  body.showcase[data-module=profile] > main > #showcase-nav.profile-contextbar {
    height: 88px !important;
    grid-template-rows: 46px 42px;
  }
  .showcase #showcase-nav > .profile-match-heading {
    justify-self: stretch;
  }
  .showcase #showcase-nav #matchTitle {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
    text-wrap: balance;
  }
  body.showcase #showcase-nav > .experience-tabs {
    justify-content: safe center;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  body.showcase #showcase-nav > .experience-tabs button {
    height: 38px;
    min-height: 38px;
    padding-inline: 5px;
    white-space: nowrap;
  }
  .showcase #moduleSidebar {
    top: 88px !important;
    height: calc(100dvh - 88px);
  }
  .showcase .shell-resizer { display: none; }
  .showcase #moduleSidebar nav { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body.showcase[data-module=profile] #workspace .pitch-stage,
  body.showcase[data-module=profile] #workspace #researchPitch {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 105 / 68;
  }
  .showcase #workspace .video-card > .card-heading {
    flex-flow: row wrap;
    align-items: center;
    justify-content: space-between;
  }
  .showcase #workspace .video-card .camera-tools { width: auto; }
  .showcase #workspace .players-card { padding: 14px; }
  .showcase #workspace .players-card > .card-heading { align-items: flex-start; }
  body.showcase[data-module=profile] #workspace .players-card .table-scroll {
    max-height: none;
    overflow: visible;
    border: 0;
  }
  .showcase #playersTable { padding: 0; }
  .showcase #playersTable tr[data-player-id] {
    margin-bottom: 12px;
    align-items: start;
  }
  .showcase #playersTable tr[data-player-id] td {
    height: auto;
    padding: 8px 12px;
    line-height: 1.45;
    white-space: normal;
  }
  .showcase #workspace #playersTable tr[data-player-id] td::before {
    color: #526b83;
    font-size: 13px;
    line-height: 1.4;
  }
  .showcase #workspace #playersTable tr[data-player-id] :is(td:first-child, td:last-child)::before {
    display: none;
  }
  .showcase #playersTable tr[data-player-id] td:first-child {
    padding-block: 12px;
    background: #f5f8fc;
    border-bottom: 1px solid #e2eaf3;
  }
  .showcase #playersTable .coverage { justify-content: flex-start; }
  .showcase #workspace > #tacticalViews {
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  .showcase #workspace .tactics-modes {
    max-width: 100%;
    flex-wrap: wrap;
    height: auto;
  }
  .showcase #researchActions table { min-width: 26rem; }
}

@media (max-width: 600px) {
  .showcase #tacticalInsights .ti-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .showcase #tacticalInsights .tx-menu { justify-self: start; }
  .showcase #tacticalInsights .tx-modes {
    height: auto;
    align-items: stretch;
    flex-wrap: wrap;
  }
  .showcase #tacticalInsights .tx-modes button {
    height: auto;
    flex: 1 1 auto;
    min-height: 36px !important;
    padding: 4px !important;
    white-space: normal;
  }
  .showcase #tacticalInsights .tx-palette { overflow-wrap: anywhere; }
  .showcase #tacticalInsights[data-experience=detail] .ti-subject {
    min-width: 0;
    flex: 1 1 100%;
    flex-wrap: wrap;
  }
  .showcase #tacticalInsights[data-experience=detail] .ti-subject > select {
    min-width: 0;
    flex: 1 1 110px;
  }
  .showcase #tacticalInsights .tx-action-row { flex-wrap: wrap; }
  .showcase #tacticalInsights[data-clip-phase=footage] :is(.tx-readout, .tx-options, .ti-metrics,
      .ti-stage-head, .tx-comparison-bars, .tx-feature-key, .tx-hint, .tx-rail-head,
      .tx-action-row, .tx-route-control, .ti-analysis) { display: none; }
  .showcase #tacticalInsights .ti-stage .tx-viewports {
    aspect-ratio: auto;
    grid-template-rows: auto;
  }
  .showcase #tacticalInsights .tx-viewports > .ti-screen {
    position: relative;
    inset: auto;
    height: auto;
    aspect-ratio: 16 / 9;
  }
  .showcase #tacticalInsights .ti-transport {
    position: static;
    order: 1;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 36px) minmax(0, 1fr) auto;
    gap: 0 4px;
    width: 100% !important;
    height: auto;
    padding: 4px 8px;
    border-radius: 0;
    background: #f1f6fc;
    box-shadow: none;
  }
  .showcase #tacticalInsights .ti-transport button { width: 36px; height: 36px; }
  .showcase #tacticalInsights .ti-transport .ti-time { min-width: 0; text-align: center; }
  .showcase #tacticalInsights .ti-scrubber { grid-column: 1 / -1; grid-row: 2; }
  .showcase #tacticalInsights .ti-speed { grid-column: 5; grid-row: 1; }

  .showcase .event-atlas :is(.ea-header-tools, .ea-teams, .ea-groups) {
    flex-wrap: wrap;
  }
  .showcase .event-atlas .ea-groups {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 4px;
  }
  .showcase .event-atlas .ea-groups button {
    justify-content: center;
    min-height: 36px;
    padding-inline: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .showcase .event-atlas .ea-inspector {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .showcase .event-atlas .ea-chart-wrap {
    height: clamp(340px, 100vw, 450px);
    min-height: 0;
  }
  .showcase #workspace #playerTeamFilters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .showcase #playerTeamFilters button { justify-content: center; }

  body.showcase[data-module=profile] #profileDialog {
    width: calc(100% - 16px);
    max-width: none;
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }
  .showcase #profileContent .profile-grid { grid-template-columns: minmax(0, 1fr); }
  .showcase #profileContent .profile-stat { padding: 12px; }
  .showcase #profileContent .profile-tabs { flex-wrap: wrap; gap: 4px; }
  body.showcase[data-module=profile] #profileDialog .speed-zone {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.showcase[data-module=profile] #profileDialog .speed-zone :is(.speed-zone-label, strong, small) {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .showcase #coachStory .cs-chapter-links button { flex: none; }
  .showcase #coachStory .cs-stage-head {
    height: auto;
    flex-wrap: wrap;
    gap: 4px 8px;
    padding-block: 5px;
  }
  .showcase #coachStory .cs-modes button { flex: none; }
  .showcase #coachStory .cs-player-controls { flex-wrap: wrap; }
  .showcase #coachStory .cs-demo { flex-shrink: 0; }
  .showcase #coachStory .cs-training-detail dl > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

/* Leave room to read the chapter when the phone is turned on its side. */
@media (max-width: 950px) and (max-height: 500px) {
  .showcase #coachStory .cs-sticky { position: static; }
  .showcase #coachStory .cs-chapter {
    padding: 18px 0 32px;
    scroll-margin-top: calc(var(--cs-top) + var(--cs-nav) + 8px);
  }
}
@media (min-width: 640px) and (max-width: 950px) and (max-height: 500px) {
  .showcase #coachStory .cs-narrative {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
  }
  .showcase #coachStory .cs-sticky { position: sticky; }
  .showcase #coachStory .cs-scene {
    height: clamp(110px, 32dvh, 160px);
    min-height: 0;
  }
  .showcase #coachStory .cs-live-metrics { position: static; flex-wrap: wrap; }
}
