:root {
  color-scheme: dark;
  --bg: var(--pr-canvas, #080b10);
  --panel: var(--pr-surface-1, #111722);
  --panel-2: var(--pr-surface-2, #171f2d);
  --edge: var(--pr-border, #263044);
  --ink: var(--pr-text, #f0f5ff);
  --muted: var(--pr-text-muted, #8994a8);
  --accent: var(--pr-accent, #27e6c1);
  --accent-deep: var(--pr-focus, #087e6a);
  --danger: var(--pr-danger, #ff647c);
  --warning: var(--pr-warning, #ffc65c);
  --pr-code-bg: #080b10;
  --pr-code-text: #f7f4ff;
  --pr-qr-bg: #fff;
  font: 500 16px/1.4 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body,
#app {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 30rem),
    var(--bg);
  color: var(--ink);
}

/* Spatial Glass reads as a stage: teal key light from the left, magenta from
   the right, violet wash rising off the floor. */
html[data-style="spatial-glass"] body {
  background:
    radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 34rem),
    radial-gradient(circle at 88% 6%, color-mix(in srgb, #ff4fd8 24%, transparent), transparent 38rem),
    radial-gradient(circle at 62% 100%, color-mix(in srgb, #7b52ff 28%, transparent), transparent 44rem),
    var(--bg);
}

/* ROLL6 (the brand look every page wears while the Style picker is off,
   protocol/styles.js): a flat night ground and the Chinese sans stack. */
html[data-style="roll6"] {
  font-family: var(--r6-font-sans);
}

html[data-style="roll6"] body {
  background: var(--r6-night);
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  flex: none;
  width: 30px;
  height: 30px;
}

.eyebrow,
.meta-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.lead {
  max-width: 42ch;
  margin: 0;
  color: var(--muted);
}

.card {
  padding: 22px;
  border: 1px solid var(--edge);
  border-radius: var(--pr-radius-card, 24px);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .26);
}

.path-label {
  margin-bottom: 5px;
  color: var(--accent);
  font: 750 10px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

/* `display: grid` above beats the browser's own [hidden] rule, so a hidden
   field (閒置天數 while 永久保留 is chosen) would still show. */
.field[hidden] {
  display: none;
}

.field label,
.field-label {
  color: var(--muted);
  font-size: 13px;
}

.field small {
  color: var(--muted);
  font-size: 11px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input,
select,
.secondary-button,
.primary-button {
  min-height: 52px;
  border: 1px solid var(--edge);
  border-radius: var(--pr-radius-control, 14px);
  background: var(--panel-2);
}

input,
select {
  width: 100%;
  padding: 0 15px;
  outline: none;
}

input {
  letter-spacing: .12em;
  text-transform: uppercase;
}

input:focus,
select:focus,
button:focus-visible,
summary:focus-visible {
  border-color: var(--accent-deep);
  outline: 3px solid var(--accent-deep);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(39, 230, 193, .1);
}

.secondary-button {
  padding: 0 16px;
  color: var(--muted);
}

.primary-button {
  width: 100%;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--pr-on-accent, #03140f);
  font-weight: 850;
}

.primary-button:disabled {
  cursor: wait;
  opacity: .5;
}

.secondary-action {
  min-height: 52px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.secondary-action:hover {
  border-color: var(--muted);
  background: rgba(137, 148, 168, .06);
}

.turnstile-slot {
  min-height: 42px;
  overflow: hidden;
}

.turnstile-slot[aria-busy="true"]::before {
  color: var(--muted);
  font-size: 12px;
  content: "正在準備安全驗證…";
}

.form-error {
  min-height: 1.4em;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
  }
}

/* Lobby (PhoneJoin): the join-by-code entry. A phone-width column even on a
   desktop: the die and wordmark, one code field, one lit button, and the
   staff link at the foot. Rooms this device manages (a staff device with a
   saved credential) list between the form and the foot. */
.lobby {
  width: min(100% - 48px, 420px);
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding:
    max(64px, calc(env(safe-area-inset-top) + 40px))
    0
    max(32px, calc(env(safe-area-inset-bottom) + 20px));
  color: var(--pr-text);
  font-family: var(--r6-font-sans);
}

.lobby-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.lobby-brand__die {
  width: 80px;
  height: 80px;
}

.lobby-brand__word {
  margin: 0;
  color: var(--r6-pip);
  font: 800 40px/1 var(--r6-font-display);
  letter-spacing: -.02em;
}

.lobby-brand__tagline {
  margin: 0;
  color: var(--r6-mist);
  font-size: 16px;
  font-weight: 500;
}

.lobby-join {
  margin-top: 72px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lobby-join__label {
  color: var(--r6-mist);
  font-size: 15px;
  font-weight: 700;
}

.lobby-join .lobby-join__input {
  width: 100%;
  height: 76px;
  min-height: 76px;
  padding: 0 20px;
  border: 2px solid var(--r6-glow);
  border-radius: 18px;
  background: var(--r6-face);
  color: var(--r6-pip);
  font: 800 32px/1 var(--r6-font-display);
  letter-spacing: .14em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.lobby-join .lobby-join__input::placeholder {
  color: var(--r6-line-strong);
}

.lobby-join .lobby-join__input:focus {
  border-color: var(--r6-glow);
  outline: none;
  box-shadow: 0 0 0 4px var(--r6-glow-soft);
}

.lobby-join .lobby-join__input[data-invalid="true"] {
  border-color: var(--r6-danger);
}

.lobby-join__error {
  margin: 0;
  color: var(--r6-danger-text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.lobby-join__error:empty {
  display: none;
}

.lobby-join__submit {
  min-height: 60px;
  margin-top: 8px;
  border: 0;
  border-radius: 18px;
  background: var(--r6-glow);
  color: var(--r6-night);
  font: 900 20px/1 var(--r6-font-sans);
  transition: background-color var(--pr-motion-fast);
}

.lobby-join__submit:hover {
  background: var(--r6-glow-hover);
}

.lobby-join__submit:focus-visible {
  border: 0;
  outline: 3px solid var(--r6-glow-text);
  outline-offset: 3px;
  box-shadow: none;
}

.lobby-join__hint {
  margin: 14px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--r6-mist);
  font-size: 15px;
  line-height: 1.5;
}

.lobby-scan-icon {
  width: 22px;
  height: 22px;
  flex: none;
}

.lobby-footer {
  margin-top: auto;
  padding-top: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--r6-mist);
  font-size: 14px;
}

.lobby-footer__staff {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--r6-glow-text);
  text-underline-offset: 3px;
}

.lobby-footer__staff:hover {
  color: var(--r6-pip);
}

.lobby-footer__staff:focus-visible {
  outline: 3px solid var(--r6-glow-text);
  outline-offset: 2px;
  border-radius: 6px;
}

.managed-rooms {
  margin-top: 40px;
  display: grid;
  gap: 12px;
}

.managed-rooms[hidden] {
  display: none;
}

.managed-rooms__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.managed-rooms__heading h2 {
  margin: 0;
  color: var(--r6-mist);
  font-size: 14px;
  font-weight: 700;
}

.managed-rooms__count {
  color: var(--r6-mist);
  font: 500 13px/1 var(--r6-font-display);
}

.managed-room-list {
  display: grid;
  gap: 10px;
}

.managed-room-card {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 18px;
  border: 1px solid var(--r6-line);
  border-radius: 18px;
  background: var(--r6-face);
}

.managed-room-channel {
  min-width: 0;
  overflow: hidden;
  color: var(--r6-pip);
  font: 800 18px/1.1 var(--r6-font-display);
  letter-spacing: .06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.managed-room-actions {
  flex: none;
  display: flex;
  gap: 8px;
}

.managed-room-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--r6-line);
  border-radius: 12px;
  background: var(--r6-face-2);
  color: var(--r6-pip);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.managed-room-link--console {
  border-color: color-mix(in srgb, var(--r6-glow) 50%, var(--r6-line));
  color: var(--r6-glow-text);
}

.managed-room-link:hover {
  border-color: var(--r6-glow);
}

.managed-room-link:focus-visible {
  outline: 3px solid var(--r6-glow-text);
  outline-offset: 2px;
}

@media (max-height: 640px) {
  .lobby { padding-top: max(28px, calc(env(safe-area-inset-top) + 16px)); }
  .lobby-brand { gap: 10px; }
  .lobby-brand__die { width: 56px; height: 56px; }
  .lobby-join { margin-top: 32px; }
}

/* Reusable room Style picker */
.style-picker-dialog {
  width: min(calc(100% - 28px), 980px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--edge);
  border-radius: 22px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 34px 120px rgba(0, 0, 0, .62);
}

.style-picker-dialog::backdrop {
  background: rgba(3, 7, 12, .8);
  backdrop-filter: blur(5px);
}

.style-picker-heading,
.style-picker-preview__heading,
.style-picker-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.style-picker-heading { align-items: flex-start; }
.style-picker-heading .path-label { margin: 0 0 5px; }
.style-picker-title { margin: 0; font-size: clamp(30px, 5vw, 44px); letter-spacing: -.045em; }
.style-picker-intro { margin: 10px 0 22px; color: var(--muted); font-size: 14px; }

.style-picker-content {
  display: grid;
  grid-template-columns: minmax(250px, .8fr) minmax(0, 1.55fr);
  gap: 18px;
  align-items: stretch;
}

.style-picker-preview {
  min-height: 350px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-card);
  background: var(--pr-canvas);
  color: var(--pr-text);
  box-shadow: var(--pr-shadow);
  font-family: var(--pr-font-body);
  transition: border-radius var(--pr-motion-standard), background var(--pr-motion-standard), color var(--pr-motion-fast);
}

.style-picker-preview .meta-label { color: var(--pr-accent); font-family: var(--pr-font-mono); }
.style-picker-preview__name { color: var(--pr-text-muted); font-family: var(--pr-font-display); font-size: 13px; }
.style-picker-preview__panel { min-height: 0; display: grid; place-items: center; }

.panel-preview {
  width: min(100%, 270px);
  display: grid;
  justify-items: center;
  gap: 16px;
}

.panel-preview__readout {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-surface-1);
  color: var(--pr-text-muted);
  font: 700 11px/1 var(--pr-font-mono);
}

.panel-preview__base {
  position: relative;
  width: min(54vw, 190px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--pr-border);
  border-radius: 50%;
  background: var(--pr-surface-1);
  box-shadow: inset 0 0 0 13px var(--pr-surface-2), var(--pr-shadow);
}

.panel-preview__axis { position: absolute; background: var(--pr-border); opacity: .72; }
.panel-preview__axis--x { top: 50%; right: 15%; left: 15%; height: 1px; }
.panel-preview__axis--y { top: 15%; bottom: 15%; left: 50%; width: 1px; }
.panel-preview__stick {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30%;
  aspect-ratio: 1;
  border: 3px solid var(--pr-accent);
  border-radius: 50%;
  background: var(--pr-surface-2);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--pr-accent) 16%, transparent);
  transform: translate(-50%, -50%);
}

.panel-preview__caption {
  color: var(--pr-text);
  font-family: var(--pr-font-display);
  font-size: 15px;
  font-weight: 800;
}

.style-picker-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.style-picker-card {
  position: relative;
  min-width: 0;
  min-height: 92px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
  color: var(--ink);
  text-align: left;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.style-picker-card:hover { border-color: var(--muted); transform: translateY(-1px); }
.style-picker-card[aria-pressed="true"] { border-color: var(--accent); background: rgba(39, 230, 193, .065); }
.style-picker-card.is-current:not([aria-pressed="true"]) { border-color: color-mix(in srgb, var(--accent) 45%, var(--edge)); }

.style-picker-card__thumbnail {
  position: relative;
  width: 42px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-canvas);
}

.style-picker-card__thumbnail i { position: absolute; display: block; }
.style-picker-card__surface { inset: 7px; border-radius: var(--pr-radius-control); background: var(--pr-surface-1); box-shadow: var(--pr-shadow); }
.style-picker-card__control { right: 11px; bottom: 11px; width: 11px; height: 11px; border-radius: 50%; background: var(--pr-accent); }
.style-picker-card__signal { top: 12px; left: 11px; width: 12px; height: 2px; background: var(--pr-text); opacity: .8; }
.style-picker-card__copy { min-width: 0; display: grid; gap: 3px; }
.style-picker-card__name { display: -webkit-box; overflow: hidden; font-size: 12px; line-height: 1.2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.style-picker-card__description { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.style-picker-card__badge { position: absolute; top: 5px; right: 6px; color: var(--accent); font: 750 8px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .05em; text-transform: uppercase; }

.style-picker-feedback { min-height: 30px; padding-top: 8px; }
.style-picker-pending,
.style-picker-error { margin: 0; font-size: 12px; }
.style-picker-pending { color: var(--muted); }
.style-picker-error { color: var(--danger); }
.style-picker-actions { justify-content: flex-end; }
.style-picker-actions > * { width: auto; min-width: 144px; min-height: 48px; padding: 0 18px; }
.style-picker-apply:disabled { cursor: not-allowed; }

@media (max-width: 760px) {
  .style-picker-dialog { width: min(calc(100% - 18px), 620px); max-height: calc(100dvh - 18px); padding: 18px; }
  .style-picker-content { grid-template-columns: 1fr; }
  .style-picker-preview { min-height: 310px; }
  .style-picker-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .style-picker-card { min-height: 76px; }
}

@media (max-width: 430px) {
  .style-picker-card { grid-template-columns: 34px minmax(0, 1fr); padding: 8px; }
  .style-picker-card__thumbnail { width: 34px; }
  .style-picker-actions { align-items: stretch; flex-direction: column-reverse; }
  .style-picker-actions > * { width: 100%; min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .style-picker-preview,
  .style-picker-card { transition: none; }
  .style-picker-card:hover { transform: none; }
}

.panel-picker-dialog {
  width: min(calc(100% - 28px), 720px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--edge);
  border-radius: 22px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 34px 120px rgba(0, 0, 0, .62);
}

.panel-picker-dialog::backdrop {
  background: rgba(3, 7, 12, .8);
  backdrop-filter: blur(5px);
}

.panel-picker-heading,
.panel-picker-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-picker-heading { align-items: flex-start; }
.panel-picker-heading .path-label { margin: 0 0 5px; }
.panel-picker-title { margin: 0; font-size: clamp(26px, 4.4vw, 38px); letter-spacing: -.04em; }
.panel-picker-intro { margin: 10px 0 22px; color: var(--muted); font-size: 14px; }

.panel-picker-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.panel-picker-card {
  position: relative;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 84px;
  padding: 12px;
  border: 1px solid var(--edge);
  border-radius: var(--pr-radius-card, 18px);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease;
}

.panel-picker-card:hover { border-color: var(--muted); transform: translateY(-1px); }
.panel-picker-card[aria-pressed="true"] { border-color: var(--accent); background: rgba(39, 230, 193, .065); }
.panel-picker-card.is-current:not([aria-pressed="true"]) { border-color: color-mix(in srgb, var(--accent) 45%, var(--edge)); }
.panel-picker-card:disabled { cursor: not-allowed; opacity: .7; }

.panel-picker-card__thumbnail {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--pr-radius-control, 12px);
  background: var(--pr-surface-1, rgba(255, 255, 255, .04));
}

.panel-thumb .panel-preview { width: 100%; gap: 0; padding: 8px; }
.panel-thumb .panel-preview__readout,
.panel-thumb .panel-preview__caption { display: none; }
.panel-thumb .panel-preview__base { width: 100%; box-shadow: none; }
.panel-thumb .panel-preview__buttons { min-height: 0; gap: 5px; }
.panel-thumb .panel-preview__buttons--grid { grid-template-columns: repeat(2, 18px); gap: 4px; }
.panel-thumb .panel-preview__button { border-width: 1px; font-size: 8px; }
.panel-thumb .panel-preview__button--hero { width: 40px; }
.panel-thumb .panel-preview__button--round { width: 22px; }
.panel-thumb .panel-preview__button--tile { width: 18px; }
.panel-thumb .panel-preview__dpad { grid-template-columns: repeat(3, 16px); grid-template-rows: repeat(3, 16px); gap: 2px; }
.panel-thumb .panel-preview__button--dpad { font-size: 7px; }
.panel-thumb .panel-preview__stick { border-width: 2px; box-shadow: none; }
.panel-thumb .panel-preview__gamepad { min-height: 0; gap: 4px; }
.panel-thumb .panel-preview__gamepad .panel-preview__dpad { grid-template-columns: repeat(3, 10px); grid-template-rows: repeat(3, 10px); gap: 1px; }
.panel-thumb .panel-preview__gamepad .panel-preview__button--round { width: 14px; font-size: 6px; }
.panel-thumb .panel-preview__pads { min-height: 0; grid-template-columns: repeat(4, 10px); grid-auto-rows: 10px; gap: 3px; }
.panel-thumb .panel-preview__button--pad { width: 10px; height: 10px; border-radius: 2px; }
.panel-thumb .panel-preview__faders { min-height: 0; gap: 5px; }
.panel-thumb .panel-preview__fader { width: 8px; height: 44px; }
.panel-thumb .panel-preview__shake { min-height: 0; gap: 4px; }
.panel-thumb .panel-preview__shake-bar { width: 8px; height: 44px; }
.panel-thumb .panel-preview__shot { width: 8px; }
.panel-thumb .panel-preview__wheel { width: 46px; }
.panel-thumb .panel-preview__wheel-marker { width: 8px; }
.panel-thumb .panel-preview__tilt { width: 46px; }
.panel-thumb .panel-preview__surface { width: 54px; aspect-ratio: 1.2; }
.panel-thumb .panel-preview__touch { width: 12px; font-size: 6px; border-width: 1px; }
.panel-thumb .panel-preview__camera { width: 48px; }
.panel-thumb .panel-preview__mic { width: 48px; min-height: 0; gap: 4px; }
.panel-thumb .panel-preview__mic-bar { height: 7px; }
.panel-thumb .panel-preview__idle { width: 48px; min-height: 0; gap: 5px; }
.panel-thumb .panel-preview__idle-avatar { width: 24px; }
.panel-thumb .panel-preview__idle-line { height: 5px; }

.panel-picker-card__copy { min-width: 0; display: grid; gap: 3px; }
.panel-picker-card__name { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.panel-picker-card__description { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.panel-picker-card__badge { position: absolute; top: 6px; right: 8px; color: var(--accent); font: 750 8px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .05em; text-transform: uppercase; }

.panel-picker-feedback { min-height: 30px; padding-top: 8px; }
.panel-picker-pending,
.panel-picker-error { margin: 0; font-size: 12px; }
.panel-picker-pending { color: var(--muted); }
.panel-picker-error { color: var(--danger); }
.panel-picker-actions { justify-content: flex-end; margin-top: 8px; }
.panel-picker-actions > * { width: auto; min-width: 144px; min-height: 48px; padding: 0 18px; }
.panel-picker-apply:disabled { cursor: default; }
.panel-picker-apply.is-pending { cursor: progress; }
/* 「全部回到待機」 sits apart from cancel/apply: it acts on its own. */
.panel-picker-idle { margin-right: auto; }
.panel-picker-idle:disabled { cursor: default; }
.panel-picker-idle.is-pending { cursor: progress; }


.host-shell > .panel-picker-dialog {
  border-color: var(--pr-border);
  border-radius: var(--pr-radius-card);
  background: var(--pr-surface-1);
  color: var(--pr-text);
  box-shadow: var(--pr-shadow);
}

.host-shell > .panel-picker-dialog::backdrop {
  background: color-mix(in srgb, var(--pr-canvas) 82%, transparent);
}

.host-shell > .panel-picker-dialog .panel-picker-intro,
.host-shell > .panel-picker-dialog .panel-picker-card__description,
.host-shell > .panel-picker-dialog .panel-picker-pending { color: var(--pr-text-muted); }
.host-shell > .panel-picker-dialog .panel-picker-card { border-color: var(--pr-border); background: var(--pr-surface-2); color: var(--pr-text); }
.host-shell > .panel-picker-dialog .panel-picker-card[aria-pressed="true"] { border-color: var(--pr-accent); background: color-mix(in srgb, var(--pr-accent) 9%, var(--pr-surface-2)); }
.host-shell > .panel-picker-dialog .panel-picker-card__badge { color: var(--pr-accent); }

.admin-shell > .panel-picker-dialog {
  border-color: var(--admin-border);
  background: var(--admin-surface);
  color: var(--admin-text);
}

.admin-shell > .panel-picker-dialog::backdrop {
  background: color-mix(in srgb, var(--admin-canvas, #05070c) 82%, transparent);
}

.admin-shell > .panel-picker-dialog .panel-picker-intro,
.admin-shell > .panel-picker-dialog .panel-picker-card__description,
.admin-shell > .panel-picker-dialog .panel-picker-pending { color: var(--admin-muted); }
.admin-shell > .panel-picker-dialog .panel-picker-card { border-color: var(--admin-border); background: var(--admin-surface); color: var(--admin-text); }
.admin-shell > .panel-picker-dialog .panel-picker-card[aria-pressed="true"] { border-color: var(--admin-accent); background: color-mix(in srgb, var(--admin-accent) 9%, var(--admin-surface)); }
.admin-shell > .panel-picker-dialog .panel-picker-card__badge { color: var(--admin-accent); }

@media (max-width: 520px) {
  .panel-picker-list { grid-template-columns: 1fr; }
  .panel-picker-actions { align-items: stretch; flex-direction: column-reverse; }
  .panel-picker-actions > * { width: 100%; min-height: 48px; }
  .panel-picker-idle { margin-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .panel-picker-card { transition: none; }
  .panel-picker-card:hover { transform: none; }
}

/* Administrator signal console */
.admin-shell,
.admin-login-shell,
.admin-loading {
  --admin-canvas: var(--pr-canvas);
  --admin-surface: color-mix(in srgb, var(--pr-surface-1) 88%, transparent);
  --admin-surface-raised: color-mix(in srgb, var(--pr-surface-2) 92%, transparent);
  --admin-border: var(--pr-border);
  --admin-text: var(--pr-text);
  --admin-muted: var(--pr-text-muted);
  --admin-accent: var(--pr-accent);
}

.admin-shell {
  width: min(100% - 32px, 1320px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(30px, env(safe-area-inset-top)) 0 max(42px, env(safe-area-inset-bottom));
}

.admin-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: 3vh 0 26px;
  border-bottom: 1px solid var(--admin-border);
}

.admin-header h1,
.admin-login-card h1 {
  margin: 6px 0;
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.052em;
}

.admin-header p:not(.eyebrow),
.admin-login-copy,
.ephemeral-dialog > p {
  max-width: 52ch;
  margin: 0;
  color: var(--muted);
}

.admin-header-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-command-bar {
  position: sticky;
  z-index: 4;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 14px 0;
  background: color-mix(in srgb, var(--admin-canvas) 82%, transparent);
  backdrop-filter: blur(18px);
}

.admin-create-trigger {
  width: auto;
  min-width: 176px;
  padding: 0 20px;
}

.admin-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) minmax(150px, .8fr) minmax(150px, .8fr) auto;
  align-items: end;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--admin-border);
  border-radius: 18px;
  background: var(--admin-surface);
  box-shadow: var(--pr-shadow);
}

.admin-filters input,
.admin-filters select,
.admin-dialog input,
.admin-dialog select,
.admin-login-card input,
.room-detail input,
.room-detail select {
  min-height: 46px;
}

.admin-filters input,
.admin-dialog input:not(#createChannel),
.admin-login-card input {
  letter-spacing: normal;
  text-transform: none;
}

.admin-filters .secondary-action {
  min-height: 46px;
  padding: 0 18px;
}

.admin-room-section {
  margin-top: 32px;
}

.admin-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.admin-section-heading h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -.035em;
}

.admin-section-heading > p {
  margin: 0 0 4px;
  color: var(--muted);
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.admin-room-list {
  position: relative;
  display: grid;
  padding-left: 28px;
}

.admin-room-list::before {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 8px;
  width: 1px;
  background: linear-gradient(var(--admin-accent), var(--admin-border) 25%, var(--admin-border) 80%, transparent);
  content: "";
}

.admin-room-row {
  position: relative;
  border: 1px solid var(--admin-border);
  border-bottom: 0;
  background: var(--admin-surface);
  backdrop-filter: blur(20px) saturate(1.08);
}

.admin-room-row:first-child { border-radius: 18px 18px 0 0; }
.admin-room-row:last-child { border-bottom: 1px solid var(--edge); border-radius: 0 0 18px 18px; }
.admin-room-row:only-child { border-radius: 18px; }

.room-bus-node {
  position: absolute;
  top: 26px;
  left: -25px;
  z-index: 1;
}

.room-bus-node i {
  display: block;
  width: 11px;
  height: 11px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 4px rgba(39, 230, 193, .07);
}

.room-summary {
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(170px, 1.4fr) minmax(90px, .65fr) minmax(142px, 1fr) minmax(88px, .65fr) minmax(155px, 1.15fr) 24px;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  border: 0;
  background: transparent;
  color: var(--admin-text);
  text-align: left;
}

.room-summary:hover:not(:disabled) { background: rgba(39, 230, 193, .035); }
.room-summary:disabled { cursor: default; opacity: .62; }

.room-summary > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.room-summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.room-summary b,
.room-summary strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-identity strong {
  color: var(--admin-accent);
  font: 850 15px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .05em;
}

.status-dot::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}

.status-dot[data-state="active"]::before { background: var(--accent); box-shadow: 0 0 10px rgba(39, 230, 193, .55); }
.status-dot[data-state="expired"]::before { background: var(--warning); }
.status-dot[data-state="deleted"]::before { background: var(--danger); }

.room-chevron {
  color: var(--admin-accent);
  font-style: normal;
  font-size: 18px;
  transition: transform .16s ease;
}

.room-summary[aria-expanded="true"] .room-chevron { transform: rotate(45deg); }

.room-detail {
  padding: 18px;
  border-top: 1px solid var(--admin-border);
  background: color-mix(in srgb, var(--admin-canvas) 92%, transparent);
}

.room-live-state {
  color: var(--muted);
  font-size: 13px;
}

.detail-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  background: var(--admin-border);
}

.detail-status-grid > div {
  display: grid;
  gap: 5px;
  padding: 14px;
  background: var(--admin-surface-raised);
}

.detail-status-grid span { color: var(--muted); font-size: 11px; }
.detail-status-grid strong { font-size: 13px; }
.display-state[data-state="live"] { color: var(--accent); }

.admin-host-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--admin-border);
  border-radius: 14px;
}

.admin-host-entry p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-host-entry .secondary-action {
  min-height: 46px;
  flex: 0 0 auto;
  text-decoration: none;
}

/* 開啟中控 leads: the show console is what an operator runs the event from. */
.admin-host-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 0 0 auto;
}

.admin-host-links > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-host-links .admin-console-link {
  min-width: 140px;
  min-height: 46px;
  margin-top: 0;
  padding: 0 18px;
}

.admin-detail-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr;
  gap: 14px;
  margin-top: 14px;
}

.admin-detail-actions > * {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--admin-border);
  border-radius: 14px;
}

.expiry-form,
.realtime-form,
.credential-actions,
.admin-delete-zone,
.admin-detail-style {
  display: grid;
  align-content: start;
  gap: 10px;
}

.admin-detail-style-value,
.admin-style-value {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.admin-style-swatch {
  position: relative;
  width: 46px;
  height: 34px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-canvas);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pr-text) 6%, transparent);
}

.admin-style-swatch i { position: absolute; display: block; }
.admin-style-swatch__surface { inset: 5px; border-radius: var(--pr-radius-control); background: var(--pr-surface-1); box-shadow: var(--pr-shadow); }
.admin-style-swatch__control { right: 8px; bottom: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--pr-accent); }
.admin-style-swatch__signal { top: 9px; left: 8px; width: 12px; height: 2px; background: var(--pr-text); opacity: .84; }
.admin-style-copy { min-width: 0; display: grid; gap: 1px; }
.admin-style-copy b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.admin-style-copy small { color: var(--admin-muted); font-size: 9px; letter-spacing: 0; text-transform: none; }
.admin-detail-style-value { min-height: 46px; }
.admin-detail-style .admin-style-swatch { width: 58px; height: 42px; }
.admin-detail-style .secondary-action { margin-top: auto; }

.admin-detail-panel {
  display: grid;
  align-content: start;
  gap: 10px;
}

.admin-detail-panel-value { min-width: 0; display: grid; gap: 2px; min-height: 46px; align-content: center; }
.admin-detail-panel-value small { color: var(--admin-muted); font-size: 9px; }
.admin-detail-panel-name { overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.admin-detail-panel .secondary-action { margin-top: auto; }

.expiry-form label,
.realtime-form label,
.admin-delete-zone label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.realtime-status {
  min-height: 34px;
  margin: 0;
  color: var(--admin-muted);
  font-size: 11px;
  line-height: 1.5;
}

.credential-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.credential-actions p b { color: var(--admin-text); font-size: 13px; }

/* 「產生中控連結」 armed by a first click: the second one signs devices out. */
.credential-actions .mint-console-link[data-armed="true"] {
  border-color: var(--danger);
  color: color-mix(in srgb, var(--danger) 72%, var(--admin-text));
}
.credential-actions .mint-console-warning { color: color-mix(in srgb, var(--danger) 72%, var(--admin-text)); }
.credential-actions .mint-console-warning:empty { display: none; }

.admin-display-url,
.ephemeral-dialog .admin-link-label + code {
  display: block;
  max-height: 96px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--accent);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.admin-console-qr { display: grid; justify-items: center; gap: 8px; margin: 16px 0 0; }
.admin-console-qr img { width: min(220px, 70vw); aspect-ratio: 1; border-radius: 12px; background: #fff; }
.admin-console-qr figcaption { color: var(--admin-muted); font-size: 12px; }
.ephemeral-dialog .admin-link-label { margin: 14px 0 0; color: var(--admin-muted); font-size: 12px; }
.ephemeral-dialog .admin-link-label + code { margin: 6px 0 0; }
.admin-link-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-display-url[hidden],
.admin-link-actions[hidden],
.admin-console-qr [hidden] { display: none; }
.admin-link-actions > * { flex: 1 1 140px; text-decoration: none; }
.admin-link-actions > a { display: inline-flex; align-items: center; justify-content: center; }
#consoleLinkDialog .dialog-actions { margin-top: 18px; }

/* The event editor gets the whole row: a show is long JSON. */
.event-form {
  grid-column: 1 / -1;
  display: grid;
  align-content: start;
  gap: 10px;
}

.event-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }

.event-editor {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--admin-text);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2;
}

.event-status { min-height: 18px; margin: 0; color: var(--admin-muted); font-size: 12px; }
.event-errors { margin: 0; padding-left: 18px; color: var(--danger); font-size: 12px; line-height: 1.6; }
.event-errors:empty { display: none; }
.event-form small { color: var(--admin-muted); font-size: 11px; }
.event-theme { max-width: 280px; }
/* 「只用手機」 (D25), in the create dialog and the event editor: a box beside
   its text, not the full-width input look every other field gets. */
.admin-dialog .admin-check,
.event-form .admin-check {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-height: 44px;
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.admin-check input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: 0;
  flex: none;
  margin: 0;
  padding: 0;
  accent-color: var(--admin-accent);
  cursor: pointer;
}
/* Warnings never block saving; they name ids the big screen will not find. */
.event-warnings { margin: 0; padding-left: 18px; color: var(--warning, #d9a441); font-size: 12px; line-height: 1.6; }
.event-warnings:empty { display: none; }
/* 節目單: checkboxes in the create dialog, a list with buttons in the event
   editor (both write show.items). Buttons keep 44 px touch targets. */
.create-show { min-width: 0; margin: 0; padding: 0; border: 0; }
.create-show legend { padding: 0; margin-bottom: 8px; }
.create-show-options { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.show-items { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.show-item { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; border: 1px solid var(--admin-border); border-radius: 10px; }
.show-item-name { flex: 1; min-width: 0; color: var(--admin-text); font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.show-items-note { color: var(--admin-muted); font-size: 12px; }
.show-add { display: flex; flex-wrap: wrap; gap: 8px; }
.show-editor .secondary-action { min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.show-editor .secondary-action:disabled { opacity: .35; cursor: default; }
.game-catalogue { border: 1px solid var(--admin-border); border-radius: 10px; padding: 10px 12px; font-size: 12px; }
.game-catalogue > summary { min-height: 32px; display: flex; align-items: center; cursor: pointer; font-weight: 700; color: var(--admin-text); }
.game-catalogue-list { display: grid; gap: 12px; margin-top: 8px; color: var(--admin-muted); line-height: 1.6; }
.game-catalogue-list p { margin: 0; }
.game-catalogue-entry h4 { margin: 0 0 4px; color: var(--admin-text); font-size: 13px; }
.game-catalogue-entry ul { margin: 4px 0 0; padding-left: 18px; }
.game-catalogue code { font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--admin-text); overflow-wrap: anywhere; }

.admin-detail-actions .secondary-action,
.admin-detail-actions .danger-button {
  min-height: 46px;
}

.admin-list-footer {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 18px;
}

.admin-list-footer .secondary-action { min-width: 160px; padding: 0 20px; }

.admin-login-shell,
.admin-loading {
  width: min(100% - 32px, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: max(32px, env(safe-area-inset-top)) 0 max(32px, env(safe-area-inset-bottom));
}

.admin-login-card {
  width: 100%;
  display: grid;
  gap: 18px;
  padding: clamp(24px, 6vw, 42px);
  border: 1px solid var(--admin-border);
  border-radius: 26px;
  background: var(--admin-surface-raised);
  color: var(--admin-text);
  box-shadow: var(--pr-shadow);
}

.admin-login-card .home-link { justify-self: start; }

.admin-signal-mark {
  display: grid;
  grid-template-columns: 9px minmax(60px, 150px) 9px;
  align-items: center;
  gap: 8px;
  width: fit-content;
}

.admin-signal-mark i {
  width: 9px;
  height: 9px;
  border: 2px solid var(--admin-accent);
  border-radius: 50%;
}

.admin-signal-mark span { height: 1px; background: linear-gradient(90deg, var(--admin-accent), var(--admin-border)); }
.admin-loading { color: var(--admin-muted); align-content: center; justify-items: center; gap: 12px; }

.admin-dialog {
  width: min(calc(100% - 28px), 540px);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--admin-border);
  border-radius: 22px;
  background: var(--admin-surface-raised);
  color: var(--admin-text);
  box-shadow: var(--pr-shadow);
}

.admin-shell > .style-picker-dialog {
  border-color: var(--admin-border);
  border-radius: var(--pr-radius-card);
  background: var(--admin-surface-raised);
  color: var(--admin-text);
  box-shadow: var(--pr-shadow);
}

.admin-shell > .style-picker-dialog::backdrop {
  background: color-mix(in srgb, var(--admin-canvas) 82%, transparent);
}

.admin-shell > .style-picker-dialog .style-picker-intro,
.admin-shell > .style-picker-dialog .style-picker-card__description,
.admin-shell > .style-picker-dialog .style-picker-pending { color: var(--admin-muted); }
.admin-shell > .style-picker-dialog .style-picker-card { border-color: var(--admin-border); background: var(--admin-surface); color: var(--admin-text); }
.admin-shell > .style-picker-dialog .style-picker-card[aria-pressed="true"] { border-color: var(--admin-accent); background: color-mix(in srgb, var(--admin-accent) 9%, var(--admin-surface)); }
.admin-shell > .style-picker-dialog .style-picker-card__badge { color: var(--admin-accent); }

.admin-dialog::backdrop { background: color-mix(in srgb, var(--admin-canvas) 82%, transparent); backdrop-filter: blur(5px); }
.admin-dialog form { margin: 0; }

.dialog-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.dialog-heading h2 { margin: 0; font-size: 28px; letter-spacing: -.035em; }

.dialog-close {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
}

.ephemeral-dialog code {
  display: block;
  max-height: 150px;
  overflow: auto;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--edge));
  border-radius: 12px;
  background: var(--bg);
  color: var(--accent);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.dialog-actions > * { flex: 1; }

@media (max-width: 960px) {
  .room-summary { grid-template-columns: minmax(160px, 1.4fr) minmax(82px, .6fr) minmax(140px, 1fr) minmax(70px, .6fr) 24px; }
  .room-expiry { display: none !important; }
  .admin-detail-actions { grid-template-columns: 1fr 1fr; }
  .admin-delete-zone { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .admin-shell { width: min(100% - 20px, 1320px); padding-top: max(18px, env(safe-area-inset-top)); }
  .admin-header { align-items: start; flex-direction: column; padding-top: 0; }
  .admin-header h1 { font-size: 38px; }
  .admin-header-actions { width: 100%; justify-content: space-between; }
  .admin-host-entry { align-items: stretch; flex-direction: column; }
  .admin-command-bar { align-items: stretch; flex-direction: column; }
  .admin-create-trigger { width: 100%; }
  .admin-filters { grid-template-columns: 1fr 1fr; }
  .filter-query { grid-column: 1 / -1; }
  .admin-filters > button { grid-column: 1 / -1; }
  .admin-room-list { padding-left: 20px; }
  .admin-room-list::before { left: 5px; }
  .room-bus-node { left: -19px; }
  .room-summary {
    grid-template-columns: minmax(0, 1fr) minmax(112px, .7fr) auto 22px;
    gap: 10px;
    padding: 14px;
  }
  .room-summary > span:not(.room-identity):not(.room-style-cell):not(:has(.status-dot)) { display: none; }
  .room-style-cell > small { display: none; }
  .admin-style-swatch { width: 38px; height: 30px; }
  .admin-style-copy b { font-size: 11px; }
  .admin-style-fallback { display: none; }
  .room-summary .status-dot { font-size: 0; }
  .room-summary .status-dot::before { margin: 0; }
  .detail-status-grid,
  .admin-detail-actions { grid-template-columns: 1fr; }
  .admin-delete-zone { grid-column: auto; }
  .dialog-actions { align-items: stretch; flex-direction: column; }
}

html[data-style="soft-control-surface"],
html[data-style="neumorphic-console"],
html[data-style="neo-brutal-broadcast"],
html[data-style="playful-console"],
html[data-style="storybook-playground"],
html[data-style="sweet-pop"],
html[data-style="gallery-nouveau"],
html[data-style="editorial-street"] {
  color-scheme: light;
}

/* ==========================================================================
   Phone controller (ROLL6 mockups PhoneName / PhoneWait / PhoneTap /
   PhoneQuiz / PhoneResult). One screen does one thing: a slim header, the
   stage, and connection trouble only when something is wrong. Surfaces use
   the --pr-* tokens (themes.css [data-style="roll6"]); brand-fixed things
   (the display face for numbers, spark, answer colours) read --r6-*.
   ========================================================================== */
html[data-style] body:has(.controller-shell) {
  background: var(--pr-canvas);
  color: var(--pr-text);
}

.controller-shell {
  --controller-pad-size: min(88vw, 70dvh, 620px);
  position: relative;
  isolation: isolate;
  height: 100dvh;
  /* clip, not just hidden: a hidden-overflow box is still scrollable, so
     focusing the nickname input could scroll the whole controller sideways
     and leave it there. clip makes the shell no scroll container at all;
     hidden stays as the fallback for browsers without clip (controller.js
     also resets the scroll). */
  overflow: hidden;
  overflow: clip;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* Header and stage. The notices, the control overlay and the name step all
     share the stage row rather than owning one: a row that came and went
     would resize the stage (and the panels read their geometry) under the
     player's thumb. */
  grid-template-rows: auto minmax(0, 1fr);
  row-gap: 12px;
  padding:
    max(20px, calc(env(safe-area-inset-top) + 8px))
    max(24px, calc(env(safe-area-inset-right) + 12px))
    max(28px, calc(env(safe-area-inset-bottom) + 12px))
    max(24px, calc(env(safe-area-inset-left) + 12px));
  background: var(--pr-canvas);
  color: var(--pr-text);
  font-family: var(--r6-font-sans);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Several blocks here are display: grid/flex, which would beat the
   browser's own [hidden] rule. */
.controller-shell [hidden] {
  display: none !important;
}

/* Light sea: the display drives this layer's colour so a room of phones reads
   as one instrument. It rides at z-index -1, over the shell's background but
   under the panel, so the phone can glow and still be played. Never accepts
   colour as text; see light-stick.js. */
.light-stick {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--pr-motion-standard), background-color var(--pr-motion-standard);
}

.light-stick[data-on="true"] { opacity: 1; }

/* The header: the event (die + name) on the waiting screen, the name step and
   every notice; the player (avatar + name) and the current item in a game
   and on a round's result. */
.controller-header {
  min-width: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.controller-header__brand,
.controller-header__player {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.controller-brand-mark {
  width: 26px;
  height: 26px;
  flex: none;
}

.controller-header__event,
.controller-header__name {
  min-width: 0;
  overflow: hidden;
  color: var(--pr-text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.controller-header__event[data-fallback="true"] {
  font-family: var(--r6-font-display);
  font-weight: 800;
  letter-spacing: -.02em;
}

.controller-header__name[data-hidden="true"] {
  text-decoration: line-through;
  text-decoration-color: var(--pr-text-muted);
}

.controller-header__disc {
  width: 34px;
  height: 34px;
}

.controller-header__item {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--pr-text-muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.controller-shell[data-header="brand"] .controller-header__player,
.controller-shell[data-header="brand"] .controller-header__item,
.controller-shell[data-header="player"] .controller-header__brand {
  display: none;
}

/* The player's avatar everywhere on the phone (components/avatar.js): their
   colour, the icon in the ink the palette picked for it. */
.avatar-disc {
  flex: none;
  width: 40px;
  aspect-ratio: 1;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  line-height: 0;
}

.avatar-disc > .avatar-icon {
  width: 55%;
  height: 55%;
}

.controller-stage {
  grid-row: 2;
  grid-column: 1;
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  /* Panels size against this box, not the viewport. The shell is
     `overflow: hidden`, so a vw/dvh-based control silently loses its edges
     in landscape, where this box is barely 300px tall. */
  container: stage / size;
}

/* Connection trouble, a short local notice and the big screen's messages.
   They overlay the top of the stage in its own grid cell, so they cost the
   panel no height, and taps fall through to the controls beneath (only the
   dock's expand toggle takes them back). */
.controller-notices {
  z-index: 6;
  grid-row: 2;
  grid-column: 1;
  align-self: start;
  min-width: 0;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.connection-banner {
  min-height: 44px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--r6-danger) 45%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--r6-danger) 18%, var(--r6-night));
  color: var(--r6-danger-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .4);
}

.connection-banner::before {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--r6-danger);
  content: "";
}

.controller-toast {
  justify-self: center;
  max-width: 100%;
  margin: 0;
  padding: 10px 16px;
  border: 1px solid var(--pr-border);
  border-radius: 16px;
  background: var(--r6-face-2);
  color: var(--pr-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .4);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity var(--pr-motion-standard), transform var(--pr-motion-standard);
}

.controller-toast:empty {
  display: none;
}

.controller-toast[data-visible="true"] {
  opacity: 1;
  transform: none;
}

.message-dock-slot {
  min-width: 0;
}

.message-dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  padding: 14px 16px;
  border: 1px solid var(--pr-border);
  border-radius: 18px;
  background: var(--pr-surface-1);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}

/* No message, no dock: it only exists while the big screen has something to say. */
.message-dock[data-has-message="false"] {
  display: none;
}

.message-dock__label {
  grid-column: 1;
  color: var(--pr-text-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.message-dock__text {
  grid-column: 1;
  min-width: 0;
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: var(--pr-text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Expanded, a long message scrolls inside the dock instead of running off
   the bottom of the shell. */
.message-dock[data-expanded="true"] .message-dock__text {
  display: block;
  max-height: min(52dvh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
  touch-action: pan-y;
}

.message-dock__toggle {
  /* Takes back the taps the notices let through. */
  pointer-events: auto;
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 56px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--pr-border);
  border-radius: 12px;
  background: var(--r6-face-2);
  color: var(--r6-glow-text);
  font-size: 14px;
  font-weight: 700;
}

/* Staff hold control (paused, someone else's turn): covers the stage, which
   stays mounted and inert underneath. */
.control-overlay {
  z-index: 3;
  grid-row: 2;
  grid-column: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  /* Opaque: the lit controls underneath would otherwise glow through. */
  background: var(--pr-canvas);
  text-align: center;
}

.control-overlay__card {
  max-width: 30ch;
  display: grid;
  justify-items: center;
  gap: clamp(8px, 2vh, 14px);
}

.control-overlay__status {
  margin: 0;
  color: var(--pr-text);
  font-size: clamp(22px, 5vh, 30px);
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.control-overlay__status.is-entering {
  animation: control-status-fade-up var(--pr-motion-standard) ease-out both;
}

@keyframes control-status-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.control-overlay__lock {
  position: relative;
  width: clamp(44px, 9vh, 64px);
  aspect-ratio: 1;
  border: 1px solid var(--pr-border);
  border-radius: 50%;
  background: var(--r6-face-2);
}

.control-overlay__lock::before {
  position: absolute;
  top: 22%;
  left: 50%;
  width: 36%;
  height: 32%;
  border: 2px solid var(--pr-text-muted);
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  content: "";
  transform: translateX(-50%);
}

.control-overlay__lock span {
  position: absolute;
  top: 46%;
  bottom: 22%;
  left: 50%;
  width: 48%;
  border-radius: 4px;
  background: var(--pr-text-muted);
  transform: translateX(-50%);
}

.control-overlay__copy {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.control-overlay__label {
  margin: 0;
  color: var(--pr-text-muted);
  font-size: 14px;
  font-weight: 700;
}

.control-overlay h2 {
  margin: 0;
  color: var(--pr-text);
  font-size: clamp(22px, 5vh, 28px);
  font-weight: 900;
  line-height: 1.3;
}

.control-overlay__detail {
  margin: 0;
  color: var(--pr-text-muted);
  font-size: 17px;
  line-height: 1.5;
}

/* Joining, dead ends (room gone, full, rejected) and the queue: centred
   copy on the stage, sized by cqh so the ~300px landscape stage keeps its
   way out on screen. */
.controller-loading,
.controller-notice,
.controller-queue {
  width: min(100%, 360px);
  display: grid;
  justify-items: center;
  gap: clamp(8px, 2.4cqh, 14px);
  text-align: center;
}

.controller-loading__text {
  margin: 0;
  color: var(--pr-text-muted);
  font-size: 17px;
  font-weight: 700;
}

.controller-notice-title {
  margin: 0;
  color: var(--pr-text);
  font-size: clamp(22px, 8cqh, 28px);
  font-weight: 900;
  line-height: 1.3;
}

.controller-notice-body {
  margin: 0;
  max-width: 22em;
  color: var(--pr-text-muted);
  font-size: clamp(14px, 5cqh, 17px);
  line-height: 1.6;
}

.controller-notice-actions {
  width: 100%;
  display: grid;
  gap: 10px;
  margin-top: clamp(0px, 2cqh, 8px);
}

.controller-notice-action {
  min-height: max(48px, min(60px, 17cqh));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border: 0;
  border-radius: 18px;
  background: var(--pr-accent);
  color: var(--pr-on-accent);
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.controller-notice-secondary {
  min-height: 48px;
  border: 1px solid var(--pr-border);
  background: transparent;
  color: var(--pr-text);
  font-size: 16px;
  font-weight: 700;
}

.controller-queue__label {
  margin: 0;
  color: var(--pr-text-muted);
  font-size: 15px;
  font-weight: 700;
}

.controller-queue__position {
  color: var(--pr-text);
  font: 800 clamp(48px, 26cqh, 128px)/1 var(--r6-font-display);
  letter-spacing: -.04em;
}

.controller-queue__body {
  margin: 0;
  max-width: 22em;
  color: var(--pr-text);
  font-size: clamp(14px, 5cqh, 17px);
  font-weight: 700;
  line-height: 1.5;
}

.controller-queue__hint {
  margin: 0;
  max-width: 24em;
  color: var(--pr-text-muted);
  font-size: clamp(12px, 4cqh, 14px);
  line-height: 1.5;
}

.controller-queue__edit,
.idle-panel__edit {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--pr-text-muted);
  font-size: 15px;
  font-weight: 700;
}

.controller-queue__edit:hover,
.idle-panel__edit:hover {
  color: var(--pr-text);
}

/* --------------------------------------------------------------------------
   Waiting screen (idle panel, PhoneWait) and a round's result (PhoneResult).
   Nothing to press but 「改名字或頭像」, so the whole stage is a name card.
   Every size is capped by cqh: the landscape stage is ~300px tall.
   -------------------------------------------------------------------------- */
.idle-panel {
  width: 100%;
  /* A phone never reaches it; a laptop opening the link keeps a composed card. */
  max-width: 960px;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 5cqh, 48px);
  padding-top: clamp(0px, 4cqh, 36px);
}

.idle-panel__me {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.8cqh, 14px);
  text-align: center;
}

/* The player colour ring: night gap, then colour (PhoneWait). */
.idle-panel__avatar {
  flex: none;
  width: clamp(64px, 17cqh, 128px);
  aspect-ratio: 1;
  display: grid;
  border-radius: 50%;
  box-shadow: 0 0 0 6px var(--pr-canvas), 0 0 0 9px var(--player-color, var(--pr-border));
}

.idle-panel__avatar .avatar-disc {
  width: 100%;
}

.idle-panel__avatar .avatar-icon {
  stroke-width: 2;
}

.idle-panel__name {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--pr-text);
  font-size: clamp(22px, 4.8cqh, 36px);
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idle-panel__meta,
.idle-panel__note {
  margin: 0;
  color: var(--pr-text-muted);
  font-size: 15px;
  line-height: 1.4;
}

.idle-panel__next,
.idle-panel__finished {
  display: grid;
  gap: clamp(8px, 2cqh, 16px);
  padding: clamp(14px, 2.8cqh, 20px);
  border: 1px solid var(--pr-border);
  border-radius: 24px;
  background: var(--pr-surface-1);
}

.idle-panel__next-label {
  margin: 0;
  color: var(--pr-text-muted);
  font-size: 14px;
  font-weight: 700;
}

.idle-panel__next-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.idle-panel__die {
  flex: none;
  width: clamp(44px, 8cqh, 60px);
  aspect-ratio: 1;
}

.idle-panel__die--small {
  width: clamp(40px, 7cqh, 52px);
}

.idle-panel__die > svg {
  display: block;
  width: 100%;
  height: 100%;
}

.idle-panel__next-copy,
.idle-panel__upcoming-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.idle-panel__next-number {
  margin: 0;
  color: var(--r6-glow-text);
  font-size: 14px;
  font-weight: 700;
}

.idle-panel__next-name {
  margin: 0;
  overflow: hidden;
  color: var(--pr-text);
  font-size: clamp(20px, 3.6cqh, 26px);
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idle-panel__next-hint {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: var(--pr-text);
  font-size: clamp(15px, 2.4cqh, 17px);
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.idle-panel__foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 2cqh, 16px);
}

.idle-panel__status {
  max-width: 100%;
  min-height: 40px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 20px;
  background: var(--r6-glow-soft);
  color: var(--r6-glow-text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.idle-panel__status-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--r6-glow);
}

/* One line in spirit; a long one (up to 120 characters) may wrap once. */
.idle-panel__status-text {
  min-width: 0;
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.idle-panel__finished {
  text-align: center;
}

.idle-panel__finished-title {
  margin: 0;
  color: var(--pr-text);
  font-size: clamp(20px, 4cqh, 26px);
  font-weight: 900;
  line-height: 1.3;
}

.idle-panel__finished-note {
  margin: 0;
  color: var(--pr-text-muted);
  font-size: 15px;
}

.idle-panel__result {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.idle-panel__summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: clamp(0px, 5cqh, 48px);
  text-align: center;
}

.idle-panel__result-title {
  margin: 0;
  color: var(--pr-text-muted);
  font-size: 18px;
  font-weight: 700;
}

.idle-panel__rank {
  margin: clamp(4px, 1.6cqh, 12px) 0 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.idle-panel__rank-word {
  color: var(--pr-text);
  font-size: clamp(22px, 4.4cqh, 32px);
  font-weight: 900;
}

.idle-panel__rank-number {
  color: var(--r6-spark);
  font: 800 clamp(56px, 17cqh, 128px)/1 var(--r6-font-display);
  letter-spacing: -.04em;
}

.idle-panel__rank[data-digits="3"] .idle-panel__rank-number {
  font-size: clamp(48px, 12cqh, 88px);
}

.idle-panel__score {
  margin: clamp(4px, 1.6cqh, 12px) 0 0;
  color: var(--pr-text);
  font-size: clamp(17px, 2.8cqh, 20px);
  font-weight: 700;
}

.idle-panel__score-number {
  color: var(--r6-spark);
  font-weight: 700;
}

.idle-panel__result-note {
  margin: 8px 0 0;
  color: var(--pr-text-muted);
  font-size: 15px;
}

.idle-panel__upcoming {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: clamp(12px, 2.4cqh, 18px) 20px;
  border: 1px solid var(--pr-border);
  border-radius: 22px;
  background: var(--pr-surface-1);
}

.idle-panel__upcoming-number,
.idle-panel__upcoming-hint {
  margin: 0;
  color: var(--pr-text-muted);
  font-size: 14px;
}

.idle-panel__upcoming-name {
  margin: 0;
  overflow: hidden;
  color: var(--pr-text);
  font-size: 20px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Landscape: the name card on the left, the next game and the status on the
   right; a result spreads across both. */
@media (orientation: landscape) {
  .controller-shell {
    row-gap: 8px;
    padding-top: max(12px, calc(env(safe-area-inset-top) + 4px));
    padding-bottom: max(12px, calc(env(safe-area-inset-bottom) + 4px));
  }

  .idle-panel {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: clamp(16px, 5cqw, 56px);
    row-gap: clamp(6px, 3cqh, 14px);
    padding-top: 0;
  }

  .idle-panel__me { grid-column: 1; grid-row: 1 / -1; }
  .idle-panel__avatar { width: clamp(56px, 32cqh, 128px); }
  .idle-panel__name { font-size: clamp(20px, 9cqh, 36px); }
  .idle-panel__next,
  .idle-panel__finished { grid-column: 2; grid-row: 1; }
  .idle-panel__die { width: clamp(40px, 15cqh, 60px); }
  .idle-panel__next-name { font-size: clamp(18px, 7cqh, 26px); }
  .idle-panel__next-hint { font-size: clamp(14px, 5cqh, 17px); line-height: 1.45; -webkit-line-clamp: 2; }

  .idle-panel__foot {
    grid-column: 2;
    grid-row: 2;
    margin-top: 0;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .idle-panel__result {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: clamp(16px, 5cqw, 56px);
  }

  .idle-panel__summary { padding-top: 0; }
  .idle-panel__rank-number { font-size: clamp(48px, 30cqh, 128px); }
  .idle-panel__rank[data-digits="3"] .idle-panel__rank-number { font-size: clamp(44px, 24cqh, 96px); }
  .idle-panel__rank-word { font-size: clamp(20px, 9cqh, 32px); }
  .idle-panel__upcoming { margin-top: 0; max-width: 44%; }
}

/* --------------------------------------------------------------------------
   Name and avatar step (profile-sheet.js, PhoneName). It fills the stage
   row; the form scrolls and the two buttons stay at the foot.
   -------------------------------------------------------------------------- */
.profile-sheet {
  z-index: 4;
  grid-row: 2;
  grid-column: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--pr-canvas);
  outline: none;
}

.profile-sheet__form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-sheet__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* The shell refuses touch panning (a stray swipe must not scroll a
     controller); this list is the one thing that has to scroll. */
  touch-action: pan-y;
  padding: 2px 2px 8px;
}

.profile-sheet__title {
  margin: clamp(8px, 4cqh, 32px) 0 0;
  color: var(--pr-text);
  font-size: 28px;
  font-weight: 900;
  line-height: 1.3;
}

.profile-sheet__lead {
  margin: 6px 0 0;
  color: var(--pr-text-muted);
  font-size: 15px;
  line-height: 1.5;
}

.profile-sheet__label {
  margin-top: 28px;
  padding: 0;
  color: var(--pr-text-muted);
  font-size: 14px;
  font-weight: 700;
}

.profile-sheet__field {
  height: 60px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border: 2px solid var(--pr-accent);
  border-radius: 16px;
  background: var(--pr-surface-1);
}

.profile-sheet__field:focus-within {
  box-shadow: 0 0 0 4px var(--r6-glow-soft);
}

.profile-sheet__field .profile-sheet__input {
  flex: 1;
  width: auto;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--pr-text);
  /* 16px or more keeps iOS Safari from zooming the page on focus. */
  font: 700 22px/1.2 var(--r6-font-sans);
  letter-spacing: normal;
  text-transform: none;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.profile-sheet__field .profile-sheet__input:focus {
  outline: none;
  box-shadow: none;
}

.profile-sheet__input::placeholder {
  color: var(--r6-line-strong);
}

.profile-sheet__count {
  flex: none;
  color: var(--pr-text-muted);
  font-size: 13px;
  font-weight: 500;
}

.profile-sheet__count[data-over="true"] {
  color: var(--r6-danger-text);
}

.profile-sheet__hint {
  margin: 8px 0 0;
  color: var(--r6-danger-text);
  font-size: 14px;
  font-weight: 700;
}

.profile-sheet__hint:empty {
  display: none;
}

.profile-sheet__avatars {
  min-width: 0;
  margin: 24px 0 0;
  padding: 0;
  border: 0;
}

.profile-sheet__avatars > legend {
  margin: 0 0 10px;
}

.profile-sheet__avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.profile-avatar {
  position: relative;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid var(--pr-border);
  border-radius: 20px;
  background: var(--pr-surface-1);
  cursor: pointer;
}

.profile-avatar input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.profile-avatar:has(input:checked) {
  border-color: var(--pr-accent);
  box-shadow: inset 0 0 0 2px var(--pr-accent);
}

.profile-avatar:has(input:focus-visible) {
  outline: 3px solid var(--r6-glow-text);
  outline-offset: 2px;
}

.profile-avatar__disc {
  width: 44px;
  pointer-events: none;
}

.profile-sheet[data-colored="false"] .profile-avatar__disc {
  background: var(--r6-face-2);
  color: var(--pr-text);
}

.profile-sheet__actions {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-sheet__submit {
  min-height: 60px;
  border: 0;
  border-radius: 18px;
  background: var(--pr-accent);
  color: var(--pr-on-accent);
  font-size: 20px;
  font-weight: 900;
}

.profile-sheet__later {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--pr-text-muted);
  font-size: 16px;
  font-weight: 700;
}

@media (orientation: landscape) {
  .profile-sheet__title { margin-top: 0; font-size: 22px; }
  .profile-sheet__label { margin-top: 16px; }
  .profile-sheet__avatars { margin-top: 16px; }
  .profile-sheet__avatar-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
  .profile-avatar { height: 60px; }
  .profile-sheet__actions { flex-direction: row-reverse; }
  .profile-sheet__actions > * { flex: 1; min-height: 52px; }
}

/* --------------------------------------------------------------------------
   Buttons shared by the panels.
   -------------------------------------------------------------------------- */
.action-button {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-surface-1);
  color: var(--pr-text);
  font: 800 clamp(16px, 4vw, 22px)/1 var(--r6-font-display);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  transition: transform var(--pr-motion-fast), background-color var(--pr-motion-fast), opacity var(--pr-motion-fast);
}

.action-button[data-pressed="true"] {
  border-color: var(--pr-accent);
  background: var(--pr-accent);
  color: var(--pr-on-accent);
  transform: scale(.97);
}

/* A game's own label (control-labels) is Chinese more often than not. */
.action-button[data-custom-label="true"]:not(.answer-tile):not(.action-button--hero) {
  max-width: 100%;
  overflow: hidden;
  padding-inline: 10px;
  font-family: var(--r6-font-sans);
  font-size: clamp(13px, 4cqh, 20px);
  font-weight: 900;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buttons-controller {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  align-content: center;
  justify-content: center;
  gap: clamp(14px, 4vw, 26px);
}

/* The one lit thing on a game screen (PhoneTap): a big glow circle. */
.buttons-controller--single {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 3cqh, 24px);
}

.buttons-controller--single .action-button--hero {
  margin-block: auto;
}

.action-button--hero {
  width: min(300px, 88cqw, 64cqh);
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: var(--pr-accent);
  color: var(--pr-on-accent);
  box-shadow:
    0 0 0 clamp(8px, 2.4cqh, 14px) color-mix(in srgb, var(--pr-accent) 18%, transparent),
    0 24px 60px color-mix(in srgb, var(--pr-accent) 35%, transparent);
  font: 900 clamp(44px, 12cqh, 88px)/1 var(--r6-font-sans);
}

.action-button--hero[data-label-size="medium"] { font-size: clamp(28px, 8cqh, 56px); }

.action-button--hero[data-label-size="long"] {
  padding: 0 14%;
  font-size: clamp(17px, 5cqh, 28px);
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
}

.action-button--hero[data-pressed="true"] {
  background: var(--r6-glow-hover);
  color: var(--pr-on-accent);
  box-shadow:
    0 0 0 clamp(4px, 1.4cqh, 8px) color-mix(in srgb, var(--pr-accent) 24%, transparent),
    0 12px 32px color-mix(in srgb, var(--pr-accent) 30%, transparent);
  transform: scale(.96);
}

.tap-count {
  flex: none;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--pr-text-muted);
  font-size: 16px;
}

.tap-count__number {
  color: var(--pr-text);
  font: 800 clamp(28px, 7cqh, 44px)/1 var(--r6-font-display);
  letter-spacing: -.02em;
}

.action-button--round {
  width: min(148px, 36cqw, 52cqh);
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: clamp(26px, 8cqh, 44px);
}

.action-button--a {
  border: 0;
  background: var(--pr-accent);
  color: var(--pr-on-accent);
}

.action-button--b {
  border-color: var(--r6-line-strong);
  background: var(--r6-face-2);
}

.action-button--a[data-pressed="true"] { background: var(--r6-glow-hover); }

.action-button--tile {
  width: 100%;
  aspect-ratio: 1;
  font-size: clamp(24px, 6vw, 36px);
}

.buttons-controller--ab {
  grid-template-columns: repeat(2, auto);
  gap: clamp(28px, 10cqw, 96px);
}

/* Four answers (PhoneQuiz): the A–D colours of the big screen, the chosen one
   ringed, the rest dimmed, and 「已選 B · 玉山」 at the foot. */
.answer-panel {
  width: 100%;
  max-width: 960px;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: clamp(8px, 2.4cqh, 16px);
}

.answer-grid {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  max-height: 540px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.action-button.answer-tile {
  width: 100%;
  height: 100%;
  min-height: 44px;
  aspect-ratio: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  overflow: hidden;
  padding: clamp(10px, 2.4cqh, 18px);
  border: 0;
  border-radius: 24px;
  background: var(--answer-color);
  color: var(--answer-ink);
  box-shadow: none;
  text-align: left;
}

.answer-tile__top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.answer-tile__letter {
  font: 800 clamp(28px, 7cqh, 52px)/1 var(--r6-font-display);
}

.answer-tile__check {
  width: clamp(24px, 5cqh, 36px);
  height: clamp(24px, 5cqh, 36px);
  flex: none;
  visibility: hidden;
}

.answer-tile__text {
  max-width: 100%;
  display: -webkit-box;
  overflow: hidden;
  font: 900 clamp(15px, 3.2cqh, 24px)/1.25 var(--r6-font-sans);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.action-button.answer-tile[data-pressed="true"] {
  background: var(--answer-color);
  color: var(--answer-ink);
  transform: scale(.97);
}

.answer-panel[data-chosen="true"] .answer-tile:not([data-chosen="true"]) {
  opacity: .4;
}

.answer-tile[data-chosen="true"] {
  box-shadow: 0 0 0 4px var(--pr-canvas), 0 0 0 8px var(--pr-text);
}

.answer-tile[data-chosen="true"] .answer-tile__check {
  visibility: visible;
}

/* 「—」: this option is not in play for the current question. */
.answer-tile[data-unused="true"] {
  opacity: .28;
}

.answer-footer {
  flex: none;
  min-height: 56px;
  margin: auto 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border: 1px solid var(--pr-border);
  border-radius: 18px;
  background: var(--pr-surface-1);
}

.answer-footer__dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--pr-border);
}

.answer-footer[data-chosen="true"] .answer-footer__dot {
  background: var(--pr-accent);
}

.answer-footer__text {
  min-width: 0;
  overflow: hidden;
  color: var(--pr-text);
  font-size: 17px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.answer-footer[data-chosen="false"] .answer-footer__text {
  color: var(--pr-text-muted);
}

.answer-footer__aside {
  flex: none;
  margin-left: auto;
  color: var(--pr-text-muted);
  font-size: 14px;
}

@media (orientation: landscape) {
  .answer-grid {
    max-height: none;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
  }

  .answer-footer { min-height: 48px; padding: 8px 16px; }
}

/* --------------------------------------------------------------------------
   The other panels, re-skinned on the same tokens. Main controls are capped
   in cqh so the ~300px landscape stage still fits them.
   -------------------------------------------------------------------------- */
.joystick-controller,
.dpad-controller {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
}

.pad {
  position: relative;
  width: min(var(--controller-pad-size), 92cqw, 88cqh);
  aspect-ratio: 1;
  border: 1px solid var(--pr-border);
  border-radius: 50%;
  background:
    linear-gradient(transparent 49.7%, var(--pr-border) 50%, transparent 50.3%),
    linear-gradient(90deg, transparent 49.7%, var(--pr-border) 50%, transparent 50.3%),
    var(--pr-surface-1);
  touch-action: none;
}

.pad::after {
  position: absolute;
  inset: 18%;
  border: 1px dashed var(--pr-border);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.puck {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: clamp(64px, 24%, 118px);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--pr-accent);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--pr-accent) 18%, transparent), 0 16px 40px color-mix(in srgb, var(--pr-accent) 30%, transparent);
  will-change: transform;
}

.puck.is-returning {
  transition: transform var(--pr-motion-standard) cubic-bezier(.2, 1.35, .4, 1);
}

.direction-pad {
  display: grid;
  grid-template-areas:
    ". up ."
    "left hub right"
    ". down .";
  /* Three rows must clear the stage height, so cap the cell by it. */
  grid-template-columns: repeat(3, min(96px, 26cqw, 29cqh));
  grid-template-rows: repeat(3, min(96px, 26cqw, 29cqh));
  gap: 8px;
}

.direction-pad__button {
  width: 100%;
  height: 100%;
  border-radius: 18px;
  font-family: var(--r6-font-sans);
  font-size: clamp(18px, 6cqh, 28px);
}

.direction-pad__button--up { grid-area: up; }
.direction-pad__button--left { grid-area: left; }
.direction-pad__button--right { grid-area: right; }
.direction-pad__button--down { grid-area: down; }

.direction-pad__hub {
  grid-area: hub;
  border-radius: 50%;
  background: var(--r6-face-2);
}

.action-button--pill {
  min-width: clamp(84px, 24vw, 120px);
  height: 44px;
  border-radius: 999px;
  font-family: var(--r6-font-sans);
  font-size: 15px;
  font-weight: 700;
}

.action-button--pad {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  color: var(--pr-text-muted);
  font: 500 clamp(13px, 4cqh, 16px)/1 var(--r6-font-display);
}

/* Portrait: d-pad stacked above the action cluster, A/B side by side. The
   cluster is held clear of the bottom edge, where the system gesture bar
   sits. */
.gamepad-controller {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  gap: clamp(16px, 5vw, 40px);
  padding-block-end: clamp(16px, 6cqh, 56px);
}

.gamepad-controller .direction-pad {
  grid-template-columns: repeat(3, min(88px, 24cqw, 22cqh));
  grid-template-rows: repeat(3, min(88px, 24cqw, 22cqh));
}

.gamepad-controller .action-button--round {
  width: min(112px, 28cqw, 20cqh);
}

/* The A/B-to-選擇/開始 gap is a mis-tap guard, not decoration: a thumb
   leaving A lands near 開始. */
.gamepad-actions {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(24px, 8vw, 48px);
}

.gamepad-face { display: flex; align-items: center; gap: clamp(14px, 4vw, 24px); }
.gamepad-system { display: flex; align-items: center; gap: 10px; }

/* Landscape: thumbs hold the phone's edges, so push each cluster out to its
   own side and stack A/B vertically instead of across the middle. Every size
   comes off the stage height; a vw-based size blows straight through the
   bottom of an `overflow: hidden` shell. */
@media (orientation: landscape) {
  .gamepad-controller {
    grid-template-columns: auto auto;
    grid-template-rows: 1fr;
    justify-content: space-between;
    padding-inline: clamp(8px, 3vw, 48px);
    padding-block-end: 0;
    gap: clamp(12px, 4vw, 32px);
  }

  .gamepad-controller .direction-pad {
    grid-template-columns: repeat(3, min(88px, 29cqh));
    grid-template-rows: repeat(3, min(88px, 29cqh));
  }

  .gamepad-controller .gamepad-direction { justify-self: start; }

  .gamepad-controller .gamepad-actions {
    justify-self: end;
    grid-auto-flow: column;
    align-items: center;
    gap: clamp(20px, 5vw, 44px);
  }

  .gamepad-controller .action-button--round { width: clamp(52px, 38cqh, 132px); }

  .gamepad-face { flex-direction: column; gap: clamp(8px, 4cqh, 18px); }

  /* 選擇/開始 sit inboard so A/B stay furthest out under the thumb. */
  .gamepad-system { order: -1; flex-direction: column; gap: 10px; }
}

.pads-controller {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  /* Four square rows plus gaps have to clear the stage height. */
  grid-template-columns: repeat(4, minmax(0, min(clamp(58px, 20vw, 104px), 21cqh)));
  grid-auto-rows: auto;
  align-content: center;
  justify-content: center;
  gap: min(clamp(8px, 2.4vw, 14px), 3cqh);
}

.faders-controller {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-auto-flow: column;
  justify-content: center;
  align-items: stretch;
  gap: clamp(18px, 6vw, 44px);
  padding: clamp(8px, 3cqh, 32px) 0;
}

.fader {
  display: grid;
  grid-template-rows: 1fr auto auto;
  justify-items: center;
  gap: 8px;
}

.fader-track {
  position: relative;
  width: clamp(44px, 12vw, 58px);
  min-height: min(160px, 62cqh);
  border: 1px solid var(--pr-border);
  border-radius: 999px;
  background: var(--pr-surface-1);
  touch-action: none;
  cursor: pointer;
}

.fader-fill {
  position: absolute;
  inset: auto 3px 3px 3px;
  height: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pr-accent) 70%, transparent);
}

.fader-thumb {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: calc(100% + 8px);
  height: clamp(24px, 6vw, 32px);
  translate: -50% 50%;
  border-radius: 12px;
  background: var(--pr-accent);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
}

.fader-label { color: var(--pr-text-muted); font-size: 13px; font-weight: 500; }
.fader-value { color: var(--pr-text); font-size: 13px; font-weight: 700; }

.wheel-controller,
.tilt-controller {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
}

.wheel-dial {
  position: relative;
  width: min(var(--controller-pad-size, min(66vw, 320px)), 92cqw, 88cqh);
  aspect-ratio: 1;
  border: 1px solid var(--pr-border);
  border-radius: 50%;
  background: var(--pr-surface-1);
  touch-action: none;
  cursor: grab;
}

.wheel-dial::after {
  position: absolute;
  inset: 32%;
  border: 1px dashed var(--pr-border);
  border-radius: 50%;
  content: "";
}

.wheel-marker {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.wheel-marker::before {
  position: absolute;
  top: 6%;
  left: 50%;
  width: clamp(16px, 5cqh, 26px);
  aspect-ratio: 1;
  translate: -50% 0;
  border-radius: 50%;
  background: var(--pr-accent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--pr-accent) 18%, transparent);
  content: "";
}

.tilt-stage {
  width: min(58vw, 260px, 60cqh);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  perspective: 600px;
  opacity: .5;
  transition: opacity var(--pr-motion-standard);
}

.tilt-stage[data-active="true"] { opacity: 1; }

.tilt-plane {
  width: 72%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--pr-accent);
  border-radius: var(--pr-radius-card);
  background: var(--r6-face-2);
  transform-style: preserve-3d;
  will-change: transform;
}

/* Reads the plane's heading: without a pointer, a square rotating on Z is
   ambiguous every 90 degrees. */
.tilt-needle {
  width: 3px;
  height: 42%;
  align-self: start;
  margin-top: 8%;
  border-radius: 999px;
  background: var(--pr-accent);
}

.tilt-actions,
.pointer-actions,
.shake-actions,
.camera-actions,
.mic-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* Status lines under sensor panels: what to do, or why it cannot. */
.tilt-status,
.pointer-status,
.shake-status,
.camera-status,
.mic-status {
  min-height: 1.4em;
  max-width: 24em;
  margin: 0;
  color: var(--pr-text-muted);
  font-size: clamp(13px, 4.5cqh, 15px);
  line-height: 1.5;
  text-align: center;
}

/* Landscape: status and buttons move beside the sensor's picture. Stacked
   under it they take most of a ~300px stage and push it off both edges. */
@media (orientation: landscape) {
  .tilt-controller,
  .pointer-controller,
  .shake-controller {
    grid-template-columns: auto minmax(0, auto);
    /* Explicit rows: `grid-row: 1 / -1` only spans the explicit grid. */
    grid-template-rows: repeat(2, auto);
    justify-content: center;
    align-content: center;
    column-gap: clamp(16px, 4vw, 44px);
    row-gap: 10px;
  }

  .tilt-stage,
  .pointer-field,
  .shake-meter {
    grid-row: 1 / -1;
  }

  .tilt-stage { width: min(58vw, 260px, 92cqh); }
  .pointer-field { width: min(52vw, 300px, 150cqh); }
  .shake-meter { width: min(30vw, 200px, 64cqh); }
}

/* Gyro pointer: the field is a scale model of the big screen, so the dot
   lands where the phone points. */
.pointer-controller,
.shake-controller {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
}

.pointer-field {
  position: relative;
  width: min(80cqw, 300px, 58cqh);
  aspect-ratio: 16 / 10;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-surface-1);
  opacity: .5;
  transition: opacity var(--pr-motion-standard);
}

.pointer-field[data-active="true"] { opacity: 1; }

.pointer-crosshair {
  position: absolute;
  inset: 12%;
  border: 1px dashed var(--pr-border);
  border-radius: var(--pr-radius-control);
}

.pointer-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  /* left/top are set as percentages, so the box is pulled back onto its own
     centre to sit on the point rather than beside it. */
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--pr-accent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--pr-accent) 20%, transparent);
  transition: left var(--pr-motion-fast), top var(--pr-motion-fast);
}

.action-button.pointer-press {
  min-width: 120px;
  min-height: max(48px, min(60px, 18cqh));
  padding: 0 28px;
  border: 0;
  border-radius: 18px;
  background: var(--pr-accent);
  color: var(--pr-on-accent);
  font: 900 18px/1 var(--r6-font-sans);
}

.action-button.pointer-press[data-pressed="true"] { background: var(--r6-glow-hover); }

/* The first tap that unlocks motion (iOS), the camera or the microphone. It
   is the one thing the player must do before the panel works, so it is the
   lit button; cqh keeps it inside the landscape stage. */
.sensor-enable-button {
  min-width: min(100%, 220px);
  min-height: max(48px, min(60px, 20cqh));
  padding: 0 28px;
  border: 0;
  border-radius: 18px;
  background: var(--pr-accent);
  color: var(--pr-on-accent);
  font: 900 clamp(17px, 6cqh, 20px)/1.1 var(--r6-font-sans);
  box-shadow: 0 14px 36px color-mix(in srgb, var(--pr-accent) 30%, transparent);
}

.sensor-enable-button:disabled { opacity: .6; }

/* Secondary actions on sensor panels (校正中心, 切換鏡頭). */
.controller-shell .compact-button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--pr-border);
  border-radius: 14px;
  background: var(--r6-face-2);
  color: var(--pr-text);
  font-size: 15px;
  font-weight: 700;
}

/* Shake: a meter that fills with glow as the swell of energy rises. */
.shake-meter {
  position: relative;
  overflow: hidden;
  display: grid;
  justify-items: center;
  align-items: start;
  width: min(60cqw, 200px, 46cqh);
  aspect-ratio: 3 / 4;
  border: 1px solid var(--pr-border);
  border-radius: 28px;
  background: var(--pr-surface-1);
  opacity: .5;
  transition: opacity var(--pr-motion-standard);
}

.shake-meter[data-active="true"] { opacity: 1; }

.shake-fill {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
  transform: scaleY(0);
  background: linear-gradient(var(--r6-glow-hover), var(--pr-accent));
  will-change: transform;
}

.shake-burst {
  position: absolute;
  inset: 0;
  border: 3px solid var(--pr-accent);
  border-radius: 28px;
  opacity: 0;
}

.shake-burst.is-bursting { animation: shake-burst 260ms ease-out; }

@keyframes shake-burst {
  from { opacity: .9; transform: scale(1); }
  to { opacity: 0; transform: scale(1.08); }
}

.shake-label {
  position: relative;
  margin-top: 14%;
  color: var(--pr-text);
  font-size: clamp(18px, 6cqh, 26px);
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(21, 22, 30, .6);
}

/* Slingshot: the band is the whole surface, so a shot can start anywhere the
   thumb already rests. */
.slingshot-controller {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  justify-items: center;
}

.slingshot-band {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 44px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-card);
  background: var(--pr-surface-1);
  touch-action: none;
}

/* All four ride from the band's centre, which is the origin the panel's
   transforms are written against. */
.slingshot-anchor,
.slingshot-shot,
.slingshot-cord,
.slingshot-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  opacity: 0;
  transition: opacity var(--pr-motion-fast);
  will-change: transform;
}

.slingshot-band[data-pulling="true"] .slingshot-anchor,
.slingshot-band[data-pulling="true"] .slingshot-shot,
.slingshot-band[data-pulling="true"] .slingshot-cord { opacity: 1; }

.slingshot-anchor {
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px dashed var(--pr-text-muted);
  border-radius: 50%;
}

.slingshot-shot {
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: var(--pr-accent);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--pr-accent) 18%, transparent);
}

/* One pixel wide and scaled to the pull length, so the transform carries both
   the angle and the distance. */
.slingshot-cord {
  width: 1px;
  height: 3px;
  margin-top: -1.5px;
  transform-origin: 0 50%;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pr-accent) 70%, transparent);
}

