/* XClick Age Gate. No theme styles are assumed and no web fonts are loaded; every rule is scoped
   to the gate or to a locked page (html[data-xcag]).
   - data-xcag="site": the site's own page behind the dialog, images blurred, no scrolling.
   - data-xcag="closed": the closed page (site name, tagline and an empty skeleton).
   The dialog follows the age modal of the big tube sites: a compact card near the top. */

html[data-xcag],
html[data-xcag] body {
  overflow: hidden !important;
}

/* ---- The site behind the dialog ------------------------------------------------------------- */

/* Thumbnails and every other picture of the page. The site's logo stays sharp: themes mark it
   in many ways (custom-logo, .logo, .site-branding, a file named logo), so all of them count. */
html[data-xcag='site'] body img:not(.custom-logo):not([class*='logo']):not([src*='logo']):not(.xcag-gate img),
html[data-xcag='site'] body svg image,
html[data-xcag='site'] body [style*='background-image']:not([class*='logo']) {
  filter: blur(22px) !important;
  transform: translateZ(0);
}

html[data-xcag='site'] body :is(.logo, .site-logo, .site-branding, .custom-logo-link, #logo) img {
  filter: none !important;
}

/* Where a player was removed on the server. */
.xcag-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #1a1a1a;
}

/* ---- The closed page ------------------------------------------------------------------------ */

html[data-xcag='closed'],
html[data-xcag='closed'] body {
  margin: 0;
  background: #121212;
  color: #f2f2f2;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
}

.xcag-site {
  position: fixed;
  inset: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 16px;
  height: 64px;
  box-sizing: border-box;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  overflow: hidden;
}

.xcag-site-name {
  margin: 0;
  color: #2e9fe6;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.xcag-site-tagline {
  margin: 0;
  overflow: hidden;
  color: #777;
  font-size: 14px;
  text-overflow: ellipsis;
}

.xcag-skeleton {
  position: fixed;
  inset: 64px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  align-content: start;
  gap: 18px 14px;
  padding: 20px;
  overflow: hidden;
}

.xcag-thumb span {
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #1c1c1c;
}

.xcag-thumb i {
  display: block;
  width: 45%;
  height: 10px;
  margin-top: 10px;
  border-radius: 5px;
  background: #1c1c1c;
}

/* ---- The dialog ----------------------------------------------------------------------------- */

.xcag-gate {
  display: none;
}

html[data-xcag] .xcag-gate,
html.xcag-locked .xcag-gate {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px 16px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.45);
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

.xcag-gate *,
.xcag-gate *::before,
.xcag-gate *::after {
  box-sizing: border-box;
}

#xcag-gate .xcag-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 440px;
  max-height: 100%;
  padding: 26px 26px 30px;
  overflow-y: auto;
  border-radius: 6px;
  background: #121212;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  color: #f2f2f2;
  text-align: left;
}

#xcag-gate .xcag-title {
  margin: 0;
  color: #f2f2f2;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
}

#xcag-gate .xcag-text {
  margin: 0;
  color: #e6e6e6;
  font-size: 15px;
  line-height: 1.5;
}

#xcag-gate .xcag-promises {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #c8c8c8;
  font-size: 13.5px;
}

#xcag-gate .xcag-promises li {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}

#xcag-gate .xcag-promises svg {
  width: 14px;
  height: 14px;
}

#xcag-gate .xcag-provider {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 12px 12px;
  border: 1px solid #5a5a5a;
  border-radius: 6px;
}

#xcag-gate .xcag-provider-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #f2f2f2;
  font-size: 17px;
  font-weight: 700;
}

#xcag-gate .xcag-provider-name svg {
  width: 22px;
  height: 22px;
  flex: none;
}

#xcag-gate .xcag-pill {
  padding: 1px 7px;
  border: 1px solid #2e9fe6;
  border-radius: 999px;
  background: #eaf5fd;
  color: #12324a;
  font-size: 12px;
  font-weight: 500;
}

#xcag-gate .xcag-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(232, 82, 63, 0.35);
  border-radius: 4px;
  background: rgba(232, 82, 63, 0.14);
  color: #f4a397;
  font-size: 14px;
  line-height: 1.4;
}

#xcag-gate .xcag-button {
  all: unset;
  display: block;
  box-sizing: border-box;
  text-align: center;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid #d0d0d0 !important;
  border-radius: 4px !important;
  background: #f2f2f2 !important;
  color: #111 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  box-shadow: none !important;
  line-height: 40px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

#xcag-gate .xcag-button:hover {
  background: #fff !important;
}

#xcag-gate .xcag-button[disabled] {
  background: #3a3a3a !important;
  border-color: #3a3a3a !important;
  color: #999 !important;
  cursor: progress;
}

#xcag-gate .xcag-fine {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #c8c8c8;
  font-size: 13px;
  line-height: 1.45;
}

#xcag-gate .xcag-fine p {
  margin: 0;
}

#xcag-gate .xcag-fine a {
  color: #f2f2f2;
  text-decoration: none;
}

#xcag-gate .xcag-fine a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

#xcag-gate .xcag-links {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
}

#xcag-gate .xcag-button:focus-visible,
#xcag-gate .xcag-fine a:focus-visible {
  outline: 2px solid #2e9fe6;
  outline-offset: 2px;
}

/* Scoped on purpose: never restyle the host site's own [hidden] elements. */
.xcag-gate [hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  html[data-xcag] .xcag-gate,
  html.xcag-locked .xcag-gate {
    padding: 12px;
  }

  #xcag-gate .xcag-card {
    padding: 22px 18px 24px;
  }

  .xcag-skeleton {
    grid-template-columns: 1fr 1fr;
    padding: 12px;
  }
}
