:root {
  --bg: #fff6f8;
  --bg-soft: #ffeef3;
  --rose: #e75480;
  --rose-deep: #c2275f;
  --rose-soft: #ff8fb1;
  --plum: #54233e;
  --text: #6b4456;
  --muted: #a08090;
  --card: #ffffff;
  --line: rgba(231, 84, 128, .12);
  --shadow: 0 10px 30px rgba(231, 84, 128, .14);
  --shadow-lg: 0 24px 60px rgba(194, 39, 95, .18);
  --radius: 22px;
  --radius-sm: 14px;
  --font-serif: "Playfair Display", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-hand: "Caveat", cursive;
  --ease: cubic-bezier(.22, .8, .36, 1);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(255, 190, 210, .55), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(255, 200, 170, .35), transparent 55%),
    linear-gradient(180deg, var(--bg), #fff 60%);
  overflow-x: hidden;
  transition: color .5s ease, background-color .5s ease;
}

/* ── Летящие сердца ─────────────────────────────────────── */
.float-heart {
  position: fixed;
  bottom: -60px;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  animation: floatUp linear forwards;
}

@keyframes floatUp {
  0%   { transform: translateY(0) rotate(-8deg); opacity: 0; }
  10%  { opacity: .45; }
  90%  { opacity: .35; }
  100% { transform: translateY(-110vh) rotate(10deg); opacity: 0; }
}

/* ── Конверт ────────────────────────────────────────────── */
.envelope {
  position: relative;
  width: 300px;
  height: 200px;
  margin-bottom: 34px;
  cursor: pointer;
  perspective: 900px;
  animation: envelopeSway 3.4s ease-in-out infinite;
}

@keyframes envelopeSway {
  0%, 100% { transform: translateY(0) rotate(-.6deg); }
  50%      { transform: translateY(-8px) rotate(.6deg); }
}

.envelope-base {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(160deg, #fbd3e2, #f4a7c3 60%, #e987ad);
  box-shadow: 0 24px 50px rgba(231, 84, 128, .35), inset 0 -12px 24px rgba(180, 30, 80, .18);
}

.envelope-letter {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 26%;
  height: 72%;
  background: #fffdfc;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 46px;
  z-index: 1;
  box-shadow: 0 6px 18px rgba(180, 30, 80, .22);
  transition: transform .8s cubic-bezier(.34, 1.3, .4, 1) .12s;
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #f4a7c3, #e987ad);
  clip-path: polygon(0 0, 100% 0, 50% 52%);
  transform-origin: top center;
  z-index: 3;
  transition: transform .8s cubic-bezier(.5, 1.4, .4, 1);
}

.envelope-heart {
  position: absolute;
  left: 50%;
  top: 48%;
  font-size: 42px;
  opacity: 0;
  z-index: 4;
  pointer-events: none;
}

.envelope.open .envelope-flap { transform: rotateX(180deg); }
.envelope.open .envelope-letter { transform: translateY(-46%); }
.envelope.open .envelope-heart { animation: heartFly 1.7s ease-out .4s forwards; }

@keyframes heartFly {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(.5); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -280px) scale(1.5) rotate(14deg); }
}

@media (max-width: 640px) {
  .envelope { width: 250px; height: 170px; }
}

/* ── Главная ────────────────────────────────────────────── */
.welcome {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 7vw, 4rem);
  color: var(--plum);
  font-weight: 700;
  letter-spacing: .5px;
}

.title .accent { color: var(--rose-deep); font-style: italic; }

.subtitle {
  margin-top: 14px;
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  line-height: 1.7;
  max-width: 460px;
}

@keyframes beat {
  0%, 100% { transform: scale(1); }
  12%      { transform: scale(1.07); }
  24%      { transform: scale(1); }
  36%      { transform: scale(1.05); }
  48%      { transform: scale(1); }
}

.btn-heart {
  margin-top: 40px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  padding: 18px 42px;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8fb1, var(--rose) 45%, var(--rose-deep));
  box-shadow: 0 16px 35px rgba(231, 84, 128, .4);
  transition: transform .25s ease, box-shadow .25s ease;
}

