/* Site player. It stays mounted through page changes and grows upward for video
   calls and task screens, so it never covers page content. Colors are fixed
   here because page stylesheets define different tokens. */
body { padding-bottom: calc(var(--dock-height, 64px) + 24px); }
.dock {
  --dock-stage: min(32vh, 280px);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: #f0efed;
  border-top: 0.5px solid #d6d3d1;
  color: #0c0a09;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom);
  /* The background runs edge to edge while the content lines up with the page column. */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  padding-inline: max(32px, (100% - 1056px) / 2);
}
.dock[hidden] { display: none; }
.dock-grip { position: absolute; top: 0; left: 0; right: 0; height: 12px; cursor: ns-resize; touch-action: none; }
.dock-grip::after { content: ''; position: absolute; top: 4px; left: 50%; width: 32px; height: 4px; margin-left: -16px; border-radius: 2px; background: #d6d3d1; }
.dock-grip:hover::after { background: #a8a29e; }
.dock:not(:has(.dock-panel:not([hidden]))) .dock-grip { display: none; }
.dock.is-large { --dock-stage: min(66vh, 640px); }
.dock:has(.dock-playlist:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; }
.dock-top { grid-column: 1; grid-row: 1; padding-top: 12px; }
.dock-top:not(:has(> :not([hidden]))) { display: none; }
/* The playlist is its own panel down the right side. A long list scrolls. */
.dock-playlist { grid-column: 2; grid-row: 1 / -1; width: 208px; margin: 0; padding: 8px 0 8px 16px; border-left: 0.5px solid #d6d3d1; overflow-y: auto; list-style: none; }
.dock-playlist[hidden] { display: none; }
.dock-item { display: block; width: 100%; min-height: 24px; padding: 3px 8px; border: 0; border-radius: 4px; background: none; color: #4e4e4e; font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.dock-item:hover { background: #e2e0dd; }
.dock-num { margin-right: 8px; color: #777169; font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 400; }
.dock-new { margin-left: 8px; padding: 0 4px; border-radius: 2px; background: #a7e5d3; color: #0c0a09; font-weight: 500; }
.dock-item[aria-current='true'] { background: #fff; color: #0c0a09; font-weight: 500; }
.dock-scenario { grid-column: 1; grid-row: 2; margin: 0; padding-top: 8px; color: #4e4e4e; }
.dock-scenario strong { color: #0c0a09; font-weight: 500; }
.dock-bar { grid-column: 1; grid-row: 3; display: flex; align-items: center; gap: 16px; min-height: 72px; padding-top: 8px; padding-bottom: 8px; }
.dock-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: #292524;
  color: #fff;
  cursor: pointer;
}
.dock-play:hover { opacity: 0.85; }
.dock-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: #777169;
  cursor: pointer;
}
.dock-close:hover { background: #e2e0dd; color: #0c0a09; }
.dock-play .i-pause, .dock-play[aria-pressed='true'] .i-play { display: none; }
.dock-play[aria-pressed='true'] .i-pause { display: inline; }
.dock-meta { flex: none; width: 152px; }
.dock-name { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-time { display: block; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; font-variant-numeric: tabular-nums; color: #777169; }

/* One row per speaker: an on/off switch beside that speaker's waveform. */
.dock-speakers { flex: 1; min-width: 0; align-self: stretch; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-auto-rows: 1fr; gap: 4px 12px; align-items: center; }
.dock-speaker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 0 8px;
  border: 0.5px solid #d6d3d1;
  border-radius: 4px;
  background: #fff;
  color: #292524;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.dock-speaker[aria-pressed='false'] { background: transparent; color: #777169; }
.dock-ch { width: 8px; font-family: 'JetBrains Mono', ui-monospace, monospace; color: #777169; }
/* The waveforms fill whatever height the playlist gives the player. */
.dock-waves { position: relative; grid-column: 2; grid-row: 1 / span var(--dock-rows, 2); align-self: stretch; display: grid; grid-auto-rows: 1fr; gap: 4px; }
.dock-wave { position: relative; min-height: 24px; }
.dock-wave.is-off { opacity: 0.25; }
.dock-wave svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dock-wave path { fill: none; stroke: #c9c5c0; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.dock-wave .played { clip-path: inset(0 calc(100% - var(--dock-progress, 0%)) 0 0); }
.dock-wave .played path { stroke: #292524; }
/* Turn-taking labels: a colored band under each waveform and a list in time order. */
.has-labels .dock-wave svg { height: calc(100% - 5px); }
.dock-band { position: absolute; bottom: 0; height: 3px; min-width: 2px; border-radius: 1px; }
/* Turn-taking label tags: [group | label], here and on the store page. Radix Colors, light: 3 fill, 6 border, 9 dot, 11 text. */
.g-turn { --c3: #f1f0ef; --c6: #dad9d6; --c9: #8d8d86; --c11: #63635e; }
.g-int { --c3: #feebe7; --c6: #fdbdaf; --c9: #e54d2e; --c11: #d13415; }
.g-try { --c3: #fff7c2; --c6: #f3d673; --c9: #ffc53d; --c11: #ab6400; }
.g-bc { --c3: #e6f4fe; --c6: #acd8fc; --c9: #0090ff; --c11: #0d74ce; }
.g-oth { --c3: #f4f0fe; --c6: #d4cafe; --c9: #6e56cf; --c11: #6550b9; }
.dock-band { background: var(--c6); }
.tl-tag { display: inline-flex; vertical-align: middle; border: 0.5px solid var(--c6); border-radius: 4px; overflow: hidden; font-size: 12px; line-height: 20px; white-space: nowrap; }
.tl-g { padding: 0 6px; background: var(--c3); color: var(--c11); font-weight: 500; }
.tl-s { padding: 0 6px; background: #fff; color: #0c0a09; border-left: 0.5px solid var(--c6); }
.dock-labels { position: relative; max-height: var(--dock-stage); overflow-y: auto; padding: 4px; border-radius: 4px; background: #fff; }
.dock-label {
  display: grid;
  grid-template-columns: 32px 64px auto minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 4px 8px;
  border: 0;
  border-radius: 2px;
  background: none;
  color: #4e4e4e;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.dock-label:hover { background: #fafaf9; }
.dock-label.is-active { background: #f0efed; color: #0c0a09; }
.dock-label-time { font-family: 'JetBrains Mono', ui-monospace, monospace; color: #777169; }
.dock-label-who { color: #777169; white-space: nowrap; }
.dock-room { height: var(--dock-stage); overflow: hidden; border-radius: 4px; background: #fff; cursor: grab; }
.dock-room canvas { display: block; }
.is-script .dock-label { grid-template-columns: 32px 88px minmax(0, 1fr); }
.off-0 [data-s='0'], .off-1 [data-s='1'] { opacity: 0.35; }
.dock-seek { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.dock-waves:has(.dock-seek:focus-visible) { outline: 2px solid #0c0a09; outline-offset: 2px; }

.dock-text {
  flex: none;
  height: 32px;
  padding: 0 12px;
  border: 0.5px solid #d6d3d1;
  border-radius: 4px;
  background: #fff;
  color: #292524;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.dock-text:hover { background: #fafaf9; }
.dock :focus-visible { outline: 2px solid #0c0a09; outline-offset: 2px; }

.dock-panel { flex: 1; min-width: 0; }
.dock-panel[hidden] { display: none; }

/* Video call: two equal camera tiles sized from the available height. */
.dock-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-width: calc(var(--dock-stage) * 16 / 9 * 2 + 8px);
  margin: 0 auto;
}
.dock-tile { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 4px; background: #0c0a09; }
.dock-tile video { display: block; width: 100%; height: 100%; object-fit: cover; }
.dock-tile.is-off video { opacity: 0.35; }
.dock-tile span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(12, 10, 9, 0.72);
  color: #fff;
  font-size: 12px;
}

/* Task screen: what each speaker could see, rebuilt at the playhead. */
.dock-stage {
  --ink: #0c0a09;
  --ink-2: #4e4e4e;
  --ink-3: #777169;
  --rule: #e7e5e4;
  --rule-strong: #d6d3d1;
  --surface: #ffffff;
  --surface-strong: #f0efed;
  --bg: #fafaf9;
  --bg-2: #fafaf9;
  --accent: #292524;
  --lavender: #c8b8e0;
  --serif: 'Newsreader', 'Times New Roman', serif;
  --sans: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  max-height: var(--dock-stage);
  overflow-y: auto;
  border-radius: 4px;
  background: #fff;
}
.dock-stage .stage { margin: 0; padding: 12px; border: 0; border-radius: 0; }
/* Fit each speaker's view inside the panel instead of scrolling a tall board.
   The frame shrinks with a raster image, so percentage-placed markers stay on
   target. SVG stimuli have no intrinsic size, so they get an explicit height. */
.dock .dock-stage .stage__frame { width: fit-content; max-width: 100%; margin: 0 auto; }
.dock .dock-stage .stage__frame img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(var(--dock-stage) - 72px);
  object-fit: fill;
}
.dock .dock-stage .stage__frame img[src$='.svg'] {
  height: calc(var(--dock-stage) - 72px);
  object-fit: contain;
}
.dock .dock-stage .stage__canvas svg,
.dock .dock-stage .stage__board svg { max-height: calc(var(--dock-stage) - 72px); }
/* A larger view also uses the full window width. */
.dock.is-large { padding-inline: 32px; }
.dock-message { padding: 16px; color: #777169; }

/* The list takes the player's height and never sets it. 92px shows half of a fourth row, a sign that the list scrolls. */
@media (min-width: 1101px) {
  .dock:has(.dock-playlist:not([hidden])) { min-height: 92px; }
  .dock-playlist { height: 0; min-height: 100%; }
}

/* Below this the waveforms need the width, so the playlist becomes one scrolling row on top. */
@media (max-width: 1100px) {
  .dock, .dock:has(.dock-playlist:not([hidden])) { display: flex; flex-direction: column; }
  .dock-playlist { order: -1; display: flex; gap: 4px; width: auto; padding: 12px 0 0; border-left: 0; overflow-x: auto; overflow-y: hidden; }
  .dock-item { width: max-content; min-height: 32px; padding: 4px 8px; white-space: nowrap; }
}

@media (max-width: 720px) {
  .dock { --dock-stage: 34vh; padding-inline: 20px; }
  .dock.is-large { --dock-stage: 62vh; padding-inline: 20px; }
  /* The controls come first, so the close button stays in the top right corner. */
  .dock-bar { order: -3; }
  .dock-playlist { order: -2; padding: 0 0 8px; }
  .dock-scenario { order: -1; padding: 0 0 8px; }
  .dock-top { padding: 0 0 12px; }
  .dock-close { position: static; width: 32px; height: 32px; }
  /* One row until something plays. */
  .dock.is-idle .dock-top, .dock.is-idle .dock-playlist, .dock.is-idle .dock-scenario, .dock.is-idle .dock-speakers, .dock.is-idle .dock-toggle { display: none; }
  .dock.is-idle .dock-bar { min-height: 56px; }
  .dock-bar { flex-wrap: wrap; gap: 8px 12px; }
  .dock-meta { flex: 1; width: auto; min-width: 0; }
  .dock-speakers { order: 1; flex-basis: 100%; }
  .dock-expand, .dock-noun { display: none; }
  .dock-label { grid-template-columns: 32px minmax(0, 1fr); gap: 0 8px; }
  .dock-label-who { grid-column: 2; }
  .dock-label .tl-tag { grid-column: 2; justify-self: start; }
  .dock-label-text { grid-column: 2; }
}
