/* The stage page: one screen on the station laptop, read from 3 metres.
   Builds on theme.css (tokens, fonts, buttons, tabs, messages, the PIN card,
   the status light, soundboard tiles, "say this" and panels); this file lays
   out the stage itself. Only theme.css tokens: no colour of its own. */

html,
body {
  height: 100%;
  /* The orb's glow may reach past the screen edge on a phone. */
  overflow-x: hidden;
}

/* One screen: header, notices, the current view, status, Stop and New.
   Only the soundboard scrolls, inside its own area. */
.stage {
  height: 100dvh;
  max-width: 1180px;
  margin-inline: auto;
  padding: var(--space-4) var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.view {
  flex: 1 1 0;
  min-height: 0;
}

/* ---------------------------------------------------------------------------
   Header: the check and the phone, as pills with a light
   --------------------------------------------------------------------------- */

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.remote-open {
  display: flex;
  align-items: center;
  gap: 0.5em;
  min-height: 60px;
  padding: 0 22px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  color: var(--ink-2);
  font: 600 1.2rem var(--font-display);
  transition: transform var(--quick) var(--ease-out);
  --link: var(--ink-5);
}
.remote-open[data-link="starting"],
.remote-open[data-link="waiting"] { --link: var(--cyan); }
.remote-open[data-link="up"] { --link: var(--ok); border-color: var(--ok-line); }
.remote-open[data-link="lost"],
.remote-open[data-link="down"] { --link: var(--amber); border-color: var(--amber-line); color: var(--amber-soft); }
.check-open[data-check="ok"] { --link: var(--ok); border-color: var(--ok-line); }
.check-open[data-check="fail"] { --link: var(--red); border-color: var(--red-line); color: var(--red-soft); }

@media (hover: hover) {
  .remote-open:hover {
    color: var(--ink);
  }
}

.remote-open:active {
  transform: scale(0.97);
  transition-duration: var(--press);
}

.remote-dot {
  flex: none;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: var(--link);
  box-shadow: 0 0 0.6em var(--link);
}
.remote-open[data-link="starting"] .remote-dot,
.remote-open[data-link="waiting"] .remote-dot {
  animation: blink 0.8s ease-in-out infinite alternate;
}

/* The menu button and the event line in the menu: narrow screens only. */
.menu-open,
.menu-event {
  display: none;
}

/* ---------------------------------------------------------------------------
   Live view: the event bar on top, then the Start and Talk orb
   --------------------------------------------------------------------------- */

.view.live {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.live-main {
  flex: 1 1 0;
  min-height: 0;
  /* The orb, PIN form and picker are sized from the space left here, and
     never grow past it: a long event list scrolls inside the picker. */
  container-type: size;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
}

/* The event bar: which event Hakim is told about, and Change. */
.event-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3) 18px;
  padding: var(--space-2);
  padding-inline-start: 22px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
}

.event-current {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
}

.event-label {
  color: var(--ink-4);
  font-size: var(--text-base);
}

.event-name {
  font: 700 1.65rem/1.3 var(--font-display);
}

.event-meta {
  color: var(--ink-3);
  font-size: var(--text-md);
}

.event-change {
  flex: none;
  min-height: 60px;
  padding: 0 28px;
  font-size: 1.25rem;
}

#event-note .message-text,
#picker-note .message-text {
  font-size: var(--text-md);
}

/* The event picker: in place of Start, one large row per event. */
.picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: min(100%, 720px);
  max-height: 100%;
  padding: min(24px, 4cqh) clamp(16px, 4cqw, 28px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow);
  animation: rise 0.25s var(--ease-out);
}

.picker-title {
  font: 700 min(2.1rem, 8cqh)/1.2 var(--font-display);
  text-align: center;
}

.picker-hint,
.picker-line {
  color: var(--ink-3);
  font-size: var(--text-base);
  text-align: center;
}

