/* Community rules gate overlay. Navy/gold theme, no emoji, no icon glyphs. */
.crg-overlay {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 1.25rem;
  box-sizing: border-box;
  background: #0a1628;
}

.crg-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  max-height: 85dvh;
  background: #0f1a2e;
  border: 1px solid rgba(200, 160, 60, 0.25);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.crg-head {
  padding: 1.4rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: #16223c;
}

.crg-title {
  color: #c8a03c;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.crg-sub {
  margin-top: 0.35rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
  line-height: 1.4;
}

.crg-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.94rem;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}

.crg-body p { margin: 0 0 0.85rem; }

.crg-body h4 {
  margin: 1.2rem 0 0.45rem;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
}

.crg-body ul {
  margin: 0 0 0.85rem;
  padding-left: 1.2rem;
}

.crg-body li { margin: 0 0 0.45rem; }

.crg-end { height: 1px; }

.crg-body::-webkit-scrollbar { width: 10px; }
.crg-body::-webkit-scrollbar-track { background: transparent; }
.crg-body::-webkit-scrollbar-thumb {
  background: rgba(200, 160, 60, 0.35);
  border-radius: 6px;
}

.crg-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: #16223c;
}

.crg-hint {
  flex: 1 1 auto;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  line-height: 1.35;
}

.crg-accept {
  flex: 0 0 auto;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 9px;
  background: #c8a03c;
  color: #0a1628;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.05s ease;
}

.crg-accept:hover:not(:disabled) { opacity: 0.92; }
.crg-accept:active:not(:disabled) { transform: translateY(1px); }

.crg-accept:disabled {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.45);
  cursor: not-allowed;
}

@media (max-width: 560px) {
  /* The overlay is mounted inside #page-content, which on mobile is offset
     below the fixed top app bar (--ms-topbar-h) and carries a bottom safe-area
     pad. Size the overlay to that REAL visible area instead of height:100%
     (which resolves to content height on the auto-height flex host and lets the
     card grow past the fold, hiding the footer/Accept button). */
  .crg-overlay {
    padding: 0;
    height: auto;
    min-height: calc(100dvh - var(--ms-topbar-h, 54px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }
  /* Clamp the whole card (header + scrolling body + pinned footer) to the
     visible area so the footer always lands above the bottom edge. */
  .crg-card {
    max-width: 100%;
    max-height: calc(100dvh - var(--ms-topbar-h, 54px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    border: none;
    border-radius: 0;
  }
  /* Scroll region: must be allowed to shrink so the footer is never pushed off. */
  .crg-body {
    flex: 1 1 auto;
    min-height: 0;
  }
  /* Pinned footer: never shrinks, stays visible at the card's bottom, and clears
     the device home indicator via the bottom safe-area inset. */
  .crg-foot {
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }
  .crg-accept { width: 100%; }
}