.slingshot-arrow {
  width: clamp(48px, 18vw, 96px);
  height: 3px;
  margin-top: -1.5px;
  transform-origin: 0 50%;
  border-radius: 999px;
  background: linear-gradient(to right, var(--pr-accent), transparent);
}

.slingshot-band[data-fired="true"] .slingshot-shot {
  opacity: 0;
  transition: opacity 90ms linear;
}

.slingshot-readout {
  color: var(--pr-text-muted);
  font-size: 15px;
  font-weight: 700;
}

.multitouch-controller,
.draw-controller {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.multitouch-surface,
.draw-surface {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: min(200px, 70cqh);
  overflow: hidden;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-card);
  background: var(--pr-surface-1);
  touch-action: none;
}

.multitouch-dot {
  position: absolute;
  width: clamp(52px, 14vw, 76px);
  aspect-ratio: 1;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  border: 2px solid var(--pr-accent);
  border-radius: 50%;
  background: var(--r6-glow-soft);
  color: var(--pr-text);
  font: 800 16px/1 var(--r6-font-display);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--pr-motion-fast);
}

.multitouch-dot[data-active="true"] { opacity: 1; }

.draw-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.draw-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--pr-text-muted);
  font-size: 15px;
  pointer-events: none;
}

.camera-color-controller,
.mic-controller {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
}

