:root {
  color-scheme: dark;
  --bg: #080b0a;
  --panel: #111715;
  --panel2: #17211d;
  --line: #26342f;
  --text: #f4faf6;
  --muted: #a7b5ad;
  --green: #28d263;
  --green-dark: #068a36;
  --danger: #ff5a67;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(40, 210, 99, 0.16), transparent 32rem),
    linear-gradient(135deg, #080b0a 0%, #101612 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.shell.narrow {
  width: min(620px, 100%);
}

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

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

.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--green);
  color: #021007;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
}

h2 {
  font-size: 22px;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.grid,
.panel-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
}

.panel-grid {
  grid-template-columns: 0.85fr 1.15fr;
  align-items: start;
}

.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(17, 23, 21, 0.88);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.26);
  padding: 22px;
}

.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0b100e;
  color: var(--text);
  outline: none;
  padding: 14px 15px;
}

input:focus {
  border-color: var(--green);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  cursor: pointer;
  background: var(--green);
  color: #031007;
  font-weight: 800;
}

.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel2);
  color: var(--muted);
  padding: 13px 14px;
}

.qrbox {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fff9;
  padding: 18px;
}

.qrbox img,
.qrbox canvas {
  width: min(240px, 100%) !important;
  height: auto !important;
}

.linkbox {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

video {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #030504;
  object-fit: cover;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.call-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #020403;
}

.remote-video,
.video-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  object-fit: cover;
}

.video-fallback {
  background:
    radial-gradient(circle at 50% 34%, rgba(40, 210, 99, 0.20), transparent 22rem),
    linear-gradient(145deg, #07110c 0%, #030504 68%);
}

.local-video {
  position: absolute;
  right: 22px;
  bottom: 112px;
  z-index: 3;
  width: min(190px, 32vw);
  aspect-ratio: 3 / 4;
  border: 2px solid rgba(255, 255, 255, 0.70);
  border-radius: 18px;
  background: #050807;
  object-fit: cover;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

.call-top {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 26px;
  z-index: 4;
  text-align: center;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

.call-top h2 {
  font-size: clamp(24px, 4vw, 44px);
}

.call-actions {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 32px;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 14px;
}

.call-screen[data-mode="outgoing"] .incoming-actions,
.call-screen[data-mode="outgoing"] #reject,
.call-screen[data-mode="active"] .incoming-actions,
.call-screen[data-mode="incoming"] .active-actions {
  display: none;
}

.call-status {
  position: absolute;
  left: 50%;
  bottom: 88px;
  z-index: 5;
  width: min(520px, calc(100% - 40px));
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
}

@media (max-width: 780px) {
  .shell {
    padding: 20px;
  }

  .grid,
  .panel-grid,
  .video-grid {
    grid-template-columns: 1fr;
  }

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

  .local-video {
    right: 14px;
    bottom: 106px;
    width: 118px;
    border-radius: 14px;
  }

  .call-actions {
    bottom: 26px;
  }
}
