/*
 * The setup screen every level-based activity opens on. Uses the tokens in /activity-theme.css. It is an adult
 * surface (ABA-206): `ToolSetup` puts `.aba-adult` on it, which points those tokens at the adult palette, and the
 * learner's pictures on it keep their own colors (level pictures, the board previews, Token Board's stage).
 */
.ts-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  align-items: safe center;
  overflow-y: auto;
  padding:
    max(var(--pad), env(safe-area-inset-top))
    max(var(--pad), env(safe-area-inset-right))
    max(var(--pad), env(safe-area-inset-bottom))
    max(var(--pad), env(safe-area-inset-left));
  background:
    radial-gradient(ellipse at 50% 18%, var(--glow) 0 30%, transparent 70%),
    var(--ivory);
  color: var(--ink);
  font-family: var(--font);
}

.ts-card {
  display: grid;
  gap: 14px;
  width: min(100%, 720px);
  padding: clamp(20px, 4vmin, 36px);
  border: 4px solid var(--panel-line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--panel-ledge);
  text-align: center;
}

.ts-card[data-wide] {
  width: min(100%, 960px);
}

.ts-card h1 {
  margin: 0;
  font-size: clamp(32px, 5.4vmin, 48px);
  font-weight: 700;
  line-height: 1.1;
}

.ts-intro {
  margin: 0 auto;
  max-width: 44ch;
  color: var(--muted);
  font-size: 17px;
  font-weight: 400;
}

.ts-card h2 {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);

}

.ts-options {
  /* Equal columns (--cols, set per group), with a short last row centered instead of left-aligned. */
  --gap: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap);
}

.ts-options button {
  flex: 0 0 calc((100% - (var(--cols, 3) - 1) * var(--gap)) / var(--cols, 3));
}

@media (max-width: 540px) {
  .ts-options button { flex-basis: 100%; }
}

