/* Модификаторы фона для первой секции (hero) */
.hero.bg-story {
  background-image: url('./background2.png');
}

.hero.bg-rules {
  background-image: url('./background3.png');
}

/* Базовые контейнеры для внутренних страниц */
.page-section {
  padding: 100px 60px;
  background:
    linear-gradient(to bottom, rgba(10,10,10,0.95), rgba(10,10,10,0.95)),
    repeating-linear-gradient(0deg, #1a1a1a 0px, #1a1a1a 2px, transparent 2px, transparent 60px),
    repeating-linear-gradient(90deg, #1a1a1a 0px, #1a1a1a 2px, transparent 2px, transparent 60px);
  background-size: 100% 100%, 60px 60px, 60px 60px;
  position: relative;
}

.page-section::before,
.page-section::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 150px;
  pointer-events: none;
}

.page-section::before {
  top: 0;
  background: linear-gradient(to bottom, #0a0a0a, transparent);
}

.page-section::after {
  bottom: 0;
  background: linear-gradient(to top, #0a0a0a, transparent);
}

.container,
.rules-container {
  max-width: 1100px;
  margin: 0 auto;
}

.page-intro {
  max-width: 900px;
  margin: 0 auto 30px;
  font-size: 18px;
  line-height: 1.8;
  opacity: 0.9;
  text-align: center;
}

/* ========== Story (Сюжет) ========== */

.ratio-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  justify-content: center;
  margin: 20px 0 30px;
}

.rc-label {
  opacity: 0.8;
  font-size: 15px;
}

.rc-btn {
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s ease;
  font-family: inherit;
  font-size: 14px;
}
.rc-btn:hover {
  border-color: #4fc3f7;
  color: #4fc3f7;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

/* Форс глобального соотношения */
.story-grid.force-1-1 .media { aspect-ratio: 1 / 1 !important; }
.story-grid.force-4-3 .media { aspect-ratio: 4 / 3 !important; }
.story-grid.force-16-9 .media { aspect-ratio: 16 / 9 !important; }

.story-card {
  background: #111;
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.story-card:hover {
  transform: translateY(-6px);
  border-color: rgba(79,195,247,0.35);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.story-card .media {
  width: 100%;
  overflow: hidden;
  background: #0f0f0f;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  /* По умолчанию аспект задаётся через классы ratio-* на .media */
}

.story-card .media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Пиксельная графика для 8×8 / 16×16 */
.story-card .media img.pixel {
  image-rendering: pixelated;
  image-rendering: crisp-edges; /* для некоторых браузеров */
}

/* Классы аспектов — используйте их на .media */
.ratio-1-1 { aspect-ratio: 1 / 1; }
.ratio-4-3 { aspect-ratio: 4 / 3; }
.ratio-16-9 { aspect-ratio: 16 / 9; }

.story-card .content {
  padding: 16px 16px 18px;
}

.story-card .content h3 {
  font-size: 18px;
  margin-bottom: 10px;
  color: #fff;
}

.story-card .content p {
  font-size: 15px;
  line-height: 1.7;
  opacity: 0.9;
  margin-bottom: 12px;
}

.story-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.story-card .tags li {
  font-size: 12px;
  padding: 6px 10px;
  background: rgba(79,195,247,0.12);
  border: 1px solid rgba(79,195,247,0.28);
  border-radius: 999px;
  color: #cfefff;
}

.howto {
  margin-top: 26px;
  font-size: 14px;
  opacity: 0.85;
}
.howto ul {
  margin-top: 8px;
  padding-left: 18px;
  line-height: 1.8;
  opacity: 0.95;
}

/* ========== Rules (Правила) ========== */

.rules-container {
  max-width: 980px;
}

.toc {
  margin: 20px 0 34px;
  padding: 16px 18px;
  background: #111;
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid #4fc3f7;
}

.toc-title {
  font-size: 15px;
  margin-bottom: 10px;
  opacity: 0.9;
}

.toc ol {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  list-style: decimal;
  margin-left: 18px;
}

.toc a {
  color: #cfefff;
  text-decoration: none;
  border-bottom: 1px dotted rgba(79,195,247,0.4);
}
.toc a:hover {
  color: #4fc3f7;
  border-bottom-color: #4fc3f7;
}

.rules-section {
  margin: 40px 0 28px;
}

.rules-title {
  font-size: 22px;
  margin-bottom: 14px;
  color: #4fc3f7;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Автонумерация правил с красивыми бейджами */
.rule-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: rule;
  display: grid;
  gap: 12px;
}

.rule-card {
  position: relative;
  background: #111;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 16px 16px 16px 52px;
  line-height: 1.7;
  border-radius: 4px;
}

.rule-card::before {
  counter-increment: rule;
  content: counter(rule);
  position: absolute;
  top: 14px;
  left: 12px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: #fff;
  background: rgba(79,195,247,0.28);
  border: 1px solid rgba(79,195,247,0.4);
  border-radius: 8px;
}

.rule-card h4 {
  margin-bottom: 6px;
  font-size: 16px;
}

.rule-card p {
  margin: 0;
  opacity: 0.95;
}

.rules-note {
  margin-top: 30px;
  font-size: 13px;
  opacity: 0.75;
  text-align: center;
}

/* ========== Адаптивность ========== */

@media (max-width: 1200px) {
  .story-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {
  .story-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .rules-container {
    padding: 0 6px;
  }
}

@media (max-width: 768px) {
  .page-section {
    padding: 60px 30px;
  }
  .story-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .rule-card {
    padding-left: 46px;
  }
  .rule-card::before {
    left: 10px;
    top: 12px;
    width: 26px;
    height: 26px;
    font-size: 13px;
  }
}
