/* ee365 — страница «Правила». Подключается после styles.css.
   Задача страницы — удобное чтение: узкая колонка текста (~68 знаков в строке), крупный кегль,
   увеличенный межстрочный интервал, содержание сбоку с подсветкой текущего раздела. */

.rules-hero { max-width: 980px; }
.rules-hero__note {
  margin-top: 28px; max-width: 720px;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 20px;
  border-radius: 10px 24px 24px 24px;
  background: var(--c-sand);
  font-size: clamp(15px, 1vw, 17px); line-height: 1.45;
}
.rules-hero__note svg { flex: none; margin-top: 1px; color: var(--c-green-dark); }

/* ---------- Коротко о главном ---------- */
.rules-key__title { font-weight: 300; font-size: var(--fs-h2); line-height: 1.15; letter-spacing: -.01em; }
.rules-key__grid {
  margin-top: clamp(22px, 2.6vw, 40px);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(10px, 1.2vw, 18px);
}
.key {
  display: flex; flex-direction: column; gap: 10px;
  padding: clamp(18px, 1.6vw, 26px);
  border-radius: 15px 15px 30px 30px;
  background: var(--c-sand);
}
.key--green { background: var(--c-green); }
.key__num { font-family: var(--f-pixel); font-weight: 400; font-size: clamp(34px, 2.8vw, 52px); line-height: 1; letter-spacing: -.01em; }
.key__text { font-size: clamp(15px, 1vw, 17px); line-height: 1.35; }
.key__link {
  margin-top: auto; align-self: flex-start;
  display: inline-flex; align-items: center; min-height: 36px;
  font-family: var(--f-mono); font-size: 13px;
  text-decoration: underline; text-underline-offset: 3px;
}
.key__link:hover { color: var(--c-green-dark); }
.key--green .key__link:hover { color: var(--c-ink); text-decoration-thickness: 2px; }

/* ---------- Правила целиком ---------- */
.rules__layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: clamp(30px, 5vw, 100px);
  align-items: start;
}

/* Содержание: «прилипает» сбоку */
.toc { position: sticky; top: 100px; }
.toc__box summary { list-style: none; }
.toc__box summary::-webkit-details-marker { display: none; }
.toc__title {
  font-family: var(--f-mono); font-size: 14px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--c-ink-soft);
  pointer-events: none;
}
.toc__list {
  margin: 16px 0 0; padding: 0; list-style: none;
  counter-reset: toc;
  display: grid; gap: 2px;
  border-left: 1px dashed rgba(17, 17, 15, .25);
}
.toc__list li { counter-increment: toc; }
.toc__list a {
  position: relative;
  display: flex; gap: 10px;
  padding: 7px 0 7px 18px;
  font-size: 15px; line-height: 1.3;
  color: var(--c-ink-soft);
  transition: color .2s;
}
.toc__list a::before {
  content: counter(toc, decimal-leading-zero);
  flex: none; width: 22px;
  font-family: var(--f-mono); font-size: 12px; line-height: 1.6;
}
.toc__list a::after {
  content: ""; position: absolute; left: -2px; top: 6px; bottom: 6px; width: 3px;
  border-radius: 2px; background: transparent; transition: background-color .2s;
}
.toc__list a:hover { color: var(--c-ink); }
.toc__list a.is-active { color: var(--c-ink); font-weight: 500; }
.toc__list a.is-active::after { background: var(--c-green); }