.picker-list {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.picker-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  min-height: 76px;
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-tile);
  background: var(--tile);
  text-align: start;
  transition: transform var(--quick) var(--ease-out);
}

.picker-item[aria-current="true"] {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--cyan-line);
}

.picker-item.loading {
  border-color: var(--cyan);
  animation: blink 0.8s ease-in-out infinite alternate;
}

.picker-item:active:not(:disabled) {
  transform: scale(0.98);
  transition-duration: var(--press);
}

@media (hover: hover) {
  .picker-item:hover:not(:disabled) {
    border-color: var(--cyan-line);
  }
}

.picker-name {
  font: 700 1.45rem/1.3 var(--font-display);
}

.picker-meta {
  color: var(--ink-3);
  font-size: var(--text-base);
  font-weight: 400;
}

.picker-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.picker-actions .btn {
  min-height: 64px;
  font-size: 1.3rem;
}

/* The PIN card, sized from the live view's height so it fits under an error
   banner on a laptop screen. */
.live-main .pin {
  gap: min(18px, 3cqh);
  padding: min(32px, 5cqh) clamp(20px, 5cqw, 36px);
  animation: rise 0.25s var(--ease-out);
}

.live-main .pin-title {
  font-size: min(2.4rem, 9cqh);
}

.live-main .pin-input,
.live-main .pin-submit {
  min-height: min(84px, 17cqh);
}

.live-main .pin-input {
  font-size: min(2.2rem, 8cqh);
}

.live-main .pin-submit {
  font-size: min(2rem, 7.5cqh);
}

.live-main .pin-hint {
  font-size: min(1.05rem, 4.5cqh);
}

/* ---------------------------------------------------------------------------
   The orb: Start, then Talk. Its layers are drawn here and by orb.js; they
   hold no text.
   --------------------------------------------------------------------------- */

.orb {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: min(78cqmin, 460px);
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
  background: none;
  transition: transform 0.18s ease-out;
  /* A held press must not scroll, select text or open a menu. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.orb > * {
  pointer-events: none;
}

.orb:disabled {
  opacity: 1;
  cursor: default;
}

.orb:focus-visible {
  outline-offset: 10px;
}

/* Instant press feedback, by pointer or by Space. */
.orb:active:not(:disabled),
[data-state="listening"] .talk {
  transform: scale(0.95);
  transition-duration: var(--press);
}

/* Colours per state */
body {
  --orb-glow: var(--cyan);
  --orb-glow-2: var(--blue);
  --orb-ring: var(--cyan-ring);
  --orb-tint: var(--cyan);
  --orb-shimmer: var(--violet);
}
[data-state="connecting"] {
  --orb-ring: var(--cyan-faint);
  --orb-shimmer: var(--cyan);
}
[data-state="listening"] {
  --orb-glow-2: var(--cyan);
  --orb-ring: var(--cyan);
}
[data-state="thinking"] {
  --orb-glow: var(--violet);
  --orb-glow-2: var(--violet);
  --orb-ring: var(--violet-line);
  --orb-tint: var(--violet);
}
[data-state="speaking"] {
  --orb-glow: var(--violet);
  --orb-glow-2: var(--blue);
  --orb-ring: var(--violet-soft);
  --orb-tint: var(--violet);
}
[data-state="failed"] {
  --orb-glow: var(--red);
  --orb-glow-2: var(--red);
  --orb-ring: var(--red);
  --orb-tint: var(--red);
}

.orb-glow {
  position: absolute;
  inset: -22%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--orb-glow) 50%, var(--orb-glow-2) 72%, transparent 100%);
  opacity: 0.45;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.orb-core {
  position: absolute;
  inset: 0;
  border: 1px solid var(--glass-border-strong);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 28%, var(--sheen), transparent 55%),
    radial-gradient(circle at 50% 100%, color-mix(in srgb, var(--orb-tint) 30%, transparent), transparent 70%),
    var(--glass-strong);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow:
    inset 0 1px 0 var(--sheen),
    inset 0 -24px 60px var(--deep),
    var(--shadow);
}

