/* Responsive repair for the existing Intelligence in Action demonstration.
   Loaded after its original inline stylesheet; animation classes stay intact. */
:root {
  --pad: 32px;
  --track-y: 100px;
  --case-w: 280px;
}

html, body {
  width: 100%;
  height: auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

body { font-size: 14px; line-height: 1.5; }

#app {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  transform: none !important;
  overflow: visible;
}

#app:fullscreen, #app:-webkit-full-screen {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  background: var(--ink);
}

#app .wrap {
  display: block;
  width: 100%;
  max-width: 1280px;
  height: auto;
  margin: 0 auto;
  padding: 26px var(--pad) 24px;
}

/* Give the scenario and playback controls a row of their own. */
#app .top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 15px 24px;
  padding: 0;
}
#app .brand img { height: 36px; }
#app .wordmark { font: 32px/1 var(--head); }
#app .tagline { min-width: 0; margin: 0; font-size: 15px; }
#app .controls {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  padding: 8px 0 20px;
  border-bottom: 1px solid var(--line);
}
#app .controls label { display: block; flex: 1 1 350px; min-width: 0; }
#app .scenario-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}
#app .controls select {
  width: 100%;
  max-width: none;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
}
#app .btn { min-height: 44px; padding: 10px 16px; font-size: 14px; }
#app .btn.primary { min-width: 104px; }

#app .brief { position: static; max-width: 1030px; padding: 22px 0 16px; }
#app .kicker { margin: 0 0 10px; font-size: 11px; letter-spacing: .14em; }
#app .intro { max-width: 1030px; font-size: 20px; line-height: 1.5; }
#app .disclaimer { display: none; }

/* The moving case still uses the original five-station rail and --x. */
#app .stage { display: block; flex: none; min-height: 0; }
#app .rail { height: 184px; }
#app .lbl { top: 2px; font-size: 11px; line-height: 1.45; letter-spacing: .1em; }
#app .case { padding: 12px 15px; }
#app .case-tag { margin-bottom: 5px; font-size: 10px; }
#app .case-title { margin-bottom: 5px; font-size: 19px; line-height: 1.25; }
#app .case-body { font-size: 13px; line-height: 1.5; }
#app .panels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
  margin-top: 8px;
}
#app .panel { display: block; min-width: 0; padding: 0; opacity: .48; }
#app .panel.is-past { opacity: .78; }
#app .panel.is-active { opacity: 1; }
#app .ph { margin-bottom: 12px; font-size: 11px; line-height: 1.5; letter-spacing: .12em; }
#app .pbody { display: none; }
#app .src-list, #app .opts { gap: 8px; }
#app .src, #app .opt { padding: 8px 10px; font-size: 13px; line-height: 1.45; }
#app .o-t { font-size: 13px; line-height: 1.45; }
#app .why { font-size: 12px; line-height: 1.45; margin-top: 5px; }
#app .tag, #app .note { margin-top: 12px; font-size: 12px; line-height: 1.5; }
#app .net { max-width: 210px; }
#app .scale { margin-top: 12px; }
#app .seg { font-size: 11px; }
#app .scale-cap { margin-top: 8px; font-size: 12px; line-height: 1.5; }
#app .chks, #app .recs { gap: 12px; }
#app .chk, #app .rec { align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.5; }
#app .box { margin-top: 3px; }

/* Inactive story layers occupy no space and cannot cover the live call. */
#app .lower { display: none; min-height: 0; margin: 0; padding: 0; overflow: visible; }
#app .lower > .convo,
#app .lower > .agentzone,
#app .lower > .loopcard,
#app .lower > .closing {
  display: none;
  grid-row: auto;
  grid-column: auto;
  width: auto;
  height: auto;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
}
#app .lower.live,
#app .lower.is-loop,
#app .lower.is-close { margin-top: 28px; padding-top: 22px; }
#app .lower.live {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: start;
  gap: 28px;
}
#app .lower.live > .convo { display: flex; opacity: 1; overflow: visible; pointer-events: auto; }
#app .lower.live > .agentzone {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 14px;
  opacity: 1;
  pointer-events: auto;
}
#app .convo-top { align-items: flex-start; gap: 8px; margin-bottom: 14px; }
#app .convo-head { font-size: 11px; line-height: 1.5; }
#app .lead { max-width: 100%; padding: 5px 9px; font-size: 11px; line-height: 1.5; }
#app .lead .pip { flex: 0 0 8px; }
#app .bubbles {
  flex: none;
  height: 320px;
  min-height: 0;
  max-height: 320px;
  gap: 12px;
  padding-right: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
