/* BackDoor (michaeljacobs.art) — Facebook-style social app
   Palette and proportions deliberately mirror the familiar layout: blue top bar, grey canvas,
   white rounded cards, three-column desktop that collapses to one column on phones. */

:root {
  --blue: #1877f2;
  --blue-dark: #166fe5;
  --green: #42b72a;
  --green-dark: #36a420;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #050505;
  --muted: #65676b;
  --line: #ced0d4;
  --hover: #f2f2f2;
  --danger: #e41e3f;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.2);
  --nav-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.34;
}
a { color: var(--blue); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.fineprint { font-size: 12px; color: var(--muted); margin: 8px 0 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- Buttons ---------- */
.btn {
  border: 0; border-radius: 6px; padding: 10px 16px; font-weight: 600; font-size: 15px;
  color: var(--text); background: #e4e6eb; transition: background .1s;
}
.btn:hover { background: #d8dadf; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; display: block; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.icon-btn {
  border: 0; background: #e4e6eb; width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.icon-btn:hover { background: #d8dadf; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------- Auth page ---------- */
.auth-body { display: flex; align-items: center; min-height: 100vh; }
.auth-wrap {
  width: min(980px, 100%); margin: 0 auto; padding: 24px 16px;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center;
}
.brand { color: var(--blue); font-size: 44px; margin: 0 0 8px; letter-spacing: -1px; }
.auth-hero p { font-size: 24px; margin: 0; }
.auth-card { padding: 16px; }
.auth-card input, .modal input, .modal textarea, .composer textarea, .chat-input input, .comment-input input, .search input {
  width: 100%; padding: 14px 16px; border: 1px solid #dddfe2; border-radius: 6px; margin-bottom: 12px; font-size: 16px;
}
.auth-card input:focus, .modal input:focus { outline: 2px solid var(--blue); border-color: transparent; }
.auth-msg { margin: 8px 0 0; min-height: 18px; font-size: 14px; text-align: center; }
.auth-msg.err { color: var(--danger); }
.auth-msg.ok { color: var(--green-dark); }
@media (max-width: 800px) {
  .auth-wrap { grid-template-columns: 1fr; text-align: center; }
  .brand { font-size: 36px; }
  .auth-hero p { font-size: 18px; }
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(255,255,255,.8); display: flex; align-items: center;
  justify-content: center; z-index: 100; padding: 16px;
}
.modal { width: min(440px, 100%); padding: 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); margin-bottom: 12px; padding-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 26px; }
.modal-head p { margin: 2px 0 0; }

/* ---------- Top nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h); background: var(--card);
  box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 16px; gap: 8px;
}
.topnav .logo {
  width: 40px; height: 40px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; font-size: 22px; flex: none;
}
.nav-left { display: flex; align-items: center; gap: 8px; }
.search { display: flex; align-items: center; }
.search input { margin: 0; border-radius: 999px; background: var(--bg); border: 0; padding: 10px 16px; width: 240px; font-size: 15px; }
.nav-center { display: flex; gap: 8px; }
.nav-tab {
  border: 0; background: transparent; padding: 0 28px; height: var(--nav-h); font-size: 22px; border-radius: 8px;
  border-bottom: 3px solid transparent; color: var(--muted); position: relative;
}
.nav-tab:hover { background: var(--hover); }
.nav-tab.active { color: var(--blue); border-bottom-color: var(--blue); border-radius: 0; }
.nav-tab .badge {
  position: absolute; top: 8px; right: 18px; background: var(--danger); color: #fff; font-size: 11px;
  font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px; padding: 0 5px; display: none; align-items: center; justify-content: center;
}
.nav-tab .badge.on { display: inline-flex; }
.nav-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.me-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: transparent; border: 0; }
.me-chip:hover { background: var(--hover); }
.me-chip span { font-weight: 600; }

/* ---------- Avatars ---------- */
.avatar { border-radius: 50%; object-fit: cover; background: #ddd; flex: none; }
.avatar-32 { width: 32px; height: 32px; }
.avatar-40 { width: 40px; height: 40px; }
.avatar-168 { width: 168px; height: 168px; border: 4px solid var(--card); }

/* ---------- Layout ---------- */
.layout {
  display: grid; grid-template-columns: 300px minmax(0, 680px) 300px; justify-content: center; gap: 24px;
  padding: 16px; max-width: 1400px; margin: 0 auto;
}
.sidebar { position: sticky; top: calc(var(--nav-h) + 16px); align-self: start; }
.side-item {
  display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; width: 100%;
  border: 0; background: transparent; text-align: left; font-weight: 500; font-size: 15px; color: var(--text);
}
.side-item:hover { background: var(--hover); }
.side-item .ico { font-size: 22px; width: 36px; text-align: center; }
.side-title { font-weight: 600; color: var(--muted); font-size: 17px; margin: 8px 8px 4px; display: flex; justify-content: space-between; align-items: center; }
.contact { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.contact:hover { background: var(--hover); }
.contact .name { flex: 1; font-weight: 500; }
.contact .actions { display: flex; gap: 4px; }
.contact .icon-btn { width: 32px; height: 32px; font-size: 15px; }
.online-dot { width: 10px; height: 10px; background: var(--green); border-radius: 50%; border: 2px solid var(--card); margin-left: -14px; margin-top: 22px; }
@media (max-width: 1100px) { .layout { grid-template-columns: minmax(0, 680px) 300px; } .sidebar-left { display: none; } }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; padding: 8px; } .sidebar { display: none; } .search input { width: 140px; } .nav-tab { padding: 0 16px; } .nav-center { display: none; } .mobile-tabs { display: flex !important; } }

/* Mobile bottom tabs */
.mobile-tabs {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); box-shadow: 0 -1px 2px rgba(0,0,0,.15);
  justify-content: space-around; z-index: 40;
}
.mobile-tabs .nav-tab { height: 52px; padding: 0 12px; }
@media (max-width: 760px) { body { padding-bottom: 56px; } }

/* ---------- Composer ---------- */
.composer { padding: 12px 16px; margin-bottom: 16px; }
.composer-top { display: flex; gap: 8px; align-items: flex-start; }
.composer textarea {
  flex: 1; resize: none; border: 0; background: var(--bg); border-radius: 20px; padding: 10px 14px; margin: 0; min-height: 40px; font-size: 17px;
}
.composer-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.composer-actions .spacer { flex: 1; }
.file-label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 6px; font-weight: 600; color: var(--muted); cursor: pointer; }
.file-label:hover { background: var(--hover); }
.file-label input { display: none; }
.composer-preview { margin-top: 8px; }
.composer-preview img, .composer-preview video { max-width: 100%; border-radius: 8px; max-height: 320px; }