.orb-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
}

.orb-ring::before,
.orb-ring::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.orb-ring::before {
  inset: 0;
  border: 3px solid var(--orb-ring);
}

/* The thinking shimmer: two violet arcs that turn around the ring. */
.orb-ring::after {
  inset: -4px;
  background: conic-gradient(
    transparent 0turn,
    var(--orb-shimmer) 0.2turn,
    var(--violet-soft) 0.27turn,
    transparent 0.4turn 0.5turn,
    var(--orb-shimmer) 0.7turn,
    var(--violet-soft) 0.77turn,
    transparent 0.9turn
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 10px), black calc(100% - 9px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 10px), black calc(100% - 9px));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.orb-label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3em;
  font: 700 min(11cqmin, 4.6rem)/1.1 var(--font-display);
  color: var(--ink);
  text-shadow: 0 2px 18px var(--deep-strong);
}

.orb-label small {
  max-width: 12em;
  font: 400 min(4.2cqmin, 1.2rem)/1.4 var(--font-text);
  color: var(--ink-3);
  text-align: center;
}

/* Start: the filled call to action */
.start .orb-core {
  border-color: var(--edge-light);
  background:
    radial-gradient(circle at 50% 26%, var(--sheen-strong), transparent 55%),
    linear-gradient(200deg, var(--cyan), var(--blue));
}

.start .orb-label {
  color: var(--on-accent);
  text-shadow: none;
}

.start .orb-glow,
[data-state="idle"] .talk .orb-glow {
  animation: breathe 4.5s ease-in-out infinite alternate;
}

/* Talk, per state. While listening and speaking, orb.js sets the glow's
   opacity and size from the sound level. */
[data-state="connecting"] .talk .orb-glow {
  opacity: 0.12;
}
[data-state="connecting"] .talk .orb-label {
  opacity: 0.5;
}
[data-state="connecting"] .talk .orb-ring::after {
  opacity: 0.8;
  animation: spin 2.6s linear infinite;
}

[data-state="listening"] .talk .orb-glow,
[data-state="speaking"] .talk .orb-glow {
  transition: none;
}
[data-state="listening"] .talk .orb-ring::before {
  border-width: 4px;
}

[data-state="thinking"] .talk .orb-ring::after {
  opacity: 1;
  animation: spin 1.4s linear infinite;
}

[data-state="failed"] .talk .orb-glow {
  opacity: 0.3;
}
[data-state="failed"] .talk .orb-label {
  color: var(--red-soft);
}
[data-state="failed"] .talk .orb-label small {
  visibility: hidden;
}

/* ---------------------------------------------------------------------------
   Stop and New conversation. Stop must stay reachable however long the
   soundboard gets, and must stand out.
   --------------------------------------------------------------------------- */

.secondary {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--space-4);
}

.secondary button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: clamp(72px, 12vh, 104px);
  padding: 0 var(--space-4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow);
  font: 700 1.7rem var(--font-display);
  transition: transform var(--quick) var(--ease-out);
}

.secondary button:active:not(:disabled) {
  transform: scale(0.97);
  transition-duration: var(--press);
}

/* ---------------------------------------------------------------------------
   Soundboard view: "say this" on top, then the guests and the clip groups.
   Scrolls inside its own area.
   --------------------------------------------------------------------------- */

.view.board {
  display: flex;
  flex-direction: column;
  gap: 22px;
  /* Room for the playing tile's glow inside the scroll area. */
  padding: var(--space-2) 14px 14px;
  margin-inline: -14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.view.board .say {
  padding: var(--space-4) 18px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-tile);
  background: var(--glass);
}

#board-groups {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* ---------------------------------------------------------------------------
   Panels: pairing a phone, and the pre-show check (theme.css .sheet)
   --------------------------------------------------------------------------- */

