:root {
  --ink: #100e0c;
  --ink-2: #1b1714;
  --bone: #f4efe6;
  --bone-dim: #c9c0b2;
  --muted: #8d8478;
  --ember: #e39b6a;
  --ember-hot: #ffb087;
  --signal: #7dcec4;
  --line: rgba(244, 239, 230, 0.14);
  --display: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --ui: "Outfit", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--ui);
  font-weight: 400;
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  pointer-events: none;
  z-index: 4;
}

::selection {
  background: var(--ember);
  color: var(--ink);
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 3px;
}

.wash {
  position: fixed;
  width: 52vw;
  height: 52vw;
  right: -8vw;
  top: -12vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(227, 155, 106, 0.28), transparent 68%);
  filter: blur(8px);
  animation: drift 26s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.18;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
}

.toast {
  position: fixed;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  margin: 0;
  max-width: min(560px, calc(100% - 48px));
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--bone);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.insecure {
  position: relative;
  z-index: 2;
  margin: 18px 18px 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(227, 155, 106, 0.16);
  color: var(--ember-hot);
  font-size: 14px;
  line-height: 1.45;
}

.lobby, .room, .gate {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.gate {
  padding: 28px 7vw 72px;
}

.gate-intro { max-width: 460px; }

.gate-form .name-field { margin-top: 18px; }

.gate-error {
  margin: 16px 0 0;
  color: var(--ember-hot);
  font-size: 14px;
}

.gate-forgot {
  display: block;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ember);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.gate-forgot:hover { color: var(--ember-hot); }

.reset-code {
  margin: 16px 0 0;
  color: var(--bone);
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.18em;
}

.gate-note, .signed-as {
  max-width: 420px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.signed-as { margin: 28px 0 0; }

.people-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: min(720px, calc(100dvh - 32px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--ink-2);
  color: var(--bone);
  padding: 22px 22px 18px;
}

.people-dialog::backdrop { background: rgba(16, 14, 12, 0.72); }

.people-dialog h2 {
  margin: 8px 0 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 32px;
}

.people-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

.people-actions .btn-primary { margin-top: 20px; }

.people-actions .btn-ghost { margin-top: 20px; }

.people-list {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.people-list li {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(244, 239, 230, 0.06);
  font-size: 14px;
}

.lobby {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(260px, 0.85fr);
  grid-template-rows: auto 1fr;
  gap: 12px 48px;
  align-items: center;
  padding: 36px 64px 56px;
}

.top {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--bone-dim);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--bone);
  letter-spacing: 0.22em;
}

.brand svg { width: 22px; height: 22px; }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--bone-dim);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.kicker i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 12px var(--signal);
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 560;
  font-size: clamp(84px, 10vw, 136px);
  line-height: 0.82;
  letter-spacing: -0.05em;
}

h1 span {
  font-style: italic;
  font-weight: 460;
}

.deck {
  max-width: 42ch;
  margin: 22px 0 0;
  color: var(--bone-dim);
  font-weight: 300;
  font-size: 18px;
  line-height: 1.55;
}

.name-field, .code-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.name-field { margin-top: 36px; max-width: 360px; }

.name-field span, .code-field span {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(244, 239, 230, 0.32);
  border-radius: 0;
  padding: 10px 0 12px;
  font-size: 16px;
  outline: none;
}

input::placeholder { color: rgba(244, 239, 230, 0.32); }

input:focus { border-bottom-color: var(--ember); }

input:-webkit-autofill {
  -webkit-text-fill-color: var(--bone);
  caret-color: var(--bone);
  transition: background-color 9999s ease-out;
}

#codeInput, .code-btn, .clock, .big-code {
  font-family: var(--mono);
}

#codeInput {
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.btn-primary, .btn-ghost, .media-btn, .note button {
  appearance: none;
}

.btn-primary {
  margin-top: 28px;
  border: 0;
  background: var(--bone);
  color: #171410;
  font-size: 15px;
  font-weight: 500;
  padding: 15px 26px;
  border-radius: 999px;
  transition: background 160ms ease, transform 160ms ease;
}

.btn-primary:hover { background: var(--ember-hot); }

.btn-primary:active { transform: translateY(1px); }

