/* Face2Face — danfo yellow on black. One display family (Archivo, variable width + weight). */

:root {
  --black: #0B0B0A;
  --coal: #161614;
  --soot: #22221F;
  --line: #2E2E2A;
  --yellow: #FFD400;
  --yellow-deep: #E6BE00;
  --paper: #F6F3EA;
  --muted: #9C9A90;
  --red: #FF4D3D;
  --radius: 14px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23F6F3EA' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --chev-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%230B0B0A' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--black);
  color: var(--paper);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

.bar, .stage, .dock, .prefs, .pane { min-width: 0; }

/* Each block has its own row, so a hidden ad strip never shifts the stage into the wrong one. */
.bar { grid-row: 1; }
.ad-strip { grid-row: 2; }
.stage { grid-row: 3; }
.dock { grid-row: 4; }

/* ---------- top bar ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--paper);
  font-weight: 900;
  font-stretch: 112%;
  font-size: 20px;
  letter-spacing: -0.03em;
  line-height: 1;
}

.wordmark .two {
  display: inline-grid;
  place-items: center;
  width: 1.15em;
  height: 1.15em;
  margin: 0 3px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--black);
  font-size: 0.9em;
  transform: rotate(-8deg);
}

.online {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--coal);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.online i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  animation: ping 2s infinite;
}

@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(255, 212, 0, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(255, 212, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 212, 0, 0); }
}

/* ---------- header ad strip ---------- */

/* Follows the banner's 10:1 shape up to a height cap; wider screens letterbox on the dark card. */
.ad-strip {
  position: relative;
  margin: 0 16px 8px;
  height: min(84px, calc((100vw - 32px) / 10));
  border-radius: 10px;
  overflow: hidden;
  background: #0f0f0e;
  border: 1px solid var(--line);
}

.ad-strip[hidden] { display: none; }
.ad-strip a { display: block; height: 100%; }
.ad-strip img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }

.ad-label {
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(11, 11, 10, 0.75);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}

.ad-strip.preview { margin: 0; }

/* ---------- split stage ---------- */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin: 0 16px;
  min-height: 0;
}

.pane {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--coal);
  border: 1px solid var(--line);
  min-height: 0;
  container-type: size;
}

.pane video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.pane.you video { transform: scaleX(-1); }

.tag {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(11, 11, 10, 0.7);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 2;
}

.you-tag { background: var(--yellow); color: var(--black); }

/* stranger pane: a poster, not a card in the middle */

.cover {
  position: absolute;
  inset: 0;
  background: var(--yellow);
  color: var(--black);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  z-index: 1;
}

.stage:not([data-state="connected"]) .them > .tag { background: var(--black); color: var(--yellow); }

.poster { margin-top: auto; }

.headline {
  margin: 0 0 10px;
  font-weight: 900;
  font-stretch: 100%;
  font-size: clamp(28px, 10cqw, 96px);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.sub {
  margin: 0;
  font-size: clamp(14px, 2.4cqw, 20px);
  font-weight: 500;
  line-height: 1.35;
  max-width: 38ch;
  opacity: 0.85;
}

/* two faces nudging toward each other while we search */
.pulse {
  display: none;
  gap: 10px;
  margin-top: 18px;
}

.pulse span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--black);
  animation: nudge 1.1s ease-in-out infinite;
}

.pulse span:last-child { animation-delay: -0.55s; }

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

.steps {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 22px 0 0;
  padding: 16px 0 0;
  border-top: 2px solid rgba(11, 11, 10, 0.18);
  list-style: none;
  font-size: 13px;
  font-weight: 600;
}

.steps li { display: inline-flex; align-items: center; gap: 8px; }

.steps b {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--black);
  color: var(--yellow);
  font-size: 11px;
}

/* 18+ and the policies, on the start screen only */
.legal {
  margin: 14px 0 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: rgba(11, 11, 10, 0.72);
}

.legal a { color: var(--black); text-underline-offset: 2px; }

.stage:not([data-state="idle"]) .legal { display: none; }

/* "Meet anyone instead", offered when the queue has people who do not fit your choices */
.btn.anyone {
  margin-top: 18px;
  background: var(--black);
  color: var(--yellow);
  border-color: var(--black);
}
.btn.anyone:hover { background: #222; }

.tag .flag { display: inline-block; width: 16px; height: 12px; margin: 0 5px 0 1px; border-radius: 2px; vertical-align: -1px; object-fit: cover; }

.stage[data-state="waiting"] .pulse,
.stage[data-state="connecting"] .pulse { display: flex; }
.stage:not([data-state="idle"]) .steps { display: none; }
.stage[data-state="connected"] .cover { display: none; }

/* your pane before the camera is on */

.you-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
}

.stage:not([data-state="idle"]) .you-empty,
.you-empty.off { display: none; }

/* ---------- dock: preferences under the stranger, Start under you ---------- */

.dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 0 16px;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}

