/* Runa Casino brand + mobile UX overrides */
:root {
  --runa-bg: #171717;
  --runa-accent: #FFEE00;
  --runa-text: #FFFFF0;
  --runa-muted: rgba(255, 255, 240, 0.72);
  --runa-panel: #121212;
  --runa-border: rgba(255, 238, 0, 0.22);
  /* Same as original Blocksy template */
  --theme-narrow-container-max-width: 750px;
  --theme-wide-offset: 130px;
  --theme-normal-container-max-width: 1290px;
}

/* Keep article readable like the source template (narrow = 750px) */
[data-content="narrow"] > article {
  --theme-block-max-width: var(--theme-narrow-container-max-width);
  --theme-block-wide-max-width: calc(var(--theme-narrow-container-max-width) + var(--theme-wide-offset) * 2);
}

[data-content="narrow"] .entry-content.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
  max-width: var(--theme-narrow-container-max-width);
}

body {
  background-color: var(--runa-bg) !important;
  color: var(--runa-text);
}

a {
  color: var(--runa-accent);
}

a:hover,
a:focus {
  color: #fff59a;
}

.entry-content h1.wp-block-heading,
.entry-content .wp-block-heading.page-title-h1 {
  text-align: center;
  color: var(--runa-text);
  margin-bottom: 0.75em;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  color: var(--runa-text);
}

.entry-content p,
.entry-content li,
.entry-content td,
.entry-content th,
.entry-content caption {
  color: var(--runa-text);
}

.entry-content table {
  border-color: var(--runa-border);
}

.entry-content th {
  background: rgba(255, 238, 0, 0.08);
}

.entry-content td,
.entry-content th {
  border-color: rgba(255, 255, 240, 0.18) !important;
}

/* Header brand */
[data-header*="type-1"] .ct-header [data-row*="middle"] {
  background-color: #0f0f0f !important;
}

[data-header*="type-1"] .ct-header [data-id="button"] {
  --theme-button-background-initial-color: #FFEE00 !important;
  --theme-button-background-hover-color: #ffe44d !important;
}

[data-header*="type-1"] .ct-header [data-id="button"] .ct-button,
[data-header*="type-1"] .ct-header [data-id="button"] .ct-button.bgb-go {
  --theme-button-text-initial-color: #171717 !important;
  --theme-button-text-hover-color: #171717 !important;
  color: #171717 !important;
  font-weight: 700;
}

[data-header*="type-1"] .ct-header [data-id="logo"] .site-logo-container {
  --logo-max-height: 42px;
}

[data-header*="type-1"] .ct-header [data-id="menu"] > ul > li > a {
  color: var(--runa-text) !important;
}

[data-footer*="type-1"] .ct-footer [data-row*="bottom"],
[data-footer*="type-1"] .ct-footer [data-row*="middle"] {
  background-color: #0f0f0f !important;
}

[data-footer*="type-1"] [data-id="copyright"],
[data-footer*="type-1"] .ct-footer [data-id="menu"] > ul > li > a {
  color: var(--runa-muted) !important;
}

[data-header*="type-1"] #offcanvas .ct-panel-inner {
  background-color: rgba(15, 15, 15, 0.98) !important;
}

/* Banner — reserved aspect ratio (CLS) + centered */
.entry-content figure.wp-block-image.runa-banner-wrap,
.entry-content .runa-banner-wrap {
  display: block !important;
  width: 100% !important;
  max-width: min(480px, 100%) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 1.25rem;
  text-align: center;
  aspect-ratio: 4 / 5;
  contain: layout;
}

.entry-content .runa-banner-wrap .bgb-go-image {
  display: block;
  width: 100%;
  margin: 0 auto;
  aspect-ratio: 4 / 5;
}

.entry-content .runa-banner-wrap img {
  width: 100%;
  max-width: 480px;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  display: block;
  margin-left: auto;
  margin-right: auto;
  border-radius: 8px;
}

/* Tables: horizontal scroll on small screens instead of clipping columns */
.entry-content .wp-block-table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.entry-content .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
}

.entry-content .wp-block-table table.has-fixed-layout {
  table-layout: auto;
}

