:root {
  --bg: #000000;
  --console: #2f2f2f;
  --console-2: #242424;
  --console-3: #3a3a3a;
  --line: #4a4a4a;
  --text: #eeeeee;
  --muted: #a9a9a9;
  --element: #22d3ee;
  --center: #99f6e4;
  --accent: #0ea5e9;
  --accent-2: #14b8a6;
  --warm: #f59e0b;
  --target-opacity: 1;
  --target-glow: 22px;
  --stage-image: none;
  --bottom-safe: max(28px, calc(env(safe-area-inset-bottom, 0px) + 14px));
  --floating-control-bottom: calc(var(--bottom-safe) + 6px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: #000;
  color: var(--text);
  overflow: hidden;
}

body.clinician-gate-pending .app {
  visibility: hidden;
  pointer-events: none;
}

button,
input {
  font: inherit;
}

.clinician-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background: linear-gradient(180deg, #071015 0%, #030506 100%);
}

.clinician-gate[hidden] {
  display: none;
}

.clinician-gate-panel {
  width: min(620px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid rgba(157, 217, 255, 0.18);
  border-radius: 8px;
  color: #edf7ff;
  background: rgba(16, 23, 32, 0.92);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.52);
}

.clinician-gate-kicker {
  color: #8fdcff;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.clinician-gate h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.clinician-gate p {
  margin: 0;
  color: #d5e8f3;
  font-size: 15px;
  line-height: 1.55;
}

.clinician-gate ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 18px;
  color: #bcd1df;
  font-size: 14px;
  line-height: 1.45;
}

.clinician-gate-button {
  min-height: 46px;
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--accent), white 18%);
  border-radius: 7px;
  color: #fff;
  background: color-mix(in srgb, var(--accent), #1d2630 34%);
  cursor: pointer;
  font-weight: 850;
}

.clinician-gate-button:hover,
.clinician-gate-button:focus-visible {
  outline: none;
  border-color: rgba(143, 220, 255, 0.76);
  background: color-mix(in srgb, var(--accent), #1d2630 22%);
}

.clinician-gate-link {
  justify-self: center;
  color: #9dd9ff;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.clinician-gate-link:hover,
.clinician-gate-link:focus-visible {
  text-decoration: underline;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: minmax(340px, 1fr) auto;
  background: var(--bg);
}

.room-launcher {
  position: absolute;
  z-index: 7;
  left: 14px;
  top: 14px;
  width: min(520px, calc(100% - 92px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(20, 26, 34, 0.72);
  color: #f2f7fb;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(12px);
}

.room-launcher strong,
.room-launcher span {
  display: block;
}

.room-launcher strong {
  font-size: 14px;
}

.room-launcher span,
.room-links label {
  color: #b8c9d6;
  font-size: 12px;
}

.setup-trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: start;
  justify-content: start;
}

.setup-trust-row span {
  padding: 5px 7px;
  border: 1px solid rgba(153, 246, 228, 0.2);
  border-radius: 999px;
  color: #d7fff8;
  background: rgba(20, 184, 166, 0.08);
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
}

.room-meta-link {
  display: inline-block;
  margin-top: 8px;
  color: #9dd9ff;
  font-size: 12px;
  text-decoration: none;
}

.room-meta-link:hover {
  text-decoration: underline;
}

.room-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--accent), white 14%);
  border-radius: 7px;
  color: #fff;
  background: color-mix(in srgb, var(--accent), #1d2630 35%);
  cursor: pointer;
  font-weight: 750;
}

.room-ttl-control {
  display: grid;
  gap: 5px;
  justify-items: center;
}

.room-ttl-control > span {
  color: #b8c9d6;
  font-size: 11px;
  line-height: 1;
}

.room-ttl-row {
  display: flex;
  gap: 5px;
}

.room-ttl-row button {
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  color: #d9edf8;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

.room-ttl-row button.is-selected {
  border-color: color-mix(in srgb, var(--accent), white 18%);
  background: color-mix(in srgb, var(--accent), #1d2630 48%);
  color: #fff;
}

.room-button:disabled {
  opacity: 0.58;
  cursor: default;
}

.room-links {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.room-links[hidden] {
  display: none;
}

.room-links label {
  display: grid;
  gap: 4px;
}

.room-links input {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  padding: 0 10px;
  color: #e9f6ff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.room-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.room-secondary-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  color: #d9edf8;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.room-secondary-button:hover,
.room-secondary-button:focus-visible {
  outline: none;
  border-color: rgba(157, 217, 255, 0.48);
  background: rgba(157, 217, 255, 0.14);
}

.room-share-status {
  min-height: 17px;
  color: #9dd9ff;
  font-size: 12px;
}

.clinical-boundary {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 2px;
  color: #f2c9bd;
  font-size: 12px;
  line-height: 1.35;
}

body.is-session-active .room-launcher,
body.is-stimulating .room-launcher {
  display: none;
}

.info-page {
  min-height: 100vh;
  overflow: auto;
  background:
    radial-gradient(circle at 18% 12%, rgba(94, 232, 111, 0.12), transparent 30%),
    radial-gradient(circle at 82% 8%, rgba(157, 217, 255, 0.11), transparent 28%),
    #050607;
}

.info-shell {
  width: min(840px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 72px;
  color: #edf7ff;
}

.info-back {
  color: #9dd9ff;
  font-weight: 700;
  text-decoration: none;
}

.info-shell h1 {
  margin: 18px 0 16px;
  font-size: clamp(36px, 5vw, 56px);
  letter-spacing: 0;
}

.info-shell p {
  max-width: 760px;
  color: #c6d4de;
  font-size: 18px;
  line-height: 1.65;
}

.info-shell section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.info-shell h2 {
  margin: 0 0 12px;
  font-size: 20px;
  letter-spacing: 0;
}

.info-shell ul {
  margin: 0;
  padding-left: 20px;
  color: #c6d4de;
  line-height: 1.65;
}

.stage {
  position: relative;
  overflow: hidden;
  background-color: var(--bg);
  background-image:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.02)),
    var(--stage-image);
  background-size: cover;
  background-position: center;
}

.stage::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 120px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.28), transparent);
}

.top-tools {
  position: absolute;
  z-index: 4;
  top: 12px;
  right: 14px;
  display: grid;
  gap: 10px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: #f5f5f5;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.34);
}

.icon-button.is-active {
  color: #111827;
  border-color: rgba(229, 246, 255, 0.72);
  background: #e5f6ff;
}

.icon-lines,
.icon-expand,
.icon-blank {
  position: relative;
  width: 18px;
  height: 18px;
  display: block;
}

.icon-lines::before,
.icon-lines::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 7px 0 currentColor;
}