.btn-primary:disabled, .btn-ghost:disabled {
  opacity: 0.55;
  cursor: wait;
}

.or {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  margin: 26px 0 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.or::before, .or::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.join-form {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  max-width: 460px;
  margin-top: 8px;
}

.code-field { flex: 1; }

.btn-ghost {
  background: transparent;
  color: var(--bone);
  border: 1px solid rgba(244, 239, 230, 0.28);
  border-radius: 999px;
  padding: 12px 18px;
  margin-bottom: 4px;
}

.btn-ghost:hover {
  border-color: var(--ember);
  color: var(--ember-hot);
}

.lens {
  width: min(430px, 100%);
  aspect-ratio: 1;
  margin-inline: auto;
  position: relative;
  display: grid;
  place-items: center;
}

.lens-glow {
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(227, 155, 106, 0.42), transparent 68%);
  filter: blur(6px);
}

.ring { position: absolute; border-radius: 50%; }

.ring-a {
  inset: 18%;
  border: 1px solid rgba(244, 239, 230, 0.38);
}

.ring-b {
  inset: 4%;
  background: repeating-conic-gradient(from 0deg, transparent 0 8.6deg, rgba(244, 239, 230, 0.72) 8.6deg 9.05deg);
  -webkit-mask: radial-gradient(circle, transparent 64%, #000 65% 70%, transparent 71%);
  mask: radial-gradient(circle, transparent 64%, #000 65% 70%, transparent 71%);
  animation: spin 80s linear infinite;
}

.ring-c {
  inset: 12%;
  border: 1px dashed rgba(227, 155, 106, 0.7);
  animation: spin 46s linear infinite reverse;
}

.lens-iris {
  width: 54%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  z-index: 1;
  background: #211c18;
  box-shadow: inset 0 0 0 1px rgba(244, 239, 230, 0.2), 0 20px 60px rgba(0, 0, 0, 0.35);
}

.lens-iris video,
.preview-fallback,
.self-face video,
.self-fallback,
.tile-face video,
.avatar,
.fill-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.lens-iris video,
.self-face video,
.tile-face video,
#mainVideo {
  object-fit: cover;
  background: #161310;
}

video.mirror { transform: scaleX(-1); }

video.is-blank { opacity: 0; }

.preview-fallback,
.self-fallback,
.avatar,
.fill-fallback {
  display: grid;
  place-items: center;
  background: var(--wash, var(--ember));
  color: #171410;
  font-family: var(--display);
}

.preview-fallback { font-size: 64px; }

.media-note {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 58px;
  margin: 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  color: #171410;
  z-index: 2;
}

.media-btn {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 2;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bone);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 12px;
}

.flip-preview {
  position: absolute;
  z-index: 2;
  right: 18%;
  bottom: 20%;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(244, 239, 230, 0.35);
  background: rgba(16, 14, 12, 0.78);
  color: var(--bone);
  padding: 0;
}

.flip-preview svg { width: 20px; height: 20px; display: block; }

.flip-preview.is-active,
#flipBtn.is-active {
  background: rgba(125, 206, 196, 0.18);
  color: var(--signal);
}

.lens-caption {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.room {
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 28px 40px 26px;
}

.room-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.code-btn {
  justify-self: start;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 0;
  letter-spacing: 0.14em;
  font-size: 14px;
}

.code-btn span:last-child,
.big-code span:last-child { color: var(--ember); }

.presence {
  margin: 0;
  color: var(--bone-dim);
  font-size: 14px;
}

.clock {
  justify-self: end;
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--bone-dim);
}

.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-height: 0;
}

.frame {
  position: relative;
  height: min(66dvh, 680px);
  aspect-ratio: 16 / 10;
  width: auto;
  max-width: calc(100% - 8px);
}

.frame-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 28px;
  background: #161310;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(244, 239, 230, 0.08);
}

.frame.is-hot .frame-media {
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(227, 155, 106, 0.7);
}

.frame.knock .frame-media { animation: knock 700ms ease-out; }

#mainVideo {
  width: 100%;
  height: 100%;
}

#mainVideo.contain {
  object-fit: contain;
  background: #090807;
}

