* { box-sizing: border-box; }

:root {
  --bg1: #6d5efc;
  --bg2: #b06ef0;
  --bg3: #ff8ac2;
  --ink: #241f3d;
  --muted: #6f6a8d;
  --card: #ffffff;
  --line: #ece9fb;
  --accent: #ff5f9e;
  --accent2: #6d5efc;
  --ok: #22c58b;
  --danger: #ef476f;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(60, 40, 140, .16);
}

html, body { margin: 0; }

body {
  min-height: 100vh;
  font-family: 'SN Pro', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg3) 0%, transparent 55%),
    radial-gradient(900px 700px at 110% 10%, var(--bg2) 0%, transparent 50%),
    linear-gradient(160deg, #f4f0ff 0%, #eef7ff 55%, #fff2f8 100%);
  background-attachment: fixed;
}

/* ---------- фоновые эмодзи ---------- */
.bg-float { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg-float span {
  position: absolute; bottom: -60px; font-size: 34px; opacity: .35;
  animation: floatUp 16s linear infinite; animation-delay: var(--d);
}
@keyframes floatUp {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: .35; }
  100% { transform: translateY(-115vh) rotate(24deg); opacity: 0; }
}

/* ---------- шапка ---------- */
.hero { position: relative; z-index: 1; text-align: center; padding: 38px 16px 8px; }
.hero__badge {
  display: inline-block; background: rgba(255,255,255,.75); color: var(--accent2);
  font-weight: 700; font-size: 13px; padding: 6px 14px; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(60,40,140,.12);
}
.hero__title { margin: 14px 0 6px; font-size: clamp(30px, 6vw, 52px); font-weight: 800; letter-spacing: -1px; }
.hero__title span {
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__lead { margin: 0 auto; max-width: 560px; color: var(--muted); font-size: clamp(14px, 2.4vw, 17px); }
.stats { display: flex; gap: 12px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.stat {
  background: var(--card); border-radius: 14px; padding: 8px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-width: 96px;
}
.stat b { font-size: 22px; color: var(--accent2); }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- вкладки ---------- */
.tabs { position: relative; z-index: 1; display: flex; gap: 8px; justify-content: center; margin: 22px 16px 0; }
.tab {
  border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 15px;
  padding: 11px 22px; border-radius: 999px; background: rgba(255,255,255,.7); color: var(--muted);
  box-shadow: 0 4px 14px rgba(60,40,140,.10); transition: .18s;
}
.tab:hover { transform: translateY(-2px); color: var(--accent2); }
.tab.is-active { background: linear-gradient(90deg, var(--accent2), var(--accent)); color: #fff; }
.badge {
  background: #fff; color: var(--accent); border-radius: 999px; font-size: 12px;
  padding: 1px 8px; margin-left: 4px;
}

/* ---------- сетка ---------- */
.wrap { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }
.panel { display: none; }
.panel.is-active { display: block; animation: pop .25s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.layout { display: grid; grid-template-columns: 350px 1fr; gap: 20px; align-items: start; }
.col-side { position: sticky; top: 14px; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 19px; }

/* ---------- формы ---------- */
.field { display: block; margin-bottom: 13px; }
.field > span { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="url"], textarea, select {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  background: #f8f7ff; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px;
  outline: none; transition: .15s;
}
textarea { resize: vertical; min-height: 66px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent2); background: #fff; }
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; line-height: 1.45; }

.btn-primary {
  width: 100%; border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 16px;
  color: #fff; padding: 12px; border-radius: 12px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  box-shadow: 0 8px 20px rgba(255, 95, 158, .35); transition: .15s;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: wait; transform: none; }

.btn-ghost {
  border: 2px solid var(--line); background: #fff; cursor: pointer; font: inherit;
  font-weight: 700; font-size: 13.5px; color: var(--accent2);
  padding: 8px 12px; border-radius: 10px; transition: .15s;
}
.btn-ghost:hover { border-color: var(--accent2); background: #f4f1ff; }
.btn-danger {
  border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 15px;
  color: #fff; background: var(--danger); padding: 10px 20px; border-radius: 10px;
}
.btn-danger:hover { filter: brightness(1.08); }

/* ---------- настроения ---------- */
.moods { display: flex; flex-wrap: wrap; gap: 6px; }
.mood-btn {
  border: 2px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer;
  font-size: 20px; padding: 5px 8px; line-height: 1; transition: .15s; position: relative;
}
.mood-btn:hover { transform: scale(1.12); }
.mood-btn.is-active { border-color: var(--accent); background: #ffeef6; box-shadow: 0 4px 12px rgba(255,95,158,.3); }
.mood-btn small {
  position: absolute; left: 50%; top: 105%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 6px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: .15s;
}
.mood-btn:hover small { opacity: 1; }

/* ---------- вложения ---------- */
.attach__row { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.attach__preview {
  position: relative; width: fit-content; margin-bottom: 8px;
  border: 2px dashed var(--line); border-radius: 12px; padding: 5px; background: #f8f7ff;
}
.attach__preview img { display: block; max-width: 190px; max-height: 130px; border-radius: 8px; }
.attach__drop {
  position: absolute; top: -9px; right: -9px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: var(--danger); color: #fff; cursor: pointer; font-size: 12px; line-height: 1;
}
.url-input { font-size: 13.5px; }

/* ---------- лента ---------- */
.feed-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.feed-head h2 { margin: 0; font-size: 19px; }
.whoami { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.whoami select { width: auto; min-width: 140px; padding: 7px 10px; font-size: 14px; }

.feed { display: flex; flex-direction: column; gap: 14px; }
.empty {
  background: var(--card); border-radius: var(--radius); padding: 26px; text-align: center;
  color: var(--muted); box-shadow: var(--shadow); font-size: 15px;
}

.msg {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; position: relative; animation: pop .22s ease;
}
.msg--dm { border-left: 5px solid var(--accent2); }
.msg--dm.msg--out { border-left-color: var(--accent); }
.msg__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
}
.msg__who { display: flex; flex-direction: column; min-width: 0; }
.msg__name { font-weight: 800; font-size: 15px; }
.msg__time { font-size: 12px; color: var(--muted); }
.msg__mood {
  margin-left: auto; font-size: 26px; line-height: 1;
  animation: moodIn .4s cubic-bezier(.2,1.6,.4,1);
}
@keyframes moodIn { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
.msg__text { margin: 0; font-size: 15.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.msg__img { margin-top: 10px; max-width: 100%; border-radius: 12px; display: block; max-height: 320px; }
.msg__img--broken {
  display: inline-block; background: #f4f2ff; color: var(--muted); font-size: 13px;
  padding: 8px 12px; border-radius: 10px;
}
.msg__to { font-size: 13px; color: var(--accent2); font-weight: 700; margin-bottom: 4px; }

.msg__actions { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.act {
  border: 0; background: #f4f2ff; color: var(--accent2); cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 700; padding: 6px 11px; border-radius: 999px; transition: .15s;
}
.act:hover { background: var(--accent2); color: #fff; }
.act--del { background: #ffeff3; color: var(--danger); }
.act--del:hover { background: var(--danger); color: #fff; }

/* ---------- ответы ---------- */
.replies { margin: 12px 0 0 14px; padding-left: 14px; border-left: 3px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.reply { background: #fbfaff; border-radius: 12px; padding: 10px 12px; animation: pop .2s ease; }
.reply .msg__avatar { width: 30px; height: 30px; font-size: 14px; }
.reply__head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.reply__text { margin: 0; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.reply__mood { font-size: 19px; margin-left: auto; }
.reply-form { display: flex; flex-direction: column; gap: 8px; background: #fbfaff; border-radius: 12px; padding: 10px 12px; }
.reply-form textarea { min-height: 52px; font-size: 14.5px; }
.reply-form .row { display: flex; gap: 8px; flex-wrap: wrap; }
.reply-form .row input { flex: 1 1 130px; }
.reply-form .mood-btn { font-size: 17px; }
.reply-form__actions { display: flex; gap: 8px; }
.reply-form__actions .btn-primary { width: auto; padding: 9px 16px; font-size: 14px; }

/* ---------- модалка ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(36, 31, 61, .55); backdrop-filter: blur(3px); padding: 16px;
}
.modal[hidden] { display: none; }
.modal__box {
  background: #fff; border-radius: 18px; padding: 22px; width: min(400px, 100%);
  box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .2s ease;
}
.modal__box h3 { margin: 0 0 6px; font-size: 19px; }
.modal__box p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.modal__err { color: var(--danger) !important; font-weight: 700; margin: 8px 0 0 !important; }

/* ---------- тосты ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; font-size: 14.5px; font-weight: 600;
  padding: 11px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.3);
  animation: toastIn .25s cubic-bezier(.2,1.4,.4,1);
}
.toast--ok { background: var(--ok); }
.toast--err { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 0 16px 26px; position: relative; z-index: 1; }

/* ---------- адаптив ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .col-side { position: static; }
  .msg__mood { font-size: 22px; }
}

/* ---------- совместимость с классами wall.js / dm.js ---------- */
.mood {
  border: 2px solid var(--line); background: #fff; cursor: pointer;
  font-size: 21px; line-height: 1; padding: 7px 9px; border-radius: 12px;
  transition: .15s; position: relative;
}
.mood:hover { transform: scale(1.14) rotate(-4deg); border-color: var(--accent2); }
.mood.is-on {
  border-color: var(--accent); background: #ffeef6;
  box-shadow: 0 5px 14px rgba(255,95,158,.32); transform: translateY(-2px);
}
.moods--mini .mood { font-size: 17px; padding: 5px 7px; }

.avatar--sm { width: 38px; height: 38px; font-size: 16px; }
.avatar--xs { width: 28px; height: 28px; font-size: 13px; }

.msg__meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.msg__author { display: flex; align-items: baseline; gap: 8px; font-weight: 800; font-size: 15px; }
.msg__del {
  margin-left: auto; border: 0; background: transparent; cursor: pointer;
  font-size: 16px; opacity: .45; transition: .15s; padding: 5px; border-radius: 8px;
}
.msg__del:hover { opacity: 1; background: #ffeff3; transform: scale(1.15); }
.msg__count { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.msg__actions .btn-ghost { font-size: 13px; padding: 6px 12px; }

.attach { display: flex; flex-direction: column; gap: 8px; margin-bottom: 13px; }

.reply-form__row { display: flex; gap: 8px; flex-wrap: wrap; }
.reply-form__row input { flex: 1 1 130px; }

.empty b { display: block; margin-top: 6px; color: var(--ink); font-size: 16px; }
.empty p { margin: 6px 0 0; font-size: 14px; }

.msg--reply { background: #fbfaff; border-left: 4px solid #e7e2ff; }
.msg--in { border-left: 5px solid var(--accent2); }
.msg--out { border-left: 5px solid var(--accent); background: #fff7fb; }

@media (max-width: 640px) {
  .msg__author { flex-wrap: wrap; gap: 4px; }
  .msg__time { font-size: 11px; }
}
