@font-face {
  font-family: Montserrat;
  src: url("/fonts/Montserrat-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: Montserrat;
  src: url("/fonts/Montserrat-SemiBold.ttf") format("truetype");
  font-weight: 600;
}
@font-face {
  font-family: Montserrat;
  src: url("/fonts/Montserrat-Bold.ttf") format("truetype");
  font-weight: 700;
}

:root {
  --black: #070f17;
  --navy: #151f30;
  --navy-light: #1e2d45;
  --gold: #e2c386;
  --gray: #9c9fa2;
  --white: #ffffff;
  --record: #d84a3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--black);
  color: var(--white);
  font-family: Montserrat, system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
}

.hidden {
  display: none !important;
}

.view,
.join {
  min-height: calc(100vh - 40px);
}

.panel {
  border: 1px solid color-mix(in srgb, var(--navy-light), transparent 30%);
  border-radius: 8px;
  background: var(--navy);
  padding: 18px;
}

.join {
  display: grid;
  align-content: center;
  gap: 16px;
}

.logo {
  width: 92px;
  border-radius: 22px;
}

.mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.eyebrow,
.label,
small {
  margin: 0;
  color: var(--gray);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 3.4rem);
  line-height: 0.98;
}

h2 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1;
}

label {
  display: grid;
  gap: 8px;
  color: var(--gray);
  font-size: 0.85rem;
  font-weight: 600;
}

input,
select {
  width: 100%;
  border: 1px solid var(--navy-light);
  border-radius: 8px;
  background: var(--black);
  color: var(--white);
  padding: 14px;
}

button {
  border: 0;
  border-radius: 8px;
  color: var(--black);
  background: var(--gold);
  padding: 14px 16px;
  font-weight: 700;
}

.icon-button {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--gold);
  background: var(--black);
  border: 1px solid var(--navy-light);
}

.icon-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.diagnostic-bar {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px;
  border: 1px solid var(--navy-light);
  border-radius: 8px;
  color: var(--gray);
  background: color-mix(in srgb, var(--black), transparent 8%);
  font-size: 0.7rem;
  font-weight: 700;
}

.diagnostic-bar span {
  flex: 0 0 auto;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.secondary {
  width: 100%;
  margin-bottom: 8px;
  border: 1px solid var(--navy-light);
  color: var(--gold);
  background: var(--black);
}

.status {
  min-height: 20px;
  margin: 0 0 14px;
  color: var(--gray);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.status.warn {
  color: var(--gold);
}

.danger {
  color: var(--white);
  background: var(--record);
}

.top-action,
.mini-button {
  width: auto;
  padding: 10px 12px;
  font-size: 0.78rem;
}

.connection-actions {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.connection-actions small {
  text-align: right;
  text-transform: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.topbar,
.row,
.toolbar,
.member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.meter {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--black);
  border: 1px solid var(--navy-light);
}

.meter i {
  display: block;
  height: 100%;
  background: var(--gold);
}

.topbar {
  margin-bottom: 18px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  font-size: clamp(1.3rem, 5vw, 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-grid,
.invite,
.toolbar,
.speaker,
.host-talk,
.controls-panel,
.segmented {
  margin-bottom: 14px;
}

.invite-grid {
  display: grid;
  gap: 10px;
}

.invite strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.invite small {
  display: block;
  margin-top: 8px;
  text-transform: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: color-mix(in srgb, var(--black), transparent 18%);
}

.modal-card {
  width: min(100%, 520px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--navy-light);
  border-radius: 8px;
  background: var(--navy);
  padding: 18px;
}

.connection-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.connection-tabs {
  margin: 16px 0 0;
}

.diagnostics-link {
  display: block;
  margin-top: 12px;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
}

.connection-card {
  display: grid;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--navy-light), transparent 25%);
  border-radius: 8px;
  background: var(--black);
  padding: 14px;
}

.connection-card strong {
  overflow-wrap: anywhere;
}

.connection-card small {
  text-transform: none;
  line-height: 1.4;
}

.connection-switch {
  width: 100%;
}

.qr {
  width: 168px;
  height: 168px;
  padding: 10px;
  border-radius: 8px;
  background: var(--white);
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .top-action {
    flex: 0 0 auto;
  }

  .member {
    display: grid;
  }

  .member-actions {
    justify-content: stretch;
  }

  .member-actions select,
  .member-actions button {
    flex: 1 1 112px;
  }

  .connection-card {
    display: none;
  }

  .connection-card.active {
    display: grid;
  }

  .qr {
    width: min(100%, 260px);
    height: auto;
    aspect-ratio: 1;
  }
}

.badge {
  border: 1px solid var(--navy-light);
  border-radius: 999px;
  color: var(--gold);
  background: var(--black);
  padding: 8px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.member-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.member {
  border-top: 1px solid var(--navy-light);
  padding-top: 12px;
  align-items: flex-start;
}

.member strong {
  display: block;
}

.member-main {
  min-width: 0;
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.member select {
  width: auto;
  min-width: 112px;
  padding: 10px;
}

.speaker strong {
  display: block;
  margin: 10px 0 18px;
  font-size: clamp(1.8rem, 10vw, 4rem);
  line-height: 1;
}

.listen {
  min-height: 68vh;
  display: grid;
  align-content: center;
}

.wave {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
}

.wave i {
  width: 8px;
  height: 18px;
  border-radius: 999px;
  background: var(--gold);
  opacity: 0.45;
  animation: wave 1s ease-in-out infinite;
}

.wave i:nth-child(2) { animation-delay: 0.1s; }
.wave i:nth-child(3) { animation-delay: 0.2s; }
.wave i:nth-child(4) { animation-delay: 0.3s; }
.wave i:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
  50% { height: 36px; opacity: 1; }
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--navy-light);
  border-radius: 8px;
  background: var(--navy);
}

.segmented button {
  color: var(--gray);
  background: transparent;
}

.segmented .active {
  color: var(--black);
  background: var(--gold);
}

.ptt {
  width: 100%;
  min-height: 38vh;
  display: grid;
  place-content: center;
  gap: 8px;
  border: 2px solid color-mix(in srgb, var(--gold), transparent 40%);
  color: var(--white);
  background: radial-gradient(circle at 50% 28%, var(--navy-light), var(--navy));
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.ptt span {
  font-size: clamp(2rem, 12vw, 4rem);
}

.ptt.compact {
  min-height: 148px;
}

.ptt.compact span {
  font-size: clamp(1.45rem, 7vw, 2.3rem);
}

.ptt.recording,
.ptt.pressing,
body.open-mode .ptt {
  border-color: var(--record);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--record), transparent 70%);
}

.ptt.pressing {
  background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--record), var(--navy-light) 35%), var(--navy));
}

body.open-mode {
  box-shadow: inset 0 0 0 5px var(--gold);
}

@media (prefers-reduced-motion: reduce) {
  .wave i {
    animation: none;
  }
}
