/* The board's own chrome: the top bar, rows of live phones, the kit grid, research, notes and
 * Play the flow. It has its own neutral palette, separate from the app's tokens, so the board
 * never competes with the screens on it. */

:root {
  --b-bg: #ebeae6;
  --b-surface: #f4f3f0;
  --b-raised: #fbfbf9;
  --b-ink: #151513;
  --b-text: #2a2926;
  --b-muted: #6f6c66;
  --b-quiet: #94918a;
  --b-line: rgba(25, 24, 22, 0.11);
  --b-accent: #1d6b5a;
  --b-accent-soft: rgba(29, 107, 90, 0.1);
  --b-button: #151513;
  --b-button-ink: #fbfbf9;
  --b-shadow: 0 1px 2px rgba(20, 20, 18, 0.06), 0 18px 40px -24px rgba(20, 20, 18, 0.3);
  --b-scrim: rgba(18, 18, 16, 0.5);
  --s: 0.6;
  --ps: 1;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --b-bg: #0f0f0e; --b-surface: #181816; --b-raised: #22221f; --b-ink: #f2f0ea; --b-text: #dedbd3;
    --b-muted: #a19e96; --b-quiet: #7f7c75; --b-line: rgba(240, 238, 232, 0.11); --b-accent: #5fc2a6;
    --b-accent-soft: rgba(95, 194, 166, 0.14); --b-button: #f2f0ea; --b-button-ink: #151513;
    --b-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 22px 44px -24px rgba(0, 0, 0, 0.8); --b-scrim: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --b-bg: #0f0f0e; --b-surface: #181816; --b-raised: #22221f; --b-ink: #f2f0ea; --b-text: #dedbd3;
  --b-muted: #a19e96; --b-quiet: #7f7c75; --b-line: rgba(240, 238, 232, 0.11); --b-accent: #5fc2a6;
  --b-accent-soft: rgba(95, 194, 166, 0.14); --b-button: #f2f0ea; --b-button-ink: #151513;
  --b-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 22px 44px -24px rgba(0, 0, 0, 0.8); --b-scrim: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
html, body { background: var(--b-bg); color: var(--b-text); }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body.has-player { overflow: hidden; }
#board button { font: inherit; cursor: pointer; }
.row-controls { display: flex; align-items: center; gap: 8px; }
.row-arrow { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--b-line); background: var(--b-surface); color: var(--b-ink); }
.row-arrow:disabled { opacity: .3; cursor: default !important; }
.row-scroll:focus-visible { outline: 2px solid var(--b-accent); outline-offset: 6px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; }
.empty { margin: 8px 24px; color: var(--b-muted); }
.note { display: flex; flex-direction: column; gap: 12px; min-width: min(420px, 80vw); }
.note h3 { margin: 0; font-size: 15px; color: var(--b-ink); }
.note textarea { width: 100%; box-sizing: border-box; padding: 12px; border-radius: 12px; border: 1px solid var(--b-line); background: var(--b-surface); color: var(--b-ink); font: inherit; resize: vertical; }
.note-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ph-error { position: absolute; inset: 40% 20px auto; padding: 12px; border-radius: 12px; background: #fde8e6; color: #8a1c14; font: 12px/1.4 ui-monospace, monospace; }

/* ------------------------------------------------------------------ the top bar */

.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 40;
  background: var(--b-bg);
  border-bottom: 1px solid var(--b-line);
}
.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 12px 24px 6px;
}
.top-row.is-sub {
  padding: 4px 24px 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand strong {
  display: block;
  color: var(--b-ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand span {
  display: block;
  color: var(--b-muted);
  font-size: 12px;
}
.top-actions,
.top-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.top-controls {
  flex: none;
}
.tabs {
  flex: 1 1 auto;
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--b-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background-color 140ms ease, color 140ms ease;
}
.tab small {
  font-size: 11px;
  color: var(--b-quiet);
  font-variant-numeric: tabular-nums;
}
.tab:hover {
  color: var(--b-ink);
}
.tab.is-on {
  background: var(--b-raised);
  color: var(--b-ink);
  box-shadow: 0 0 0 1px var(--b-line);
}
.counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--b-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.counter b {
  color: var(--b-ink);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.counter i {
  display: block;
  width: 28px;
  height: 1px;
  background: var(--b-line);
}
.bseg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--b-surface);
  box-shadow: inset 0 0 0 1px var(--b-line);
}
.bseg button {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--b-muted);
  font-size: 12.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.bseg button[aria-pressed="true"] {
  background: var(--b-raised);
  color: var(--b-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.play,
.ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1), background-color 140ms ease;
}
.play {
  background: var(--b-button);
  color: var(--b-button-ink);
}
.play:hover {
  background: #d99a55;
}
.ghost {
  background: var(--b-raised);
  color: var(--b-ink);
  box-shadow: inset 0 0 0 1px var(--b-line);
}
.ghost.is-small {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 500;
}
.play:active,
.ghost:active {
  transform: scale(0.97);
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: var(--b-raised);
  color: var(--b-ink);
  box-shadow: inset 0 0 0 1px var(--b-line);
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
:is(.play, .ghost, .icon-btn, .tab, .bseg button, .ref-img):focus-visible {
  outline: 2px solid var(--b-accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ the rows  */

.rows {
  max-width: 1600px;
  margin: 0 auto;
  padding: 8px 0 80px;
}
.sec {
  padding-top: 28px;
  scroll-margin-top: 104px;
}
.sec[hidden] {
  display: none;
}
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px 12px;
}
.sec-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.sec-head h2 {
  margin: 0;
  color: var(--b-ink);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
  white-space: nowrap;
}
.sec-range {
  color: var(--b-quiet);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sec-about {
  align-self: center;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--b-quiet);
}
.sec-about:hover,
.sec-about[aria-expanded="true"] {
  background: var(--b-raised);
  color: var(--b-ink);
}
.sec-intent {
  margin: -4px 24px 14px;
  max-width: 70ch;
  color: var(--b-muted);
  font-size: 13px;
  line-height: 1.55;
}
.row-controls .row-arrow {
  width: 36px;
  height: 36px;
}
.row-controls .moment-filter {
  min-height: 36px;
  border-radius: 10px;
  font-size: 13px;
}
.row-scroll {
  display: flex;
  gap: 26px;
  overflow-x: auto;
  padding: 4px 24px 14px;
  scroll-snap-type: x proximity;
  scroll-padding: 0 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--b-line) transparent;
}

/* A card: a small tool bar, the phone, one line. Everything else is one tap away. */
.card {
  flex: none;
  position: relative;
  width: calc(390px * var(--s));
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card[hidden] {
  display: none;
}
.card-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 32px;
}
.card-n {
  padding-left: 4px;
  color: var(--b-quiet);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.card-tools {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border-radius: 999px;
  background: var(--b-surface);
  box-shadow: inset 0 0 0 1px var(--b-line);
}
.tbtn {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--b-muted);
  transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1), background-color 140ms ease, color 140ms ease;
}
.tbtn:hover {
  background: var(--b-raised);
  color: var(--b-ink);
}
.tbtn:active {
  transform: scale(0.9);
}
.tbtn.is-pick {
  color: var(--b-accent);
}
.tbtn.is-pick[aria-pressed="true"] {
  background: var(--b-accent);
  color: var(--b-button-ink);
}
.tbtn.is-info[aria-pressed="true"] {
  background: var(--b-ink);
  color: var(--b-bg);
}
.tbtn.has-note::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--b-accent);
}
body.is-readonly .tbtn.is-pick,
body.is-readonly .tbtn.is-note {
  display: none;
}
.stage-wrap {
  position: relative;
}
.stage {
  position: relative;
  width: calc(390px * var(--s));
  height: calc(844px * var(--s));
  border-radius: calc(54px * var(--s));
  overflow: hidden;
  background: var(--b-surface);
  box-shadow: var(--b-shadow), 0 0 0 1px var(--b-line);
  isolation: isolate;
}
.stage-fit {
  position: absolute;
  left: 0;
  top: 0;
  width: 390px;
  height: 844px;
  transform: scale(var(--s));
  transform-origin: 0 0;
}
.stage-fit > .ph {
  position: absolute;
  left: 0;
  top: 0;
}
.card.is-picked .stage,
.card.is-lab .stage {
  box-shadow: var(--b-shadow), 0 0 0 2px var(--b-accent);
}
/* What the screen is for, over the phone's lower half; a tap closes it. */
.card-info {
  position: absolute;
  z-index: 4;
  left: 8px;
  right: 8px;
  bottom: 8px;
  max-height: calc(100% - 16px);
  overflow: auto;
  padding: 14px 16px;
  border-radius: calc(36px * var(--s)) calc(36px * var(--s)) calc(46px * var(--s)) calc(46px * var(--s));
  background: var(--b-raised);
  box-shadow: 0 0 0 1px var(--b-line), 0 18px 40px -20px rgba(40, 22, 8, 0.5);
  color: var(--b-text);
  font-size: 12.5px;
  line-height: 1.5;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
  transition: opacity 200ms ease, transform 320ms cubic-bezier(0.23, 1, 0.32, 1);
}
.card.is-info .card-info {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.card-info strong {
  display: block;
  margin-bottom: 4px;
  color: var(--b-ink);
  font-size: 13.5px;
  font-weight: 600;
}
.card-info p {
  margin: 0;
}
.card-note {
  margin: 10px 0 0 !important;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--b-accent-soft);
  white-space: pre-wrap;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 4px;
}
.card-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--b-ink);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.card-badge {
  flex: none;
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--b-accent-soft);
  color: var(--b-accent);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
