@import url("./site-tokens.css");

:root {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  font-synthesis: none;
  --ink: var(--color-text);
  --muted: var(--color-text-light);
  --line: var(--color-border);
  --paper: var(--color-bg);
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.in-call {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.in-call .topbar {
  display: none;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  outline-offset: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-link);
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  border-radius: 8px;
  padding: 11px 16px;
  transition: background 0.16s;
}
button:hover {
  background: var(--color-link-highlight-hover);
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
[hidden] {
  display: none !important;
}
.topbar {
  min-height: 86px;
  padding: 20px var(--spacing);
  flex-wrap: wrap;
  gap: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
  background: var(--paper);
}
.brand {
  font-size: 18px;
  letter-spacing: -0.8px;
  font-weight: 600;
}
.brand-slash {
  margin: 0 12px;
  color: var(--muted);
  font-weight: 300;
}
.brand > span:last-child {
  font-weight: 400;
  color: var(--muted);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 12px;
}
.connection {
  color: var(--muted);
}
.connection[data-state="connected"]:before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--ink);
  border-radius: 50%;
  margin-right: 8px;
}
.lobby {
  max-width: 1320px;
  margin: auto;
  padding: 96px 5vw 32px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 64px 70px;
}
.intro {
  padding: 38px 0;
}
.eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.9px;
  color: var(--muted);
  margin: 0 0 25px;
}
.intro h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(55px, 5.6vw, 82px);
  line-height: 1.03;
  letter-spacing: -3px;
  margin: 0 0 30px;
}
.intro h1 em {
  font-weight: 400;
  color: var(--muted);
}
.lede {
  font-size: 15px;
  line-height: 1.9;
  color: var(--muted);
}
.room-tags {
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 44px;
}
.room-tags span:before {
  content: "✦";
  margin-right: 7px;
  color: var(--muted);
}
.entry-card {
  padding: 36px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 16px;
  box-shadow: 0 18px 80px #0002;
}
.entry-card .eyebrow {
  margin-bottom: 15px;
}
h2 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.6px;
  font-size: 28px;
  margin: 0 0 14px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.entry-card label,
dialog > label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin: 22px 0 0;
}
input:not([type="radio"]):not([type="checkbox"]):not([type="file"]),
select,
textarea {
  display: block;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  margin-top: 8px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 24px 0;
}
legend {
  font-size: 12px;
  margin-bottom: 10px;
}
.template-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.entry-card .template-choice {
  margin: 0;
  position: relative;
  border: 1px solid var(--line);
  padding: 14px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.template-choice:has(input:checked) {
  /* Selected options stay neutral; only the primary action uses the accent. */
  border-color: color-mix(in srgb, var(--ink) 28%, var(--color-bg));
  background: color-mix(in srgb, var(--ink) 9%, var(--color-bg));
}
.template-choice input {
  position: absolute;
  right: 10px;
  top: 10px;
  accent-color: var(--ink);
}
.template-icon {
  font-size: 30px;
  font-weight: 300;
  color: var(--muted);
}
.template-choice strong {
  font-size: 12px;
}
.template-choice small {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
}
.primary {
  background: var(--color-link-highlight);
  border-color: var(--color-link-highlight);
  color: var(--ink);
}
.primary:hover {
  background: var(--color-link-highlight-hover);
}
.wide {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-top: 25px;
  padding: 15px 17px;
  font-size: 13px;
}
.button-link {
  display: inline-block;
  padding: 12px;
  border-radius: 8px;
}
.entry-card .inline-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
.inline-label input {
  accent-color: var(--ink);
}
.fineprint {
  font-size: 10px;
  line-height: 1.7;
  color: var(--muted);
}
.error {
  color: #a24537;
  font-size: 12px;
  line-height: 1.6;
}
.lobby-bottom {
  grid-column: 1/-1;
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.little-square {
  font-size: 34px;
}
.edition {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: 1.5px;
}
.camera-preview {
  height: 190px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  margin-top: 22px;
}
.camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
#preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 9px;
  color: var(--muted);
}
#preview-placeholder span {
  font-size: 50px;
}
#preview-placeholder small {
  font-size: 11px;
}
.preview-label {
  position: absolute;
  bottom: 10px;
  left: 13px;
  font-size: 10px;
  background: var(--paper);
  padding: 5px 8px;
  border-radius: 5px;
}
.device-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.device-actions button {
  font-size: 11px;
  flex: 1;
}
.device-actions button[aria-pressed="true"] {
  background: var(--color-link-highlight);
  border-color: var(--line);
}
#meeting {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--paper);
}
#world {
  position: absolute;
  inset: 0;
}
#world canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.world-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: none;
}
/* FAHDS-456: the hit player's own red edge pulse (they cannot see their avatar). */
.attack-cue { position: absolute; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 110px 36px rgb(210 0 0 / 0.8); }
.attack-cue.hit { animation: attack-cue 0.6s ease-out; }
@keyframes attack-cue { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.world-title {
  position: absolute;
  top: 34px;
  left: 40px;
  pointer-events: none;
}
.world-title .eyebrow {
  margin-bottom: 10px;
}
.world-title h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  margin: 0 0 12px;
  letter-spacing: -0.7px;
}
.world-title > span {
  font-size: 11px;
  color: var(--muted);
  background: var(--paper);
  padding: 6px 10px;
  border-radius: 20px;
}
.toolbar {
  position: absolute;
  bottom: 27px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 8px;
  background: var(--paper);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 8px 32px #0002;
}
.toolbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 65px;
  padding: 8px;
  border: 0;
  font-size: 9px;
  white-space: nowrap;
}
.toolbar button[aria-pressed="true"] {
  background: var(--color-link-highlight);
}
.tool-icon {
  font-family: Arial, sans-serif;
  font-size: 23px;
  line-height: 25px;
}
.tool-divider {
  height: 29px;
  width: 1px;
  background: var(--paper);
  margin: 0 5px;
}
.toolbar .leave {
  color: #a45443;
}
.toolbar .leave:hover {
  background: #f7e9e1;
}
.world-help {
  position: absolute;
  bottom: 124px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 22px;
  font-size: 10px;
  white-space: nowrap;
  color: var(--ink);
  text-shadow: none;
}
kbd {
  font: inherit;
  border: 1px solid var(--line);
  padding: 3px 4px;
  border-radius: 3px;
  margin-right: 2px;
}
.side-panel {
  position: absolute;
  right: 16px;
  top: 16px;
  bottom: 130px;
  width: 350px;
  z-index: 10;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 70px #0002;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.panel-heading .eyebrow {
  font-size: 8px;
  letter-spacing: 1.2px;
  margin-bottom: 10px;
}
.panel-heading button {
  border: 0;
  padding: 0 5px;
  font-size: 24px;
  line-height: 25px;
}
.panel-heading h2 {
  font-size: 25px;
}
#chat-messages {
  flex: 1;
  overflow: auto;
  margin: 15px -6px;
  padding: 0 6px;
}
.chat-message {
  margin-bottom: 18px;
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.chat-message header {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 3px;
}
.chat-message time {
  color: var(--muted);
  font-size: 9px;
  margin-left: 8px;
}
#chat-form textarea {
  resize: vertical;
  max-height: 100px;
  font-size: 12px;
}
#chat-form button {
  float: right;
  margin-top: 8px;
  font-size: 11px;
}
.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.person-info {
  flex: 1;
}
.person-hand {
  margin-right: 5px;
}
.person-info small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 5px;
}
.person-avatar {
  width: 35px;
  height: 35px;
  background: var(--color-link-highlight);
  display: grid;
  place-items: center;
  border-radius: 6px;
}
.person.speaking .person-avatar {
  outline: 2px solid var(--color-link);
}
.person button {
  font-size: 10px;
  padding: 6px;
}
.danger {
  color: #9b4035;
  margin-top: 24px;
  border-color: #d8b9af;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  width: min(460px, calc(100vw - 30px));
  padding: 28px;
  max-height: 90dvh;
  overflow: auto;
  box-shadow: 0 20px 100px #0002;
}
dialog::backdrop {
  background: #0006;
  backdrop-filter: blur(4px);
}
dialog label {
  margin-bottom: 22px;
}
dialog > label.setting-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 6px;
  cursor: pointer;
}
.setting-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ink);
}
.projector-dialog {
  width: min(1000px, calc(100vw - 30px));
  padding: 25px;
}
.presenter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.presenter-actions button,
.upload-button {
  font-size: 11px;
  padding: 11px 14px;
}
.upload-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  position: relative;
}
.upload-button input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  cursor: pointer;
}
.file-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 16px 0;
}
.file-list button {
  font-size: 10px;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 8px;
}
.file-list button[aria-pressed="true"] {
  background: transparent;
}

