/* Four-edge Google AdSense frame (Top, Bottom, Left, Right) across all views */
:root {
  --ad-top-h: 90px;
  --ad-bottom-h: 90px;
  --ad-left-w: 160px;
  --ad-right-w: 160px;
  --ad-bg: var(--topbar-bg, #ffffff);
  --ad-border: var(--line, #dee1e3);
  --ad-label: var(--muted, #606162);
  --ad-slot-bg: var(--surface, #f2f4f5);
}

/* Dark rails during fullscreen WASM gameplay */
body.playing {
  --ad-bg: #141519;
  --ad-border: #262830;
  --ad-label: #8e929b;
  --ad-slot-bg: #1c1e24;
}

/* Compact desktop / tablet: all four rails stay visible */
@media (max-width: 1099px) {
  :root {
    --ad-top-h: 60px;
    --ad-bottom-h: 60px;
    --ad-left-w: 120px;
    --ad-right-w: 120px;
  }
}

/* Short viewports: keep top & bottom slim so center screen stays roomy */
@media (max-height: 720px) and (min-width: 768px) {
  :root {
    --ad-top-h: 60px;
    --ad-bottom-h: 60px;
  }
}

/* Narrow mobile viewports: keep top & bottom banners, collapse side rails */
@media (max-width: 767px) {
  :root {
    --ad-top-h: 50px;
    --ad-bottom-h: 50px;
    --ad-left-w: 0px;
    --ad-right-w: 0px;
  }
}

.wb-ad-rail {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ad-bg);
  overflow: hidden;
  box-sizing: border-box;
  user-select: none;
}

.wb-ad-top {
  top: 0;
  left: 0;
  right: 0;
  height: var(--ad-top-h);
  border-bottom: 1px solid var(--ad-border);
  z-index: 60;
}

.wb-ad-bottom {
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--ad-bottom-h);
  border-top: 1px solid var(--ad-border);
  z-index: 60;
}

.wb-ad-left {
  top: var(--ad-top-h);
  bottom: var(--ad-bottom-h);
  left: 0;
  width: var(--ad-left-w);
  border-right: 1px solid var(--ad-border);
  z-index: 55;
}

.wb-ad-right {
  top: var(--ad-top-h);
  bottom: var(--ad-bottom-h);
  right: 0;
  width: var(--ad-right-w);
  border-left: 1px solid var(--ad-border);
  z-index: 55;
}

@media (max-width: 767px) {
  .wb-ad-left,
  .wb-ad-right {
    display: none;
  }
}

.wb-ad-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  max-width: 100%;
  max-height: 100%;
}

/* Explicit responsive AdSense slot dimensions to prevent layout overflow */
.wb-ad-unit-h {
  display: inline-block;
  width: 728px;
  height: 90px;
}

.wb-ad-unit-v {
  display: inline-block;
  width: 160px;
  height: 600px;
}

.wb-ad-frame {
  border: 0;
  background: transparent;
  overflow: hidden;
  display: block;
}

@media (max-width: 1099px) {
  .wb-ad-unit-h {
    width: 468px;
    height: 60px;
  }
  .wb-ad-unit-v {
    width: 120px;
    height: 600px;
  }
}

@media (max-height: 780px) {
  .wb-ad-unit-v {
    height: 300px;
  }
}

@media (max-height: 720px) and (min-width: 768px) {
  .wb-ad-unit-h {
    width: 468px;
    height: 60px;
  }
}

@media (max-width: 767px) {
  .wb-ad-unit-h {
    width: 320px;
    height: 50px;
  }
}

/* Subtle "Ad" badge shown in corner of populated rails */
.wb-ad-tag {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ad-label);
  opacity: .55;
  pointer-events: none;
  line-height: 1;
}

/* Clean placeholder shown only until ADSENSE_CLIENT and slot IDs are configured */
.wb-ad-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 4px 8px;
  background: var(--ad-slot-bg);
  border: 1px dashed var(--ad-border);
  border-radius: 4px;
  color: var(--ad-label);
  text-align: center;
  font-size: 11px;
  line-height: 1.25;
}