.btn-heart:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 22px 45px rgba(231, 84, 128, .5);
}

.btn-heart:active { transform: scale(.97); }
.btn-heart .icon { font-size: 1.4rem; animation: beat 1.6s infinite; }
.btn-heart.loading { opacity: .8; pointer-events: none; }

/* ── Шапка ──────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--plum);
  text-decoration: none;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.visit-badge {
  background: var(--bg-soft);
  border: 1px solid rgba(231, 84, 128, .25);
  color: var(--rose-deep);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ── Страницы ───────────────────────────────────────────── */
.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px clamp(16px, 4vw, 48px) 80px;
  position: relative;
  z-index: 1;
}

.blog-hero { text-align: center; margin-bottom: 48px; }

.blog-hero h1 {
  font-family: var(--font-serif);
  color: var(--plum);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

.blog-hero p { margin-top: 10px; opacity: .75; }

.blog-hero::after {
  content: "";
  display: block;
  width: 90px;
  height: 2px;
  margin: 22px auto 0;
  background: linear-gradient(90deg, transparent, var(--rose-soft), transparent);
  border-radius: 2px;
}

/* ── Карточки посланий ──────────────────────────────────── */
.posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.post-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.post-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rose-soft), var(--rose-deep));
  opacity: 0;
  transition: opacity .3s ease;
}

.post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.post-card:hover::before { opacity: 1; }

.post-card .post-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.post-date {
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--rose);
  font-weight: 600;
}

.post-num {
  font-family: var(--font-sans);
  font-size: .78rem;
  font-weight: 600;
  color: var(--rose);
  background: var(--bg-soft);
  border: 1px solid rgba(231, 84, 128, .18);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.post-card h2 {
  font-family: var(--font-serif);
  color: var(--plum);
  font-size: 1.25rem;
  line-height: 1.35;
}

.post-card p { font-size: .95rem; line-height: 1.6; opacity: .75; flex: 1; }

.post-more {
  color: var(--rose-deep);
  font-weight: 600;
  font-size: .9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap .2s ease;
}

.post-card:hover .post-more { gap: 11px; }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  opacity: .6;
}

/* ── Статья ─────────────────────────────────────────────── */
.article {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(26px, 5vw, 56px);
  border: 1px solid var(--line);
}

.article h1 {
  font-family: var(--font-serif);
  color: var(--plum);
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  margin: 10px 0 8px;
  line-height: 1.3;
}

.article .markdown { margin-top: 28px; line-height: 1.9; font-size: 1.05rem; }

.article .markdown p { margin-bottom: 20px; }

.article .markdown > p:first-of-type::first-letter {
  font-family: var(--font-serif);
  float: left;
  font-size: 3.4em;
  line-height: .85;
  padding-right: 10px;
  color: var(--rose-deep);
}

.article .markdown h2,
.article .markdown h3,
.article .markdown h4 {
  font-family: var(--font-serif);
  color: var(--plum);
  margin: 32px 0 12px;
  line-height: 1.35;
}

.article .markdown blockquote {
  border-left: 3px solid var(--rose);
  padding: 12px 20px;
  background: var(--bg-soft);
  border-radius: 0 12px 12px 0;
  color: var(--rose-deep);
  font-style: italic;
  margin: 22px 0;
}

.article .markdown a { color: var(--rose-deep); }
.article .markdown ul, .article .markdown ol { margin: 0 0 20px 22px; }
.article .markdown li { margin-bottom: 6px; }
.article .markdown hr { border: none; border-top: 1px dashed rgba(231, 84, 128, .35); margin: 28px 0; }
.article .markdown code {
  background: var(--bg-soft);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: .92em;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 26px;
  color: var(--rose-deep);
  text-decoration: none;
  font-weight: 600;
  transition: gap .2s ease;
}

.back-link:hover { gap: 11px; }

.footer-note { text-align: center; margin-top: 48px; font-style: italic; opacity: .65; }