#upload-status,
#video-upload-status {
  font-size: 11px;
  padding-top: 10px;
  color: var(--muted);
}
.upload-actions button {
  font-size: 10px;
  margin: 8px 8px 0 0;
}
#toast {
  position: fixed;
  z-index: 30;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--ink);
  padding: 13px 20px;
  max-width: min(90vw, 560px);
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 5px 30px #0002;
  text-align: center;
}
.audio-resume {
  position: absolute;
  right: 30px;
  top: 30px;
  background: var(--paper);
  z-index: 3;
  font-size: 12px;
}
.joystick {
  display: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
#fallback {
  position: absolute;
  inset: 130px 30px 140px;
  text-align: center;
  overflow: auto;
}
#fallback-videos {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
#fallback-videos video {
  width: 200px;
  max-width: 42vw;
  border-radius: 10px;
}
#meeting-dashboard {
  grid-column: 1/-1;
}
#meeting-dashboard:empty {
  display: none;
}
#meeting-dashboard table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
#meeting-dashboard th,
#meeting-dashboard td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
@media (max-width: 850px) {
  .topbar {
    min-height: 68px;
    padding: 16px var(--spacing);
  }
  .topbar-right {
    gap: 12px;
  }
  .topbar-right .connection {
    display: none;
  }
  .lobby {
    padding: 42px 24px;
    gap: 30px;
    grid-template-columns: 1fr;
  }
  .intro {
    padding: 0;
  }
  .intro h1 {
    font-size: 62px;
  }
  .intro .eyebrow {
    font-size: 9px;
    margin-bottom: 20px;
  }
  .lede {
    font-size: 13px;
  }
  .room-tags {
    margin-top: 24px;
  }
  .entry-card {
    padding: 25px;
  }
  .lobby-bottom {
    gap: 10px;
  }
  .edition {
    display: none;
  }
  .world-title {
    left: 24px;
    top: 25px;
  }
  .world-title h1 {
    font-size: 24px;
  }
  .toolbar {
    bottom: 15px;
    width: calc(100% - 20px);
    max-width: 630px;
    justify-content: space-around;
    gap: 0;
    padding: 6px;
  }
  .toolbar button {
    min-width: 0;
    flex: 1;
    font-size: 8px;
    padding: 7px 3px;
  }
  .tool-divider {
    margin: 0 3px;
  }
  .tool-icon {
    font-size: 20px;
  }
  .world-help {
    bottom: 115px;
    font-size: 9px;
    gap: 12px;
  }
  .side-panel {
    top: 12px;
    bottom: 105px;
    right: 10px;
    width: min(350px, calc(100vw - 20px));
    padding: 20px;
  }
  .joystick {
    position: absolute;
    bottom: 145px;
    left: 24px;
    width: 95px;
    height: 95px;
    display: block;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--paper);
    touch-action: none;
    backdrop-filter: blur(4px);
  }
  .joystick span {
    display: block;
    position: absolute;
    width: 36px;
    height: 36px;
    top: 28px;
    left: 28px;
    transform: translate(var(--sx, 0px), var(--sy, 0px));
    background: var(--paper);
    border-radius: 50%;
    box-shadow: 0 2px 10px #0002;
  }
  .world-help span:first-child {
    display: none;
  }
  #toast {
    bottom: 110px;
  }
  .projector-dialog {
    padding: 18px;
  }
  .audio-resume {
    right: 20px;
    top: 100px;
    font-size: 10px;
  }
}
@media (pointer: fine) and (min-width: 851px) {
  .joystick {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.host-rooms {
  padding: 25px 0 40px;
}
.host-room {
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}
.host-room a {
  font-size: 14px;
  flex: 1;
}
.host-room small {
  font-size: 10px;
  color: var(--muted);
}
.host-room button {
  font-size: 11px;
}
.meeting-booking-form {
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.meeting-booking-form label {
  font-size: 12px;
  display: block;
}
.meeting-booking-form button {
  align-self: end;
}
.meeting-booking-card {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.meeting-booking-card input,
.meeting-booking-card select {
  max-width: 350px;
}
.meeting-booking-card button {
  margin: 8px 8px 0 0;
  font-size: 11px;
}
@media (max-width: 650px) {
  .meeting-booking-form {
    grid-template-columns: 1fr;
  }
  .host-room {
    flex-wrap: wrap;
  }
  .host-room small {
    flex-basis: 100%;
  }
}
.world-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: Arial, sans-serif;
  font-size: 18px;
  color: #fffef2a8;
  text-shadow: 0 0 3px #283d25;
  line-height: 1;
  pointer-events: none;
}
.look-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 8px 45px #0002;
  border-radius: 14px;
  padding: 22px 28px;
  text-align: center;
  max-width: calc(100% - 40px);
  width: 350px;
  backdrop-filter: blur(12px);
}
.look-overlay button {
  font-size: 13px;
  padding: 13px 27px;
}
.look-overlay p {
  font-size: 10px;
  line-height: 1.7;
  color: var(--muted);
  margin: 12px 0 0;
}
/* Video-first meeting entry and shared call stage. */
body:not(.in-call) .topbar {
  max-width: var(--max-width);
  margin: auto;
  padding: 2rem var(--spacing) 0;
  min-height: 0;
  width: 100%;
  justify-content: flex-end;
  border-bottom: 0;
  background: transparent;
}
body:not(.in-call) .brand,
body:not(.in-call) .connection {
  display: none;
}
.meeting-site-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
.meeting-site-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}
.meeting-site-nav a:hover {
  color: var(--muted);
}
body:not(.in-call) .topbar-right {
  flex-basis: 100%;
  justify-content: flex-end;
}
.lobby {
  display: block;
  max-width: var(--max-width);
  padding: 65px var(--spacing) 60px;
}
.entry-card {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  border-radius: 0;
}
.entry-card h2 {
  font-size: 42px;
  margin-bottom: 18px;
}
.entry-card > .muted {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 35px;
}
.entry-card form > label:first-child,
#create-form > label {
  width: 100%;
  max-width: 440px;
}
.setting-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 440px;
  gap: 12px;
  margin: 28px 0;
}
.setting-options legend {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}
.entry-card .setting-choice {
  margin: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 2px 14px;
  position: relative;
  cursor: pointer;
  padding: 16px 42px 16px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}
.setting-choice input {
  position: absolute;
  right: 13px;
  top: 13px;
  accent-color: var(--ink);
}
.setting-choice > span {
  grid-row: 1 / 3;
  font-size: 31px;
  line-height: 38px;
  color: var(--muted);
}
.setting-choice strong {
  font-size: 14px;
}
.setting-choice small {
  grid-column: 2;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.setting-choice:has(input:checked) {
  /* Selected options stay neutral; only Start meeting uses the accent. */
  background: color-mix(in srgb, var(--ink) 9%, var(--color-bg));
  border-color: color-mix(in srgb, var(--ink) 28%, var(--color-bg));
  box-shadow: 0 0 0 1px #0002;
}
.setting-choice.unavailable {
  opacity: 0.45;
  cursor: not-allowed;
}
.entry-card .camera-preview {
  height: 190px;
  max-width: 330px;
  margin-top: 25px;
}
.entry-card .device-actions {
  max-width: 440px;
}
.entry-card .wide {
  max-width: 440px;
}
.entry-card #display-name {
  max-width: 440px;
}
.verification {
  padding-top: 110px;
}
.verification .entry-card {
  max-width: 430px;
  margin: auto;
}
.verification #entry-title {
  font-family: var(--font-sans);
  font-size: 24px;
  letter-spacing: -0.4px;
}
.verification #verify-form > label {
  display: none;
}
/* FAHDS-441: /meet/<slug> passcode entry shares the code screen's layout. */
.verification #named-form > label {
  display: none;
}
#named-passcode,
#verification-code {
  font-size: 22px;
  letter-spacing: 4px;
  text-transform: uppercase;
  padding: 17px 18px;
}
#host-auth {
  font-size: 12px;
  color: var(--muted);
  padding: 20px 0;
}
#meeting-dashboard {
  margin-top: 65px;
}



.video-stage {
  position: absolute;
  inset: 100px 28px 117px;
}
.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  height: 100%;
  gap: 15px;
}
.video-tile {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px #0002;
}
.video-tile.is-speaking {
  outline: 3px solid var(--color-link);
  outline-offset: -3px;
}
.video-picture {
  position: absolute;
  inset: 0;
}
.video-picture video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-picture .local-camera {
  transform: scaleX(-1);
}
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--paper);
  color: var(--ink);
  gap: 15px;
}
.video-placeholder > span {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border: 1px solid var(--line);
  border-radius: 25px;
  background: var(--paper);
  font-family: var(--font-display);
  font-size: 33px;
}
.video-reconnecting {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  background: #000a;
  color: #fff;
  font-size: 12px;
  z-index: 2;
  pointer-events: none;
}
.video-reconnecting[hidden] {
  display: none;
}
/* FAHDS-432: a raised hand, top-left of the tile (Zoom-style). */
.video-hand {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f4c84a;
  font-size: 20px;
  line-height: 1.2;
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 2px 8px #0004;
}
.video-hand[hidden] {
  display: none;
}
.video-tile.hand-raised {
  outline: 3px solid #f4c84a;
  outline-offset: -3px;
}
.video-placeholder > small {
  font-size: 11px;
  color: var(--muted);
}
.video-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 18px 16px;
  background: var(--paper);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.video-caption small {
  font-size: 9px;
  color: var(--muted);
}
.video-stage.solo .video-grid {
  grid-template-columns: 1fr;
}
.video-stage.solo .video-tile {
  max-width: 330px;
  max-height: 210px;
  align-self: end;
  justify-self: end;
  width: 100%;
  height: 100%;
}
.video-waiting {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: min(440px, 85%);
  pointer-events: none;
}
.video-waiting h2 {
  font-size: 31px;
  color: var(--muted);
}
.video-waiting > p:last-child {
  font-size: 12px;
  color: var(--muted);
}
.video-stage.two-person .video-grid {
  display: block;
}
.video-stage.two-person .video-tile:not([data-self="true"]) {
  position: absolute;
  inset: 0;
}
.video-stage.two-person .video-tile[data-self="true"] {
  position: absolute;
  z-index: 2;
  right: 18px;
  bottom: 18px;
  width: 230px;
  height: 150px;
  border: 2px solid var(--line);
  box-shadow: 0 7px 20px #0002;
  border-radius: 12px;
}
.video-stage.two-person
  .video-tile[data-self="true"]
  .video-placeholder
  > span {
  width: 48px;
  height: 48px;
  font-size: 22px;
  border-radius: 14px;
}
.video-stage.two-person
  .video-tile[data-self="true"]
  .video-placeholder
  > small {
  display: none;
}
.video-stage.two-person .video-tile[data-self="true"] .video-caption {
  font-size: 10px;
  padding: 20px 12px 10px;
}
.video-presentation {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 10px 15px;
  font-size: 11px;
  max-width: 90%;
  box-shadow: 0 4px 20px #0002;
}
.video-presentation:disabled { opacity: 1; cursor: default; color: var(--ink); }
#meeting[data-view="video"] {
  background: var(--paper);
}
#meeting[data-view="video"] .world-title {
  top: 24px;
}
#meeting[data-view="video"] .world-title h1 {
  font-size: 23px;
  margin-bottom: 8px;
}
#meeting[data-view="video"] .world-title .eyebrow {
  display: none;
}
#meeting[data-view="video"] .world-title > span {
  font-size: 10px;
}
.toolbar {
  z-index: 8;
}
.chat-overlay {
  position: absolute;
  left: 28px;
  bottom: 133px;
  width: min(345px, calc(100vw - 44px));
  z-index: 10;
  color: var(--ink);
  pointer-events: none;
  font-size: 12px;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--paper);
  backdrop-filter: blur(4px);
  max-height: 45dvh;
}
.chat-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 6px;
}
.chat-topline button {
  pointer-events: auto;
  border: 0;
  padding: 2px 0;
  color: var(--muted);
  font-size: 10px;
  background: transparent;
}
.chat-topline > span {
  opacity: 0.7;
}
.chat-overlay #chat-messages {
  margin: 0;
  padding: 0;
  max-height: 185px;
  overflow: hidden;
  scrollbar-width: thin;
}
.chat-overlay .chat-message {
  font-size: 11px;
  line-height: 1.55;
  margin: 0 0 5px;
  text-shadow: none;
  white-space: pre-wrap;
}
.chat-overlay .chat-message strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}
.chat-overlay.expanded {
  background: var(--paper);
  pointer-events: auto;
}
.chat-overlay.expanded #chat-messages {
  max-height: 35dvh;
  overflow: auto;
}
.chat-overlay #chat-form {
  display: flex;
  gap: 6px;
  pointer-events: auto;
  margin-top: 10px;
}
.chat-overlay #chat-form textarea {
  margin: 0;
  background: var(--paper);
  padding: 9px;
  font-size: 11px;
  max-height: 90px;
  min-height: 36px;
  border: 0;
  flex: 1;
}
.chat-overlay #chat-form button {
  float: none;
  margin: 0;
  padding: 6px 11px;
  font-size: 17px;
  border: 1px solid var(--line);
}
.look-shield {
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  transform: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  z-index: 3;
  pointer-events: auto;
}
.look-shield button {
  box-shadow: 0 8px 45px #0002;
  background: var(--paper);
  color: var(--muted);
  border: 1px solid var(--line);
}
.look-shield p {
  background: var(--paper);
  padding: 9px 15px;
  border-radius: 8px;
  max-width: 330px;
}
.seat-context {
  position: absolute;
  bottom: 156px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  background: var(--paper);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 11px;
  padding: 8px 16px;
  border-radius: 20px;
}
.touch-jump {
  position: absolute;
  right: 25px;
  bottom: 155px;
  z-index: 3;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 26px;
  touch-action: none;
}
@media (pointer: fine) {
  .seat-context {
    pointer-events: none;
  }
  .touch-jump {
    display: none;
  }
}
@media (max-width: 850px) {
  .lobby {
    padding: 38px var(--spacing);
  }
  .verification {
    padding-top: 95px;
  }
  .entry-card h2 {
    font-size: 34px;
  }
  .setting-options {
    gap: 8px;
  }
  .entry-card .setting-choice {
    padding: 16px 38px 16px 12px;
  }
  .setting-choice small {
  grid-column: 2;
    font-size: 11px;
  }
  .meeting-site-nav {
    gap: 16px;
    font-size: 12px;
  }
  .topbar-right #host-link {
    display: none;
  }
  .video-stage {
    inset: 90px 12px 110px;
  }
  .video-grid {
    gap: 8px;
  }
  .video-tile {
    border-radius: 12px;
  }
  .video-stage.two-person .video-tile[data-self="true"] {
    right: 10px;
    bottom: 10px;
    width: 125px;
    height: 95px;
  }
  .video-stage.two-person .video-tile[data-self="true"] .video-caption small {
    display: none;
  }
  .video-stage.solo .video-tile {
    max-width: 170px;
    max-height: 115px;
  }
  .video-waiting h2 {
    font-size: 25px;
  }
  .video-waiting .eyebrow {
    font-size: 8px;
  }
  .video-caption {
    font-size: 10px;
    padding: 20px 10px 10px;
  }
  .video-caption small {
    font-size: 8px;
  }
  .video-placeholder > span {
    width: 60px;
    height: 60px;
    font-size: 26px;
  }


  .world-title {
    max-width: 55%;
  }
  .world-title h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .chat-overlay {
    left: 17px;
    bottom: 115px;
    width: min(245px, calc(100vw - 30px));
    padding: 8px 10px;
    max-height: 35dvh;
  }
  .chat-overlay #chat-messages {
    max-height: 140px;
  }
  .chat-overlay .chat-message {
    font-size: 10px;
  }
  .chat-overlay:not(.is-typing):not(.expanded) {
    max-width: calc(100vw - 165px);
  }
  .chat-overlay.is-typing,
  .chat-overlay.expanded {
    width: calc(100vw - 34px);
    max-width: none;
  }
  .seat-context {
    bottom: 224px;
    left: auto;
    right: 20px;
    transform: none;
    font-size: 10px;
  }
  .world-help {
    bottom: 101px;
    opacity: 0.85;
  }
  .video-stage[data-count="5"] .video-grid,
  .video-stage[data-count="6"] .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .verification .entry-card h2 {
    font-size: 24px;
  }
}

