/* Rules: the page regles.html, the drawer of the game screen, the previews and the « ? » buttons. */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ text of the rules */
.rules { line-height: 1.6; font-size: 15px; max-width: 860px; }
.rules-cover h1 { font: 600 34px var(--serif); margin: 0 0 8px; }
.rules-intro { border-left: 3px solid var(--gold); padding: 2px 0 2px 16px; color: var(--muted); margin-bottom: 10px; }
.rules-intro p { margin: 4px 0; }
.rules h2 { font: 600 26px var(--serif); margin: 34px 0 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.rules h3 { font: 600 19px var(--serif); margin: 24px 0 8px; }
.rules p { margin: 8px 0; }
.rules ul, .rules ol { padding-left: 24px; margin: 8px 0; }
.rules li { margin: 3px 0; }
.rules code { font: 13px var(--mono); background: var(--row-hover); padding: 1px 4px; border-radius: 4px; }
.rules .ranchor { color: var(--line); text-decoration: none; margin-right: 8px; font-family: var(--mono); font-size: .75em; vertical-align: 2px; }
.rules h2:hover .ranchor, .rules h3:hover .ranchor { color: var(--gold); }
.rules a.rterm, .rules a.rref { color: inherit; text-decoration: underline dotted var(--gold); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.rules a.rref { color: var(--accent); font-weight: 600; text-decoration-style: solid; }
.rules a.rterm:hover, .rules a.rref:hover { color: var(--accent); text-decoration-color: var(--accent); }
.rtable { overflow-x: auto; margin: 10px 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.rtable table { border-collapse: collapse; width: 100%; font-size: 13.5px; line-height: 1.45; }
.rtable th { text-align: left; font-weight: 600; background: var(--row-hover); padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rtable td { padding: 6px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.rtable tr:first-child td { border-top: 0; }
.rtable tr[id] td:first-child { font-weight: 600; }
mark.rules-hit { background: var(--gold-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.rules-flash { animation: rules-flash 1.8s ease-out; }
@keyframes rules-flash { 0%, 30% { background: var(--gold-soft); } 100% { background: transparent; } }

/* ------------------------------------------------------------------ page regles.html */
body.rules-page { min-height: 100vh; background: var(--bg); }
.rules-bar { display: flex; align-items: center; gap: 16px 20px; padding: 12px 24px; background: var(--side); color: var(--side-ink); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.rules-search { flex: 1 1 260px; max-width: 460px; }
.rules-search input { width: 100%; border: 1px solid var(--side-hover); border-radius: 8px; padding: 8px 12px; background: var(--side-hover); color: var(--side-ink); }
.rules-search input::placeholder { color: var(--side-muted); }
.rules-count { color: var(--side-muted); font-size: 13px; }
.rules-bar .play-links { display: flex; gap: 16px; align-items: center; margin-left: auto; }
.rules-bar .play-links a { text-decoration: none; }
.rules-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 36px; max-width: 1260px; margin: 0 auto; padding: 24px 24px 80px; }
.rules-side { position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; font-size: 13.5px; }
#rules-toc ol { list-style: none; padding: 0; margin: 0; }
#rules-toc > ol > li { margin: 2px 0 8px; }
#rules-toc > ol > li > a { font-weight: 600; }
#rules-toc ol ol { padding-left: 12px; border-left: 1px solid var(--line); margin: 3px 0 0 4px; }
#rules-toc a { display: block; padding: 2px 6px; border-radius: 5px; color: var(--muted); text-decoration: none; }
#rules-toc > ol > li > a { color: var(--ink); }
#rules-toc a:hover { background: var(--row-hover); color: var(--ink); }
#rules-toc a.current { color: var(--accent); background: var(--row-hover); }
#toc-toggle { display: none; }
@media (max-width: 900px) {
  .rules-layout { grid-template-columns: 1fr; padding: 16px 16px 60px; }
  .rules-side { display: none; position: fixed; inset: 64px 0 0 0; max-height: none; background: var(--bg); padding: 16px; z-index: 4; top: auto; }
  body.toc-open .rules-side { display: block; }
  #toc-toggle { display: inline; }
  .rules-bar { padding: 10px 16px; }
}

/* ------------------------------------------------------------------ preview on hover */
.rules-popover { position: fixed; z-index: 60; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); font-size: 13px; line-height: 1.45; max-height: 50vh; overflow: hidden; pointer-events: none; }
.rules-popover > strong { display: block; font: 600 15px var(--serif); margin-bottom: 4px; }
.rules-popover p { margin: 4px 0; }
.rules-popover dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 4px 0 0; }
.rules-popover dt { color: var(--muted); font-size: 12px; }
.rules-popover dd { margin: 0; }
.rules-popover .rtable { font-size: 12px; }
.rules-popover ul, .rules-popover ol { margin: 4px 0; padding-left: 18px; }

/* ------------------------------------------------------------------ « ? » buttons and links in the game */
.rules-q { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; margin-left: 6px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--muted); font: 600 11px/1 var(--mono); vertical-align: 2px; flex: none; }
.rules-q:hover { color: var(--accent); border-color: var(--accent); }
[data-rules]:not(.rules-q):not(button) { cursor: help; }
.rules-home { margin-top: 26px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.rules-home h2 { font: 600 20px var(--serif); margin: 0 0 4px; }
.rules-home p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.rules-links { display: flex; flex-wrap: wrap; gap: 8px; }
.rules-links a { align-self: center; color: var(--accent); font-size: 14px; }

/* ------------------------------------------------------------------ drawer of the game screen */
.rules-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); z-index: 50; background: var(--bg); border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(0, 0, 0, .18); display: flex; flex-direction: column; }
.rules-drawer-head { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 8px 10px; align-items: center; padding: 12px 16px; background: var(--side); color: var(--side-ink); }
.rules-drawer-head strong { font: 600 18px var(--serif); }
.rules-drawer-head button, .rules-drawer-head .rules-tab { border: 0; background: none; color: var(--side-ink); font-size: 18px; padding: 2px 6px; text-decoration: none; }
.rules-drawer-head button:disabled { opacity: .35; cursor: default; }
.rules-drawer-head select { min-width: 0; border: 1px solid var(--side-hover); border-radius: 6px; padding: 5px 8px; background: var(--side-hover); color: var(--side-ink); font-size: 13px; }
.rules-drawer-head .rules-find { grid-column: 1 / 5; border: 1px solid var(--side-hover); border-radius: 6px; padding: 6px 10px; background: var(--side-hover); color: var(--side-ink); }
.rules-drawer-head .rules-count { grid-column: 5; text-align: right; }
.rules-missing { margin: 0; padding: 8px 16px; background: var(--row-hover); color: var(--accent); font-size: 13px; }
.rules-entry { padding: 12px 18px; background: var(--paper); border-bottom: 1px solid var(--line); font-size: 13.5px; line-height: 1.45; max-height: 40vh; overflow: auto; }
.rules-entry > strong { display: block; font: 600 18px var(--serif); margin-bottom: 6px; }
.rules-entry dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.rules-entry dt { color: var(--muted); font-size: 12.5px; }
.rules-entry dd { margin: 0; }
.rules-entry .small { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.rules-drawer-body { flex: 1; overflow: auto; padding: 4px 20px 60px; }
.rules-drawer-body .rules { font-size: 14px; }
.rules-drawer-body .rules-cover h1 { font-size: 24px; margin-top: 14px; }
.rules-drawer-body .rules h2 { font-size: 21px; }
.rules-drawer-body .rules h3 { font-size: 17px; }
@media (min-width: 1300px) { body.rules-drawer-open .game { margin-right: 580px; } }