.camera-stage {
  position: relative;
  width: min(80cqw, 300px, 52cqh);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-card);
  background: var(--pr-surface-1);
}

.camera-video { width: 100%; height: 100%; object-fit: cover; display: block; }

.camera-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border: 2px solid var(--pr-accent);
  border-radius: var(--pr-radius-control);
  box-shadow: 0 0 0 999px rgba(21, 22, 30, .3);
  pointer-events: none;
}

.camera-swatch {
  width: clamp(48px, 14vw, 68px);
  aspect-ratio: 1.6;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: #000;
}

/* Landscape: the swatch, status and buttons sit beside the viewfinder rather
   than stacked under it, which leaves the stage no room. */
@media (orientation: landscape) {
  .camera-color-controller {
    grid-template-columns: auto minmax(0, auto);
    grid-template-rows: repeat(3, auto);
    justify-content: center;
    align-content: center;
    column-gap: clamp(16px, 4vw, 44px);
    row-gap: 8px;
  }

  .camera-stage {
    grid-row: 1 / -1;
    width: min(64vw, 300px, 92cqh);
  }
}

.mic-meters { width: min(84cqw, 420px); display: grid; gap: min(14px, 3cqh); }
.mic-meter { display: grid; grid-template-columns: 3em minmax(0, 1fr); align-items: center; gap: 12px; }
.mic-meter-label { color: var(--pr-text-muted); font-size: 14px; font-weight: 700; }
.mic-meter-track { height: 14px; overflow: hidden; border: 1px solid var(--pr-border); border-radius: 999px; background: var(--pr-surface-1); }
.mic-meter-fill { display: block; width: 0; height: 100%; border-radius: 999px; background: var(--pr-accent); }