/* A haptic shows in the bar beside the number, never over the phone. */
.card-haptic {
  position: absolute;
  left: 30px;
  top: 7px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  background: var(--b-ink);
  color: var(--b-bg);
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.card-haptic.is-on {
  animation: b-haptic 1100ms cubic-bezier(0.23, 1, 0.32, 1);
}
@keyframes b-haptic {
  0% { opacity: 0; transform: translateX(-4px); }
  14%, 70% { opacity: 0.92; transform: none; }
  100% { opacity: 0; }
}
.card-toast {
  position: absolute;
  left: 4px;
  bottom: -18px;
  color: var(--b-accent);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
}
.card-toast.is-on {
  animation: b-toast 2400ms ease;
}
@keyframes b-toast {
  0% { opacity: 0; transform: translateY(-3px); }
  10%, 75% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

/* Research: its own view, grouped by the row it informed. */
.research-view .sec-head {
  padding-bottom: 4px;
}
.research-group {
  padding: 18px 24px 8px;
  scroll-margin-top: 104px;
}
.research-group h3 {
  margin: 0 0 12px;
  color: var(--b-ink);
  font-size: 14px;
  font-weight: 600;
}
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.ref {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ref-img {
  display: block;
  height: 170px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #151110;
  box-shadow: 0 0 0 1px var(--b-line);
}
.ref-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1);
}
.ref-img:hover img {
  transform: scale(1.03);
}
.ref figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--b-muted);
}
.ref figcaption strong {
  color: var(--b-ink);
  font-weight: 600;
}