@media (max-width: 768px) {
  .entry-content .wp-block-table {
    margin-left: 0;
    margin-right: 0;
  }

  .entry-content .wp-block-table table,
  .entry-content .wp-block-table table.has-fixed-layout {
    table-layout: auto !important;
    width: max-content;
    min-width: 100%;
    max-width: none;
  }

  .entry-content .wp-block-table th,
  .entry-content .wp-block-table td {
    white-space: normal;
    word-break: break-word;
    min-width: 7.5rem;
    vertical-align: top;
  }
}

/* Logo: lock box to real asset ratio (990×400) to avoid attr mismatch CLS */
.site-logo-container {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.site-logo-container img.default-logo,
.site-logo-container img {
  width: auto;
  height: 42px;
  max-height: 42px;
  aspect-ratio: 990 / 400;
  object-fit: contain;
}

/* Sticky bar brand + alignment */
.bgb-sticky {
  background: rgba(23, 23, 23, 0.92) !important;
  border-top: 1px solid rgba(255, 238, 0, 0.25) !important;
}

/* Reserve sticky space on mobile from first paint (avoid padding CLS on reveal) */
@media (max-width: 768px) {
  body.bgb-has-sticky {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.bgb-has-sticky.bgb-sticky-visible {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

.bgb-sticky-inner {
  display: flex !important;
  align-items: stretch !important;
  justify-content: center !important;
  gap: 10px !important;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.bgb-sticky .bgb-btn {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  background-color: #FFEE00 !important;
  color: #171717 !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 10px !important;
  padding-right: 10px !important;
}

.bgb-sticky .bgb-btn[data-bgb="login"] {
  background-color: transparent !important;
  color: #FFEE00 !important;
  box-shadow: inset 0 0 0 2px #FFEE00 !important;
}

.bgb-inline-wrap .bgb-btn {
  background-color: #FFEE00 !important;
  color: #171717 !important;
  font-weight: 700 !important;
  --bgb-accent: #FFEE00;
}

/* Space between claim CTA and following paragraph (stable before/after BGB wrap) */
.entry-content > .bgb-inline-wrap,
.entry-content .bgb-inline-wrap {
  display: flex !important;
  justify-content: center;
  width: 100%;
  margin: 18px 0 0 !important;
  padding-bottom: 48px !important;
  min-height: 52px;
  box-sizing: content-box;
  contain: layout;
}

/* Pre-size claim CTA like final .bgb-btn to avoid JS hydration CLS */
.entry-content > span.butreg,
.entry-content > .butreg {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 92vw;
  min-width: min(240px, 92vw);
  min-height: 52px;
  margin: 18px auto 48px !important;
  padding: 10px 18px;
  box-sizing: border-box;
  background: #FFEE00;
  color: #171717 !important;
  font-weight: 700;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  contain: layout;
}

.entry-content > .bgb-inline-wrap > .butreg {
  margin: 0 !important;
  min-height: 52px;
}

/* Mobile header: keep Blocksy 2-col grid, align items cleanly */
@media (max-width: 999.98px) {
  [data-header*="type-1"] {
    --header-height: 64px !important;
  }

  [data-header*="type-1"] .ct-header [data-row*="middle"] {
    --height: 64px !important;
  }

  #header [data-device="mobile"] [data-row="middle"] {
    width: 100%;
  }

  #header [data-device="mobile"] [data-column-set="2"] > .ct-container {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    width: 100% !important;
    max-width: 100% !important;
    padding-inline: 16px;
    box-sizing: border-box;
  }

  #header [data-device="mobile"] [data-column="start"],
  #header [data-device="mobile"] [data-column="end"] {
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
  }

  #header [data-device="mobile"] [data-column="start"] {
    justify-content: flex-start;
  }

  #header [data-device="mobile"] [data-column="end"] {
    justify-content: flex-end;
  }

  #header [data-device="mobile"] [data-column="start"] > [data-items],
  #header [data-device="mobile"] [data-column="end"] > [data-items="primary"] {
    display: flex !important;
    align-items: center;
    height: 100%;
    width: auto;
    margin: 0;
  }

  #header [data-device="mobile"] [data-column="end"] > [data-items="primary"] {
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 10px;
  }

  #header [data-device="mobile"] [data-column="end"] > [data-items="primary"] > * {
    margin: 0 !important;
  }

  #header [data-device="mobile"] .site-branding,
  #header [data-device="mobile"] .site-logo-container {
    max-width: 100%;
    display: flex;
    align-items: center;
  }

  #header [data-device="mobile"] .site-logo-container img {
    height: 30px !important;
    max-height: 30px !important;
    width: auto !important;
    max-width: 120px !important;
    aspect-ratio: 990 / 400;
    object-fit: contain;
    display: block;
  }

  /* Stable mobile header box */
  #header [data-device="mobile"] [data-row="middle"] {
    min-height: 64px;
  }

  #header [data-device="mobile"] .ct-header-cta {
    flex: 0 0 auto;
  }

  #header [data-device="mobile"] .ct-header-cta .ct-button,
  #header [data-device="mobile"] .ct-header-cta span.ct-button {
    min-height: 34px !important;
    height: 34px;
    padding: 0 12px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    white-space: nowrap;
    max-width: none;
  }

  #header [data-device="mobile"] .ct-header-trigger {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #FFFFF0;
    background: transparent;
    border: 0;
  }

  .entry-content h1.wp-block-heading {
    font-size: clamp(1.5rem, 6vw, 2rem) !important;
    line-height: 1.25 !important;
    padding: 0 4px;
  }

  .bgb-sticky-inner {
    max-width: 100%;
    padding: 0 2px;
  }

  .bgb-sticky .bgb-btn {
    min-height: 48px !important;
    font-size: 14px !important;
  }
}

