.rules-screen {
  align-items: stretch; max-width: 1180px; margin: 0 auto;
  padding: 24px 16px; overflow-y: auto;
}
/* 2-col grid uses horizontal space; align-items:stretch makes side-by-side
   cards share height; grid-auto-flow:dense back-fills holes left by
   full-width sections. */
.rules-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: stretch;
  grid-auto-flow: dense;
}
.rules-section.rules-section-wide { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .rules-body { grid-template-columns: 1fr; }
  .rules-section.rules-section-wide { grid-column: auto; }
}
/* Flex column so body stretches + trailing rules-note(s) pin to bottom edge
   when a short section inherits extra height from its taller row-mate. */
.rules-section {
  border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg); padding: 12px 14px;
  display: flex; flex-direction: column;
}
.rules-section-hdr {
  margin: 0; font-size: 1.05rem; color: var(--accent-gold);
  text-transform: uppercase; letter-spacing: 0.5px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; user-select: none; padding-bottom: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent-gold) 20%, transparent);
}
.rules-section-hdr:hover { color: #f0d97a; }
.rules-section-hdr:last-child { border-bottom: none; padding-bottom: 0; }
.rules-section-body {
  padding-top: 8px;
  display: flex; flex-direction: column; flex: 1 1 auto;
}
.rules-section p, .rules-section li {
  font-size: 0.9rem; line-height: 1.65; margin: 0 0 8px;
  /* hyphens:auto breaks long words on narrow viewports so justify doesn't
     produce huge word-gaps. Browser uses page's `lang` attribute. */
  text-align: justify;
  hyphens: auto; -webkit-hyphens: auto; -ms-hyphens: auto;
}
.rules-section ol, .rules-section ul { padding-left: 20px; margin: 0 0 8px; }
.rules-section li { margin-bottom: 4px; }
/* Tiny bottom gap so the gold note bar doesn't touch the table border. */
.rules-section table { margin-bottom: 6px; }

/* Aliased into .data-table chrome; rules-page specifics + responsive
   collapse-to-stacked-cards driven by data-label attributes. */
.rules-table {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
  table-layout: auto;
}
.rules-table tbody td strong          { color: var(--accent-gold); }
.rules-table tbody td:first-child     { white-space: nowrap; }
.rules-table-6col tbody td:first-child { width: 48px; text-align: center; font-size: 1.05rem; }

/* Explicit narrow widths on first three cols so auto-layout gives Description
   (col 4) the rest of the row. */
.rules-table-4col thead th:nth-child(1),
.rules-table-4col tbody td:nth-child(1) { width: 110px; }
.rules-table-4col thead th:nth-child(2),
.rules-table-4col tbody td:nth-child(2) { width: 150px; }
.rules-table-4col thead th:nth-child(3),
.rules-table-4col tbody td:nth-child(3) { width: 120px; white-space: nowrap; }
.rules-table-4col thead th:nth-child(4),
.rules-table-4col tbody td:nth-child(4) { width: auto; }

/* SPECIFICITY GOTCHA: desktop fixed-width rules `.rules-table-4col tbody
   td:nth-child(N)` are (0,2,1) — they BEAT `.rules-table td` (0,2,0)
   regardless of cascade order. The mobile reset MUST match (0,2,1) inside
   the @media or tables overflow horizontally on narrow screens. */
@media (max-width: 600px) {
  .rules-table thead { display: none; }
  .rules-table, .rules-table tbody, .rules-table tr, .rules-table td { display: block; width: 100%; }
  .rules-table tr {
    border-bottom: 1px solid var(--border-color);
    padding: 6px 0;
  }
  .rules-table tr:last-child { border-bottom: 0; }
  /* SPECIFICITY BUMP: desktop base `.rules-table tbody td { border-bottom }`
     (0,2,0) lives LATER in the file (data-table shared block) and would win
     by source order. .rules-section ancestor pushes us to (0,3,0). */
  .rules-section .rules-table tbody td {
    padding: 4px 10px;
    border-bottom: 0;
    white-space: normal;
  }
  /* (0,2,1) specificity to override desktop fixed-width rules when stacked. */
  .rules-table-4col tbody td:nth-child(1),
  .rules-table-4col tbody td:nth-child(2),
  .rules-table-4col tbody td:nth-child(3),
  .rules-table-4col tbody td:nth-child(4),
  .rules-table-6col tbody td:first-child,
  .rules-table tbody td:first-child {
    width: 100%;
    white-space: normal;
    text-align: left;
  }
  .rules-table tbody td:before {
    content: attr(data-label) ": ";
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: inline-block;
    margin-right: 4px;
  }
  .rules-table-6col tbody td:first-child { font-size: 1rem; }
  .rules-table tbody td { word-wrap: break-word; overflow-wrap: anywhere; }
}
.rules_example {
  font-size:0.85rem !important; background: rgba(100,180,100,0.07);
  border-left: 3px solid #5a9e5a; padding: 8px 12px; border-radius: 0 4px 4px 0;
  margin-top: 10px !important; color: #ffffff !important;
}
.rules_example-block {
  background: rgba(255,255,255,0.03); border-radius: 6px; padding: 14px 16px;
  font-size: 0.88rem;
}
.rules_example-block ol { padding-left: 18px; }
.rules_example-block li { margin-bottom: 6px; color: #e8e8e8; }

@media (max-width: 480px) {
  .rules-section { padding: 14px; }
  .rules-section h3 { font-size: 0.95rem; }
}
