::selection {
  background-color: #ed2e4d; /* your custom green */
  color:             #fff;    /* white text */
}
::-moz-selection {
  background-color: #ed2e4d;
  color:             #fff;
}

/* make sure dark-mode (data-bs-theme="dark") still uses the same style */
[data-bs-theme="dark"] ::selection {
  background-color: #1d5349 !important;
  color:             #fff    !important;
}
[data-bs-theme="dark"] ::-moz-selection {
  background-color: #1d5349 !important;
  color:             #fff    !important;
}:root {
  --primary: #1d5349;       /* main dark‑green text */
  --hover-accent: #ed2e4d;  /* crimson for sidebar hover */
  --bg-page: #fafcfd;
  --bg-widget: #fff;
  --border-radius: 8px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --font: 'Inter', sans-serif;
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* WebKit browsers */
html::-webkit-scrollbar {
  width: 12px;
}

html::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

html::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 6px;
  border: 3px solid var(--scrollbar-track);
}

/* RESET */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--primary);
  line-height: 1.5;
}

/* PAGE WRAPPER */
.rules-page-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  max-width: 1200px;
  margin: auto;
  padding-top: 1rem;
}
@media (max-width: 1024px) {
  .rules-page-wrapper {
    flex-direction: column;
    padding-top: 20px;
  }
}

/* SIDEBAR */
.rules-sidebar {
  position: sticky;
  top: calc(85px + 1rem);
  align-self: flex-start;
  background: transparent;
  border-left: 4px solid var(--primary);
  padding: 1.5rem;
  width: 220px;
  margin-right: 20px;
  z-index: 10;
}
.rules-sidebar ul {
  list-style: none;
}
.rules-sidebar li + li {
  margin-top: 1rem;
}
.rules-sidebar button {
  position: relative;
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 0.4rem 0.8rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary);
  text-align: left;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}
.rules-sidebar button:hover {
  color: var(--hover-accent);
  transform: translateX(4px);
}
.rules-sidebar button:hover::before,
.rules-sidebar button.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.4rem;
  width: 4px;
  height: calc(100% - 0.8rem);
  background: var(--hover-accent);
  border-radius: 2px;
}

/* MAIN CONTENT */
.rules-content {
  flex: 1;
  position: relative;
  z-index: 0;
}

/* CONTENT HEADER IMAGE */
.content-header {
  padding: 0;
  margin-bottom: 1rem;
  background: transparent;
  box-shadow: none;
}
.content-header-logo {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  max-height: 120px;
  object-fit: cover;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin: 0 0 1rem;
}

/* CATEGORY & SECTION HEADER IMAGES */
.rule-category-card h3,
.additional-section h3 {
  margin-bottom: 1rem;
}
.category-icon,
.section-header-logo {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 120px;
  object-fit: cover;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin: 0 auto 1rem;
}

/* RULE LINES */
.rule-toggle {
  margin-bottom: 1rem;
}
.rule-toggle-header {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  color: var(--primary);
}
.rule-toggle-header strong {
  width: 3rem;
  font-weight: 600;
  color: var(--primary);
}
.rule-toggle-header span {
  color: var(--primary);
}

/* INFO ICON & POPUP */
.info-icon {
  position: relative;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.info-icon img {
  width: 1em;
  height: 1em;
  object-fit: contain;
  vertical-align: text-bottom;
}
.info-icon:hover {
  transform: scale(1.2);
  z-index: 11;
}
.punishment-popup {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-widget);
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 0.5rem;
  white-space: nowrap;
  display: none;
  z-index: 10;
}
.info-icon:hover .punishment-popup {
  display: block;
}
.punishment-popup table {
  border-collapse: collapse;
}
.punishment-popup th,
.punishment-popup td {
  padding: 0.4rem 0.6rem;
  border: 1px solid #eee;
  font-size: 0.9rem;
  text-align: center;
}
.punishment-popup th {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.punishment-popup td {
  color: var(--text);
}

/* ADDITIONAL SECTIONS MATCH RULE CARDS */
.additional-section {
  margin-bottom: 2rem;
  padding: 0;
  background: transparent;
  border: none;
}
.section-header-logo {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 120px;
  object-fit: cover;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin: 0 auto 1rem;
}
.additional-section ul {
  list-style: disc inside;
  margin: 0;
  padding: 0 1rem;
}
.additional-section li {
  margin-bottom: 1rem;
  font-weight: 600;
  color: var(--primary);
}

.additional-section h3 .category-icon {
  float: none !important;
  display: block;
  margin: 0 auto 0.5em;
}

.additional-section ul {
  margin: 0;
  padding-left: 1.3em;      /* tweak this until it looks right */
  list-style-position: outside;
}

.additional-section ul li {
  margin-bottom: 0.5em;
}
/* ------------------------------------------------------------------
   1) Clamp the popup so it never exceeds the viewport
   2) Center it horizontally by default on small screens
   3) Always allow scrolling if it’s too tall
------------------------------------------------------------------ */
.punishment-popup {
  max-width: calc(100vw - 2rem) !important;    /* leave 1rem gutter each side */
  max-height: calc(100vh - 2rem) !important;   /* leave 1rem top/bottom */
  overflow: auto !important;                   /* scroll if content is tall */
}

/* Mobile & tablet: fix in viewport center, not relative to icon */
@media (max-width: 768px) {
  .rule-toggle-header .punishment-popup {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: auto !important;
  }
}


/* SMOOTH SCROLL OFFSET */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 85px;
}