/* Readable neutral backing for text over live video and the unchanged 3D scene. */
.world-title {
  max-width: min(50%, 560px);
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--paper);
}
.world-title h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.world-help {
  color: var(--ink);
  background: var(--paper);
  padding: 8px 12px;
  border-radius: 8px;
}
.video-caption {
  padding: 10px 18px;
}
.video-placeholder > span,
.person-avatar {
  background: var(--color-link-highlight);
}
.primary,
.setting-choice > span,
.video-waiting h2,
.look-shield button {
  color: var(--ink);
}
.setting-choice:has(input:checked) {
  box-shadow: none;
  border-color: color-mix(in srgb, var(--ink) 28%, var(--color-bg));
}
.chat-overlay {
  border: 1px solid var(--line);
  box-shadow: 0 4px 24px #0002;
}
.chat-overlay .chat-message strong {
  color: var(--ink);
}
.chat-overlay #chat-form textarea {
  min-width: 0;
  border: 1px solid var(--line);
}
#people-list {
  overflow: auto;
  min-height: 0;
}
.host-room a,
.person-info {
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .meeting-site-nav ul {
    gap: 1rem;
  }
  .in-call .brand {
    display: none;
  }
  .in-call .topbar {
    justify-content: flex-end;
    gap: 8px 16px;
  }
  .in-call .topbar-right {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 12px;
  }
  .world-title {
    left: 12px;
    max-width: calc(100% - 170px);
    padding: 8px;
  }
  .world-title h1,
  #meeting[data-view="video"] .world-title h1 {
    font-size: 18px;
  }
  .world-title > span {
    padding: 0;
  }
  #meeting[data-view="video"] .chat-overlay {
    bottom: 245px;
  }
  .world-help {
    max-width: calc(100% - 24px);
    white-space: normal;
    gap: 8px;
    opacity: 1;
  }
}