/* Текст правил */
.rules__list { max-width: 760px; }
.rule {
  scroll-margin-top: 100px;
  padding: clamp(28px, 3vw, 44px) 0;
  border-top: 1px dashed rgba(17, 17, 15, .25);
  font-size: clamp(17px, 1.15vw, 19px);
  line-height: 1.65;
}
.rule:first-child { padding-top: 0; border-top: 0; }
.rule p + p, .rule p + ul, .rule ul + p, .rule p + table, .rule table + p { margin-top: 14px; }
.rule__title {
  display: flex; align-items: baseline; gap: 16px;
  font-weight: 400; font-size: clamp(24px, 2vw, 34px); line-height: 1.2; letter-spacing: -.01em;
}
.rule__num {
  flex: none;
  font-family: var(--f-pixel); font-weight: 400; font-size: .9em; line-height: 1;
  color: var(--c-green-dark);
}
.rule__lead { margin-top: 18px; font-size: clamp(18px, 1.3vw, 21px); line-height: 1.55; }
.rule b { font-weight: 600; }
.rule__note {
  margin-top: 18px !important;
  padding: 14px 18px;
  border-radius: 10px 22px 22px 22px;
  background: var(--c-sand);
  font-size: clamp(15px, 1vw, 17px); line-height: 1.5;
}
.rule__list { margin-top: 14px; padding: 0; list-style: none; display: grid; gap: 10px; }
.rule__list li { position: relative; padding-left: 30px; }
.rule__list li::before {
  content: ""; position: absolute; left: 2px; top: .45em;
  width: 16px; height: 16px;
  background: var(--c-green-dark);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.rule__list--cross li::before {
  background: #a0441b;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
}

.rule__table {
  margin-top: 16px; width: 100%;
  border-collapse: separate; border-spacing: 0;
  border-radius: 16px; overflow: hidden;
  background: var(--c-sand);
  font-size: clamp(15px, 1.05vw, 18px); line-height: 1.4;
}
.rule__table th, .rule__table td { padding: 14px 20px; text-align: left; vertical-align: top; }
.rule__table thead th { font-family: var(--f-mono); font-size: 13px; font-weight: 400; color: var(--c-ink-soft); background: rgba(17, 17, 15, .05); }
.rule__table tbody tr + tr td { border-top: 1px dashed rgba(17, 17, 15, .2); }
.rule__table td:last-child { font-weight: 500; white-space: nowrap; }

.rule--main {
  margin-top: 10px;
  padding: clamp(24px, 2.6vw, 40px) !important;
  border: 0;
  border-radius: 10px 30px 30px 30px;
  background: var(--c-green);
}
.rule--main .rule__num { color: var(--c-ink); }
.rule--main .rule__list li::before { background: var(--c-ink); }

.rules__help {
  margin-top: clamp(30px, 3vw, 50px);
  padding: clamp(24px, 2.6vw, 40px);
  border-radius: 20px;
  background: var(--c-ink); color: var(--c-paper);
}
.rules__help-title { font-weight: 300; font-size: clamp(24px, 2vw, 34px); line-height: 1.2; }
.rules__help-text { margin-top: 10px; font-size: clamp(16px, 1.1vw, 19px); color: rgba(243, 232, 210, .8); }
.rules__help-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 12px; }
.rules__help .btn--ghost { border-color: var(--c-paper); color: var(--c-paper); }
.rules__help .btn--ghost:hover { background: var(--c-paper); color: var(--c-ink); }

/* ---------- Планшет ---------- */
@media (max-width: 1199px) {
  .rules-key__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .rules__layout { grid-template-columns: 1fr; gap: 28px; }
  .rules__list { max-width: none; }
  /* Содержание — раскрывающийся список над текстом */
  .toc { position: static; }
  .toc__box { padding: 4px 20px; border-radius: 16px; background: var(--c-sand); }
  .toc__title {
    pointer-events: auto; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    min-height: 52px;
  }
  .toc__title::after { content: "+"; font-size: 22px; line-height: 1; transition: transform .25s; }
  .toc__box[open] .toc__title::after { transform: rotate(45deg); }
  .toc__list { margin: 0 0 14px; border-left: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
  .toc__list a { padding-left: 0; min-height: 40px; align-items: center; }
  .toc__list a::after { display: none; }
}

/* ---------- Телефон ---------- */
@media (max-width: 767px) {
  .rules-key__grid { grid-template-columns: 1fr; gap: 8px; }
  .key { display: grid; grid-template-columns: 136px minmax(0, 1fr); column-gap: 14px; row-gap: 4px; align-items: baseline; padding: 16px 18px; }
  .key__num { font-size: 27px; white-space: nowrap; grid-row: span 2; }
  .key__link { margin-top: 0; min-height: 32px; }
  .toc__list { grid-template-columns: 1fr; }
  .rule { line-height: 1.6; }
  .rule__title { gap: 12px; }
  .rule__table th, .rule__table td { padding: 12px 14px; }
  .rule__table td:last-child { white-space: normal; }
  .rules__help-actions .btn { width: 100%; }
}
