/* Pear Presser — optional ad boosts: the Boosts button on the Press screen, the Boosts sheet,
 * the test advert screen, the welcome-back doubler and the Settings section. Same candy look as
 * the rest. Nothing here animates to attract attention: adverts are never forced.
 * Desktop-only rules are in css/desktop.css, which loads after this file. */

.ico-gift { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2.500 8.500h8.300v4.200H2.500zM13.200 8.500h8.300v4.200h-8.300zM4 14.200h6.800V21.500H5.500A1.500 1.500 0 0 1 4 20zM13.200 14.200H20V20a1.500 1.500 0 0 1-1.500 1.500h-5.300zM11.300 7.300C9.800 4 7.600 2.200 5.800 3c-1.700.800-1.500 3.300.6 4.300zM12.700 7.300c1.500-3.300 3.700-5.100 5.500-4.300 1.700.800 1.500 3.300-.6 4.300z'/%3E%3C/svg%3E"); }
.ico-play { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.300a1.200 1.200 0 0 1 1.800-1l11.400 7.700a1.200 1.200 0 0 1 0 2L8.800 20.700a1.200 1.200 0 0 1-1.800-1z'/%3E%3C/svg%3E"); }

/* --- the Boosts button: a third candy tile, tucked under the Arcade tile at the top right of the pear's area --- */
#hud { position: relative; }
.quick.boost-btn { --c1: #a6f5d6; --c2: #0f9f7c; position: absolute; right: 0; top: calc(100% + 5px); }
.boost-btn .dot { position: absolute; top: -5px; right: 2px; z-index: 3; width: 14px; height: 14px; border-radius: 50%; background: #ff3d6e; border: 2.5px solid var(--ink); box-shadow: inset 0 2px 0 rgba(255,255,255,.45); }
@media (max-width: 350px) { .boost-btn .dot { right: -1px; } }

/* --- the Boosts sheet --- */
dialog.ads-dlg { width: min(94vw, 400px); max-height: min(88vh, 760px); max-height: min(88dvh, 760px); }
.ads-dlg .dlg-body { align-items: stretch; text-align: left; gap: 8px; padding: 14px 12px 6px; }
.ads-sheet { display: flex; flex-direction: column; gap: 8px; }
.ads-sheet p { max-width: none; margin: 0; }
.ad-intro { text-align: center; font-family: var(--display); font-weight: 600; font-size: 15px; line-height: 1.25; text-wrap: balance; }
.ad-today { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 12px; border-radius: 999px; border: 2.5px solid var(--ink); background: #fffdf2; font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.ad-today b { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ad-test { font-size: 12px; line-height: 1.25; }
.ad-notice { display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 7px; border-radius: 16px; border: 2.5px solid var(--ink); background: linear-gradient(180deg, #f6ffe0, #d3f08f); font-size: 14px; }
.ad-notice .ti { width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); display: grid; place-items: center; font-size: 18px; flex: none; }
.ad-notice b { display: block; font-family: var(--display); font-weight: 600; font-size: 15px; line-height: 1.15; }
.ad-notice small { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.ad-list { display: flex; flex-direction: column; gap: 8px; }
.ad-card { --c1: #ffe873; --c2: #ffab1f; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 8px 9px; border: 2.5px solid var(--ink); border-radius: 18px;
  background: linear-gradient(180deg, #fffdf2, #fff1bd); box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.9); }
.ad-card.is-on { background: linear-gradient(180deg, #f6ffe0, #dcf5a2); }
.ad-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; line-height: 1; border: 2.5px solid var(--ink);
  background: radial-gradient(circle at 26% 20%, rgba(255,255,255,.88) 0 8%, rgba(255,255,255,0) 9%), linear-gradient(180deg, var(--c1), var(--c2));
  box-shadow: 0 3px 0 var(--ink), inset 0 -5px 0 rgba(0,0,0,.16), inset 0 2px 0 rgba(255,255,255,.55); }
.ad-ico > span { filter: drop-shadow(0 2px 0 rgba(0,0,0,.28)); }
.ad-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ad-name { margin: 0; font-family: var(--display); font-weight: 600; font-size: 16px; line-height: 1.15; }
.ad-desc { font-size: 12.5px; line-height: 1.25; font-weight: 600; color: var(--ink-soft); }
.ad-state { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; font-size: 12px; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; }
.ad-on { padding: 0 7px; border-radius: 999px; border: 2px solid var(--ink); background: #c9f24f; font-family: var(--display); font-weight: 600; white-space: nowrap; }
.ad-watch { min-height: 40px; min-width: 88px; padding: 6px 12px 6px 9px; font-size: 15.5px; }
.ad-watch .ico { font-size: 15px; }
.ad-more { font-size: 12px; line-height: 1.3; font-weight: 700; color: var(--ink-soft); text-align: center; text-wrap: pretty; }

/* --- the test advert: a full-screen placeholder --- */
dialog.ad-screen { position: fixed; top: 0; left: 0; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow-y: auto; overscroll-behavior: contain;
  background: radial-gradient(ellipse at 50% 30%, #34508c, #141c38 78%); color: #fff; }
dialog.ad-screen::backdrop { background: #141c38; }
.ad-frame:focus { outline: none; }
.ad-frame { box-sizing: border-box; min-height: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px;
  padding: calc(10px + var(--sat)) calc(14px + var(--sar)) calc(14px + var(--sab)) calc(14px + var(--sal)); }
.ad-top { display: flex; align-items: center; gap: 10px; }
.ad-label { flex: 1; min-width: 0; padding: 6px 12px; border-radius: 14px; border: 2.5px solid var(--ink); color: var(--ink); font-family: var(--display); font-weight: 600; font-size: 14px; line-height: 1.2;
  background: repeating-linear-gradient(-45deg, #ffe873 0 12px, #fff6bf 12px 24px); box-shadow: 0 3px 0 var(--ink); }
.ad-label b { font-weight: 700; font-size: 16px; }
.ad-close { flex: none; }
.ad-stage { flex: 1; min-height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; border-radius: 24px;
  border: 3px dashed rgba(255,255,255,.5); background: rgba(255,255,255,.07); }
.ad-tv { width: 92px; height: 92px; border-radius: 28px; display: grid; place-items: center; font-size: 50px; line-height: 1; border: 3px solid var(--ink);
  background: radial-gradient(circle at 26% 20%, rgba(255,255,255,.88) 0 8%, rgba(255,255,255,0) 9%), linear-gradient(180deg, #a4e2ff, #3f8fe6); box-shadow: 0 4px 0 var(--ink), inset 0 -6px 0 rgba(0,0,0,.16); }
.ad-stage p { margin: 0; max-width: 32ch; }
.ad-stage-title { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.15; -webkit-text-stroke: 4.5px var(--ink); paint-order: stroke fill; }
.ad-stage-text { font-size: 13.5px; font-weight: 700; line-height: 1.35; color: #d8e2ff; text-wrap: pretty; }
.ad-foot { display: flex; flex-direction: column; gap: 9px; padding: 12px; border-radius: 22px; border: 3px solid var(--ink); background: var(--cream); color: var(--ink); box-shadow: 0 5px 0 var(--ink); }
.ad-foot p { margin: 0; text-align: center; }
.ad-reward { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 10px; text-align: left; }
.ad-reward-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; line-height: 1; border: 2.5px solid var(--ink);
  background: radial-gradient(circle at 26% 20%, rgba(255,255,255,.88) 0 8%, rgba(255,255,255,0) 9%), linear-gradient(180deg, var(--c1, #ffe873), var(--c2, #ffab1f)); box-shadow: 0 3px 0 var(--ink), inset 0 -5px 0 rgba(0,0,0,.16); }
.ad-reward small { display: block; font-size: 11.5px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; }
.ad-reward b { display: block; font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1.15; }
.ad-reward span span, .ad-reward div > span { display: block; font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--ink-soft); }
.ad-bar { height: 18px; border-radius: 999px; border: 2.5px solid var(--ink); background: #e6d69c; overflow: hidden; box-shadow: inset 0 2px 0 rgba(0,0,0,.12); }
.ad-bar i { display: block; width: 0; height: 100%; background: linear-gradient(180deg, #d4ff6a, #58b81e); box-shadow: inset 0 2px 0 rgba(255,255,255,.5); }
.ad-count { font-family: var(--display); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.ad-collect { width: 100%; font-size: 18px; font-weight: 700; }
.ad-hint { font-size: 12px; font-weight: 700; line-height: 1.3; color: var(--ink-soft); }
.ad-screen.is-done .ad-hint { visibility: hidden; }

/* --- welcome back: Collect stays the main button, the ad is a quiet second choice under it --- */
.away-dlg .dlg-actions { flex-direction: column; gap: 8px; }
.away-dlg .dlg-actions .btn { flex: none; }
.away-dlg .away-ad { min-height: 40px; font-size: 14.5px; }
.away-note { font-size: 12.5px; }

/* --- settings --- */
.ads-count { font-family: var(--display); font-weight: 700; font-size: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (max-width: 350px) {
  .ads-dlg .dlg-body { padding: 13px 9px 5px; }
  .ad-card { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 4px 7px; padding: 7px; }
  .ad-ico { width: 44px; height: 44px; font-size: 24px; border-radius: 14px; }
  .ad-name { font-size: 15px; }
  .ad-desc { font-size: 12px; }
  .ad-watch { min-width: 0; padding: 6px 9px 6px 7px; font-size: 14.5px; }
  /* the state line gets the full width under the text and the button */
  .ad-main { display: contents; }
  .ad-ico { grid-column: 1; grid-row: 1 / span 2; align-self: start; }
  .ad-name { grid-column: 2; grid-row: 1; align-self: end; }
  .ad-desc { grid-column: 2; grid-row: 2; align-self: start; }
  .ad-watch { grid-column: 3; grid-row: 1 / span 2; }
  .ad-state { grid-column: 2 / -1; grid-row: 3; }
  .ad-label { font-size: 13px; padding: 5px 9px; }
  .ad-label b { font-size: 14.5px; }
}
@media (max-height: 640px) {
  .ad-frame { gap: 9px; }
  .ad-stage { min-height: 96px; padding: 10px; gap: 5px; }
  .ad-tv { width: 62px; height: 62px; font-size: 34px; border-radius: 20px; }
  .ad-stage-title { font-size: 19px; }
  .ad-stage-text { font-size: 12.5px; }
  .ad-foot { padding: 10px; gap: 7px; }
}

/* Phone layout: the header holds only the essentials (world, gems + Shop, juice, rates).
   Quest, Boosts and Arcade float as side buttons beside the pear, so the pear gets the room. (Desktop keeps its own layout.) */
@media (max-width: 1023.98px), (max-height: 559.98px) {
  #hud { position: relative; }
  .hud-quick { display: block; min-height: 0; }
  .hud-quick .juice-card { margin-top: 0; }
  .hud-quick .quick, .hud-quick .quick.quest-chip, .hud-quick .quick.arcade-btn, .hud-quick .quick.boost-btn { position: absolute; top: calc(100% + 6px); width: 60px; margin: 0; }
  .hud-quick .quick.quest-chip { left: 0; right: auto; }
  .hud-quick .quick.boost-btn { left: 0; right: auto; top: calc(100% + 84px); }
  .hud-quick .quick.arcade-btn { right: 0; left: auto; }
  .hud-quick .quick .tile { width: 52px; height: 52px; border-radius: 18px; }
  .chip-gems { min-width: 132px; justify-content: space-between; padding-right: 5px; }
  .juice-amount { font-size: clamp(40px, 13vw, 58px); }
  .juice-amount.is-long { font-size: clamp(30px, 9.6vw, 44px); }
}
@media (max-width: 350px) { .chip-gems { min-width: 116px; } }
.chip-plus { width: auto; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; white-space: nowrap; }