@media (max-height: 600px) and (orientation: landscape) {
  .controller-shell { --controller-pad-size: min(66vw, 68dvh); }
}

@media (prefers-reduced-motion: reduce) {
  .light-stick { transition: none; }
  .shake-burst.is-bursting { animation: none; }
  .control-overlay__status.is-entering { animation: none; }
  .controller-toast { transition: none; }
}

/* --------------------------------------------------------------------------
   Panel thumbnails (previews.js) for the staff panel pickers and the Host
   page. Sized for a card; `.panel-thumb` shrinks them further.
   -------------------------------------------------------------------------- */
/* Mirrors the real portrait panel: d-pad above the action buttons. */
.panel-preview__gamepad {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 120px;
}

/* The buttons row is full-width when it is a preview's whole subject, but
   nested here it must be only as wide as its two buttons — at 100% it forced
   the d-pad and itself past the frame. */
.panel-preview__gamepad .panel-preview__buttons {
  width: auto;
  min-height: 0;
}

/* Stacked, the d-pad and the buttons share one column of height, so both come
   in from the sizes they use when each is a preview's whole subject. */
.panel-preview__gamepad .panel-preview__dpad {
  grid-template-columns: repeat(3, 34px);
  grid-template-rows: repeat(3, 34px);
}

.panel-preview__gamepad .panel-preview__button--round {
  width: 54px;
  font-size: 16px;
}

