/* The meeting opens over the site, on true black. */

.meet { position: fixed; inset: 0; z-index: 30; background: var(--void); }
.in-call { --dock-height: 6.25rem; }
.audio-out { display: none; }

/* Keys: the square buttons on the dock */

.key {
  position: relative;
  flex: none; display: grid; place-items: center;
  width: 3rem; height: 3rem;
  border-radius: var(--key);
  background: var(--dusk-raised); color: var(--ink);
  transition: background-color 0.15s, color 0.15s, transform 0.15s var(--ease), box-shadow 0.2s;
}
.key:hover { background: var(--dusk-high); }
.key:active { transform: scale(0.93); }
.key.is-off { background: color-mix(in srgb, var(--danger) 20%, var(--dusk-raised)); color: var(--danger); }
.key.is-off:hover { background: color-mix(in srgb, var(--danger) 32%, var(--dusk-raised)); }
.key.is-on, .key[aria-pressed='true'][data-panel] { background: var(--accent); color: var(--on-accent); }
.key.is-on { box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 50%, transparent); }
.key-quiet { background: none; color: var(--ash); }
.key-quiet:hover { color: var(--ink); }
.key-leave { width: 3.75rem; background: var(--danger); color: #000; }
.key-leave:hover { background: color-mix(in srgb, var(--danger) 80%, #fff); }

.key-lock {
  position: absolute; right: -0.25rem; bottom: -0.25rem;
  display: grid; place-items: center;
  width: 1.25rem; height: 1.25rem;
  border-radius: 50%;
  background: var(--danger); color: #000;
}
.key-lock .icon { width: 0.75rem; height: 0.75rem; }

.key-count, .key-dot { position: absolute; font-style: normal; font-weight: 700; }
.key-count {
  right: 0; top: 0;
  min-width: 1.125rem; height: 1.125rem; padding-inline: 0.25rem;
  border-radius: 999px;
  background: var(--dusk-high); color: var(--ink);
  font-size: 0.6875rem; line-height: 1.125rem; text-align: center;
}
.key[aria-pressed='true'] .key-count { background: var(--void); color: var(--ink); }
.key-count.is-alert { background: var(--accent-2); color: #fff; }
.key-dot { right: 0.5rem; top: 0.5rem; width: 0.5625rem; height: 0.5625rem; border-radius: 50%; background: var(--accent-2); }

/* Before joining */

.prejoin {
  position: relative;
  height: 100%; overflow-y: auto;
  display: grid; align-items: center; align-content: center; gap: clamp(1.5rem, 4vw, 3.5rem);
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  padding: 4.5rem clamp(1rem, 5vw, 5rem) 2rem;
}
.prejoin-brand { position: absolute; left: clamp(1rem, 4vw, 3rem); top: 0.875rem; }
.prejoin-preview {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--dusk);
  border: 1px solid var(--line);
  border-radius: calc(22px * var(--round));
}
.prejoin-sky, .prejoin-video { position: absolute; inset: 0; width: 100%; height: 100%; }
.prejoin-video { object-fit: cover; transform: scaleX(-1); }
.prejoin-controls {
  position: absolute; left: 50%; bottom: 0.875rem;
  display: flex; gap: 0.375rem;
  padding: 0.375rem;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--dusk) 70%, transparent);
  backdrop-filter: blur(18px);
  border-radius: calc(18px * var(--round));
}
.prejoin-side { display: grid; justify-items: start; gap: 0.75rem; min-width: 0; }
.prejoin-code { color: var(--accent-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.prejoin-side h1 { font-size: clamp(2rem, 3.6vw, 3rem); font-weight: 800; line-height: 1.02; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.prejoin-side .field { width: 100%; }
.prejoin-who { color: var(--ink); font-weight: 650; }
.prejoin-problem { color: var(--danger); font-size: var(--step--1); }
.prejoin-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; margin-top: 0.5rem; }

/* Knocking, and every way a meeting can end */

.holding { position: relative; height: 100%; overflow: hidden; }
.holding-sky { position: absolute; inset: 0; width: 100%; height: 100%; }
.holding-copy {
  position: absolute; left: 50%; top: 54%;
  display: grid; justify-items: center; gap: 0.625rem;
  width: min(30rem, calc(100% - 2rem));
  transform: translateX(-50%);
  text-align: center;
}
.holding-copy h1 { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 800; line-height: 1.05; letter-spacing: -0.025em; }
.holding-copy p { color: var(--ash); }
.holding-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.625rem; margin-top: 0.75rem; }

/* The call: details on top, people in the middle, controls in a dock below */

.call {
  height: 100%;
  display: grid; gap: var(--gap);
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 0.5rem 0.75rem 0.75rem;
}
.call-head { display: flex; align-items: center; gap: 0.75rem; min-height: 3rem; }
.call-brand img { display: block; }
.call-meta { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.call-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.call-meta > span { color: var(--ash); font-size: var(--step--1); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-meta button { color: var(--ash); margin-left: 0.5rem; }
.call-meta button:hover { color: var(--ink); text-decoration: underline; }
.call-tools { flex: none; display: flex; align-items: center; gap: 0.125rem; }

.call-body { min-height: 0; display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr) auto; }
.call-main { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: var(--gap); }
.call-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }

.call-banner {
  flex: none;
  padding: 0.5rem 1rem;
  border-radius: var(--key);
  background: color-mix(in srgb, var(--accent-2) 22%, var(--dusk-raised)); color: var(--ink);
  font-size: var(--step--1); font-weight: 600; text-align: center;
}

.call-dock { position: relative; justify-self: center; max-width: 100%; }
.dock-keys {
  display: flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem;
  background: color-mix(in srgb, var(--dusk) var(--bar-glass), transparent);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: calc(20px * var(--round));
}
.dock-rule { width: 1px; height: 1.75rem; margin-inline: 0.25rem; background: var(--line); }

/* Tiles: placed by RoomView.layout, so they can slide when the room changes. */

.tile {
  --hue: 215;
  position: absolute; left: 0; top: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, oklch(0.26 0.07 var(--hue)), var(--dusk) 70%);
  border-radius: calc(18px * var(--round));
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform 0.28s var(--ease), width 0.28s var(--ease), height 0.28s var(--ease), box-shadow 0.15s;
}
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile video.is-mirrored { transform: scaleX(-1); }
.tile-screen video { object-fit: contain; }
.tile-screen { background: #000; }
.tile::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; transition: box-shadow 0.12s; }
.tile.is-speaking::after { box-shadow: inset 0 0 0 3px oklch(0.8 0.15 var(--hue)); }
.tile.is-away { opacity: 0.45; }

.tile-face { position: absolute; inset: 0; display: grid; place-items: center; }
.tile video:not([hidden]) ~ .tile-face { display: none; }
.tile-avatar, .tile-glow {
  grid-area: 1 / 1;
  width: clamp(3rem, 28%, 8rem); aspect-ratio: 1;
  border-radius: 50%;
}
.tile-avatar {
  position: relative;
  display: grid; place-items: center; overflow: hidden;
  background: oklch(0.42 0.13 var(--hue)); color: #fff;
  font-size: clamp(1.25rem, 3.5vw, 3rem); font-weight: 750;
}
.tile-avatar img { width: 100%; height: 100%; object-fit: cover; }
/* A ripple leaving the person, sized by their voice. */
.tile-glow {
  --voice: 0;
  box-shadow: 0 0 0 2px oklch(0.8 0.15 var(--hue));
  transform: scale(calc(1 + var(--voice) * 0.7));
  opacity: calc(var(--voice) * 1.4);
  transition: transform 0.09s linear, opacity 0.09s linear;
}

.tile-name {
  position: absolute; left: 0.5rem; bottom: 0.5rem;
  display: flex; align-items: center; gap: 0.375rem;
  max-width: calc(100% - 1rem); padding: 0.125rem 0.5rem;
  border-radius: calc(9px * var(--round));
  background: rgb(0 0 0 / 0.6); color: #fff;
  font-size: var(--step--1); font-weight: 600;
}
.tile-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-name small { flex: none; color: #c3ccd6; font-size: 0.6875rem; font-weight: 400; }
.tile-name .icon { width: 0.875rem; height: 0.875rem; color: #9be3ff; }

.tile-state { position: absolute; right: 0.5rem; top: 0.5rem; display: flex; gap: 0.25rem; }
.badge {
  display: grid; place-items: center;
  width: 1.75rem; height: 1.75rem;
  border-radius: calc(9px * var(--round));
  background: rgb(0 0 0 / 0.6); color: #fff;
}
.badge .icon { width: 1rem; height: 1rem; }
.badge-locked { background: var(--danger); color: #000; }
.badge-hand { background: var(--accent); color: var(--on-accent); }

.tile-more {
  position: absolute; left: 0.5rem; top: 0.5rem;
  display: grid; place-items: center;
  width: 2rem; height: 2rem;
  border-radius: calc(9px * var(--round));
  background: rgb(0 0 0 / 0.6); color: #fff;
  opacity: 0; transition: opacity 0.15s;
}
.tile:hover .tile-more, .tile-more:focus-visible { opacity: 1; }
.tile.is-small .tile-name small { display: none; }
.tile.is-small .badge { width: 1.375rem; height: 1.375rem; }
.tile.is-small .badge .icon { width: 0.8125rem; height: 0.8125rem; }

/* Alone in the room */

.alone {
  position: absolute; left: 0.75rem; bottom: 0.75rem; z-index: 2;
  display: grid; justify-items: start; gap: 0.375rem;
  width: min(21rem, calc(100% - 1.5rem)); padding: 1rem;
  background: color-mix(in srgb, var(--dusk) 82%, transparent);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.alone h2 { font-size: var(--step-1); font-weight: 750; }
.alone-close { position: absolute; right: 0.375rem; top: 0.375rem; width: 2rem; height: 2rem; }
.alone-close .icon { width: 1rem; height: 1rem; }
.alone-link { max-width: 100%; color: var(--accent-soft); overflow-wrap: anywhere; font-size: var(--step--1); }
.alone .btn { margin-top: 0.25rem; }

/* Reactions rise off the bottom of the stage */

.reactions { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.reaction {
  position: absolute; bottom: 0;
  display: grid; justify-items: center; gap: 0.125rem;
  animation: rise 3.2s var(--ease) forwards;
}
.reaction span { font-size: 2.25rem; line-height: 1; }
.reaction small { padding: 0 0.375rem; border-radius: 6px; background: rgb(0 0 0 / 0.6); color: #fff; font-size: 0.6875rem; }
@keyframes rise {
  from { opacity: 0; transform: translateY(1rem); }
  12% { opacity: 1; }
  75% { opacity: 1; }
  to { opacity: 0; transform: translateY(-55vh); }
}

.reaction-picker {
  position: absolute; left: 50%; bottom: calc(100% + 0.5rem); z-index: 3;
  display: flex; gap: 0.125rem;
  padding: 0.25rem;
  transform: translateX(-50%);
  background: var(--dusk-high);
  border: 1px solid var(--line);
  border-radius: var(--key);
  box-shadow: 0 16px 24px rgb(0 0 0 / 0.5);
}
.reaction-picker button { width: 2.75rem; height: 2.75rem; border-radius: calc(10px * var(--round)); font-size: 1.5rem; transition: transform 0.15s var(--ease), background-color 0.15s; }
.reaction-picker button:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); transform: scale(1.12); }

/* Someone at the door */

.knocks { position: absolute; right: 0.5rem; top: 0.5rem; z-index: 2; display: grid; gap: 0.5rem; width: min(25rem, calc(100% - 1rem)); }
.knock {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  background: var(--dusk-high);
  border: 1px solid color-mix(in srgb, var(--accent-2) 55%, transparent);
  border-radius: var(--radius);
  box-shadow: 0 16px 24px rgb(0 0 0 / 0.5);
  animation: menu-in 0.2s var(--ease);
}
.knock p { flex: 1; min-width: 0; font-size: var(--step--1); overflow-wrap: anywhere; }
.knock b { font-weight: 700; }
.knock .avatar { width: 2rem; height: 2rem; font-size: var(--step--1); }

/* Side panel */

.call-panel {
  width: 21rem; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--dusk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  animation: panel-in 0.25s var(--ease);
}
@keyframes panel-in { from { opacity: 0; transform: translateX(0.75rem); } }
.panel-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0.625rem 0.5rem 0.25rem 1rem; }
.panel-head h2 { font-size: var(--step-1); font-weight: 750; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0.25rem 1rem 1rem; }
.panel-block { margin-bottom: 1.5rem; }
.panel-block h3 { margin-bottom: 0.5rem; font-size: var(--step-0); font-weight: 700; overflow-wrap: anywhere; }
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.25rem; }
.panel-row h3 { margin: 0; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.meeting-link { margin-bottom: 0.625rem; color: var(--ash); overflow-wrap: anywhere; }
.selectable, .selectable * { -webkit-user-select: text; user-select: text; }

.people { display: grid; gap: 0.125rem; margin-inline: -0.5rem; }
.person { display: flex; align-items: center; gap: 0.625rem; padding: 0.3125rem 0.5rem; border-radius: calc(10px * var(--round)); }
.person:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.person.is-away { opacity: 0.5; }
.person .avatar { width: 2.25rem; height: 2.25rem; font-size: var(--step--1); }
.person-names { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.person-names b, .person-names small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-names b { font-weight: 600; }
.person-names small { color: var(--ash); font-size: var(--step--1); }
.person-state { flex: none; display: flex; gap: 0.25rem; color: var(--ash); }
.person-state .icon { width: 1rem; height: 1rem; }
.person-state .is-locked { color: var(--danger); }
.icon-btn.is-accent { color: var(--accent); }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; margin: 0; color: var(--ash); font-size: var(--step--1); }
.keys dt { color: var(--ink); font-weight: 700; }
.keys dd { margin: 0; }

.switch {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 2.5rem; padding-block: 0.25rem;
  cursor: pointer;
}
.switch > span { min-width: 0; display: grid; }
.switch small { color: var(--ash); font-size: var(--step--1); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i {
  position: relative; flex: none;
  width: 2.5rem; height: 1.375rem;
  border-radius: calc(8px * var(--round));
  background: var(--dusk-high);
  transition: background-color 0.15s;
}
.switch i::after {
  content: ''; position: absolute; left: 0.1875rem; top: 0.1875rem;
  width: 1rem; height: 1rem;
  border-radius: calc(5px * var(--round));
  background: var(--ink);
  transition: transform 0.2s var(--ease);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(1.125rem); background: var(--on-accent); }
.switch input:focus-visible + i { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

.device-form { display: grid; gap: 0.875rem; }
.device-form h2 { margin-bottom: 0.25rem; }
select.input { appearance: auto; }
select.input option { background: var(--dusk); color: var(--ink); }

/* Chat */

.chat-log { display: flex; flex-direction: column; gap: 0.25rem; }
.message { display: grid; }
.message-head { margin-top: 0.625rem; font-size: var(--step--1); }
.message-head b { font-weight: 700; }
.message-head time { color: var(--ash); margin-left: 0.25rem; }
.message-text {
  width: fit-content; max-width: 100%;
  padding: 0.3125rem 0.75rem;
  border-radius: calc(12px * var(--round));
  background: var(--dusk-raised);
  overflow-wrap: anywhere; white-space: pre-wrap;
  -webkit-user-select: text; user-select: text;
}
.message.is-mine { justify-items: end; }
.message.is-mine .message-text { background: var(--accent); color: var(--on-accent); }
.chat-note { flex: none; padding: 0 1rem; color: var(--ash); font-size: 0.75rem; }
.chat-form { flex: none; display: flex; align-items: center; gap: 0.25rem; padding: 0.5rem 0.625rem 0.75rem 1rem; }

/* Narrow screens: the panel covers the stage */

@media (max-width: 1099px) {
  .call-body { grid-template-columns: minmax(0, 1fr); }
  .call-panel {
    position: fixed; z-index: 35;
    top: 4rem; right: 0.75rem; bottom: 5.5rem;
    width: min(21rem, calc(100vw - 1.5rem));
    box-shadow: 0 0 40px rgb(0 0 0 / 0.7);
  }
}

@media (max-width: 760px) {
  .in-call { --dock-height: 5.25rem; }
  .call { padding: 0.25rem 0.375rem 0.375rem; }
  .call-brand { display: none; }
  .key { width: 2.625rem; height: 2.625rem; }
  .key-leave { width: 3rem; }
  .call-tools .key { width: 2.5rem; }
  .dock-keys { gap: 0.1875rem; padding: 0.3125rem; }
  .dock-rule, [data-ctl='settings'] { display: none; }
  .tile-more { opacity: 1; }
  .call-panel { inset: 3.5rem 0.375rem 4.5rem; width: auto; }
  .alone { left: 0.375rem; bottom: 0.375rem; }

  .prejoin { grid-template-columns: minmax(0, 1fr); align-content: start; padding-top: 4rem; }
}