.fill-fallback { font-size: clamp(64px, 8vw, 112px); }

.waiting {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 42%, rgba(227, 155, 106, 0.16), transparent 46%),
    #14110f;
}

.waiting p:last-child {
  max-width: 32ch;
  margin: 12px 0 0;
  color: var(--bone-dim);
  font-weight: 300;
  line-height: 1.5;
}

.big-code {
  display: flex;
  gap: 0.35em;
  margin: 0;
  font-family: var(--display);
  font-weight: 560;
  font-size: clamp(48px, 6vw, 88px);
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.share-note {
  position: absolute;
  top: 16px;
  left: 16px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(125, 206, 196, 0.16);
  color: var(--signal);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.caption {
  position: absolute;
  left: 22px;
  right: 168px;
  bottom: 64px;
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 460;
  font-size: clamp(22px, 3vw, 38px);
  line-height: 1.15;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.caption b {
  display: block;
  margin-bottom: 6px;
  font-family: var(--ui);
  font-style: normal;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.nameplate {
  position: absolute;
  left: 16px;
  bottom: 16px;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(16, 14, 12, 0.62);
  color: var(--bone);
  font-size: 13px;
  letter-spacing: 0.04em;
  backdrop-filter: blur(12px);
}

.self {
  --level: 0;
  position: absolute;
  width: 132px;
  height: 132px;
  right: -16px;
  bottom: -16px;
  z-index: 2;
}

.self-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(227, 155, 106, 0.9);
  box-shadow:
    0 0 0 8px rgba(227, 155, 106, 0.08),
    0 0 28px rgba(227, 155, 106, calc(0.18 + var(--level) * 0.8));
  transform: scale(calc(1 + var(--level) * 0.07));
}

.self-face {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  overflow: hidden;
  background: #211c18;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.self-fallback { font-size: 42px; }

.self.is-muted .self-face::after,
.tile.is-muted .tile-face::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  right: 8px;
  bottom: 8px;
  border-radius: 50%;
  background: #e7c98a;
  box-shadow: 0 0 0 2px #211c18;
}

.orbit {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 92px;
}

.orbit-item { text-align: center; }

.tile {
  width: 84px;
  height: 84px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  --level: 0;
}

.tile-face {
  position: relative;
  display: block;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  background: #211c18;
  box-shadow: 0 0 0 1px rgba(244, 239, 230, 0.18);
}

.tile.is-hot .tile-face {
  box-shadow: 0 0 0 3px rgba(227, 155, 106, calc(0.45 + var(--level)));
}

.avatar { font-size: 28px; }

.tile-name {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--bone-dim);
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

.note {
  width: min(440px, 100%);
  background: var(--bone);
  color: #1a1714;
  border-radius: 18px;
  padding: 12px 14px 10px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.28);
}

.note ol {
  list-style: none;
  margin: 0;
  padding: 0 2px;
  max-height: 180px;
  overflow: auto;
}

.note li {
  padding: 7px 2px 8px;
  border-bottom: 1px solid rgba(16, 14, 12, 0.08);
}

.note li.empty {
  border: 0;
  color: #6f675d;
  font-family: var(--display);
  font-style: italic;
  font-size: 16px;
}

.note .who {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6f675d;
}

.note .line {
  font-family: var(--display);
  font-style: italic;
  font-size: 18px;
  line-height: 1.25;
}

.whisper-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.note input {
  flex: 1;
  color: #1a1714;
  border-bottom-color: rgba(16, 14, 12, 0.25);
}

.note input::placeholder { color: rgba(16, 14, 12, 0.35); }

.note input:focus { border-bottom-color: #9c3b32; }

.note button {
  border: 0;
  background: #171410;
  color: var(--bone);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
}

.dock {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(16, 14, 12, 0.78);
  border: 1px solid rgba(244, 239, 230, 0.12);
  backdrop-filter: blur(16px);
}

.dock button {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--bone);
}

.dock button.is-off {
  background: var(--bone);
  color: var(--ink);
}

.dock button.is-active {
  background: rgba(125, 206, 196, 0.18);
  color: var(--signal);
}

.dock .leave {
  width: 64px;
  border-radius: 999px;
  background: #9c3b32;
  color: #fff8f4;
}

.dock .leave:hover { background: #b3473c; }

.dock svg { width: 22px; height: 22px; display: block; }

.dock button.is-off .icon-on,
.dock button:not(.is-off) .icon-off { display: none; }

.hints {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-6vw, 4vh, 0) scale(1.08); }
}

@keyframes knock {
  0% { box-shadow: inset 0 0 0 1px rgba(227, 155, 106, 0.2), 0 0 0 0 rgba(227, 155, 106, 0.45); }
  100% { box-shadow: inset 0 0 0 1px rgba(244, 239, 230, 0.08), 0 0 0 26px transparent; }
}

@media (max-height: 820px) and (min-width: 721px) {
  .frame { height: min(56dvh, 540px); }
  .room { padding-top: 18px; padding-bottom: 14px; }
  .footer { margin-top: 12px; }
}

@media (max-width: 900px) {
  body::before { inset: 8px; border-radius: 16px; }

  .lobby {
    grid-template-columns: 1fr;
    padding: 22px 22px 48px;
  }

  .lens { width: min(340px, 86vw); }

  h1 { font-size: 84px; }

  .room { padding: 18px 14px 20px; }

  .room-bar { grid-template-columns: 1fr; justify-items: start; }

  .clock { justify-self: start; }

  .stage { flex-direction: column-reverse; align-items: stretch; }

  .orbit {
    flex-direction: row;
    width: auto;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .frame {
    height: auto;
    width: 100%;
    max-width: none;
  }

  .self { width: 96px; height: 96px; right: 8px; bottom: 8px; }

  .caption { right: 22px; bottom: 58px; font-size: 22px; }
}

@media (max-width: 720px) {
  .dock { flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 36px); }
  .dock button { width: 44px; height: 44px; }
  .dock .leave { width: 56px; }

  .lobby {
    padding: 16px 16px 24px;
    gap: 0;
    align-items: start;
  }

  h1 { font-size: 64px; }

  .deck { font-size: 16px; margin-top: 12px; }

  .name-field { margin-top: 16px; }

  .btn-primary { margin-top: 14px; }

  .or { margin-top: 14px; }

  .lens { width: min(220px, 58vw); margin-top: 8px; }

  .lens-caption { margin-top: 8px; }

  .preview-fallback { font-size: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .wash, .ring-b, .ring-c, .frame.knock .frame-media { animation: none; }
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.top-sip {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--bone-dim);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 13px;
}

.top-sip.is-live,
.call-icon.is-live,
#sipBtn.is-live { color: var(--signal); }

.top-sip.has-mail {
  color: var(--ink);
  background: var(--ember);
  border-radius: 99px;
  padding: 6px 12px;
}

.call-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(227, 155, 106, 0.55);
  background: transparent;
  color: var(--ember);
}

.call-icon svg { width: 20px; height: 20px; display: block; }

.call-icon.is-live {
  background: rgba(125, 206, 196, 0.16);
  border-color: var(--signal);
}

.call-pad {
  position: fixed;
  z-index: 7;
  top: 72px;
  right: max(16px, env(safe-area-inset-right));
  width: min(320px, calc(100vw - 24px));
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #161310;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.call-pad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.call-pad-head .kicker { margin: 0; }

.call-pad-status {
  min-height: 1.3em;
  margin: 10px 0;
  color: var(--bone-dim);
  font-size: 14px;
}

.call-pad-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.call-pad-form input { flex: 1; min-width: 0; }

.call-pad-form .btn-primary,
.call-speaker,
.call-pad-end {
  margin-top: 0;
  min-height: 44px;
}

.call-pad-end {
  border: 0;
  border-radius: 999px;
  background: var(--ember);
  color: var(--ink);
  padding: 0 16px;
}

.call-pad-end[hidden],
#callPadGo[hidden] { display: none; }

.call-speaker {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
}

.call-speaker.is-on {
  background: var(--signal);
  border-color: transparent;
  color: var(--ink);
}

.call-speaker:disabled {
  opacity: 0.4;
  cursor: default;
}

.pad-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.pad-keys button {
  height: 52px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: transparent;
  font-family: var(--display);
  font-size: 22px;
}

.pad-keys .pad-delete { grid-column: 2; }

.call-pad-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.call-pad-foot .btn-ghost {
  width: 100%;
  margin: 0;
  min-height: 44px;
}

.call-history {
  margin: 14px 0;
  max-height: 280px;
  overflow: auto;
}

.call-history-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.call-history ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.call-history button {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.call-history .call-peer {
  font-family: var(--mono);
  font-size: 14px;
}

.call-history .call-meta {
  color: var(--muted);
  font-size: 12px;
}

.room-tools {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
}

.clock { justify-self: auto; }

.sip {
  width: min(880px, calc(100vw - 40px));
  max-height: min(940px, calc(100vh - 36px));
  overflow: auto;
  margin: auto;
  padding: 22px 22px 18px;
  color: var(--bone);
  background: #161310;
  border: 1px solid rgba(244, 239, 230, 0.16);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.sip::backdrop { background: rgba(16, 14, 12, 0.74); }

.sip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sip-head .kicker { margin: 0; }

.sip-close {
  border: 0;
  background: transparent;
  color: var(--bone-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
}

.sip-status {
  min-height: 1.3em;
  margin: 14px 0 0;
  color: var(--bone-dim);
  font-size: 14px;
}

.sip-body {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(280px, 360px);
  gap: 28px;
  align-items: center;
  margin-top: 18px;
}

.sip-account {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sip-account > label:not(.sip-check) span,
.sip-check span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sip-account > label:not(.sip-check) {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sip-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sip-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ember);
  border: 0;
}

.sip-actions, .sip-call, .sip-tones, .sip-incoming {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sip .btn-primary {
  margin-top: 0;
  padding: 12px 18px;
}

.sip-note, .dial-hint, .sip-log {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.sip-scan video {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 16px;
  background: #000;
}

.sip-incoming p { margin: 0; flex: 1; }

.sip-call input, .sip-tones input { flex: 1; min-width: 0; }

.sip-end { color: #f0b2a8; border-color: rgba(240, 178, 168, 0.4); }

.dial {
  position: relative;
  width: min(340px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  touch-action: none;
  user-select: none;
  cursor: grab;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 27%, rgba(227, 155, 106, 0.16) 28%, transparent 34%),
    radial-gradient(circle at 50% 50%, rgba(244, 239, 230, 0.05), transparent 58%);
  box-shadow: inset 0 0 0 1px rgba(244, 239, 230, 0.12);
}

.dial.is-turning { cursor: grabbing; }

.dial-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 5;
  width: 22px;
  height: 4px;
  margin-left: -11px;
  border-radius: 999px;
  background: var(--ember);
  box-shadow: 0 0 12px var(--ember);
}

.dial-orbit { position: absolute; inset: 0; }

.dial-key {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(244, 239, 230, 0.2);
  background: rgba(16, 14, 12, 0.72);
  color: var(--bone);
  font-family: var(--display);
  font-size: 18px;
  line-height: 1;
}

.dial-key.is-focus {
  background: var(--bone);
  color: var(--ink);
  border-color: transparent;
}

.dial-key.is-sent { background: var(--ember); color: var(--ink); }

.dial-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: 34%;
  height: 34%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid rgba(244, 239, 230, 0.16);
}

.dial-focus {
  font-family: var(--display);
  font-size: 42px;
  line-height: 0.9;
}

.dial-hub button {
  border: 0;
  background: transparent;
  color: var(--ember);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  padding: 0;
}

.sip-codecs {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.sip-codecs legend {
  width: 100%;
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sip-mail { display: flex; flex-direction: column; gap: 8px; }

.sip-mail ol {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 148px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sip-mail li {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

.sip-mail .who {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sip-mail .out { text-align: right; }
.sip-mail .in .who { color: var(--signal); }

.sip-dialwrap { display: flex; flex-direction: column; gap: 12px; }

#sipRemote {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

@media (max-width: 720px) {
  .sip { width: min(100vw - 20px, 440px); padding: 16px; }
  .sip-body { grid-template-columns: 1fr; }
  .sip-dialwrap { order: -1; }
  .dial-focus { font-size: 34px; }
}

.chat {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 22px 28px 18px;
  border: 0;
  border-radius: 0;
  background: var(--ink);
  color: var(--bone);
}

.chat::backdrop { background: transparent; }

.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.install-note {
  margin: 10px 0 0;
  color: var(--ember-hot);
  font-size: 14px;
  line-height: 1.4;
}

.install-steps {
  margin: 14px 0 0;
  padding-left: 1.2em;
  font-size: 16px;
  line-height: 1.45;
}

.install-steps li { margin: 8px 0; }

.invite-link {
  margin: 14px 0 0;
  color: var(--bone-dim);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-all;
}

.chat-head, .chat-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-head .kicker { margin: 0; }

.chat-back {
  display: none;
  border: 0;
  background: transparent;
  color: var(--ember);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 0;
}

.chat-body {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 22px;
  height: calc(100% - 52px);
  margin-top: 16px;
  min-height: 0;
}

.chat-rail, .chat-stage {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-rail {
  border-right: 1px solid var(--line);
  padding-right: 12px;
}

.chat-new { display: flex; gap: 8px; }

.chat-new button { flex: 1; padding: 8px 10px; font-size: 13px; }

.chat-line {
  min-height: 1.2em;
  margin: 0;
  color: var(--ember);
  font-size: 13px;
}

.chat-rail ol, #chatPeople, #chatMessages, #chatDirectory {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
}

#chatDirectory { flex: 0 1 auto; max-height: 42%; }

.chat-rail ol, #chatMessages { flex: 1; }

.chat-row, .chat-person {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 14px;
  background: transparent;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 10px;
}

.chat-mark {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  border: 1px solid rgba(244, 239, 230, 0.16);
  color: var(--bone);
  font-family: var(--display);
  font-size: 16px;
}

.chat-row.has-mail,
.chat-person.has-mail {
  background: rgba(227, 155, 106, 0.14);
}

.has-mail .chat-mark {
  background: var(--ember);
  color: var(--ink);
  border-color: var(--ember);
  box-shadow: 0 0 0 4px rgba(227, 155, 106, 0.28);
}

.chat-mark i {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--ink);
  color: var(--ember);
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

.chat-head-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--ember);
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0;
  line-height: 18px;
  text-align: center;
}

#chatTitleHead.has-mail { color: var(--ember); }
#chatTitleHead.has-mail i {
  background: var(--ember);
  box-shadow: 0 0 12px var(--ember);
}

.chat-row:hover, .chat-person:hover,
.chat-row.is-open, .chat-person.is-picked {
  background: rgba(244, 239, 230, 0.06);
}

.chat-person.is-picked { color: var(--signal); }

.chat-row-title, .chat-person-name {
  grid-column: 2;
  grid-row: 1;
  font-size: 17px;
}

.chat-person-state,
.chat-row-kind {
  grid-column: 3;
  grid-row: 1;
}

.chat-person-state {
  justify-self: end;
  color: var(--signal);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chat-person-mail {
  grid-column: 2 / -1;
  grid-row: 2;
  color: var(--muted);
  font-size: 12px;
}

.chat-row-kind, .chat-row-preview, .chat-quiet, .chat-empty, #chatMembers {
  color: var(--muted);
  font-size: 12px;
}

.chat-row-preview { grid-column: 2 / -1; grid-row: 2; }

.chat-badge {
  justify-self: end;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--ember);
  color: var(--ink);
  font-size: 11px;
  text-align: center;
}

.chat-kicker {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}

#chatTitleField span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#chatTitle, #chatInput {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 8px 0;
}

.chat-empty {
  margin: auto;
  text-align: center;
}

.chat-thread-head { align-items: baseline; }

#chatTalk {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 10px;
}

.chat-thread-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 40px;
}

#chatMembers { margin: 0; }

#chatMessages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

#chatMessages li {
  max-width: min(640px, 72%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(244, 239, 230, 0.06);
  font-size: 17px;
  line-height: 1.45;
}

#chatMessages .mine { background: rgba(227, 155, 106, 0.16); }

#chatMessages .who {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

#chatMessages .mine { align-self: flex-end; text-align: right; }
#chatMessages .mine .who { color: var(--ember); }
#chatMessages .theirs .who { color: var(--signal); }

.chat-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-form button { flex: none; }

@media (max-width: 720px) {
  html, body { overflow-x: hidden; }

  body::before {
    inset:
      max(6px, env(safe-area-inset-top))
      max(6px, env(safe-area-inset-right))
      max(6px, env(safe-area-inset-bottom))
      max(6px, env(safe-area-inset-left));
    border-radius: 16px;
  }

  .toast {
    top: max(12px, env(safe-area-inset-top));
    width: calc(100% - 24px);
    max-width: none;
  }

  .lobby, .room { min-height: 100dvh; }

  .lobby {
    padding:
      max(12px, env(safe-area-inset-top))
      16px
      max(20px, env(safe-area-inset-bottom));
  }

  .top {
    align-items: center;
    gap: 8px;
    letter-spacing: 0.08em;
  }

  .top-note { display: none; }

  .top-actions {
    gap: 2px 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .top-sip {
    min-height: 44px;
    padding: 10px 2px;
    font-size: 12px;
    letter-spacing: 0.1em;
  }

  h1 { font-size: 56px; }

  .deck { font-size: 15px; }

  .name-field, .join-form, .or { max-width: none; }

  .join-form {
    flex-direction: column;
    align-items: stretch;
  }

  .join-form .btn-ghost,
  .lobby .btn-primary {
    width: 100%;
    min-height: 48px;
    margin-bottom: 0;
  }

  .lens { width: min(230px, 64vw); }

  .room {
    height: 100dvh;
    padding:
      max(8px, env(safe-area-inset-top))
      10px
      max(8px, env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .room-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 10px;
    margin-bottom: 8px;
  }

  .presence {
    order: 3;
    flex: 1 0 100%;
    font-size: 13px;
  }

  .room-tools { margin-left: auto; justify-self: auto; }

  .stage {
    min-height: 0;
    height: 100%;
    align-items: stretch;
  }

  .frame {
    width: 100%;
    height: 100%;
    max-width: none;
    aspect-ratio: auto;
  }

  .big-code { font-size: clamp(28px, 8vw, 44px); }

  .waiting { padding: 14px; }

  .waiting p:last-child { font-size: 14px; }

  .footer { margin-top: 8px; gap: 8px; }

  .hints { display: none; }

  .dock {
    max-width: 100%;
    gap: 0;
    padding: 4px;
  }

  .dock button { width: 42px; height: 42px; }
  .dock .leave { width: 46px; }

  .note { width: 100%; }
  .note ol { max-height: 88px; }

  .self { width: 78px; height: 78px; }

  .chat, .sip {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding:
      max(12px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
  }

  .chat {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .chat-body {
    flex: 1;
    height: auto;
    grid-template-columns: 1fr;
    margin-top: 8px;
  }

  .chat-rail { border-right: 0; padding-right: 0; }

  .chat.is-talking .chat-rail,
  .chat.is-picking .chat-rail,
  .chat:not(.is-talking):not(.is-picking) .chat-stage { display: none; }

  .chat.is-talking .chat-back,
  .chat.is-picking .chat-back { display: inline; min-height: 44px; }

  .chat-new button,
  .chat-person,
  .chat-row,
  .chat-form button,
  #chatCreate {
    min-height: 48px;
  }

  .chat-thread-head { align-items: center; }
  .chat-thread-head h2 { font-size: 24px; }
  #chatMessages li { max-width: 88%; }

  .sip { overflow: auto; }
  .sip-body { gap: 18px; margin-top: 12px; }
  .dial { width: min(280px, 86vw); }

  .sip-actions, .sip-call, .sip-tones {
    align-items: stretch;
  }

  .chat-form { align-items: center; }

  .sip-actions button,
  .sip-call button,
  .sip-tones button,
  .chat-form button {
    min-height: 44px;
  }

  .gate {
    min-height: 100dvh;
    padding:
      max(12px, env(safe-area-inset-top))
      16px
      max(20px, env(safe-area-inset-bottom));
  }

  .gate .btn-primary,
  .gate .gate-forgot,
  .people-actions .btn-primary,
  .people-actions .btn-ghost {
    width: 100%;
    min-height: 48px;
  }
}