.panel-preview__pads {
  display: grid;
  grid-template-columns: repeat(4, 22px);
  grid-auto-rows: 22px;
  gap: 5px;
  min-height: 120px;
  align-content: center;
}

.panel-preview__button--pad { width: 22px; height: 22px; border-radius: 5px; }

.panel-preview__faders { display: flex; align-items: flex-end; justify-content: center; gap: 10px; min-height: 120px; }
.panel-preview__fader { position: relative; width: 14px; height: 96px; border: 1px solid var(--pr-border); border-radius: 999px; background: var(--pr-surface-1); overflow: hidden; }
.panel-preview__fader-fill { position: absolute; inset: auto 0 0 0; background: var(--pr-accent); opacity: .8; }
.panel-preview__wheel { position: relative; width: 108px; aspect-ratio: 1; border: 1px solid var(--pr-border); border-radius: 50%; background: var(--pr-surface-1); }
.panel-preview__wheel-marker { position: absolute; top: 8%; left: 50%; width: 16px; aspect-ratio: 1; translate: -50% 0; border-radius: 50%; background: var(--pr-accent); }
.panel-preview__reticle { position: absolute; inset: 14%; border: 1px dashed var(--pr-border); border-radius: 8px; }
.panel-preview__shake { display: flex; align-items: flex-end; justify-content: center; gap: 8px; min-height: 120px; }
.panel-preview__shake-bar { position: relative; width: 16px; height: 96px; display: flex; align-items: flex-end; border-radius: 999px; background: var(--pr-surface-1); overflow: hidden; }
.panel-preview__shake-bar > span { width: 100%; border-radius: 999px; background: var(--pr-accent); opacity: .85; }
.panel-preview__shot { position: absolute; left: 66%; top: 26%; width: 14px; aspect-ratio: 1; border-radius: 50%; background: var(--pr-accent); }
.panel-preview__tilt { width: 108px; aspect-ratio: 1; display: grid; place-items: center; }
.panel-preview__tilt-plane { width: 66%; aspect-ratio: 1; border: 2px solid var(--pr-accent); border-radius: var(--pr-radius-control); background: var(--pr-surface-2); transform: rotate(-12deg); }