/* One squared card holding the three groups, divided by hairlines. */
.prefs {
  grid-column: 1;
  justify-self: stretch;
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--coal);
  overflow: hidden;
}

.go-row {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.go-row .go { flex: 1; justify-content: center; }

/* Dock buttons share the card's corners. */
.dock .btn { border-radius: 12px; }

/* On desktop the preference card stands as tall as the Start button. */
.dock { --dock-h: 62px; }
.dock .prefs { height: var(--dock-h); }
.dock .go-row .go { height: var(--dock-h); padding-top: 0; padding-bottom: 0; }
.dock .go-row .btn.quiet { height: var(--dock-h); padding-top: 0; padding-bottom: 0; }

.seg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 0;
}

.seg + .seg { border-left: 1px solid var(--line); }
.seg:last-child { flex: 1; min-width: 0; }
.seg:last-child .pick { flex: 1; max-width: none; }

.seg-label {
  padding: 0 6px 0 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* the inline "in" between the gender chips and the place */
.seg .seg-label + label ~ .seg-label { padding: 0 2px 0 8px; }

.seg label { position: relative; }

.seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.seg span:not(.seg-label) {
  display: inline-block;
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--soot);
  font-size: 13px;
  font-weight: 700;
  color: var(--paper);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease;
}

.seg label:hover span:not(.seg-label) { background: var(--line); }

.seg input:checked + span { background: var(--yellow); color: var(--black); }

/* Start was pressed before this was filled in */
.seg.need { border-color: var(--yellow); animation: shake 0.5s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}
.seg input:focus-visible + span { outline: 2px solid var(--yellow); outline-offset: 2px; }