.icon-lines::before {
  top: 2px;
}

.icon-lines::after {
  bottom: 2px;
  box-shadow: none;
}

.icon-expand::before,
.icon-expand::after {
  content: "";
  position: absolute;
  inset: 1px;
  border: 2px solid currentColor;
}

.icon-expand::before {
  clip-path: polygon(0 0, 46% 0, 46% 20%, 20% 20%, 20% 46%, 0 46%);
}

.icon-expand::after {
  clip-path: polygon(54% 80%, 80% 80%, 80% 54%, 100% 54%, 100% 100%, 54% 100%);
}

.icon-blank::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 3px;
  border: 2px solid currentColor;
}

.icon-blank::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-42deg);
  transform-origin: center;
}

.quick-rail {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: var(--floating-control-bottom);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(157, 217, 255, 0.22);
  border-radius: 999px;
  background: rgba(8, 12, 18, 0.72);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
}

.quick-rail.is-free-position {
  bottom: auto;
  transform: none;
}

.quick-rail.is-dragging {
  cursor: grabbing;
  transition: none;
}

body.is-paused .quick-rail {
  border-color: rgba(251, 191, 36, 0.46);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.3),
    0 0 24px rgba(251, 191, 36, 0.16);
}

.quick-drag-handle {
  width: 14px;
  height: 34px;
  flex: 0 0 14px;
  border-radius: 999px;
  cursor: grab;
  touch-action: none;
  background-image:
    radial-gradient(circle, rgba(236, 254, 255, 0.78) 0 1.5px, transparent 2px),
    radial-gradient(circle, rgba(236, 254, 255, 0.44) 0 1.5px, transparent 2px);
  background-position: 4px 7px, 4px 17px;
  background-size: 8px 10px;
  background-repeat: repeat-y;
  opacity: 0.74;
}

.quick-drag-handle:hover {
  opacity: 1;
}

.quick-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  color: #ecfeff;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.quick-button:hover,
.quick-button:focus-visible {
  outline: none;
  border-color: rgba(34, 211, 238, 0.58);
  background: rgba(34, 211, 238, 0.18);
}

.quick-button:disabled {
  opacity: 0.36;
  cursor: default;
}

.quick-readout {
  min-width: 74px;
  display: grid;
  justify-items: center;
  gap: 2px;
  color: #e9fbff;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.quick-readout strong {
  font-size: 15px;
  line-height: 1;
}

.quick-readout span {
  color: #8fdcff;
  font-size: 11px;
  line-height: 1;
}

.quick-session-counter {
  min-width: 66px;
  display: none;
  justify-items: center;
  gap: 2px;
  color: #f8feff;
  user-select: none;
}

.quick-session-counter strong {
  font-size: 15px;
  line-height: 1;
}

.quick-session-counter span {
  color: #fbbf24;
  font-size: 11px;
  line-height: 1;
}

.quick-play::before {
  content: "";
  border-left: 13px solid currentColor;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  margin-left: 3px;
}

.quick-play.is-running::before {
  width: 13px;
  height: 16px;
  margin-left: 0;
  border: 0;
  border-left: 5px solid currentColor;
  border-right: 5px solid currentColor;
}

.quick-stop::before {
  content: "";
  width: 15px;
  height: 15px;
  border-radius: 3px;
  background: currentColor;
}

.quick-blank::before {
  content: "";
  position: absolute;
  width: 17px;
  height: 17px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.quick-blank::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-42deg);
}

.quick-blank.is-active {
  color: #111827;
  background: #e5f6ff;
}

.quick-cue {
  width: 48px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.quick-home {
  width: 34px;
  height: 34px;
}

.quick-home-icon {
  position: relative;
  width: 16px;
  height: 14px;
  display: block;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 2px;
}

.quick-home-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 11px;
  height: 11px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: translateX(-50%) rotate(45deg);
}

.target-plane {
  position: absolute;
  inset: 0;
  transition: opacity 140ms ease;
}

.target {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--target-size, 68px);
  height: var(--target-size, 68px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--center) 0 18%, transparent 19%),
    radial-gradient(circle at center, color-mix(in srgb, var(--center), white 14%) 0 18%, var(--element) 20% 42%, rgba(37, 99, 235, 0.55) 44% 100%);
  opacity: var(--target-opacity);
  box-shadow:
    0 0 calc(var(--target-glow) * 1.35) color-mix(in srgb, var(--element), transparent 44%),
    0 0 7px color-mix(in srgb, var(--center), transparent 12%) inset;
  will-change: left, top, transform;
}