/* The top bar: brand, the four views, the controls. */
.views {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--b-surface);
  box-shadow: inset 0 0 0 1px var(--b-line);
}
.view {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--b-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background-color 160ms ease, color 160ms ease;
}
.view:hover {
  color: var(--b-ink);
}
.view[aria-selected="true"] {
  background: var(--b-ink);
  color: var(--b-bg);
}
.ghost.is-icon {
  width: 36px;
  padding: 0;
  justify-content: center;
}
.tabs[hidden] {
  display: none;
}
.top-row.is-sub:has(.tabs[hidden]) {
  display: none;
}
:is(.tbtn, .view, .sec-about):focus-visible {
  outline: 2px solid var(--b-accent);
  outline-offset: 2px;
}
@media (max-width: 1100px) {
  .top-actions .bseg {
    display: none;
  }
}
@media (max-width: 760px) {
  .top-row {
    flex-wrap: wrap;
  }
  .views {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }
}
.foot {
  max-width: 820px;
  padding: 48px 24px 0;
  color: var(--b-muted);
  font-size: 13px;
}
.foot p {
  margin: 0 0 6px;
}
.muted {
  color: var(--b-muted);
}

/* ------------------------------------------------------------------ modal, note, lightbox, toast */

.modal {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--b-scrim);
  animation: b-fade 200ms ease;
}
.modal.is-leaving {
  animation: b-fade-out 160ms ease forwards;
}
@keyframes b-fade { from { opacity: 0; } }
@keyframes b-fade-out { to { opacity: 0; } }
.modal-card {
  width: min(520px, 100%);
  max-height: calc(100% - 32px);
  overflow: auto;
  border-radius: 22px;
  background: var(--b-raised);
  color: var(--b-text);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.5);
  animation: b-rise 260ms cubic-bezier(0.23, 1, 0.32, 1);
}
.modal.is-light .modal-card {
  width: min(1400px, 100%);
}
@keyframes b-rise { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.note-sheet {
  padding: 22px;
}
.note-sheet h3 {
  margin: 0;
  color: var(--b-ink);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.note-sheet p {
  margin: 4px 0 12px;
  font-size: 13px;
}
.note-sheet textarea {
  resize: vertical;
  min-height: 120px;
  font-size: 14px;
}
.note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.lightbox {
  margin: 0;
  padding: 14px;
}
.lightbox img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: #151110;
}
.lightbox figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 4px 2px;
  font-size: 13.5px;
  color: var(--b-muted);
}
.lightbox figcaption strong {
  color: var(--b-ink);
}
.flash {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #1c1714;
  color: #fff3e2;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 260ms cubic-bezier(0.23, 1, 0.32, 1);
}
.flash.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.ph-error {
  position: absolute;
  inset: 80px 20px auto;
  padding: 12px;
  border-radius: 12px;
  background: #fde8e7;
  color: #8a1c17;
  font: 12px/1.4 ui-monospace, monospace;
}

