/* Slim 4-edge Google AdSense rails + Clean Flat Roblox-Native Remove Ads & Fullscreen UI */
:root {
  --ad-top-h: 52px;
  --ad-bottom-h: 52px;
  --ad-left-w: 112px;
  --ad-right-w: 112px;
  --ad-bg: var(--topbar-bg, #ffffff);
  --ad-border: var(--line, #dee1e3);
  --ad-label: var(--muted, #606162);
  --ad-slot-bg: var(--surface, #f2f4f5);
}

body.playing {
  --ad-bg: #121215;
  --ad-border: #262830;
  --ad-label: #7d8596;
  --ad-slot-bg: #191a1f;
}

/* Collapse side rails below 1440px so sidebar + content never feel cramped or far apart */
@media (max-width: 1439px) {
  :root {
    --ad-top-h: 50px;
    --ad-bottom-h: 50px;
    --ad-left-w: 0px;
    --ad-right-w: 0px;
  }
}

@media (max-width: 767px) {
  :root {
    --ad-top-h: 46px;
    --ad-bottom-h: 46px;
    --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: 1439px) {
  .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%;
}

.wb-ad-unit-h { display: inline-block; width: 468px; height: 48px; }
.wb-ad-unit-v { display: inline-block; width: 108px; height: 520px; }
.wb-ad-frame { border: 0; background: transparent; overflow: hidden; display: block; }

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

.wb-ad-tag {
  position: absolute; top: 2px; left: 5px;
  font-size: 8.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ad-label); opacity: .5; pointer-events: none; line-height: 1;
}

: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,
html.wb-modal-open .wb-ad-rail {
  display: none !important;
}

/* ---- Clean Native Topbar Controls (Zero Floating Overlap on Site UI!) ---- */
.wb-present-btn,
.wb-fs-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--line, #2c2e35);
  background: var(--surface, #202227);
  color: var(--fg, #f7f7f8);
  font-family: "BuilderSans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background .12s, border-color .12s;
}
.wb-present-btn:hover,
.wb-fs-btn:hover {
  background: var(--surface-2, #2b2d33);
  border-color: var(--line-strong, #464952);
}

.wb-present-icon { width: 16px; height: 16px; display: grid; place-items: center; flex: none; }
.wb-present-icon svg { width: 16px; height: 16px; display: block; }
.wb-present-badge,
.wb-fs-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #a1a5ad);
}

.wb-fs-btn svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none;
}
.wb-fs-btn.unlocked svg { color: #02b757; }

/* Only float cleanly in corners during fullscreen WASM gameplay (when topbar is hidden) */
body.playing .wb-present-btn,
body.playing .wb-fs-btn {
  position: fixed;
  top: calc(var(--ad-top-h, 0px) + 8px);
  z-index: 82;
  background: #191a1f;
  border-color: #2f3138;
  color: #f7f7f8;
}
body.playing .wb-present-btn { left: calc(var(--ad-left-w, 0px) + 10px); }
body.playing .wb-fs-btn { right: calc(var(--ad-right-w, 0px) + 10px); }

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

@media (max-width: 960px) {
  .wb-present-label,
  .wb-fs-btn span:not(.wb-fs-badge) { display: none; }
  .wb-present-btn,
  .wb-fs-btn { padding: 0 7px; }
}

/* ---- Clean Flat Roblox-Style Reward Modal (No AI Glass/Glow!) ---- */
.wb-gift-backdrop {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
}

.wb-gift-frame {
  position: relative;
  width: min(500px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--line, #2c2e35);
  background: var(--bg, #191a1f);
  color: var(--fg, #f7f7f8);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  font-family: "BuilderSans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.wb-gift-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line, #2c2e35);
}

.wb-gift-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--fg, #f7f7f8);
}

.wb-gift-close {
  width: 28px; height: 28px; border-radius: 6px; border: 0;
  background: transparent; color: var(--muted, #a1a5ad);
  font-size: 14px; font-weight: 700; cursor: pointer;
  display: grid; place-items: center;
}
.wb-gift-close:hover { background: var(--surface, #202227); color: var(--fg, #f7f7f8); }

.wb-gift-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wb-gift-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 6px;
  background: var(--surface, #202227);
  border: 1px solid var(--line, #2c2e35);
}

.wb-gift-art { width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.wb-gift-art svg { width: 40px; height: 40px; display: block; }
.wb-gift-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wb-gift-kicker { display: none; }
.wb-gift-headline { font-size: 16px; font-weight: 700; color: var(--fg, #f7f7f8); }
.wb-gift-sub { font-size: 13px; color: var(--muted, #a1a5ad); line-height: 1.4; }

.wb-req-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.wb-req-card {
  display: flex; flex-direction: column; gap: 10px; padding: 12px;
  border-radius: 6px; background: var(--surface, #202227); border: 1px solid var(--line, #2c2e35);
}
.wb-req-card.done { border-color: #02b757; }
.wb-req-head { font-size: 13px; font-weight: 700; color: var(--fg, #f7f7f8); }
.wb-req-preview { display: flex; align-items: center; gap: 8px; }
.wb-req-preview svg { width: 28px; height: 28px; flex: none; }
.wb-req-status { font-size: 12.5px; color: var(--muted, #a1a5ad); }
.wb-req-card.done .wb-req-status { color: #02b757; font-weight: 600; }

.wb-req-watch-btn {
  height: 34px; width: 100%; border-radius: 6px; border: 0;
  background: #335fff; color: #ffffff; font-size: 13px; font-weight: 700; cursor: pointer;
}
.wb-req-watch-btn:hover:not(:disabled) { background: #244ee6; }
.wb-req-watch-btn:disabled { background: var(--surface-2, #2b2d33); color: var(--muted, #a1a5ad); cursor: default; }
.wb-req-card.done .wb-req-watch-btn:disabled { color: #02b757; }

.wb-claim-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }

.wb-claim-btn {
  width: 100%; height: 40px; border-radius: 8px; border: 0;
  background: #02b757; color: #ffffff; font-size: 14.5px; font-weight: 700; cursor: pointer;
}
.wb-claim-btn:hover:not(:disabled) { filter: brightness(1.06); }
.wb-claim-btn.locked { background: #335fff; }
.wb-claim-btn:disabled { opacity: .45; cursor: not-allowed; }
.wb-claim-hint { font-size: 12.5px; color: var(--muted, #a1a5ad); text-align: center; }

.wb-ad-watch-panel { display: flex; flex-direction: column; gap: 12px; }
.wb-ad-watch-top { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; }
.wb-ad-progress-bar { height: 5px; border-radius: 999px; background: var(--surface-2, #2b2d33); overflow: hidden; }
.wb-ad-progress-bar i { display: block; height: 100%; width: 0%; background: #335fff; transition: width .2s linear; }
.wb-ad-watch-box {
  min-height: 260px; border-radius: 6px; background: var(--surface, #202227);
  border: 1px solid var(--line, #2c2e35); display: flex; align-items: center; justify-content: center; padding: 8px;
}
.wb-ad-watch-slot { width: 336px; height: 250px; max-width: 100%; display: flex; align-items: center; justify-content: center; }
.wb-ad-watch-caption { font-size: 12px; color: var(--muted, #a1a5ad); text-align: center; }
.wb-ad-watch-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wb-watch-back {
  height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--outline-border, #555963);
  background: transparent; color: var(--fg, #f7f7f8); font-size: 14px; font-weight: 600; cursor: pointer;
}
.wb-watch-back:hover { background: var(--surface, #202227); }

.wb-reward-toast {
  position: fixed; left: 50%; bottom: calc(var(--ad-bottom-h, 0px) + 18px); transform: translateX(-50%);
  z-index: 990; padding: 9px 16px; border-radius: 6px;
  background: #191a1f; border: 1px solid #02b757; color: #ffffff;
  font-size: 13px; font-weight: 700; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

@media (max-width: 560px) { .wb-req-grid { grid-template-columns: 1fr; } }
