/* ============================================================
   UnitedPeople — design system
   ============================================================ */
:root {
  /* — palette: warm, premium, sunset-coral — */
  --bg: #14100e;
  --bg-2: #1b1512;
  --surface: #221b17;
  --surface-2: #2b2320;
  --surface-3: #352b26;
  --border: rgba(255, 238, 228, 0.1);
  --border-strong: rgba(255, 238, 228, 0.2);

  --text: #f7f0ea;
  --text-muted: #b7a99e;
  --text-dim: #897b71;

  --brand: #ff5c39;
  --brand-2: #ff3d6e;
  --brand-soft: rgba(255, 92, 57, 0.14);
  --amber: #ffb23e;
  --ok: #34d399;
  --danger: #f25c54;

  --grad-brand: linear-gradient(118deg, var(--amber) 0%, var(--brand) 46%, var(--brand-2) 100%);

  /* — type — */
  --font-display: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* — spacing scale — */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  /* — radii — */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 999px;

  /* — shadows — */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --sh-2: 0 8px 24px rgba(0, 0, 0, 0.35);
  --sh-3: 0 24px 60px rgba(0, 0, 0, 0.45);
  --sh-glow: 0 16px 48px rgba(255, 92, 57, 0.35);

  /* — motion — */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 0.14s var(--ease);
  --t-med: 0.26s var(--ease);
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(900px 560px at 86% -12%, rgba(255, 92, 57, 0.2), transparent 60%),
    radial-gradient(720px 520px at -12% 112%, rgba(255, 178, 62, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app, .screen { min-height: 100vh; }
.hidden { display: none !important; }

svg.lucide { width: 1.08em; height: 1.08em; flex: none; stroke-width: 2; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-full); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 6px; }

/* ============================================================
   Buttons (shared)
   ============================================================ */
.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 12px 18px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-med), opacity var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: var(--sh-glow);
  border-color: transparent;
}
.btn-primary:hover { box-shadow: 0 20px 56px rgba(255, 92, 57, 0.45); }
.btn-block { width: 100%; padding: 15px 18px; font-size: 1.02rem; }

/* ============================================================
   Topbar + brand
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) clamp(var(--sp-4), 4vw, var(--sp-8));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  color: var(--text);
}
.brand-mark { display: block; border-radius: 8px; }
.brand-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}
.brand-word span {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.presence {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.02);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ============================================================
   Lobby / hero
   ============================================================ */
.lobby { display: flex; flex-direction: column; }
.hero {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(var(--sp-5), 4vw, var(--sp-8)) clamp(var(--sp-4), 4vw, var(--sp-8)) var(--sp-8);
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: clamp(var(--sp-6), 5vw, var(--sp-8));
  align-items: center;
}
.hero-copy { animation: rise 0.7s var(--ease) both; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--amber);
  padding: 7px 14px;
  border: 1px solid rgba(255, 178, 62, 0.3);
  border-radius: var(--r-full);
  background: rgba(255, 178, 62, 0.08);
  margin-bottom: var(--sp-5);
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 5.2vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-5);
}
.hero h1 em {
  font-style: normal;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lede {
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  color: var(--text-muted);
  max-width: 42ch;
  margin-bottom: var(--sp-6);
}
.value-props { list-style: none; display: flex; flex-direction: column; gap: var(--sp-4); }
.value-props li { display: flex; align-items: flex-start; gap: var(--sp-4); }
.vp-ico {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid rgba(255, 92, 57, 0.25);
}
.vp-ico svg.lucide { width: 20px; height: 20px; }
.value-props b { font-family: var(--font-display); font-weight: 600; display: block; font-size: 1rem; }
.value-props small { color: var(--text-dim); font-size: 0.9rem; }

/* form card */
.hero-form { animation: rise 0.7s 0.08s var(--ease) both; }
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  padding: clamp(var(--sp-5), 3vw, var(--sp-7));
}
.form-card h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; letter-spacing: -0.01em; }
.form-sub { color: var(--text-dim); font-size: 0.92rem; margin-bottom: var(--sp-5); }

.field { display: block; margin-bottom: var(--sp-4); }
.field-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: var(--sp-2); }
.field-label .opt { font-weight: 500; font-size: 0.72rem; color: var(--text-dim); margin-left: 6px; }
.input-wrap { position: relative; display: block; }
.input-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-dim); width: 18px; height: 18px; pointer-events: none; }
.input-wrap input,
.field input[type="number"] {
  width: 100%;
}
input[type="text"], input:not([type]), input[type="number"], select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 13px 14px 13px 42px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
select { padding-left: 14px; appearance: none; cursor: pointer; }
input::placeholder { color: var(--text-dim); }
input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
  background: var(--surface);
}

/* segmented gender control */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  padding: var(--sp-1);
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
}
.seg {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.seg:hover { color: var(--text); }
.seg.active {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: var(--sh-1);
}

.consent-note {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  font-size: 0.84rem;
  color: var(--text-dim);
}
.consent-note svg.lucide { color: var(--amber); margin-top: 2px; }

/* ============================================================
   Chat screen
   ============================================================ */
.chat { display: flex; flex-direction: column; height: 100vh; }
.chat-topbar { padding: var(--sp-4) clamp(var(--sp-4), 3vw, var(--sp-6)); border-bottom: 1px solid var(--border); }
.chat-meta { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-transform: capitalize;
}
.badge svg.lucide { color: var(--text-dim); width: 15px; height: 15px; }
.badge.partner { background: var(--brand-soft); border-color: rgba(255, 92, 57, 0.3); color: var(--brand); text-transform: none; }

.mod-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.mod-status .mod-ico svg.lucide { width: 15px; height: 15px; }
.mod-status.active { color: var(--ok); }
.mod-status.off { color: var(--amber); }

.chat-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--sp-4);
  padding: var(--sp-4) clamp(var(--sp-4), 3vw, var(--sp-6));
}