.panel-preview__surface {
  position: relative;
  width: min(100%, 200px);
  aspect-ratio: 1.4;
  overflow: hidden;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-surface-1);
}

.panel-preview__touch {
  position: absolute;
  width: 24px;
  aspect-ratio: 1;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  border: 2px solid var(--pr-accent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--pr-accent) 28%, transparent);
  color: var(--pr-text);
  font: 800 10px/1 var(--r6-font-display);
}

.panel-preview__stroke-svg { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); }

.panel-preview__camera { position: relative; width: 120px; aspect-ratio: 1; border: 1px solid var(--pr-border); border-radius: var(--pr-radius-control); background: linear-gradient(135deg, #5B8CFF, #1D1F2A); overflow: hidden; }
.panel-preview__camera-reticle { position: absolute; top: 50%; left: 50%; width: 30%; aspect-ratio: 1; translate: -50% -50%; border: 2px solid #EFEDFB; border-radius: 4px; opacity: .85; }
.panel-preview__mic { display: grid; gap: 6px; width: 120px; min-height: 96px; align-content: center; }
.panel-preview__mic-bar { height: 12px; border-radius: 999px; background: var(--pr-surface-2); overflow: hidden; }
.panel-preview__mic-bar > span { display: block; height: 100%; background: var(--pr-accent); border-radius: 999px; }
.panel-preview__idle { display: grid; justify-items: center; gap: 10px; width: 120px; min-height: 96px; align-content: center; }
.panel-preview__idle-avatar { width: 44px; aspect-ratio: 1; border-radius: 50%; background: var(--r6-answer-a); box-shadow: 0 0 0 3px var(--pr-canvas), 0 0 0 5px var(--r6-answer-a); }
.panel-preview__idle-line { width: 80%; height: 8px; border-radius: 999px; background: var(--r6-glow-soft); }

.panel-preview__buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: 120px;
}

.panel-preview__buttons--grid {
  display: grid;
  grid-template-columns: repeat(2, 62px);
  gap: 10px;
}

.panel-preview__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-surface-1);
  color: var(--pr-text);
  font: 800 14px/1 var(--r6-font-display);
}

.panel-preview__button--hero {
  width: 108px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: var(--pr-accent);
  color: var(--pr-on-accent);
  font-family: var(--r6-font-sans);
  font-size: 30px;
  font-weight: 900;
}

.panel-preview__button--round {
  width: 68px;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 20px;
}

.panel-preview__button--primary {
  border: 0;
  background: var(--pr-accent);
  color: var(--pr-on-accent);
}

.panel-preview__button--tile {
  width: 100%;
  aspect-ratio: 1;
  font-size: 18px;
}

.panel-preview__button--answer-a,
.panel-preview__button--answer-b,
.panel-preview__button--answer-c,
.panel-preview__button--answer-d {
  justify-content: flex-start;
  align-items: flex-start;
  padding: 6px;
  border: 0;
  color: var(--r6-night);
}

.panel-preview__button--answer-a { background: var(--r6-answer-a); }
.panel-preview__button--answer-b { background: var(--r6-answer-b); }
.panel-preview__button--answer-c { background: var(--r6-answer-c); }
.panel-preview__button--answer-d { background: var(--r6-answer-d); }

/* The latch is the point of the selector, so its thumbnail shows one held
   (ringed) and the rest dimmed. */
.panel-preview__buttons--grid:has([data-pressed="true"]) .panel-preview__button:not([data-pressed="true"]) {
  opacity: .4;
}

.panel-preview__button[data-pressed="true"] {
  box-shadow: 0 0 0 2px var(--pr-canvas), 0 0 0 4px var(--pr-text);
}

.panel-preview__dpad {
  display: grid;
  grid-template-areas:
    ". up ."
    "left hub right"
    ". down .";
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 4px;
}

.panel-preview__button--dpad { width: 100%; height: 100%; font-size: 13px; }
.panel-preview__button--dpad-up { grid-area: up; }
.panel-preview__button--dpad-left { grid-area: left; }
.panel-preview__button--dpad-right { grid-area: right; }
.panel-preview__button--dpad-down { grid-area: down; }

.panel-preview__hub {
  grid-area: hub;
  border-radius: 50%;
  background: var(--pr-surface-2);
}

.home-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--pr-text-muted, var(--muted));
  font-size: 12px;
  text-decoration: none;
}

.host-shell {
  width: min(100% - 32px, 1120px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(34px, env(safe-area-inset-top)) 0 max(48px, env(safe-area-inset-bottom));
  color: var(--pr-text);
  font-family: var(--pr-font-body);
}

.host-shell .eyebrow,
.host-shell .meta-label,
.host-shell .path-label { color: var(--pr-accent); }

.host-shell button:focus-visible,
.host-shell input:focus,
.host-shell summary:focus-visible {
  border-color: var(--pr-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-focus) 18%, transparent);
}

html[data-style] body:has(.host-shell) {
  background:
    radial-gradient(circle at 14% 0%, color-mix(in srgb, var(--pr-accent) 13%, transparent), transparent 31rem),
    var(--pr-canvas);
  color: var(--pr-text);
  transition: background var(--pr-motion-standard), color var(--pr-motion-fast);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.host-header,
.section-heading,
.delete-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.host-header h1,
.host-empty h1 {
  margin: 7px 0 0;
  font-size: clamp(34px, 5vw, 62px);
  font-weight: 900;
  line-height: .96;
  letter-spacing: -.052em;
  font-family: var(--pr-font-display);
}

.host-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* The way into the show console; it sits beside "home" so an operator who
   lands here from Admin finds 開始／下一個遊戲 one tap away. */
.host-console-link {
  min-width: 0;
  margin-top: 0;
  padding: 0 18px;
}

.host-home {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--pr-border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--pr-text-muted);
}

.room-console {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(110px, .45fr) minmax(300px, .9fr);
  align-items: center;
  gap: 24px;
  margin: 34px 0 18px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--pr-accent) 42%, var(--pr-border));
  border-radius: var(--pr-radius-card);
  background:
    linear-gradient(108deg, color-mix(in srgb, var(--pr-accent) 8%, transparent), transparent 42%),
    var(--pr-surface-1);
  box-shadow: var(--pr-shadow);
}

.channel-block {
  min-width: 0;
}

.host-channel {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  font: 850 clamp(31px, 5vw, 56px)/1 var(--pr-font-mono);
  letter-spacing: .05em;
  text-overflow: ellipsis;
}

.console-signal {
  display: grid;
  grid-template-columns: 12px 1fr 12px;
  align-items: center;
}

.console-signal i,
.signal-orbit i {
  width: 12px;
  height: 12px;
  border: 2px solid var(--pr-accent);
  border-radius: 50%;
  background: var(--pr-surface-1);
  box-shadow: 0 0 18px color-mix(in srgb, var(--pr-accent) 30%, transparent);
}

.console-signal span {
  height: 1px;
  background: linear-gradient(90deg, var(--pr-accent), var(--pr-border));
}

.room-meta {
  display: grid;
  gap: 9px;
  margin: 0;
}