.signature {
  font-family: var(--font-hand);
  font-size: 2rem;
  line-height: 1.35;
  color: var(--rose-deep);
  text-align: right;
  margin-top: 42px;
  padding-top: 18px;
  border-top: 1px dashed rgba(231, 84, 128, .3);
}

.signature .signature-date {
  display: block;
  font-size: 1.2rem;
  color: var(--rose);
  opacity: .8;
  margin-top: 4px;
}

/* ── Реакции ────────────────────────────────────────────── */
.reactions-block {
  margin-top: 34px;
  text-align: center;
}

.reactions-title {
  font-family: var(--font-hand);
  font-size: 1.6rem;
  color: var(--rose);
  opacity: .9;
  margin-bottom: 14px;
}

.reactions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font: inherit;
  cursor: pointer;
  transition: transform .18s var(--ease), border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.reaction-btn .reaction-emoji { font-size: 1.15rem; line-height: 1; }
.reaction-btn .reaction-count { font-size: .9rem; font-weight: 600; color: var(--text); min-width: 14px; }

.reaction-btn:hover {
  transform: translateY(-3px);
  border-color: var(--rose);
  box-shadow: 0 10px 22px rgba(231, 84, 128, .18);
}

.reaction-btn.active {
  background: var(--bg-soft);
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(231, 84, 128, .15), 0 10px 22px rgba(231, 84, 128, .18);
}

body.candle-mode .reaction-btn { background: var(--card); }
body.candle-mode .reaction-btn.active { background: var(--bg-soft); }

/* ── Админка: каркас ────────────────────────────────────── */
.admin-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px clamp(16px, 4vw, 48px) 80px;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  border: 1px solid var(--line);
}

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.admin-login .card {
  width: min(420px, 100%);
  text-align: center;
  padding: 40px 34px;
}

.admin-login .login-orb {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 32px;
  background: linear-gradient(135deg, var(--rose-soft), var(--rose-deep));
  box-shadow: 0 12px 28px rgba(231, 84, 128, .35);
  animation: beat 1.6s ease-in-out infinite;
}

.admin-login h1 {
  font-family: var(--font-serif);
  color: var(--plum);
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.admin-login .card-sub { font-size: .9rem; opacity: .65; margin-bottom: 24px; }

.admin-login .btn { width: 100%; justify-content: center; }

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-header h1 { font-family: var(--font-serif); color: var(--plum); font-size: 1.7rem; }
.admin-header .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Админка: статистика ────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease);
}

.stat:hover { transform: translateY(-3px); }

.stat-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 21px;
  background: linear-gradient(135deg, var(--rose-soft), var(--rose-deep));
  box-shadow: 0 8px 18px rgba(231, 84, 128, .3);
}

.stat b {
  display: block;
  font-size: 1.5rem;
  color: var(--plum);
  font-family: var(--font-serif);
  line-height: 1.1;
}

.stat span { font-size: .82rem; opacity: .65; }

/* ── Админка: посты ─────────────────────────────────────── */
.admin-section { margin-bottom: 26px; }

.admin-section > h2 {
  font-family: var(--font-serif);
  color: var(--plum);
  font-size: 1.25rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-rows { display: flex; flex-direction: column; gap: 10px; }

.post-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s ease;
}

.post-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(231, 84, 128, .3);
}

.post-row .row-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 19px;
  background: var(--bg-soft);
  border: 1px solid rgba(231, 84, 128, .15);
}

.post-row .row-main { flex: 1; min-width: 0; }