/* ---------- Posts ---------- */
.post { margin-bottom: 16px; }
.post-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px 0; }
.post-head .who { flex: 1; }
.post-head .who b { display: block; }
.post-head .who small { color: var(--muted); }
.post-head .who a { color: var(--text); }
.post-head .who a:hover { text-decoration: underline; }
.post-body { padding: 8px 16px; white-space: pre-wrap; word-wrap: break-word; font-size: 15px; }
.post-body.big { font-size: 24px; }
.post-media img, .post-media video { width: 100%; display: block; max-height: 600px; object-fit: contain; background: #000; }
.post-stats { display: flex; justify-content: space-between; padding: 8px 16px; color: var(--muted); font-size: 15px; border-bottom: 1px solid var(--line); margin: 0 16px; padding-left: 0; padding-right: 0; }
.post-stats .like-pill { display: inline-flex; align-items: center; gap: 4px; }
.post-stats .like-pill i { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 11px; align-items: center; justify-content: center; font-style: normal; }
.post-actions { display: flex; padding: 4px 12px; }
.post-actions button {
  flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 6px; font-weight: 600; color: var(--muted); font-size: 15px;
}
.post-actions button:hover { background: var(--hover); }
.post-actions button.liked { color: var(--blue); }
.comments { padding: 4px 16px 12px; }
.comment { display: flex; gap: 8px; margin-top: 8px; }
.comment .bubble { background: var(--bg); border-radius: 18px; padding: 8px 12px; max-width: 100%; }
.comment .bubble b { display: block; font-size: 13px; }
.comment .bubble span { font-size: 15px; white-space: pre-wrap; }
.comment-input { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.comment-input input { margin: 0; border-radius: 20px; background: var(--bg); border: 0; padding: 8px 14px; font-size: 15px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.post-del { color: var(--muted); }

/* ---------- Profile ---------- */
.cover { height: 220px; border-radius: 0 0 8px 8px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.25)); }
.profile-head { padding: 0 16px 16px; display: flex; gap: 16px; align-items: flex-end; margin-top: -40px; flex-wrap: wrap; }
.profile-head h1 { margin: 0 0 4px; font-size: 32px; }
.profile-head .bio { color: var(--muted); margin: 0; }
.profile-head .spacer { flex: 1; }
.profile-head .actions { display: flex; gap: 8px; padding-bottom: 8px; }
.profile-wrap { max-width: 940px; margin: 0 auto; }

/* ---------- Friends ---------- */
.friends-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding: 16px; }
.friend-card { overflow: hidden; }
.friend-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.friend-card .body { padding: 10px; }
.friend-card .body b { display: block; margin-bottom: 8px; }
.friend-card .body .btn { margin-bottom: 6px; }
.section-title { font-size: 20px; font-weight: 700; padding: 16px 16px 0; }