.pair-dialog {
  text-align: center;
}

.pair-dialog .sheet-body {
  align-items: center;
}

/* White ground with its quiet zone, so any phone camera reads it. */
.pair-qr {
  width: min(62vw, 300px, 40dvh);
  aspect-ratio: 1;
  border-radius: var(--radius-button);
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow-accent);
}
.pair-qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* The two steps, each with its number in a circle. */
.pair-steps {
  display: grid;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
  counter-reset: step;
  color: var(--ink-2);
  font-size: var(--text-md);
  line-height: 1.5;
  text-align: start;
}
.pair-steps li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  counter-increment: step;
}
.pair-steps li::before {
  content: counter(step);
  flex: none;
  display: grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border: 1px solid var(--cyan-line);
  border-radius: 50%;
  background: var(--cyan-wash);
  color: var(--cyan-soft);
  font: 700 var(--text-base)/1 var(--font-display);
}

.pair-code-line {
  color: var(--ink-3);
  font-size: var(--text-md);
}
.pair-code {
  color: var(--ink);
  font: 700 2.2rem/1.2 var(--font-mono);
  letter-spacing: 0.12em;
}

.pair-url {
  color: var(--ink-4);
  font: 0.9rem/1.4 var(--font-mono);
  overflow-wrap: anywhere;
}

.pair-status {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.5;
}
.pair-dialog[data-link="up"] .pair-status { color: var(--ok); }
.pair-dialog[data-link="lost"] .pair-status,
.pair-dialog[data-link="down"] .pair-status,
.pair-dialog[data-link="failed"] .pair-status { color: var(--amber-soft); }

.sheet-foot .btn {
  min-width: 220px;
}

/* The pre-show check: the devices, the checklist, the full test. */

.check-dialog {
  width: min(94vw, 760px);
}

.devices {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-tile);
  background: var(--glass);
}

.device-field {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  color: var(--ink-2);
  font: 600 var(--text-md) var(--font-display);
}

.device-field .input {
  font-size: var(--text-base);
}

.check-run,
.full-run {
  width: 100%;
}

.check-list {
  display: grid;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}
.check-list:empty {
  display: none;
}

/* One line per item: its mark in a circle, its name, what was found; the
   cause under it when it failed. */
.check-item {
  display: grid;
  grid-template-columns: 2em 8.5em minmax(0, 1fr);
  align-items: center;
  gap: 2px var(--space-3);
  min-height: 56px;
  padding: var(--space-2) 14px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-button);
  background: var(--glass);
  font-size: var(--text-base);
  line-height: 1.45;
  --mark: var(--ink-5);
}
.check-item::before {
  content: "";
  display: grid;
  place-items: center;
  width: 1.75em;
  height: 1.75em;
  border: 2px solid var(--mark);
  border-radius: 50%;
  color: var(--mark);
  font: 700 var(--text-sm)/1 var(--font-text);
}
.check-item[data-state="running"] {
  --mark: var(--cyan);
  border-color: var(--cyan-line);
}
.check-item[data-state="running"]::before {
  border-top-color: transparent;
  animation: spin 0.9s linear infinite;
}
.check-item[data-state="ok"] { --mark: var(--ok); }
.check-item[data-state="ok"]::before { content: "✓"; background: var(--ok-wash); }
.check-item[data-state="fail"] {
  --mark: var(--red);
  border-color: var(--red-line);
  background: var(--red-wash);
}
.check-item[data-state="fail"]::before { content: "✗"; color: var(--red-soft); }

.check-title {
  color: var(--ink);
  font-weight: 700;
}
.check-text {
  color: var(--ink-3);
}
.check-item[data-state="ok"] .check-text { color: var(--ink-2); }
.check-item[data-state="fail"] .check-text { color: var(--red-soft); font-weight: 600; }
.check-cause {
  grid-column: 2 / -1;
  color: var(--ink-4);
  font: var(--text-xs)/1.4 var(--font-mono);
  overflow-wrap: anywhere;
}