.target.shape-soft {
  border-radius: 18px;
}

.target.shape-diamond {
  border-radius: 18px;
  transform: translate(-50%, -50%) rotate(45deg);
}

.target.shape-diamond::after {
  content: "";
  position: absolute;
  inset: 36%;
  border-radius: 50%;
  background: var(--center);
  box-shadow: 0 0 14px color-mix(in srgb, var(--center), transparent 24%);
}

.target.type-bar {
  width: calc(var(--target-size, 68px) * 2.4);
  border-radius: 999px;
}

.target.is-ghost {
  opacity: 0.45;
  filter: blur(1px);
}

.target.is-blink-mode {
  box-shadow:
    0 0 calc(var(--target-glow) + 10px) color-mix(in srgb, var(--element), transparent 36%),
    0 0 10px color-mix(in srgb, var(--center), transparent 12%) inset;
}

.target.is-phone-center {
  border-radius: 50%;
}

.prompt-card,
.blank-screen {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.prompt-card {
  top: 18px;
  min-width: min(460px, calc(100% - 110px));
  padding: 14px 18px;
  display: grid;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(12, 18, 28, 0.68);
  color: #eef8ff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  opacity: 0;
  translate: 0 -12px;
  transition: opacity 160ms ease, translate 160ms ease;
}

.prompt-card.is-visible {
  opacity: 1;
  translate: 0 0;
}

.prompt-card span {
  color: #9dd9ff;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.prompt-card strong {
  font-size: clamp(20px, 3vw, 34px);
  line-height: 1.12;
}

.blank-screen {
  inset: 0;
  left: 0;
  transform: none;
  display: none;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: #000;
  color: #d8e7f0;
  text-align: center;
}

.blank-screen strong {
  font-size: clamp(28px, 5vw, 54px);
}

.blank-screen span {
  color: #8ea5b4;
  font-size: 15px;
}

.client-ready-card,
.client-signal-card,
.client-signal-toast,
.duplicate-card {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 5;
  width: min(360px, calc(100% - 40px));
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 18, 24, 0.9);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.client-ready-card {
  display: none;
}

.client-signal-card {
  left: auto;
  right: 20px;
  display: none;
}

.client-signal-toast {
  display: grid;
  width: min(320px, calc(100% - 40px));
  border-color: rgba(34, 211, 238, 0.5);
}

.client-signal-toast[hidden] {
  display: none;
}

body.room-client .client-ready-card,
body.room-client .client-signal-card {
  display: grid;
}

body.room-client .client-ready-card {
  top: 20px;
  bottom: auto;
}

.client-ready-card.is-ready {
  border-color: rgba(94, 232, 111, 0.55);
}

.client-ready-card strong,
.client-signal-card strong,
.client-signal-toast strong,
.duplicate-card strong {
  font-size: 14px;
}

.client-ready-card span,
.client-signal-card span,
.client-signal-toast span,
.duplicate-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.client-signal-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.client-signal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.duplicate-card {
  left: auto;
  right: 20px;
}

.duplicate-card[hidden] {
  display: none;
}

.duplicate-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.is-blanked .target-plane,
body.is-blanked .prompt-card {
  opacity: 0;
}

body.is-blanked .blank-screen {
  display: grid;
}

body.is-blanked .client-ready-card,
body.is-blanked .client-signal-card,
body.is-blanked .client-signal-toast,
body.is-blanked .duplicate-card {
  display: none;
}

.console {
  min-height: 146px;
  display: grid;
  grid-template-columns: minmax(430px, 1fr) minmax(300px, 350px) minmax(210px, 270px) minmax(110px, 126px);
  grid-template-rows: 42px 42px auto;
  border-top: 1px solid var(--line);
  background: var(--console);
  box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.38);
  position: relative;
  z-index: 5;
}

.mode-strip {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #202020;
}

.mode-button {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: #202020;
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0;
}

.mode-button:last-child {
  border-right: 0;
}

.mode-button.is-selected {
  color: #f8fdff;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent), #222 72%), color-mix(in srgb, var(--accent-2), #222 78%));
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--center), white 10%);
}

.mode-button.wombat-button.is-selected {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--warm), #222 76%), color-mix(in srgb, var(--accent), #222 78%));
}

.tabs {
  grid-column: 1 / 2;
  grid-row: 2 / 3;
  display: flex;
  align-items: stretch;
}

.tab {
  min-width: 100px;
  padding: 0 20px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: var(--console-2);
  cursor: pointer;
}

.tab.is-active {
  color: #fff;
  background: var(--console-3);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.settings {
  grid-column: 1 / 2;
  grid-row: 3 / 4;
  min-width: 0;
  display: grid;
  border-right: 1px solid var(--line);
}

.panel {
  display: none;
  align-items: stretch;
  gap: 0;
  min-width: 0;
}

.panel.is-active {
  display: flex;
  flex-wrap: wrap;
  overflow-x: hidden;
}

.control {
  min-width: 94px;
  max-width: 210px;
  padding: 12px 14px 10px;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 7px;
  border-right: 1px solid var(--line);
  color: var(--muted);
}

.control.compact {
  min-width: 92px;
}

.control.set-control {
  min-width: 150px;
}

.control.pitch-control,
.control.sound-test-control {
  min-width: 150px;
}

.control.path-control {
  min-width: 250px;
  max-width: 290px;
}

.control.prompt-control {
  min-width: 210px;
}

.value {
  min-width: 48px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #4db2ff;
  background: #292929;
  font-size: 16px;
  font-weight: 650;
}

.label {
  font-size: 13px;
  line-height: 1.1;
  color: #b9b9b9;
  text-align: center;
  white-space: nowrap;
}

input[type="range"] {
  width: 118px;
  accent-color: var(--accent);
}

.control-note {
  min-height: 16px;
  color: #86cfff;
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}

.choice-row,
.stepper,
.nudge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.path-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}

