/* ========== shits.ai — friendly social UI ========== */
:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-card: 12px;
  --r-ctl: 8px;
  --maxw: 1240px;
  --like: #22a565;
  --dislike: #e5484d;
  --c-green: #22a565;
  --c-red: #e5484d;
  --c-orange: #f59f00;
  --c-violet: #8657e1;
  --c-teal: #0ca678;
  --c-pink: #d6336c;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #eff2f6;
  --bg-card: #ffffff;
  --bg-elev: #f8f9fb;
  --bg-hover: #eef1f6;
  --bg-input: #eff2f6;
  --text: #14191f;
  --text-2: #676f7e;
  --text-3: #9aa2b1;
  --border: #e4e8ef;
  --border-strong: #d3d9e4;
  --accent: #0f6fec;
  --accent-hover: #0c5dc7;
  --accent-soft: #e7f0fe;
  --shadow: 0 1px 2px rgba(20, 30, 50, .05), 0 4px 14px rgba(20, 30, 50, .04);
  --topbar-bg: rgba(255, 255, 255, .92);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1117;
  --bg-card: #161b24;
  --bg-elev: #1c2230;
  --bg-hover: #212939;
  --bg-input: #1c2230;
  --text: #e7eaf1;
  --text-2: #9aa3b5;
  --text-3: #667082;
  --border: #232b3a;
  --border-strong: #303a4e;
  --accent: #4c8dff;
  --accent-hover: #6ba1ff;
  --accent-soft: #17233a;
  --shadow: none;
  --topbar-bg: rgba(14, 17, 23, .92);
}
html[data-theme="light"] .theme-icon-light { display: none; }
html[data-theme="dark"] .theme-icon-dark { display: none; }

* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font-family: var(--font); }
img, video { max-width: 100%; }
h1, h2, h3 { text-wrap: balance; }

