:root {
  color-scheme: dark;
  --bg: #11141a;
  --panel: #171b22;
  --panel-2: #1d2430;
  --panel-3: #242c39;
  --text: #eef4ff;
  --muted: #9fabbe;
  --line: #2d3645;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --success: #22c55e;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "IBM Plex Sans", "Inter", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.15), transparent 24%),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.12), transparent 18%),
    var(--bg);
  color: var(--text);
}

body {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr 360px;
}

.side-panel {
  background: rgba(11, 15, 22, 0.94);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: width 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.side-panel.right {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.side-panel:not(.is-open) {
  width: 0;
  opacity: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-body {
  padding: 18px;
  overflow: auto;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.05rem;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  color: var(--muted);
  font-size: 0.9rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  padding: 14px 16px;
}

textarea {
  resize: vertical;
}

.meta-card {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.meta-card div {
  display: grid;
  gap: 4px;
}

.meta-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.room-stage {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(23, 27, 34, 0.82);
}

.status-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.16), transparent 52%),
    var(--panel);
  box-shadow: var(--shadow);
}

.hero-card p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--line);
}

.legend-dot.speaking {
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.18);
}

.participants-wrap {
  min-height: 0;
}

.participants-grid {
  height: 100%;
  min-height: 420px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.participant-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 240px;
  padding: 18px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 35%),
    var(--panel-2);
  overflow: hidden;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.participant-card.speaking {
  border-color: rgba(34, 197, 94, 0.7);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2), 0 18px 42px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}

.participant-card.local {
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.18), transparent 35%),
    var(--panel-2);
}

.participant-card.empty {
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--muted);
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: var(--panel-3);
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.participant-card.speaking .avatar {
  background: rgba(34, 197, 94, 0.2);
}

.participant-meta {
  display: grid;
  gap: 8px;
}

.participant-name {
  font-size: 1.15rem;
  font-weight: 700;
}

.participant-subtitle {
  color: var(--muted);
  font-size: 0.92rem;
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 16px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.88rem;
}

.participant-card.speaking .participant-chip {
  background: rgba(34, 197, 94, 0.16);
  color: #d7ffe4;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
}

.control-dock {
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(10, 14, 20, 0.9);
  box-shadow: var(--shadow);
}

.control-button,
.icon-button {
  border: 0;
  cursor: pointer;
  color: var(--text);
}

.control-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 999px;
  background: var(--panel-3);
}

.control-button.secondary {
  background: #263245;
}

.control-button.connect {
  background: var(--accent);
}

.control-button.disconnect {
  background: var(--danger-soft);
  color: #ffdede;
}

.control-button:disabled,
.icon-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: 999px;
  background: var(--panel-3);
}

.icon-button.ghost {
  background: rgba(255, 255, 255, 0.04);
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
}

.icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.log {
  margin: 0;
  min-height: 220px;
  white-space: pre-wrap;
  line-height: 1.45;
  color: #d9e4f5;
}

.desktop-only {
  display: inline;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px 1fr;
  }

  .side-panel.right {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 90vw);
    z-index: 20;
  }

  .side-panel.right:not(.is-open) {
    transform: translateX(100%);
    width: min(360px, 90vw);
  }
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
  }

  .side-panel.left,
  .side-panel.right {
    position: fixed;
    top: 0;
    bottom: 0;
    width: min(360px, 92vw);
    z-index: 30;
  }

  .side-panel.left:not(.is-open) {
    transform: translateX(-100%);
    width: min(360px, 92vw);
  }

  .side-panel.right:not(.is-open) {
    transform: translateX(100%);
    width: min(360px, 92vw);
  }

  .room-stage {
    padding: 16px;
  }

  .topbar,
  .hero-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .desktop-only {
    display: none;
  }

  .participants-grid {
    min-height: 320px;
  }
}