.room-meta > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--pr-border);
}

.room-meta > div:last-child {
  padding-bottom: 0;
  border: 0;
}

.room-meta dt {
  color: var(--pr-text-muted);
  font-size: 12px;
}

.room-meta dd {
  margin: 0;
  font-size: 13px;
  font-weight: 750;
}

.connection-copy[data-state="live"] { color: var(--pr-success); }
/* Not connected is the resting state of a new room — the host simply hasn't
   wired up step 02 yet. Warning colour here reads as "you broke something". */
.connection-copy[data-state="off"] { color: var(--pr-text-muted); }

.host-player-card {
  display: grid;
  gap: 14px;
  margin: 16px 0 18px;
  padding: 18px 20px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-card);
  background: var(--pr-surface-1);
}

.host-player-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.host-player-heading .path-label { margin: 0 0 4px; }
.host-player-heading h2 { margin: 0; font: 800 22px/1.1 var(--pr-font-display); }
.host-player-heading > span { color: var(--pr-text-muted); font: 750 11px/1 var(--pr-font-mono); }

.host-player-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.host-player-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-surface-2);
}

.host-player-row > strong { font: 800 14px/1 var(--pr-font-display); white-space: nowrap; }
.host-player-identity { min-width: 0; display: grid; gap: 4px; }
.host-player-who,.host-live-player-who { min-width: 0; display: inline-flex; align-items: center; gap: 6px; }
.host-live-player-who { max-width: 100%; font-size: 12px; font-weight: 700; }
.host-player-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-player-avatar { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--host-player-swatch, var(--pr-surface-1)); font-size: 13px; line-height: 1; }
.host-player-slot { color: var(--pr-text-muted); font: 750 11px/1 var(--pr-font-mono); }
.host-player-hidden { padding: 2px 6px; border-radius: 999px; background: color-mix(in srgb, var(--pr-warning) 12%, transparent); color: var(--pr-warning); font-size: 10px; font-weight: 800; white-space: nowrap; }
.host-player-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.host-player-badge { padding: 5px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; line-height: 1; white-space: nowrap; }
.host-player-badge.is-connected,
.host-player-badge.is-enabled { background: color-mix(in srgb, var(--pr-success) 13%, transparent); color: var(--pr-success); }
.host-player-badge.is-reconnecting { background: color-mix(in srgb, var(--pr-warning) 12%, transparent); color: var(--pr-warning); }
.host-player-badge.is-locked { background: color-mix(in srgb, var(--pr-text-muted) 12%, transparent); color: var(--pr-text-muted); }
.host-player-empty { margin: 0; color: var(--pr-text-muted); font-size: 12px; }
.host-player-empty[hidden] { display: none; }

.host-player-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.host-player-heading-actions > span { color: var(--pr-text-muted); font: 750 11px/1 var(--pr-font-mono); white-space: nowrap; }
/* Join lock: a pressed toggle is a room that turns new phones away, so it
   wears the warning colour for as long as it is on. */
.host-join-lock { flex: none; padding: 0 14px; white-space: nowrap; }
.host-join-lock[aria-pressed="true"] { border-color: color-mix(in srgb, var(--pr-warning) 55%, var(--pr-border)); background: color-mix(in srgb, var(--pr-warning) 14%, var(--pr-surface-2)); color: var(--pr-warning); }
.host-join-lock:disabled { cursor: wait; opacity: .55; }
.host-join-lock-status { margin: 0; color: var(--pr-warning); font-size: 12px; font-weight: 700; }
.host-join-lock-status:empty { display: none; }

.host-live-dialog {
  width: 100dvw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  overflow: auto;
  border: 0;
  background: var(--pr-canvas);
  color: var(--pr-text);
  outline: 0;
}
.host-live-dialog::backdrop { background: color-mix(in srgb, var(--pr-canvas) 88%, transparent); backdrop-filter: blur(8px); }
.host-live-shell { position: relative; width: min(100%, 1180px); min-height: calc(100dvh - 24px); display: grid; align-content: start; gap: 14px; margin: 0 auto; font-family: var(--pr-font-body); }
.host-live-shell button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 12px; border: 1px solid var(--pr-border); border-radius: var(--pr-radius-control); background: var(--pr-surface-2); color: var(--pr-text); font: 700 13px/1.15 var(--pr-font-body); box-shadow: none; white-space: nowrap; }
.host-live-shell button:hover { border-color: color-mix(in srgb, var(--pr-accent) 55%, var(--pr-border)); transform: translateY(-1px); }
.host-live-shell button:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.host-live-shell .primary-button,.host-live-shell button[aria-pressed="true"] { border-color: var(--pr-accent); background: var(--pr-accent); color: var(--pr-on-accent); }
.host-live-shell .danger-button { border-color: var(--pr-danger); background: var(--pr-danger); color: #fff; }
.host-live-topbar { display: grid; grid-template-columns: auto minmax(190px, 1fr) auto 44px; align-items: center; gap: 12px; padding: 0 0 12px; border-bottom: 1px solid var(--pr-border); }
.host-live-brand { min-width: 0; display: flex; align-items: center; gap: 11px; }
.host-live-brand-mark { width: 38px; height: 38px; flex: 0 0 auto; }
.host-live-meta { min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--pr-text-muted); font-size: 11px; }
.host-live-meta span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.host-live-meta span:first-child i { width: 8px; height: 8px; display: block; border-radius: 50%; background: var(--pr-success); }
.host-live-meta span:first-child.is-offline i { background: var(--pr-text-muted); }
.host-live-brand h2,.host-live-panel h3,.host-live-popover h3 { margin: 3px 0 0; font-family: var(--pr-font-display); }
.host-live-brand h2 { font-weight: 400; letter-spacing: -.02em; white-space: nowrap; }
.host-live-brand h2 > span { color: var(--pr-text-muted); font-weight: 400; }
.host-live-brand h2 > strong { color: var(--pr-text); font-weight: 900; letter-spacing: -.035em; }
.host-live-brand .path-label,.host-live-section-head .path-label,.host-live-panel .path-label,.host-live-popover .path-label { margin: 0; color: var(--pr-accent); }
.host-live-current { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 12px; border: 1px solid var(--pr-border); border-radius: var(--pr-radius-control); background: var(--pr-surface-2); }
.host-live-current span { color: var(--pr-text-muted); white-space: nowrap; }
.host-live-current strong { overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.host-live-toolbar { min-width: 0; display: flex; align-items: end; justify-content: flex-end; gap: 8px; }
.host-live-toolbar button,.host-live-action-groups button,.host-live-cue button,.host-live-global-actions button,.host-live-room-actions button,.host-live-player-tools button,.host-live-section-head button,.host-live-popover button { min-width: 0; min-height: 44px; }
.host-live-close { width: 44px; height: 44px; }
.host-live-panel { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--pr-border); border-radius: var(--pr-radius-card); background: var(--pr-surface-1); box-shadow: var(--pr-shadow); }
.host-live-control-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.host-live-access,.host-live-room-settings { grid-template-rows: auto 1fr; align-items: stretch; }
.host-live-access p:not(.path-label),.host-live-room-settings p:not(.path-label) { margin: 5px 0 0; color: var(--pr-text-muted); }
.host-live-global-actions,.host-live-room-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-self: end; gap: 8px; }
/* Room settings holds only the panel button now that Style lives in Admin. */
.host-live-room-actions { grid-template-columns: minmax(0, 1fr); }
.host-live-global-actions button,.host-live-room-actions button { min-height: 64px; justify-content: space-between; padding: 12px 14px; text-align: left; }
.host-live-global-actions button span,.host-live-room-actions button span { min-width: 0; display: grid; gap: 5px; }
.host-live-global-actions button small,.host-live-room-actions button small { overflow: hidden; color: inherit; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; opacity: .72; }
.host-live-global-actions button strong,.host-live-room-actions button strong { font: 800 14px/1 var(--pr-font-display); }
.host-live-global-actions button > b,.host-live-room-actions button > b { font-size: 22px; font-weight: 400; }
.host-live-global-actions button[aria-pressed="true"] { border-color: var(--pr-accent); background: var(--pr-accent); color: var(--pr-on-accent); }
.host-live-players { grid-template-rows: auto clamp(320px, 42dvh, 460px) auto; }
.host-live-section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.host-live-player-meta { display: flex; align-items: center; justify-content: flex-end; gap: 10px; color: var(--pr-text-muted); }
.host-live-player-grid { height: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: start; gap: 8px; overflow-y: auto; overscroll-behavior: contain; padding-right: 3px; }
.host-live-player { --host-player-color: var(--pr-border); min-width: 0; min-height: 122px; display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; padding: 10px; border: 1px solid var(--pr-border); border-top: 4px solid var(--host-player-color); border-radius: var(--pr-radius-control); background: var(--pr-surface-2); }
.host-live-player.is-selected { border-color: var(--pr-accent); background: var(--pr-accent); color: var(--pr-on-accent); }
.host-live-player.is-vibrating { animation: host-live-player-vibrate .42s ease-out; }
@keyframes host-live-player-vibrate { 0%,100% { transform: translateX(0); } 22% { transform: translateX(-4px); } 45% { transform: translateX(4px); } 68% { transform: translateX(-3px); } 84% { transform: translateX(2px); } }
.host-live-player-select { min-width: 0; display: grid; place-content: center; justify-items: center; gap: 7px; padding: 4px; border: 0; background: transparent; color: inherit; text-align: center; }
.host-live-shell .host-live-player-select,.host-live-shell .host-live-player-select:hover { display: grid; place-content: center; justify-items: center; gap: 7px; border: 0; background: transparent; color: inherit; box-shadow: none; transform: none; white-space: normal; }
.host-live-player-select strong { font: 800 14px/1 var(--pr-font-display); }
.host-live-player-select span { color: var(--pr-text-muted); }
.host-live-player-select b { color: var(--pr-text-muted); font-size: 12px; }
.host-live-player.is-enabled .host-live-player-select b { color: var(--pr-success); }
.host-live-player.is-selected .host-live-player-select span,.host-live-player.is-selected .host-live-player-select b { color: var(--pr-on-accent); }
.host-live-player-tools { display: grid; grid-template-columns: 44px; align-content: end; gap: 6px; }
.host-live-player-tools button { width: 44px; padding: 0; }
.host-live-player-tools svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.host-live-color-dot { width: 22px; height: 22px; display: block; border: 1px solid color-mix(in srgb, var(--pr-text) 30%, transparent); border-radius: 50%; background: var(--host-player-color); }
.host-live-selection { display: grid; gap: 10px; color: var(--pr-text-muted); }
.host-live-action-groups { display: grid; grid-template-columns: 2fr 2fr 2fr; gap: 12px; }
.host-live-action-groups > section { min-width: 0; display: grid; grid-template-rows: auto 1fr; gap: 6px; }
.host-live-action-groups > section + section { padding-left: 12px; border-left: 1px solid var(--pr-border); }
.host-live-action-groups > section > span { font: 700 11px/1 var(--pr-font-mono); }
.host-live-action-groups > section > div { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.host-live-action-groups > section > button { width: 100%; }
.host-live-action-groups button { width: 100%; padding-inline: 8px; white-space: normal; }
.host-live-action-groups #liveAllowSelected { border-color: color-mix(in srgb, var(--pr-success) 58%, var(--pr-border)); background: color-mix(in srgb, var(--pr-success) 18%, var(--pr-surface-2)); }
.host-live-action-groups #liveRemoveSelected { border-color: color-mix(in srgb, var(--pr-danger) 65%, var(--pr-border)); background: color-mix(in srgb, var(--pr-danger) 14%, var(--pr-surface-2)); color: var(--pr-text); }
.host-live-cue { min-width: 0; display: grid; grid-template-columns: auto minmax(140px, 1fr) auto auto; align-items: center; gap: 8px; padding: 13px; border: 1px solid var(--pr-border); border-radius: var(--pr-radius-card); background: var(--pr-surface-1); }
.host-live-cue input { min-width: 0; min-height: 44px; }
.host-live-status { color: var(--pr-text-muted); font: 700 11px/1.4 var(--pr-font-mono); }
.host-live-overlay { position: absolute; inset: 0; z-index: 5; min-height: 100%; display: grid; place-items: start center; padding: 72px 14px; background: color-mix(in srgb, var(--pr-canvas) 86%, transparent); }
.host-live-overlay[hidden] { display: none; }
.host-live-popover { width: min(520px, 100%); display: grid; gap: 14px; padding: 18px; border: 1px solid var(--pr-border); border-radius: var(--pr-radius-card); background: var(--pr-surface-1); box-shadow: var(--pr-shadow); }
.host-live-popover > header { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.host-live-popover > p { margin: 0; color: var(--pr-text-muted); }
.host-live-popover ol { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.host-live-popover li > button { width: 100%; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; text-align: left; }
.host-live-popover li > button span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--pr-surface-2); }
.host-live-popover li > button small { color: var(--pr-text-muted); }
.host-live-queue-empty { padding: 18px; color: var(--pr-text-muted); text-align: center; }
.host-live-color-popover { width: min(420px, 100%); }
.host-live-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.host-live-presets button::before { content: ""; width: 28px; height: 28px; display: block; border: 1px solid var(--pr-border); border-radius: 50%; background: var(--preset-color); }
.host-live-custom-color { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; }
.host-live-custom-color input { width: 52px; min-height: 44px; padding: 4px; }

@media (min-width: 901px) {
  .host-live-topbar { align-items: end; }
  .host-live-brand { min-height: 62px; align-items: center; padding-bottom: 2px; }
  .host-live-current { min-height: 62px; padding-block: 10px; }
  .host-live-toolbar { align-items: end; }
  .host-live-toolbar > button,.host-live-close { height: 62px; min-height: 62px; }
  .host-live-close { align-self: end; }
}

@media (min-width: 901px) and (max-width: 1120px) {
  .host-live-topbar { grid-template-columns: minmax(0, 1fr) 62px; gap: 10px; }
  .host-live-brand { grid-column: 1; grid-row: 1; }
  .host-live-close { grid-column: 2; grid-row: 1; }
  .host-live-current { grid-column: 1 / -1; grid-row: 2; }
  .host-live-toolbar { grid-column: 1 / -1; grid-row: 3; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .host-live-topbar { grid-template-columns: minmax(0, 1fr) 44px; }
  .host-live-brand { grid-column: 1; grid-row: 1; }
  .host-live-close { grid-column: 2; grid-row: 1; }
  .host-live-current,.host-live-toolbar { grid-column: 1 / -1; }
  .host-live-current { grid-row: 2; }
  .host-live-toolbar { grid-row: 3; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .host-live-toolbar > button { width: 100%; white-space: normal; }
  .host-live-player-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .host-player-heading { align-items: stretch; flex-direction: column; }
  .host-player-heading-actions { justify-content: space-between; }
  .host-live-brand { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; }
  .host-live-brand-mark { grid-column: 1; grid-row: 1; }
  .host-live-brand > div:not(.host-live-meta) { grid-column: 2; grid-row: 1; min-width: 0; }
  .host-live-brand h2 { overflow: hidden; text-overflow: ellipsis; }
  .host-live-brand > .host-live-meta { grid-column: 1 / -1; grid-row: 2; flex-wrap: wrap; padding-top: 3px; }
  .host-live-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; }
  .host-live-toolbar > button { width: 100%; white-space: normal; }
  .host-live-control-row { grid-template-columns: 1fr; }
  .host-live-section-head { align-items: stretch; flex-direction: column; }
  .host-live-player-meta { display: grid; grid-template-columns: 1fr 1fr; justify-content: stretch; }
  .host-live-player-meta button { grid-column: 1 / -1; width: 100%; }
  .host-live-player-grid { grid-template-columns: 1fr; }
  .host-live-action-groups { grid-template-columns: 1fr; }
  .host-live-action-groups > section + section { padding: 10px 0 0; border-top: 1px solid var(--pr-border); border-left: 0; }
  .host-live-cue { grid-template-columns: 1fr 1fr; }
  .host-live-cue label,.host-live-cue input { grid-column: 1 / -1; }
}

@media (max-height: 540px) and (orientation: landscape) {
  .host-live-dialog { padding-block: 8px; }
  .host-live-shell { gap: 8px; min-height: calc(100dvh - 16px); }
  .host-live-topbar { grid-template-columns: auto minmax(160px, 1fr) auto 44px; padding-bottom: 7px; }
  .host-live-brand { grid-column: 1; grid-row: 1; }
  .host-live-current { grid-column: 2; grid-row: 1; }
  .host-live-toolbar { grid-column: 3; grid-row: 1; flex-wrap: nowrap; }
  .host-live-close { grid-column: 4; grid-row: 1; }
  .host-live-control-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .host-live-access,.host-live-room-settings { padding: 10px; }
  .host-live-access .path-label,.host-live-access h3,.host-live-room-settings .path-label,.host-live-room-settings h3 { display: none; }
  .host-live-players { grid-template-rows: auto 210px auto; padding: 10px; }
  .host-live-player-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .host-live-player { min-height: 96px; }
  .host-live-cue { grid-template-columns: auto minmax(120px, 1fr) auto auto; padding: 8px; }
  .host-live-cue label,.host-live-cue input { grid-column: auto; }
}

@media (max-width: 700px) {
  .host-player-list { grid-template-columns: 1fr; }
}

.room-config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

.room-config-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-card);
  background: var(--pr-surface-1);
  box-shadow: var(--pr-shadow);
}