.ic { flex: none; vertical-align: -3px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px); background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 9px 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand em { font-style: normal; color: var(--accent); }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; }
.search {
  flex: 1; max-width: 400px; display: flex; align-items: center; gap: 9px;
  background: var(--bg-input); border: 1px solid transparent; border-radius: 10px; padding: 8px 14px; color: var(--text-3);
  transition: border-color .15s, background .15s;
}
.search:focus-within { border-color: var(--accent); background: var(--bg-card); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; min-width: 0; }
.search input::placeholder { color: var(--text-3); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.icon-btn {
  border: 0; background: var(--bg-input); color: var(--text-2);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.btn {
  cursor: pointer; border-radius: var(--r-ctl); padding: 8px 16px; font-size: 14px; font-weight: 600;
  background: var(--bg-input); color: var(--text); border: 0; transition: background .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; line-height: 1.4;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover { background: var(--accent-soft); filter: brightness(.96); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { color: var(--dislike); }

#authArea { display: flex; align-items: center; gap: 9px; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 10px;
  background: var(--bg-input); color: var(--text); font-weight: 600; font-size: 13.5px; transition: background .15s;
}
.user-chip:hover { background: var(--bg-hover); text-decoration: none; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; color: #fff; background: var(--bg-elev);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13.5px; flex: none; overflow: hidden;
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- layout ---------- */
.layout {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 250px minmax(0, 1fr) 290px;
  gap: 20px; padding: 20px; align-items: start;
}
.rail { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 92px); overflow-y: auto; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.content { min-width: 0; }

.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow);
}

/* profile card */
.profile-card { overflow: hidden; text-align: center; }
.profile-card .cover { height: 70px; background: var(--bg-elev) url('/assets/cover.jpg') center/cover; }
.profile-card .avatar { width: 64px; height: 64px; font-size: 24px; margin: -32px auto 0; border: 3px solid var(--bg-card); position: relative; }
.profile-card .p-name { font-weight: 700; font-size: 16px; margin-top: 8px; }
.profile-card .p-name a { color: var(--text); }
.profile-card .p-sub { color: var(--text-3); font-size: 13px; }
.profile-card .p-bio { color: var(--text-2); font-size: 13px; padding: 6px 16px 0; }
.profile-card .p-stats {
  display: flex; justify-content: center; gap: 0; margin: 14px 0 0;
  border-top: 1px solid var(--border); padding: 12px 8px 14px;
}
.profile-card .p-stats span { flex: 1; font-size: 12.5px; color: var(--text-3); }
.profile-card .p-stats b { display: block; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.profile-card .p-cta { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.profile-card .p-welcome { padding: 14px 16px 0; font-size: 13.5px; color: var(--text-2); }
.profile-card .p-welcome b { color: var(--text); font-size: 15px; display: block; margin-bottom: 3px; }

/* side nav */
.side-nav { padding: 8px; display: flex; flex-direction: column; gap: 1px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-ctl);
  color: var(--text-2); font-weight: 600; font-size: 14px; transition: background .12s, color .12s;
}
.side-nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.side-nav a.active { color: var(--accent); background: var(--accent-soft); }
.nav-ico { display: inline-flex; }
.ni-feed { color: var(--accent); }
.ni-image { color: var(--c-green); }
.ni-video { color: var(--c-red); }
.ni-music { color: var(--c-orange); }
.ni-soft { color: var(--c-violet); }
.ni-other { color: var(--c-pink); }
.ni-groups { color: var(--c-teal); }

/* right rail */
.side-card { padding: 16px; }
.side-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.topic-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  background: var(--bg-input); padding: 5px 11px; border-radius: 999px; transition: background .12s, color .12s;
}
.chip:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.chip small { color: var(--text-3); font-weight: 500; font-size: 11px; }
.side-stats { font-size: 13.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 7px; font-variant-numeric: tabular-nums; }
.side-stats b { color: var(--text); font-weight: 700; }
.side-groups { display: flex; flex-direction: column; gap: 12px; }
.side-group { display: flex; align-items: center; gap: 10px; }
.side-group .g-ava {
  width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none;
}
.side-group .g-info { flex: 1; min-width: 0; }
.side-group .g-info a { color: var(--text); font-weight: 600; font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-group .g-info small { color: var(--text-3); font-size: 12px; }
.side-group .btn { flex: none; }
.side-more { display: block; text-align: center; margin-top: 12px; font-size: 13px; font-weight: 600; }

/* ---------- composer ---------- */
.composer { padding: 14px 16px; margin-bottom: 16px; }
.composer-row { display: flex; gap: 10px; align-items: center; }
.composer-input {
  flex: 1; text-align: left; background: var(--bg-input); border: 0; border-radius: 999px;
  color: var(--text-3); font-size: 14px; padding: 10px 16px; cursor: pointer; font-family: var(--font);
  transition: background .15s;
}
.composer-input:hover { background: var(--bg-hover); }
.composer-cats { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.composer-cat {
  display: inline-flex; align-items: center; gap: 7px; border: 0; cursor: pointer;
  background: var(--bg-elev); color: var(--text-2); font-size: 13px; font-weight: 600;
  padding: 7px 13px; border-radius: 999px; transition: background .12s, color .12s;
}
.composer-cat:hover { background: var(--bg-hover); color: var(--text); }
.composer-cat.cc-image .ic { color: var(--c-green); }
.composer-cat.cc-video .ic { color: var(--c-red); }
.composer-cat.cc-audio .ic { color: var(--c-orange); }
.composer-cat.cc-software .ic { color: var(--c-violet); }
.composer-cat.cc-other .ic { color: var(--c-pink); }

/* ---------- page head ---------- */
.page-head { margin-bottom: 16px; }
.page-head h1 { margin: 0 0 3px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.page-head h1 .ic { color: var(--text-3); }
.page-head .sub { color: var(--text-2); font-size: 14px; }
.page-head-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-head-row .spacer { flex: 1; }
.feed-tabs { display: inline-flex; gap: 2px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.feed-tabs button {
  border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px;
  padding: 5px 14px; border-radius: 999px; cursor: pointer; transition: background .12s, color .12s;
}
.feed-tabs button:hover { color: var(--text); }
.feed-tabs button.active { background: var(--accent); color: #fff; }

/* ---------- post card ---------- */
.feed { display: flex; flex-direction: column; gap: 16px; }
.post { padding: 16px 18px 8px; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.post-head .who { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.post-head .who > a { color: var(--text); font-weight: 700; font-size: 14px; line-height: 1.3; }
.post-meta { font-size: 12.5px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; line-height: 1.3; }
.post-meta a { color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; }
.post-meta a:hover { color: var(--accent); text-decoration: none; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 11px; border-radius: 999px; background: var(--bg-input); color: var(--text-2);
}
.badge.cat-image .ic { color: var(--c-green); }
.badge.cat-video .ic { color: var(--c-red); }
.badge.cat-audio .ic { color: var(--c-orange); }
.badge.cat-software .ic { color: var(--c-violet); }
.badge.cat-other .ic { color: var(--c-pink); }
.post-title { margin: 0 0 4px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; line-height: 1.35; }
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); text-decoration: none; }
.post-body { color: var(--text-2); font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: break-word; margin: 0; }
.post-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.post-media { margin: 14px 0 0; background: #0b0d12; border-radius: 10px; overflow: hidden; }
.post-media img { display: block; width: 100%; max-height: 560px; object-fit: contain; cursor: zoom-in; }
.post-media video { display: block; width: 100%; max-height: 560px; }
.post-audio { margin-top: 14px; }
.post-audio audio { width: 100%; height: 40px; }
.file-tile {
  margin-top: 14px; display: flex; align-items: center; gap: 13px; padding: 13px 15px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px;
}
.file-tile .ico { display: inline-flex; color: var(--c-violet); }
.file-tile .fname { font-weight: 600; font-size: 13.5px; word-break: break-all; }
.file-tile .fmeta { font-size: 12px; color: var(--text-3); }
.file-tile .btn { margin-left: auto; flex: none; }

/* repost */
.repost-note { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; margin-bottom: 12px; font-weight: 500; }
.repost-note a { color: var(--text-2); font-weight: 700; }
.repost-note .ic { color: var(--c-teal); }
.embedded { border: 1px solid var(--border); border-radius: 10px; padding: 13px 15px; margin-top: 12px; background: var(--bg-elev); }
.embedded .post-title { font-size: 15px; }
.embedded .post-media { margin-top: 12px; }

/* actions */
.post-actions {
  display: flex; align-items: center; gap: 4px; margin: 12px -8px 0;
  padding: 5px 8px; border-top: 1px solid var(--border);
}
.action-btn {
  display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent;
  color: var(--text-2); font-size: 13px; font-weight: 600; border-radius: var(--r-ctl);
  padding: 8px 12px; cursor: pointer; transition: background .12s, color .12s;
  font-variant-numeric: tabular-nums;
}
.action-btn:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.action-btn.voted-up { color: var(--like); }
.action-btn.voted-down { color: var(--dislike); }
.action-btn .lbl { display: inline; }
@media (max-width: 480px) { .action-btn .lbl { display: none; } }

/* ---------- comments ---------- */
.comments { margin-top: 16px; padding: 18px; }
.comments h2 { font-size: 16px; margin: 0 0 14px; font-weight: 700; }
.comment { display: flex; gap: 10px; padding: 9px 0; }
.comment .c-main { flex: 1; min-width: 0; }
.comment .c-bubble { background: var(--bg-elev); border-radius: 4px 14px 14px 14px; padding: 9px 13px; display: inline-block; max-width: 100%; }
.comment .c-head { font-size: 12.5px; color: var(--text-3); }
.comment .c-head a { color: var(--text); font-weight: 700; font-size: 13px; }
.comment .c-body { font-size: 14px; line-height: 1.55; margin: 1px 0 0; white-space: pre-wrap; overflow-wrap: break-word; }
.comment .c-actions { display: flex; gap: 2px; align-items: center; margin-top: 3px; }
.c-vote {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent;
  color: var(--text-3); cursor: pointer; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px;
  transition: background .12s, color .12s; font-variant-numeric: tabular-nums;
}
.c-vote:hover { background: var(--bg-hover); color: var(--text); }
.c-vote.voted-up { color: var(--like); } .c-vote.voted-down { color: var(--dislike); }
.replies { margin-left: 40px; }
.comment-form { display: flex; gap: 10px; margin: 8px 0; }
.comment-form textarea {
  flex: 1; resize: vertical; min-height: 42px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text); padding: 10px 14px; font-family: var(--font); font-size: 14px;
}
.comment-form textarea:focus { outline: none; border-color: var(--accent); background: var(--bg-card); }

/* ---------- forms & modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(12, 16, 24, .55); backdrop-filter: blur(4px);
  z-index: 100; display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 40px; overflow-y: auto; overscroll-behavior: contain;
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 460px; padding: 26px; animation: pop .16s ease;
}
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }
.modal h2 { margin: 0 0 18px; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-field input, .form-field textarea, .form-field select {
  width: 100%; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-input);
  color: var(--text); padding: 9px 12px; font-size: 14px; font-family: var(--font);
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
  outline: none; border-color: var(--accent); background: var(--bg-card);
}
.form-error { color: var(--dislike); font-size: 13px; margin: 6px 0; min-height: 1em; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 18px; }
.muted-link { background: none; border: 0; color: var(--text-2); cursor: pointer; font-size: 13px; padding: 0; margin-right: auto; }
.muted-link:hover { color: var(--accent); }

/* dropzone */
.dropzone {
  border: 1px dashed var(--border-strong); border-radius: var(--r-ctl); padding: 20px; text-align: center;
  color: var(--text-3); font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); color: var(--accent); }
.dropzone.has-file { border-style: solid; border-color: var(--border-strong); color: var(--text); }

/* ---------- groups ---------- */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.group-card { padding: 16px; display: flex; flex-direction: column; gap: 7px; }
.group-card h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.group-card h3 a { color: var(--text); }
.group-card p { margin: 0; color: var(--text-2); font-size: 13.5px; flex: 1; line-height: 1.5; }
.group-card .g-meta { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.group-card .btn { align-self: flex-start; margin-top: 3px; }

/* profile page */
.profile-head { display: flex; gap: 18px; align-items: center; padding: 22px; margin-bottom: 16px; }
.profile-head .avatar { width: 68px; height: 68px; font-size: 26px; }
.profile-head h1 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.profile-head .sub { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.profile-stats { display: flex; gap: 18px; margin-top: 9px; font-size: 13.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.profile-stats b { color: var(--text); font-weight: 700; }

/* ---------- misc ---------- */
.loader { text-align: center; color: var(--text-3); padding: 28px; font-size: 13.5px; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--text-3); padding: 56px 20px; font-size: 14px; }
.empty .big { color: var(--text-3); margin-bottom: 12px; opacity: .7; }

.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(8, 10, 16, .93);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 28px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }

#toastRoot { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border-strong);
  padding: 10px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600; animation: pop .18s ease;
  box-shadow: 0 6px 24px rgba(10, 15, 30, .18);
}
.toast.err { border-color: var(--dislike); color: var(--dislike); }

/* responsive */
@media (max-width: 1120px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .rail-right { display: none; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; gap: 14px; padding: 14px; }
  .rail { position: static; max-height: none; }
  .rail-left { gap: 10px; }
  #profileCard { display: none; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav a { padding: 7px 11px; }
  .search { max-width: none; }
  .brand span { display: none; }
}

/* ---------- admin ---------- */
.ni-admin { color: var(--dislike); }
.admin-table { padding: 6px 16px; overflow-x: auto; }
.admin-table table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th { text-align: left; color: var(--text-3); font-weight: 600; font-size: 12px; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table .email { color: var(--text-2); }
.admin-user { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.badge-admin { background: var(--accent-soft); color: var(--accent); margin-left: 6px; font-size: 11px; padding: 2px 8px; }