.post-row .row-title {
  font-family: var(--font-serif);
  color: var(--plum);
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-row .row-sub {
  font-size: .82rem;
  opacity: .6;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-row .badge { margin-left: auto; flex-shrink: 0; }

.post-row .row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Админка: визиты ────────────────────────────────────── */
.visit-list {
  display: flex;
  flex-direction: column;
}

.visit-row {
  display: grid;
  grid-template-columns: 96px 120px 130px 84px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}

.visit-row:last-child { border-bottom: none; }

.visit-row.visit-head {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--rose-deep);
  padding-top: 0;
  padding-bottom: 10px;
}

.visit-row .visit-when,
.visit-row .visit-ip,
.visit-row .visit-screen {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.visit-row .visit-browser {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: var(--muted);
  font-size: .9em;
}

.visit-row .visit-empty { grid-column: 1 / -1; opacity: .6; }

@media (max-width: 640px) {
  .visit-row {
    grid-template-columns: 84px 110px 1fr;
  }
  .visit-row .visit-screen,
  .visit-row .visit-browser { grid-column: 1 / -1; }
  .visit-row .visit-screen { order: 2; }
  .visit-row .visit-browser { order: 3; }
  .visit-row.visit-head .visit-screen,
  .visit-row.visit-head .visit-browser { display: none; }
}

/* ── Бейджи и статусы ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge.on {
  background: #e8f7ee;
  color: #1e8e4e;
}

.badge.off {
  background: #f7e8ec;
  color: #8e1e3c;
}

.badge.new {
  background: #fff1e8;
  color: #b3541e;
}

/* ── Кнопки ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #ff8fb1, var(--rose-deep));
  color: #fff;
  box-shadow: 0 10px 24px rgba(231, 84, 128, .3);
  text-decoration: none;
  transition: transform .2s var(--ease), box-shadow .2s ease, opacity .2s ease;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(231, 84, 128, .38); }
.btn:active { transform: translateY(0) scale(.98); }

.btn.ghost {
  background: var(--bg-soft);
  color: var(--rose-deep);
  box-shadow: none;
  border: 1px solid rgba(231, 84, 128, .25);
}

.btn.ghost:hover { box-shadow: 0 8px 18px rgba(231, 84, 128, .15); }

.btn.small { padding: 8px 16px; font-size: .85rem; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: var(--bg-soft);
  border: 1px solid rgba(231, 84, 128, .15);
  transition: transform .2s var(--ease), background .2s ease;
}

.btn-icon:hover { transform: translateY(-2px); background: #ffe4ec; }
.btn-icon.danger:hover { background: #ffe0e0; }

.error {
  background: #fff0f0;
  color: #b3261e;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: .9rem;
}

/* ── Формы ──────────────────────────────────────────────── */
.field { margin-bottom: 18px; text-align: left; }

.field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--plum);
}

.field input,
.field textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid rgba(231, 84, 128, .22);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--plum);
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.field textarea { min-height: 340px; resize: vertical; line-height: 1.7; }

.field input::placeholder,
.field textarea::placeholder { color: var(--muted); opacity: .6; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(231, 84, 128, .13);
}

.check {
  display: flex;
  gap: 9px;
  align-items: center;
  font-weight: 600;
  color: var(--plum);
  margin-bottom: 20px;
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--rose);
  cursor: pointer;
}

/* ── Редактор: вкладки ──────────────────────────────────── */
.editor-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: var(--bg-soft);
  border: 1px solid rgba(231, 84, 128, .15);
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
}

.editor-tab {
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 600;
  font-size: .88rem;
  color: var(--text);
  padding: 8px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.editor-tab.active {
  background: linear-gradient(135deg, var(--rose-soft), var(--rose-deep));
  color: #fff;
  box-shadow: 0 6px 16px rgba(231, 84, 128, .3);
}

.editor-panel { display: none; }
.editor-panel.active { display: block; }

.preview-box {
  min-height: 340px;
  padding: 20px 22px;
  border: 1px solid rgba(231, 84, 128, .22);
  border-radius: var(--radius-sm);
  line-height: 1.85;
  font-size: 1rem;
}

.preview-box p { margin-bottom: 14px; }
.preview-box h1, .preview-box h2, .preview-box h3 {
  font-family: var(--font-serif);
  color: var(--plum);
  margin: 20px 0 10px;
}
.preview-box blockquote {
  border-left: 3px solid var(--rose);
  padding: 8px 16px;
  background: var(--bg-soft);
  color: var(--rose-deep);
  font-style: italic;
  margin: 14px 0;
}
.preview-box ul, .preview-box ol { margin: 0 0 14px 22px; }
.preview-box code { background: var(--bg-soft); padding: 2px 7px; border-radius: 6px; }

.char-count {
  font-size: .8rem;
  opacity: .55;
  margin-top: 6px;
  text-align: right;
}

/* ── Свеча ──────────────────────────────────────────────── */
.candle-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  background: rgba(255, 255, 255, .8);
  box-shadow: 0 8px 22px rgba(231, 84, 128, .25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform .25s ease, box-shadow .25s ease, background .4s ease;
}

.candle-btn:hover { transform: translateY(-3px) scale(1.06); }
.candle-btn:active { transform: scale(.94); }

.to-top {
  position: fixed;
  right: 84px;
  bottom: 20px;
  z-index: 50;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--rose-soft), var(--rose-deep));
  box-shadow: 0 8px 22px rgba(231, 84, 128, .35);
  transition: transform .25s ease, box-shadow .25s ease, opacity .25s ease;
}

