/* ═══════════════════════════════════════════════
   RULES PAGE — Official regulation document style
   Works on both arena (logged-in) and landing layouts
   ═══════════════════════════════════════════════ */

.rules-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

/* When inside arena layout, the parent already provides max-width and padding */
.arena-main .rules-page {
  max-width: none;
  padding: 0;
}

.rules-inner {
  max-width: 800px;
  margin: 0 auto;
}

.arena-main .rules-inner {
  max-width: none;
}

/* ── HEADER ── */

.rules-header {
  text-align: center;
  padding: 3rem 0 2.5rem;
  border-bottom: 2px solid var(--border, #E2E8E4);
  margin-bottom: 2.5rem;
}

.rules-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--green-primary, #2D6A4F);
  background: var(--green-wash, #F0F7F2);
  border: 1px solid var(--green-pale, #D8F3DC);
  border-radius: 4px;
  padding: 0.35rem 1rem;
  margin-bottom: 1.5rem;
}

.rules-title {
  font-family: var(--font-display, 'Sora', sans-serif);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-primary, #1A2A1E);
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.rules-subtitle {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary, #4A5D50);
  margin: 0 0 0.5rem;
}

.rules-updated {
  font-size: 0.8rem;
  color: var(--text-muted, #8A9B8F);
  margin: 0;
}

/* ── TABLE OF CONTENTS ── */

.rules-toc {
  background: var(--bg-card, #F8FAF9);
  border: 1px solid var(--border, #E2E8E4);
  border-radius: 8px;
  padding: 1.5rem 2rem;
  margin-bottom: 3rem;
}

.rules-toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted, #8A9B8F);
  margin: 0 0 1rem;
}

.rules-toc-list {
  margin: 0;
  padding-left: 1.25rem;
  list-style-type: decimal;
}

.rules-toc-list li {
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.rules-toc-list a {
  color: var(--text-primary, #1A2A1E);
  text-decoration: none;
  transition: color 0.15s ease;
}

.rules-toc-list a:hover {
  color: var(--green-primary, #2D6A4F);
  text-decoration: underline;
}

/* ── CHAPTERS ── */

.rules-chapter {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border, #E2E8E4);
}

.rules-chapter:last-of-type {
  border-bottom: none;
}

.rules-chapter-number {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--green-primary, #2D6A4F);
  margin-bottom: 0.25rem;
}

.rules-chapter-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary, #1A2A1E);
  margin: 0 0 1.5rem;
  letter-spacing: -0.01em;
}

/* ── ARTICLES ── */

.rules-article {
  margin-bottom: 1.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--border, #E2E8E4);
}

.rules-article h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary, #4A5D50);
  margin: 0 0 0.5rem;
  letter-spacing: 0.02em;
}

.rules-article p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-primary, #1A2A1E);
  margin: 0 0 0.75rem;
}

.rules-article ol {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-primary, #1A2A1E);
  margin: 0 0 0.75rem;
  padding-left: 1.5rem;
}

.rules-article ol li {
  margin-bottom: 0.3rem;
}

/* Warning article — infractions */

.rules-article-warning {
  border-left-color: var(--red-warning, #DC2626);
  background: rgba(220, 38, 38, 0.03);
  padding: 1rem 1rem 0.25rem;
  border-radius: 0 6px 6px 0;
}

/* ── TABLES ── */

.rules-table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.rules-table th {
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #8A9B8F);
  padding: 0.6rem 1rem;
  border-bottom: 2px solid var(--border, #E2E8E4);
  background: var(--bg-card, #F8FAF9);
}

.rules-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border, #E2E8E4);
  color: var(--text-primary, #1A2A1E);
}

.rules-table tbody tr:last-child td {
  border-bottom: none;
}

.rules-table-compact {
  max-width: 300px;
}

/* ── FORMULA ── */

.rules-formula {
  background: var(--bg-card, #F8FAF9);
  border: 1px solid var(--border, #E2E8E4);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  color: var(--green-primary, #2D6A4F);
  margin: 1rem 0;
}

/* ── TEXT COLORS ── */

.rules-text-green {
  color: var(--green-primary, #2D6A4F);
}

.rules-text-red {
  color: var(--red-warning, #DC2626);
}

/* ── FOOTER ── */

.rules-footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 1rem;
  border-top: 2px solid var(--border, #E2E8E4);
}

.rules-footer-text {
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--text-muted, #8A9B8F);
}

/* ── LANDING LAYOUT OVERRIDES ── */

.landing-body .rules-page {
  padding-top: 5rem;
  padding-bottom: 4rem;
}

.landing-body .rules-badge {
  color: var(--green-electric, #00e85a);
  background: rgba(0, 232, 90, 0.08);
  border-color: rgba(0, 232, 90, 0.2);
}

.landing-body .rules-chapter-number {
  color: var(--green-electric, #00e85a);
}

.landing-body .rules-formula {
  color: var(--green-electric, #00e85a);
  background: var(--bg-card, #0d1f15);
  border-color: var(--green-muted, #1a3d28);
}

.landing-body .rules-toc {
  background: var(--bg-card, #0d1f15);
  border-color: var(--green-muted, #1a3d28);
}

.landing-body .rules-toc-list a:hover {
  color: var(--green-electric, #00e85a);
}

.landing-body .rules-table th {
  background: var(--bg-card, #0d1f15);
  border-color: var(--green-muted, #1a3d28);
}

.landing-body .rules-table td {
  border-color: rgba(26, 61, 40, 0.5);
}

.landing-body .rules-article-warning {
  background: rgba(255, 68, 68, 0.05);
}

/* ── RESPONSIVE ── */

@media (max-width: 640px) {
  .rules-page {
    padding: 1rem;
  }

  .rules-title {
    font-size: 1.6rem;
  }

  .rules-chapter-title {
    font-size: 1.2rem;
  }

  .rules-toc {
    padding: 1rem 1.25rem;
  }

  .rules-article {
    padding-left: 0.75rem;
  }

  .rules-table {
    font-size: 0.8rem;
  }

  .rules-table th,
  .rules-table td {
    padding: 0.5rem 0.6rem;
  }
}
