/* The same solid, themed overlay protects text on every part of the artwork. */
.room-overlay,
.hero-bubble,
.brooke-dialogue,
.button.glass,
.icon-button.glass,
.stage-count,
.stage-rest,
.stage-chip,
.stage-bottom,
.stage-badge,
.watch-back,
.watch-fullscreen,
.watch-scene-label span,
.watch-scene-bottom,
.brooke-art-status,
.workout-stage.has-room .stage-badge,
.workout-stage.has-room .stage-topline .icon-button,
.workout-stage.has-room .stage-bottom,
.workout-stage.has-room .brooke-dialogue {
  background: var(--overlay-bg);
  color: var(--overlay-ink);
  border-color: var(--overlay-line);
  box-shadow: var(--room-shadow);
}
.workout-stage.has-room .brooke-dialogue .bubble-name,
.workout-stage.has-room .stage-topline .text-button { color: var(--green); }
.button.primary, .brand-mark { background: var(--green); color: var(--on-accent); }
.button.primary:hover { background: var(--green-dark); color: var(--on-accent); }
.button, .icon-button, .text-button, summary, .mode-switch button, .stage-tools .icon-button {
  min-height: 44px;
}
.icon-button, .stage-tools .icon-button { min-width: 44px; }
:where(button,a,input,select,textarea,summary):focus-visible { outline: 3px solid var(--focus); }
body:has(.room-shell), body:has(.room-immersive-shell), body:has(.welcome) { overflow: hidden; }
.room-shell {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  --room-small: 294px;
  --room-medium: 58dvh;
  --room-tall: calc(100dvh - max(238px, 11rem));
  --room-panel-width: 460px;
}
.room-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-image: linear-gradient(var(--room-shade), var(--room-shade)), var(--room);
  background-position: center 73%;
  background-size: cover;
}
.room-header {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 4;
  pointer-events: none;
}
.room-header > * { pointer-events: auto; }
.room-brand { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 12px 4px 5px; border-radius: 100px; font-size: .8rem; font-weight: 750; }
.room-brand .brand-mark { width: 36px; height: 36px; border-radius: 50%; font-size: 25px; }
.room-header-tools { display: flex; align-items: center; gap: 8px; }
.room-header-tools .offline-status { border-radius: 100px; padding: 8px 12px; }
.room-profile { width: 46px; height: 46px; border: 2px solid var(--overlay-bg); border-radius: 50%; display: grid; place-items: center; font-weight: 800; overflow: hidden; }
.room-profile img { width: 100%; height: 100%; object-fit: cover; }
.room-companion { position: absolute; top: 78px; bottom: calc(var(--room-small) + 16px); left: 41%; right: 1%; pointer-events: none; }
.room-bubble { position: absolute; left: 14px; top: 86px; width: calc(41% - 20px); max-width: 290px; padding: 12px 13px; border: 1px solid var(--overlay-line); border-radius: 18px 18px 5px 18px; font-size: .91rem; line-height: 1.42; overflow-wrap: anywhere; }
.room-bubble .bubble-name { font-size: .65rem; margin-bottom: 5px; }
.room-bubble p { margin: 0; }
.room-shell.no-dialogue .room-companion { left: 12%; right: 12%; }
.room-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  height: var(--room-small);
  max-height: calc(100dvh - 150px);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--overlay-line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  transition: height .24s ease, width .24s ease;
}
.room-panel[data-height='medium'] { height: var(--room-medium); }
.room-panel[data-height='tall'] { height: var(--room-tall); }
.room-panel-grip { display: flex; align-items: center; justify-content: space-between; flex: none; gap: 4px; min-height: 46px; padding: 2px 12px; border-bottom: 1px solid var(--line); touch-action: none; user-select: none; }
.room-height-toggle { position: relative; display: flex; flex: 1; gap: 8px; align-items: center; min-height: 44px; padding: 6px 8px; color: var(--muted); font-size: .72rem; font-weight: 750; text-align: left; touch-action: none; }
.room-height-toggle .icon { width: 15px; height: 15px; }
.room-height-toggle .icon:last-child { margin-left: auto; }
.room-panel[data-height='tall'] .room-height-toggle .icon:last-child { transform: rotate(180deg); }
.room-grip-bar { width: 24px; height: 4px; border-radius: 3px; background: var(--muted); }
.room-panel .room-panel-content { flex: 1; min-height: 0; width: 100%; max-width: none; margin: 0; padding: 16px 18px; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.room-panel-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); flex: none; padding: 4px 8px; border-top: 1px solid var(--line); background: var(--surface); }
.room-panel-nav a { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px; padding: 5px 2px; min-height: 50px; border-radius: 12px; font-size: .65rem; line-height: 1.25; text-align: center; color: var(--muted); }
.room-panel-nav a[aria-current] { background: var(--green-soft); color: var(--green); font-weight: 800; }
.room-panel-nav .icon { width: 19px; height: 19px; }
.room-panel-content .page-heading { margin: 0 0 18px; display: flex; gap: 12px; flex-wrap: wrap; }
.room-panel-content .page-heading h1 { font-size: 1.65rem; }
.room-panel-content .page-heading .brooke-note, .room-panel-content .brooke-note-face { display: none; }
.room-panel-content :is(.plans-grid,.settings-grid,.progress-grid,.cardio-grid,.library-grid,.more-grid,.two-column,.quick-layout) { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; }
.room-panel-content :is(.panel,.week-card) { padding: 16px; border-radius: 18px; box-shadow: none; }
.room-panel-content :is(.exercise-grid,.routine-grid,.stats-grid) { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.room-panel-content :is(.settings-main,.settings-side,.quick-main,.quick-side) { min-width: 0; }
.room-panel-content :is(.tabs,.filter-chips,.range-switch) { max-width: 100%; overflow-x: auto; }
.room-panel-content .activity-row { gap: 10px; }
.room-panel-content .activity-main { min-width: 0; overflow-wrap: anywhere; }
.room-panel-content .activity-main strong { white-space: normal; }
.room-resume { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 0 12px; color: var(--muted); font-size: .8rem; }
.room-today { display: grid; gap: 7px; }
.room-today-title { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.18; }
.room-today-detail { color: var(--muted); font-size: .8rem; }
.room-today .room-primary-action { width: 100%; min-height: 48px; }
.room-today-actions { display: flex; align-items: center; gap: 8px; }
.room-today-actions .room-primary-action { flex: 1; width: auto; }
.room-icon-action { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-2); }
.room-icon-action:hover { color: var(--green); border-color: var(--green); }
.room-today-actions .room-icon-action { width: 48px; min-height: 48px; }
.room-today .text-button { justify-self: center; min-height: 44px; }
.room-today .room-today-title + .room-today-detail { margin-top: 0; }
.room-alternatives,.room-exercise-list { display: grid; gap: 9px; margin-top: 12px; }
.room-choice { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-2); color: var(--ink); }
.room-choice > span:not(.icon) { flex: 1; min-width: 0; }
.room-choice strong,.room-choice small { display: block; }
.room-choice strong { font-size: .9rem; overflow-wrap: anywhere; }
.room-choice small { font-size: .75rem; line-height: 1.4; color: var(--muted); }
.room-choice:hover { border-color: var(--green); background: var(--green-soft); }
.room-week-summary { margin-bottom: 18px; font-size: .95rem; line-height: 1.55; }
.room-journal .week-card { margin: 0 0 18px; }
.room-journal-links { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 18px 0; }
.room-journal-links a { display: flex; justify-content: flex-start; align-items: center; gap: 8px; padding: 8px 10px; min-height: 44px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); font-size: .8rem; font-weight: 700; }
.room-journal-links a span { min-width: 0; overflow-wrap: anywhere; }
.room-recent h2 { font-size: 1.1rem; margin: 22px 0 10px; }
.room-search { display: grid; gap: 6px; margin: 14px 0; font-size: .8rem; font-weight: 700; }
.room-search input { width: 100%; min-width: 0; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--ink); background: var(--surface); }
.room-quick-amounts { display: grid; grid-template-columns: repeat(5,minmax(44px,1fr)); gap: 7px; margin: 18px 0; }
.room-quick-amounts button { padding: 8px 0; min-height: 50px; font-size: 1.15rem; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); font-weight: 800; }
.room-quick-amounts button.selected { background: var(--green); color: var(--on-accent); border-color: var(--green); }
.room-quick-footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.room-quick-footer .primary { flex: 1; }
.room-immersive-shell { display: block; }
.room-immersive-shell .main-column { margin: 0; width: 100%; }
.room-immersive-shell .page { padding: 0; margin: 0; max-width: none; }
.room-immersive-shell .pace-control input { min-height: 44px; }
/* Existing editors replace the panel; the room remains visible behind them. */
body:has(#modal-root dialog[open]) #room-panel { visibility: hidden; }
dialog.modal[open] { position: fixed; left: 0; right: 0; top: auto; bottom: 0; margin: 0; width: 100%; max-width: none; max-height: calc(100dvh - max(238px,11rem)); border-radius: 26px 26px 0 0; border: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: var(--room-shadow); }
dialog.modal::backdrop { background: transparent; backdrop-filter: none; }
.modal :is(button,.text-button,summary,input,select) { min-height: 44px; }
.modal .modal-body { overflow-wrap: anywhere; }
body:has(.room-shell) #toast { bottom: max(16px,env(safe-area-inset-bottom)); z-index: 1200; }
@media (min-width: 1001px) {
  .room-shell { --room-panel-width: 460px; --room-small: 286px; }
  .room-shell[data-panel-height='small'] { --room-panel-width: 390px; }
  .room-shell[data-panel-height='medium'] { --room-panel-width: 430px; }
  .room-scene { right: var(--room-panel-width); transition: right .24s ease; }
  .room-companion { top: 82px; bottom: 28px; left: 30%; right: 2%; }
  .room-shell.no-dialogue .room-companion { left: 10%; right: 10%; }
  .room-bubble { top: 110px; left: 28px; width: 27%; max-width: 280px; font-size: 1rem; padding: 17px 18px; }
  .room-header { right: calc(var(--room-panel-width) + 18px); }
  .room-panel, .room-panel[data-height='medium'], .room-panel[data-height='tall'] { left: auto; right: 0; top: 0; bottom: 0; height: 100%; width: var(--room-panel-width); max-height: none; border-radius: 0; border-top: 0; border-right: 0; padding-top: 12px; }
  .room-panel .room-panel-content { padding: 24px; }
  .room-panel[data-height='small'] .room-panel-content { display: flex; flex-direction: column; justify-content: center; }
  .room-panel-grip { padding: 4px 12px 10px; }
  .room-panel-nav { padding: 9px 8px 14px; }
  .room-today { gap: 14px; }
  .room-today-title { font-size: 2rem; }
  .room-today-detail { font-size: .9rem; }
  dialog.modal[open] { left: auto; right: 0; top: 0; bottom: 0; width: 460px; max-height: 100dvh; border-radius: 0; }
}
@media (max-width: 380px) {
  .room-shell { --room-small: 294px; }
  .room-panel .room-panel-content { padding: 12px 14px; }
  .room-panel-grip { padding-inline: 8px; }
  .room-height-toggle { gap: 5px; padding-inline: 3px; }
  .room-grip-bar { width: 16px; }
  .room-bubble { left: 10px; width: calc(41% - 15px); padding: 10px; font-size: .85rem; }
  .room-journal-links { grid-template-columns: minmax(0,1fr); }
  .room-panel-content :is(.exercise-grid,.routine-grid,.stats-grid) { grid-template-columns: minmax(0,1fr); }
}
@media (max-height: 540px) and (max-width: 1000px) {
  .room-shell { --room-small: 220px; --room-medium: 60dvh; --room-tall: calc(100dvh - 155px); }
  .room-bubble { top: 68px; font-size: .75rem; }
  .room-companion { top: 64px; }
  .room-panel { max-height: calc(100dvh - 120px); }
  dialog.modal[open] { max-height: calc(100dvh - 150px); }
}
@media (prefers-reduced-motion: reduce) {
  .room-panel,.room-scene { transition: none; }
}
/* Profile selection uses the same room and panel before a profile is selected. */
.welcome { position: fixed; inset: 0; display: block; width: 100%; height: 100dvh; min-height: 0; padding: 0; overflow: hidden; background: var(--bg); }
.welcome .welcome-stage { position: absolute; inset: 0; min-height: 0; height: auto; border-radius: 0; padding: 0; background-image: linear-gradient(var(--room-shade),var(--room-shade)),var(--room); background-size: cover; background-position: center 73%; }
.welcome .welcome-stage > .brand { position: absolute; top: 14px; left: 14px; background: var(--overlay-bg); color: var(--overlay-ink); border-radius: 30px; padding: 5px 14px 5px 5px; font-size: 16px; }
.welcome .welcome-character { position: absolute; top: 78px; bottom: 300px; left: 41%; right: 0; width: auto; height: auto; }
.welcome .welcome-bubble { position: absolute; top: 90px; left: 14px; right: auto; bottom: auto; transform: none; width: calc(41% - 20px); padding: 12px; }
.welcome .welcome-bubble .hero-line { font-size: 1rem; line-height: 1.4; }
.welcome .welcome-bubble p { font-size: .8rem; }
.welcome .welcome-form { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; width: 100%; max-width: none; max-height: 45dvh; overflow: auto; margin: 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 26px 26px 0 0; border: 1px solid var(--line); }
@media (min-width: 1001px) {
  .welcome .welcome-stage { right: 460px; }
  .welcome .welcome-character { top: 80px; bottom: 28px; left: 30%; right: 2%; }
  .welcome .welcome-bubble { top: 110px; left: 28px; width: 27%; }
  .welcome .welcome-form { left: auto; right: 0; top: 0; bottom: 0; width: 460px; max-height: none; border-radius: 0; display: flex; flex-direction: column; justify-content: center; padding: 32px; }
}
/* Confirmation choices are large taps; the full editor remains the Other path. */
.room-set-review { min-width: 0; }
.room-set-review h2 { font-size: 1rem; margin: 0 0 9px; }
.room-tap-choices { display: flex; flex-wrap: wrap; gap: 5px; }
.room-tap-choices button { flex: 1 0 44px; min-width: 44px; min-height: 48px; padding: 8px 5px; border-radius: 13px; font-weight: 800; font-size: 1.1rem; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.room-tap-choices button.target,.room-tap-choices button.selected,.room-tap-choices button[aria-pressed='true'] { background: var(--green); color: var(--on-accent); border-color: var(--green); }
.room-tap-choices button[data-action='review-set'] { font-size: .8rem; }
.room-feedback { display: grid; gap: 14px; }
.room-feedback h1 { font-family: var(--font-display); font-size: 1.75rem; }
.room-feedback .room-tap-choices button { font-size: 1rem; min-height: 54px; }
/* Browsing movements also opens a panel in this room. */
#watch-layout { position: fixed; inset: 0; z-index: 1000; display: block; width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; overflow: hidden; background: var(--bg); }
#watch-layout .watch-main { height: 100%; }
#watch-layout #watch-stage { position: absolute; inset: 0; height: 100%; min-height: 0; max-height: none; border: 0; border-radius: 0; }
#watch-layout .watch-back { top: max(12px,env(safe-area-inset-top)); left: max(12px,env(safe-area-inset-left)); right: auto; }
#watch-layout .watch-fullscreen { top: max(12px,env(safe-area-inset-top)); right: max(12px,env(safe-area-inset-right)); }
#watch-layout .watch-scene-bottom { display: none; }
#watch-layout .watch-browse-panel { display: none; }
#watch-layout:not(.is-immersive) .watch-controls { display: none; }
#watch-layout:not(.is-immersive) .watch-browse-panel { display: flex; flex-direction: column; position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; max-height: calc(100dvh - max(238px,11rem)); overflow: auto; overscroll-behavior: contain; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 26px 26px 0 0; box-shadow: var(--room-shadow); }
#watch-layout:not(.is-immersive) .watch-browse-panel .watch-browser { position: static; order: 1; padding: 12px 0; width: 100%; border: 0; background: none; }
#watch-layout:not(.is-immersive) .watch-browse-panel .watch-instructions { order: 2; padding: 16px 0; margin: 0; border: 0; background: none; }
#watch-layout:not(.is-immersive) .watch-list { max-height: 290px; overflow: auto; }
#watch-layout:not(.is-immersive) #watch-companion { inset: 68px 5% calc(100dvh - max(238px,11rem) + 12px); }
@media (min-width: 1001px) {
  #watch-layout:not(.is-immersive) #watch-stage { right: 460px; width: auto; }
  #watch-layout:not(.is-immersive) #watch-companion { inset: 74px 5% 28px; }
  #watch-layout:not(.is-immersive) .watch-browse-panel { top: 0; left: auto; right: 0; width: 460px; max-height: 100dvh; border-radius: 0; padding: 24px; }
}

/* Keep content readable and every control usable within the scrollable panel. */
.room-panel :is(button,a,input,select,summary), .watch-browse-panel :is(button,a,input,select,summary) { min-height: 44px; }
.room-panel :is(button,.icon-button), .watch-browse-panel :is(button,.icon-button) { min-width: 44px; }
.room-panel :is(input,textarea)::placeholder, .watch-browse-panel input::placeholder { color: var(--muted); opacity: 1; }
.room-panel-content .brooke-says { display: none; }
.room-today .section-heading, .room-quick .section-heading { margin: 0 0 10px; gap: 8px; }
.room-today .section-heading h1, .room-quick .section-heading h1 { font-size: 1.35rem; }
.room-alternatives { margin-top: 0; }
.room-search { display: flex; align-items: center; gap: 8px; }
.room-search input { flex: 1; }
.room-quick-amounts button { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.room-quick-amounts button span { font-size: .65rem; }
.room-bubble { max-height: calc(100dvh - var(--room-small) - 100px); overflow: auto; overscroll-behavior: contain; }
.room-bubble .bubble-name { white-space: nowrap; font-size: 11px; }
.room-shell[data-panel-height='medium'] .room-bubble { max-height: calc(100dvh - var(--room-medium) - 100px); }
.room-shell[data-panel-height='tall'] .room-bubble { max-height: calc(max(238px,11rem) - 100px); }
@media (max-width: 1000px) {
  .room-panel .room-panel-content { padding-block: 12px; }
}
@media (min-width: 1001px) {
  .room-bubble,.room-shell[data-panel-height='medium'] .room-bubble,.room-shell[data-panel-height='tall'] .room-bubble { max-height: calc(100dvh - 180px); }
}
.room-tap-choices button.primary { background: var(--green); color: var(--on-accent); border-color: var(--green); }
body:has(#modal-root dialog[open]) :is(.player-sheet,.finish-copy,.watch-controls,.watch-browse-panel) { visibility: hidden; }
@media (min-width: 1001px) {
  .immersive-workout .player-sheet,.immersive-finish .finish-copy {
    position: absolute; left: auto; right: 0; top: 0; bottom: 0; transform: none;
    width: 400px; max-height: 100dvh; padding: 28px 24px; margin: 0;
    border-radius: 0; border-top: 0; border-right: 0; border-bottom: 0;
    display: flex; flex-direction: column; justify-content: center; gap: 24px;
    overflow: auto; overscroll-behavior: contain;
  }
  .immersive-workout .player-sheet:has(.workout-details[open]),.immersive-finish .finish-copy:has(.workout-details[open]) { justify-content: flex-start; }
  .immersive-workout .workout-dock-main,.immersive-finish .finish-dock-main { display: grid; grid-template-columns: minmax(0,1fr); gap: 20px; }
  .immersive-workout .workout-companion,.immersive-workout .workout-stage:has(.brooke-dialogue) .workout-companion,.immersive-finish .finish-art { inset: 82px 424px 28px 3%; }
  .immersive-workout .stage-topline { right: 424px; }
  .immersive-workout .stage-count,.immersive-workout .stage-rest { right: 424px; }
  .immersive-workout .brooke-dialogue { width: min(240px,22%); }
  .room-immersive-shell .workout-details { flex: none; }
  .room-immersive-shell .workout-details > summary { min-height: 48px; height: auto; flex-direction: row; gap: 8px; }
  .room-immersive-shell .workout-details-panel { position: static; width: 100%; max-height: none; padding: 20px 0 0; border: 0; border-radius: 0; box-shadow: none; }
  #watch-layout:is(:fullscreen,.is-immersive) .watch-controls { top: 0; bottom: 0; left: auto; right: 0; transform: none; width: 400px; height: 100%; max-height: none; border-radius: 0; padding: 24px; display: flex; flex-direction: column; justify-content: center; overflow: auto; }
  #watch-layout:is(:fullscreen,.is-immersive).show-view-options .watch-controls { justify-content: flex-start; padding-top: 64px; }
  #watch-layout:is(:fullscreen,.is-immersive) .watch-transport { display: grid; grid-template-columns: 1fr 1fr; }
  #watch-layout:is(:fullscreen,.is-immersive) .watch-fullscreen-picker { grid-row: 2; grid-column: 1 / -1; }
  #watch-layout:is(:fullscreen,.is-immersive) .watch-view-options { grid-column: 1 / -1; }
  #watch-layout:is(:fullscreen,.is-immersive) #watch-companion { inset: 76px 424px 28px 3%; }
  #watch-layout:is(:fullscreen,.is-immersive) .watch-fullscreen { right: 418px; }
  #watch-layout:is(:fullscreen,.is-immersive) .watch-scene-label { right: 590px; }
}

/* Brooke stays in the room while detail editors occupy her panel. */
.room-panel .summary-art, .room-panel .quick-brooke, body:has(.room-shell) dialog .detail-stage { display: none; }
.room-panel .saved-summary { display: block; }
/* The options handle grows the same panel; it never opens a second sheet. */
.room-shell { --room-medium: 59dvh; }
@media (max-width: 1000px) {
  .immersive-workout .player-sheet:has(.workout-details[open]),.immersive-finish .finish-copy:has(.workout-details[open]) {
    height: calc(100dvh - max(238px,11rem)); max-height: calc(100dvh - max(238px,11rem));
    left: 0; right: 0; bottom: 0; transform: none; width: 100%; border-radius: 26px 26px 0 0;
    display: flex; flex-direction: column; justify-content: flex-start; gap: 12px; padding: 16px;
    overflow: auto; overscroll-behavior: contain;
  }
  .immersive-workout .player-sheet[data-height='medium'],.immersive-finish .finish-copy[data-height='medium'] { height: 56dvh; max-height: calc(100dvh - 200px); }
  .room-immersive-shell .workout-details > summary { height: auto; min-height: 44px; flex-direction: row; gap: 8px; }
  .room-immersive-shell .workout-details-panel { position: static; max-height: none; width: 100%; border: 0; border-radius: 0; box-shadow: none; padding: 16px 0 0; }
  .immersive-workout:has(.workout-details[open]) .workout-companion,.immersive-workout:has(.workout-details[open]) .workout-stage:has(.brooke-dialogue) .workout-companion { inset: 150px 3% 180px; }
  .immersive-finish:has(.workout-details[open]) .finish-art { inset: 122px 3% 180px; }
  #watch-layout.show-view-options .watch-controls { bottom: 0; height: calc(100dvh - max(238px,11rem)); max-height: calc(100dvh - max(238px,11rem)); width: 100%; border-radius: 26px 26px 0 0; padding: 16px; }
  #watch-layout.show-view-options .watch-controls[data-height='medium'] { height: 56dvh; max-height: calc(100dvh - 200px); }
}
@media (min-width: 1001px) {
  .immersive-workout,.immersive-finish,#watch-layout { --immersive-panel-width: 400px; }
  :is(.immersive-workout,.immersive-finish,#watch-layout)[data-panel-height='medium'] { --immersive-panel-width: 430px; }
  :is(.immersive-workout,.immersive-finish,#watch-layout)[data-panel-height='tall'] { --immersive-panel-width: 460px; }
  .immersive-workout .player-sheet,.immersive-finish .finish-copy,#watch-layout:is(:fullscreen,.is-immersive) .watch-controls { width: var(--immersive-panel-width); }
  .immersive-workout .workout-companion,.immersive-workout .workout-stage:has(.brooke-dialogue) .workout-companion,.immersive-finish .finish-art { right: calc(var(--immersive-panel-width) + 24px); }
  .immersive-workout .stage-topline,.immersive-workout .stage-count,.immersive-workout .stage-rest { right: calc(var(--immersive-panel-width) + 24px); }
  #watch-layout:is(:fullscreen,.is-immersive) #watch-companion { right: calc(var(--immersive-panel-width) + 24px); }
  #watch-layout:is(:fullscreen,.is-immersive) .watch-fullscreen { right: calc(var(--immersive-panel-width) + 18px); }
}
#room-panel :is(button,a,input,select,summary) { min-height: 44px; }
#room-panel :is(button,.icon-button) { min-width: 44px; }
@media (max-width: 1000px) {
  .immersive-workout .player-sheet[data-height='medium']:has(.workout-details[open]),.immersive-finish .finish-copy[data-height='medium']:has(.workout-details[open]) { height: 56dvh; max-height: calc(100dvh - 200px); }
}
/* Safe alignment keeps the first profile reachable when the list is taller than its panel. */
.welcome .welcome-form { justify-content: flex-start; justify-content: safe center; }
.welcome .welcome-character { pointer-events: none; }
body:has(.room-immersive-shell) .modal .detail-stage { display: none; }
.room-immersive-status { position: fixed; z-index: 1001; top: max(14px,env(safe-area-inset-top)); left: 70px; min-height: 40px; padding: 8px 10px; border-radius: 14px; font-size: 12px; }
.is-watch .room-immersive-status { top: 68px; left: 14px; }
@media (max-width: 1000px) {
  body:has(dialog[open] .exercise-detail) #room-companion,
  body:has(dialog[open] .exercise-detail) #workout-companion { top: 68px; height: 150px; bottom: auto; left: 41%; right: 1%; }
}
dialog.modal .choice, dialog.modal .check-pill { min-height: 44px; }
#watch-layout:not(.is-immersive) .watch-browse-panel .watch-controls { position: static; display: block; width: 100%; height: auto; max-height: none; transform: none; padding: 12px 0; margin: 8px 0; border: 0; border-radius: 0; box-shadow: none; visibility: visible; background: var(--surface); }
#watch-layout:not(.is-immersive) .watch-browse-panel .watch-transport { display: flex; flex-wrap: wrap; gap: 8px; }
#watch-layout:not(.is-immersive) .watch-browse-panel .watch-extra-controls { display: block; }
dialog.modal .choice, dialog.modal .choice > span, dialog.modal .check-pill { min-height: 44px; min-width: 44px; }
dialog.modal .choice > span { display: inline-flex; align-items: center; justify-content: center; }
/* Reflow actual glyphs, not only their control boxes, at enlarged text sizes. */
#room-panel :is(h1,h2,h3,p,.room-panel-nav a,.room-panel-nav a span) { min-width: 0; overflow-wrap: anywhere; }
#room-panel .room-panel-nav a { white-space: normal; }
.room-shell[data-large-text='true'] .room-panel-nav { grid-template-columns: repeat(2,minmax(0,1fr)); }
.room-panel .routine-grid { grid-template-columns: minmax(0,1fr); }
#room-panel :is(.tab-strip,.filter-chips,.jump-chips) { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; overflow: visible; }
#room-panel :is(.tab-strip,.filter-chips,.jump-chips) > * { flex: 0 0 auto; min-width: 44px; max-width: 100%; white-space: normal; overflow-wrap: anywhere; padding-inline: 12px; }
.room-companion .brooke-companion { min-height: 0; }
.room-bubble .bubble-name { letter-spacing: .04em; }
@media (max-width: 1000px) {
  .room-shell { --room-tall: calc(100dvh - var(--room-head-space,238px)); --room-medium: min(59dvh,calc(100dvh - var(--room-head-space,238px))); }
  .room-panel { max-height: calc(100dvh - var(--room-head-space,238px)); }
  .room-bubble,.room-shell[data-panel-height='medium'] .room-bubble,.room-shell[data-panel-height='tall'] .room-bubble { max-height: calc(var(--room-head-space,238px) - 100px); }
  body:has(.room-shell) dialog.modal[open] { max-height: calc(100dvh - var(--room-head-space,238px)); }
  dialog.modal .form-grid { grid-template-columns: minmax(0,1fr); }
}
@media (min-width: 1001px) { dialog.modal[open] { height: 100dvh; } }
/* Status messages use the same overlay and sit in the panel, clear of Brooke and navigation. */
#toast,#toast.error { background: var(--overlay-bg); color: var(--overlay-ink); border: 1px solid var(--overlay-line); box-shadow: var(--room-shadow); }
#toast.error { color: var(--danger); border-color: var(--danger); }
#toast,#toast.show,body:has(.room-shell) #toast { left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: auto; max-width: none; transform: none; }
@media (min-width: 1001px) {
  #toast,#toast.show,body:has(.room-shell) #toast { left: auto; right: 16px; bottom: 84px; width: 350px; max-width: calc(100vw - 32px); }
}
.room-feedback { gap: 2px; }
.room-feedback h1 { font-size: 1.3rem; line-height: 1.15; }
.room-feedback > .eyebrow { font-size: 11px; line-height: 1.3; }
.room-feedback > p { margin: 0; font-size: .75rem; line-height: 1.4; }
.room-feedback .room-tap-choices button { min-height: 44px; }
body:has([data-testid='room-feedback']) #toast:not(.error) { clip-path: inset(50%); width: 1px; height: 1px; padding: 0; }
#toast,#toast.show,body:has(.room-shell) #toast { bottom: calc(var(--room-nav-height,60px) + 16px + env(safe-area-inset-bottom)); }
.room-brand .brand-mark,.welcome .brand-mark { font-size: 0 !important; }
.room-brand .brand-mark::before,.welcome .brand-mark::before { content: 'b.'; font-size: 25px; line-height: 1; }

/* Settings is the user's full-screen menu, retaining the room beneath it. */
.room-shell.is-settings #room-panel {
  position: fixed; inset: 0; width: 100%; height: 100dvh; max-height: none;
  min-height: 0; border: 0; border-radius: 0; z-index: 10; transition: none;
}
.settings-fullscreen-header { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 12px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line); color: var(--muted); font-size: .85rem; flex: none; }
.settings-fullscreen-header span { overflow-wrap: anywhere; }
.settings-fullscreen-header .button { flex: none; }
.settings-fullscreen-header[hidden], .room-panel-grip[hidden], .room-panel-nav[hidden] { display: none; }
.room-shell.is-settings #room-panel .room-panel-content { width: 100%; max-width: 1160px; margin-inline: auto; padding: 22px clamp(16px, 3vw, 36px) 40px; }
.settings-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: 16px; margin-bottom: 20px; }
.settings-overview .panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.settings-overview .panel > h2, .settings-overview p { margin: 0; }
.settings-theme-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-theme-choices button { flex: 1 1 85px; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; color: var(--ink); background: var(--surface-2); }
.settings-theme-choices button[aria-pressed="true"] { color: var(--on-accent); background: var(--green); border-color: var(--green); }
.settings-song-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-overview select, .settings-overview input[type="range"] { width: 100%; min-width: 0; min-height: 44px; }
.settings-overview .field { margin: 0; }
.settings-profile-list { display: grid; gap: 8px; max-height: 220px; overflow: auto; }
.settings-profile-list .profile-card { width: 100%; padding: 10px; }
.settings-profile-list .profile-card > span { min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 900px) {
  .room-shell.is-settings .room-panel-content .settings-grid { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
}
@media (prefers-reduced-motion: reduce) { .settings-theme-choices button { transition: none; } }

/* Profile facts must reflow when names or system text sizes grow. */
.room-panel-content .profile-facts > div { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.room-panel-content .profile-facts dt { flex: 1 1 7rem; min-width: 0; }
.room-panel-content .profile-facts dd { flex: 1 1 10rem; min-width: 0; margin: 0; white-space: normal; overflow-wrap: anywhere; }

.settings-overview > .panel { margin: 0; }
.settings-overview input[type="range"] { accent-color: var(--green); }

.room-guest-badge { padding: 8px 12px; border-radius: 100px; font-size: .75rem; }
.guest-storage-warning { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); font-size: .75rem; line-height: 1.4; }
.guest-storage-warning > span { flex: 1; min-width: 0; }
.guest-storage-warning > button { flex: none; }
.room-immersive-shell .guest-storage-warning { position: static; grid-column: 1 / -1; margin: 0; width: 100%; background: var(--surface-2); color: var(--ink); }
.room-shell.is-settings .room-backup-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.room-shell.is-settings .room-backup-actions > .button { flex: 0 1 280px; max-width: 100%; }
.settings-overview { align-items: start; }

/* Settings dialogs stay within the full-screen settings surface. */
body:has(.room-shell.is-settings):has(#modal-root dialog[open]) #room-panel { visibility: visible; }
body:has(.room-shell.is-settings) dialog.modal[open] {
  inset: 50% auto auto 50%; transform: translate(-50%,-50%); margin: 0;
  width: min(640px,calc(100% - 16px)); height: auto; max-height: calc(100dvh - 16px);
  border-radius: 22px;
}
body:has(.room-shell.is-settings) dialog.modal::backdrop { background: var(--shadow-color); }
.room-header-tools { flex-shrink: 0; }
.room-profile { flex: none; }
.room-shell[data-large-text='true'] .room-brand > span:last-child { display: none; }

/* The next action owns the phone width; options share the exercise heading. */
@media (max-width: 760px) {
  .immersive-workout .player-sheet:not(:has(.workout-details[open])) {
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: start;
  }
  .immersive-workout .player-sheet:not(:has(.workout-details[open])) .workout-dock-main { display: contents; }
  .immersive-workout .player-sheet:not(:has(.workout-details[open])) .player-heading { grid-column: 1; grid-row: 1; }
  .immersive-workout .player-sheet:not(:has(.workout-details[open])) .workout-details { grid-column: 2; grid-row: 1; }
  .immersive-workout .player-sheet:not(:has(.workout-details[open])) :is(.player-primary-controls,.room-set-review) { grid-column: 1 / -1; grid-row: 2; }
  .immersive-workout .player-sheet:has(.guest-storage-warning):not(:has(.workout-details[open])) .guest-storage-warning { grid-row: 1; }
  .immersive-workout .player-sheet:has(.guest-storage-warning):not(:has(.workout-details[open])) :is(.player-heading,.workout-details) { grid-row: 2; }
  .immersive-workout .player-sheet:has(.guest-storage-warning):not(:has(.workout-details[open])) :is(.player-primary-controls,.room-set-review) { grid-row: 3; }
}
.room-set-review .room-tap-choices { display: flex; flex-wrap: wrap; }
.room-set-review .room-tap-choices > button { flex: 1 0 44px; min-width: max-content; padding-inline: 4px; font-variant-numeric: tabular-nums; }
.room-review-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.room-review-footer .field-note { margin: 0; }
.room-review-footer > .text-button { min-height: 44px; min-width: 44px; }
