.rules-page { min-width: 0; }
.rules-filters { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 290px) minmax(150px, 230px) 36px; gap: 12px; align-items: end; }
.rules-filters label { display: grid; gap: 8px; min-width: 0; font-size: 13px; font-weight: 400; color: var(--muted); }
.rules-filters input, .rules-filters select { width: 100%; height: 40px; min-width: 0; font-size: 14px; font-weight: 400; }
.rules-filters .icon-button { width: 36px; height: 40px; padding: 0; }
.rules-search-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-height: 44px; padding: 10px 0; font-size: 12px; color: var(--muted); }
#rulesIndexStatus { margin-left: auto; }
.rules-layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); height: max(440px, calc(100dvh - 395px)); max-height: 980px; min-width: 0; border: 1px solid var(--line); border-radius: 0 6px 6px 0; overflow: hidden; }
.rules-results { min-width: 0; overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg); scrollbar-gutter: stable; }
.rules-group { border-bottom: 1px solid var(--line); }
.rules-group > summary { display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer; padding: 14px 12px; font-size: 12px; font-weight: 550; color: var(--muted); }
.rules-group > summary::-webkit-details-marker { display: none; }
.rules-group > summary::before { content: ''; display: block; width: 14px; height: 14px; flex: 0 0 14px; background: currentColor; mask: url('./assets/icons/chevron-down.svg') center / contain no-repeat; transform: rotate(-90deg); }
.rules-group[open] > summary::before { transform: none; }
.rules-group > summary > span { margin-left: auto; font-size: 11px; font-weight: 400; }
.rules-group > summary:hover, .rules-result:hover { background: var(--soft); }
.rules-result { display: grid; gap: 6px; width: 100%; border: 0; border-top: 1px solid var(--line); border-left: 3px solid transparent; border-radius: 0; padding: 13px 14px; text-align: left; background: transparent; color: var(--ink); }
.rules-result strong { font-size: 13px; line-height: 1.45; font-weight: 550; overflow-wrap: anywhere; }
.rules-result > span { display: flex; gap: 8px; font-size: 11px; font-weight: 400; color: var(--muted); }
.rules-result-page { margin-left: auto; font-variant-numeric: tabular-nums; }
.rules-result small { font-size: 12px; line-height: 1.6; font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }
.rules-result .rules-result-parent { font-size: 11px; }
.rules-result[aria-current="true"] { border-left-color: var(--red); background: var(--red-deep); }
.rules-result[aria-current="true"] strong { color: var(--red); }
.rules-reader { min-height: 0; min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--paper); }
.rules-reader-header { display: flex; align-items: center; gap: 12px; padding: 20px 26px; border-bottom: 1px solid var(--line); }
.rules-reader-header > div { min-width: 0; }
.rules-reader-header p { margin: 0 0 7px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.rules-reader-header h2 { margin: 0; font-size: 20px; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.rules-back { display: none !important; }
.rules-article { min-width: 0; overflow-y: auto; position: relative; padding: 28px; scrollbar-gutter: stable; }
.rules-prose { width: 100%; min-width: 0; }
.rules-prose p { margin: 0 0 16px; font-size: 15px; line-height: 1.8; font-weight: 400; overflow-wrap: anywhere; }
.rules-prose h3 { margin: 28px 0 12px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 16px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.rules-prose h3:first-child { margin-top: 0; padding-top: 0; border: 0; }
.rules-list { margin: 0 0 20px; padding-left: 24px; font-size: 15px; line-height: 1.8; }
.rules-list li { padding-left: 4px; margin: 4px 0; overflow-wrap: anywhere; }
.rules-table-wrap { max-width: 100%; overflow-x: auto; margin: 16px 0 24px; }
.rules-table { width: 100%; border-collapse: collapse; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.6; color: var(--ink); font-variant-numeric: tabular-nums; }
.rules-table th, .rules-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); min-width: 72px; }
.rules-table th { color: var(--muted); font-size: 12px; font-weight: 600; background: var(--paper); }
.rules-table td { font-weight: 400; }
.rules-table tbody tr:nth-child(even) { background: #ffffff03; }
.rules-table tbody tr:hover { background: var(--soft); }
.rules-reader-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); }
.rules-reader-toolbar > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rules-reader-toolbar .icon-button { width: 36px; height: 36px; padding: 0; flex-shrink: 0; }
.rules-page mark { color: var(--ink); background: #50502e; border-radius: 2px; }
.rules-empty { padding: 20px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.rules-attribution { margin-top: 16px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.rules-attribution summary { width: fit-content; cursor: pointer; padding: 8px 0; }
.rules-attribution p { max-width: 90ch; margin: 8px 0; }
@media (min-width: 1800px) {
  .rules-layout { grid-template-columns: 340px minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  .rules-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; }
  .rules-filters .rules-search { grid-column: 1 / -1; }
  .rules-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .rules-reader-header { padding: 18px; }
  .rules-article { padding: 20px; }
}
@media (max-width: 760px) {
  .rules-filters { gap: 10px; }
  .rules-filters > label:nth-child(2) { grid-column: 1 / 3; }
  .rules-filters > label:nth-child(3) { grid-column: 1 / -1; grid-row: 3; }
  .rules-filters > .icon-button { grid-column: 3; grid-row: 2; }
  .rules-layout { grid-template-columns: minmax(0, 1fr); height: max(500px, calc(100dvh - 310px)); }
  .rules-results { border-right: 0; }
  .rules-layout:not([data-reading="true"]) .rules-reader { display: none; }
  .rules-layout[data-reading="true"] .rules-results { display: none; }
  .rules-page:has(.rules-layout[data-reading="true"]) .rules-filters,
  .rules-page:has(.rules-layout[data-reading="true"]) .rules-search-status { display: none; }
  .rules-layout[data-reading="true"] { height: max(460px, calc(100dvh - 285px)); }
  .rules-back { display: inline-flex !important; flex-shrink: 0; }
  .rules-reader-header h2 { font-size: 18px; }
  .rules-reader-header { padding: 14px; }
  .rules-article { padding: 18px; }
  .rules-reader-toolbar { justify-content: center; gap: 6px; padding: 12px 8px; }
  #rulesIndexStatus { margin-left: 0; }
}