.seg .pick {
  max-width: 200px;
  padding: 9px 30px 9px 13px;
  border: 0;
  border-radius: 8px;
  text-align: left;
  background: var(--soot) var(--chev) no-repeat right 10px center / 14px;
  color: var(--paper);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg .pick:hover { background-color: var(--line); }
.seg .pick:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.pick[aria-expanded="true"] { background-color: var(--yellow) !important; color: var(--black) !important; background-image: var(--chev-dark) !important; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 20px;
  color: var(--paper);
  background: var(--coal);
  transition: transform 0.08s ease, background 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn.go {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
  padding: 18px 34px;
  font-size: 19px;
}

.btn.go:hover { background: var(--yellow-deep); }
.btn.quiet { background: transparent; }
.btn.quiet:hover { background: var(--coal); }
.btn.report { color: var(--red); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* which controls show when */
.stage[data-state="idle"] ~ .dock #stop,
.stage[data-state="idle"] ~ .dock #report,
.stage[data-state="idle"] ~ .dock #next { display: none; }
.stage:not([data-state="idle"]) ~ .dock #start,
.stage:not([data-state="idle"]) ~ .dock .prefs { display: none; }

/* In a call the dock shrinks to a floating bar over the stage, and the panes take the room. */
.stage:not([data-state="idle"]) { margin-bottom: 16px; }

.stage:not([data-state="idle"]) ~ .dock {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  margin: 0;
  padding: 6px;
  border-radius: 999px;
  background: rgba(11, 11, 10, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.stage:not([data-state="idle"]) ~ .dock .go-row { gap: 6px; }
.stage:not([data-state="idle"]) ~ .dock .btn { border-radius: 999px; }
.stage:not([data-state="idle"]) ~ .dock .go { padding: 14px 96px; }
.stage:not([data-state="idle"]) ~ .dock .btn.quiet { border-color: transparent; }

/* ---------- report + sponsor sheets ---------- */

.ts { min-height: 0; margin: 4px 0; }
.ts:empty { display: none; }

.sponsor-form { padding: 22px; }
.sponsor-form h2 { margin: 0 0 4px; font-size: 22px; font-weight: 900; letter-spacing: -0.03em; }
.sponsor-form .why { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.sponsor-form textarea { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--black); color: var(--paper); font: inherit; font-size: 15px; resize: vertical; }
.sponsor-form .row { display: flex; gap: 8px; margin-top: 6px; }
.sponsor-form .row .btn { flex: 1; justify-content: center; }
.sponsor-done { padding: 26px 22px; text-align: center; }
.sponsor-done h2 { margin: 0 0 6px; font-size: 24px; font-weight: 900; letter-spacing: -0.03em; }
.sponsor-done p { margin: 0 0 18px; color: var(--muted); }
.sponsor-done .btn { justify-content: center; }
#sponsor-sheet { width: min(100% - 32px, 440px); }

/* ---------- terms / privacy / rules in a sheet ---------- */

.sheet.doc { width: min(100% - 32px, 640px); max-height: calc(100dvh - 48px); padding: 0; }
.sheet.doc[open] { display: grid; grid-template-rows: auto 1fr; }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.doc-head b { font-size: 17px; font-weight: 900; letter-spacing: -0.02em; }
.doc-body { overflow-y: auto; padding: 6px 20px 24px; font-size: 15px; line-height: 1.6; color: var(--paper); }
.doc-body h1 { font-size: 24px; font-weight: 900; letter-spacing: -0.03em; margin: 14px 0 8px; }
.doc-body h2 { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; margin: 22px 0 6px; }
.doc-body h3 { font-size: 15px; font-weight: 800; margin: 16px 0 4px; }
.doc-body p, .doc-body li { color: #d9d7cf; }
.doc-body a { color: var(--yellow); }
.doc-body ul, .doc-body ol { padding-left: 20px; }
.doc-body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-body td, .doc-body th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc-body .doc-loading { color: var(--muted); padding: 20px 0; }

/* ---------- report sheet ---------- */

.sheet {
  width: min(100% - 32px, 400px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--coal);
  color: var(--paper);
}

.sheet::backdrop { background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(3px); }

.report-form {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 20px;
}

.report-form h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.report-form button {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soot);
  color: var(--paper);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.report-form button:hover { background: var(--line); }
.report-form button:focus-visible { outline: 2px solid var(--yellow); outline-offset: 1px; }
.report-form .cancel { margin-top: 8px; background: transparent; color: var(--muted); text-align: center; }

/* ---------- place menu (our own, not the browser's) ---------- */

.menu {
  position: fixed;
  z-index: 50;
  width: 300px;
  max-height: min(420px, 70vh);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--coal);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.menu[hidden] { display: none; }

.menu-search {
  margin: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--black);
  color: var(--paper);
  font: inherit;
  font-size: 14px;
}

.menu-search::placeholder { color: var(--muted); }
.menu-search:focus { outline: 2px solid var(--yellow); outline-offset: -1px; }

.menu-list {
  overflow-y: auto;
  padding: 0 6px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.menu-group {
  padding: 10px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover, .menu-item.active { background: var(--soot); }

.menu-item[aria-selected="true"] {
  background: var(--yellow);
  color: var(--black);
}

.menu-item[aria-selected="true"]::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--black);
}

.menu-empty { padding: 14px 10px; color: var(--muted); font-size: 13px; }

/* Mid-size desktops: the card keeps its natural width, Start takes the rest. */
@media (min-width: 761px) and (max-width: 1600px) {
  .dock { grid-template-columns: auto minmax(220px, 1fr); }
  .seg:last-child .pick { max-width: 200px; }
}

/* ---------- phones ---------- */

@media (max-width: 760px) {
  .ad-strip { margin: 0 12px 8px; height: calc((100vw - 24px) / 10); border-radius: 8px; }
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    margin: 0 12px;
  }
  .cover { padding: 16px; }
  .headline { font-size: clamp(24px, 9.5cqw, 40px); }
  .sub { font-size: 14px; }
  .steps { display: none; }
  .dock {
    grid-template-columns: minmax(0, 1fr);
    margin: 0 12px;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  }
  .go-row { grid-column: 1; grid-row: 2; }

  /* One card, three rows, a label column. Square-ish corners; hairlines instead of pill borders. */
  .prefs {
    grid-column: 1;
    grid-row: 1;
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--coal);
    overflow: hidden;
  }
  .seg {
    width: 100%;
    height: auto;
    gap: 6px;
    padding: 6px 8px 6px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .dock .prefs { height: auto; justify-self: stretch; }
  .seg + .seg { border-left: 0; border-top: 1px solid var(--line); }
  .seg-label {
    flex: 0 0 52px;
    padding: 0 0 0 12px;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  /* "I'm" row: the second label ("in") is inline, not a column */
  .seg .seg-label + label ~ .seg-label { flex: 0 0 auto; padding: 0 2px 0 6px; }
  .seg label { flex: 1; }
  .seg span:not(.seg-label) {
    display: block;
    padding: 9px 6px;
    border-radius: 8px;
    background: var(--soot);
    font-size: 13px;
    text-align: center;
  }
  .seg .pick {
    flex: 1.2;
    max-width: none;
    padding: 9px 26px 9px 10px;
    border-radius: 8px;
    font-size: 13px;
    text-align: left;
  }
  /* Meet row wraps: chips on the first line, "from <place>" on the second */
  .seg.meet { flex-wrap: wrap; row-gap: 6px; }
  .seg.meet label { flex: 1 1 calc(33.333% - 24px); }
  .seg.meet .seg-label.from { flex: 0 0 52px; padding: 0 0 0 12px; }
  .seg.meet .pick { flex: 1 1 calc(100% - 60px); }
  .seg.need { border-color: var(--line); box-shadow: inset 3px 0 0 var(--yellow); }
  .menu { width: calc(100vw - 24px); left: 12px !important; right: 12px; }
  .stage:not([data-state="idle"]) { margin-bottom: 12px; }
  .stage:not([data-state="idle"]) ~ .dock { width: calc(100% - 24px); }
  .stage:not([data-state="idle"]) ~ .dock .go-row { width: 100%; }
  .stage:not([data-state="idle"]) ~ .dock .go { padding: 12px 16px; }
}