.room-config-copy { min-width: 0; }
.room-config-copy .path-label { margin: 0 0 3px; color: var(--pr-accent); }
.room-config-copy h2 { margin: 0; font: 800 clamp(18px, 2vw, 23px)/1.1 var(--pr-font-display); }
.room-config-status { grid-column: 2 / -1; min-height: 1.2em; margin: 4px 0 0; font-size: 12px; color: var(--pr-success); }

.room-panel-manage { min-width: 150px; padding: 0 16px; }

.room-capacity-card select { min-width: 150px; }
.room-capacity-note { margin: 4px 0 0; color: var(--pr-text-muted); font-size: 12px; }

.room-capacity-swatch {
  display: grid;
  place-items: center;
  width: 64px;
  height: 50px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-canvas);
  color: var(--pr-accent);
  font: 800 22px/1 var(--pr-font-display);
}

.room-panel-swatch {
  position: relative;
  width: 64px;
  height: 50px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-surface-2);
}

.host-shell > .style-picker-dialog {
  border-color: var(--pr-border);
  border-radius: var(--pr-radius-card);
  background: var(--pr-surface-1);
  color: var(--pr-text);
  box-shadow: var(--pr-shadow);
}

.host-shell > .style-picker-dialog::backdrop {
  background: color-mix(in srgb, var(--pr-canvas) 82%, transparent);
}

.host-shell > .style-picker-dialog .style-picker-intro,
.host-shell > .style-picker-dialog .style-picker-card__description,
.host-shell > .style-picker-dialog .style-picker-pending { color: var(--pr-text-muted); }
.host-shell > .style-picker-dialog .style-picker-card { border-color: var(--pr-border); background: var(--pr-surface-2); color: var(--pr-text); }
.host-shell > .style-picker-dialog .style-picker-card[aria-pressed="true"] { border-color: var(--pr-accent); background: color-mix(in srgb, var(--pr-accent) 9%, var(--pr-surface-2)); }
.host-shell > .style-picker-dialog .style-picker-card__badge { color: var(--pr-accent); }
.host-shell > .style-picker-dialog .style-picker-error { color: var(--pr-danger); }
.host-shell > .style-picker-dialog .primary-button { border-color: var(--pr-accent); background: var(--pr-accent); color: var(--pr-on-accent); }
.host-shell > .style-picker-dialog .secondary-action { border-color: var(--pr-border); border-radius: var(--pr-radius-control); color: var(--pr-text); }

.host-grid {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  gap: 18px;
}

.host-grid .card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 20px;
  border-color: var(--pr-border);
  border-radius: var(--pr-radius-card);
  background: var(--pr-surface-1);
  color: var(--pr-text);
  box-shadow: var(--pr-shadow);
}

.section-heading h2,
.danger-zone h2 {
  margin: 3px 0 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
  letter-spacing: -.035em;
}

.route-index {
  color: var(--pr-border);
  font: 900 32px/1 var(--pr-font-mono);
}

.qr-frame {
  position: relative;
  width: min(100%, 264px);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-qr-bg);
}

.qr-frame::before,
.qr-frame::after {
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: var(--pr-accent);
  content: "";
  pointer-events: none;
}

.qr-frame::before {
  top: -5px;
  left: -5px;
  border-top: 2px solid;
  border-left: 2px solid;
  border-radius: 8px 0 0;
}

.qr-frame::after {
  right: -5px;
  bottom: -5px;
  border-right: 2px solid;
  border-bottom: 2px solid;
  border-radius: 0 0 8px;
}

.qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
}

.url-field {
  min-width: 0;
  display: grid;
  gap: 9px;
}

.url-field code {
  min-height: 68px;
  display: block;
  overflow-wrap: anywhere;
  padding: 13px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-code-bg);
  color: var(--pr-code-text);
  font: 650 11px/1.55 var(--pr-font-mono);
  user-select: all;
}

.display-url-field code {
  min-height: 96px;
  color: var(--pr-code-text);
}

.display-url-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.display-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  text-decoration: none;
  white-space: nowrap;
}

/* No credential on this device yet: the link has no href and must not look
   like it goes anywhere. */
.display-open-link[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.compact-button,
.danger-button,
.primary-link {
  min-height: 48px;
  border-radius: 13px;
  font-weight: 800;
}

.compact-button {
  border: 1px solid var(--pr-border);
  background: var(--pr-surface-2);
  color: var(--pr-text);
}

.section-copy,
.security-content p,
.danger-zone > p,
.host-empty > p {
  margin: 0;
  color: var(--pr-text-muted);
  font-size: 13px;
}

.security-details {
  margin-top: 6px;
  border-top: 1px solid var(--pr-border);
}

.security-details summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--pr-text-muted);
  font-size: 13px;
  list-style: none;
}

.security-details summary::-webkit-details-marker { display: none; }
.security-details summary::after { color: var(--pr-accent); content: "+"; }
.security-details[open] summary::after { content: "−"; }

.security-content {
  display: grid;
  gap: 13px;
  padding: 4px 0 2px;
}

.host-grid .display-card:has(.host-device-inline) { grid-template-rows: auto auto auto 1fr auto; }

.host-device-inline {
  grid-row: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px 18px;
  padding-top: 18px;
  border-top: 1px solid var(--pr-border);
}

.host-device-inline .path-label { margin: 0 0 4px; }
.host-device-inline h3 { margin: 0; font: 800 clamp(18px, 2vw, 22px)/1.15 var(--pr-font-display); letter-spacing: -.02em; }
.host-device-inline-copy > p:last-child { max-width: 52ch; margin: 6px 0 0; color: var(--pr-text-muted); font-size: 11px; line-height: 1.55; }
.host-device-inline .compact-button { padding: 0 15px; white-space: nowrap; }
.host-advanced { margin-top: 18px; padding: 0 21px; border: 1px solid var(--pr-border); border-radius: var(--pr-radius-card); background: var(--pr-surface-1); }
.host-advanced .security-details { margin: 0; border: 0; }
.host-advanced .secondary-action { border-color: var(--pr-border); border-radius: var(--pr-radius-control); color: var(--pr-text); }

.host-credential-reset {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--pr-border);
}

.host-credential-reset .danger-button { justify-self: start; }

.host-access-dialog {
  width: min(calc(100% - 28px), 590px);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-card);
  background: var(--pr-surface-1);
  color: var(--pr-text);
  box-shadow: var(--pr-shadow);
}

.host-access-dialog::backdrop {
  background: color-mix(in srgb, var(--pr-canvas) 84%, transparent);
  backdrop-filter: blur(5px);
}

.host-access-warning {
  display: grid;
  gap: 4px;
  margin: 20px 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--pr-warning) 44%, var(--pr-border));
  border-radius: var(--pr-radius-control);
  background: color-mix(in srgb, var(--pr-warning) 7%, var(--pr-surface-2));
}

.host-access-warning strong { color: var(--pr-warning); font-size: 13px; }
.host-access-warning span { color: var(--pr-text-muted); font-size: 12px; line-height: 1.55; }

.host-access-qr-frame {
  width: min(100%, 286px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  padding: 12px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-qr-bg);
}

.host-access-qr-frame img { grid-area: 1 / 1; width: 100%; height: 100%; display: block; }
.host-access-qr-frame img:not([src]) { display: none; }
.host-access-qr-frame span { grid-area: 1 / 1; max-width: 22ch; color: #39404b; font-size: 12px; text-align: center; }
.host-access-qr-frame span[hidden] { display: none; }

.host-access-dialog-actions,
.host-access-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.host-access-dialog-actions > *,
.host-access-actions > * { flex: 1; }

.host-access-shell {
  width: min(100% - 32px, 660px);
  min-height: 100dvh;
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: max(32px, env(safe-area-inset-top)) 0 max(32px, env(safe-area-inset-bottom));
}

.host-access-card {
  width: 100%;
  padding: clamp(24px, 6vw, 42px);
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-card);
  background: var(--pr-surface-1);
  box-shadow: var(--pr-shadow);
}

.host-access-card h1 { margin: 8px 0 12px; font: 850 clamp(34px, 7vw, 54px)/1 var(--pr-font-display); letter-spacing: -.045em; }
.host-access-card > p:not(.eyebrow, .form-error) { margin: 0; color: var(--pr-text-muted); line-height: 1.65; }
.host-access-card > p strong { color: var(--pr-accent); }
.host-access-card .form-error { min-height: 1.4em; margin: 14px 0 0; }
.host-access-actions { margin-top: 22px; }
.host-access-actions .secondary-link {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius-control);
  color: var(--pr-text);
  font-weight: 800;
  text-decoration: none;
}

.host-access-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.host-access-heading h2 { margin: 4px 0 0; font-size: clamp(28px, 5vw, 42px); letter-spacing: -.04em; }

.danger-zone {
  display: grid;
  grid-template-columns: minmax(160px, .55fr) minmax(210px, .8fr) minmax(280px, 1fr);
  align-items: end;
  gap: 18px;
  margin-top: 18px;
  padding: 21px;
  border: 1px solid color-mix(in srgb, var(--pr-danger) 38%, var(--pr-border));
  border-radius: var(--pr-radius-card);
  background: color-mix(in srgb, var(--pr-danger) 5%, var(--pr-surface-1));
}

.danger-zone label {
  grid-column: 3;
  color: var(--pr-text-muted);
  font-size: 12px;
}

.danger-zone input {
  border-color: var(--pr-border);
  border-radius: var(--pr-radius-control);
  background: var(--pr-surface-2);
  color: var(--pr-text);
}

.delete-row {
  grid-column: 3;
}

.delete-row input {
  min-width: 0;
}

.danger-button {
  flex: 0 0 auto;
  padding: 0 18px;
  border: 1px solid var(--pr-danger);
  background: transparent;
  color: var(--pr-danger);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.danger-zone .form-error {
  grid-column: 3;
}

.host-error {
  min-height: 1.4em;
  margin: 12px 4px 0;
  color: var(--pr-warning);
  font-size: 12px;
}

.host-empty {
  width: min(100% - 32px, 620px);
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  place-content: center;
  justify-items: start;
  gap: 16px;
  padding: max(36px, env(safe-area-inset-top)) 0 max(36px, env(safe-area-inset-bottom));
}

.signal-orbit {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--pr-border);
  border-radius: 50%;
}

.primary-link {
  min-width: 180px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  background: var(--pr-accent);
  color: var(--pr-on-accent);
  text-decoration: none;
}

@media (max-width: 820px) {
  .room-console {
    grid-template-columns: 1fr;
  }

  .console-signal {
    grid-template-columns: 12px 1fr 12px;
    width: min(100%, 220px);
  }

  .host-grid {
    grid-template-columns: 1fr;
  }

  .room-config-row {
    grid-template-columns: 1fr;
  }

  .danger-zone {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .danger-zone label,
  .delete-row,
  .danger-zone .form-error {
    grid-column: 1;
  }
}

@media (max-width: 520px) {
  .host-header {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .host-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .host-header h1 {
    font-size: 39px;
  }

  .room-console,
  .host-grid .card {
    padding: 19px;
  }

  .room-config-card {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 15px;
  }

  .room-panel-manage,
  .room-capacity-card select,
  .room-config-status {
    grid-column: 1 / -1;
    width: 100%;
  }

  .room-meta > div {
    grid-template-columns: 100px 1fr;
  }

  .delete-row {
    align-items: stretch;
    flex-direction: column;
  }

  .host-access-dialog-actions,
  .host-access-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .host-device-inline {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .host-device-inline .compact-button { width: 100%; }

  .host-access-dialog-actions > *,
  .host-access-actions > * { width: 100%; flex: none; }

  .danger-button {
    min-height: 50px;
  }
}

/* Cross-Style tactile and contrast states */
[data-style="neumorphic-console"] button,
[data-style="neumorphic-console"] input,
[data-style="neumorphic-console"] select,
[data-style="neumorphic-console"] summary {
  border-color: color-mix(in srgb, var(--pr-border) 72%, var(--pr-text));
}

[data-style="neumorphic-console"] button:hover,
[data-style="neumorphic-console"] button:focus-visible,
[data-style="neumorphic-console"] input:focus,
[data-style="neumorphic-console"] select:focus {
  border-color: var(--pr-accent);
}

[data-style="neumorphic-console"] button:active {
  box-shadow: inset 5px 5px 10px #bec6cd, inset -5px -5px 10px #ffffff;
}

:is(
  [data-style="soft-control-surface"],
  [data-style="neumorphic-console"],
  [data-style="neo-brutal-broadcast"],
  [data-style="playful-console"],
  [data-style="storybook-playground"],
  [data-style="sweet-pop"],
  [data-style="gallery-nouveau"],
  [data-style="editorial-street"]
) .form-error {
  color: color-mix(in srgb, var(--pr-danger) 58%, var(--pr-text));
}

:is(
  [data-style="soft-control-surface"],
  [data-style="neumorphic-console"],
  [data-style="neo-brutal-broadcast"],
  [data-style="playful-console"],
  [data-style="storybook-playground"],
  [data-style="sweet-pop"],
  [data-style="gallery-nouveau"],
  [data-style="editorial-street"]
) .room-config-status {
  color: color-mix(in srgb, var(--pr-success) 45%, var(--pr-text));
}

[data-style="neo-brutal-broadcast"] button,
[data-style="gallery-nouveau"] button,
[data-style="editorial-street"] button,
[data-style="neo-brutal-broadcast"] a,
[data-style="gallery-nouveau"] a,
[data-style="editorial-street"] a {
  min-height: 44px;
}
