:root{
  --accent:#1877f2;

  --chat-bg: #e7ebf5;
  --chat-surface: #ffffff;
  --chat-text: #0f172a;
  --chat-muted: #64748b;
  --chat-border: rgba(15, 23, 42, 0.12);

  --shadow-Panel: 12px 12px 22px #00000035, -12px -12px 22px #f5f5f5;
  --shadow-btn-inset: -3px -3px 5px #00000025, 3px 3px 5px #f5f5f5;
  --shadow-btn: 3px 3px 5px #00000025, -3px -3px 5px #f5f5f5;

  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

body[data-theme="dark"]{
  --chat-bg: #0b1220;
  --chat-surface: #0f172a;
  --chat-text: #e5e7eb;
  --chat-muted: #94a3b8;
  --chat-border: rgba(226, 232, 240, 0.14);

  --shadow-Panel: 10px 10px 18px #000, -10px -10px 18px #ffffff10;
  --shadow-btn-inset: -3px -3px 5px #000, 3px 3px 5px #ffffff10;
  --shadow-btn: 3px 3px 5px #000000, -3px -3px 5px #ffffff10;
}

body{ margin:0; background: var(--chat-bg); color: var(--chat-text); }

.container { max-width: 1024px; margin: 0 auto; padding: 16px; }

.span-c1 { color: #8200cd }
.span-c2 { color: #3b82f6 }
.span-c3 { color: #10b981 }
.span-c4 { color: #facc15 }
.span-c5 { color: #f97316 }
.span-c6 { color: #ef4444 }

h2 {
  color: var(--accent);
  font-weight: 500;
}

.topbar { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom: 16px; }
.brand {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--accent);
  text-shadow: 0px 0px 3px #00000050;
}
.mebox { opacity: .9; font-size: 14px; }

.card{
  position: relative;
  margin-top: 1.0rem;
  background: var(--chat-bg);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow-Panel);
}

.row { display:flex; gap: 18px; flex-wrap: wrap; margin: 0; padding:10px 0; }

input, select {
  background: var(--chat-bg);
  color: var(--chat-text);
  border: 1px solid transparent;
  padding: 10px 12px;
  border-radius: 24px;
  outline: none;
  flex: 1;
  min-width: 180px;
  box-shadow: var(--shadow-btn-inset);
}

textarea {
  margin-top: 10px;
  width: 100%;
  padding: 10px 12px;
  background: var(--chat-bg);
  color: var(--chat-text);
  border: 1px solid transparent;
  border-radius: 24px;
  outline: none;
  box-shadow: var(--shadow-btn-inset);
}

.btn {
  background:var(--accent);
  border: none;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}
.btn:hover { opacity: .92; }

.btn-ghost {
  background: transparent;
  color: var(--chat-text);
  box-shadow: var(--shadow-btn);
}

.sep { border: none; border-top: 1px solid rgba(0,0,0,.15); margin: 14px 0; }
.hint { color: var(--chat-muted); font-size: 13px; }

.tabs { display:flex; gap: 1rem; margin: 12px 0; flex-wrap: wrap; }
.tab { background: transparent; border: none; box-shadow: var(--shadow-btn); color: var(--accent); padding: 8px 12px; border-radius: 999px; cursor: pointer; }
.tab.active { box-shadow: 0px 0px 8px var(--accent); }

.list { display:flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.item { box-shadow: var(--shadow-btn-inset); border-radius: 12px; padding: 12px; background: var(--chat-bg); }
.item .meta { display:flex; justify-content:space-between; font-size: 13px; color: var(--chat-muted); gap: 10px; }
.item .actions { display:flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.hidden { display: none !important; }

/* chat */
.chatbox { box-shadow: var(--shadow-btn-inset); border-radius: 12px; background: var(--chat-bg); height: 320px; overflow:auto; padding: 10px; scrollbar-width: none; }

#chatMsg{
  margin-top: 10px;
  background: var(--chat-bg);
  color: var(--chat-text);
  border: 1px solid var(--chat-border);
}

.msg { margin: 8px 0; padding: 8px 10px; border-radius: 10px; max-width: 60%; box-shadow: var(--shadow-btn); }
.msg.them{ background: #c7d3dd; color: var(--accent); }
.msg.me{ background: var(--chat-bg); color: var(--chat-text); margin-left: auto; }
.msg .time { font-size: 11px; opacity: .75; margin-top: 4px; color: var(--chat-muted); }

.chathead { display:flex; justify-content:space-between; align-items:center; margin: 6px 0 10px; }
.chatpeer { display:flex; align-items:center; gap: 10px; font-weight: 800; }
.status-dot { width: 10px; height: 10px; border-radius: 999px; display:inline-block; border: 1px solid rgba(0,0,0,.25); }
.status-dot.online { background: #22c55e; }
.status-dot.offline { background: #64748b; }
.typing { font-size: 12px; color: var(--chat-muted); }

.colorwrap{
  display:flex;
  align-items:center;
  gap:10px;
  max-width: 90px;
  padding:8px 10px;
  border-radius:999px;
  box-shadow: var(--shadow-btn);
  background:var(--chat-bg);
}
.colorwrap label{ font-size:12px; color:var(--chat-text); }

.colorwrap input[type="color"]{
  -webkit-appearance: none;
  appearance: none;
  width:15px;
  height:15px;
  border:none;
  padding:0;
  background:transparent;
  cursor:pointer;
}
.colorwrap input[type="color"]::-webkit-color-swatch-wrapper{ padding:0; width:15px; height:15px; }
.colorwrap input[type="color"]::-webkit-color-swatch{
  width:15px; height:15px; border-radius:10px;
  border:1px solid rgba(0,0,0,.12);
}

/* ---------- FB-like Composer ---------- */
.composer{
  background: var(--chat-bg);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-Panel);
}
.composer-top{ display:flex; align-items:center; gap:12px; }
.avatar{
  width:42px; height:42px; border-radius:999px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  box-shadow: var(--shadow-btn);
  flex: 0 0 auto;
}
.composer-input{
  width:100%;
  text-align:left;
  padding: 12px 14px;
  border-radius: 999px;
  background: var(--chat-surface);
  color: var(--chat-muted);
  border: 1px solid var(--chat-border);
  cursor:pointer;
}
.composer-actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top: 12px; }
.pill{
  border: 1px solid var(--chat-border);
  background: var(--chat-surface);
  color: var(--chat-text);
  padding: 8px 12px;
  border-radius: 999px;
  cursor:pointer;
  box-shadow: var(--shadow-btn);
}
.pill:hover{ opacity:.92; }

.composer-preview{
  margin-top: 12px;
  border: 1px solid var(--chat-border);
  background: var(--chat-surface);
  border-radius: 16px;
  padding: 12px;
}
.preview-line{ color: var(--chat-text); margin-bottom: 10px; }
.preview-img{
  width:100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--chat-border);
}
.preview-actions{ display:flex; justify-content:flex-end; margin-top:10px; }

/* ---------- Posts ---------- */
.post{
  background: var(--chat-surface);
  border: 1px solid var(--chat-border);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow-btn);
}
.post-head{ display:flex; justify-content:space-between; align-items:center; gap: 10px; }
.post-author{ display:flex; align-items:center; gap:10px; }
.post-author .miniava{
  width:36px; height:36px; border-radius:999px;
  background: linear-gradient(135deg, var(--accent), #22c55e);
  border: 1px solid var(--chat-border);
}
.post-name{ font-weight:900; color: var(--chat-text); }
.post-time{ font-size: 12px; color: var(--chat-muted); }
.post-text{
  margin: 10px 0;
  color: var(--chat-text);
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.post-media img{
  width:100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--chat-border);
  cursor: zoom-in;
}
.post-stats{
  display:flex; justify-content:space-between; align-items:center;
  margin-top: 10px;
  font-size: 13px;
  color: var(--chat-muted);
}
.post-actions{ display:flex; gap: 8px; margin-top: 10px; flex-wrap:wrap; }
.actionbtn{
  flex: 1 1 120px;
  display:flex; align-items:center; justify-content:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--chat-border);
  background: var(--chat-bg);
  color: var(--chat-text);
  cursor:pointer;
  box-shadow: var(--shadow-btn);
}
.actionbtn.active{
  border-color: color-mix(in srgb, var(--accent) 60%, var(--chat-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.actionbtn:hover{ opacity:.92; }

/* ---------- Drawer (Comments) ---------- */
.drawer{
  position: fixed; inset: 0;
  background: rgba(2,6,23,.55);
  display:flex; align-items:flex-end; justify-content:center;
  padding: 16px;
  z-index: 9999;
}
.drawer-inner{
  width:min(720px, 100%);
  max-height: 82vh;
  background: var(--chat-surface);
  border: 1px solid var(--chat-border);
  border-radius: 18px;
  box-shadow: var(--shadow-Panel);
  display:flex; flex-direction:column;
}
.drawer-head{
  padding: 12px 12px 10px;
  display:flex; align-items:center; justify-content:space-between;
  border-bottom: 1px solid var(--chat-border);
}
.drawer-title{ font-weight: 900; color: var(--chat-text); }
.iconbtn{
  border:none; background:transparent; color: var(--chat-text);
  font-size: 18px; cursor:pointer; padding: 6px 10px;
  border-radius: 10px;
}
.drawer-meta{ padding: 10px 12px; font-size: 13px; color: var(--chat-muted); }
.drawer-list{ padding: 0 12px 12px; overflow:auto; }
.comment{
  border: 1px solid var(--chat-border);
  background: var(--chat-bg);
  border-radius: 14px;
  padding: 10px;
  margin-top: 10px;
}
.comment .c-head{
  display:flex; justify-content:space-between; gap:10px;
  font-size: 12px; color: var(--chat-muted);
}
.comment .c-body{ margin-top: 6px; color: var(--chat-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.drawer-input{ padding: 12px; border-top: 1px solid var(--chat-border); display:flex; gap:10px; }

/* ---------- Lightbox ---------- */
.lightbox{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.78);
  display:flex; align-items:center; justify-content:center;
  z-index: 10000;
  padding: 18px;
}
.lightbox img{
  max-width: min(1100px, 96vw);
  max-height: 86vh;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.18);
}
.lightbox-close{
  position: fixed;
  top: 18px; right: 18px;
  width: 44px; height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.12);
  color:#fff;
  cursor:pointer;
}

/* ---------- Toast ---------- */
.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15,23,42,.92);
  color: #fff;
  border: 1px solid rgba(255,255,255,.15);
  z-index: 10001;
  max-width: min(720px, 92vw);
}

/* ---------- Skeleton ---------- */
.skeleton{
  height: 170px;
  position: relative;
  overflow: hidden;
}
.skeleton::before{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--chat-bg) 85%, transparent),
    color-mix(in srgb, var(--chat-surface) 85%, transparent),
    color-mix(in srgb, var(--chat-bg) 85%, transparent)
  );
  animation: shimmer 1.15s infinite linear;
}
@keyframes shimmer{
  0%{ transform: translateX(-35%); }
  100%{ transform: translateX(35%); }
}
