/* ===== Sex.dk Live – deler farver med sex.dk ===== */
:root {
  --bg: #0f0f12;
  --surface: #17171c;
  --surface-2: #1f1f26;
  --border: #2a2a33;
  --text: #f2eef5;
  --muted: #9a94a6;
  --magenta: #d63384;
  --purple: #6f42c1;
  --pink: #e685b5;
  --danger: #ff4d6d;
  --ok: #3ddc97;
  --grad: linear-gradient(135deg, var(--magenta), var(--purple));
  --radius: 14px;
  --blur: 25px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--pink); }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Knapper ---------- */
.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  transition: transform .12s, filter .2s, background .2s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 24px -8px rgba(214, 51, 132, .7); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.big { width: 100%; padding: 15px; font-size: 17px; }
#btn-enter:not(.ready) { opacity: .55; box-shadow: none; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(15, 15, 18, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; font-size: 22px; color: var(--text); text-decoration: none; letter-spacing: -.5px; }
.brand span { color: var(--magenta); }
.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(214, 51, 132, .15); color: var(--pink);
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 1px;
}
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--magenta); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.online { color: var(--muted); font-size: 13px; }
.topbar-room { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar-room strong { color: var(--pink); }

/* ---------- Switch ---------- */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch.block { display: flex; margin: 18px 0 8px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .slider { width: 38px; height: 22px; border-radius: 999px; background: var(--border); position: relative; flex: none; transition: background .2s; }
.switch .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .slider { background: var(--grad); }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--pink); outline-offset: 2px; }
.switch-text { font-size: 14px; }
.switch-text small { color: var(--muted); }

/* ---------- Velkomst ---------- */
.screen { flex: 1; min-width: 0; }
/* I lobbyen fylder appen præcis skærmen; kun chatten scroller */
body:has(#screen-lobby:not(.hidden)) { height: 100vh; height: 100dvh; overflow: hidden; }
.welcome {
  display: grid; place-items: center; padding: 32px 16px;
  background:
    radial-gradient(600px 400px at 15% 10%, rgba(214, 51, 132, .18), transparent 70%),
    radial-gradient(600px 400px at 85% 90%, rgba(111, 66, 193, .2), transparent 70%);
}
.welcome-card {
  width: 100%; max-width: 520px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; padding: 30px 26px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
}
.welcome-card h1 { margin: 0 0 6px; font-size: 28px; line-height: 1.2; }
.welcome-card h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); margin: 0 0 22px; }
.field { margin-bottom: 18px; }
.field-label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.error { color: var(--danger); min-height: 1.2em; font-size: 14px; margin: 10px 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.stack { flex-direction: column; }
.chip {
  flex: 1 1 auto; min-width: 110px;
  border: 1px solid var(--border); background: var(--surface-2);
  padding: 11px 14px; border-radius: 12px; font-weight: 600; text-align: center;
  transition: border-color .15s, background .15s;
}
.chip:hover { border-color: var(--pink); }
.chip.active { background: rgba(214, 51, 132, .16); border-color: var(--magenta); color: #fff; box-shadow: inset 0 0 0 1px var(--magenta); }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 6px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--magenta); flex: none; margin-top: 1px; }

.rules { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-top: 10px; }
.rules summary { cursor: pointer; color: var(--pink); font-weight: 600; }
.rules ul { margin: 10px 0 2px; padding-left: 18px; color: var(--muted); }
.rules li { margin-bottom: 4px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 26px 0 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-buttons { display: grid; gap: 8px; }
.login-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); text-decoration: none; color: var(--text); font-weight: 600;
}
.login-btn:hover { border-color: var(--pink); }
.login-btn b { width: 20px; text-align: center; }
.email-login { display: flex; gap: 8px; margin-top: 8px; }
.email-login input, .composer input, textarea {
  flex: 1; min-width: 0;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 11px 14px; font: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--magenta); box-shadow: 0 0 0 3px rgba(214, 51, 132, .2); }

/* ---------- Lobby ---------- */
.lobby { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 0; }
.members { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.members-head { display: flex; justify-content: space-between; padding: 14px 16px; font-weight: 700; border-bottom: 1px solid var(--border); }
.members-head .count { color: var(--pink); }
.member-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.member {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 12px; border: 0; background: none; text-align: left;
}
.member:hover, .member:focus-visible { background: var(--surface-2); outline: none; }
.member.me { opacity: .75; cursor: default; }
.member.blocked { opacity: .35; }
.member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.member-tags { display: flex; gap: 4px; font-size: 12px; color: var(--muted); }
.tag-calls { color: var(--ok); }
.members-foot { color: var(--muted); font-size: 12px; padding: 10px 16px; margin: 0; border-top: 1px solid var(--border); }

.moodie {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 19px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .06);
}

.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.members-toggle { display: none; }