/* A question to the operator: speak now, or did you hear it. */
.check-ask {
  display: grid;
  gap: 10px;
  padding: var(--space-4);
  border: 1px solid var(--cyan-line);
  border-radius: var(--radius-tile);
  background: var(--cyan-wash);
  animation: rise 0.25s var(--ease-out);
}
.check-ask[hidden] {
  display: none;
}
.check-ask-text {
  font: 700 var(--text-lg)/1.5 var(--font-display);
}
.check-level {
  width: 100%;
  height: 22px;
}
.check-ask-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.check-ask-buttons:empty {
  display: none;
}
.check-ask-buttons button {
  flex: 1 1 auto;
  min-height: 64px;
  padding: 0 var(--space-6);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-button);
  background: var(--raised);
  font: 700 var(--text-md) var(--font-display);
  transition: transform var(--quick) var(--ease-out);
}
.check-ask-buttons button:first-child {
  border-color: transparent;
  background: var(--gradient-button);
  color: var(--on-accent);
}
.check-ask-buttons button:active {
  transform: scale(0.97);
  transition-duration: var(--press);
}

/* The verdict: ready for the show, or what to fix first. */
.check-summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 18px;
  border: 1px solid var(--glass-border);
  border-inline-start-width: 6px;
  border-radius: var(--radius-tile);
  background: var(--glass);
  font: 700 var(--text-lg)/1.5 var(--font-display);
}
.check-summary:empty {
  display: none;
}
.check-summary[data-state="ok"] {
  border-color: var(--ok-line);
  border-inline-start-color: var(--ok);
  background: var(--ok-wash);
  color: var(--ok);
}
.check-summary[data-state="fail"] {
  border-color: var(--red-line);
  border-inline-start-color: var(--red);
  background: var(--red-wash);
  color: var(--red-soft);
}

.full-test {
  display: grid;
  gap: 10px;
  padding: var(--space-4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-tile);
  background: var(--glass);
}
.full-title {
  font: 700 var(--text-md) var(--font-display);
}
.full-hint {
  color: var(--ink-3);
  font-size: var(--text-base);
  line-height: 1.5;
}
.full-result {
  color: var(--ink);
  font: 700 var(--text-lg)/1.5 var(--font-display);
}
.full-result:empty {
  display: none;
}
.full-talk {
  min-height: 104px;
  border-radius: var(--radius-tile);
  background: var(--gradient-button);
  color: var(--on-accent);
  font: 700 1.6rem var(--font-display);
  box-shadow: var(--shadow-accent);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform var(--quick) var(--ease-out);
}
.full-talk:active {
  transform: scale(0.97);
  transition-duration: var(--press);
}

/* ---------------------------------------------------------------------------
   Narrow screens, up to a tablet held upright (1040px: tablets upright are
   up to 1032px wide, laptops at their usual scaling 1280px or more, the
   station 1366px). The check, the phone
   and the event line go into a menu behind one button, and the event bar
   keeps only the event's name, on one line. Laptops keep the header above.
   --------------------------------------------------------------------------- */

