.rules-page-shell {
  margin: 0 auto;
  max-width: 80rem;
  width: 100%;
}

.rules-page-toolbar {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dbe4ef;
  border-left: 4px solid var(--tlfl-blue);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgb(15 23 42 / 0.07);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
}

.rules-page-toolbar-label {
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.075em;
  margin: 0 0 0.2rem;
  text-transform: uppercase;
}

.rules-page-toolbar-status {
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 0;
}

.rules-edit-button {
  flex: 0 0 auto;
}

.rules-page {
  color: #1e293b;
  margin: 0 auto;
  max-width: 80rem;
  width: 100%;
}

.rules-hero {
  background:
    radial-gradient(circle at 88% 14%, rgb(147 197 253 / 0.22), transparent 28%),
    radial-gradient(circle at 72% 112%, rgb(96 165 250 / 0.18), transparent 38%),
    linear-gradient(135deg, #0c2451 0%, #123d7f 54%, #1f55ab 100%);
  border: 1px solid rgb(147 197 253 / 0.3);
  border-radius: 14px;
  box-shadow: 0 18px 42px rgb(15 23 42 / 0.2);
  color: #ffffff;
  overflow: hidden;
  padding: clamp(1.35rem, 4vw, 2.4rem);
  position: relative;
}

.rules-hero::after {
  border: 1px solid rgb(255 255 255 / 0.11);
  border-radius: 999px;
  content: "";
  height: 14rem;
  position: absolute;
  right: -5rem;
  top: -7rem;
  width: 14rem;
}

.rules-hero-heading {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.rules-eyebrow {
  color: #bfdbfe;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  margin: 0 0 0.5rem;
  text-transform: uppercase;
}

.rules-hero h1 {
  color: #ffffff;
  font-size: clamp(2.35rem, 6vw, 4rem);
  letter-spacing: -0.035em;
  margin: 0;
}

.rules-hero h1::after {
  background: #93c5fd;
  height: 0.22rem;
  margin-top: 0.65rem;
  width: 4.5rem;
}

.rules-preview-badge {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 999px;
  box-shadow: 0 5px 16px rgb(15 23 42 / 0.18);
  color: #78350f;
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.055em;
  padding: 0.45rem 0.7rem;
  text-transform: uppercase;
}

.rules-hero-lede {
  color: #dbeafe;
  font-size: clamp(1rem, 2.2vw, 1.18rem);
  line-height: 1.55;
  margin: 1.15rem 0 0;
  max-width: 48rem;
  position: relative;
  z-index: 1;
}

.rules-hero-meta {
  color: #bfdbfe;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.82rem;
  font-weight: 750;
  gap: 0.35rem 1.3rem;
  margin-top: 1.25rem;
  position: relative;
  z-index: 1;
}

.rules-hero-meta span {
  align-items: center;
  display: inline-flex;
  gap: 0.45rem;
}

.rules-hero-meta span::before {
  background: #60a5fa;
  border-radius: 999px;
  content: "";
  height: 0.38rem;
  width: 0.38rem;
}

.rules-preview-notice {
  align-items: flex-start;
  background: linear-gradient(135deg, #fffbeb, #fefce8);
  border: 1px solid #facc15;
  border-left: 4px solid #d97706;
  border-radius: 8px;
  box-shadow: 0 7px 18px rgb(120 53 15 / 0.08);
  display: flex;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0.85rem 1rem;
}

.rules-preview-icon {
  align-items: center;
  background: #92400e;
  border-radius: 999px;
  color: #ffffff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.7rem;
  height: 1.55rem;
  justify-content: center;
  margin-top: 0.05rem;
  width: 1.55rem;
}

.rules-preview-notice h2 {
  color: #78350f;
  font-size: 0.95rem;
  margin: 0 0 0.2rem;
}

.rules-preview-notice p {
  color: #713f12;
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0;
}

.rules-quick-facts {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0 0 1.25rem;
}

.rules-quick-fact {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  box-shadow: 0 5px 16px rgb(15 23 42 / 0.06);
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.85rem 0.55rem;
  text-align: center;
}

.rules-quick-fact strong {
  color: var(--tlfl-blue-dark);
  font-size: 1.55rem;
  line-height: 1;
}

.rules-quick-fact span {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.035em;
  line-height: 1.25;
  margin-top: 0.38rem;
  text-transform: uppercase;
}

.rules-layout {
  align-items: start;
  display: grid;
  gap: 1.15rem;
  grid-template-columns: 15.5rem minmax(0, 1fr);
}

.rules-toc {
  background: #ffffff;
  border: 1px solid #dbe4ef;
  border-radius: 9px;
  box-shadow: 0 8px 22px rgb(15 23 42 / 0.07);
  max-height: calc(100vh - var(--tlfl-sticky-action-top) - 1.5rem);
  overflow: auto;
  padding: 0.95rem;
  position: sticky;
  top: calc(var(--tlfl-sticky-action-top) + 0.75rem);
}

.rules-toc-title {
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin: 0 0 0.55rem;
  padding: 0 0 0.6rem;
  text-transform: uppercase;
}

.rules-toc ol {
  counter-reset: rules-toc;
  display: grid;
  gap: 0.08rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.rules-toc li {
  counter-increment: rules-toc;
}

.rules-toc a,
.rules-toc a:visited {
  align-items: baseline;
  border-radius: 5px;
  color: #475569;
  display: grid;
  font-size: 0.8rem;
  font-weight: 750;
  gap: 0.5rem;
  grid-template-columns: 1.45rem minmax(0, 1fr);
  line-height: 1.28;
  padding: 0.35rem 0.4rem;
}

.rules-toc a::before {
  color: #94a3b8;
  content: counter(rules-toc, decimal-leading-zero);
  font-size: 0.64rem;
  font-weight: 900;
}

.rules-toc a:hover,
.rules-toc a:focus-visible {
  background: #eff6ff;
  color: var(--tlfl-blue-dark);
  outline: none;
}

.rules-toc a:focus-visible {
  box-shadow: var(--tlfl-focus-ring);
}

.rules-content {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.rules-section {
  background: #ffffff;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  box-shadow: 0 7px 20px rgb(15 23 42 / 0.065);
  min-width: 0;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  scroll-margin-top: calc(var(--tlfl-sticky-action-top) + 1rem);
}

.rules-section-heading {
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 0.85rem;
  margin: 0 0 1rem;
  padding: 0 0 0.85rem;
}

.rules-section-number {
  align-items: center;
  background: linear-gradient(145deg, #dbeafe, #eff6ff);
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  color: var(--tlfl-blue-dark);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 950;
  height: 2.25rem;
  justify-content: center;
  width: 2.25rem;
}

.rules-section h2 {
  color: #0f172a;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  letter-spacing: -0.015em;
  line-height: 1.18;
  margin: 0;
}

.rules-section h3 {
  color: #1e3a5f;
  font-size: 1.02rem;
  line-height: 1.3;
  margin: 1.25rem 0 0.5rem;
}

.rules-bye-timing-groups {
  display: grid;
  gap: 0.75rem;
  margin: 0.7rem 0 1rem;
}

.rules-section .rules-bye-intro {
  color: #334155;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.rules-bye-timing-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--tlfl-blue);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
}

.rules-bye-timing-group h4 {
  color: #1e3a5f;
  font-size: 0.94rem;
  line-height: 1.35;
  margin: 0;
}

.rules-bye-timing-group ol,
.rules-bye-timing-group ul {
  margin-top: 0.45rem;
}

.rules-bye-average {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-top: 1rem;
  padding: 0.8rem 0.9rem;
}

.rules-bye-average h3 {
  margin-top: 0;
}

.rules-bye-average p:last-child {
  margin-bottom: 0;
}

.rules-section > h3:first-of-type {
  margin-top: 0.25rem;
}

.rules-section p,
.rules-section li {
  font-size: 0.94rem;
  line-height: 1.6;
}

.rules-section p {
  color: #475569;
  margin: 0.7rem 0;
}

.rules-section ul,
.rules-section ol {
  color: #334155;
  margin: 0.55rem 0 0;
  padding-left: 1.35rem;
}

.rules-section li + li {
  margin-top: 0.38rem;
}

.rules-section li::marker {
  color: var(--tlfl-blue);
  font-weight: 850;
}

.rules-callout {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--tlfl-blue);
  border-radius: 7px;
  color: #1e3a5f;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.8rem;
}

.rules-callout-warning {
  background: #fffbeb;
  border-color: #fde68a;
  border-left-color: #d97706;
  color: #78350f;
  margin-top: 1rem;
}

.rules-table-wrap {
  border: 1px solid var(--tlfl-table-border);
  border-radius: 8px;
  margin: 0.75rem 0;
  max-width: 100%;
  overflow-x: auto;
}

.rules-table-compact {
  max-width: 25rem;
}

.rules-table-events {
  max-width: 38rem;
}

.rules-table {
  border-collapse: separate;
  border-spacing: 0;
  color: #334155;
  font-size: 0.88rem;
  min-width: 18rem;
  width: 100%;
}

.rules-table th,
.rules-table td {
  border-bottom: 1px solid var(--tlfl-table-border);
  padding: 0.48rem 0.7rem;
  text-align: left;
}

.rules-table thead th {
  background: #edf3fa;
  color: #1e3a5f;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.rules-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.rules-table tbody tr:last-child th,
.rules-table tbody tr:last-child td {
  border-bottom: 0;
}

.rules-table th:last-child,
.rules-table td:last-child {
  text-align: right;
}

.rules-table tbody th {
  color: #1e293b;
  font-weight: 800;
}

.rules-table-total {
  background: #eaf2fc !important;
  color: #0f2f60;
  font-weight: 900;
}

.rules-table-note {
  color: #64748b !important;
  font-size: 0.8rem !important;
  font-style: italic;
  margin-top: -0.15rem !important;
}

.rules-scoring-grid,
.rules-definition-grid,
.rules-tiebreaker-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rules-scoring-grid {
  align-items: start;
}

.rules-scoring-grid > div,
.rules-definition-grid > section,
.rules-tiebreaker-grid > div {
  min-width: 0;
}

.rules-scoring-grid > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(3rem, auto) auto auto;
}

.rules-scoring-grid > div > h3 {
  grid-row: 1;
}

.rules-scoring-grid > div > p:not(.rules-table-note) {
  grid-row: 2;
}

.rules-scoring-grid > div > .rules-table-wrap {
  grid-row: 3;
}

.rules-scoring-grid > div > .rules-table-note {
  grid-row: 4;
}

.rules-definition-grid {
  margin: 1rem 0;
}

.rules-definition-grid > section,
.rules-tiebreaker-grid > div {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.85rem;
}

.rules-definition-grid h3,
.rules-tiebreaker-grid h3 {
  margin-top: 0;
}

.rules-definition-grid p:last-child {
  margin-bottom: 0;
}

.rules-checklist-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rules-checklist-grid > section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid var(--tlfl-blue);
  border-radius: 7px;
  padding: 0.75rem 0.85rem;
}

.rules-checklist-grid > section:last-child {
  grid-column: 1 / -1;
}

.rules-checklist-grid h3 {
  margin: 0 0 0.4rem;
}

.rules-checklist-grid ul {
  margin-top: 0;
}

.rules-open-policies {
  background: linear-gradient(145deg, #fffdf5, #ffffff 55%);
  border-color: #f5d987;
  border-top: 4px solid #d97706;
}

.rules-open-policies .rules-section-number {
  background: #fef3c7;
  border-color: #fde68a;
  color: #78350f;
}

.rules-closing-note {
  background: #fffbeb;
  border-radius: 6px;
  color: #713f12 !important;
  font-weight: 750;
  margin-top: 1rem !important;
  padding: 0.75rem 0.85rem;
}

.rules-editor-page {
  margin: 0 auto;
  max-width: 88rem;
  width: 100%;
}

.rules-editor-heading {
  align-items: flex-start;
  background:
    radial-gradient(circle at 92% 0%, rgb(147 197 253 / 0.18), transparent 28%),
    linear-gradient(135deg, #0c2451, #174786);
  border: 1px solid rgb(147 197 253 / 0.25);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgb(15 23 42 / 0.16);
  color: #ffffff;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: clamp(1.15rem, 3vw, 1.75rem);
}

.rules-editor-heading h1 {
  color: #ffffff;
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.65rem;
}

.rules-editor-heading h1::after {
  background: #93c5fd;
}

.rules-editor-heading > div > p:last-child {
  color: #dbeafe;
  line-height: 1.5;
  margin: 0;
  max-width: 48rem;
}

.rules-editor-view-link,
.rules-editor-view-link:visited {
  background: rgb(255 255 255 / 0.12);
  border-color: rgb(255 255 255 / 0.35);
  color: #ffffff;
  flex: 0 0 auto;
}

.rules-editor-form {
  min-width: 0;
}

.rules-editor-errors {
  margin-bottom: 1rem;
}

.rules-editor-toolbar {
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  box-shadow: 0 10px 24px rgb(15 23 42 / 0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-bottom: 0.75rem;
  padding: 0.7rem;
  position: sticky;
  top: calc(var(--tlfl-sticky-action-top) + 0.35rem);
  z-index: 950;
}

.rules-editor-toolbar-group {
  align-items: center;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-right: 1rem;
}

.rules-editor-toolbar-group:last-child {
  border-right: 0;
  padding-right: 0;
}

.rules-editor-save-button,
.rules-editor-cancel-button {
  min-height: 2.15rem;
}

.rules-editor-save-status {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 750;
  margin-left: 0.2rem;
  white-space: nowrap;
}

.rules-editor-tool {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  color: #334155;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  min-height: 2rem;
  padding: 0.42rem 0.55rem;
}

.rules-editor-tool:hover,
.rules-editor-tool:focus-visible {
  background: #eaf2fc;
  border-color: var(--tlfl-blue);
  color: var(--tlfl-blue-dark);
}

.rules-editor-tool:focus-visible {
  box-shadow: var(--tlfl-focus-ring);
  outline: 0;
}

.rules-editor-tool-bold {
  font-size: 0.9rem;
  font-weight: 950;
  min-width: 2rem;
}

.rules-editor-tool-italic {
  font-family: Georgia, serif;
  font-size: 0.92rem;
  font-style: italic;
  min-width: 2rem;
}

.rules-editor-tool-danger {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.rules-editor-tool-danger:hover,
.rules-editor-tool-danger:focus-visible {
  background: #c2410c;
  border-color: #c2410c;
  color: #ffffff;
}

.rules-editor-help {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--tlfl-blue);
  border-radius: 7px;
  color: #334155;
  font-size: 0.84rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.8rem;
}

.rules-editor-canvas-wrap {
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0.45) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(315deg, rgb(255 255 255 / 0.45) 25%, transparent 25%) 0 0 / 18px 18px,
    #dfe7f1;
  border: 1px solid #bac8d9;
  border-radius: 11px;
  box-shadow: inset 0 1px 5px rgb(15 23 42 / 0.08);
  min-width: 0;
  padding: clamp(0.55rem, 2vw, 1.1rem);
}

.rules-editor-canvas {
  min-height: 36rem;
  outline: none;
}

.rules-editor-canvas:focus-visible {
  border-radius: 10px;
  box-shadow: 0 0 0 4px rgb(31 85 171 / 0.2);
}

.rules-editor-canvas .rules-page {
  background: var(--tlfl-page-background);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgb(15 23 42 / 0.14);
  box-sizing: border-box;
  padding: clamp(0.55rem, 2vw, 1rem);
}

.rules-editor-canvas .rules-section,
.rules-editor-canvas .rules-hero,
.rules-editor-canvas .rules-quick-fact,
.rules-editor-canvas .rules-preview-notice {
  cursor: text;
  transition: outline-color 120ms ease;
}

.rules-editor-canvas .rules-section:hover,
.rules-editor-canvas .rules-hero:hover,
.rules-editor-canvas .rules-quick-fact:hover,
.rules-editor-canvas .rules-preview-notice:hover {
  outline: 2px dashed rgb(31 85 171 / 0.35);
  outline-offset: 2px;
}

.rules-editor-canvas .rules-system-field {
  background: rgb(15 23 42 / 0.22);
  border: 1px dashed rgb(191 219 254 / 0.75);
  border-radius: 4px;
  cursor: not-allowed;
  padding: 0.12rem 0.28rem;
}

@media (max-width: 68rem) {
  .rules-layout {
    display: block;
  }

  .rules-toc {
    margin-bottom: 1rem;
    max-height: none;
    position: static;
  }

  .rules-toc ol {
    gap: 0.1rem 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rules-editor-toolbar {
    position: static;
  }

  .rules-editor-toolbar-group {
    border-right: 0;
    padding-right: 0;
    width: 100%;
  }
}

@media (max-width: 46rem) {
  .rules-page-toolbar,
  .rules-editor-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .rules-edit-button,
  .rules-editor-view-link {
    align-self: flex-start;
  }

  .rules-hero-heading {
    display: block;
  }

  .rules-preview-badge {
    display: inline-block;
    margin-top: 1rem;
  }

  .rules-hero-meta {
    display: grid;
    gap: 0.35rem;
  }

  .rules-quick-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rules-quick-fact:last-child {
    grid-column: 1 / -1;
  }

  .rules-toc ol,
  .rules-scoring-grid,
  .rules-definition-grid,
  .rules-tiebreaker-grid,
  .rules-checklist-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .rules-scoring-grid > div {
    display: block;
  }

  .rules-checklist-grid > section:last-child {
    grid-column: auto;
  }

  .rules-section-heading {
    align-items: flex-start;
  }

  .rules-section-number {
    height: 2rem;
    width: 2rem;
  }

  .rules-section p,
  .rules-section li {
    font-size: 0.91rem;
  }
}

@media print {
  .rules-page-toolbar,
  .rules-editor-heading,
  .rules-editor-toolbar,
  .rules-editor-help {
    display: none;
  }

  .rules-preview-notice,
  .rules-toc {
    display: none;
  }

  .rules-hero {
    background: #12366f;
    box-shadow: none;
  }

  .rules-section {
    break-inside: avoid;
    box-shadow: none;
  }
}