/* ------------------------------------------------------------------ one phone, real size */

body.is-solo {
  background: var(--b-bg);
}
.solo {
  position: relative;
  width: 390px;
  height: 844px;
  overflow: hidden;
}
.solo > .ph {
  position: absolute;
  left: 0;
  top: 0;
}
body.is-solo .player-haptic {
  position: fixed;
  left: 195px;
  bottom: 40px;
}

/* ------------------------------------------------------------------ Play the flow */

.player {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--b-bg);
  animation: b-fade 220ms ease;
}
.player-frame {
  position: relative;
  width: calc(390px * var(--ps));
  height: calc(844px * var(--ps));
  border-radius: calc(54px * var(--ps));
  overflow: hidden;
  box-shadow: var(--b-shadow), 0 0 0 1px var(--b-line);
  background: var(--b-surface);
}
.player-stage {
  position: absolute;
  inset: 0;
}
.player-fit {
  position: absolute;
  left: 0;
  top: 0;
  width: 390px;
  height: 844px;
  transform: scale(var(--ps));
  transform-origin: 0 0;
}
.player-fit > .ph {
  position: absolute;
  left: 0;
  top: 0;
}
.player-haptic {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 5;
  transform: translate(-50%, 6px);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(20, 14, 10, 0.78);
  color: #fff3e2;
  font-size: 11px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
}
.player-haptic.is-on {
  animation: b-haptic 1100ms cubic-bezier(0.23, 1, 0.32, 1);
}
.player-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(560px, calc(100% - 32px));
}
.player-label {
  min-width: 0;
  flex: 0 1 auto;
  color: var(--b-ink);
  font-size: 13.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-gap {
  flex: 1;
}

/* ------------------------------------------------------------------ phone width */

@media (max-width: 640px) {
  .top-row {
    padding: 10px 16px 4px;
  }
  .top-row.is-sub {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 4px 16px 10px;
  }
  .top-controls {
    justify-content: space-between;
    flex-wrap: nowrap;
  }
  .counter {
    display: none;
  }
  .bseg button {
    padding: 0 9px;
  }
  .top-actions .ghost {
    display: none;
  }
  .counter i {
    width: 16px;
  }
  .lead {
    padding: 28px 16px 4px;
  }
  .sec-head {
    padding: 0 16px 12px;
  }
  .sec-head .ghost {
    display: none;
  }
  .row-scroll {
    gap: 16px;
    padding: 6px 16px 16px;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
  }
  .research {
    margin: 4px 16px 0;
  }
  .ref {
    width: 240px;
  }
  .lab {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    height: 62vh;
    animation-name: b-sheet-in;
  }
  @keyframes b-sheet-in {
    from { opacity: 0; transform: translateY(40px); }
  }
  body.has-lab .rows {
    padding-right: 0;
    padding-bottom: 64vh;
  }
  .player {
    gap: 0;
    justify-content: flex-start;
  }
  .player-frame {
    border-radius: 0;
    box-shadow: none;
  }
  .player-bar {
    position: fixed;
    left: 50%;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: auto;
    padding: 4px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--b-raised) 82%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 0 0 1px var(--b-line), 0 8px 24px rgba(0, 0, 0, 0.18);
    opacity: 0.25;
    transition: opacity 200ms ease;
  }
  .player-bar:hover,
  .player-bar:focus-within {
    opacity: 1;
  }
  .player-label,
  .player-gap {
    display: none;
  }
  .player-bar .icon-btn {
    width: 34px;
    height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lab,
  .modal,
  .modal-card,
  .player {
    animation: none;
  }
}

/* ------------------------------------------------------------------ the hero card, the kit, the moments */

/* Each row leads with its whole part: the same size as the screens, marked by an outline. */
.card.is-hero .stage {
  outline: 2px solid var(--b-accent);
  outline-offset: 5px;
}
.card.is-hero .card-title strong {
  font-weight: 600;
}
.card.is-hero .card-title::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent var(--b-accent);
}
.row-arrows {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.row-scroll[hidden] {
  display: none;
}

/* The kit: live tiles in a grid, three groups, before any screen. */
.kit-view {
  padding-top: 12px;
}
.kit-group {
  padding-top: 22px;
  scroll-margin-top: 104px;
}
.kit-group .sec-head {
  padding-bottom: 2px;
}
.kit-line {
  margin: 0 24px 14px;
  color: var(--b-muted);
  font-size: 13px;
}
.kit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, calc(390px * var(--s-tile, 0.56)));
  gap: 22px 26px;
  padding: 0 24px 8px;
}
.card.is-tile {
  --s: var(--s-tile, 0.56);
}
.card.is-tile .stage {
  height: calc(720px * var(--s));
  border-radius: 22px;
}
.card.is-tile .ph-status,
.card.is-tile .ph-island,
.card.is-tile .ph-home {
  display: none;
}
.card.is-tile .ph-body {
  padding-top: 26px;
}

/* The transitions: one row per moment. */
.moment {
  padding-top: 10px;
}
.moment-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 10px;
}
.moment-head h3 {
  margin: 0;
  color: var(--b-ink);
  font-size: 15px;
  font-weight: 600;
}
.moment-head .row-controls {
  margin-left: auto;
}
.moment .row-arrow {
  width: 32px;
  height: 32px;
}
/* On the smaller cards the haptic chip is just its glyph, so it never runs into the tools. */
.sec[data-view="screens"] .card:not(.is-hero) .card-haptic,
.moment .card .card-haptic {
  font-size: 0;
  gap: 0;
  padding: 4px;
}
