:root {
  --bg: #0b0c12;
  --panel: #14161f;
  --panel-2: #1d202c;
  --line: #262a38;
  --text: #eef0f6;
  --muted: #8d93a6;
  --accent: #7c5cff;
  --accent-2: #ff5ca8;
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --danger: #ef4058;
  --ok: #2fd27a;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(124, 92, 255, .18), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(255, 92, 168, .12), transparent 60%),
    var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 800; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.logo-text span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #fff; }
.logo-mark svg { width: 18px; height: 18px; }
.online {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(47, 210, 122, .08); border: 1px solid rgba(47, 210, 122, .25);
  color: var(--muted); font-size: .85rem;
}
.online strong { color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(47, 210, 122, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(47, 210, 122, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 210, 122, 0); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 12px 18px;
  font-weight: 600; color: #fff; background: var(--panel-2);
  transition: transform .15s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad); box-shadow: 0 8px 24px -8px rgba(124, 92, 255, .7); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: var(--panel-2); }
.btn.block { width: 100%; padding: 15px; font-size: 1.05rem; }
kbd { font: inherit; font-size: .7rem; padding: 2px 6px; border-radius: 5px; background: rgba(255, 255, 255, .2); }

/* ---------- Start screen ---------- */
.start {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  align-items: center;
  gap: 56px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-2); padding: 6px 12px; border-radius: 999px; background: rgba(255, 92, 168, .1);
}
.hero h1 { font-size: clamp(2.1rem, 4.2vw, 3.2rem); line-height: 1.05; letter-spacing: -.035em; margin: 18px 0 16px; font-weight: 800; }
.hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); font-size: 1.1rem; line-height: 1.6; max-width: 46ch; margin: 0 0 28px; }
.features { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.features li {
  display: flex; align-items: center; gap: 8px; font-size: .9rem;
  padding: 9px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
}
.features svg { width: 16px; height: 16px; color: var(--accent); }

.card {
  background: rgba(20, 22, 31, .85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px;
  width: 100%;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
}
.card h2 { margin: 0 0 4px; font-size: 1.5rem; letter-spacing: -.02em; }
.sub { color: var(--muted); margin: 0 0 24px; line-height: 1.5; }
.field { margin-bottom: 20px; }
.field > label { display: block; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.options button {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--panel-2); color: var(--text);
  border: 1.5px solid transparent; border-radius: 14px;
  padding: 14px 6px; font-weight: 500; font-size: .92rem;
  transition: border-color .15s, background .15s, transform .15s;
}
.options button span { font-size: 1.5rem; }
.options button:hover { border-color: var(--line); background: #232736; }
.options button.selected { border-color: var(--accent); background: rgba(124, 92, 255, .14); }
.field > label small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.text-input {
  width: 100%; padding: 12px 14px; border-radius: 12px; font: inherit; color: var(--text);
  background: var(--panel-2); border: 1.5px solid transparent; outline: none;
}
.text-input:focus { border-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: .9rem; line-height: 1.4; margin-bottom: 14px; cursor: pointer; }
.check a { color: var(--text); }
.check input { accent-color: var(--accent); width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0; }
.error { color: var(--danger); min-height: 1.2em; margin: 0 0 10px; font-size: .88rem; }

.banned { grid-template-columns: minmax(0, 440px); justify-content: center; text-align: center; }
.banned .dialog-icon { margin: 0 auto 14px; }

/* ---------- Chat screen ---------- */
.chat {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  padding: 0 14px 14px;
  min-height: 0;
}

.stage {
  position: relative;
  background: #000;
  border-radius: 22px;
  overflow: hidden;
  min-height: 0;
  border: 1px solid var(--line);
}
.stage > video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* No right-click saving or dragging of the stranger's video. */
#remoteVideo { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; pointer-events: none; }
/* Each new stranger starts blurred until "Show video" is pressed or the countdown ends. */
#remoteVideo { transition: filter .3s; }
.stage.veiled #remoteVideo { filter: blur(40px) brightness(.7); }
.veil {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: #fff; text-align: center; padding: 16px;
}
.veil p { margin: 0; font-size: 1rem; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.stage.veiled .veil { display: flex; }

.overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(circle at center, #171a26, #0a0b10 70%);
  color: var(--muted); text-align: center; padding: 16px;
}
.overlay p { margin: 0; font-size: 1.05rem; }
.radar { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.radar > svg { width: 32px; height: 32px; color: #fff; z-index: 1; }
.radar::before { content: ""; position: absolute; inset: 22px; border-radius: 50%; background: var(--grad); }
.radar span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: ripple 2.4s infinite; }
.radar span:nth-child(2) { animation-delay: .8s; }
.radar span:nth-child(3) { animation-delay: 1.6s; }
@keyframes ripple { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }

.tag {
  position: absolute; left: 16px; top: 16px;
  background: rgba(0, 0, 0, .5); backdrop-filter: blur(8px);
  padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 500;
}
.tag.small { left: 8px; top: auto; bottom: 8px; padding: 3px 9px; font-size: .75rem; }

.pip {
  position: absolute; right: 16px; top: 16px;
  width: clamp(120px, 22%, 240px); aspect-ratio: 4 / 3;
  border-radius: 14px; overflow: hidden; background: #111;
  border: 2px solid rgba(255, 255, 255, .15);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
}
.pip video { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }

.controls {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: 20px;
  background: rgba(15, 16, 24, .72); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .08);
  max-width: calc(100% - 24px);
}
.round {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px;
  border: none; color: #fff; background: rgba(255, 255, 255, .1);
  transition: background .15s;
}
.round:hover { background: rgba(255, 255, 255, .18); }
.round:disabled { opacity: .4; cursor: default; }
.round .offi { display: none; }
.round.off { background: var(--danger); }
.round.off .on { display: none; }
.round.off .offi { display: block; }
.round.active { background: var(--accent); }
.pip.blurred video { filter: blur(12px); }
.sep { width: 1px; height: 28px; background: rgba(255, 255, 255, .12); margin: 0 4px; }
.controls .btn { height: 46px; border-radius: 14px; }
#nextBtn { padding: 0 20px; }

/* ---------- Text chat ---------- */
.side {
  display: flex; flex-direction: column;
  background: var(--panel); border-radius: 22px; border: 1px solid var(--line);
  min-height: 0; overflow: hidden;
}
.side-head { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.side-head small { color: var(--muted); font-weight: 400; font-size: .75rem; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-height: 150px; }
.msg { max-width: 85%; padding: 9px 14px; border-radius: 18px; word-wrap: break-word; line-height: 1.4; font-size: .95rem; animation: pop .18s ease-out; }
.msg.me { align-self: flex-end; background: var(--grad); border-bottom-right-radius: 6px; }
.msg.them { align-self: flex-start; background: var(--panel-2); border-bottom-left-radius: 6px; }
.msg.system { align-self: center; background: none; color: var(--muted); font-size: .8rem; text-align: center; padding: 4px 8px; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } }

.typing { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: .8rem; padding: 0 18px 8px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; margin-right: 4px; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input {
  flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid transparent; color: var(--text);
  border-radius: 14px; padding: 12px 14px; font: inherit; outline: none;
}
.chat-form input:focus { border-color: var(--accent); }
.chat-form button { display: grid; place-items: center; width: 46px; background: var(--grad); color: #fff; border: none; border-radius: 14px; }
.chat-form button:disabled, .chat-form input:disabled { opacity: .45; cursor: default; }

/* ---------- Dialog ---------- */
dialog {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 22px;
  padding: 26px; width: min(420px, calc(100vw - 32px));
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .9);
}
dialog::backdrop { background: rgba(5, 6, 10, .7); backdrop-filter: blur(4px); }
dialog h3 { margin: 0 0 4px; font-size: 1.25rem; }
.dialog-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: rgba(239, 64, 88, .14); color: var(--danger); margin-bottom: 14px; }
.reasons { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.reasons label { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-radius: 12px; background: var(--panel-2); border: 1.5px solid transparent; cursor: pointer; }
.reasons label:has(input:checked) { border-color: var(--danger); background: rgba(239, 64, 88, .08); }
.reasons input { accent-color: var(--danger); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .start { grid-template-columns: 1fr; gap: 28px; padding: 8px 16px 24px; }
  .hero { text-align: center; }
  .lead { margin-left: auto; margin-right: auto; }
  .features { justify-content: center; }
}

@media (max-width: 800px) {
  body { height: auto; min-height: 100dvh; }
  .topbar { padding: 12px 16px; }
  .chat { grid-template-columns: 1fr; padding: 0 10px 10px; }
  .stage { height: 62vh; height: 62dvh; }
  .side { min-height: 340px; }
  .pip { width: 30%; right: 10px; top: 10px; }
  .controls { bottom: 12px; gap: 6px; padding: 6px; }
  .round, .controls .btn { width: 42px; height: 42px; }
  .controls .btn { width: auto; padding: 0 12px; }
  .sep, kbd, #stopBtn .lbl { display: none; }
}

/* ---------- Terms / Privacy pages ---------- */
body.legal { height: auto; min-height: 100vh; display: block; }
.doc { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; line-height: 1.65; color: #d6d9e4; }
.doc h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); margin: 8px 0 4px; color: var(--text); }
.doc h2 { font-size: 1.15rem; margin: 32px 0 8px; color: var(--text); }
.doc .meta { color: var(--muted); margin: 0 0 24px; font-size: .9rem; }
.doc a { color: var(--accent-2); }
.doc ul { padding-left: 20px; }
.doc li { margin: 4px 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: .92rem; display: block; overflow-x: auto; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.doc th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.legal-links { text-align: center; margin: 14px 0 0; font-size: .82rem; color: var(--muted); }
.legal-links a { color: var(--muted); }