.ts-options button {
  min-height: 60px;
  padding: 10px 14px;
  border: 2px solid var(--card-line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.ts-options button[aria-checked="true"] {
  border-color: var(--prompt);
  background: var(--prompt-wash);
  box-shadow: inset 0 0 0 2px var(--prompt);
}

.ts-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  justify-self: center;
  min-width: 240px;
  min-height: 88px;
  margin-top: 12px;
  padding: 0 48px 0 38px;
  border: 0;
  border-radius: 999px;
  background: var(--prompt);
  box-shadow: 0 8px 0 var(--prompt-deep);
  color: var(--on-prompt);
  font: inherit;
  font-size: clamp(28px, 4.4vmin, 40px);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.ts-play svg {
  width: 36px;
  height: 36px;
  fill: currentColor;
}

.ts-play:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 var(--prompt-deep);
}

.ts-options button:focus-visible,
.ts-play:focus-visible {
  outline: 6px solid var(--focus-ring, var(--gold-ring));
  outline-offset: 6px;
}

.ts-help {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

/*
 * The shared setup screen (ABA-161, design C): a scrolling column of the title, the learner, the
 * level cards, More settings, and Next time, over a Play bar that never moves. The classes above stay
 * for the setup screens that are not on ToolSetup yet (Say It, Token Board, Tiny Bites).
 */
.ts-setup {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background:
    radial-gradient(ellipse at 50% 18%, var(--glow) 0 30%, transparent 70%),
    var(--ivory);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

.ts-scroll {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding:
    max(18px, env(safe-area-inset-top))
    max(var(--pad), env(safe-area-inset-right))
    28px
    max(var(--pad), env(safe-area-inset-left));
}

.ts-body {
  display: grid;
  gap: 14px;
  justify-items: center;
  width: min(100%, 1000px);
  margin: 0 auto;
  text-align: center;
}

.ts-body > * {
  max-width: 100%;
}

.ts-head h1 {
  margin: 0;
  font-size: clamp(30px, 5vmin, 44px);
  font-weight: 700;
  line-height: 1.05;
}

.ts-setup .ts-intro {
  /* Wide enough for a 20-word intro on one line on an iPad in landscape. */
  max-width: 80ch;
  margin-top: 6px;
  font-size: 16.5px;
}

.ts-who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 400;
}

/* The Privacy policy link at the end of a standalone activity page's settings (ABA-245): an adult link, in the flow,
   so it never covers Play or the learner's screen. */
.ts-setup .ts-privacy {
  justify-self: center;
  padding: 6px 12px;
  color: var(--adult-link);
  font: 700 14.5px var(--font);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ts-setup .ts-privacy:focus-visible {
  outline: 6px solid var(--focus-ring, var(--gold-ring));
  outline-offset: 6px;
}

.ts-inspector .ts-privacy {
  justify-self: start;
  margin-top: 8px;
  padding-left: 0;
}

.ts-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  font-size: 17px;
  line-height: 1;
}

.ts-label,
.ts-body > h2 {
  margin: 4px 0 -4px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.ts-levels {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: clamp(12px, 2vmin, 18px);
  width: min(100%, calc(var(--cols, 3) * 236px));
  padding-bottom: 7px;
}

.ts-level {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 96px;
  padding: 12px;
  border: 4px solid var(--card-line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 7px 0 var(--card-ledge);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 110ms var(--ease-press), box-shadow 110ms var(--ease-press);
}

.ts-level[aria-checked="true"] {
  border-color: var(--prompt);
  background: var(--prompt-wash);
  box-shadow: 0 7px 0 var(--prompt-ledge), 0 0 0 4px color-mix(in srgb, var(--prompt) 22%, transparent);
}

.ts-level:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 var(--card-ledge);
}

.ts-level[aria-checked="true"]:active {
  box-shadow: 0 2px 0 var(--prompt-ledge), 0 0 0 4px color-mix(in srgb, var(--prompt) 22%, transparent);
}

/* The picture slot, for each tool's approved photos or drawings (ABA-161 step 3). */
.ts-level-picture {
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  background: var(--art-card);
}

/*
 * Cards with pictures (ABA-161 decision 14): all in one row on an iPad in landscape (up to six), so the help and More
 * settings stay on screen; rows of at most three under 760px; on a phone, each card is a row with its picture at the left.
 */
.ts-levels.ts-pictured .ts-level {
  align-content: start;
  padding: 9px 9px 11px;
}

.ts-levels.ts-pictured-many {
  gap: 14px;
  width: min(100%, calc(var(--cols) * 200px));
}

.ts-levels.ts-pictured-many .ts-level {
  border-radius: 20px;
  font-size: 15.5px;
}

@media (max-width: 760px) {
  .ts-levels.ts-pictured-many {
    width: min(100%, calc(var(--cols-narrow, 3) * 236px));
  }
}

@media (max-width: 540px) {
  .ts-levels.ts-pictured-many {
    gap: 12px;
    width: 100%;
  }

  .ts-levels.ts-pictured .ts-level {
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    align-content: center;
    gap: 12px;
    padding: 7px 12px 7px 7px;
    font-size: 17px;
    text-align: left;
  }
}

.ts-setup .ts-level-help {
  max-width: 66ch;
}

.ts-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
}

.ts-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-height: 52px;
  padding: 0 14px 0 18px;
  border: 2px solid var(--card-line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.ts-more[aria-expanded="true"] {
  border-color: var(--selected-line);
  background: var(--selected);
}

.ts-more-label {
  flex: none;
}

.ts-more-summary {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ts-chip {
  color: var(--prompt-text);
}

.ts-chevron {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 160ms var(--ease-press);
}

.ts-more[aria-expanded="true"] .ts-chevron {
  transform: rotate(180deg);
}

.ts-panel {
  width: min(100%, 760px);
  padding: 6px 24px;
  border: 4px solid var(--panel-line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--panel-ledge);
  text-align: left;
}

.ts-panel[hidden] {
  display: none;
}

.ts-next {
  padding: 8px 20px 16px;
}

.ts-next .rp-list {
  justify-items: start;
}

.ts-next .rp-list ul {
  justify-content: flex-start;
}

/* In the setup flow each choice is its own block; inside More settings it is one row. */
.ts-choice {
  display: contents;
}

.ts-panel .ts-choice {
  display: grid;
  grid-template-columns: minmax(0, 190px) minmax(0, 1fr);
  gap: 8px 18px;
  align-items: center;
  padding: 14px 0;
  border-top: 1.5px solid var(--row-line);
}

.ts-panel .ts-choice:first-child {
  border-top: 0;
}

.ts-panel .ts-choice > h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16.5px;
  font-weight: 700;
}

.ts-panel .ts-options {
  justify-content: flex-start;
  gap: 8px;
}

.ts-panel .ts-options button {
  flex: 0 1 auto;
  min-height: 48px;
  padding: 6px 16px;
  font-size: 16px;
}

.ts-panel .ts-choice > :not(h2) {
  grid-column: 2;
}

.ts-panel .ts-help {
  font-size: 14.5px;
  line-height: 1.4;
}

.ts-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding:
    10px
    max(var(--pad), env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(var(--pad), env(safe-area-inset-left));
  background: var(--ivory);
}

/* A short fade over the content that scrolls under the bar. */
.ts-bar::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 22px;
  background: linear-gradient(to top, var(--ivory), transparent);
  pointer-events: none;
}

.ts-bar-summary {
  display: -webkit-box;
  max-width: 520px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
  text-align: right;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ts-bar-summary b {
  color: var(--ink);
}

.ts-bar .ts-play {
  flex: none;
  min-width: 220px;
  min-height: 74px;
  margin: 0 0 8px;
  font-size: clamp(28px, 4.4vmin, 34px);
}

.ts-level:focus-visible,
.ts-more:focus-visible {
  outline: 6px solid var(--focus-ring, var(--gold-ring));
  outline-offset: 6px;
}

/* A narrow window or iPad portrait: at most three cards in a row. */
@media (max-width: 760px) {
  .ts-levels {
    grid-template-columns: repeat(var(--cols-narrow, 3), minmax(0, 1fr));
    width: min(100%, calc(var(--cols-narrow, 3) * 236px));
  }
}

/* A phone: one column of shorter cards, More settings as full-width rows, and Play across the bar. */
@media (max-width: 540px) {
  .ts-scroll {
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .ts-body {
    gap: 12px;
  }

  .ts-setup .ts-intro {
    font-size: 15px;
  }

  .ts-levels {
    grid-template-columns: 1fr;
    width: 100%;
    gap: 12px;
  }

  .ts-level {
    min-height: 60px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 17px;
  }

  .ts-row {
    display: grid;
    width: 100%;
    gap: 10px;
  }

  .ts-more {
    flex-wrap: wrap;
    width: 100%;
    padding: 10px 14px 10px 16px;
  }

  .ts-more-label {
    flex: 1;
  }

  .ts-more-summary {
    flex-basis: 100%;
    order: 3;
    white-space: normal;
  }

  .ts-panel {
    padding: 4px 16px;
  }

  .ts-panel .ts-choice {
    grid-template-columns: minmax(0, 1fr);
  }

  .ts-panel .ts-choice > :not(h2) {
    grid-column: 1;
  }

  .ts-panel .ts-options button {
    flex: 1 1 auto;
  }

  .ts-bar {
    flex-direction: column;
    gap: 8px;
    padding-top: 6px;
  }

  .ts-bar-summary {
    max-width: 100%;
    font-size: 13.5px;
    text-align: center;
  }

  /* The More settings row above already lists these; the bar keeps the learner and the level. */
  .ts-bar-settings {
    display: none;
  }

  .ts-bar .ts-play {
    width: 100%;
    min-width: 0;
    min-height: 64px;
  }
}

/* A phone on its side leaves the frame only about 310px tall: a smaller Play beside one line of summary. */
@media (orientation: landscape) and (max-height: 500px) {
  .ts-bar {
    padding-top: 6px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .ts-bar-summary {
    -webkit-line-clamp: 1;
  }

  .ts-bar .ts-play {
    min-width: 180px;
    min-height: 56px;
    margin-bottom: 6px;
    font-size: 26px;
  }

  .ts-bar .ts-play svg {
    width: 28px;
    height: 28px;
  }

  .ts-level {
    min-height: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ts-level,
  .ts-chevron {
    transition: none;
  }

  .ts-level:active,
  .ts-play:active {
    transform: none;
  }
}

/*
 * A board on the setup screen (ABA-161 decision 10, `SetupBoard`): Say It's board, My Way's button, and
 * Token Board's menus. The preview is the board, small, in a framed tap-card surface; a line about it and
 * Edit board sit under it. Edit board opens `.ts-editor`, a panel over the setup screen.
 */
.ts-board {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(100%, 470px);
}

.ts-board[data-small] {
  width: min(100%, 250px);
}

.ts-board-picture {
  display: contents;
}

.ts-board-frame {
  box-sizing: border-box;
  width: 100%;
  padding: 8px;
  border: 4px solid var(--card-line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 7px 0 var(--card-ledge);
  pointer-events: none;
}

.ts-board-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
}

.ts-board-line p {
  margin: 0;
}

.ts-board-line b {
  color: var(--ink);
}

/* A quiet adult button: Edit board, Hear. */
.ts-adult {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--control-fill);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.ts-adult svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--prompt);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ts-adult:focus-visible,
.ts-done:focus-visible {
  outline: 6px solid var(--focus-ring, var(--gold-ring));
  outline-offset: 6px;
}

/* A More settings row that is not a SetupChoice; its own radio group lays out its pictures. */
.ts-row-body {
  min-width: 0;
}

/* Its options can wrap to several lines, so its title stays at the top. */
.ts-panel .ts-row-choice {
  align-items: start;
}

.ts-panel .ts-row-choice > h2 {
  padding-top: 12px;
}

/* Edit board: a content panel over the setup screen, with the editor scrolling inside it. */
.ts-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding:
    max(var(--pad), env(safe-area-inset-top))
    max(var(--pad), env(safe-area-inset-right))
    max(var(--pad), env(safe-area-inset-bottom))
    max(var(--pad), env(safe-area-inset-left));
  background: var(--backdrop);
  color: var(--ink);
  font-family: var(--font);
}

.ts-editor {
  /* No transform here: the word picker inside is position: fixed to the whole screen. */
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(100%, 860px);
  max-height: calc(100dvh - 2 * max(var(--pad), 8px));
  border: 4px solid var(--panel-line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--panel-ledge);
}

.ts-editor-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 10px 24px;
  border-bottom: 1.5px solid var(--row-line);
}

.ts-editor-head h1 {
  flex: 1;
  margin: 0;
  font-size: clamp(22px, 3.4vmin, 28px);
  font-weight: 700;
}

.ts-done {
  min-width: 110px;
  min-height: 52px;
  margin-bottom: 5px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--prompt);
  box-shadow: 0 5px 0 var(--prompt-deep);
  color: var(--on-prompt);
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.ts-done:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--prompt-deep);
}

.ts-editor-body {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px clamp(16px, 3vmin, 28px) 24px;
  text-align: center;
}

.ts-editor-body h2 {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

/* Play is off, with the reason above it in the bar (Say It's grid that is too narrow for this screen). */
.ts-play:disabled {
  opacity: 0.45;
  cursor: default;
}

.ts-bar[data-note] {
  flex-wrap: wrap;
}

.ts-bar-note {
  flex-basis: 100%;
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
  text-align: center;
}

@media (max-width: 540px) {
  .ts-board-line {
    display: grid;
    justify-items: center;
  }

  .ts-editor-backdrop {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  }

  .ts-editor {
    border-radius: 22px;
  }

  .ts-editor-head {
    padding: 10px 12px 8px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ts-done:active {
    transform: none;
  }
}

/*
 * The wide setup: preview and inspector (ABA-200, option A of ABA-193 item 7). `ToolSetup` with a `preview`, in a
 * landscape window at least 960px wide and 600px tall (`WIDE_SETUP`): the stage at the left (about 58%), with the learner's real
 * screen at play scale, and a Paper inspector at the right (about 42%) that scrolls, with every setting open and Play
 * pinned at its bottom. The app's `SetupWide` is the same.
 */
.ts-setup.ts-wide {
  grid-template-columns: minmax(0, 58fr) minmax(0, 42fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 24px;
  padding:
    max(12px, env(safe-area-inset-top))
    max(var(--pad), env(safe-area-inset-right))
    max(calc(var(--pad) + 8px), env(safe-area-inset-bottom))
    max(var(--pad), env(safe-area-inset-left));
}

.ts-stage {
  display: grid;
  align-content: safe center;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 4px;
}

.ts-stage-label {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.ts-stage-menu {
  display: grid;
  gap: 10px;
}

.ts-stage-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ts-stage-menu h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.ts-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ts-chip-picture {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 5px;
  width: 86px;
  text-align: center;
}

.ts-chip-tile {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 2px solid var(--card-line);
  border-radius: 16px;
  background: var(--art-card);
  font-size: 36px;
  line-height: 1;
}

/* Two lines, also for a short name, so the pictures in a row line up. */
.ts-chip-name {
  min-height: 2.4em;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.ts-chip-detail {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.ts-chip-detail .tb-amount {
  justify-content: center;
}

.ts-inspector {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
  border: 4px solid var(--panel-line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--panel-ledge);
}

.ts-inspector-scroll {
  display: grid;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 22px 20px;
  text-align: left;
}

.ts-inspector .ts-head h1 {
  font-size: 30px;
}

.ts-inspector .ts-intro {
  max-width: none;
  margin: 6px 0 0;
  font-size: 15.5px;
}

.ts-inspector .ts-who {
  margin: 8px 0 10px;
}

/* Each row of the inspector: its title in ink above, then its options, under a rule. */
.ts-inspector-levels,
.ts-inspector .ts-choice {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1.5px solid var(--row-line);
}

.ts-inspector .ts-label,
.ts-inspector .ts-choice > h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16.5px;
  font-weight: 700;
}

.ts-inspector .ts-levels {
  grid-template-columns: repeat(auto-fill, 160px);
  justify-content: start;
  gap: 12px;
  width: 100%;
}

.ts-inspector .ts-levels .ts-level {
  border-radius: 20px;
  font-size: 15.5px;
}

.ts-inspector .ts-level-help,
.ts-inspector .ts-help {
  font-size: 15px;
  line-height: 1.4;
}

/* A choice is one segmented row, 52px tall: the chosen segment on the selected fill with a --prompt border (brown on the setup screen). */
.ts-inspector .ts-options {
  flex-wrap: nowrap;
  justify-content: stretch;
  gap: 0;
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.ts-inspector .ts-options button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  padding: 6px 12px;
  border: 0;
  border-left: 1.5px solid var(--line);
  border-radius: 0;
  font-size: 17px;
}

.ts-inspector .ts-options button:first-child {
  border-left: 0;
}

.ts-inspector .ts-options button[aria-checked="true"] {
  border-radius: 13px;
  background: var(--selected);
  box-shadow: inset 0 0 0 3px var(--prompt);
}

.ts-inspector .ts-options button:focus-visible {
  outline-offset: -6px;
}

.ts-inspector .ts-chip {
  justify-self: stretch;
  margin-top: 14px;
}

.ts-inspector .ts-next {
  width: 100%;
  margin-top: 10px;
}

/* Play at the bottom of the inspector, on paper under a rule, with the level in ink at the left. */
.ts-bar.ts-bar--inspector {
  justify-content: space-between;
  padding: 14px 20px 12px;
  border-top: 1.5px solid var(--row-line);
  background: var(--paper);
}

.ts-bar--inspector::before {
  display: none;
}

.ts-bar--inspector .ts-bar-summary {
  font-size: 17px;
  text-align: left;
}

.ts-bar--inspector .ts-play {
  min-width: 200px;
}
