:root {
  --bg: #0d0f14;
  --panel: #161a22;
  --panel-2: #1f2430;
  --line: #2a3040;
  --text: #eef1f7;
  --muted: #8c94a6;
  --accent: #ff4d6d;
  --accent-2: #ff8a5b;
  --ok: #3ddc97;
  --danger: #ff4d4d;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 600; cursor: pointer;
  transition: transform .08s, opacity .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn.ghost { background: rgba(255,255,255,.12); backdrop-filter: blur(8px); color: #fff; }
.btn.danger { background: rgba(255,77,77,.15); color: var(--danger); }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.big { padding: 14px 30px; font-size: 1.05rem; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.3rem;
  background: rgba(0,0,0,.45); color: #fff; backdrop-filter: blur(8px);
  display: grid; place-items: center;
}
.icon-btn.small { width: 32px; height: 32px; font-size: 1rem; }

/* ---------- auth page ---------- */
.auth-body { min-height: 100%; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 10% -10%, #3a1427 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 110%, #3a2414 0%, transparent 60%), var(--bg); }
.auth-wrap { width: 100%; max-width: 420px; padding: 32px 18px; }
.brand { display: flex; align-items: center; gap: 10px; justify-content: center; }
.brand h1 { margin: 0; font-size: 2.1rem; letter-spacing: -.02em; }
.brand h1 span { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px rgba(255,77,109,.2); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(255,77,109,0); } }
.tagline { text-align: center; color: var(--muted); margin: 8px 0 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel-2); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.tab { border: 0; background: none; padding: 10px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab.active { background: var(--text); color: var(--bg); }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: .88rem; color: var(--muted); }
.form input:not([type=radio]):not([type=checkbox]), .form select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 16px; color: var(--text); outline: none;
}
.form input:focus, .form select:focus { border-color: var(--accent); }
.gender { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gender legend { font-size: .88rem; color: var(--muted); margin-bottom: 6px; }
.pill { cursor: pointer; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: block; text-align: center; padding: 10px 4px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font-size: .92rem; }
.pill input:checked + span { border-color: var(--accent); background: rgba(255,77,109,.15); }
.pill input:focus-visible + span { outline: 2px solid var(--accent); }
.form .check { grid-template-columns: auto 1fr; align-items: start; gap: 10px; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); }
.error { color: var(--danger); min-height: 1em; margin: 0; font-size: .9rem; }

/* ---------- chat page ---------- */
.chat-body { overflow: hidden; background: #000; }
.stage { position: fixed; inset: 0; height: 100dvh; display: grid; grid-template-rows: 1fr 1fr; gap: 2px; background: #000; }
.half { position: relative; overflow: hidden; background: #0b0b0f; }
.half video { width: 100%; height: 100%; object-fit: cover; display: block; background: #0b0b0f; }
.half video.mirror { transform: scaleX(-1); }

.placeholder { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 14px; text-align: center; padding: 20px; color: var(--muted);
  background: radial-gradient(600px 300px at 50% 50%, #1b1f2a, #0b0b0f); }
.placeholder p { margin: 0; font-size: 1.05rem; }
.placeholder b { color: var(--text); }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.partner { position: absolute; left: 12px; top: calc(12px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.5); backdrop-filter: blur(8px); padding: 6px 6px 6px 12px; border-radius: 999px; font-weight: 600; }
#partnerFlag { font-size: 1.3rem; line-height: 1; }
.gender-tag { font-size: .8rem; color: var(--muted); font-weight: 500; }
.settings-btn { position: absolute; right: 12px; top: calc(12px + env(safe-area-inset-top)); }

.controls { position: absolute; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; align-items: flex-end; z-index: 3; }

/* chat overlay – bottom-left over the user's half */
.chat { position: fixed; left: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); width: min(360px, calc(100vw - 150px));
  max-height: calc(50dvh - 20px); display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.messages { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px;
  mask-image: linear-gradient(to bottom, transparent 0, #000 24px); -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px); scrollbar-width: none; }
.messages::-webkit-scrollbar { display: none; }
.msg { align-self: flex-start; max-width: 100%; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); padding: 6px 10px; border-radius: 12px; font-size: .92rem; line-height: 1.35; word-wrap: break-word; overflow-wrap: anywhere; }
.msg b { font-weight: 700; }
.msg.me b { color: var(--accent-2); }
.msg.them b { color: #7cc4ff; }
.msg.system { background: rgba(255,255,255,.1); color: #cfd5e2; font-size: .82rem; }
.msg.big-emoji { font-size: 1.5rem; padding: 4px 10px; }
.msg.big-emoji b { font-size: .85rem; vertical-align: middle; }
.emojis { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.emojis::-webkit-scrollbar { display: none; }
.emoji { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(6px); font-size: 1.15rem; cursor: pointer; transition: transform .1s; }
.emoji:hover:not(:disabled) { transform: scale(1.15); }
.emoji:active:not(:disabled) { transform: scale(.9); }
.emoji:disabled { opacity: .4; cursor: default; }
.chat-input { display: flex; gap: 6px; }
.chat-input input { flex: 1; min-width: 0; border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  border-radius: 999px; padding: 10px 14px; font-size: 16px; outline: none; }
.chat-input input:focus { border-color: var(--accent); }
.chat-input input:disabled { opacity: .5; }
.send { width: 42px; height: 42px; padding: 0; flex: none; }

/* settings sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 10; }
.sheet { position: fixed; z-index: 11; right: 12px; top: calc(64px + env(safe-area-inset-top)); width: min(320px, calc(100vw - 24px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet h2 { margin: 0; font-size: 1.1rem; }
.me { background: var(--panel-2); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.me-name { font-weight: 700; font-size: 1.05rem; }
.me-sub { color: var(--muted); font-size: .82rem; margin-top: 4px; overflow-wrap: anywhere; }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle i { width: 44px; height: 26px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + i { background: var(--ok); }
.toggle input:checked + i::after { transform: translateX(18px); }
.toggle input:focus-visible + i { outline: 2px solid var(--accent); }

.toast { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.8); padding: 10px 16px; border-radius: 999px; z-index: 20; font-size: .9rem; }

/* small phones: tighter controls */
@media (max-width: 480px) {
  .btn.big { padding: 12px 20px; font-size: 1rem; }
  .chat { width: calc(100vw - 130px); }
  .emoji { width: 32px; height: 32px; font-size: 1rem; }
}

/* ---------- moderation banner (shown to a monitored user) ---------- */
.mod-banner { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 15; background: rgba(255,77,77,.92); color: #fff; font-size: .82rem; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: modpulse 2s infinite; }
@keyframes modpulse { 50% { opacity: .75; } }

/* ---------- admin panel ---------- */
.admin-body { background: var(--bg); min-height: 100vh; }
.admin-head { position: sticky; top: 0; z-index: 5; background: rgba(13,15,20,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.brand.small h1 { font-size: 1.15rem; }
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.atab { border: 0; background: var(--panel-2); color: var(--muted); padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .9rem; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.atab.active { background: var(--text); color: var(--bg); }
.atab.link { background: none; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .78rem; }
.view { padding: 16px; max-width: 1100px; margin: 0 auto; }
.hint { color: var(--muted); font-size: .9rem; margin-top: 0; }
.empty { color: var(--muted); text-align: center; padding: 40px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card-live { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.card-live.in-chat { border-color: var(--accent); }
.thumb { position: relative; aspect-ratio: 4/3; background: #000; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .noimg { color: var(--muted); font-size: .82rem; }
.live-dot { position: absolute; top: 8px; right: 8px; color: #3ddc97; font-size: .7rem; filter: drop-shadow(0 0 4px #3ddc97); }
.card-info { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.card-name { font-weight: 700; }
.card-name .g { color: var(--muted); font-weight: 500; }
.card-sub { color: var(--muted); font-size: .82rem; }

.search { width: 100%; max-width: 420px; margin-bottom: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 16px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.utable { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
.utable th, .utable td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.utable th { color: var(--muted); font-weight: 600; background: var(--panel); position: sticky; top: 0; }
.utable tr.banned { opacity: .55; }
.utable .muted { color: var(--muted); }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3ddc97; margin-right: 6px; }
.tag { font-size: .72rem; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.tag.green { background: rgba(61,220,151,.16); color: #3ddc97; }
.tag.red { background: rgba(255,77,77,.16); color: #ff6b6b; }
.btn.tiny { padding: 6px 12px; font-size: .82rem; }

/* monitor overlay */
.monitor { position: fixed; inset: 0; z-index: 30; background: rgba(5,6,9,.97); display: flex; flex-direction: column; padding: 14px; gap: 12px; }
.monitor-head { display: flex; justify-content: space-between; align-items: center; }
.monitor-head h2 { margin: 0; font-size: 1.1rem; }
.monitor-videos { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 0; }
.mv { position: relative; background: #000; border-radius: 12px; overflow: hidden; }
.mv video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.mv-label { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.6); padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.monitor-chat { height: 120px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: .88rem; display: flex; flex-direction: column; gap: 3px; }
.monitor-chat .sys { color: var(--muted); }
.m-msg b { color: var(--accent-2); }
.monitor-actions { display: flex; gap: 10px; justify-content: center; }
@media (max-width: 640px) { .monitor-videos { grid-template-columns: 1fr; } }

/* live-card status accents */
.card-live.st-chat   { border-color: var(--accent); }
.card-live.st-search { border-color: #f5c451; }
.card-live.st-idle   { border-color: #f5c451; }
.card-live.st-off    { opacity: .7; }
.card-live .watch-btn { margin-top: 2px; }

/* ===== swipe controls (mobile) + polish ===== */

/* On touch devices hide the buttons and show a swipe hint instead */
body.touch .controls { display: none; }
.swipe-hint { display: none; }
body.touch .swipe-hint {
  display: block; position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%); white-space: nowrap; z-index: 3; pointer-events: none;
  max-width: calc(100vw - 20px); text-align: center;
  background: rgba(10,12,18,.6); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff; padding: 9px 16px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  animation: hintfloat 3s ease-in-out infinite;
}
@keyframes hintfloat { 50% { transform: translateX(-50%) translateY(-3px); } }

/* directional swipe animations on the stranger (top) panel */
.remote.anim-next { animation: animNext .4s cubic-bezier(.22,.61,.36,1); }
.remote.anim-stop { animation: animStop .32s ease; }
@keyframes animNext {
  0%   { transform: translateX(28%) scale(.97); opacity: .2; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes animStop {
  0%   { transform: translateX(0); opacity: 1; }
  55%  { transform: translateX(-18%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* ---- visual polish ---- */
.stage { gap: 0; background: #05060a; }
.half { box-shadow: inset 0 0 120px rgba(0,0,0,.45); }
.half.remote { border-bottom: 1px solid rgba(255,255,255,.06); }

/* nicer control buttons (PC) */
.controls .btn.big {
  padding: 15px 30px; font-size: 1.05rem; border-radius: 16px;
  box-shadow: 0 10px 30px rgba(255,77,109,.35);
}
.btn.primary { box-shadow: 0 8px 24px rgba(255,77,109,.3); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border: 1px solid rgba(255,255,255,.16); }
.controls .btn.ghost.big { box-shadow: none; }

/* placeholder / status */
.placeholder { background: radial-gradient(700px 360px at 50% 42%, #1a1f2c, #06070c); }
.placeholder p { font-size: 1.12rem; letter-spacing: .01em; }
.spinner { width: 42px; height: 42px; border-width: 3px; }

/* partner badge: cleaner glass pill */
.partner {
  background: rgba(10,12,18,.55); border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 8px 24px rgba(0,0,0,.3); padding: 7px 8px 7px 13px;
}
#partnerName { font-weight: 700; letter-spacing: .01em; }

/* settings cog + report: subtle border */
.icon-btn { border: 1px solid rgba(255,255,255,.12); box-shadow: 0 6px 18px rgba(0,0,0,.3); }

/* chat bubbles a touch softer */
.msg { border: 1px solid rgba(255,255,255,.06); box-shadow: 0 4px 14px rgba(0,0,0,.25); }

/* auth card polish */
.card { border-radius: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.brand h1 { font-size: 2.3rem; }
.btn.primary.big, .form .btn.primary { padding: 14px; border-radius: 14px; font-size: 1.02rem; }
.pill span { transition: background .15s, border-color .15s, transform .08s; }
.pill input:checked + span { transform: translateY(-1px); }

/* ======================================================================
   v2 — layout fixes (no overlap), online pill, report sheet, polish
   ====================================================================== */

/* PC controls: a centered pill bar at the bottom (was bottom-right, overlapped chat) */
.controls {
  position: fixed; left: 50%; right: auto;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  flex-direction: row; align-items: center; gap: 12px; z-index: 6;
}
body.touch .controls { display: none; }

/* Lift the chat above the bottom control bar / swipe hint so they never collide */
.chat {
  bottom: calc(88px + env(safe-area-inset-bottom));
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100dvh - 360px);
}
body.touch .chat { max-height: calc(50dvh - 40px); }

/* Live online count — top-left on the idle screen (partner badge replaces it once connected) */
.online-pill {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 12px; z-index: 4;
  background: rgba(10,12,18,.55); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12);
  padding: 7px 13px; border-radius: 999px; font-weight: 700; font-size: .85rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.3); color: var(--ok);
}

/* Report sheet (reuses the settings-sheet look) */
.report-sheet .btn.wide { margin-top: 8px; text-align: left; }
.report-intro { color: var(--muted); font-size: .86rem; margin: 2px 0 10px; }

/* --- extra polish --- */
.brand-dot { box-shadow: 0 0 0 5px rgba(255,77,109,.18); }
.placeholder p b { color: var(--accent-2); }
.online-pill::first-letter { font-size: 1em; }
.controls .btn.big { min-width: 120px; text-align: center; }
.msg.system { border-color: rgba(255,255,255,.08); }
.partner { animation: popin .25s ease; }
@keyframes popin { from { opacity: 0; transform: translateY(-6px); } }
.chat-input input { background: rgba(0,0,0,.6); }
.send { box-shadow: 0 6px 18px rgba(255,77,109,.35); }

/* keep the mod banner clear of the online pill (both can show when an idle user is watched) */
.mod-banner { top: calc(10px + env(safe-area-inset-top)); }
body:has(.online-pill:not(.hidden)) .mod-banner { top: calc(54px + env(safe-area-inset-top)); }

/* ---- admin v2: stat tiles, ban modal ---- */
.stat-row { max-width: 1100px; margin: 14px auto 0; padding: 0 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat-num { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; }
.stat:nth-child(1) .stat-num { color: var(--ok); }
.stat:nth-child(2) .stat-num { color: var(--accent-2); }
.stat-lbl { color: var(--muted); font-size: .8rem; margin-top: 2px; }
@media (max-width: 560px) { .stat-row { grid-template-columns: repeat(2, 1fr); } .stat-num { font-size: 1.4rem; } }

.utable .reason { font-size: .74rem; margin-top: 3px; max-width: 220px; white-space: normal; }

.ban-modal { position: fixed; z-index: 31; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.ban-reasons { display: flex; flex-wrap: wrap; gap: 8px; }
.ban-modal .btn.danger.wide { margin-top: 14px; }

/* login page: online count */
.online-note { text-align: center; color: var(--ok); font-weight: 700; font-size: .9rem; margin: -8px 0 18px; }