.choice-row button,
.stepper button,
.nudge-row button,
.preset,
.plain-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #d8d8d8;
  background: #272727;
  cursor: pointer;
}

.choice-row button {
  padding: 0 10px;
  font-size: 12px;
}

.speed-preset-row button {
  min-width: 46px;
  padding: 0 8px;
}

.pitch-preset-row button {
  min-width: 44px;
  padding: 0 8px;
}

.nudge-row button {
  min-width: 34px;
  padding: 0 9px;
  font-size: 12px;
}

.choice-row button.is-selected,
.preset.is-selected {
  color: white;
  border-color: color-mix(in srgb, var(--accent), white 18%);
  background: color-mix(in srgb, var(--accent), #222 78%);
}

.stepper button {
  width: 38px;
  font-size: 18px;
}

.color-control input[type="color"] {
  width: 54px;
  height: 38px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.color-chip {
  width: 48px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #000;
}

.upload-control input {
  width: 118px;
  color: #b9b9b9;
  font-size: 11px;
}

.plain-button {
  align-self: center;
  margin: 22px 14px 0;
  padding: 0 14px;
}

.compact-action {
  min-height: 30px;
  margin: 0;
  padding: 0 14px;
}

.safety-action {
  min-width: 104px;
}

.transport {
  grid-column: 2 / 3;
  grid-row: 1 / 4;
  display: grid;
  grid-template-columns: 58px 58px 58px 1fr 1fr;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.transport-button {
  width: 58px;
  height: 58px;
  position: relative;
  border: 0;
  border-radius: 50%;
  background: #bcbcbc;
  color: #252525;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.transport-button:disabled {
  opacity: 0.42;
  cursor: default;
}

.transport-button.play::before {
  content: "";
  position: absolute;
  left: 23px;
  top: 17px;
  border-left: 18px solid #232323;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
}

.transport-button.stop::before {
  content: "";
  position: absolute;
  width: 19px;
  height: 19px;
  left: 20px;
  top: 20px;
  border-radius: 3px;
  background: #232323;
}

.transport-button.repeat::before,
.transport-button.repeat::after {
  content: "";
  position: absolute;
}

.transport-button.repeat::before {
  width: 22px;
  height: 22px;
  left: 18px;
  top: 17px;
  border: 3px solid #232323;
  border-right-color: transparent;
  border-radius: 50%;
}

.transport-button.repeat::after {
  right: 15px;
  top: 15px;
  border-left: 8px solid #232323;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  transform: rotate(32deg);
}

.transport-button.play.is-running {
  outline: 4px solid color-mix(in srgb, var(--accent), transparent 68%);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent), transparent 86%);
}

.transport-button.play.is-running::before {
  width: 18px;
  height: 23px;
  left: 20px;
  top: 17px;
  border: 0;
  border-left: 6px solid #232323;
  border-right: 6px solid #232323;
}

.counter {
  display: grid;
  justify-items: center;
  gap: 5px;
  color: #d2d2d2;
}

.counter span {
  font-size: 13px;
}

.counter strong {
  font-size: 22px;
  font-weight: 650;
}

.presets {
  grid-column: 3 / 4;
  grid-row: 1 / 4;
  display: flex;
  align-items: start;
  justify-content: start;
  gap: 8px;
  padding: 14px 16px;
  flex-wrap: wrap;
  border-right: 1px solid var(--line);
}

.preset {
  padding: 0 14px;
  min-width: 72px;
  font-size: 13px;
}

.status {
  grid-column: 4 / 5;
  grid-row: 1 / 4;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  color: #cfcfcf;
}

.status span {
  font-size: 12px;
  color: var(--muted);
}

.status strong {
  font-size: 16px;
}

body.focus-view .console {
  transform: translateY(calc(100% - 42px));
  transition: transform 180ms ease;
}

body.client-view .console {
  transform: translateY(calc(100% - 42px));
  transition: transform 180ms ease;
}

body.mode-bls .advanced-control,
body.mode-bls .advanced-choice,
body.mode-bls .tab[data-tab="load"],
body.mode-bls .preset[data-preset="load"] {
  display: none;
}

body.room-client .room-launcher,
body.room-client .top-tools,
body.room-client .quick-rail,
body.client-view .quick-rail {
  display: none;
}

body.room-client .app {
  grid-template-rows: 1fr;
}

body.room-client .console {
  display: none;
}

body.room-client .stage::after {
  display: none;
}

body.focus-view .console:hover,
body.focus-view .console:focus-within,
body.client-view .console:hover,
body.client-view .console:focus-within {
  transform: translateY(0);
}

@media (max-width: 980px) {
  .app {
    grid-template-rows: minmax(330px, 1fr) auto;
  }

  .console {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto auto;
    max-height: 48vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: calc(var(--bottom-safe) + 22px);
    scroll-padding-bottom: calc(var(--bottom-safe) + 22px);
  }

  .mode-strip {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    border-right: 0;
  }

  .tabs {
    grid-row: 2 / 3;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tab {
    min-width: 0;
    min-height: 42px;
    padding: 0 8px;
  }

  .room-launcher {
    width: calc(100% - 74px);
    grid-template-columns: 1fr;
  }

  .room-ttl-control {
    justify-items: start;
  }

  .room-button {
    width: 100%;
  }

  .quick-rail {
    bottom: calc(var(--floating-control-bottom) + 8px);
    max-width: calc(100% - 24px);
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    padding: 7px;
    border-radius: 22px;
  }

  .quick-button {
    width: 34px;
    height: 34px;
  }

  .quick-cue {
    width: 44px;
  }

  .quick-readout {
    min-width: 62px;
  }

  .quick-session-counter {
    min-width: 58px;
  }

  .tabs,
  .mode-strip,
  .settings,
  .transport,
  .presets,
  .status {
    grid-column: 1 / 2;
    min-width: 0;
    width: 100%;
  }

  .settings {
    grid-row: 3 / 4;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .panel.is-active {
    flex-wrap: wrap;
    overflow-x: hidden;
  }

  .control {
    flex: 1 1 120px;
    max-width: none;
    border-bottom: 1px solid var(--line);
  }

  .control.path-control,
  .control.prompt-control {
    flex-basis: 100%;
    min-width: 0;
  }

  .path-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transport {
    grid-row: 4 / 5;
    grid-template-columns: 58px 58px 58px 1fr 1fr;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .presets {
    grid-row: 5 / 6;
    justify-content: start;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .status {
    grid-row: 6 / 7;
    padding: 10px 16px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Reimagined clinician console */
.app {
  grid-template-rows: minmax(300px, 1fr) clamp(360px, 50vh, 400px);
}

.console {
  min-height: 0;
  max-height: none;
  display: grid;
  grid-template-columns: 156px minmax(520px, 1fr) minmax(410px, 520px);
  grid-template-rows: 1fr;
  gap: 0;
  overflow: hidden;
  border-top: 1px solid rgba(157, 217, 255, 0.2);
  background:
    linear-gradient(180deg, rgba(35, 43, 52, 0.98), rgba(17, 21, 26, 0.99)),
    var(--console);
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.52);
}

.mode-strip,
.session-dock,
.settings-deck {
  min-width: 0;
  min-height: 0;
}

.mode-strip {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 14px;
  border-right: 1px solid rgba(157, 217, 255, 0.14);
  border-bottom: 0;
  background:
    linear-gradient(180deg, rgba(8, 12, 18, 0.86), rgba(20, 26, 34, 0.8));
}

.console-kicker {
  color: #8fa8b7;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.mode-button {
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #b9c6cf;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 800;
}

.mode-button.is-selected {
  border-color: rgba(34, 211, 238, 0.58);
  color: #f2fdff;
  background:
    radial-gradient(circle at 20% 10%, rgba(153, 246, 228, 0.22), transparent 44%),
    linear-gradient(135deg, rgba(14, 165, 233, 0.62), rgba(20, 184, 166, 0.26));
  box-shadow:
    inset 0 0 0 1px rgba(153, 246, 228, 0.1),
    0 12px 28px rgba(14, 165, 233, 0.16);
}

.mode-button.wombat-button.is-selected {
  border-color: rgba(245, 158, 11, 0.62);
  background:
    radial-gradient(circle at 18% 12%, rgba(245, 158, 11, 0.24), transparent 44%),
    linear-gradient(135deg, rgba(245, 158, 11, 0.46), rgba(14, 165, 233, 0.3));
}

.mode-button.phone-button.is-selected {
  border-color: rgba(165, 180, 252, 0.64);
  background:
    radial-gradient(circle at 18% 12%, rgba(165, 180, 252, 0.22), transparent 44%),
    linear-gradient(135deg, rgba(59, 130, 246, 0.5), rgba(20, 184, 166, 0.24));
}

.session-dock {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: 14px 16px 12px;
  border-right: 1px solid rgba(157, 217, 255, 0.14);
}

.session-dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #f2fbff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.session-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

#connectionStatus {
  min-width: 0;
  color: #8fdcff;
  font-weight: 750;
  text-align: right;
  text-transform: none;
}

.console-pin-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid rgba(143, 220, 255, 0.24);
  border-radius: 999px;
  color: #8fdcff;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.console-pin-button:hover,
.console-pin-button:focus-visible {
  border-color: rgba(143, 220, 255, 0.68);
  color: #e9fbff;
  background: rgba(143, 220, 255, 0.12);
}

.console-pin-button:focus-visible {
  outline: 2px solid rgba(143, 220, 255, 0.72);
  outline-offset: 2px;
}

.console-pin-button.is-active {
  border-color: rgba(52, 211, 153, 0.72);
  color: #c7f9df;
  background: rgba(52, 211, 153, 0.14);
}

.console-pin-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
  transform: rotate(-34deg);
  transition: transform 160ms ease;
}

.console-pin-icon::before {
  position: absolute;
  top: 1px;
  left: 4px;
  width: 6px;
  height: 8px;
  border-radius: 5px 5px 3px 3px;
  background: currentColor;
  content: "";
}

.console-pin-icon::after {
  position: absolute;
  top: 8px;
  left: 6px;
  width: 2px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 -4px 0 2px color-mix(in srgb, currentColor, transparent 42%);
  content: "";
}

.console-pin-button.is-active .console-pin-icon {
  transform: rotate(0deg);
}

.phone-guide {
  display: none;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(165, 180, 252, 0.22);
  border-radius: 8px;
  color: #dfeaff;
  background:
    radial-gradient(circle at 10% 0%, rgba(165, 180, 252, 0.18), transparent 44%),
    rgba(255, 255, 255, 0.045);
  font-size: 12px;
  line-height: 1.35;
}

.phone-guide strong {
  color: #f6fbff;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.phone-guide span {
  color: #c8d8e6;
}

.wombat-boundary,
.cue-editor {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(245, 158, 11, 0.24);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 0%, rgba(245, 158, 11, 0.13), transparent 48%),
    rgba(255, 255, 255, 0.045);
}

.wombat-boundary strong,
.cue-editor label {
  color: #fff7ed;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
}

.wombat-boundary span,
.cue-editor span {
  color: #d7c7b4;
  font-size: 12px;
  line-height: 1.35;
}

.cue-editor textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  padding: 9px 10px;
  color: #f5fbff;
  background: rgba(6, 10, 14, 0.58);
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
}

.cue-editor textarea:disabled {
  opacity: 0.6;
  cursor: default;
}

.cue-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.session-main {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(238px, 0.88fr) minmax(280px, 1.12fr);
  gap: 14px;
  align-items: start;
}

.transport {
  grid-column: auto;
  grid-row: auto;
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: 64px auto;
  align-items: center;
  justify-content: start;
  align-content: start;
  gap: 12px;
  padding: 0;
  border-right: 0;
  align-self: start;
  height: auto;
}

.transport .counter {
  min-height: 54px;
  padding: 10px 12px;
  justify-items: start;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.transport .counter:first-of-type {
  grid-column: 1 / 3;
}

.transport .counter:last-of-type {
  grid-column: 3 / 4;
}

.transport-button {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, #e7f9ff, #99dff1);
  color: #072231;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
}

.transport-button.stop {
  background: linear-gradient(180deg, #f4f7fa, #c3cbd3);
}

.transport-button.repeat {
  background: rgba(255, 255, 255, 0.12);
  color: #dffaff;
}

.transport-button.play.is-running {
  outline: 0;
  border-color: rgba(153, 246, 228, 0.76);
  box-shadow:
    0 0 0 4px rgba(20, 184, 166, 0.16),
    0 0 28px rgba(34, 211, 238, 0.36);
}

.session-controls {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  align-content: start;
  align-items: start;
  gap: 8px;
}

.control-speed {
  grid-column: 1 / -1;
}

.session-control-row {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-self: start;
  align-items: start;
}

.session-dock .session-control-row {
  grid-template-columns: 1fr;
}

.control {
  min-width: 0;
  max-width: none;
  padding: 10px;
  justify-items: stretch;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 8px;
  color: #c7d5de;
  background: rgba(255, 255, 255, 0.045);
}

.control.primary-control {
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
}

.control.primary-control .value {
  grid-row: 1 / 4;
  grid-column: 1 / 2;
}

.control.primary-control .label {
  grid-column: 2 / 3;
  justify-self: start;
}

.control.primary-control input[type="range"] {
  grid-column: 2 / 4;
  width: 100%;
}

.control.primary-control .control-note {
  grid-column: 3 / 4;
  grid-row: 1 / 2;
  justify-self: end;
}

.control.primary-control .nudge-row,
.control.primary-control .speed-preset-row {
  grid-column: 2 / 4;
  justify-content: start;
}

.compact-control {
  align-content: start;
}

.session-dock .control-speed {
  padding: 8px;
}

.session-dock .control-speed .speed-preset-row {
  display: none;
}

.session-dock .compact-control {
  min-height: 52px;
  display: grid;
  grid-template-columns: 74px 58px minmax(0, 1fr);
  align-items: center;
  align-content: center;
  padding: 7px 8px;
}

.session-dock .compact-control .value {
  height: 30px;
}

.session-dock .compact-control .label {
  align-self: center;
}

.session-dock .compact-control .choice-row {
  flex-wrap: nowrap;
  justify-content: start;
  overflow-x: auto;
  padding-bottom: 1px;
}

.session-dock,
.panel.is-active,
.session-dock .compact-control .choice-row {
  scrollbar-color: rgba(143, 220, 255, 0.5) rgba(255, 255, 255, 0.04);
  scrollbar-width: thin;
}

.session-dock::-webkit-scrollbar,
.panel.is-active::-webkit-scrollbar,
.session-dock .compact-control .choice-row::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.session-dock::-webkit-scrollbar-track,
.panel.is-active::-webkit-scrollbar-track,
.session-dock .compact-control .choice-row::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.session-dock::-webkit-scrollbar-thumb,
.panel.is-active::-webkit-scrollbar-thumb,
.session-dock .compact-control .choice-row::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(143, 220, 255, 0.5);
}

.session-dock .set-control {
  grid-template-columns: 58px 42px minmax(0, 1fr) auto;
}

.session-dock .set-control .compact-action {
  min-height: 28px;
  padding: 0 9px;
}

.value {
  min-width: 0;
  height: 34px;
  border-color: rgba(157, 217, 255, 0.2);
  border-radius: 8px;
  color: #7ddfff;
  background: rgba(8, 12, 18, 0.58);
  font-size: 14px;
}

.label {
  justify-self: start;
  color: #d7e5ee;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: normal;
}

.control-note {
  min-height: 14px;
  color: #8fdcff;
  font-size: 11px;
  white-space: normal;
}

input[type="range"] {
  width: 100%;
}

.sound-type-control select {
  min-height: 34px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  padding: 0 34px 0 10px;
  color: #dffaff;
  background:
    linear-gradient(45deg, transparent 50%, #8fdcff 50%) calc(100% - 18px) 14px / 6px 6px no-repeat,
    linear-gradient(135deg, #8fdcff 50%, transparent 50%) calc(100% - 12px) 14px / 6px 6px no-repeat,
    rgba(255, 255, 255, 0.07);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  appearance: none;
}

.sound-type-control select:focus-visible {
  outline: none;
  border-color: rgba(34, 211, 238, 0.58);
  background-color: rgba(14, 165, 233, 0.16);
}

.choice-row,
.stepper,
.nudge-row {
  justify-content: start;
  gap: 5px;
}

.choice-row button,
.stepper button,
.nudge-row button,
.preset,
.plain-button {
  min-height: 30px;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  color: #dcecf5;
  background: rgba(255, 255, 255, 0.07);
  font-size: 11px;
  font-weight: 750;
}

.choice-row button {
  padding: 0 8px;
}

.choice-row button.is-selected,
.preset.is-selected {
  border-color: rgba(34, 211, 238, 0.58);
  background: rgba(14, 165, 233, 0.3);
}

.plain-button {
  margin: 0;
}

.color-randomizer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-deck {
  grid-column: 3 / 4;
  grid-row: 1 / 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 14px 14px 12px;
  gap: 10px;
  background: rgba(6, 10, 15, 0.22);
}

.tabs {
  grid-column: auto;
  grid-row: auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
  min-height: 34px;
}

.tab {
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  color: #aebfca;
  background: rgba(255, 255, 255, 0.055);
  font-size: 11px;
  font-weight: 800;
}

.tab.is-active {
  border-color: rgba(34, 211, 238, 0.52);
  color: #f3fdff;
  background: rgba(14, 165, 233, 0.24);
  box-shadow: none;
}

.settings {
  grid-column: auto;
  grid-row: auto;
  min-height: 0;
  display: grid;
  overflow: hidden;
  border-right: 0;
}

.panel {
  min-height: 0;
  display: none;
  gap: 8px;
}

.panel.is-active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 3px;
}

.control.path-control,
.control.prompt-control,
.control.pitch-control,
.control.sound-test-control,
.upload-control {
  min-width: 0;
  max-width: none;
  grid-column: 1 / -1;
}

.path-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.presets {
  grid-column: auto;
  grid-row: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 0;
  flex-wrap: wrap;
  border-right: 0;
}

.preset {
  min-width: 0;
  padding: 0 10px;
}

.status {
  grid-column: auto;
  grid-row: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  color: #cfcfcf;
}

.status span {
  color: #8fa8b7;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.status strong {
  color: #e9fbff;
  font-size: 14px;
  font-weight: 800;
}

body.focus-view .console,
body.client-view .console {
  transform: translateY(calc(100% - 50px));
}

body.console-pinned.focus-view .console,
body.console-pinned.client-view .console {
  transform: translateY(0);
}

body.is-stimulating:not(.console-pinned) .app {
  grid-template-rows: minmax(420px, 1fr) auto;
}

body.is-stimulating:not(.console-pinned) .console {
  min-height: 56px;
  max-height: 56px;
  overflow: hidden;
  transition: max-height 180ms ease, min-height 180ms ease;
}

body.is-stimulating:not(.console-pinned) .console:hover:not(:has(#consolePinButton:hover)),
body.is-stimulating:not(.console-pinned) .console:focus-within:not(:has(#consolePinButton:focus)) {
  min-height: 146px;
  max-height: min(52vh, 360px);
  overflow: auto;
}

body.is-stimulating:not(.console-pinned) .console:not(:hover):not(:focus-within) .session-main,
body.is-stimulating:not(.console-pinned) .console:not(:hover):not(:focus-within) .phone-guide,
body.is-stimulating:not(.console-pinned) .console:not(:hover):not(:focus-within) .settings,
body.is-stimulating:not(.console-pinned) .console:not(:hover):not(:focus-within) .presets,
body.is-stimulating:not(.console-pinned) .console:not(:hover):not(:focus-within) .status {
  display: none;
}

body.is-stimulating:not(.console-pinned) .console:not(:hover):not(:focus-within) .session-dock {
  grid-template-rows: 1fr;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

body.is-stimulating:not(.console-pinned) .console:not(:hover):not(:focus-within) .settings-deck {
  grid-template-rows: 1fr;
}

body.is-stimulating:not(.console-pinned) .console:not(:hover):not(:focus-within) .tabs {
  align-self: stretch;
}

body.mode-phone .phone-guide {
  display: grid;
}

body.mode-phone .session-control-row,
body.mode-phone .tabs .tab:not([data-tab="sound"]),
body.mode-phone .settings .panel:not([data-panel="sound"]),
body.mode-phone .presets,
body.mode-phone .status,
body.mode-phone #repeatButton,
body.mode-phone .quick-button[data-quick-action="blank-toggle"],
body.mode-phone .quick-button[data-quick-action="cue"] {
  display: none;
}

body.mode-phone .quick-session-counter {
  display: grid;
}

body.mode-phone .tabs {
  grid-template-columns: 1fr;
}

body.mode-phone .settings-deck {
  grid-template-rows: auto minmax(0, 1fr);
}

body.mode-phone .session-main {
  align-content: start;
  grid-template-columns: 1fr;
}

body.mode-phone .session-controls {
  order: -1;
}

body.mode-phone .transport {
  grid-template-columns: repeat(2, 58px);
}

body.mode-phone .transport .counter {
  display: none;
}

body.mode-phone .control.primary-control {
  grid-template-columns: 48px minmax(0, 1fr);
}

body.mode-phone .control.primary-control .control-note {
  display: none;
}

body.mode-phone .control.primary-control input[type="range"],
body.mode-phone .control.primary-control .nudge-row,
body.mode-phone .control.primary-control .speed-preset-row {
  grid-column: 1 / 3;
}

body.mode-phone .session-dock .control-speed .speed-preset-row {
  display: flex;
  justify-content: start;
}

body.mode-phone .speed-preset-row button {
  min-width: 42px;
}

body.mode-phone .session-dock [data-speed-nudge="-4"] {
  display: none;
}

body.mode-phone .sound-test-control {
  border-color: rgba(34, 211, 238, 0.28);
  background: rgba(34, 211, 238, 0.08);
}

body.mode-phone .sound-test-control .value {
  color: #d9fbff;
}

body.mode-phone .target-plane {
  opacity: 1;
}

body.mode-phone .target {
  width: min(18vw, 126px);
  height: min(18vw, 126px);
  min-width: 74px;
  min-height: 74px;
  opacity: 0.52;
  transform: translate(-50%, -50%) scale(0.82);
  background:
    radial-gradient(circle at center, var(--center) 0 13%, transparent 14%),
    radial-gradient(circle at center, color-mix(in srgb, var(--center), white 24%) 0 16%, var(--element) 18% 38%, rgba(15, 23, 42, 0.08) 40% 100%);
  box-shadow:
    0 0 26px color-mix(in srgb, var(--element), transparent 52%),
    0 0 9px color-mix(in srgb, var(--center), transparent 14%) inset;
  transition: opacity 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

body.mode-phone .target-plane.is-phone-beat .target {
  opacity: 0.95;
  transform: translate(-50%, -50%) scale(1.03);
  box-shadow:
    0 0 52px color-mix(in srgb, var(--element), transparent 20%),
    0 0 18px color-mix(in srgb, var(--center), transparent 5%) inset;
}

body.mode-phone .target-plane[data-beat-side="left"].is-phone-beat .target {
  filter: drop-shadow(-18px 0 26px color-mix(in srgb, var(--element), transparent 36%));
}

body.mode-phone .target-plane[data-beat-side="right"].is-phone-beat .target {
  filter: drop-shadow(18px 0 26px color-mix(in srgb, var(--element), transparent 36%));
}

@media (max-width: 1160px) {
  .app {
    grid-template-rows: minmax(300px, 1fr) minmax(420px, 52vh);
  }

  .console {
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    overflow-x: hidden;
    overflow-y: auto;
  }

  .mode-strip {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
  }

  .session-dock {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    border-right: 0;
    border-bottom: 1px solid rgba(157, 217, 255, 0.14);
  }

  .settings-deck {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
  }
}

@media (min-width: 721px) and (max-width: 1160px) {
  body.mode-phone .app {
    grid-template-rows: minmax(250px, 1fr) minmax(430px, 62vh);
  }

  body.mode-phone .console {
    grid-template-columns: 112px minmax(300px, 0.95fr) minmax(360px, 1.05fr);
    grid-template-rows: 1fr;
    overflow: hidden;
  }

  body.mode-phone .mode-strip {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
  }

  body.mode-phone .session-dock {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    overflow-y: auto;
    border-right: 1px solid rgba(157, 217, 255, 0.14);
    border-bottom: 0;
  }

  body.mode-phone .settings-deck {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
  }
}

@media (max-width: 720px) {
  .clinician-gate {
    align-items: start;
    padding: 14px;
  }

  .clinician-gate-panel {
    gap: 13px;
    padding: 20px;
  }

  .clinician-gate h1 {
    font-size: 28px;
  }

  .clinician-gate p,
  .clinician-gate li {
    font-size: 14px;
  }

  .app {
    grid-template-rows: minmax(300px, 1fr) minmax(520px, 62vh);
  }

  .console {
    grid-template-columns: 1fr;
    grid-template-rows: 46px 268px minmax(0, 1fr);
    overflow: hidden;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  }

  .mode-strip {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    grid-template-columns: auto repeat(3, minmax(0, 1fr));
    grid-template-rows: 30px;
    align-items: stretch;
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid rgba(157, 217, 255, 0.14);
  }

  .console-kicker {
    align-self: center;
  }

  .session-dock {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    padding: 8px 10px;
    overflow-y: auto;
    border-bottom: 1px solid rgba(157, 217, 255, 0.14);
  }

  .session-main {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .transport {
    grid-template-columns: repeat(3, 52px) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 52px;
    gap: 8px;
  }

  .transport-button {
    width: 52px;
    height: 52px;
  }

  .transport .counter {
    min-height: 52px;
    padding: 8px;
  }

  .transport .counter:first-of-type,
  .transport .counter:last-of-type {
    grid-column: auto;
  }

  .session-controls {
    grid-template-rows: auto;
    gap: 6px;
  }

  .session-control-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .control.primary-control {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .control.primary-control .control-note {
    grid-column: 2 / 3;
    grid-row: auto;
    justify-self: start;
  }

  .control.primary-control input[type="range"],
  .control.primary-control .nudge-row,
  .control.primary-control .speed-preset-row {
    grid-column: 1 / 3;
  }

  .control.primary-control .speed-preset-row {
    display: none;
  }

  .control {
    padding: 8px;
  }

  .choice-row button,
  .stepper button,
  .nudge-row button,
  .preset,
  .plain-button {
    min-height: 28px;
    padding: 0 7px;
    font-size: 10px;
  }

  .settings-deck {
    grid-column: 1 / 2;
    grid-row: 3 / 4;
    min-height: 0;
    padding: 10px;
  }

  .tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .tab {
    padding: 0 5px;
    font-size: 10px;
  }

  .panel.is-active {
    grid-template-columns: 1fr;
  }

  .path-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .room-launcher {
    width: calc(100% - 74px);
  }
}
