:root {
  --red: #d83a32;
  --cream: #f3f5ec;
  --ink: #111111;
  --shadow: 6px 6px 0 var(--ink);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Закрученная карамельная спираль из референса (SVG-свирл) */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url('swirl.svg') center center / cover no-repeat;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* Заголовок — текст на равном отступе от всех рёбер (центр + одинаковый padding) */
.title-box {
  background: var(--cream);
  border: 5px solid var(--ink);
  box-shadow: var(--shadow);
  padding: 32px;
}
.title-box h1 {
  font-size: clamp(26px, 5vw, 48px);
  letter-spacing: 2px;
  line-height: 1.1;
  text-transform: uppercase;
  text-align: center;
  text-wrap: balance;
}

/* Карточки */
.card {
  background: var(--cream);
  border: 4px solid var(--ink);
  box-shadow: var(--shadow);
}
.card-head {
  background: var(--red);
  color: var(--cream);
  font-size: 15px;
  letter-spacing: 3px;
  padding: 12px 18px;
  text-transform: uppercase;
  border-bottom: 4px solid var(--ink);
}
.card-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }

.field-label {
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.input {
  font-family: inherit;
  font-size: 18px;
  font-weight: bold;
  padding: 16px;
  border: 3px solid var(--ink);
  background: #fff;
  width: 100%;
  outline: none;
}
.input:focus { box-shadow: inset 0 0 0 3px var(--red); }
.textarea { resize: vertical; min-height: 130px; }

.counter { text-align: right; font-size: 14px; opacity: .65; }

.who-row { display: flex; justify-content: space-between; align-items: center; }
.who-name {
  font-size: 22px;
  text-transform: uppercase;
  color: var(--red);
  margin-top: -6px;
}
.link-btn {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 12px; text-decoration: underline;
  letter-spacing: 1px; text-transform: uppercase;
}

.btn {
  font-family: inherit;
  font-size: 20px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--red);
  border: 3px solid var(--ink);
  padding: 16px;
  cursor: pointer;
  transition: transform .05s ease;
}
.btn:hover { background: #c22e27; }
.btn:active { transform: translate(3px, 3px); }

/* Стена */
.wall { padding: 18px; display: flex; flex-direction: column; gap: 14px; }

.message {
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 14px 16px;
}
.message .meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.message .author {
  font-size: 16px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.message .time { font-size: 12px; opacity: .6; white-space: nowrap; }
.message .body {
  font-family: Arial, sans-serif;
  font-weight: normal;
  font-size: 16px;
  line-height: 1.4;
  word-wrap: break-word;
}

/* Низ сообщения: лайк-бокал + счётчик */
.message .actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 3px solid var(--ink);
  padding: 5px 10px 5px 7px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  font-size: 15px;
  line-height: 1;
  transition: transform .06s ease, background .1s ease;
}
.like-btn:hover { background: #ffe9c2; }
.like-btn:active { transform: translateY(2px); }
.like-btn .glass { width: 22px; height: 26px; display: block; }
.like-btn .count { min-width: 10px; }
/* Лайкнул сам — лёгкая заливка кнопки */
.like-btn.liked { background: #ffd98a; }
/* Пшик при клике */
@keyframes pop { 0%{transform:scale(1)} 40%{transform:scale(1.35)} 100%{transform:scale(1)} }
.like-btn .glass.pop { animation: pop .35s ease; }

/* ТОП РАЗЪЁБЫ */
.top-list { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.top-empty { font-family: Arial, sans-serif; font-weight: normal; opacity: .6; }
.top-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 12px 14px;
}
.top-rank {
  font-size: 26px;
  line-height: 1;
  width: 34px;
  text-align: center;
  flex-shrink: 0;
}
.top-main { flex: 1; min-width: 0; }
.top-main .author { font-size: 14px; letter-spacing: 1px; text-transform: uppercase; }
.top-main .body {
  font-family: Arial, sans-serif; font-weight: normal; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-likes {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  font-size: 18px;
}
.top-likes .glass { width: 22px; height: 26px; }

/* Кнопка «предыдущие» */
.more-btn {
  width: 100%;
  border: none;
  border-top: 4px solid var(--ink);
  background: var(--cream);
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 16px;
  cursor: pointer;
}
.more-btn:hover { background: #e7e9df; }

/* Статичная кнопка языка в правом верхнем углу */
.lang-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 2px;
  color: var(--cream);
  background: var(--red);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 10px 14px;
  cursor: pointer;
  transition: transform .05s ease;
}
.lang-btn:hover { background: #c22e27; }
.lang-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }

/* Админ-управление под кнопкой языка */
.admin-controls {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 220px;
}
.adm-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 10px;
  cursor: pointer;
}
.adm-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.adm-btn.open { background: var(--cream); color: var(--ink); }
.adm-btn.open:hover { background: #e7e9df; }
.close-wrap { position: relative; }
.close-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 100%;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  display: flex;
  flex-direction: column;
  z-index: 101;
}
.close-opt {
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  background: var(--cream);
  border: none;
  border-bottom: 2px solid var(--ink);
  padding: 11px 12px;
  cursor: pointer;
}
.close-opt:last-child { border-bottom: none; font-style: italic; }
.close-opt:hover { background: #ffe9c2; }

/* Оверлей пароля */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.pass-box {
  width: 100%;
  max-width: 360px;
  background: var(--cream);
  border: 4px solid var(--ink);
  box-shadow: var(--shadow);
}
.pass-error { color: var(--red); font-size: 14px; font-weight: bold; }
.pass-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pass-actions .btn { flex: 1; }

/* Баннер «комментарии закрыты» */
.chat-notice {
  background: var(--ink);
  color: var(--cream);
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 12px 14px;
  border: 3px solid var(--ink);
}

/* Бейдж админа */
.who-line { display: flex; align-items: center; gap: 10px; margin-top: -6px; }
.admin-badge {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--cream);
  background: var(--ink);
  border: 2px solid var(--ink);
  padding: 3px 8px;
}

/* Кнопки модерации */
.mod-btn {
  border: 3px solid var(--ink);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  font-size: 15px;
  line-height: 1;
  padding: 6px 10px;
  transition: transform .06s ease, background .1s ease;
}
.mod-btn:active { transform: translateY(2px); }
.mod-btn.del { color: var(--red); }
.mod-btn.del:hover { background: #ffe0de; }
.mod-btn.ban:hover { background: #ffeccc; }

.hidden { display: none !important; }

/* === АНИМАЦИИ === */

/* Новое сообщение влетает сверху, остальные плавно сдвигаются вниз.
   Сдвиг вниз обеспечивает анимация высоты-«распорки» (.spacer). */
@keyframes drop-in {
  0%   { opacity: 0; transform: translateY(-26px) scale(.96); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.message.new {
  animation: drop-in .45s cubic-bezier(.2, .8, .25, 1) both;
}

/* Распорка раскрывается от 0 до высоты карточки — старые сообщения
   уезжают вниз плавно, а не скачком. */
@keyframes expand {
  from { height: 0; }
  to   { height: var(--h); }
}
.spacer {
  overflow: hidden;
  animation: expand .35s ease both;
}

@media (max-width: 520px) {
  .title-box h1 { letter-spacing: 1px; }
  .card-body { padding: 16px; }
}