@media (max-width: 1040px) {
  .top {
    z-index: 3; /* the open menu over Stop and New */
  }

  .menu-open {
    display: inline-flex;
    position: relative;
    flex: none;
    width: 60px;
    min-height: 60px;
    padding: 0;
    border-color: var(--glass-border);
    border-radius: var(--radius-pill);
    background: var(--glass);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    color: var(--ink-2);
  }

  .menu-open[aria-expanded="true"] {
    border-color: var(--cyan-line);
    background: var(--cyan-wash);
    color: var(--ink);
  }

  .menu-lines {
    width: 24px;
    height: 3px;
    border-radius: 2px;
    background: currentColor;
    box-shadow: 0 -8px 0 currentColor, 0 8px 0 currentColor;
  }

  /* A warning stays in sight: the check has not passed in this page, or the
     phone is waited for or lost. */
  .menu-dot {
    display: none;
    position: absolute;
    inset-block-start: 2px;
    inset-inline-end: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 3px var(--navy), 0 0 10px var(--amber);
  }
  .top:has(#check-open:not([data-check="ok"])) .menu-dot,
  .top:has(#remote-open:not([hidden]):is([data-link="starting"], [data-link="waiting"], [data-link="lost"], [data-link="down"])) .menu-dot {
    display: block;
  }

  /* The menu: under the header, at the button's end. */
  .top-actions {
    display: none;
    position: absolute;
    z-index: 3;
    inset-block-start: calc(100% + var(--space-2));
    inset-inline-end: 0;
    width: min(100%, 440px);
    max-height: calc(100dvh - 120px);
    flex-direction: column;
    flex-wrap: nowrap;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--glass-border-strong);
    border-radius: var(--radius-card);
    background:
      radial-gradient(120% 60% at 85% 0%, var(--glow-a), transparent 60%),
      var(--navy-surface);
    box-shadow: var(--shadow);
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: rise 0.2s var(--ease-out);
  }

  .menu-open[aria-expanded="true"] + .top-actions {
    display: flex;
  }

  .top-actions .remote-open {
    flex: none;
    width: 100%;
    min-height: var(--control-lg);
    padding: 0 var(--space-5);
    border-radius: var(--radius-button);
    font-size: var(--text-md);
  }

  .menu-event {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-2) var(--space-1);
    border-top: 1px solid var(--glass-border);
  }

  .menu-event .event-current {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .menu-event .event-name {
    font-size: var(--text-md);
  }

  .menu-event .event-meta {
    font-size: var(--text-sm);
  }

  .menu-event .event-change {
    min-height: var(--control);
    padding: 0 var(--space-5);
    font-size: var(--text-base);
  }

  /* The event bar: the name alone, on one line. */
  .event-bar {
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-pill);
  }

  .event-bar .event-label,
  .event-bar .event-meta,
  .event-bar .event-change {
    display: none;
  }

  .event-bar .event-current {
    flex-wrap: nowrap;
  }

  .event-bar .event-name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: var(--text-md);
  }
}

/* ---------------------------------------------------------------------------
   Phone
   --------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .stage {
    padding: var(--space-3) 14px 14px;
    gap: var(--space-3);
  }

  /* The tabs on a row of their own, under the name and the menu button. */
  .tabs {
    width: 100%;
    order: 1;
  }

  .menu-open {
    width: 54px;
    min-height: 54px;
  }

  .picker-item {
    min-height: 68px;
    padding: 10px 14px;
  }

  .picker-name {
    font-size: 1.25rem;
  }

  .status {
    font-size: 1.6rem;
  }

  .secondary {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .secondary button {
    font-size: 1.3rem;
  }

  .view.board .say {
    padding: var(--space-3);
  }

  .device-field {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .check-item {
    grid-template-columns: 2em minmax(0, 1fr);
  }

  .check-text,
  .check-cause {
    grid-column: 2 / -1;
  }

  .full-talk {
    min-height: 88px;
    font-size: 1.35rem;
  }
}

/* No breathing, turning or growing. The thinking ring stays as still arcs,
   and orb.js changes only the glow's brightness. */
@media (prefers-reduced-motion: reduce) {
  .orb:active:not(:disabled),
  [data-state="listening"] .talk,
  .secondary button:active:not(:disabled),
  .remote-open:active,
  .picker-item:active:not(:disabled),
  .check-ask-buttons button:active,
  .full-talk:active {
    transform: none;
  }

  .orb:active:not(:disabled) .orb-core,
  [data-state="listening"] .talk .orb-core {
    border-color: var(--cyan);
  }
}