/* ---------- Messenger ---------- */
.messenger { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - var(--nav-h) - 32px); overflow: hidden; }
.thread-list { border-right: 1px solid var(--line); overflow: auto; }
.thread-list h2 { font-size: 24px; margin: 0; padding: 16px; }
.thread { display: flex; gap: 10px; align-items: center; padding: 10px 16px; cursor: pointer; }
.thread:hover, .thread.active { background: var(--hover); }
.thread .name { font-weight: 600; }
.thread .preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .txt { min-width: 0; }
.chat { display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.chat-head .name { flex: 1; font-weight: 600; }
.chat-log { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.msg { max-width: 70%; padding: 8px 12px; border-radius: 18px; background: #e4e6eb; align-self: flex-start; white-space: pre-wrap; word-wrap: break-word; }
.msg.mine { background: var(--blue); color: #fff; align-self: flex-end; }
.msg time { display: block; font-size: 10px; opacity: .7; margin-top: 2px; }
.chat-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: center; }
.chat-input input { margin: 0; border-radius: 20px; background: var(--bg); border: 0; padding: 10px 14px; }
@media (max-width: 760px) { .messenger { grid-template-columns: 1fr; height: calc(100vh - var(--nav-h) - 72px); } .messenger.in-chat .thread-list { display: none; } .messenger:not(.in-chat) .chat { display: none; } }

/* ---------- Video call ---------- */
.call-stage { position: fixed; inset: 0; background: #111; z-index: 200; display: flex; flex-direction: column; }
.call-videos { flex: 1; position: relative; overflow: hidden; }
.call-videos video { background: #000; }
#remote-video { width: 100%; height: 100%; object-fit: cover; }
#local-video { position: absolute; right: 16px; bottom: 16px; width: 220px; max-width: 30vw; border-radius: 12px; border: 2px solid #fff; object-fit: cover; }
.call-status { position: absolute; top: 16px; left: 16px; color: #fff; background: rgba(0,0,0,.45); padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.call-bar { display: flex; justify-content: center; gap: 16px; padding: 16px; background: #1c1e21; }
.call-bar .icon-btn { width: 56px; height: 56px; font-size: 24px; background: #3a3b3c; color: #fff; }
.call-bar .icon-btn.off { background: #fff; color: #111; }
.call-bar .icon-btn.hang { background: var(--danger); }

/* ---------- Incoming call / toast ---------- */
.ring {
  position: fixed; top: 72px; right: 16px; z-index: 150; padding: 16px; width: 320px; display: flex; gap: 12px; align-items: center;
  animation: ringpulse 1.2s infinite;
}
@keyframes ringpulse { 0%,100% { box-shadow: var(--shadow); } 50% { box-shadow: 0 0 0 6px rgba(24,119,242,.25); } }
.ring .txt { flex: 1; }
.ring .txt b { display: block; }
.ring .btns { display: flex; gap: 6px; }
.toast { position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%); background: #1c1e21; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 160; font-size: 14px; }

.tagline { color: #5f6368; font-size: 17px; margin: 0 0 24px; }

/* ---------- BackDoor theme (v3): BlackHeaven palette (matches BLACKHEAVEN Gaming Hub) ---------- */
@import url("https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;700&family=IBM+Plex+Mono:wght@400;600&display=swap");
:root {
  color-scheme: dark;
  --void: #03050b;
  --panel: #0b1020;
  --line: #223056;
  --text: #e6ecfa;
  --dim: #8a97b6;
  --gold: #ffd23d;
  --orange: #ff9b3d;
  --cyan: #52d8ff;
  --blue: #52d8ff;
  --blue-dark: #3bbfe6;
  --green: #ffd23d;
  --green-dark: #e6bd2e;
  --bg: #03050b;
  --card: #0b1020;
  --muted: #8a97b6;
  --hover: #131c36;
  --danger: #ff5d6c;
  --radius: 10px;
  --shadow: 0 0 0 1px #223056, 0 12px 36px rgba(0,0,0,.45);
}
body {
  background: var(--void); color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 15px; line-height: 1.6;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(255,155,61,.14), transparent 50%),
    radial-gradient(ellipse at 90% 10%, rgba(82,216,255,.12), transparent 45%);
  background-attachment: fixed;
}
h1, h2, h3, .brand, .logo, .btn, .nav-tab, .topnav .logo, .tagline {
  font-family: "Chakra Petch", sans-serif; letter-spacing: .04em;
}
a { color: var(--cyan); }
.card, .modal, .topnav { background: var(--panel); border: 1px solid var(--line); }
.topnav { background: rgba(11,16,32,.92); backdrop-filter: blur(8px); box-shadow: none; border-bottom: 1px solid var(--line); }
/* The cut-corner shape and fill live on ::before. A clip-path on the element itself would also clip its focus outline. */
.topnav .logo {
  position: relative; isolation: isolate;
  background: none; color: #070a12; border-radius: 0; font-weight: 700;
}
.topnav .logo::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, var(--orange), var(--gold) 55%, var(--cyan));
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
.btn {
  --btn-bg: linear-gradient(90deg, var(--orange), var(--gold) 55%, var(--cyan));
  position: relative; isolation: isolate;
  color: #070a12; background: none;
  border: 0; border-radius: 0; text-transform: uppercase; font-weight: 700; letter-spacing: .04em;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--btn-bg);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
/* Beats the older .btn-*:hover backgrounds at the top of this file. */
.btn:hover, .btn:focus, .btn:active { background: none; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost, .btn-success, .btn-danger { --btn-bg: #1a2442; color: var(--text); }
.btn-primary { --btn-bg: linear-gradient(90deg, var(--orange), var(--gold) 55%, var(--cyan)); color: #070a12; }
.btn-success { --btn-bg: linear-gradient(90deg, var(--gold), var(--cyan)); color: #070a12; }
.btn-danger { --btn-bg: #5a1822; color: #ffd7dc; }
/* Outline: a gold ::before shape with the panel color laid 1.5px inside it on ::after. */
.btn-outline { --btn-bg: var(--gold); color: var(--gold); }
.btn-outline::after {
  content: ""; position: absolute; inset: 1.5px; z-index: -1;
  background: var(--panel);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

/* Keyboard focus: 2px cyan ring, 3px outside the element. */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 3px;
}
.icon-btn { background: #1a2442; color: var(--text); }
.icon-btn:hover { background: #24305a; }
input, textarea, select {
  background: var(--void) !important; color: var(--text) !important; border: 1px solid var(--line) !important;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, textarea:focus { outline: 2px solid var(--cyan); }
.search input, .chat-input input, .comment-input input, .composer textarea { background: var(--void) !important; }
.nav-tab { color: var(--dim); }
.nav-tab.active, .nav-tab:hover { color: var(--gold); }
.muted, .fineprint, .auth-msg { color: var(--dim); }
.auth-msg.err { color: var(--danger); }
.auth-msg.ok { color: var(--gold); }
hr { border-top-color: var(--line); }

/* Login page */
.auth-body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255,155,61,.18), transparent 50%),
    radial-gradient(ellipse at 90% 10%, rgba(82,216,255,.16), transparent 45%),
    var(--void);
  color: var(--text);
}
.auth-body .brand {
  font-size: clamp(44px, 7vw, 68px); font-weight: 700; line-height: 1; letter-spacing: .04em;
  background: linear-gradient(90deg, var(--orange), var(--gold) 55%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
.auth-body .tagline { color: var(--text); font-size: 20px; font-weight: 600; margin: 0 0 14px; }
.auth-hero > p:not(.tagline) { color: var(--dim); font-size: 16px; }
.auth-card {
  padding: 24px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(255,210,61,.12), 0 30px 60px rgba(0,0,0,.5);
}
.auth-card .btn { padding: 14px 16px; font-size: 15px; }
.auth-card hr { margin: 18px 0; }
.auth-card .forgot { display: block; text-align: center; font-size: 14px; padding: 12px 0; text-decoration: none; }
.auth-card .forgot:hover { text-decoration: underline; }
.modal-head h2 { color: var(--gold); }
@media (max-width: 800px) {
  .auth-body .tagline { font-size: 17px; }
}

/* ---------- Groups + Creator hub ---------- */
.stat { background: var(--void); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; min-width: 140px; }
.stat-n { font-family: "Chakra Petch", sans-serif; font-size: 28px; color: var(--gold); }
.empty { color: var(--dim); }
#view input:not([type=checkbox]) { width: 100%; padding: 12px 14px; margin-bottom: 10px; }
#view textarea { width: 100%; }
#new-group summary { color: #070a12; }

/* Footer credit */
.site-credit { text-align:center; color: var(--dim); font-size:13px; padding:18px 12px 28px; }
.site-credit b { color: var(--gold); font-weight:600; }