.to-top:hover { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(231, 84, 128, .45); }
.to-top:active { transform: scale(.92); }

body.candle-mode .to-top {
  background: rgba(255, 160, 80, .22);
  color: var(--plum);
  box-shadow: 0 0 20px rgba(255, 150, 60, .4);
}

/* ── Свечной режим ──────────────────────────────────────── */
body.candle-mode {
  --bg: #221318;
  --bg-soft: #3a2029;
  --plum: #ffe3d0;
  --text: #ecc8b3;
  --muted: #b08d7c;
  --card: #3b2430;
  --line: rgba(255, 190, 120, .14);
  --shadow: 0 12px 32px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  background: radial-gradient(800px 400px at 85% -10%, rgba(255, 160, 90, .14), transparent 60%),
              linear-gradient(180deg, #221318, #180e12 70%);
}

body.candle-mode .card,
body.candle-mode .post-card,
body.candle-mode .article,
body.candle-mode .stat,
body.candle-mode .post-row {
  border-color: var(--line);
  background: var(--card);
}

body.candle-mode .topbar {
  background: rgba(34, 19, 24, .8);
  border-bottom-color: var(--line);
}

body.candle-mode .visit-badge,
body.candle-mode .btn.ghost,
body.candle-mode .editor-tabs,
body.candle-mode .field input,
body.candle-mode .field textarea,
body.candle-mode .preview-box {
  background: var(--bg-soft);
  border-color: rgba(255, 190, 120, .2);
}

body.candle-mode .field input,
body.candle-mode .field textarea,
body.candle-mode .preview-box { color: var(--plum); }

body.candle-mode .candle-btn {
  background: rgba(255, 160, 80, .22);
  box-shadow: 0 0 26px rgba(255, 150, 60, .55), 0 8px 22px rgba(0, 0, 0, .4);
}

body.candle-mode .float-heart { filter: drop-shadow(0 0 6px rgba(255, 160, 90, .35)); }
body.candle-mode .btn-icon,
body.candle-mode .post-row .row-icon { background: var(--bg-soft); border-color: var(--line); }
body.candle-mode .visit-row:hover { background: rgba(255, 190, 120, .05); }
body.candle-mode .post-card p { opacity: .8; }

/* ── Анимации появления ─────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .7s ease, transform .7s ease;
}

.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ── Конфетти ───────────────────────────────────────────── */
.burst-heart {
  position: fixed;
  pointer-events: none;
  z-index: 60;
  animation: burst 1s ease-out forwards;
}

@keyframes burst {
  0%   { transform: translate(0, 0) scale(.4) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(var(--rot)); opacity: 0; }
}

/* ── Мобильные ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .posts { grid-template-columns: 1fr; }
  .topbar .brand { font-size: 1rem; }
  .visit-badge { font-size: .75rem; }
  .btn-heart { padding: 16px 30px; font-size: 1.1rem; }
  .post-row { flex-wrap: wrap; }
  .post-row .row-main { flex-basis: 100%; }
  .post-row .badge { margin-left: 0; }
  .admin-header { flex-direction: column; align-items: flex-start; }
}