@media (max-width: 380px) {
  #header [data-device="mobile"] .site-logo-container img {
    max-width: 96px !important;
    max-height: 26px !important;
  }

  #header [data-device="mobile"] .ct-header-cta .ct-button,
  #header [data-device="mobile"] .ct-header-cta span.ct-button {
    padding: 0 8px !important;
    font-size: 11px !important;
  }

  #header [data-device="mobile"] [data-column="end"] > [data-items="primary"] {
    gap: 4px;
  }
}

/* Offcanvas close hit area */
.ct-toggle-close {
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: #FFFFF0 !important;
  background: transparent;
  border: 0;
}

.ct-toggle-close .ct-icon {
  fill: currentColor;
}

/* Theme button defaults for content CTAs */
:root {
  --theme-button-background-initial-color: #FFEE00;
  --theme-button-background-hover-color: #ffe44d;
  --theme-button-text-initial-color: #171717;
  --theme-button-text-hover-color: #171717;
  --theme-link-initial-color: #FFEE00;
  --theme-link-hover-color: #fff59a;
  --theme-text-color: #FFFFF0;
  --theme-headings-color: #FFFFF0;
  --theme-palette-color-1: #FFEE00;
  --theme-palette-color-4: #FFFFF0;
  --theme-palette-color-8: #FFFFF0;
}

/* FAQ accordion: stable question row height before/after hydration */
.entry-content h3.bgb-faq-h3,
.entry-content h3.runa-faq-q {
  min-height: 3.25rem;
}

/*
 * First-paint FAQ CLS guard:
 * keep the first answer visible; hide 2nd+ raw answers until wrapped into .bgb-faq-a
 */
.entry-content h2.runa-faq-heading ~ h3.wp-block-heading ~ h3.wp-block-heading + p.wp-block-paragraph,
.entry-content h2.runa-faq-heading ~ section h3.wp-block-heading ~ h3.wp-block-heading + p.wp-block-paragraph {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

.entry-content .bgb-faq-a .bgb-faq-a-inner > p.wp-block-paragraph {
  position: static !important;
  width: auto !important;
  height: auto !important;
  margin: 0 0 1em !important;
  padding: 0 !important;
  overflow: visible !important;
  clip: auto !important;
}

/* Tables: reserve a predictable block without expanding page on load */
.entry-content .wp-block-table {
  contain: inline-size;
}

/* Avoid font metric swaps shifting text (system stack already, reinforce) */
body {
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