/* Documents: local selection is separate from the shared wall. */
.document-drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 2px dashed var(--muted);
  border-radius: 10px;
  padding: 22px 14px;
  margin: 16px 0;
  text-align: center;
}
.document-drop small { flex-basis: 100%; }
.document-drop.drag-active,
.document-drop:focus-within {
  border-color: var(--ink);
  background: var(--color-link-highlight);
}
.document-drop .upload-button { position: relative; overflow: hidden; }
.document-drop .upload-button input {
  display: block;
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
#file-list button { overflow-wrap: anywhere; white-space: normal; text-align: left; }
#file-list button[aria-pressed="true"] { background: transparent; border-color: var(--ink); }
#selected-document, #upload-status { overflow-wrap: anywhere; min-width: 0; }
.projector-dialog { overflow-x: hidden; }

/* Quiet exploration with explicit, accessible controls. */
#meeting-toolbar[hidden] { display: none; }
.room-menu { position: absolute; right: 24px; bottom: 26px; z-index: 11; min-height: 44px; }
.world-help { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 10px; font-size: 10px; padding: 6px 10px; }
.world-help span { white-space: nowrap; }
.look-shield #look-description { background: rgba(12,16,24,.85); color: #f5f7fb; }
.chat-overlay,
.chat-overlay.expanded,
.chat-overlay.is-typing {
  color: #f5f7fb;
  background: rgba(12,16,24,.78);
  border: 1px solid rgba(255,255,255,.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.chat-overlay .chat-message strong { color: #dce9fa; }
.chat-overlay .chat-topline,
.chat-overlay .chat-topline button { color: #e0e6ef; }
.chat-overlay #chat-form textarea { background: rgba(0,0,0,.35); color: #fff; border-color: #ffffff50; }
.chat-overlay #chat-form textarea::placeholder { color: #c6ccd5; }
.chat-overlay button:focus-visible,
.chat-overlay textarea:focus-visible { outline: 2px solid var(--color-link-highlight); outline-offset: 2px; }
.chat-overlay #chat-form button { background: var(--color-link-highlight); color: var(--ink); }
@media (max-width: 600px) {
  .room-menu { right: 14px; bottom: 106px; }
  .world-help { max-width: calc(100% - 24px); gap: 3px 8px; font-size: 9px; }
  .world-help span:first-child { display: inline; }
  .document-drop { padding: 16px 10px; }
}

#room-code,
#current-room-code {
  overflow-wrap: anywhere;
}
#current-room-code {
  max-width: 17rem;
  margin: 0;
  font-size: .7rem;
}

/* One public entry flow at a time; native tabs retain their form drafts. */
.entry-selector { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 24px; max-width: 100%; }
.entry-selector [role="tab"] { border: 0; border-radius: 20px; padding: 8px 18px; background: transparent; color: var(--muted); }
.entry-selector [aria-selected="true"] { background: var(--ink); color: var(--paper); font-weight: 600; }
.entry-selector button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
#room-code-form { margin-top: 0; padding-top: 0; border-top: 0; }
.interaction-context { position: absolute; bottom: 156px; left: 50%; transform: translateX(-50%); z-index: 4; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 20px; padding: 10px 16px; min-height: 44px; cursor: pointer; }
.interaction-context kbd { margin-right: 8px; }
.interaction-context.is-blocked { cursor: default; color: var(--muted); font-style: italic; }
.world-help { left: auto; right: 20px; bottom: 20px; transform: none; max-width: 230px; justify-content: flex-start; pointer-events: none; }
@media (max-width: 850px) {
  .world-help { right: 14px; bottom: 18px; max-width: 210px; }
  .interaction-context { bottom: 230px; left: auto; right: 20px; transform: none; }
}
@media (pointer: coarse) {
  .world-help { max-width: 200px; }
  .world-help #raise-hint, .world-help #point-hint, .world-help #move-hint, .world-help #sprint-hint, .world-help #chat-hint, .world-help #projector-hint, .world-help #attack-hint { display: none; }
}

/* The toolbar and shortcut guide share an actual bottom edge. */
/* FAHDS-422: the key guide and the self preview share one bottom-right column,
   preview at the bottom; --hud-column-w is the single width both use. */
#meeting { --hud-bottom: max(27px, env(safe-area-inset-bottom)); --hud-right: max(20px, env(safe-area-inset-right)); --hud-column-w: 256px; }
#meeting-toolbar { bottom: var(--hud-bottom); max-width: calc(100% - 720px); flex-wrap: wrap; justify-content: center; }
#world-help { left: auto; right: var(--hud-right); bottom: var(--hud-bottom); transform: none; box-sizing: border-box; width: var(--hud-column-w); max-width: calc(100% - 28px); z-index: 11; pointer-events: auto; white-space: normal; }
.keyboard-hints { display: flex; flex-wrap: wrap; gap: 8px 10px; }
/* Local computer chrome sits above the measured Keys/menu bounds. */
.computer-chrome { position: absolute; right: var(--hud-right, 12px); bottom: var(--hud-bottom, 12px); width: 340px; max-width: calc(100% - 28px); box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 6px; pointer-events: auto; background: #000; color: #fff; border: 1px solid #555; border-radius: 8px; font: 14px/1.4 system-ui; }
.computer-address, .computer-controls { display: flex; gap: 4px; margin: 0; }
.computer-chrome .computer-address input[type="text"] { flex: 1; min-height: 36px; width: 0; min-width: 0; margin: 0; padding: 6px 8px; border: 1px solid #555; border-radius: 4px; background: #000; color: #fff; font: inherit; }
.computer-address input::placeholder { color: #aaa; }
.computer-chrome button, .computer-chrome a { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; margin: 0; padding: 4px 8px; border: 1px solid #555; border-radius: 4px; background: #000; color: #fff; font: inherit; text-decoration: none; }
.computer-chrome button:disabled, .computer-chrome a[aria-disabled="true"] { opacity: .4; }
.computer-chrome :is(input, button, a):focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.computer-controls .computer-exit { margin-left: auto; }
.computer-error { margin: 0; color: #ffb5b5; font-size: 12px; }
.computer-refusal { position: absolute; inset: 0; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 48px; background: #111; color: #fff; text-align: center; font: 18px/1.4 system-ui; }
.computer-refusal[hidden] { display: none; }
.computer-refusal h2 { margin: 0; font-size: 28px; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; }
.computer-refusal p { margin: 0; color: #ccc; }
.computer-refusal a { padding: 10px 18px; border: 1px solid #888; border-radius: 6px; color: #fff; text-decoration: none; }
.computer-refusal a:hover { background: #222; }
.computer-refusal a:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
#world-help[data-mode="computer"] .keyboard-hints { box-sizing: border-box; overflow-y: auto; }
#world-help[data-mode="computer"] #move-hint,
#world-help[data-mode="computer"] #sprint-hint,
#world-help[data-mode="computer"] #look-hint,
#world-help[data-mode="computer"] #chat-hint,
#world-help[data-mode="computer"] #seat-hint,
#world-help[data-mode="computer"] #raise-hint,
#world-help[data-mode="computer"] #point-hint,
#world-help[data-mode="computer"] #attack-hint { display: none; }
#keys-toggle { display: none; min-width: 54px; min-height: 44px; }
#room-menu { bottom: var(--hud-bottom); right: calc(var(--hud-right) + var(--hud-column-w) + 8px); }
#keys-toggle:focus-visible, .upload-button:focus-within { outline: 2px solid var(--ink); outline-offset: 3px; }
@media (max-width: 1200px) {
  #meeting { --hud-bottom: max(15px, env(safe-area-inset-bottom)); --hud-right: max(14px, env(safe-area-inset-right)); }
  #world-help { width: auto; padding: 0; }
  #keys-toggle { display: block; }
  .keyboard-hints { display: none; position: absolute; right: 0; bottom: calc(100% + 8px); box-sizing: border-box; width: min(var(--hud-column-w), calc(100vw - 28px)); max-height: calc(100dvh - 90px); overflow-y: auto; padding: 12px; border-radius: 8px; background: var(--paper); box-shadow: 0 4px 20px #0002; }
  #keys-toggle[aria-expanded="true"] + .keyboard-hints { display: flex; }
  #meeting-toolbar { left: 12px; right: calc(var(--hud-right) + var(--hud-column-w) + 8px); width: auto; max-width: none; transform: none; }
}
@media (max-width: 700px) {
  #meeting { --hud-column-w: clamp(160px, 42vw, 256px); }
  #meeting-toolbar { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: calc(var(--hud-bottom) + 54px); gap: 2px; }
  #meeting-toolbar button { min-width: 44px; flex: 1 0 44px; }
  #meeting-toolbar .tool-divider { display: none; }
  #meeting .chat-overlay, #meeting .side-panel { bottom: calc(var(--hud-bottom) + 200px); max-height: calc(100dvh - var(--hud-bottom) - 225px); overflow-y: auto; }
}
@media (max-width: 600px) and (pointer: fine) {
  #world-help[data-mode="computer"] span { white-space: normal; }
}
@media (pointer: coarse) {
  #meeting { --hud-column-w: clamp(160px, 42vw, 256px); }
  #world-help { display: none; }
  #room-menu { right: var(--hud-right); }
  #meeting-toolbar { left: 12px; right: 12px; bottom: calc(var(--hud-bottom) + 54px); width: auto; max-width: none; transform: none; }
}

/* Compact document selection and separate live room controls. */
.projector-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 18px; overflow-y: auto; }
.projector-dialog .panel-heading { margin-bottom: 10px; }
.projector-dialog h2, .projector-dialog p { margin: 0; }
.projector-dialog .presenter-actions { justify-content: space-between; margin-bottom: 10px; }
.projector-dialog .presenter-actions p { flex: 1; min-width: 120px; }
.projector-dialog .document-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 140px; padding: 18px; margin: 0; }
.projector-dialog .document-drop label { margin: 0; }
.projector-dialog .document-drop small { flex-basis: auto; font-size: 11px; }
.projector-dialog .upload-button { min-height: 40px; display: inline-flex; align-items: center; }
.projector-dialog #upload-status:not(:empty) { margin-top: 6px; font-size: 11px; }
.projector-dialog .upload-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.projector-dialog .file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); max-height: 250px; overflow-y: auto; overflow-x: hidden; gap: 8px; margin: 10px 0; }
.projector-dialog .file-list:empty { display: none; }
.projector-dialog .file-list button { min-width: 0; max-width: none; padding: 5px; display: flex; flex-direction: column; align-items: center; gap: 4px; background: transparent; color: var(--ink); border: 1px solid var(--line); }
.projector-dialog .file-list button[aria-pressed="true"] { background: transparent; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.file-list canvas, .thumbnail-fallback { width: 72px; height: 72px; object-fit: contain; }
.thumbnail-fallback { display: grid; place-items: center; background: #8881; }
.thumbnail-caption { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.thumbnail-marker { min-height: 1.2em; font-size: 10px; }
.presenter-handoff { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.presenter-handoff label { margin: 0; }
.presenter-handoff select { flex: 1 1 160px; min-width: min(160px, 100%); max-width: 100%; }
@media (max-width: 500px) { .presenter-handoff label { flex-basis: 100%; } }
.projector-live-controls { position: absolute; right: var(--hud-right); bottom: calc(var(--hud-bottom) + 52px); z-index: 11; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: 230px; max-width: calc(100% - 28px); box-sizing: border-box; padding: 8px; border-radius: 8px; background: var(--paper); color: var(--ink); overflow-y: auto; }
#document-canvas[hidden], .projector-live-controls[hidden] { display: none; }
#world-help[data-projector="true"] .keyboard-hints { max-height: 30dvh; box-sizing: border-box; overflow-y: auto; }
.projector-live-controls output { grid-column: 1 / -1; font-size: 12px; }
.projector-live-controls .projector-hud-group { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.projector-live-controls .projector-hud-group:empty, .projector-hud-group[hidden], .projector-panel[hidden] { display: none; }
.projector-modes { margin-bottom: 12px; }
.projector-mode { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.projector-mode button { min-height: 40px; padding: 6px 8px; background: transparent; color: var(--ink); border: 1px solid var(--line); }
.projector-mode button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
.projector-mode button:disabled { cursor: default; opacity: 1; }
.projector-mode button:disabled:not([aria-pressed="true"]) { color: var(--muted); }
.projector-mode button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.projector-dialog #projector-mode-hint { font-size: 11px; margin-top: 6px; }
.projector-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 140px; padding: 18px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; }
.projector-live-controls button { min-width: 44px; min-height: 44px; padding: 5px; font-size: 12px; }
.projector-live-controls button:focus-visible, .file-list button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (max-height: 650px) { .projector-dialog .document-drop { min-height: 110px; } }
.project-selection { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.project-selection p { flex: 1; max-height: 3.5em; overflow-y: auto; }
.projector-dialog #project-guidance { font-size: 11px; margin-top: 6px; }

#entry-description:empty { display: none; }

/* FAHDS-390: the shared whiteboard editor fills the viewport. */
.whiteboard-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  display: none;
  flex-direction: column;
  background: #fff;
}
.whiteboard-dialog[open] { display: flex; }
.whiteboard-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(6px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.whiteboard-bar h2 { margin: 0; font-size: 16px; }
.whiteboard-bar .muted { flex: 1; font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whiteboard-bar button { min-height: 36px; }
#close-whiteboard { min-width: 44px; font-size: 20px; }
.whiteboard-root {
  position: relative;
  flex: 1;
  min-height: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.whiteboard-root .excalidraw { --zIndex-modal: 1000; }
/* FAHDS-434: the projector frame guide over the editor (never takes input). */
.whiteboard-host { position: absolute; inset: 0 0 env(safe-area-inset-bottom) !important; z-index: 0; }
.whiteboard-frame-layer { position: absolute; inset: 0 0 env(safe-area-inset-bottom) !important; z-index: 1; overflow: hidden; pointer-events: none; }
.whiteboard-frame { position: absolute; border: 2px dashed rgba(70, 86, 59, .5); border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(30, 36, 26, .06); pointer-events: none; }
.whiteboard-frame span { position: absolute; right: 6px; bottom: 4px; font: 500 11px/1.2 system-ui, sans-serif;
  color: rgba(70, 86, 59, .75); letter-spacing: .02em; pointer-events: none; }
/* Libraries are not part of v1: no external "Browse libraries" link. */
.whiteboard-root .library-menu-browse-button { display: none !important; }
.whiteboard-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
@media (max-width: 480px) { .whiteboard-bar .muted { display: none; } .whiteboard-bar h2 { flex: 1; } }
/* FAHDS-451: Normal view's shared board fills the meeting area; the toolbar
   (z 8), chat and side panels (z 10) stay above it. */
.shared-board { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; background: #fff; }
.shared-board[hidden] { display: none; }
.shared-board .whiteboard-root { padding-bottom: 0; }
#close-shared-board { min-width: 44px; font-size: 20px; }
#meeting.shared-board-open .self-preview { display: none; }

/* FAHDS-401: pre-join device check, mic level meter, permission dialog. */
.device-check {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.device-check-title {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
}
.device-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.device-row {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.device-row:first-child {
  border-top: 0;
}
.device-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
}
.device-status {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.device-row[data-state="on"] .device-status {
  color: var(--ink);
}
.device-row[data-state="failed"] .device-status,
.device-row[data-state="denied"] .device-status {
  color: #9b4035;
}
.device-row button {
  font-size: 12px;
  justify-self: start;
  padding: 8px 14px;
}
.device-row button[aria-pressed="true"] {
  background: var(--color-link-highlight);
}
.entry-card .device-picker {
  margin: 0;
  font-size: 12px;
}
.entry-card .device-picker select {
  margin-top: 4px;
  padding: 8px 10px;
  font-size: 13px;
}
.device-help {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, var(--paper));
  border-radius: 6px;
  padding: 8px 10px;
}
.mic-meter {
  --level: 0%;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 10%, var(--paper));
  overflow: hidden;
}
.mic-meter > span {
  display: block;
  height: 100%;
  width: var(--level);
  background: var(--ink);
  transition: width 0.08s linear;
}
.text-button {
  display: block;
  margin: 10px auto 0;
  border: 0;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.permission-dialog {
  width: min(440px, calc(100vw - 32px));
}
.permission-dialog p {
  font-size: 14px;
  line-height: 1.6;
}
.permission-dialog .mic-meter {
  margin: 12px 0 4px;
}
.permission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.permission-actions .primary {
  flex: 1 1 auto;
}
.permission-dialog .device-status {
  text-align: left;
}

/* FAHDS-413: mirrored self-camera preview, bottom-right in the Office view.
   app.mjs lifts it above whatever HUD shares its column; it never takes input.
   FAHDS-422: 16:9, exactly the key guide's width (--hud-column-w); the guide
   stacks directly above it. */
.self-preview { position: absolute; right: var(--hud-right, 20px); bottom: var(--hud-bottom, 20px); z-index: 3; box-sizing: border-box; width: var(--hud-column-w, 256px); aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 4px 20px #0002; pointer-events: none; user-select: none; }
.self-preview[hidden] { display: none; }
.self-preview video { display: block; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.self-preview[data-state="video"] .self-preview-off { display: none; }
.self-preview[data-state="off"] { width: auto; aspect-ratio: auto; padding: 6px 12px; border-radius: 20px; color: var(--muted); font-size: 12px; }
.self-preview[data-state="off"] video { display: none; }
/* FAHDS-422: on narrow screens the collapsed chat ends before the preview
   column instead of running under it; typing/expanded chat may cover it. */
@media (max-width: 850px) {
  #meeting .chat-overlay:not(.expanded):not(.is-typing) { box-sizing: border-box; max-width: calc(100vw - 17px - var(--hud-right) - var(--hud-column-w) - 8px); }
}

/* FAHDS-389: video library in the presenter menu. */
.video-list button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.video-list .video-meta { color: var(--muted); }
.video-list .thumbnail-marker:empty { display: none; }
/* FAHDS-389 phase B: the shared projector video. */
.video-holder { position: fixed; left: 0; top: 0; width: 2px; height: 2px; overflow: hidden; opacity: .01; pointer-events: none; z-index: -1; }
.video-holder video { width: 2px; height: 2px; }
.video-screen { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; border-radius: 18px; background: #000; }
.video-screen[hidden] { display: none; }
.video-screen video { display: block; width: 100%; height: 100%; object-fit: contain; }
.video-stage.has-screen { display: flex; flex-direction: column; gap: 12px; }
.video-stage.has-screen .video-waiting { display: none; }
.video-stage.has-screen .video-grid { display: grid; flex: 0 0 26%; height: auto; min-height: 0; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); grid-auto-rows: 1fr; }
.video-stage.has-screen .video-grid .video-tile { position: relative; inset: auto; width: auto; height: auto; max-width: none; max-height: none; align-self: stretch; justify-self: stretch; }
.video-stage.has-screen .video-presentation { top: 8px; }
.video-sound { position: absolute; right: 30px; top: 74px; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: calc(100% - 32px); box-sizing: border-box; padding: 6px 10px; border-radius: 8px; background: var(--paper); color: var(--ink); font-size: 12px; box-shadow: 0 4px 20px #0002; }
.video-sound[hidden], .video-sound [hidden] { display: none; }
.video-sound button { min-height: 36px; padding: 4px 10px; font-size: 12px; }
#video-volume { display: inline-block; width: 110px; margin: 0; padding: 0; border: 0; background: transparent; }
.video-transport { display: grid; gap: 8px; margin-top: 12px; }
.video-transport[hidden] { display: none; }
.video-transport-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.video-transport-buttons button { min-height: 40px; }
#video-scrub { width: 100%; margin: 0; padding: 0; border: 0; background: transparent; }
.video-transport small { font-size: 11px; }
.projector-live-controls .video-hud-time { grid-column: 1 / -1; font-size: 12px; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .video-sound { right: 12px; top: 64px; }
  .video-stage.has-screen .video-grid { flex-basis: 30%; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
}

/* Mobile movement: the joystick shows on every touch screen (iPads and
   landscape phones are wider than 850px), reads clearly against the office,
   and the chat sits above it instead of covering it. */
@media (pointer: coarse) {
  #meeting .joystick {
    display: block;
    position: absolute;
    left: 20px;
    bottom: 145px;
    width: 104px;
    height: 104px;
    z-index: 11;
    border: 2px solid color-mix(in srgb, var(--ink) 45%, transparent);
    border-radius: 50%;
    background: color-mix(in srgb, var(--paper) 55%, transparent);
    box-shadow: 0 4px 18px #0003;
    touch-action: none;
    backdrop-filter: blur(4px);
  }
  #meeting .joystick span {
    width: 44px;
    height: 44px;
    top: 28px;
    left: 28px;
    background: color-mix(in srgb, var(--ink) 75%, transparent);
    box-shadow: 0 2px 10px #0004;
  }
  #meeting .joystick[hidden] { display: none; }
  #meeting .chat-overlay { bottom: calc(145px + 104px + 12px); }
}

/* Phone action wheel (GTA-style): a round button on the right opens a ring
   of the keyboard actions (E, Stand, Jump, T, P, L, M); tapping one runs it
   and closes the wheel. */
.touch-actions, .action-wheel { display: none; }
@media (pointer: coarse) {
  #meeting .touch-actions:not([hidden]) {
    display: grid;
    place-items: center;
    position: absolute;
    right: 20px;
    bottom: 225px;
    z-index: 11;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--ink) 45%, transparent);
    background: var(--paper);
    color: var(--ink);
    font-size: 30px;
    line-height: 1;
    box-shadow: 0 4px 18px #0003;
    touch-action: manipulation;
  }
  #meeting .action-wheel:not([hidden]) {
    display: grid;
    place-items: center;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: color-mix(in srgb, #000 35%, transparent);
    backdrop-filter: blur(2px);
  }
}
/* Modern action wheel: frosted glass ring, thin dividers, line icons. */
.action-wheel-ring {
  --slices: 7;
  position: relative;
  width: min(300px, 86vw, 86dvh);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from calc(-180deg / var(--slices)),
      transparent 0 calc(360deg / var(--slices) - .6deg),
      #ffffff1f calc(360deg / var(--slices) - .6deg) calc(360deg / var(--slices))),
    radial-gradient(circle, transparent 0 33%, #ffffff10 33.5% 34%, transparent 34.5%),
    #16161ab8;
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid #ffffff26;
  box-shadow: 0 20px 60px #0007, inset 0 1px 0 #ffffff1a;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  animation: action-wheel-in .16s ease-out;
}
@keyframes action-wheel-in { from { opacity: 0; transform: scale(.9); } }
.action-wheel-ring button {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.action-wheel-item {
  width: 76px;
  height: 68px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 4px;
  border-radius: 16px;
  line-height: 1.15;
  text-align: center;
  transition: background .12s, transform .12s;
}
.action-wheel-item .action-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.action-wheel-item:not(:disabled):active { background: #ffffff26; }
.action-wheel-item:disabled { opacity: .28; }
.action-wheel-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40%;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 2px;
  pointer-events: none;
  text-align: center;
}
.action-wheel-hub strong { font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.action-wheel-hub span { font-size: 11px; opacity: .55; }

/* Shown from entering the Office view until the 3D world is ready. */
.world-loading { display: none; }
#meeting .world-loading:not([hidden]) {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--color-bg, var(--paper));
  color: var(--muted);
  font-size: 15px;
}
.world-loading-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--ink) 15%, transparent);
  border-top-color: var(--ink);
  animation: world-loading-spin .8s linear infinite;
}
@keyframes world-loading-spin { to { transform: rotate(360deg); } }

#meeting.toolbar-open :is(.joystick, .touch-actions, .touch-jump),
#meeting.world-loading-active :is(.joystick, .touch-actions, .touch-jump, .chat-overlay) { visibility: hidden; }

/* ---- Phone room layout (Zoom-style): joystick bottom-left, action wheel
   bottom-right, ⋯ top-right opening a bottom sheet, Twitch-style chat
   top-right, no title card or jump button. ---- */
@media (pointer: coarse) {
  #meeting[data-view="room"] .world-title,
  #meeting[data-view="room"] .touch-jump,
  #meeting[data-view="room"] #chat-key-hint { display: none !important; }
  #meeting.world-loading-active .toolbar { display: none !important; }

  #meeting[data-view="room"] .joystick {
    left: 20px;
    bottom: calc(24px + env(safe-area-inset-bottom));
  }
  #meeting[data-view="room"] .touch-actions:not([hidden]) {
    right: 20px;
    bottom: calc(40px + env(safe-area-inset-bottom));
    width: 72px;
    height: 72px;
  }

  #meeting:is([data-view="room"], [data-view="video"]) .room-menu {
    top: calc(14px + env(safe-area-inset-top));
    right: 14px;
    bottom: auto;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    background: color-mix(in srgb, var(--paper) 85%, transparent);
    box-shadow: 0 2px 10px #0003;
  }
  #meeting:is([data-view="room"], [data-view="video"]) .room-menu::before { content: "⋯"; font-size: 24px; line-height: 1; }

  #meeting[data-view="room"] .chat-overlay {
    top: calc(20px + env(safe-area-inset-top));
    left: 14px;
    right: auto;
    bottom: auto !important;
    width: min(240px, calc(100vw - 90px));
    max-width: none !important;
    background: transparent;
    backdrop-filter: none;
    border: 0;
    box-shadow: none;
    color: #fff;
    text-shadow: 0 1px 2px #000, 0 0 6px #000a;
  }
  #meeting[data-view="room"] .chat-overlay #chat-history { color: #fff; text-shadow: inherit; }
  #meeting[data-view="room"] .chat-overlay.is-typing #chat-form {
    background: var(--paper);
    border-radius: 10px;
    text-shadow: none;
  }

  #meeting[data-view="room"] .self-preview {
    top: calc(66px + env(safe-area-inset-top)) !important;
    right: 14px !important;
    left: auto !important;
    bottom: auto !important;
    width: 120px !important;
  }

  /* ⋯ opens the toolbar as a bottom sheet of rows. */
  #meeting:is([data-view="room"], [data-view="video"]) .toolbar:not([hidden]) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    transform: none;
    z-index: 41;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    max-height: 70dvh;
    overflow-y: auto;
    padding: 10px 10px calc(14px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    border: 0;
    box-shadow: 0 0 0 100vmax #0006, 0 -8px 30px #0003;
  }
  #meeting:is([data-view="room"], [data-view="video"]) .toolbar:not([hidden]) > button:not([hidden]) {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 16px;
    text-align: left;
  }
  #meeting:is([data-view="room"], [data-view="video"]) .toolbar .tool-divider { display: none; }
  #meeting.toolbar-open:is([data-view="room"], [data-view="video"]) .room-menu { visibility: hidden; }
  #meeting:is([data-view="room"], [data-view="video"]) .toolbar:not([hidden]) > .toolbar-close {
    order: -1;
    position: sticky;
    top: -10px;
    z-index: 1;
    justify-content: center;
    margin-bottom: 6px;
    background: color-mix(in srgb, var(--ink) 8%, var(--paper));
    font-weight: 600;
  }
}
.toolbar-close { display: none !important; }
@media (pointer: coarse) {
  #meeting:is([data-view="room"], [data-view="video"]) .toolbar:not([hidden]) > .toolbar-close { display: flex !important; }
}
/* FAHDS-443: first/third person lives in the phone ⋯ sheet; desktop uses V or Settings. */
.camera-view-toggle { display: none !important; }
@media (pointer: coarse) {
  #meeting[data-view="room"] .toolbar:not([hidden]) > .camera-view-toggle { display: flex !important; }
}
/* The "Camera off" chip is noise while navigating; only a live preview shows. */
.self-preview[data-state="off"] { display: none !important; }

/* Projector controls: same width as the key guide column; whiteboard mode is
   two condensed rows, [L] Laser and [B] Open whiteboard. */
#meeting .projector-live-controls { width: var(--hud-column-w, 256px); max-width: calc(100% - 28px); }
.projector-live-controls:has([data-mode-hud="whiteboard"]:not([hidden])) output { display: none; }
.projector-live-controls [data-mode-hud="whiteboard"] { grid-template-columns: 1fr; }
.projector-live-controls [data-mode-hud="whiteboard"] button {
  display: flex; align-items: center; gap: 8px; justify-content: flex-start;
  min-height: 0; padding: 2px 0; border: 0; background: none; font-size: 13px; text-align: left;
}
.projector-live-controls .projector-laser-key { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 13px; }
/* FAHDS-461: condensed desktop panel — short two-column buttons, tight gaps.
   Phones (pointer: coarse) keep their 48px rail buttons below. */
#meeting .projector-live-controls { gap: 3px; padding: 6px; }
#meeting .projector-live-controls .projector-hud-group { gap: 3px; }
#meeting .projector-live-controls .projector-hud-group:not([data-mode-hud="whiteboard"]) button { min-height: 30px; padding: 2px 6px; line-height: 1.2; }
#meeting .projector-live-controls :is(output, .projector-laser-key) { line-height: 1.3; }

/* Phone chat: no input until Chat is picked in the wheel; legible text with
   no panel behind it. */
@media (pointer: coarse) {
  #meeting[data-view="room"] .chat-overlay:not(.is-typing) #chat-form { display: none !important; }
  #meeting[data-view="room"] .chat-overlay .chat-message,
  #meeting[data-view="room"] .chat-overlay #chat-history {
    color: #fff;
    font-weight: 600;
    text-shadow: 0 0 2px #000, 0 0 2px #000, 0 1px 3px #000, 0 0 8px #000c;
  }
  #meeting[data-view="room"] .chat-overlay .chat-message strong { color: #ffd76a; }
}

/* Phone chat entry (Twitch-style): a bar at the bottom centre above the
   keyboard with a Send button. 16px text stops iOS Safari zooming in. */
@media (pointer: coarse) {
  #meeting[data-view="room"] .chat-overlay.is-typing #chat-form:not([hidden]) {
    position: fixed;
    left: 50%;
    bottom: calc(12px + var(--keyboard-inset, 0px) + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 45;
    display: flex !important;
    align-items: center;
    gap: 8px;
    width: min(92vw, 440px);
    box-sizing: border-box;
    padding: 8px;
    border-radius: 14px;
    background: var(--paper);
    box-shadow: 0 8px 30px #0005;
    text-shadow: none;
  }
  #meeting[data-view="room"] .chat-overlay #chat-input {
    flex: 1 1 auto;
    min-height: 40px;
    font-size: 16px;
    resize: none;
    color: var(--ink);
    background: var(--color-bg, var(--paper));
  }
  #meeting[data-view="room"] .chat-overlay #chat-form button {
    flex: none;
    min-width: 64px;
    min-height: 40px;
    font-size: 0;
    border-radius: 10px;
  }
  #meeting[data-view="room"] .chat-overlay #chat-form button::after { content: "Send"; font-size: 15px; font-weight: 600; }
}

/* Phone presenter: a round button above the wheel while presenting; it opens
   the live projector controls as a bottom panel. */
.touch-presenter { display: none; }
@media (pointer: coarse) {
  #meeting[data-view="room"] .touch-presenter:not([hidden]) {
    display: grid;
    place-items: center;
    position: absolute;
    right: 24px;
    bottom: calc(126px + env(safe-area-inset-bottom));
    z-index: 11;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--ink) 45%, transparent);
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 4px 18px #0003;
    touch-action: manipulation;
  }
  #meeting.presenter-panel-open .touch-presenter { background: var(--ink) !important; color: var(--paper) !important; }
  #meeting .touch-presenter svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  #meeting[data-view="room"] .projector-live-controls { display: none !important; }
  #meeting[data-view="room"].presenter-panel-open .projector-live-controls:not([hidden]) {
    display: grid !important;
    position: fixed;
    left: 50%;
    right: auto;
    bottom: calc(206px + env(safe-area-inset-bottom)) !important;
    transform: translateX(-50%);
    width: min(92vw, 360px) !important;
    max-height: 50dvh !important;
    z-index: 42;
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 10px 40px #0005;
  }
  #meeting[data-view="room"].presenter-panel-open .projector-live-controls button { min-height: 48px; font-size: 14px; }
  #meeting[data-view="room"] .projector-live-controls .projector-laser-key kbd { display: none; }
}
/* Phone chat: just the messages, no "Chat N" header. */
@media (pointer: coarse) {
  #meeting[data-view="room"] .chat-overlay .chat-topline { display: none !important; }
}
/* No "Chat N" title anywhere; desktop keeps only the "T to type" hint. */
#meeting .chat-overlay #chat-history { display: none !important; }

/* FAHDS-439: no double-tap / pinch page zoom in the meeting on phones. The 3D
   canvas and joystick already use touch-action: none; everything else only
   pans/taps. Inputs keep 16px text, so focus never zooms either. */
body.in-call, body.in-call #meeting { touch-action: manipulation; }

/* FAHDS-438: phone presenter controls are a slim vertical rail on the right,
   between the ⋯ menu (top) and the presenter/wheel buttons (bottom). Icons
   only (aria-labels stay), no scrim, so the 3D view and its gestures stay live. */
@media (pointer: coarse) {
  #meeting[data-view="room"].presenter-panel-open .projector-live-controls:not([hidden]) {
    --rail-top: calc(72px + env(safe-area-inset-top));
    --rail-bottom: calc(204px + env(safe-area-inset-bottom));
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: fixed;
    left: auto;
    right: calc(16px + env(safe-area-inset-right));
    top: calc((var(--rail-top) + 100dvh - var(--rail-bottom)) / 2);
    bottom: auto !important;
    transform: translateY(-50%);
    width: 60px !important;
    max-width: none;
    max-height: calc(100dvh - var(--rail-top) - var(--rail-bottom)) !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
    border-radius: 30px;
    background: color-mix(in srgb, var(--paper) 72%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 18px #0003;
    touch-action: pan-y;
  }
  #meeting[data-view="room"] .projector-live-controls :is(output, .projector-laser-key, .video-hud-time) { display: none !important; }
  #meeting[data-view="room"] .projector-live-controls .projector-hud-group:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  #meeting[data-view="room"].presenter-panel-open .projector-live-controls button {
    display: grid;
    place-items: center;
    flex: none;
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    line-height: 1;
    touch-action: manipulation;
  }
  #meeting[data-view="room"] .projector-live-controls button kbd { display: none; }
  #meeting[data-view="room"] .projector-live-controls button::before { font-size: 22px; font-weight: 600; }
  #meeting[data-view="room"] .projector-live-controls [data-command="previous"]::before { content: "‹"; content: "‹" / ""; font-size: 28px; }
  #meeting[data-view="room"] .projector-live-controls [data-command="next"]::before { content: "›"; content: "›" / ""; font-size: 28px; }
  #meeting[data-view="room"] .projector-live-controls [data-command="left"]::before { content: "←"; content: "←" / ""; }
  #meeting[data-view="room"] .projector-live-controls [data-command="right"]::before { content: "→"; content: "→" / ""; }
  #meeting[data-view="room"] .projector-live-controls [data-command="up"]::before { content: "↑"; content: "↑" / ""; }
  #meeting[data-view="room"] .projector-live-controls [data-command="down"]::before { content: "↓"; content: "↓" / ""; }
  #meeting[data-view="room"] .projector-live-controls [data-command="zoomOut"]::before { content: "−"; content: "−" / ""; }
  #meeting[data-view="room"] .projector-live-controls [data-command="zoomIn"]::before { content: "+"; content: "+" / ""; }
  #meeting[data-view="room"] .projector-live-controls [data-video-command="toggle"]::before { content: "▶"; content: "▶" / ""; }
  #meeting[data-view="room"] .projector-live-controls [data-video-command="toggle"][data-label="Pause"]::before { content: "❚❚"; content: "❚❚" / ""; font-size: 16px; }
  #meeting[data-view="room"] .projector-live-controls [data-video-command="restart"]::before { content: "↺"; content: "↺" / ""; }
  #meeting[data-view="room"] .projector-live-controls [data-video-command="back"]::before { content: "«"; content: "«" / ""; }
  #meeting[data-view="room"] .projector-live-controls [data-video-command="forward"]::before { content: "»"; content: "»" / ""; }
  #meeting[data-view="room"] .projector-live-controls [data-whiteboard="open"]::before { content: "✎"; content: "✎" / ""; }
}
/* No focus ring around the chat box while typing. */
#meeting .chat-overlay #chat-input:focus,
#meeting .chat-overlay #chat-input:focus-visible { outline: none !important; box-shadow: none !important; }
/* "Copy invite" already carries the room link; no separate "Copy code". */
#meeting #copy-code { display: none !important; }
/* Normal view: your own camera sits in the bottom-right corner (solo too). */
#meeting[data-view="video"] .video-stage.solo .video-tile {
  position: absolute; z-index: 2; right: 18px; bottom: 18px;
  width: 300px; height: 190px; max-width: none; max-height: none;
}
@media (max-width: 850px) {
  #meeting[data-view="video"] .video-stage.solo .video-tile { width: 170px; height: 115px; }
}
/* The Office/Normal button is a switch, never shown as "selected". */
#meeting #toggle-view,
#meeting #toggle-view[aria-pressed="true"] { background: transparent; box-shadow: none; }
/* Wide desktop Normal view: the self tile drops to the window's bottom-right
   corner, level with the toolbar (the stage stops 117px above the bottom). */
