* { box-sizing: border-box; }

:root {
  --bg: #14161f;
  --surface: #1c1f2b;
  --surface-2: #242838;
  --line: #2e3346;
  --text: #e9ebf3;
  --muted: #9aa1b8;
  --accent: #7c5cff;
  --accent-2: #35e0c2;
  --danger: #ff6b8b;
  --radius: 14px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 15% -10%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(800px 400px at 95% 0%, rgba(53, 224, 194, 0.12), transparent 55%),
    var(--bg);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(20, 22, 31, 0.82);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__logo {
  font-size: 26px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
}
.brand__text strong { display: block; font-size: 17px; }
.brand__text small { color: var(--muted); font-size: 12px; }

.me { display: flex; align-items: center; gap: 10px; }
.me__avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  color: #14161f;
  background: var(--accent);
}
.me__info { text-align: right; line-height: 1.15; }
.me__info strong { display: block; font-size: 14px; }
.me__info small { color: var(--muted); font-size: 12px; }

/* ---------- layout ---------- */
.layout {
  max-width: 1160px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card h3 {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 900px) {
  .sidebar { order: 2; }
  .feed { order: 1; }
}

/* ---------- profile ---------- */
.card--profile label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.card--profile input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
}
.card--profile input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.colors { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.color-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}
.color-dot:hover { transform: scale(1.15); }
.color-dot.active { border-color: #fff; transform: scale(1.1); }

/* ---------- sections ---------- */
.card--sections ul { list-style: none; margin: 0; padding: 0; }
.card--sections li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s;
}
.card--sections li:hover { background: var(--surface-2); }
.card--sections li.active {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.3), rgba(124, 92, 255, 0.08));
  font-weight: 600;
}
.card--sections .count {
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--muted);
}

/* ---------- stats ---------- */
.stat {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.stat:last-child { border-bottom: none; }
.stat span { color: var(--muted); }
.stat strong { color: var(--accent-2); }

/* ---------- feed ---------- */
.feed__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.feed__head h2 { margin: 0; font-size: 22px; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, filter 0.12s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:active { transform: translateY(0); }
.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #5a8bff);
  box-shadow: 0 6px 18px rgba(124, 92, 255, 0.35);
}
.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 7px 11px;
}
.btn--like {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
}
.btn--like.liked { background: rgba(255, 107, 139, 0.18); border-color: var(--danger); color: var(--danger); }

/* ---------- composer ---------- */
.composer { margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.composer__row { display: flex; gap: 10px; flex-wrap: wrap; }
.composer select, .composer input, .composer textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
.composer select { min-width: 170px; }
.composer input { flex: 1; min-width: 200px; }
.composer textarea { resize: vertical; min-height: 76px; }
.composer select:focus, .composer input:focus, .composer textarea:focus {
  outline: 2px solid var(--accent); border-color: transparent;
}
.composer__foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hint { font-size: 12px; color: var(--muted); }

/* ---------- posts ---------- */
.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  animation: pop 0.25s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.post__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  color: #14161f;
  flex-shrink: 0;
}
.post__who { line-height: 1.2; }
.post__who strong { font-size: 14px; }
.post__who small { display: block; color: var(--muted); font-size: 12px; }
.post__section {
  margin-left: auto;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(53, 224, 194, 0.12);
  border: 1px solid rgba(53, 224, 194, 0.35);
  color: var(--accent-2);
  white-space: nowrap;
}
.post h4 { margin: 0 0 6px; font-size: 17px; }
.post p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.55; color: #d5d9e6; white-space: pre-wrap; }
.post__actions { display: flex; gap: 10px; align-items: center; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 14px;
}

/* ---------- chat ---------- */
.chat { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.chat__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.chat__head h2 { margin: 0; font-size: 20px; }
.btn--sm { padding: 7px 12px; font-size: 13px; }
.chat__body { display: grid; grid-template-columns: 240px 1fr; gap: 14px; min-height: 320px; }
@media (max-width: 760px) { .chat__body { grid-template-columns: 1fr; } }
.chat__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; }
.chat__list li {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-radius: 9px; cursor: pointer;
  background: var(--surface-2); border: 1px solid transparent;
  font-size: 14px; transition: border-color 0.15s, background 0.15s;
}
.chat__list li:hover { border-color: var(--line); }
.chat__list li.active { border-color: var(--accent); background: rgba(124, 92, 255, 0.15); font-weight: 600; }
.chat__dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.chat__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat__room { display: flex; flex-direction: column; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.chat__roomhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 15px; }
.chat__error { padding: 8px 14px; color: var(--danger); background: rgba(255, 107, 139, 0.1); border-bottom: 1px solid rgba(255, 107, 139, 0.3); font-size: 13px; }
.chat__messages { flex: 1; padding: 14px; overflow-y: auto; max-height: 380px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 9px; align-items: flex-start; }
.msg--mine { flex-direction: row-reverse; }
.msg__avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #14161f; flex-shrink: 0; font-size: 13px; }
.msg__bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; max-width: 75%; }
.msg--mine .msg__bubble { background: rgba(124, 92, 255, 0.22); border-color: rgba(124, 92, 255, 0.5); }
.msg__meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.msg__meta strong { color: var(--accent-2); }
.msg__text { font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.chat__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat__form input { flex: 1; background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.chat__form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.chat__setup { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 12px; background: var(--surface-2); border: 1px dashed var(--accent); border-radius: 10px; }
.chat__setup input { flex: 1; min-width: 200px; background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 14px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(8, 9, 14, 0.7); backdrop-filter: blur(3px); }
.modal__dialog {
  position: relative;
  width: min(640px, calc(100vw - 32px));
  max-height: 85vh;
  overflow: auto;
  padding: 24px;
  animation: pop 0.2s ease;
}
.modal__close {
  position: absolute;
  top: 12px; right: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
}

.comments { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.comment {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
}
.comment__avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: #14161f;
  flex-shrink: 0;
}
.comment small { color: var(--muted); display: block; font-size: 11.5px; }
.comment-form { display: flex; gap: 8px; margin-top: 12px; }
.comment-form input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}
.comment-form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
