:root {
  color-scheme: light dark;
  --bg: #0f1115;
  --fg: #e6e8ee;
  --fg-muted: #9aa1b2;
  --accent: #76b3ff;
  --error: #ff7676;
  --border: #2a2f3a;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
}

main {
  max-width: 28rem;
  margin: 0 auto;
  padding: 6rem 1.25rem 2rem;
}

h1,
h2 {
  font-weight: 600;
  margin: 0 0 0.75rem;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 0.75rem;
  color: var(--fg-muted);
}

.view {
  display: block;
}

.join-screen {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.join-pin-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.join-pin-input {
  font: inherit;
  font-size: 1.25rem;
  letter-spacing: 0.4em;
  text-align: center;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
}

.join-pin-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.join-pin-submit {
  font: inherit;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: #06121f;
  border: 0;
  font-weight: 600;
  cursor: pointer;
}

.join-pin-submit:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.join-pin-hint-error {
  color: var(--error);
}

.join-ended h2,
.join-locked h2 {
  color: var(--error);
}

.join-call-start {
  font: inherit;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: #06121f;
  border: 0;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
}

/* --- call view --- */

.view-call {
  max-width: none;
  margin: 0;
  padding: 0;
}

.call-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #000;
  color: var(--fg);
  z-index: 10;
}

.call-banner {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  background: rgba(0, 0, 0, 0.6);
}

.call-banner > div {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.call-banner strong {
  font-weight: 600;
}

.call-banner span {
  color: var(--fg-muted);
}

.call-videos {
  position: relative;
  display: grid;
  place-items: center;
  background: #000;
  overflow: hidden;
}

.call-video {
  max-width: 100%;
  max-height: 100%;
  background: #000;
}

.call-video-remote {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.call-video-local {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  width: 8rem;
  height: 6rem;
  border-radius: var(--radius);
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.call-controls {
  padding: 1rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.6);
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
}

.call-hangup {
  font: inherit;
  padding: 0.75rem 2rem;
  border-radius: var(--radius);
  background: var(--error);
  color: white;
  border: 0;
  font-weight: 600;
  cursor: pointer;
}

.call-hangup:disabled {
  opacity: 0.5;
  cursor: default;
}
