:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #152033;
  --muted: #5c6b7e;
  --line: #d9e0ea;
  --accent: #0b6e4f;
  --accent-soft: #e6f5ef;
  --danger: #c62828;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    linear-gradient(180deg, #e8eef5 0%, var(--bg) 40%),
    var(--bg);
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  letter-spacing: -0.03em;
}
.lead {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  margin-bottom: 0.85rem;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}
.row > div { flex: 1; min-width: 160px; }

button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
}
.btn-call {
  background: var(--accent);
  color: #fff;
}
.btn-call:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  padding: 0;
  background: #eef2f7;
}
.btn-icon.off { background: #fdecea; color: var(--danger); }

#call-panel { display: none; }
#call-panel.visible { display: block; }

.stage {
  position: relative;
  background: #101820;
  border-radius: 10px;
  min-height: 280px;
  overflow: hidden;
  margin-bottom: 1rem;
}
#remote-videos {
  width: 100%;
  min-height: 280px;
  display: grid;
  place-items: center;
  color: #8fa3bf;
}
#remote-videos video {
  width: 100%;
  height: 280px;
  object-fit: cover;
}
#local-video {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 120px;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 8px;
  background: #1c2a38;
  transform: scaleX(-1);
}
#local-video.hidden { display: none; }

.controls {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

#status {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
#error {
  display: none;
  background: #fdecea;
  color: var(--danger);
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
#error.visible { display: block; }

#recent {
  list-style: none;
  margin: 0;
  padding: 0;
}
#recent li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
#recent .meta { color: var(--muted); }

#audio-sink { position: absolute; width: 0; height: 0; overflow: hidden; }

.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
}
.check input { width: auto; margin: 0; }