.wb-ad-placeholder strong {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.wb-ad-placeholder span {
  font-size: 10px;
  opacity: .75;
}

.wb-ad-top .wb-ad-placeholder {
  width: min(728px, calc(100vw - 16px));
  height: calc(var(--ad-top-h) - 10px);
  flex-direction: row;
  gap: 8px;
}

.wb-ad-bottom .wb-ad-placeholder {
  width: min(728px, calc(100vw - 16px));
  height: calc(var(--ad-bottom-h) - 10px);
  flex-direction: row;
  gap: 8px;
}

.wb-ad-left .wb-ad-placeholder {
  width: calc(var(--ad-left-w) - 12px);
  height: min(600px, calc(100vh - var(--ad-top-h) - var(--ad-bottom-h) - 16px));
}

.wb-ad-right .wb-ad-placeholder {
  width: calc(var(--ad-right-w) - 12px);
  height: min(600px, calc(100vh - var(--ad-top-h) - var(--ad-bottom-h) - 16px));
}

:fullscreen,
html.wb-ads-removed {
  --ad-top-h: 0px !important;
  --ad-bottom-h: 0px !important;
  --ad-left-w: 0px !important;
  --ad-right-w: 0px !important;
}

:fullscreen .wb-ad-rail,
html.wb-ads-removed .wb-ad-rail {
  display: none !important;
}

/* Hide rail ad iframes while the reward modal is open so cross-origin ad layers never cover the modal */
html.wb-modal-open .wb-ad-rail {
  display: none !important;
}

/* ============================================================================
   Top-Left Bouncing Present ("Remove Ads For Today") & Fullscreen Button
   ============================================================================ */
.wb-present-btn {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 8px 6px;
  background: transparent;
  border: 0;
  cursor: pointer;
  user-select: none;
  animation: wb-present-bob 1.55s ease-in-out infinite;
  filter: drop-shadow(0 5px 8px rgb(0 0 0 / .35));
  transition: filter .15s, transform .15s;
}
.wb-present-btn:hover {
  filter: drop-shadow(0 7px 14px rgb(0 212 255 / .55));
}
.wb-present-btn:active {
  animation-play-state: paused;
  transform: scale(.94);
}
.wb-present-icon {
  width: 50px;
  height: 50px;
  display: block;
}
.wb-present-label {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: linear-gradient(180deg, #18d8ff 0%, #0088ff 100%);
  border: 2px solid #0b0d14;
  color: #ffffff;
  font-family: "BuilderSans", "Arial Black", sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.15;
  white-space: nowrap;
  text-shadow:
    -1px -1px 0 #0b0d14,
     1px -1px 0 #0b0d14,
    -1px  1px 0 #0b0d14,
     1px  1px 0 #0b0d14,
     0    2px 0 #0b0d14;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / .45), 0 2px 0 #0b0d14;
}

@keyframes wb-present-bob {
  0%, 100% { transform: translateY(0px) rotate(-1.5deg); }
  50%      { transform: translateY(-9px) rotate(1.5deg); }
}

/* Hide present once ads are removed for today or while in fullscreen */
html.wb-ads-removed .wb-present-btn,
:fullscreen .wb-present-btn {
  display: none !important;
}

/* Fullscreen button — top-right corner */
.wb-fs-btn {
  position: fixed;
  top: 24px;
  right: 14px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 2.5px solid #0b0d14;
  background: linear-gradient(180deg, #3366ff 0%, #1d44d8 100%);
  color: #ffffff;
  font-family: "BuilderSans", sans-serif;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  text-shadow: 0 1.5px 0 #0b0d14;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / .35), 0 3px 0 #0b0d14, 0 5px 12px rgb(0 0 0 / .28);
  transition: transform .1s, filter .15s;
}
.wb-fs-btn:hover { filter: brightness(1.09); transform: translateY(-1px); }
.wb-fs-btn:active { transform: translateY(1px); box-shadow: inset 0 2px 0 rgb(255 255 255 / .25), 0 1px 0 #0b0d14; }
.wb-fs-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wb-fs-btn .wb-fs-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgb(0 0 0 / .35);
  border: 1px solid rgb(255 255 255 / .25);
}
.wb-fs-btn.unlocked {
  background: linear-gradient(180deg, #4ae81c 0%, #1fb300 100%);
}
html.wb-ads-removed .wb-fs-btn,
:fullscreen .wb-fs-btn {
  top: auto;
  bottom: 14px;
  right: 14px;
  height: 36px;
  font-size: 12.5px;
  opacity: .88;
}
html.wb-ads-removed .wb-fs-btn:hover,
:fullscreen .wb-fs-btn:hover {
  opacity: 1;
}

/* Keep present & fullscreen clear of centered top AdSense banner on narrower screens */
@media (max-width: 1120px) {
  .wb-present-btn {
    top: calc(var(--ad-top-h, 0px) + 46px);
    left: calc(var(--ad-left-w, 0px) + 8px);
  }
  .wb-present-icon { width: 42px; height: 42px; }
  .wb-fs-btn {
    top: calc(var(--ad-top-h, 0px) + 46px);
    right: calc(var(--ad-right-w, 0px) + 8px);
    height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }
}

/* ============================================================================
   Roblox-Game-Style Studded Reward Modal ("Remove Ads!" & "Unlock Fullscreen!")
   ============================================================================ */
.wb-gift-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483640;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(6 8 18 / .72);
  backdrop-filter: blur(4px);
  animation: wb-fade-in .15s ease-out;
}
@keyframes wb-fade-in { from { opacity: 0; } }

.wb-gift-frame {
  width: min(640px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border-radius: 16px;
  border: 4px solid #0b0d14;
  background-color: #26253b;
  /* Roblox plastic stud pattern + subtle radial burst */
  background-image:
    radial-gradient(circle at 26% 36%, rgb(0 212 255 / .22) 0%, transparent 45%),
    repeating-conic-gradient(from 0deg at 50% 40%, rgb(255 255 255 / .03) 0deg 10deg, transparent 10deg 20deg),
    radial-gradient(circle at 12px 12px, rgb(255 255 255 / .07) 4.5px, rgb(0 0 0 / .24) 5.5px, transparent 6px);
  background-size: 100% 100%, 100% 100%, 24px 24px;
  box-shadow:
    inset 0 0 0 2px rgb(255 255 255 / .14),
    0 20px 50px rgb(0 0 0 / .65);
  color: #ffffff;
  font-family: "BuilderSans", "Arial Black", sans-serif;
  animation: wb-modal-pop .18s cubic-bezier(.22, 1.25, .36, 1);
}
@keyframes wb-modal-pop {
  from { opacity: 0; transform: scale(.92) translateY(10px); }
}

/* Top Cyan Glossy Striped Header Bar */
.wb-gift-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px 20px;
  border-bottom: 4px solid #0b0d14;
  background:
    repeating-linear-gradient(
      -52deg,
      rgb(255 255 255 / .18) 0 26px,
      transparent 26px 58px
    ),
    radial-gradient(circle at 10px 10px, rgb(255 255 255 / .16) 3.5px, transparent 4.5px),
    linear-gradient(90deg, #07d7ff 0%, #1e8bff 52%, #1ce8ff 100%);
  background-size: 100% 100%, 20px 20px, 100% 100%;
  box-shadow: inset 0 3px 0 rgb(255 255 255 / .45);
}

.wb-gift-title {
  margin: 0;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 800;
  line-height: 1.08;
  color: #ffffff;
  letter-spacing: -.01em;
  text-shadow:
    -2px -2px 0 #0b0d14,
     2px -2px 0 #0b0d14,
    -2px  2px 0 #0b0d14,
     2px  2px 0 #0b0d14,
     0    4px 0 #0b0d14;
}

.wb-gift-close {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 3px solid #0b0d14;
  background: linear-gradient(180deg, #ff4b5c 0%, #d90429 100%);
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-shadow: 0 2px 0 #0b0d14;
  box-shadow: inset 0 3px 0 rgb(255 255 255 / .35), 0 3px 0 #0b0d14;
  transition: transform .1s, filter .12s;
}
.wb-gift-close:hover { filter: brightness(1.1); transform: scale(1.05); }
.wb-gift-close:active { transform: scale(.95); }

/* Body */
.wb-gift-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Hero Row: Big Graphic Left + Wavy Headline Right */
.wb-gift-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.wb-gift-art {
  width: 146px;
  height: 146px;
  flex: none;
  filter: drop-shadow(0 8px 14px rgb(0 0 0 / .5));
  animation: wb-art-float 2.4s ease-in-out infinite;
}
@keyframes wb-art-float {
  0%, 100% { transform: translateY(0px) rotate(-2deg); }
  50%      { transform: translateY(-6px) rotate(2deg); }
}
.wb-gift-copy {
  flex: 1;
  min-width: 220px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.wb-gift-kicker {
  font-size: clamp(18px, 2.8vw, 24px);
  font-weight: 800;
  letter-spacing: .03em;
  background: linear-gradient(180deg, #ffe2e2 0%, #ff8a8a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(-2px -2px 0 #0b0d14) drop-shadow(2px 2px 0 #0b0d14) drop-shadow(0 3px 0 #0b0d14);
}
.wb-gift-headline {
  font-size: clamp(24px, 3.8vw, 34px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: .01em;
  background: linear-gradient(180deg, #42f5ff 0%, #24ff9c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(-2px -2px 0 #0b0d14) drop-shadow(2px 2px 0 #0b0d14) drop-shadow(0 4px 0 #0b0d14);
}
.wb-gift-sub {
  font-size: 13.5px;
  font-weight: 600;
  color: #cfd4ec;
  margin-top: 2px;
}

/* Requirement Cards (2-step Watch Ad #1 & Watch Ad #2) */
.wb-req-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 540px) {
  .wb-req-grid { grid-template-columns: 1fr; }
}

.wb-req-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 12px;
  border-radius: 12px;
  border: 3px solid #0b0d14;
  background: rgb(14 15 26 / .78);
  box-shadow: inset 0 2px 0 rgb(255 255 255 / .08);
  transition: border-color .15s, transform .12s;
}
.wb-req-card.done {
  border-color: #36e800;
  background: linear-gradient(180deg, rgb(22 72 18 / .55) 0%, rgb(14 15 26 / .85) 100%);
}
.wb-req-head {
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  color: #ffffff;
  text-shadow:
    -1.5px -1.5px 0 #0b0d14,
     1.5px -1.5px 0 #0b0d14,
    -1.5px  1.5px 0 #0b0d14,
     1.5px  1.5px 0 #0b0d14,
     0      2px   0 #0b0d14;
}

.wb-req-preview {
  position: relative;
  height: 92px;
  border-radius: 8px;
  border: 2px solid rgb(255 255 255 / .16);
  background: linear-gradient(180deg, #1b2238 0%, #101322 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  overflow: hidden;
}
.wb-req-preview svg { width: 34px; height: 34px; }
.wb-req-status {
  font-size: 12px;
  font-weight: 700;
  color: #b7c0e0;
}
.wb-req-card.done .wb-req-status { color: #67ff3d; }

.wb-req-watch-btn {
  width: 100%;
  height: 36px;
  border-radius: 8px;
  border: 2.5px solid #0b0d14;
  background: linear-gradient(180deg, #4b7bff 0%, #2651e8 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  text-shadow: 0 1.5px 0 #0b0d14;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / .35), 0 2px 0 #0b0d14;
  transition: transform .1s, filter .12s;
}
.wb-req-watch-btn:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.wb-req-watch-btn:active:not(:disabled) { transform: translateY(1px); }
.wb-req-watch-btn:disabled {
  background: #2f334a;
  color: #9ba3c4;
  cursor: default;
  box-shadow: none;
}
.wb-req-card.done .wb-req-watch-btn {
  background: linear-gradient(180deg, #49e619 0%, #1fb300 100%);
  color: #ffffff;
  opacity: .95;
}

/* Big Neon Green Studded "Claim!" / "Unlock!" Button */
.wb-claim-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.wb-claim-btn {
  width: min(320px, 100%);
  height: 58px;
  border-radius: 10px;
  border: 3.5px solid #0b0d14;
  background-color: #4be800;
  background-image:
    radial-gradient(circle at 10px 10px, rgb(255 255 255 / .24) 3.5px, rgb(0 0 0 / .12) 4.5px, transparent 5px),
    linear-gradient(180deg, #88ff26 0%, #3ee000 55%, #27b800 100%);
  background-size: 20px 20px, 100% 100%;
  color: #ffffff;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: .01em;
  cursor: pointer;
  text-shadow:
    -2px -2px 0 #0b0d14,
     2px -2px 0 #0b0d14,
    -2px  2px 0 #0b0d14,
     2px  2px 0 #0b0d14,
     0    4px 0 #0b0d14;
  box-shadow:
    inset 0 3px 0 rgb(255 255 255 / .5),
    0 5px 0 #0b0d14,
    0 8px 20px rgb(68 232 0 / .35);
  transition: transform .1s, filter .12s;
}
.wb-claim-btn:hover:not(.locked) { filter: brightness(1.07); transform: translateY(-2px); }
.wb-claim-btn:active:not(.locked) { transform: translateY(2px); box-shadow: inset 0 2px 0 rgb(255 255 255 / .3), 0 2px 0 #0b0d14; }
.wb-claim-btn.locked {
  filter: grayscale(.65) brightness(.72);
  box-shadow: 0 3px 0 #0b0d14;
}
.wb-claim-hint {
  font-size: 12.5px;
  font-weight: 600;
  color: #aeb6d6;
}

/* ============================================================================
   Sponsored Ad Viewer Sub-Overlay (when watching Ad #1 or Ad #2)
   ============================================================================ */
.wb-ad-watch-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 6px 0 4px;
}
.wb-ad-watch-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}
.wb-ad-progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 2px solid #0b0d14;
  background: #141524;
  overflow: hidden;
}
.wb-ad-progress-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00e5ff, #4be800);
  transition: width .25s linear;
}
.wb-ad-watch-box {
  position: relative;
  width: min(344px, 100%);
  height: 258px;
  border-radius: 10px;
  border: 3px solid #0b0d14;
  background: #141624;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
}
.wb-ad-watch-slot {
  width: 336px;
  height: 250px;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.wb-ad-watch-caption {
  font-size: 12.5px;
  font-weight: 600;
  color: #aeb6d6;
  text-align: center;
}
.wb-ad-watch-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.wb-watch-back {
  height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  border: 3px solid #0b0d14;
  background: linear-gradient(180deg, #3c415e 0%, #272a40 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  text-shadow: 0 1.5px 0 #0b0d14;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / .2), 0 3px 0 #0b0d14;
}
.wb-watch-back:hover { filter: brightness(1.12); }
.wb-watch-back:active { transform: translateY(1px); }

/* Reward Toast */
.wb-reward-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  padding: 10px 20px;
  border-radius: 10px;
  border: 3px solid #0b0d14;
  background: linear-gradient(180deg, #49e619 0%, #1fb300 100%);
  color: #ffffff;
  font-family: "BuilderSans", sans-serif;
  font-size: 15px;
  font-weight: 800;
  text-shadow: 0 1.5px 0 #0b0d14;
  box-shadow: 0 8px 24px rgb(0 0 0 / .45);
  animation: wb-modal-pop .18s ease-out;
}
