/* Shared styles for the Rulebook (rulebook.html) and Event Guide (event-guide.html).
   Both pages are structurally identical; only their JSON source + a few labels
   differ (see rulebook-engine.js + each page's RB_CONFIG). */
  /* Base + nav styles (:root palette, header, buttons, More menu, mobile nav)
     now live in the shared site-base.css. Only Rulebook/Event-Guide-specific
     styles remain below. */


  /* PAGE */
  .page { padding: 24px; max-width: 1180px; margin: 0 auto; }

  /* HERO */
  .rb-hero { margin-bottom: 18px; }
  .rb-title { font-family: 'Cinzel Decorative', serif; font-size: 2rem; color: var(--gold); letter-spacing: 0.02em; }
  .rb-sub { color: var(--rune); font-size: 1rem; margin-top: 6px; font-style: italic; }

  /* STICKY CONTROLS (search + page jump) */
  .rb-controls {
    position: sticky; top: 60px; z-index: 90;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: rgba(11,10,15,0.95); backdrop-filter: blur(8px);
    border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 14px; margin-bottom: 20px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  }
  .rb-search-wrap { position: relative; flex: 1 1 320px; min-width: 0; }
  .rb-search-wrap svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; fill: var(--arcane); opacity: 0.5; pointer-events: none; }
  .rb-search {
    width: 100%; background: #0b0a0f; border: 1px solid var(--border-strong);
    color: var(--parchment); font-family: 'Crimson Pro', serif; font-size: 1.12rem;
    padding: 12px 14px 12px 40px; border-radius: 8px; outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .rb-search:focus { border-color: var(--arcane); box-shadow: 0 0 0 3px rgba(155,135,212,0.18); }
  .rb-search::placeholder { color: var(--mist); font-style: italic; }
  .rb-pagejump { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
  .rb-pagejump label { font-family: 'Cinzel', serif; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--rune); }
  .rb-pagejump input { width: 64px; background: #0b0a0f; border: 1px solid var(--border-strong); color: var(--gold); font-family: 'Cinzel', serif; font-weight: 700; font-size: 0.95rem; text-align: center; padding: 8px 6px; border-radius: 6px; outline: none; -moz-appearance: textfield; }
  .rb-pagejump input::-webkit-outer-spin-button, .rb-pagejump input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .rb-pagejump input:focus { border-color: var(--arcane); }
  .rb-count { font-size: 0.85rem; color: var(--rune); font-style: italic; flex-basis: 100%; }
  .rb-count:empty { display: none; }

  /* TOC TOGGLE (mobile only) */
  .rb-toc-toggle { display: none; width: 100%; margin-bottom: 16px; background: var(--abyss); border: 1px solid var(--border-strong); color: var(--gold); font-family: 'Cinzel', serif; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 11px 14px; border-radius: 8px; cursor: pointer; text-align: left; }
  .rb-toc-toggle:hover { border-color: var(--arcane); }

  /* LAYOUT */
  .rb-layout { display: grid; grid-template-columns: 250px 1fr; gap: 30px; align-items: start; }

  /* TABLE OF CONTENTS */
  .rb-toc {
    position: sticky; top: 142px; align-self: start;
    max-height: calc(100vh - 160px); overflow-y: auto;
    border-right: 1px solid var(--border); padding-right: 8px;
  }
  .rb-toc-group { margin-bottom: 16px; }
  /* Collapsible group heading — same caret affordance used across the site */
  .rb-toc-title {
    display: flex; align-items: center; width: 100%;
    font-family: 'Cinzel', serif; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold);
    margin: 0 0 7px; padding: 0 0 4px; border: none; border-bottom: 1px solid var(--border);
    background: none; text-align: left; cursor: pointer; user-select: none;
  }
  .rb-toc-title:hover { color: var(--shimmer); }
  .rb-toc-caret {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 20px; height: 20px; margin-right: 8px;
    border: 1px solid var(--border-strong); border-radius: 5px;
    background: rgba(155,135,212,0.1); color: var(--arcane);
    font-size: 0.66rem; line-height: 1;
    transition: transform 0.18s, background 0.15s, border-color 0.15s;
  }
  .rb-toc-title:hover .rb-toc-caret { background: rgba(155,135,212,0.22); border-color: var(--arcane); color: var(--shimmer); }
  .rb-toc-group.collapsed .rb-toc-caret { transform: rotate(-90deg); }
  .rb-toc-group.collapsed .rb-toc-body { display: none; }
  .rb-toc-link { display: block; font-size: 0.93rem; color: var(--rune); text-decoration: none; padding: 4px 8px; border-radius: 5px; border-left: 2px solid transparent; transition: color 0.12s, background 0.12s, border-color 0.12s; cursor: pointer; }
  .rb-toc-link:hover { color: var(--shimmer); background: rgba(155,135,212,0.08); border-left-color: var(--arcane); }

  /* CONTENT */
  .rb-content { min-width: 0; }
  .rb-section { scroll-margin-top: 150px; margin-bottom: 30px; padding-bottom: 6px; outline: none; }
  .rb-section:target { } /* handled via JS focus */
  .rb-section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .rb-section-title { font-family: 'Cinzel', serif; font-size: 1.32rem; font-weight: 700; letter-spacing: 0.03em; color: var(--gold); overflow-wrap: break-word; min-width: 0; }
  .rb-group > .rb-section-head .rb-section-title { font-family: 'Cinzel Decorative', serif; font-size: 1.5rem; }
  .rb-page-badge { font-family: 'Cinzel', serif; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--rune); background: rgba(155,135,212,0.08); border: 1px solid var(--border); border-radius: 20px; padding: 2px 9px; white-space: nowrap; }
  .rb-para { margin: 0 0 11px; line-height: 1.62; color: var(--parchment); overflow-wrap: break-word; }
  .rb-para:last-child { margin-bottom: 0; }
  .rb-link { color: var(--gold); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; overflow-wrap: break-word; transition: color 0.15s, text-decoration-color 0.15s; }
  .rb-link:hover { color: var(--shimmer); text-decoration-color: var(--arcane); }

  /* GLOSSARY / QUICK REFERENCE TERMS */
  .rb-terms { display: flex; flex-direction: column; gap: 4px; }
  .rb-term { scroll-margin-top: 150px; padding: 12px 14px; border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: 6px; background: rgba(17,16,24,0.5); outline: none; }
  .rb-term-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 5px; }
  .rb-term-name { font-family: 'Cinzel', serif; font-size: 1rem; font-weight: 700; color: var(--shimmer); overflow-wrap: break-word; min-width: 0; }
  .rb-term-def .rb-para { font-size: 0.98rem; color: var(--parchment); }
  .rb-term-def .rb-para:first-child { margin-top: 0; }

  /* HIGHLIGHT */
  mark { background: rgba(200,169,110,0.38); color: #fff; border-radius: 2px; padding: 0 1px; }

  /* STATES */
  .rb-status { padding: 50px 10px; text-align: center; color: var(--rune); font-style: italic; }
  .rb-noresults { padding: 40px 10px; text-align: center; color: var(--rune); font-style: italic; font-size: 1.05rem; }
  .rb-noresults b { color: var(--gold); font-style: normal; }

  /* CREDIT */
  .rb-credit { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; font-size: 0.85rem; color: var(--rune); font-style: italic; }
  .rb-credit a { color: var(--gold); text-decoration: none; }
  .rb-credit a:hover { text-decoration: underline; }

  /* RESPONSIVE */
  @media (max-width: 900px) {
    .rb-layout { grid-template-columns: 1fr; gap: 0; }
    .rb-toc-toggle { display: block; }
    .rb-toc { display: none; position: static; max-height: none; overflow: visible; border-right: none; padding-right: 0; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
    .rb-toc.open { display: block; }
  }
  @media (max-width: 560px) {
    .page { padding: 14px; }
    .rb-title { font-size: 1.6rem; }
    .rb-controls { top: 60px; padding: 10px; }
    .rb-search { font-size: 1.05rem; }
    .rb-section { scroll-margin-top: 132px; }
    .rb-term { scroll-margin-top: 132px; }
  }