@media (min-width: 1400px) and (pointer: fine) {
  #meeting[data-view="video"] .video-stage.solo .video-tile { right: -10px; bottom: -99px; }
}
/* The room id is internal; links and passcodes are what people share. */
#current-room-code { display: none !important; }

/* FAHDS-461: compact desktop key guide (smaller kbd chips, tighter rows) so
   the presenter panel and the guide form one short right column. */
@media (pointer: fine) {
  #world-help .keyboard-hints { gap: 2px 8px; line-height: 1.5; }
  #world-help kbd, #meeting .projector-live-controls .projector-laser-key kbd { padding: 0 4px; font-size: 11px; line-height: 16px; }
}
/* FAHDS-461: phones — the interaction prompt ("Present", "Stand", doors,
   blinds) sits centred above the joystick, clear of the presenter rail on the
   right and the presenter/action buttons; the open ⋯ sheet hides the rail
   instead of running underneath it. */
@media (pointer: coarse) {
  #meeting[data-view="room"] .interaction-context {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: calc(150px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    max-width: calc(100% - 172px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #meeting.toolbar-open :is(.projector-live-controls, .touch-presenter) { visibility: hidden; }
  /* Eight rail buttons (pages, four scroll directions, zoom) fit the rail
     between ⋯ and the presenter button on an iPhone 13 without scrolling. */
  #meeting[data-view="room"].presenter-panel-open .projector-live-controls:not([hidden]) { gap: 3px; padding: 4px; }
  #meeting[data-view="room"] .projector-live-controls .projector-hud-group:not([hidden]) { gap: 3px; }
  #meeting[data-view="room"].presenter-panel-open .projector-live-controls button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  #meeting[data-view="room"].presenter-panel-open .projector-live-controls:not([hidden]) { width: 52px !important; border-radius: 26px; }
}
/* FAHDS-461: a narrower right-hand column on desktop (presenter panel, key
   guide and self preview share --hud-column-w); [L] Laser and the page/zoom
   status share one row. H hides the column (app.mjs adds .hud-hidden). */
