@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Unbounded:wght@600;800&display=swap');

/* ============================================================================
   ENHANCED PORTAL DESIGN — Современный дизайн с темной и светлой темами
   ============================================================================ */

/* Цветовая схема и переменные */
:root {
  /* Темная тема (по умолчанию) */
  --bg: #080a0b;
  --bg-elevated: #0d0f11;
  --panel: #111416;
  --panel-hover: #15191b;
  --line: #25292b;
  --line-strong: #34393b;
  --text: #f1f0ec;
  --text-secondary: #d2d5d5;
  --muted: #92989b;
  --muted-strong: #777e81;
  --red: #e44531;
  --red2: #ff6a3d;
  --red-light: #ff8977;
  --accent: #ff6a3d;
  --success: #36c76b;
  --warning: #fbbf24;
  --info: #3b82f6;

  /* Размеры */
  --max: 1240px;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;

  /* Переходы */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Тени */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);

  /* Z-индексы */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 1000;
  --z-toast: 2000;
}

/* Сезонные визуальные события: меняются только цвета и декоративный слой. */
html[data-season="winter"] { --season-glow: #9bd7ff; --season-accent: #8ec5ff; }
html[data-season="spring"] { --season-glow: #b8ed9a; --season-accent: #78c875; }
html[data-season="summer"] { --season-glow: #ffd477; --season-accent: #f3a847; }
html[data-season="autumn"] { --season-glow: #ffad72; --season-accent: #d87548; }

.season-banner {
  position: relative;
  z-index: 210;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 8px max(24px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid color-mix(in srgb, var(--season-accent) 38%, var(--line));
  background: linear-gradient(90deg, color-mix(in srgb, var(--season-accent) 13%, var(--bg)), var(--bg));
  color: var(--text);
}
.season-banner-icon { color: var(--season-glow); font-size: 20px; text-shadow: 0 0 16px var(--season-glow); }
.season-banner-copy { display: grid; gap: 1px; flex: 1; }
.season-banner-copy b { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.season-banner-copy small { color: var(--muted); font-size: 12px; }
.season-banner-close { border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; padding: 2px 8px; }
.season-banner-close:hover { color: var(--text); }
.profile-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.profile-badge { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 999px; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); font-size: 12px; font-weight: 700; }
body.seasonal-event::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; background: radial-gradient(circle at 86% 12%, color-mix(in srgb, var(--season-glow) 10%, transparent), transparent 28%); }
body.easter-egg-found .brand img { animation: easterEggPulse .8s ease-in-out 2; box-shadow: 0 0 0 5px color-mix(in srgb, var(--season-glow) 35%, transparent), 0 0 28px var(--season-glow); }
@keyframes easterEggPulse { 50% { transform: rotate(12deg) scale(1.12); } }

/* Фоновая декорация текущего сезона. Контент остаётся поверх слоя. */
.season-particles { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.season-particle { position: absolute; left: var(--particle-left); top: -10vh; display: block; opacity: .6; }
.season-particles-autumn .season-particle { width: 13px; height: 9px; border-radius: 80% 12% 80% 12%; background: var(--season-accent); box-shadow: 0 0 8px color-mix(in srgb, var(--season-accent) 35%, transparent); animation: leafFall 8s linear var(--particle-delay) infinite; transform: rotate(25deg); }
.season-particles-winter .season-particle { width: 7px; height: 7px; border-radius: 50%; background: #eaf7ff; box-shadow: 0 0 8px #fff; animation: snowFall 9s linear var(--particle-delay) infinite; }
.season-particles-spring .season-particle { width: 3px; height: 13px; border-radius: 80% 10% 80% 10%; background: #b9e9ff; box-shadow: 0 0 7px #b9e9ff; animation: rainFall 5s linear var(--particle-delay) infinite; }
.season-particles-summer .season-particle { left: auto; top: 88px; right: 8vw; width: 120px; height: 120px; border-radius: 50%; background: #ffd66b; box-shadow: 0 0 30px #ffc94d, 0 0 90px color-mix(in srgb, #ffc94d 45%, transparent); animation: sunPulse 5s ease-in-out var(--particle-delay) infinite; }
.season-particles-winter::after { content: ''; position: absolute; left: -5%; right: -5%; bottom: -42px; height: 105px; border-radius: 50% 50% 0 0; background: linear-gradient(#f4fbff, #d8ebf4); opacity: .32; box-shadow: 0 -12px 30px rgba(231, 248, 255, .25); }
@keyframes leafFall { 0% { transform: translate3d(0, -8vh, 0) rotate(0deg); opacity: 0; } 12% { opacity: .65; } 50% { transform: translate3d(35px, 50vh, 0) rotate(180deg); } 100% { transform: translate3d(-55px, 112vh, 0) rotate(360deg); opacity: 0; } }
@keyframes snowFall { 0% { transform: translate3d(0, -8vh, 0); opacity: 0; } 12% { opacity: .75; } 50% { transform: translate3d(24px, 50vh, 0); } 100% { transform: translate3d(-18px, 112vh, 0); opacity: 0; } }
@keyframes rainFall { 0% { transform: translate3d(0, -8vh, 0) rotate(18deg); opacity: 0; } 10% { opacity: .55; } 100% { transform: translate3d(-16px, 112vh, 0) rotate(18deg); opacity: 0; } }
@keyframes sunPulse { 50% { transform: scale(1.06); opacity: .8; } }
@media (prefers-reduced-motion: reduce) { .season-particle { animation: none !important; } .season-particles-autumn .season-particle, .season-particles-winter .season-particle, .season-particles-spring .season-particle { top: 18%; opacity: .3; } }

/* Светлая тема */
html[data-theme="light"] {
  --bg: #f4f1eb;
  --bg-elevated: #fafaf8;
  --panel: #fffdf9;
  --panel-hover: #f8f6f2;
  --line: #d9d3c8;
  --line-strong: #c9c3b8;
  --text: #17191a;
  --text-secondary: #555d60;
  --muted: #676d70;
  --muted-strong: #9ca1a4;
  --red: #d43f2d;
  --red2: #e85a3d;
  --red-light: #ff6b52;
  --accent: #e85a3d;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);

  color-scheme: light;
}

/* Базовые стили */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Шум/текстура фона */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

html[data-theme="light"] .noise {
  opacity: 0.015;
}

/* ============================================================================
   ТОПБАР / НАВИГАЦИЯ
   ============================================================================ */

.topbar {
  height: 72px;
  padding: 0 max(24px, calc((100vw - var(--max)) / 2));
  display: flex;
  align-items: center;
  gap: 32px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(8, 10, 11, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  z-index: var(--z-sticky);
  transition: var(--transition);
}

html[data-theme="light"] .topbar {
  background: rgba(250, 250, 248, 0.92);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

.brand:hover {
  opacity: 0.8;
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 50%;
  filter: contrast(1.1);
  box-shadow: var(--shadow-sm);
}

.brand span {
  display: flex;
  flex-direction: column;
  line-height: 1;
  font-family: Unbounded, Arial, sans-serif;
}

.brand b {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand small {
  color: var(--red2);
  font-size: 9px;
  letter-spacing: 0.25em;
  margin-top: 6px;
  font-weight: 600;
}

.topbar nav {
  display: flex;
  gap: 24px;
  margin: auto 0 auto auto;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 0;
  position: relative;
  transition: var(--transition);
}

.topbar nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: var(--transition);
}

.topbar nav a:hover,
.topbar nav a.active {
  color: var(--text);
}

.topbar nav a:hover::after,
.topbar nav a.active::after {
  transform: scaleX(1);
}

.theme-toggle {
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.theme-toggle:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
  transform: rotate(15deg);
}

.account,
.menu {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.account:hover,
.menu:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.menu {
  display: none;
  padding: 10px 14px;
  font-size: 18px;
}

/* ============================================================================
   КОНТЕНТ / LAYOUT
   ============================================================================ */

.view {
  display: none;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px 90px;
  position: relative;
  z-index: 2;
}

.view.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hero секция */
.hero {
  min-height: 650px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 60px;
  position: relative;
  padding: 80px 0;
}

.hero::after {
  content: "";
  position: absolute;
  right: 5%;
  top: 50%;
  transform: translateY(-50%);
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--red) 0%, transparent 70%);
  filter: blur(120px);
  opacity: 0.12;
  pointer-events: none;
}

.eyebrow {
  display: block;
  color: var(--red2);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  margin-bottom: 18px;
}

.hero h1,
.page-title h1 {
  font-family: Unbounded, Arial, sans-serif;
  margin: 0 0 24px;
  text-transform: uppercase;
  font-size: clamp(42px, 6vw, 86px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.hero h1 i {
  font-style: normal;
  color: var(--red2);
  display: inline-block;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.hero-copy > p {
  max-width: 620px;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.8;
  margin: 0 0 36px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 14px 22px;
  border-radius: var(--radius);
  text-decoration: none;
  font: 700 13px Manrope, Arial, sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn.primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn.primary:hover {
  background: var(--red2);
  border-color: var(--red2);
}

.btn.danger {
  background: rgba(228, 69, 49, 0.1);
  border-color: rgba(228, 69, 49, 0.3);
  color: var(--red-light);
}

.btn.danger:hover {
  background: rgba(228, 69, 49, 0.2);
  border-color: var(--red);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.hero-mark {
  justify-self: end;
  position: relative;
  z-index: 3;
}

.hero-mark img {
  width: min(36vw, 390px);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1),
              0 30px 80px rgba(0, 0, 0, 0.6);
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.hero-mark span {
  display: block;
  text-align: center;
  color: var(--muted);
  font: 10px Unbounded, Arial, sans-serif;
  letter-spacing: 0.3em;
  margin-top: 24px;
  opacity: 0.7;
}

/* ============================================================================
   СЕКЦИИ И ЗАГОЛОВКИ
   ============================================================================ */

.page-title {
  padding: 100px 0 55px;
  max-width: 900px;
}

.page-title h1 {
  font-size: clamp(36px, 5vw, 68px);
  margin-bottom: 16px;
}

.page-title p {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
  max-width: 720px;
  overflow-wrap: anywhere;
}

/* Keep standalone prose readable instead of letting it run across the page. */
.view > p,
.view > .prose,
.view > [data-prose] {
  max-width: 820px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-secondary);
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.about-grid article {
  min-width: 0;
  padding: 30px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.about-grid article p { color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }

.donate-card,
.purchase-terms {
  max-width: 850px;
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.donate-card { max-width: 720px; border-color: #5a342e; }
.donate-card b { font: 600 22px Unbounded, Arial, sans-serif; }
.donate-card p { color: var(--muted); line-height: 1.7; margin: 18px 0 25px; }
.donation-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; margin: 24px 0 34px; }
.donation-product { min-width: 0; border: 1px solid var(--line); background: var(--panel); cursor: pointer; transition: transform .2s ease, border-color .2s ease; overflow: hidden; }
.donation-product:hover, .donation-product:focus-visible { transform: translateY(-4px); border-color: var(--red2); outline: none; }
.donation-product-media { height: 190px; background: #0b0d0e; overflow: hidden; }
.donation-product-media img, .donation-product-media video { width: 100%; height: 100%; object-fit: cover; }
.donation-product-body { padding: 20px; }
.donation-product-body h3 { margin: 0 0 10px; font-size: 21px; overflow-wrap: anywhere; }
.donation-product-body p { color: var(--muted); line-height: 1.6; min-height: 52px; overflow-wrap: anywhere; }
.donation-product-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; color: var(--red2); font-size: 12px; }
.donation-product-foot b { font-size: 14px; }
.donation-card-price { font: 700 18px Unbounded, Arial, sans-serif; color: var(--red2); margin: 12px 0 18px; }
.purchase-terms { margin: 28px 0; }
.purchase-terms h3 { margin-top: 0; }
.purchase-terms li { color: var(--muted); line-height: 1.7; margin: 8px 0; }
.legal-requisites { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.legal-requisites b { color: var(--text); }
.legal-requisites a { color: var(--red2); font-weight: 700; text-decoration: none; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding: 50px 0 32px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.section-head > div {
  flex: 1;
  min-width: 200px;
}

h2 {
  font: 700 clamp(28px, 4vw, 48px) Unbounded, Arial, sans-serif;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

/* ============================================================================
   КАРТОЧКИ НОВОСТЕЙ / ПОСТОВ
   ============================================================================ */

.posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.post {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-slow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.post:hover {
  transform: translateY(-6px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lg);
}

.post:first-child {
  grid-column: 1 / -1;
}

.post:first-child .post-media {
  height: 420px;
}

.post-media {
  height: 240px;
  background: var(--bg-elevated);
  overflow: hidden;
  position: relative;
}

.post-media img,
.post-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-slow);
}

.post:hover .post-media img,
.post:hover .post-media video {
  transform: scale(1.05);
}

.post-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted-strong);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 14px;
}

.post h3 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.3;
  color: var(--text);
}

.post p {
  color: var(--text-secondary);
  line-height: 1.65;
  white-space: pre-line;
  margin: 0;
  flex: 1;
}

.post-more {
  display: inline-block;
  margin-top: 16px;
  color: var(--red2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: var(--transition);
}

.post:hover .post-more {
  transform: translateX(4px);
}

.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.like-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.like-btn:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.like-btn.liked {
  color: var(--red-light);
  border-color: rgba(228, 69, 49, 0.4);
  background: rgba(228, 69, 49, 0.1);
}

.empty {
  grid-column: 1 / -1;
  padding: 80px 30px;
  text-align: center;
  color: var(--muted);
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  font-size: 15px;
}

/* ============================================================================
   ФОРУМ
   ============================================================================ */

.forum-tools {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.forum-tools input,
.forum-tools select {
  flex: 1;
  min-width: 180px;
}

.topic-list {
  border-top: 1px solid var(--line);
}

.topic {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  padding: 24px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: var(--transition);
  align-items: start;
  min-width: 0;
  overflow: hidden;
}

.topic > div {
  min-width: 0;
}

.topic-media {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: contain;
  box-sizing: border-box;
  background: #0b0d0e;
  border-radius: 8px;
  margin-bottom: 10px;
}

.post-poll { margin-top: 16px; padding: 14px; border: 1px solid var(--line); background: var(--panel-hover); }
.post-poll > b { display: block; margin-bottom: 10px; }
.poll-option { display: flex; justify-content: space-between; gap: 12px; width: 100%; margin-top: 7px; padding: 9px 11px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-align: left; cursor: pointer; }
.poll-option:hover, .poll-option.selected { border-color: var(--red2); }
.poll-option small { color: var(--muted); white-space: nowrap; }

.topic:hover {
  background: var(--panel-hover);
}

.topic h3 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.topic p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.topic-priority {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.priority-normal {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.priority-important {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.priority-urgent {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

.badge {
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 11px;
  height: max-content;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: var(--transition);
}

.badge.closed,
.badge.blocked {
  color: var(--red-light);
  border-color: rgba(228, 69, 49, 0.3);
  background: rgba(228, 69, 49, 0.1);
}

/* ============================================================================
   ФОРМЫ И ИНПУТЫ
   ============================================================================ */

input,
textarea,
select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 14px 16px;
  border-radius: var(--radius);
  font: 14px Manrope, Arial, sans-serif;
  transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 106, 61, 0.1);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 18px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.compact-search {
  width: min(280px, 100%);
  padding: 12px 16px;
}

/* ============================================================================
   МОДАЛЬНЫЕ ОКНА
   ============================================================================ */

dialog {
  width: min(580px, calc(100% - 32px));
  max-height: calc(100vh - 80px);
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 38px;
  box-shadow: var(--shadow-lg);
  overflow: auto;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

dialog .close {
  position: absolute;
  right: 18px;
  top: 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 32px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

dialog .close:hover {
  background: var(--panel-hover);
  color: var(--text);
}

dialog h2 {
  font-size: clamp(24px, 5vw, 42px);
  margin: 0 0 24px;
}

/* ============================================================================
   АДМИН-ПАНЕЛЬ — УЛУЧШЕННАЯ
   ============================================================================ */

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

.admin-card {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 28px;
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.admin-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.admin-card.wide {
  grid-column: 1 / -1;
}

.admin-card h3 {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.manage-row {
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding: 16px 0;
  flex-wrap: wrap;
}

.manage-row > div:first-child {
  flex: 1;
  min-width: 180px;
}

.manage-row b {
  display: block;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.manage-row small {
  color: var(--muted);
  font-size: 12px;
  display: block;
  line-height: 1.5;
}

/* ============================================================================
   ЩИТПОСТЫ / ЧАТ
   ============================================================================ */

.chat-post {
  max-width: 760px;
  margin: 0 auto 20px;
}

.chat-bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: var(--transition);
}

.chat-bubble:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.chat-bubble b {
  color: var(--red2);
  font-weight: 700;
}

.chat-bubble small {
  float: right;
  color: var(--muted);
  font-size: 12px;
}

.chat-bubble p {
  white-space: pre-wrap;
  line-height: 1.7;
  margin: 14px 0 0;
  color: var(--text-secondary);
}

.chat-replies {
  padding: 12px 0 0 32px;
}

.chat-reply {
  border-left: 2px solid var(--line);
  padding: 10px 16px;
  color: var(--text-secondary);
  margin-top: 10px;
  transition: var(--transition);
}

.chat-reply:hover {
  border-left-color: var(--accent);
  background: var(--panel-hover);
}

.chat-reply b {
  color: var(--red2);
  margin-right: 8px;
  font-weight: 700;
}

.reply-inline {
  display: flex;
  gap: 10px;
  padding: 12px 0 0 32px;
}

.reply-inline input {
  flex: 1;
}

/* ============================================================================
   TOAST УВЕДОМЛЕНИЯ
   ============================================================================ */

#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--panel);
  color: var(--text);
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  transform: translateY(120px);
  transition: var(--transition-slow);
  z-index: var(--z-toast);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
}

#toast.show {
  transform: translateY(0);
}

html[data-theme="light"] #toast {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ============================================================================
   FOOTER
   ============================================================================ */

footer {
  max-width: var(--max);
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 40px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  gap: 24px;
  flex-wrap: wrap;
}

footer a {
  color: var(--muted);
  text-decoration: none;
  transition: var(--transition);
}

footer a:hover {
  color: var(--text);
}

.mini img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

/* ============================================================================
   TELEGRAM ИНТЕГРАЦИЯ
   ============================================================================ */

.telegram-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
}

.telegram-panel h3 {
  margin: 0 0 16px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.telegram-panel h3::before {
  content: "📱";
  font-size: 24px;
}

.telegram-hint {
  color: var(--muted);
  font-size: 13px;
  margin: -8px 0 16px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-left: 3px solid var(--info, #3b82f6);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.telegram-error {
  padding: 16px;
  background: rgba(228, 69, 49, 0.1);
  border: 1px solid rgba(228, 69, 49, 0.3);
  border-radius: var(--radius);
  color: var(--red-light);
  font-size: 14px;
  margin-top: 16px;
}

.telegram-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 8px;
}

.telegram-feed::-webkit-scrollbar {
  width: 8px;
}

.telegram-feed::-webkit-scrollbar-track {
  background: var(--bg-elevated);
  border-radius: 4px;
}

.telegram-feed::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.telegram-feed::-webkit-scrollbar-thumb:hover {
  background: var(--line-strong);
}

.telegram-item {
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: var(--transition);
}

.telegram-item:hover {
  border-color: var(--line-strong);
}

.telegram-item-header {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.telegram-item-body {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 780px) {
  .about-grid { grid-template-columns: 1fr; }
  .topbar {
    height: 68px;
    padding: 0 16px;
    gap: 12px;
  }

  .topbar nav {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--panel);
    padding: 20px;
    flex-direction: column;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
  }

  .topbar nav.open {
    display: flex;
  }

  .menu {
    display: block;
    margin-left: auto;
  }

  .hero {
    display: flex;
    flex-direction: column;
    min-height: auto;
    padding: 60px 0;
  }

  .hero-mark {
    position: relative;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }

  .hero-mark img {
    width: 100%;
  }

  .posts {
    grid-template-columns: 1fr;
  }

  .post:first-child .post-media,
  .post-media {
    height: 240px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .view {
    padding: 0 16px 60px;
  }

  .page-title {
    padding: 60px 0 40px;
  }

  dialog {
    padding: 24px;
  }
}

/* ============================================================================
   УТИЛИТЫ
   ============================================================================ */

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-hover) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