#app .lower .bubble { font-size: 14px; line-height: 1.6; }
#app .lower .bubble .who { font-size: 10px; line-height: 1.5; }
#app .lower .bubble.specialist {
  display: block !important;
  align-self: stretch;
  padding: 10px 12px;
  border-left-color: var(--text);
  background: rgba(238, 239, 232, .92);
  color: var(--ink);
}
#app .lower .bubble.specialist .who,
#app .lower .bubble.specialist p { color: var(--ink); }
#app .agent-card, #app .agent-card.is-assist {
  grid-column: auto !important;
  grid-row: auto;
  min-width: 0;
  margin: 0;
  padding: 18px;
}
#app .specialist-card { display: none !important; grid-column: auto; grid-row: auto; }
#app .specialist-card.on { display: block !important; align-self: stretch; padding: 13px 16px; }
#app .photo { display: none; }
#app .lower .who { font-size: 14px; line-height: 1.5; }
#app .lower .who-sub { margin-top: 5px; font-size: 13px; line-height: 1.5; }
#app .wave { height: 40px; margin: 0 0 12px; }
#app .wave span { height: calc(var(--h) * 40px); }
#app .agent-card .wave span { animation-play-state: paused; }
#app .agent-card.talking .wave span { animation-play-state: running; }
#app .surf { margin-top: 14px; }
#app .lower .surf li { padding: 7px 10px; margin-bottom: 8px; font-size: 13px; line-height: 1.5; }
#app .cap { display: block; margin-top: 18px; font-size: 10px; line-height: 1.5; }
#app .supplies { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin-top: 10px; }
#app .lower .supplies li { font-size: 12px; line-height: 1.5; }
#app .lower.is-loop, #app .lower.is-close { display: block; }
#app .lower.is-loop > .loopcard,
#app .lower.is-close > .closing { display: flex; opacity: 1; pointer-events: auto; }
#app .row { grid-template-columns: 180px minmax(0, 1fr); gap: 18px; padding: 16px 18px; }
#app .row .v { font-size: 15px; line-height: 1.6; }
#app .loopfoot { margin: 16px 18px; font-size: 14px; line-height: 1.6; }
#app .closing { gap: 18px; padding: 0; }
#app .cl { max-width: 1000px; font-size: 26px; line-height: 1.4; }

#app .return { display: none; height: auto; min-height: 0; margin-top: 24px; padding: 18px 20px; }
#app .return.on { display: flex; }
#app .ret-label { width: auto; font-size: 20px; line-height: 1.4; }
#app .return .gates { flex-wrap: wrap; }
#app .return .gates span { padding: 8px 11px; font-size: 12px; }

/* Chapter navigation remains visible and usable without precision clicking. */
#app .progress {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 26px;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
}
#app .pg { min-height: 48px; padding: 9px 8px; border: 1px solid var(--line); border-radius: 4px; }
#app .pg::before { height: 3px; margin-bottom: 8px; }
#app .pg.now { background: rgba(201, 255, 101, .08); border-color: var(--accent); }
#app .pl { display: block; font-size: 10px; line-height: 1.5; letter-spacing: .04em; }
#app .foot { display: block; margin: 20px 0 0; padding: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
#app .foot p { margin: 0; }

@media (max-width: 900px) {
  :root { --pad: 24px; --case-w: 250px; }
  #app .controls label { flex-basis: 100%; }
  #app .panels { grid-template-columns: minmax(0, 1fr); }
  #app .panel { display: none; opacity: 1; }
  #app .panel.is-active { display: block; }
  #app .panel .src-list, #app .panel .opts { max-width: 640px; }
  #app .pbody { display: block; margin: 16px 0 0; font-size: 15px; line-height: 1.6; }
  #app .net { max-width: 300px; margin: 0; }
  #app .scale { max-width: 420px; }
  #app .lower.live { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  #app .return { flex-direction: column; align-items: flex-start; gap: 16px; }
  #app .return .gates { width: 100%; justify-content: flex-start; }
}

@media (max-width: 540px) {
  :root { --pad: 16px; --case-w: 190px; --track-y: 96px; }
  #app .wrap { padding-top: 18px; }
  #app .top { gap: 12px 16px; }
  #app .brand img { height: 30px; }
  #app .tagline { font-size: 12px; line-height: 1.5; }
  #app .controls { gap: 8px; padding-bottom: 18px; }
  #app .controls select { padding: 10px; font-size: 13px; }
  #app .btn { flex: 1 1 auto; padding: 10px 12px; font-size: 13px; }
  #app .btn.primary { min-width: 0; }
  #app .brief { padding-top: 20px; }
  #app .kicker { font-size: 10px; letter-spacing: .08em; }
  #app .intro { font-size: 18px; }
  #app .rail { height: 170px; }
  #app .lbl { padding: 0 2px; font-size: 9px; line-height: 1.4; letter-spacing: 0; }
  #app .case { padding: 10px 12px; }
  #app .case-title { margin: 0; font-size: 17px; }
  #app .case-body { display: none; }
  #app .bubbles { height: 300px; max-height: 300px; }
  #app .agent-card, #app .agent-card.is-assist { padding: 15px; }
  #app .row { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 15px; }
  #app .row .v { font-size: 14px; }
  #app .cl { font-size: 22px; }
  #app .cl span { display: block; margin: 0 0 5px; }
  #app .progress { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #app .pg { padding: 9px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  #app .wave span { animation: none; }
}

#app[data-playback="paused"] *,
#app[data-playback="paused"] *::before,
#app[data-playback="paused"] *::after { animation-play-state: paused !important; }
