/* Шрифт крупнее, JetBrains Mono везде */
html { font-size: 18px; }
body { font-family: 'JetBrains Mono', 'Courier New', monospace; }

/* Убираем $ у ссылок/кнопок и мигающее подчёркивание у логотипа */
.nav-link::before,
.mobile-menu-link::before { content: none !important; }
.nav-brand::after { content: none !important; animation: none; }

/* Логотип в шапке */
.nav-brand { color: #fff; }
.nav-brand:hover { color: #fff; }

.rates-carousel {
  padding: 0.75rem var(--container-padding);
  margin: 0 auto 1rem;
  max-width: 400px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.03);
  font-size: 0.95rem;
  min-height: 2.5rem;
  position: relative;
  text-align: center;
}
.rate-slide {
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.rate-slide.active {
  display: block;
  opacity: 1;
  animation: rate-fade-in 0.5s ease;
}
@keyframes rate-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.rate-slide strong { margin-right: 0.5rem; }

.flash {
  padding: 0.85rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.flash-success {
  background: rgba(38,222,129,0.08);
  border-color: rgba(38,222,129,0.25);
  color: #26de81;
}
.flash-error {
  background: rgba(255,71,87,0.08);
  border-color: rgba(255,71,87,0.25);
  color: #ff6b78;
}
.flash-warning {
  background: rgba(255,200,0,0.08);
  border-color: rgba(255,200,0,0.25);
  color: rgba(255,200,0,0.9);
}
.flash-info {
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.25);
  color: #60a5fa;
}

.star-btn { background: none; border: none; color: rgba(255,255,255,0.6); cursor: pointer; padding: 0.25rem; }
.star-btn:hover:not([disabled]) { color: #fff; }
.star-btn.starred { color: #fff; }
.star-btn[disabled] { opacity: 0.8; cursor: not-allowed; }
.star-count { margin-left: 0.35rem; opacity: 0.9; font-size: 0.9em; }

.post-priority { display: inline-block; padding: 0.2rem 0.5rem; font-size: 0.75rem; background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); margin-bottom: 0.5rem; }
.post-card.is-priority { border: 3px solid #fff !important; font-weight: 700; }
.post-card { position: relative; }
.badge-new { display: inline-block; padding: 0.12rem 0.4rem; font-size: 0.68rem; background: #fff; color: #000; font-weight: 800; letter-spacing: 0.08em; margin-bottom: 0.4rem; text-transform: uppercase; vertical-align: middle; margin-right: 0.3rem; }
.pixel-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; display: block; }

.poll-block { margin: 2rem 0; padding: 1.5rem; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.03); }
.poll-question { margin-bottom: 1rem; }
.poll-option { display: block; margin-bottom: 0.5rem; cursor: pointer; }
.poll-option input { margin-right: 0.5rem; }
.poll-votes { margin-left: 0.5rem; opacity: 0.8; }
.poll-submit-btn { margin-top: 0.75rem; }

.categories-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.categories-nav--strip { margin-bottom: 1.5rem; }
.main-header--compact { margin-bottom: 1.5rem; }
.main-header--compact .hero-title { font-size: clamp(1.5rem, 5vw, 2.25rem); margin-bottom: 0.5rem; }
.main-header--compact .hero-description { font-size: 0.95rem; margin-bottom: 0; }
.featured-block { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.post-card--featured { padding: 1.5rem; }
.post-card--featured .post-title { font-size: 1.35rem; }
.post-card--featured .post-excerpt { font-size: 0.95rem; }
.main-page .featured-block,
.main-page .posts-grid {
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}
.post-category { display: inline-block; font-size: 1rem; opacity: 0.9; margin-bottom: 0.5rem; padding: 0.25rem 0.5rem; }
.post-cover-link { display: block; margin-bottom: 0.75rem; overflow: hidden; }
.post-cover-img { width: 100%; height: 220px; object-fit: contain; background: rgba(0,0,0,0.15); display: block; }
.post-cover-wrap { margin-bottom: 1.5rem; }
.post-cover-detail { width: 100%; height: auto; max-height: 70vh; object-fit: contain; display: block; margin: 0 auto; }
.posts-grid--compact .post-card .post-title { font-size: 1.15rem; }
.posts-grid--compact .post-card .post-excerpt { font-size: 0.9rem; }

/* Детальная страница статьи с сайдбаром (баннер справа) */
.post-detail-layout {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  align-items: flex-start;
}
.post-detail-main {
  flex: 1 1 auto;
  min-width: 0;
}
.post-detail-aside {
  width: 260px;
  flex: 0 0 260px;
}
.post-ad-banner img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.03);
}
@media (max-width: 960px) {
  .post-detail-layout {
    flex-direction: column;
  }
  .post-detail-aside {
    width: 100%;
    flex: 0 0 auto;
  }
}

/* Длинные названия — перенос и обрезка */
.post-title, .post-card .post-title { word-wrap: break-word; overflow-wrap: break-word; }
.post-card .post-title a { display: block; overflow: hidden; text-overflow: ellipsis; }
.post-card--featured .post-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.posts-grid--compact .post-card .post-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-detail .post-header .post-title { word-wrap: break-word; overflow-wrap: break-word; }
.btn-inline-edit { background: none; border: none; color: rgba(255,255,255,0.6); cursor: pointer; font-size: 0.9rem; padding: 0 0.25rem; }
.btn-inline-edit:hover { color: #fff; }
.article-author-card { margin-top: 1rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.article-author-label { font-weight: 600; opacity: 0.9; }
.author-card-link { display: inline-flex; align-items: center; gap: 0.5rem; color: #fff; text-decoration: none; padding: 0.4rem 0.75rem; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); }
.author-card-link:hover { color: #fff; background: rgba(255,255,255,0.12); }
.author-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.author-avatar-placeholder { display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.15); font-size: 1.2rem; min-width: 40px; height: 40px; border-radius: 50%; }
.author-name { font-weight: 600; }
/* Ники администрации и работника издания — зелёные */
.author-name--staff,
.hero-title .author-name--staff,
.user-profile-card .author-name--staff,
.user-profile-card .hero-title .author-name--staff { color: #00cc44 !important; }
.author-coins { opacity: 0.9; }
.author-unknown { opacity: 0.7; }
.author-badge { font-size: 1rem; margin-left: 0.15rem; }
.author-badge--green { color: #00cc44; }
.author-badge--gold { color: #ffd700 !important; }
.author-badge--gold:hover { color: #ffec8b !important; }

.notif-fixed-btn {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  width: 3rem;
  height: 3rem;
  border-radius: 0;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.7);
  color: #fff;
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.notif-fixed-btn:hover { background: rgba(0,0,0,0.9); color: #fff; }
@media (min-width: 769px) {
  .nav-menu { display: flex !important; gap: 0.5rem; align-items: center; }
  .mobile-menu-toggle { display: none !important; }
  .notif-icon-pc { display: flex !important; }
}
/* Полоска донатов */
.donation-bar-wrapper {
  max-width: 900px;
  margin: 0.5rem auto 1.5rem;
  padding: 0.5rem 0;
}
.donation-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(0, 80, 0, 0.6);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(0, 255, 100, 0.6);
}
.donation-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff66, #00c94f);
  box-shadow: 0 0 8px rgba(0, 255, 100, 0.8);
  width: calc(var(--don-pct, 0) * 1%);
}
.donation-bar-text {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  margin-top: 0.35rem;
  color: #b6ffcf;
}
.donation-bar-desc {
  opacity: 0.9;
}
/* RKN event: red alarm overlay + click squares */
.rkn-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: auto;
  cursor: crosshair;
}
.rkn-overlay.rkn-flash { animation: rkn-flash 0.4s ease-in-out infinite; }
.rkn-overlay .rkn-squares { pointer-events: auto; position: absolute; inset: 0; cursor: crosshair; }
.rkn-square {
  position: absolute;
  width: 64px;
  height: 64px;
  background: rgba(255,255,255,0.9);
  background-image: url('/static/images/rkn-logo.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  cursor: crosshair;
  border: 1px solid rgba(0,0,0,0.3);
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}
.rkn-square:hover { background-color: #fff; }
.rkn-square.rkn-square--destroying {
  pointer-events: none;
  transform: scale(2);
  opacity: 0;
}
.rkn-logo {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 8px rgba(255,0,0,0.8);
  pointer-events: none;
}
@keyframes rkn-flash {
  0%, 100% { background: rgba(255,0,0,0.35); }
  50% { background: rgba(255,0,0,0.6); }
}

/* Планшеты и мобилки (960px breakpoint — когда layout переходит в column) */
@media (max-width: 960px) {
  body { overflow-x: hidden; }
  .posts-grid, .featured-block { grid-template-columns: 1fr !important; }
  .main-page .featured-block, .main-page .posts-grid { max-width: 100%; }
  .post-card { max-width: 100%; box-sizing: border-box; overflow: hidden; }
  .post-cover-img { height: auto; max-height: 220px; object-fit: contain; }
  .donation-bar-wrapper { max-width: 100%; padding-left: 1rem; padding-right: 1rem; box-sizing: border-box; }
  .donation-bar-text { font-size: 0.75rem; gap: 0.5rem; flex-wrap: wrap; }
  .post-detail-layout { overflow-x: hidden; }
  .post-detail-main { min-width: 0; max-width: 100%; overflow-x: hidden; }
  .post-content {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .post-content pre { overflow-x: auto; max-width: 100%; }
  .post-content table { display: block; overflow-x: auto; max-width: 100%; }
  .post-content img { max-width: 100% !important; height: auto !important; }
  /* Баннер на мобилке — полная ширина, внизу */
  .post-detail-aside { margin-top: 1.5rem; }
  .post-ad-banner img { max-width: 100%; height: auto; }
}

/* Статья и общие блоки — оптимизация под маленькие экраны */
@media (max-width: 768px) {
  .post-detail.section-padding { padding-top: 1rem; padding-bottom: 2rem; }
  .post-detail .post-header { margin-bottom: 1rem; }
  .post-detail .post-header .post-title {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .post-detail .post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.875rem;
  }
  .post-detail .post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
  }
  .post-detail .post-tags .post-tag { font-size: 0.8rem; padding: 0.2rem 0.4rem; }
  .post-detail .article-author-card {
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
  }
  .post-detail .author-card-link {
    flex-wrap: wrap;
    max-width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.9rem;
  }
  .post-detail .author-avatar,
  .post-detail .author-avatar-placeholder { width: 32px; height: 32px; min-width: 32px; font-size: 0.9rem; }
  .post-detail .author-name { word-break: break-word; }
  .post-detail .post-cover-wrap { margin: 0; max-width: 100%; }
  .post-detail .post-cover-detail { width: 100%; height: auto; max-height: 50vh; object-fit: contain; }
  .post-detail .post-excerpt { font-size: 0.95rem; }
  .post-detail .post-content {
    font-size: 0.9375rem;
    padding: 0 !important;
    margin-bottom: 1.5rem;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  .post-detail .post-content p,
  .post-detail .post-content li { overflow-wrap: break-word; word-wrap: break-word; }
  .post-detail .post-content h1 { font-size: 1.35rem; }
  .post-detail .post-content h2 { font-size: 1.2rem; }
  .post-detail .post-content h3 { font-size: 1.1rem; }
  .post-detail .post-content pre,
  .post-detail .post-content code { font-size: 0.8rem; overflow-x: auto; max-width: 100%; white-space: pre-wrap; }
  .post-detail .article-media {
    margin: 1rem 0;
    padding: 0;
  }
  .post-detail .article-media h3 { font-size: 1rem; margin-bottom: 0.5rem; }
  .post-detail .media-video video,
  .post-detail .media-audio audio { max-width: 100%; width: 100%; }
  .post-detail .breadcrumb { margin-bottom: 0.75rem; font-size: 0.8rem; }
  .post-detail .poll-block { padding: 0.75rem 0; }
  .post-detail .poll-question { font-size: 1rem; }
  .post-detail .poll-options { flex-direction: column; }
  /* Общие фиксы переполнения */
  .section-padding { padding-left: 0; padding-right: 0; }
  .container { overflow-x: hidden; }
  pre, code { word-break: break-all; }
}
