.rules-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 0.25rem 0 2.5rem;
  color: var(--text);
}

.rules-kicker {
  margin: 0 0 0.7rem;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

.rules-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--text);
}

.rules-hero h1 span {
  display: block;
  color: var(--accent-bright);
}

.rules-lead {
  max-width: 42rem;
  margin: 1.15rem 0 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.rules-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.6rem 0 0;
}

.rules-toc a {
  flex: 0 1 auto;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.86rem;
  background: var(--bg-panel);
}

.rules-toc a:hover,
.rules-toc a:focus-visible {
  border-color: var(--accent);
  color: var(--accent-bright);
}

.rules-section {
  margin-top: 2.4rem;
  padding-top: 1.7rem;
  border-top: 1px solid var(--border);
}

.rules-section h2,
.rules-block h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
}

.rules-section h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  color: var(--text);
}

.rules-block h3 {
  font-size: 1.02rem;
  color: var(--accent-bright);
}

.rules-section p,
.rules-card p,
.rules-step p,
.rules-flow p,
.rules-list li {
  line-height: 1.65;
}

.rules-section p,
.rules-note {
  color: var(--text-muted);
}

.rules-pair,
.rules-steps,
.rules-flow {
  display: grid;
  gap: 0.9rem;
}

.rules-pair {
  grid-template-columns: 1fr 1fr;
  margin-top: 1rem;
}

.rules-card,
.rules-step,
.rules-flow li {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.05rem 1.05rem;
}

.rules-card h3,
.rules-step h3,
.rules-flow h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.rules-card p,
.rules-step p,
.rules-flow p {
  margin: 0;
}

.rules-steps,
.rules-flow {
  grid-template-columns: repeat(3, 1fr);
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.rules-step,
.rules-flow li {
  position: relative;
}

.rules-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  margin-bottom: 0.55rem;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent-bright);
  font-size: 0.85rem;
  font-weight: 700;
}

.rules-brackets {
  width: 100%;
  margin: 1rem 0;
  border-collapse: separate;
  border-spacing: 0 0.55rem;
}

.rules-sr,
.rules-brackets thead th {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rules-brackets td {
  padding: 0.35rem 0.4rem;
  vertical-align: middle;
}

.rules-brackets tbody tr {
  background: var(--bg-panel);
}

.rules-band {
  width: 6.2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.rules-rounds {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.rules-round {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent-bright);
  font-weight: 700;
  font-size: 0.92rem;
}

.rules-round--optional {
  border-style: dashed;
  color: var(--text-muted);
}

.rules-cut {
  width: 7.2rem;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-bright);
  white-space: nowrap;
}

.rules-callout {
  margin: 1rem 0 0;
  padding: 1rem 1.15rem;
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
}

.rules-callout h3 {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

.rules-callout p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.rules-callout p + p {
  margin-top: 0.55rem;
}

.rules-callout--strong {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-elevated));
}

.rules-list {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}

.rules-list li {
  margin: 0 0 0.75rem;
  padding-left: 0.95rem;
  border-left: 2px solid var(--border-strong);
}

.rules-list strong {
  color: var(--text);
}

.rules-table-scroll {
  margin: 1rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.rules-points,
.rules-check {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.rules-check {
  min-width: 0;
}

.rules-points th,
.rules-points td,
.rules-check th,
.rules-check td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.rules-points thead th,
.rules-check thead th {
  color: var(--accent-bright);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-panel);
}

.rules-points tbody th {
  color: var(--text);
  font-weight: 600;
}

.rules-points th:first-child,
.rules-points td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg);
  box-shadow: 1px 0 0 var(--border);
}

.rules-points thead th:first-child {
  z-index: 2;
  background: var(--bg-panel);
}

.rules-points td {
  text-align: center;
  white-space: nowrap;
}

.rules-points tbody th small {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.rules-bonus {
  color: var(--accent-bright);
  font-weight: 700;
}

.rules-close {
  margin-top: 2.4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.rules-close h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 1.25rem;
}

.rules-close p {
  margin: 0.45rem 0 0;
  color: var(--text-muted);
}

.rules-close__links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.9rem;
}

.rules-close a {
  color: var(--accent-bright);
}

@media (max-width: 800px) {
  .rules-pair,
  .rules-steps,
  .rules-flow {
    grid-template-columns: 1fr;
  }

  .rules-page {
    padding-bottom: 1.5rem;
  }

  .rules-brackets td {
    display: block;
    width: auto;
    text-align: left;
  }

  .rules-cut {
    text-align: left;
    padding-top: 0.15rem;
  }

  .rules-band {
    padding-bottom: 0.15rem;
  }
}

@media print {
  .portal-header,
  .app-sidebar,
  .app-shell-backdrop,
  .portal-footer,
  .portal-flash,
  .toast-container,
  #card-modal,
  #qr-modal {
    display: none !important;
  }

  .app-shell,
  .app-content {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  body.rules-body {
    background: #fff !important;
    color: #161616 !important;
  }

  .rules-page,
  .rules-section p,
  .rules-note,
  .rules-lead,
  .rules-card p,
  .rules-step p,
  .rules-flow p,
  .rules-close p {
    color: #161616 !important;
  }

  .rules-hero h1,
  .rules-hero h1 span,
  .rules-kicker,
  .rules-section h2,
  .rules-block h3,
  .rules-cut,
  .rules-index,
  .rules-round,
  .rules-bonus,
  .rules-callout h3,
  .rules-points thead th,
  .rules-check thead th,
  .rules-close a {
    color: #7a5b24 !important;
  }

  .rules-card,
  .rules-step,
  .rules-flow li,
  .rules-brackets tbody tr,
  .rules-callout,
  .rules-points thead th,
  .rules-check thead th,
  .rules-points th:first-child,
  .rules-points td:first-child {
    background: #fff !important;
    box-shadow: none !important;
  }

  .rules-callout,
  .rules-round,
  .rules-index {
    border-color: #7a5b24 !important;
  }

  .rules-toc a {
    border-color: #ccc !important;
    color: #161616 !important;
    background: #fff !important;
  }

  .rules-points,
  .rules-check,
  .rules-brackets {
    min-width: 0;
  }
}
