* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0f172a;
  color: #f1f5f9;
  min-height: 100vh;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: #3b82f6;
  color: #fff;
}
.btn-primary:hover {
  background: #2563eb;
}

.btn-secondary {
  background: #334155;
  color: #f1f5f9;
}
.btn-secondary:hover {
  background: #475569;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-outline {
  background: transparent;
  border: 1px solid #475569;
  color: #f1f5f9;
}
.btn-outline:hover {
  background: #1e293b;
}

/* ---------------- Home page ---------------- */
.home-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.home-container h1 {
  font-size: 32px;
  margin-bottom: 8px;
}

.subtitle {
  color: #94a3b8;
  margin-bottom: 32px;
}

.home-card {
  background: #1e293b;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.privacy-note { color: #94a3b8; font-size: 12px; margin-top: 6px; }

.divider {
  display: flex;
  align-items: center;
  color: #64748b;
  font-size: 13px;
  margin: 6px 0;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #334155;
}
.divider span {
  padding: 0 10px;
}

.field-label {
  text-align: left;
  font-size: 13px;
  color: #94a3b8;
}

#codeInput {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #f1f5f9;
  font-size: 18px;
  letter-spacing: 4px;
  text-align: center;
  text-transform: uppercase;
}
#codeInput:focus {
  outline: none;
  border-color: #3b82f6;
}

/* ---------------- Share page ---------------- */
.share-body {
  height: 100vh;
  overflow: hidden;
}

.share-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #1e293b;
}
.top-actions { display: flex; align-items: center; gap: 14px; color: #94a3b8; font-size: 13px; }

.code-display {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.code-label {
  font-size: 12px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.code-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #3b82f6;
}

.video-wrapper {
  flex: 1;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#localVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.black-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.black-overlay[hidden], video[hidden], [hidden] { display: none !important; }
.share-prompt { display: flex; flex-direction: column; align-items: center; gap: 18px; color: #cbd5e1; }
.share-prompt label { font-size: 13px; }
.share-prompt input { margin-right: 7px; }

.controls {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: center;
  padding: 16px;
  background: #1e293b;
}
.connection-status { color: #94a3b8; font-size: 13px; }

/* ---------------- View page ---------------- */
.view-body {
  height: 100vh;
  overflow: hidden;
  background: #000;
}

.view-container {
  position: relative;
  height: 100vh;
  width: 100vw;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

#remoteVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.status-message {
  position: absolute;
  color: #94a3b8;
  font-size: 16px;
  text-align: center;
}

.end-call-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  background: rgba(15, 23, 42, 0.85);
  padding: 10px;
  border-radius: 30px;
  backdrop-filter: blur(6px);
}

.end-call-bar.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.end-call-bar .btn {
  border-radius: 24px;
  padding: 10px 26px;
}
.end-call-bar { display: flex; gap: 8px; }
@media (max-width: 560px) {
  .top-bar { align-items: flex-start; gap: 12px; }
  .top-actions { flex-direction: column; align-items: flex-end; gap: 6px; }
  .code-label { display: none; }
  .controls { justify-content: space-between; }
}