/* Faner: rummet + private samtaler */
.tabs { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs-dm { display: contents; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  border: 1px solid var(--border); background: transparent;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted);
  max-width: 220px;
}
.tab .moodie { width: 20px; height: 20px; font-size: 11px; }
.tab .tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab:hover { border-color: var(--pink); color: var(--text); }
.tab.active { background: rgba(214, 51, 132, .16); border-color: var(--magenta); color: #fff; }
.tab.closed { opacity: .5; }
.tab .badge { background: var(--magenta); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; min-width: 18px; text-align: center; }
.tab .badge:empty { display: none; }
.tab.unread:not(.active) { color: var(--text); border-color: var(--pink); }

.dm-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.dm-who { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.dm-who .moodie { width: 26px; height: 26px; font-size: 14px; }
.dm-note { color: var(--muted); font-size: 12px; }
.dm-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.threads { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.threads .messages { flex: 1; }
.composer input:disabled { opacity: .5; }

/* Anmodninger om privat chat */
.requests { position: fixed; z-index: 70; right: 16px; top: 70px; display: grid; gap: 10px; width: min(92vw, 340px); }
.request {
  background: var(--surface-2); border: 1px solid var(--magenta); border-radius: 16px; padding: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .6); animation: up .25s ease;
  display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center;
}
.request p { margin: 0; font-size: 14px; }
.request p strong { color: var(--pink); }
.request .modal-actions { grid-column: 1 / -1; margin: 0; justify-content: flex-end; }
.messages { list-style: none; margin: 0; padding: 18px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 720px; }
.msg .moodie { width: 30px; height: 30px; font-size: 16px; }
.bubble { background: var(--surface-2); border: 1px solid var(--border); padding: 8px 12px; border-radius: 4px 14px 14px 14px; word-wrap: break-word; overflow-wrap: anywhere; }
.bubble .who { font-size: 12px; font-weight: 700; color: var(--pink); display: block; margin-bottom: 2px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.mine .bubble { background: rgba(214, 51, 132, .14); border-color: rgba(214, 51, 132, .35); border-radius: 14px 4px 14px 14px; }
.msg.system { align-self: center; color: var(--muted); font-size: 13px; text-align: center; }
.msg.system.warn { color: #ffb4c4; }

.composer { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface); align-items: center; }
.me-avatar .moodie { width: 34px; height: 34px; }

/* ---------- Popover / modaler ---------- */
.popover {
  position: fixed; z-index: 50; min-width: 230px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
  padding: 6px; box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .8);
}
.popover-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; font-weight: 700; }
.popover button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 10px; }
.popover button:hover { background: rgba(214, 51, 132, .12); }
.popover button:disabled { opacity: .4; cursor: not-allowed; }
.popover .danger { color: var(--danger); }

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(5, 5, 8, .75); backdrop-filter: blur(6px); padding: 16px; }
.modal-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 26px; text-align: center; }
.modal-card h2 { margin: 12px 0 6px; font-size: 20px; }
.modal-card textarea { width: 100%; margin-top: 12px; min-height: 70px; resize: vertical; }
.modal-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.ring-avatar { display: inline-grid; }
.ring-avatar .moodie { width: 72px; height: 72px; font-size: 38px; }
.pulse .moodie { animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(214, 51, 132, .6); } 100% { box-shadow: 0 0 0 22px rgba(214, 51, 132, 0); } }
.ring-bar { height: 4px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 14px; }
.ring-bar i { display: block; height: 100%; background: var(--grad); width: 100%; }

/* ---------- Privat opkald ---------- */
.call {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  display: grid; grid-template-columns: 1fr 320px; grid-template-rows: 1fr auto;
}
.call-stage { position: relative; padding: 14px; min-height: 0; }
.video-tile { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.video-tile video { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .6s ease; }
.video-tile.remote { height: 100%; }
.video-tile.remote video { filter: blur(var(--remote-blur, 25px)); transform: scale(1.06); }
.video-tile.local { position: absolute; right: 28px; bottom: 28px; width: 200px; aspect-ratio: 3/4; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
.video-tile.local video { filter: blur(var(--local-blur, 25px)); transform: scaleX(-1) scale(1.06); }
.tile-overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; background: radial-gradient(circle, rgba(111, 66, 193, .25), rgba(15, 15, 18, .95)); color: var(--muted); font-size: 14px; text-align: center; padding: 10px; }
.tile-label { position: absolute; left: 12px; top: 12px; background: rgba(0, 0, 0, .55); padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.blur-ctrl {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: rgba(15, 15, 18, .8); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; font-size: 13px;
}
.blur-ctrl input[type=range] { accent-color: var(--magenta); width: 120px; }

.call-chat { border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.call-toolbar { grid-column: 1 / -1; display: flex; justify-content: center; gap: 14px; padding: 14px; border-top: 1px solid var(--border); background: var(--surface); }
.round { width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); font-size: 20px; }
.round.off { background: #3a1d28; border-color: var(--danger); }
.round.on { background: rgba(214, 51, 132, .25); border-color: var(--magenta); }
.round.danger { background: var(--danger); border-color: transparent; color: #fff; }
.round.big { width: 64px; height: 64px; font-size: 24px; }
.call-toolbar { align-items: center; flex-wrap: wrap; }
.quality-btn { white-space: nowrap; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 80; left: 50%; bottom: 90px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--magenta); padding: 12px 14px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); animation: up .25s ease; }
.toast.warn { border-left-color: var(--danger); }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Mobil ---------- */
@media (max-width: 820px) {
  .lobby { grid-template-columns: minmax(0, 1fr); }
  .topbar { gap: 8px; padding: 8px 12px; }
  .online { display: none; }
  .topbar-room { gap: 8px; }
  .topbar-room strong { font-size: 13px; }
  .members { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: 86vw; max-width: 320px; transform: translateX(-100%); transition: transform .25s; box-shadow: 20px 0 50px rgba(0, 0, 0, .6); }
  .members.open { transform: none; }
  .members-toggle { display: inline-block; flex: none; margin-left: auto; background: var(--surface-2); }
  .dm-note { display: none; }
  .requests { top: auto; bottom: 150px; right: 50%; transform: translateX(50%); }
  .topbar-room .switch-text { display: none; }
  .call { grid-template-columns: 1fr; grid-template-rows: 1fr 180px auto; }
  .call-chat { border-left: 0; border-top: 1px solid var(--border); }
  .video-tile.local { width: 110px; right: 22px; bottom: 76px; }
  .blur-ctrl input[type=range] { width: 80px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
