/* Rewarded "AD" chest draws (W01, ads-v1; ads-ui.js, docs/ADS.md). */
/* The AD badge: a small rounded "AD" plate with a play triangle (no third-party mark). */
.ad-badge{display:inline-flex;align-items:center;gap:3px;flex:none;padding:2px 6px 2px 5px;border-radius:7px;background:var(--gold-50);border:2px solid #3b1f14;box-shadow:0 2px 0 #3b1f14;color:#3b1f14;font:900 11px/1 system-ui;letter-spacing:.04em;-webkit-text-stroke:0}
.ad-badge i{width:0;height:0;border-style:solid;border-width:4px 0 4px 7px;border-color:transparent transparent transparent #e2502f}
.ad-badge.is-large{padding:4px 9px 4px 8px;border-radius:9px;font-size:14px;gap:5px}
.ad-badge.is-large i{border-width:6px 0 6px 10px}
/* AB12/AC03: the ad slot REPLACES a Gem-paid Draw 1 (one button: AD -> after watching ->
   a warm "Draw 1 / Free"), so the row keeps its two columns at every height;
   once today's ads are used the paid Draw 1 returns. AB19: the AD face has the
   draw buttons' shape (label line, then a pill), blue, not warm. */
#online .gemstone-draw-actions.has-ad{grid-template-columns:repeat(2,minmax(0,1fr))}
#online .gemstone-draw-actions.has-ad>button{grid-row:1;grid-column:auto}
/* Visual polish v1: the draw receipt reuses the chest card faces (blue ad Free draw). */
:is(#online,#modal) .gem-chest-buy.ad-draw-button:not(:disabled){--small-top:#8fe3ff;--small-bottom:#3aa7e0;--small-edge:#1d3f5c;--small-lip:#2a7fb0;--small-shine:#d9f6ff}
#online .ad-draw-button,#online .ad-ready-button{touch-action:manipulation}
#online .ad-ready-button .gemstone-price.is-free b{font:800 14px/1.1 system-ui}
#online .gemstone-draw-actions.has-ad>.gem-chest-buy{padding-left:4px;padding-right:4px}
#online .gemstone-draw-actions.has-ad .button-label{max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:clip}
#online .ad-draw-button .ad-price{gap:5px;padding-left:5px}
#online .ad-draw-button .ad-price .ad-badge{padding:1px 5px 1px 4px;border-width:2px;box-shadow:0 1px 0 #3b1f14;font-size:10px;paint-order:normal}

/* Full-screen in-house ad player (a top-layer dialog). */
dialog.ad-player{position:fixed;inset:0;width:100vw;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;background:#1a120d;color:#fff;overflow:hidden}
dialog.ad-player::backdrop{background:#000}
.ad-player .ad-stage{position:absolute;inset:0;overflow:hidden}
.ad-player .ad-stage img,.ad-player .ad-stage video{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
.ad-player .ad-stage video[hidden]{display:none}
/* AA01: the video stays rendered (iOS may not present frames of a display:none
   video) and transparent over the approved master until it actually plays. */
.ad-player .ad-stage video{opacity:0}
.ad-player .ad-stage video.is-playing{opacity:1}
/* Play: shown only when iOS refused, stalled or reduced motion waits for a tap.
   The AD button's blue plump face with the AD badge's play mark. */
#online .ad-player .ad-play{position:absolute;inset:0;margin:auto;width:max-content;max-width:calc(100% - 64px);height:max-content;display:flex;align-items:center;justify-content:center;gap:10px;min-height:64px;padding:8px 22px 8px 14px;border-radius:20px;border:3px solid #1d3f5c;background:linear-gradient(#8fe3ff,#3aa7e0);box-shadow:inset 0 2px #d9f6ff,0 4px 0 #1d3f5c;color:#fff;font:24px/1 Lucky;-webkit-text-stroke:3px #1d3f5c;paint-order:stroke fill;cursor:pointer;touch-action:manipulation}
#online .ad-player .ad-play[hidden]{display:none}
#online .ad-player .ad-play .button-label{white-space:nowrap}
#online .ad-player .ad-play i{position:relative;flex:none;width:38px;height:38px;border-radius:50%;background:var(--gold-50);border:3px solid #3b1f14;box-shadow:0 2px 0 #3b1f14}
#online .ad-player .ad-play i::after{content:'';position:absolute;left:12px;top:8px;border-style:solid;border-width:8px 0 8px 13px;border-color:transparent transparent transparent #e2502f}
#online .ad-player .ad-play:active{transform:translateY(2px);box-shadow:inset 0 2px #d9f6ff,0 2px 0 #1d3f5c}
.ad-player .ad-top{position:absolute;top:calc(var(--safe-top,env(safe-area-inset-top,0px)) + 12px);left:16px;right:16px;display:flex;align-items:center;gap:10px}
.ad-player .ad-note{padding:4px 10px;border-radius:10px;background:#0000006b;font:700 13px/1.2 system-ui;color:#ffe9c6}
/* AB11: today's count ("Free draw 1 of 2 today") and the big seconds countdown. */
.ad-player .ad-day{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.ad-player .ad-count{margin-left:auto;flex:none;display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:var(--gold-50);border:3px solid #3b1f14;box-shadow:0 2px 0 #3b1f14;color:#3b1f14;font:26px/1 Lucky;transition:opacity .2s}
.ad-player .ad-count.is-done{opacity:0}
/* AB11: the TV-2 still gets a slow camera push-in (transform only); reduced
   motion keeps the still at its end state. */
.ad-player .ad-stage .ad-still{animation:ad-still-push 6s ease-out both}
@keyframes ad-still-push{from{transform:scale(1)}to{transform:scale(1.05)}}
@media(prefers-reduced-motion:reduce){.ad-player .ad-stage .ad-still{animation:none;transform:scale(1.05)}}
.ad-player .ad-progress{position:absolute;left:16px;right:16px;top:calc(var(--safe-top,env(safe-area-inset-top,0px)) + 50px);height:5px;border-radius:3px;background:#ffffff38;overflow:hidden}
.ad-player .ad-progress i{position:absolute;inset:0;background:#ffd166;transform-origin:left;transform:scaleX(0);transition:transform .25s linear}
.ad-player .ad-bottom{position:absolute;left:0;right:0;bottom:0;padding:34px 16px calc(var(--safe-bottom,env(safe-area-inset-bottom,0px)) + 16px);background:linear-gradient(#0000,#000000b3 40%);display:flex;flex-direction:column;gap:10px}
.ad-player .ad-hint{margin:0;text-align:center;font:18px/1.2 Lucky;color:#fff;-webkit-text-stroke:3px #2b1a10;paint-order:stroke fill}
.ad-player .ad-actions{display:grid;grid-template-columns:1fr 1.35fr;gap:10px}
#online .ad-player .ad-actions .secondary{width:100%;min-width:0;min-height:56px;margin:0;font-size:21px}
#online .ad-player .ad-claim:disabled{opacity:1}
#online .ad-player .ad-claim.is-ready{--small-top:var(--btn-claim-top);--small-bottom:var(--btn-claim-bottom);--small-edge:var(--btn-claim-edge);--small-lip:var(--btn-claim-lip);--small-shine:var(--btn-claim-shine)}
/* AC390 supersedes AC92's duplicate AD | Buy row. The clip card owns one
   compact action; the server's availability and watched state are unchanged. */
#modal .energy-purchase-offer.is-ad{min-height:106px;background:#f1f8ff;border-color:#8cb7d8;box-shadow:inset 0 2px #fff,0 3px #8fb0c9}
#modal .energy-ad-button:not(:disabled){--small-top:#8fe3ff;--small-bottom:#3aa7e0;--small-edge:#1d3f5c;--small-lip:#2a7fb0;--small-shine:#d9f6ff;touch-action:manipulation}
#modal .energy-ad-button.is-warm:not(:disabled){--small-top:var(--honey-200);--small-bottom:#f2a23a;--small-edge:#5a3410;--small-lip:#b8681c;--small-shine:var(--cream-350)}
#modal .energy-ad-button .ad-badge{padding:2px 6px;font-size:13px;-webkit-text-stroke:0;text-shadow:none}
/* AC120 (build 55): the Buried Treasures dig refill sits in the dig counter well,
   between the dig and scan counters, only at zero digs (or watched and unclaimed).
   The AD shape (AB19): "+15" over the AD pill with today's count, narrow enough
   to sit between both counters in every locale; warm "Claim +15" once watched. */
#online .mining-charge-well.has-ad{gap:8px;padding-top:4px;padding-bottom:4px}
#online .miner-ad-button{flex:none;display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;width:auto;min-width:0;height:auto;min-height:52px;margin:0;padding:8.5px 10px;font-size:18px;line-height:1;white-space:nowrap;touch-action:manipulation}
#online .miner-ad-button:not(:disabled){--small-top:#8fe3ff;--small-bottom:#3aa7e0;--small-edge:#1d3f5c;--small-lip:#2a7fb0;--small-shine:#d9f6ff}
#online .miner-ad-button.is-warm:not(:disabled){--small-top:var(--honey-200);--small-bottom:#f2a23a;--small-edge:#5a3410;--small-lip:#b8681c;--small-shine:var(--cream-350)}
#online .miner-ad-button .ad-price{display:inline-flex;align-items:center;gap:5px;padding:1px 7px 1px 5px;border-radius:9px;background:#173a5acc;color:#fff;font:800 13px/16px system-ui;-webkit-text-stroke:0}
#online .miner-ad-button .ad-price .ad-badge{padding:1px 5px 1px 4px;border-width:2px;box-shadow:0 1px 0 #3b1f14;font-size:10px}
#online .mining-charge-well.has-ad .mining-counter small{text-wrap:balance}
#online .miner-ad-button.is-warm .button-label{max-width:80px;white-space:normal;text-wrap:balance;text-align:center;line-height:1.05}

/* AC436: event refills share the established blue Free draw action and AD pill. */
#modal .event-gift-ad{width:120px;min-width:120px;min-height:64px;margin:0;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:3px;padding:8px 6px 10px;font-size:18px}
#modal .event-gift-ad.ad-draw-button:not(:disabled){--small-top:#8fe3ff;--small-bottom:#3aa7e0;--small-edge:#1d3f5c;--small-lip:#2a7fb0;--small-shine:#d9f6ff}
#modal .event-gift-ad .ad-price{display:inline-flex;align-items:center;gap:5px;margin:0;font:800 12px/16px system-ui;-webkit-text-stroke:0;text-shadow:none}
#modal .event-gift-ad .ad-price .ad-badge{padding:1px 5px 1px 4px;border-width:2px;font-size:10px}
@media(max-width:390px){.event-gift-pack>article{gap:8px;padding:8px}.event-gift-pack>article b{font-size:16px}}
