:root {
  color-scheme: dark;
  --bg: #101214;
  --panel: #181c20;
  --panel-2: #20262c;
  --line: #313941;
  --text: #f5f0e8;
  --muted: #aeb7bf;
  --accent: #39c7a5;
  --accent-2: #f4b860;
  --danger: #ff6b6b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(57, 199, 165, 0.12), transparent 42%),
    linear-gradient(315deg, rgba(244, 184, 96, 0.12), transparent 46%),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.panel,
.room-view {
  width: min(100%, 960px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(24, 28, 32, 0.92);
  box-shadow: var(--shadow);
}

.join-panel {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 34px;
  min-height: 520px;
  padding: clamp(22px, 5vw, 48px);
}

.brand-row {
  align-items: center;
  display: flex;
  gap: 12px;
  grid-column: 1 / -1;
}

.brand-row p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.brand-mark {
  align-items: end;
  background: #0f1517;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: flex;
  gap: 3px;
  height: 34px;
  justify-content: center;
  padding: 8px;
  width: 34px;
}

.brand-mark span {
  animation: idle-wave 1.45s ease-in-out infinite;
  background: var(--accent);
  border-radius: 999px;
  display: block;
  height: 8px;
  width: 3px;
}

.brand-mark span:nth-child(2) {
  animation-delay: 0.12s;
}

.brand-mark span:nth-child(3) {
  animation-delay: 0.24s;
}

.brand-mark span:nth-child(4) {
  animation-delay: 0.36s;
}

.join-copy {
  align-self: center;
}

.join-copy h1,
.room-header h1 {
  letter-spacing: 0;
  margin: 0;
}

.join-copy h1 {
  font-size: 4.7rem;
  line-height: 0.94;
  max-width: 7ch;
}

.join-copy p {
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
  margin: 22px 0 0;
  max-width: 31rem;
}

.join-form {
  align-self: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  padding: clamp(18px, 4vw, 28px);
}

label {
  display: grid;
  gap: 8px;
}

label span {
  color: var(--muted);
  font-size: 0.88rem;
}

input {
  background: #11161a;
  border: 1px solid #3d474f;
  border-radius: 8px;
  color: var(--text);
  min-height: 48px;
  outline: none;
  padding: 0 14px;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(57, 199, 165, 0.18);
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.primary-action,
.control-button {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 700;
  gap: 10px;
  justify-content: center;
  min-height: 48px;
}

.primary-action {
  background: var(--accent);
  color: #06211a;
  margin-top: 6px;
}

.agent-docs {
  align-self: center;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.api-step {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: clamp(16px, 3vw, 22px);
}

.api-step-heading {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.api-step h2 {
  font-size: 1.05rem;
  letter-spacing: 0;
  margin: 0;
}

.copy-code {
  align-items: center;
  background: #11161a;
  border: 1px solid #3d474f;
  border-radius: 8px;
  color: var(--text);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.86rem;
  font-weight: 800;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
}

.copy-code:hover {
  border-color: rgba(57, 199, 165, 0.62);
}

.copy-code svg {
  height: 17px;
  width: 17px;
}

.api-step pre {
  background: #101519;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #d6f8ef;
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0;
  overflow-x: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.response-note {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0;
}

.response-note code {
  color: var(--accent);
  font-size: 0.9em;
}

.button-icon {
  height: 20px;
  width: 20px;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.room-view {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.2fr 0.8fr;
  padding: clamp(18px, 3vw, 28px);
}

.room-header {
  align-items: start;
  display: flex;
  grid-column: 1 / -1;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.room-header h1 {
  font-size: 2.5rem;
}

.connection-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 0.86rem;
  padding: 8px 12px;
}

.connection-pill.online {
  border-color: rgba(57, 199, 165, 0.48);
  color: var(--accent);
}

.stage {
  align-content: space-between;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 40%),
    #12171b;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  min-height: 410px;
  overflow: hidden;
  padding: clamp(18px, 3vw, 28px);
  position: relative;
}

.visualizer {
  align-items: center;
  display: flex;
  gap: clamp(8px, 2vw, 16px);
  height: 250px;
  justify-content: center;
}

.visualizer span {
  animation: room-wave 1.4s ease-in-out infinite;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  display: block;
  height: 38px;
  opacity: 0.9;
  width: clamp(8px, 2vw, 18px);
}

.visualizer span:nth-child(2n) {
  animation-delay: 0.12s;
}

.visualizer span:nth-child(3n) {
  animation-delay: 0.22s;
}

.visualizer.quiet span {
  animation-play-state: paused;
  height: 18px;
  opacity: 0.45;
}

.self-tile {
  align-items: center;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.avatar,
.peer-avatar {
  align-items: center;
  background: #273139;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 900;
  justify-content: center;
}

.avatar {
  font-size: 1.8rem;
  height: 64px;
  width: 64px;
}

.self-tile p,
.peer-card p {
  font-weight: 800;
  margin: 0;
  overflow-wrap: anywhere;
}

.self-tile span,
.peer-card span,
.section-heading span {
  color: var(--muted);
  font-size: 0.88rem;
}

.people-panel {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 410px;
  padding: 18px;
}

.section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading h2 {
  font-size: 1rem;
  margin: 0;
}

.peer-list {
  display: grid;
  gap: 10px;
}

.peer-card {
  align-items: center;
  background: #171d22;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr auto;
  min-height: 68px;
  padding: 12px;
}

.peer-avatar {
  height: 42px;
  width: 42px;
}

.peer-meter {
  background: #2c363e;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  width: 52px;
}

.peer-meter::before {
  animation: meter 1.1s ease-in-out infinite;
  background: var(--accent);
  content: "";
  display: block;
  height: 100%;
  width: 60%;
}

.peer-card.muted .peer-meter::before,
.peer-card.connecting .peer-meter::before {
  animation: none;
  background: #69747d;
  width: 24%;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  grid-column: 1 / -1;
  justify-content: center;
}

.control-button {
  background: #222a31;
  color: var(--text);
  min-width: 132px;
  padding: 0 16px;
}

.control-button svg {
  height: 20px;
  width: 20px;
}

.control-button:hover {
  background: #2d3740;
}

.control-button[aria-pressed="true"] {
  background: rgba(255, 107, 107, 0.18);
  color: #ffd6d6;
}

.leave-button {
  background: rgba(255, 107, 107, 0.15);
  color: #ffd8d8;
}

.hidden {
  display: none !important;
}

.toast {
  background: #f5f0e8;
  border-radius: 8px;
  bottom: 22px;
  color: #101214;
  font-weight: 800;
  left: 50%;
  max-width: min(92vw, 460px);
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 16px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes idle-wave {
  50% {
    height: 18px;
  }
}

@keyframes room-wave {
  0%,
  100% {
    transform: scaleY(0.36);
  }
  50% {
    transform: scaleY(2.8);
  }
}

@keyframes meter {
  0%,
  100% {
    transform: translateX(-70%);
  }
  50% {
    transform: translateX(85%);
  }
}

@media (max-width: 780px) {
  .app-shell {
    align-items: stretch;
    padding: 12px;
  }

  .join-panel,
  .room-view {
    grid-template-columns: 1fr;
  }

  .join-panel {
    min-height: calc(100vh - 24px);
  }

  .join-copy h1 {
    font-size: 3.1rem;
    max-width: 11ch;
  }

  .api-step-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .copy-code {
    justify-content: center;
    width: 100%;
  }

  .room-header h1 {
    font-size: 2rem;
  }

  .stage,
  .people-panel {
    min-height: 300px;
  }

  .room-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .control-button {
    flex: 1 1 140px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