@media (pointer: fine) and (min-width: 701px) {
  #meeting { --hud-column-w: 212px; }
}
@media (pointer: fine) {
  #meeting .projector-live-controls .projector-laser-key { grid-column: 1; }
  #meeting .projector-live-controls output { grid-column: 2; align-self: center; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  #meeting .projector-live-controls .projector-hud-group:not([data-mode-hud="whiteboard"]) button { font-size: 12px; white-space: nowrap; }
  #meeting.hud-hidden:not(.toolbar-open) :is(#world-help, .projector-live-controls) { display: none !important; }
}
/* FAHDS-466: a bigger self camera preview in the Office view, decoupled from
   the narrow key-guide column (--hud-column-w). The guide and presenter panel
   still stack above it (app.mjs); the room menu and the wrapped toolbar clear
   the wider of the two. H (hud-hidden) leaves the preview alone. Phones keep
   their 120px top-right preview. */
#meeting { --self-preview-w: var(--hud-column-w, 256px); }
.self-preview { width: var(--self-preview-w, var(--hud-column-w, 256px)); }
@media (pointer: fine) and (min-width: 701px) {
  #meeting { --self-preview-w: clamp(240px, 26vw, 300px); }
  #room-menu { right: calc(var(--hud-right) + max(var(--hud-column-w), var(--self-preview-w)) + 8px); }
}
@media (pointer: fine) and (min-width: 701px) and (max-width: 1200px) {
  #meeting-toolbar { right: calc(var(--hud-right) + max(var(--hud-column-w), var(--self-preview-w)) + 8px); }
}
@media (pointer: fine) and (min-width: 701px) and (max-width: 850px) {
  #meeting .chat-overlay:not(.expanded):not(.is-typing) { max-width: calc(100vw - 17px - var(--hud-right) - max(var(--hud-column-w), var(--self-preview-w)) - 8px); }
}
/* FAHDS-470: with the room menu open (Esc / M), a corner handle on the
   preview's top-left resizes it between two sizes: default (above) and small.
   app.mjs snaps the drag to the nearer one and the width animates; the guide
   and presenter panel re-stack every frame. Phones keep their fixed preview. */