/*========================================
  PHONES & SMALL TABLETS (<=768px)
========================================*/
@media (max-width: 768px) {
		.info-icon {
		display: none !important;
	}
  .rules-sidebar {
    display: none;
  }

  .rule-toggle-header {
    display: inline;
    white-space: normal;
    font-size: 0.9rem;
    line-height: 1.3;
    position: relative;
    overflow: visible;
  }

  .rule-toggle-header strong {
    display: inline;
    margin-right: 0.5rem;
    width: auto;
  }

  .rule-toggle-header span {
    display: inline;
    word-break: break-word;
  }

  .rule-toggle-header .info-icon {
    display: inline-block;
    margin-left: 0.25rem;
    vertical-align: text-bottom;
    position: relative;
  }

  .info-icon img {
    width: 1em;
    height: 1em;
  }

  .rule-toggle-header .punishment-popup {
    display: none;
  }

  .rule-toggle-header .info-icon:hover .punishment-popup,
  .rule-toggle-header .info-icon:focus .punishment-popup,
  .rule-toggle-header .info-icon:active .punishment-popup {
    display: block;
  }

  .rule-toggle-header .punishment-popup {
    position: fixed !important;
    top: auto!important;
    /* Center the popup in the viewport */
    left: auto ;
    transform: translateX(-50%);
    /* Make it at most 90% of the viewport width */
    width: 90vw;
    max-width: calc(100vw - 1rem);
    background: var(--bg-widget);
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 0.75rem;
    font-size: 0.85rem;
    z-index: 999;
    white-space: normal;
    word-break: break-word;
  }

  .rule-toggle-header .punishment-popup table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
  }

  .rule-toggle-header .punishment-popup th,
  .rule-toggle-header .punishment-popup td {
    padding: 0.4rem;
    font-size: 0.8rem;
    border: 1px solid #eee;
    text-align: center;
    word-break: break-word;
  }
}

@media (max-width: 425px) {
		.info-icon {
		display: none !important;
	}
.rule-toggle-header .punishment-popup {
  /* pin to viewport */
  position: fixed !important;
  left: 0 !important;        /* flush against the left edge */
  top: 1rem !important;      /* or whatever vertical offset you prefer */
  transform: none !important;/* cancel any inherited translate */

  /* span full viewport width and never overflow */
  width: 100vw !important;
  max-width: 100vw !important;

  /* if it gets too tall, let it scroll */
  max-height: 90vh;
  overflow-y: auto;

  /* include padding in the 100vw */
  box-sizing: border-box;

  /* your existing styling */
  background: var(--bg-widget);
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 0.75rem;
  font-size: 0.85rem;
  z-index: 999;
  white-space: normal;
  word-break: break-word;
}


  .rule-toggle-header .info-icon:hover .punishment-popup,
  .rule-toggle-header .info-icon:focus .punishment-popup,
  .rule-toggle-header .info-icon:active .punishment-popup {
    display: block;
  }

  .rule-toggle-header .punishment-popup table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
  }

  .rule-toggle-header .punishment-popup th,
  .rule-toggle-header .punishment-popup td {
    padding: 0.4rem;
    font-size: 0.8rem;
    border: 1px solid #eee;
    text-align: center;
    word-break: break-word;
  }
}