/* video stage */
.stage { position: relative; min-height: 0; }
.video-wrap {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}
.video-wrap.remote { width: 100%; height: 100%; }
.video-wrap.remote::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 -90px 120px -60px rgba(0, 0, 0, 0.8);
}
.video-wrap.local {
  position: absolute;
  right: var(--sp-4);
  bottom: var(--sp-4);
  width: 210px;
  height: 158px;
  z-index: 3;
  border: 2px solid var(--border-strong);
  box-shadow: var(--sh-2);
}
video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
video.blurred { filter: blur(26px) saturate(1.1); transform: scale(1.06); }

.vlabel {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: 4;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--r-full);
  background: rgba(20, 16, 14, 0.6);
  backdrop-filter: blur(8px);
  color: var(--text);
}
.reveal-status {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--r-full);
  background: rgba(20, 16, 14, 0.6);
  backdrop-filter: blur(8px);
  color: var(--text-muted);
}
.reveal-status svg.lucide { width: 14px; height: 14px; }
.reveal-status.on { color: var(--ok); }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  text-align: center;
  padding: var(--sp-5);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 92, 57, 0.12), transparent 60%),
    rgba(16, 12, 10, 0.78);
  backdrop-filter: blur(6px);
  color: var(--text-muted);
  font-size: 1.02rem;
}
.spinner {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--brand);
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  min-height: 0;
}
.devices { display: flex; flex-direction: column; gap: var(--sp-3); }
.device-field { display: flex; flex-direction: column; gap: 5px; }
.device-field > span { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; color: var(--text-dim); font-weight: 600; }
.device-field > span svg.lucide { width: 14px; height: 14px; }
.device-field select { font-size: 0.88rem; padding: 9px 12px; }

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.messages-empty {
  margin: auto;
  text-align: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}
.messages-empty svg.lucide { width: 30px; height: 30px; opacity: 0.5; }
.messages-empty p { font-size: 0.85rem; }
.msg {
  padding: 9px 13px;
  border-radius: 14px;
  max-width: 86%;
  font-size: 0.9rem;
  word-break: break-word;
  animation: pop 0.2s var(--ease) both;
}
.msg.me { align-self: flex-end; background: var(--grad-brand); color: #fff; border-bottom-right-radius: 5px; }
.msg.them { align-self: flex-start; background: var(--surface-3); border-bottom-left-radius: 5px; }
.msg.sys { align-self: center; background: transparent; color: var(--text-dim); font-size: 0.78rem; text-align: center; padding: 4px 8px; }

.chat-form { display: flex; gap: var(--sp-2); }
.chat-form input { padding-left: 14px; }
.btn-send {
  flex: none;
  width: 46px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--r-md);
  background: var(--grad-brand);
  color: #fff;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-med);
}
.btn-send:hover { transform: translateY(-1px); box-shadow: var(--sh-glow); }
.btn-send:active { transform: scale(0.95); }

/* controls bar */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-4) clamp(var(--sp-4), 3vw, var(--sp-6)) clamp(var(--sp-4), 3vw, var(--sp-6));
}
.ctrl { background: var(--surface-2); border-color: var(--border); }
.ctrl:hover { background: var(--surface-3); }
.ctrl .ctrl-ico { display: inline-flex; }
.ctrl.next { background: var(--grad-brand); color: #fff; border-color: transparent; box-shadow: var(--sh-glow); margin-left: auto; }
.ctrl.next:hover { box-shadow: 0 20px 56px rgba(255, 92, 57, 0.45); }
.ctrl.stop { color: var(--text-muted); background: transparent; border-color: var(--border); }
.reveal.armed { background: rgba(255, 178, 62, 0.16); border-color: var(--amber); color: var(--amber); }
.share.armed { background: rgba(255, 178, 62, 0.16); border-color: var(--amber); color: var(--amber); }
#micBtn.off { background: rgba(242, 92, 84, 0.16); border-color: var(--danger); color: var(--danger); }

/* contact card */
.contact-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--border);
  animation: pop 0.2s var(--ease) both;
}
.contact-title { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; font-weight: 600; color: var(--text-dim); }
.contact-title svg.lucide { width: 14px; height: 14px; }
.contact-links { display: flex; flex-direction: column; gap: var(--sp-2); }
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  word-break: break-all;
}
.contact-link:hover { text-decoration: underline; }
.contact-link svg.lucide { width: 16px; height: 16px; flex: none; }
.contact-empty { font-size: 0.82rem; color: var(--text-dim); }

/* ============================================================
   Animations
   ============================================================ */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: var(--sp-6); padding-top: var(--sp-4); }
  .hero-form { order: -1; }
  .value-props { display: none; }
}

@media (max-width: 860px) {
  .chat-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(180px, 38vh); }
  .video-wrap.local { width: 110px; height: 80px; right: var(--sp-3); bottom: var(--sp-3); }
  .controls .ctrl-label { display: none; }
  .ctrl.next, .ctrl.stop { font-size: 0; }
  .ctrl.next svg.lucide, .ctrl.stop svg.lucide { font-size: 1rem; }
}

@media (max-width: 560px) {
  .presence span:last-child { display: none; }
  .controls { justify-content: space-between; }
  .ctrl.next { margin-left: 0; }
}