.self-preview-resize { display: none; }
@media (pointer: fine) and (min-width: 701px) {
  #meeting.self-preview-small { --self-preview-w: 180px; }
  .self-preview { transition: width 220ms ease-out; }
  #room-menu, #meeting-toolbar { transition: right 220ms ease-out; }
  #meeting.self-preview-resizing :is(.self-preview, #room-menu, #meeting-toolbar) { transition: none; }
  #meeting.toolbar-open[data-view="room"] .self-preview[data-state="video"] .self-preview-resize {
    display: block; position: absolute; top: 0; left: 0; z-index: 1; box-sizing: border-box;
    width: 32px; height: 32px; padding: 0; border: 0; border-radius: 0 0 10px 0;
    background: rgb(0 0 0 / .45); cursor: nwse-resize; pointer-events: auto; touch-action: none;
  }
  .self-preview-resize::before {
    content: ""; position: absolute; top: 8px; left: 8px; width: 11px; height: 11px;
    border-top: 2px solid #fff; border-left: 2px solid #fff; border-radius: 2px 0 0 0;
  }
  .self-preview-resize:hover, .self-preview-resize:focus-visible { background: rgb(0 0 0 / .65); }
  .self-preview-resize:focus-visible { outline: 2px solid var(--color-link, #2a6df4); outline-offset: -2px; }
  #meeting.self-preview-resizing .self-preview { outline: 2px solid rgb(255 255 255 / .8); }
}
#world-help[data-mode="computer"] #hide-hud-hint { display: none; }

/* FAHDS-463: Normal view polish. No message or presenting chip at the top;
   taller self tile with the caption over the video; a blue talking border;
   your own tile floats over the shared whiteboard and can be minimized to a
   "Show camera" pill (VideoStage remembers the choice per device). */
#meeting[data-view="video"] .video-presentation { display: none !important; }
#meeting[data-view="video"] .video-picture video { object-position: 50% 30%; }
#meeting[data-view="video"] .video-caption {
  z-index: 1;
  padding: 26px 12px 9px;
  background: linear-gradient(to top, rgb(0 0 0 / .62), rgb(0 0 0 / 0));
  color: #fff;
  text-shadow: 0 1px 2px rgb(0 0 0 / .45);
}
#meeting[data-view="video"] .video-caption small { color: rgb(255 255 255 / .85); }
#meeting[data-view="video"] .video-caption > span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Talking: a 3px ring in the site link blue (--color-link, from site-tokens.css) above the video, fading in and out. */
.video-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 3px solid transparent;
  border-radius: inherit;
  pointer-events: none;
  transition: border-color .15s ease;
}
.video-tile.is-speaking { outline: none; }
.video-tile.is-speaking::after { border-color: var(--color-link, #2563eb); }
/* Taller (portrait) self tile: solo, two-person picture-in-picture and over
   the whiteboard share one size. */
#meeting[data-view="video"] .video-stage.solo .video-tile,
#meeting[data-view="video"] .video-stage.two-person:not(.has-screen) .video-tile[data-self="true"],
#meeting[data-view="video"].shared-board-open .video-tile[data-self="true"] {
  position: absolute; z-index: 8; inset: auto 18px 18px auto;
  width: 300px; height: 375px; max-width: none; max-height: none;
}
/* FAHDS-466: 300x375 on wide screens (was 240x300), scaled down in between. */
@media (max-width: 1100px) {
  #meeting[data-view="video"] .video-stage.solo .video-tile,
  #meeting[data-view="video"] .video-stage.two-person:not(.has-screen) .video-tile[data-self="true"],
  #meeting[data-view="video"].shared-board-open .video-tile[data-self="true"] { width: 256px; height: 320px; }
}
@media (max-width: 850px) {
  #meeting[data-view="video"] .video-stage.solo .video-tile,
  #meeting[data-view="video"] .video-stage.two-person:not(.has-screen) .video-tile[data-self="true"],
  #meeting[data-view="video"].shared-board-open .video-tile[data-self="true"] {
    inset: auto 10px 10px auto; width: 132px; height: 170px;
  }
}
@media (pointer: coarse) and (max-height: 500px) {
  #meeting[data-view="video"] .video-stage.solo .video-tile,
  #meeting[data-view="video"] .video-stage.two-person:not(.has-screen) .video-tile[data-self="true"],
  #meeting[data-view="video"].shared-board-open .video-tile[data-self="true"] { width: 96px; height: 120px; }
}
@media (min-width: 1400px) and (pointer: fine) {
  #meeting[data-view="video"] .video-stage.solo .video-tile,
  #meeting[data-view="video"] .video-stage.two-person:not(.has-screen) .video-tile[data-self="true"],
  #meeting[data-view="video"].shared-board-open .video-tile[data-self="true"],
  #meeting[data-view="video"] .video-self-pill { right: -10px; bottom: -99px; }
}
/* Minimize control (your own tile only) and the pill that brings it back. */
.video-minimize {
  position: absolute; top: 8px; right: 8px; z-index: 4;
  display: grid; place-items: center;
  width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 50%;
  background: rgb(0 0 0 / .45); color: #fff;
  font-size: 18px; line-height: 1;
  opacity: .8; transition: opacity .15s, background .15s;
}
.video-minimize:hover, .video-minimize:focus-visible { opacity: 1; background: rgb(0 0 0 / .65); }
.video-tile:not([data-self="true"]) .video-minimize,
#meeting:not([data-view="video"]) .video-minimize { display: none; }
#meeting[data-view="video"] .video-stage.self-minimized .video-tile[data-self="true"] { display: none !important; }
.video-self-pill {
  position: absolute; right: 18px; bottom: 18px; z-index: 8;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--paper); color: var(--ink);
  font-size: 12px; box-shadow: 0 4px 16px #0002;
}
.video-self-pill[hidden] { display: none; }
@media (max-width: 850px) {
  #meeting[data-view="video"] .video-self-pill { right: 10px; bottom: 10px; }
}
@media (pointer: coarse) {
  .video-minimize { width: 34px; height: 34px; opacity: 1; }
  .video-self-pill { min-height: 40px; }
  /* Phones: the toolbar sheet covers the stage's bottom edge, so your tile
     and its pill sit at the top-right instead. */
  #meeting[data-view="video"] .video-stage.solo .video-tile,
  #meeting[data-view="video"] .video-stage.two-person:not(.has-screen) .video-tile[data-self="true"],
  #meeting[data-view="video"].shared-board-open .video-tile[data-self="true"] { inset: 10px 10px auto auto; }
  #meeting[data-view="video"] .video-self-pill { top: 10px; bottom: auto; }
}
/* FAHDS-469: the key guide reads as a tidy two-column list (two controls per row). */
@media (pointer: fine) {
  #world-help .keyboard-hints, #keys-toggle[aria-expanded="true"] + .keyboard-hints {
    display: grid; grid-template-columns: max-content max-content; justify-content: space-between; gap: 7px 10px; align-items: center;
  }
  #world-help .keyboard-hints > span { white-space: nowrap; display: flex; align-items: center; gap: 5px; min-width: 0; }
  #world-help .keyboard-hints > span[hidden] { display: none; }
}
/* FAHDS-473: no "Menu" button on desktop; Esc / M open the menu. Phones keep the ⋯ button. */
@media (pointer: fine) { #meeting #room-menu { display: none !important; } }
/* FAHDS-475: alone in Normal view, a calm neutral stage with a centred "no one else yet" note. */
#meeting[data-view="video"]:has(#video-stage.solo) { background: radial-gradient(ellipse at 50% 40%, #f7f7f5 0%, #ecebe7 70%, #e4e2dd 100%); }
#meeting[data-view="video"] .video-waiting { top: 42%; text-align: center; color: var(--muted, #666); }
#meeting[data-view="video"] .video-waiting h2 { font-size: 24px; color: var(--ink, #222); margin: 0 0 8px; }
#meeting[data-view="video"] .video-waiting p { font-size: 14px; margin: 0; }
#meeting[data-view="video"] .video-waiting[hidden] { display: none; }
/* FAHDS-440: Normal view. Desktop: the toolbar fades out after 3 s without
   activity (app.mjs ToolbarAutoHide sets .toolbar-idle). Phones: the Office
   ⋯ bottom sheet (rules above match both views), so the stage runs to the
   bottom and your tile sits bottom-right again. A shared screen (or the
   projector video) fills the main stage and cameras stack in a right rail of
   up to five others plus you, with a "+N" chip and a chevron tab that hides
   the rail (remembered per device). */
#meeting[data-view="video"] .toolbar { transition: opacity .25s ease, translate .25s ease; }
#meeting[data-view="video"].toolbar-idle .toolbar { opacity: 0; translate: 0 14px; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { #meeting[data-view="video"] .toolbar { transition: none; } }
@media (pointer: coarse) {
  #meeting[data-view="video"] .video-stage { bottom: calc(12px + env(safe-area-inset-bottom)); }
  #meeting[data-view="video"] .video-stage.solo .video-tile,
  #meeting[data-view="video"] .video-stage.two-person:not(.has-screen) .video-tile[data-self="true"],
  #meeting[data-view="video"].shared-board-open .video-tile[data-self="true"] { inset: auto 10px 10px auto; }
  #meeting[data-view="video"] .video-self-pill { top: auto; bottom: 10px; }
  #meeting[data-view="video"] .chat-overlay { bottom: calc(24px + env(safe-area-inset-bottom)); }
}
.video-share { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; overflow: hidden; border-radius: 18px; background: #0b0d10; }
.video-share[hidden] { display: none; }
.video-share-picture { position: absolute; inset: 0; }
.video-share-picture video { display: block; width: 100%; height: 100%; object-fit: contain; background: #0b0d10; }
.video-share-bar {
  position: absolute; left: 12px; top: 12px; z-index: 2; max-width: calc(100% - 24px);
  display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 12px; border-radius: 999px;
  background: rgb(0 0 0 / .6); color: #fff; font-size: 12px;
}
.video-share-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-share-label:empty { display: none; }
.video-share-stop { display: none; min-height: 28px; padding: 3px 12px; border: 0; border-radius: 999px; background: #b4402f; color: #fff; font-size: 12px; }
.video-share[data-self="true"] .video-share-stop { display: inline-flex; align-items: center; }
.video-share:not([data-self="true"]) .video-share-bar { padding-right: 12px; }
.video-rail-more, .video-rail-toggle { display: none; }
.video-tile.is-screen .video-picture video { object-fit: contain; background: #0b0d10; }
#meeting[data-view="video"] #video-stage { --rail-w: 232px; }
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) { display: flex; flex-direction: row; gap: 12px; }
#meeting[data-view="video"] #video-stage.has-share #video-screen { display: none; }
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-waiting { display: none; }
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-grid {
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
  flex: 0 0 var(--rail-w); width: var(--rail-w); height: 100%; min-height: 0; overflow: hidden;
}
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-tile {
  position: relative; inset: auto; z-index: auto; flex: 0 1 150px;
  width: 100%; height: auto; min-height: 64px; max-width: none; max-height: 150px;
  border-width: 1px; border-radius: 12px; align-self: stretch;
}
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-tile.rail-overflow { display: none !important; }
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-placeholder { gap: 6px; }
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-placeholder > span { width: 40px; height: 40px; border-radius: 12px; font-size: 17px; }
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-placeholder > small { display: none; }
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-tile.is-presenting .video-placeholder > small { display: block; font-size: 10px; }
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-caption { padding: 16px 9px 6px; font-size: 11px; }
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-minimize { top: 5px; right: 5px; width: 24px; height: 24px; font-size: 15px; }
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-rail-more:not([hidden]) {
  display: flex; flex: 0 0 34px; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink);
  font-size: 13px; font-weight: 600;
}
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-rail-toggle {
  position: absolute; z-index: 6; top: 50%; right: calc(var(--rail-w) + 1px); transform: translateY(-50%);
  display: grid; place-items: center; width: 22px; height: 56px; min-height: 0; padding: 0;
  border: 1px solid var(--line); border-right: 0; border-radius: 9px 0 0 9px;
  background: var(--paper); color: var(--ink); box-shadow: -2px 2px 10px #0002;
}
#meeting[data-view="video"] #video-stage .video-rail-toggle > span::before { content: "\203A"; font-size: 20px; line-height: 1; }
#meeting[data-view="video"] #video-stage.rail-hidden .video-rail-toggle > span::before { content: "\2039"; }
#meeting[data-view="video"] #video-stage.rail-hidden:is(.has-share, .has-screen, .has-speaker) .video-grid { display: none; }
#meeting[data-view="video"] #video-stage.rail-hidden:is(.has-share, .has-screen, .has-speaker) .video-rail-toggle { right: 0; }
#meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-self-pill { right: 10px; bottom: 10px; top: auto; }
@media (max-width: 850px) {
  #meeting[data-view="video"] #video-stage { --rail-w: 112px; }
  #meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) { gap: 8px; }
  #meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-grid { gap: 6px; }
  #meeting[data-view="video"] #video-stage:is(.has-share, .has-screen, .has-speaker) .video-caption small { display: none; }
}
/* FAHDS-440: Normal view has no HUD columns beside the toolbar, so it may run
   wider than the Office limit and keep Share screen and Leave on one row. */
/* (left: 50% caps a shrink-to-fit box at half the window, so size it to its content.) */
@media (pointer: fine) {
  #meeting[data-view="video"] #meeting-toolbar { width: max-content; max-width: calc(100% - 600px); }
}
@media (pointer: fine) and (max-width: 1400px) { #meeting[data-view="video"] #meeting-toolbar { max-width: calc(100% - 40px); } }
/* FAHDS-482: speaker view. 3+ people and nothing shared: the active (or
   pinned) speaker's tile fills the main stage left of the FAHDS-440 rail;
   everyone else, then you, stack in the rail. Click a tile or its Pin chip
   to pin someone; a shared screen or projector video still takes the stage. */
#meeting[data-view="video"] #video-stage.has-speaker .video-grid { margin-left: auto; }
#meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-tile.is-stage {
  position: absolute; inset: 0 calc(var(--rail-w) + 12px) 0 0; z-index: 1;
  width: auto; height: auto; min-height: 0; max-height: none; flex: none; border-radius: 18px;
}
#meeting[data-view="video"] #video-stage.has-speaker.rail-hidden:not(.has-share, .has-screen) .video-tile.is-stage { right: 0; }
#meeting[data-view="video"] #video-stage.has-speaker .video-tile.is-stage .video-placeholder { gap: 15px; }
#meeting[data-view="video"] #video-stage.has-speaker .video-tile.is-stage .video-placeholder > span { width: 84px; height: 84px; border-radius: 25px; font-size: 33px; }
#meeting[data-view="video"] #video-stage.has-speaker .video-tile.is-stage .video-placeholder > small { display: block; font-size: 11px; }
/* The stage's name sits at the top: the chat overlay covers the bottom-left. */
#meeting[data-view="video"] #video-stage.has-speaker .video-tile.is-stage .video-caption {
  top: 0; bottom: auto; padding: 14px 110px 30px 16px; font-size: 14px;
  background: linear-gradient(to bottom, rgb(0 0 0 / .55), rgb(0 0 0 / 0));
}
#meeting[data-view="video"] #video-stage.has-speaker .video-tile.is-stage .video-hand { top: 52px; }
#meeting[data-view="video"] #video-stage.has-speaker .video-tile:not([data-self="true"]) { cursor: pointer; }
.video-pin { display: none; }
#meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-tile:not([data-self="true"]) .video-pin {
  position: absolute; top: 6px; right: 6px; z-index: 4; display: inline-flex; align-items: center;
  min-height: 0; padding: 3px 10px; border: 0; border-radius: 999px;
  background: rgb(0 0 0 / .5); color: #fff; font-size: 11px; line-height: 1.4;
  opacity: 0; transition: opacity .15s, background .15s;
}
#meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-tile:not([data-self="true"]):is(:hover, :focus-within, .is-pinned) .video-pin { opacity: 1; }
#meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-tile:not([data-self="true"]).is-pinned .video-pin { background: var(--color-link, #2563eb); }
#meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-tile:not([data-self="true"]).is-stage .video-pin { top: 12px; right: 12px; padding: 5px 14px; font-size: 12px; }
@media (pointer: coarse) { #meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-tile:not([data-self="true"]) .video-pin { opacity: 1; } }
@media (max-width: 850px) {
  #meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-tile.is-stage { right: calc(var(--rail-w) + 8px); }
  #meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-tile:not(.is-stage) .video-pin { padding: 2px 7px; font-size: 10px; }
}
/* A collapsed rail hides the other tiles, not the stage tile that lives in it. */
#meeting[data-view="video"] #video-stage.rail-hidden.has-speaker .video-grid { display: flex; flex-basis: 0; width: 0; overflow: visible; }
#meeting[data-view="video"] #video-stage.rail-hidden.has-speaker .video-grid > :not(.is-stage) { display: none !important; }
/* Portrait phones: stage on top, the others in a horizontal strip below. */
@media (max-width: 600px) and (orientation: portrait) {
  #meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) { --strip-h: 116px; flex-direction: column; }
  #meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-grid {
    flex-direction: row; justify-content: flex-start; flex: 0 0 var(--strip-h);
    width: 100%; height: var(--strip-h); margin: auto 0 0; overflow-x: auto; overflow-y: hidden;
  }
  #meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-tile:not(.is-stage) {
    flex: 0 0 100px; width: 100px; height: 100%; max-height: none; min-height: 0;
  }
  #meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-rail-more:not([hidden]) { flex: 0 0 44px; }
  #meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-tile.is-stage { inset: 0 0 calc(var(--strip-h) + 8px) 0; }
  #meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-rail-toggle {
    top: auto; right: 12px; bottom: calc(var(--strip-h) + 8px); transform: none;
    width: 56px; height: 22px; border: 1px solid var(--line); border-bottom: 0; border-radius: 9px 9px 0 0;
  }
  #meeting[data-view="video"] #video-stage.has-speaker:not(.has-share, .has-screen) .video-rail-toggle > span { rotate: 90deg; }
  #meeting[data-view="video"] #video-stage.has-speaker.rail-hidden:not(.has-share, .has-screen) .video-rail-toggle { bottom: 0; right: 12px; }
  #meeting[data-view="video"] #video-stage.has-speaker.rail-hidden:not(.has-share, .has-screen) .video-tile.is-stage { inset: 0 0 24px 0; }
  #meeting[data-view="video"]:has(#video-stage.has-speaker:not(.rail-hidden, .has-share, .has-screen)) .chat-overlay { bottom: calc(150px + env(safe-area-inset-bottom)); }
}
