/* Garden Guard++ web: immersive look, frosted-glass panels (owner: Bill). Loaded LAST.
   The garden canvas fills the screen behind everything (Hank's layout contract); the header, the side
   panel and the cards float on it as translucent, blurred "glass" with light garden touches.
   Contrast: the glass is always LIGHT (dark ink on it), so the text reads the same over grass, soil,
   autumn leaves, night and snow. Snow is the hard case for the EDGE of a light panel, so every panel
   also has a darker green hairline + soft shadow that separates it from white ground.
   No backdrop-filter (old browsers): the same panels, just more opaque (see @supports at the end). */
:root {
  --glass: rgba(248, 252, 242, .66);          /* panel fill (the blur does most of the work) */
  --glass-strong: rgba(250, 253, 246, .84);   /* cards, tooltips: text-heavy */
  --glass-chip: rgba(255, 255, 255, .58);     /* stat pills, shop cards, buttons on glass */
  --glass-edge: rgba(47, 90, 40, .30);        /* hairline: visible on snow and on dark grass */
  --glass-hi: rgba(255, 255, 255, .75);       /* top highlight (inner) */
  --glass-blur: blur(14px) saturate(1.35);
  --glass-shadow: 0 6px 22px rgba(20, 40, 12, .22), 0 1px 3px rgba(20, 40, 12, .18);
}

/* ---- Panels: header and side ---- */
#header, #side {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
}
#header { border-radius: 16px; padding: 6px 10px; }
#side { border-radius: 16px; overflow: visible; }
/* Garden touch: a thin leafy band along the top edge of the side panel. */
#side::before { content: ""; position: absolute; left: 14px; right: 14px; top: -1px; height: 3px;
  border-radius: 0 0 3px 3px; pointer-events: none;
  background: linear-gradient(90deg, rgba(76,175,80,0), rgba(76,175,80,.85) 20%, rgba(139,195,74,.85) 80%, rgba(139,195,74,0)); }
#title { color: #22702c; text-shadow: 0 1px 0 rgba(255,255,255,.7); }

/* Stat pills: brighter chips on the glass. */
.stat { background: var(--glass-chip); border-color: rgba(47, 90, 40, .22); }
.stat.bump { background: rgba(255, 243, 196, .92); border-color: var(--gold); }
.stat.low { background: rgba(255, 236, 232, .9); }

/* Buttons on glass: translucent white, crisp edge; the coloured ones (primary/danger) stay solid. */
#header button, #side button:not(.primary):not(.danger), .card button:not(.primary):not(.danger):not([aria-pressed="true"]) {
  background: var(--glass-chip); border-color: rgba(47, 90, 40, .24); }
#header button:hover:not(:disabled), #side button:not(.primary):not(.danger):hover:not(:disabled),
.card button:not(.primary):not(.danger):not([aria-pressed="true"]):hover:not(:disabled) { background: rgba(255, 255, 255, .85); }
#header button:active:not(:disabled), #side button:not(.primary):not(.danger):active:not(:disabled),
.card button:not(.primary):not(.danger):not([aria-pressed="true"]):active:not(:disabled) { background: rgba(230, 239, 218, .95); }
#side button:not(.primary):not(.danger):disabled, .card button:not(.primary):not(.danger):not([aria-pressed="true"]):disabled {
  background: rgba(243, 246, 238, .45); color: #8f9a85; }
.iconBtn.on, #header button.iconBtn.on { background: rgba(255, 243, 196, .95); border-color: var(--gold); }
button.primary { box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 2px 6px rgba(30, 90, 35, .25); }
/* Disabled green buttons ("Wave 4…", "Max level"): white-on-pale-green was ~1.6:1 over snow. */
button.primary:disabled { background: rgba(196, 224, 192, .85); color: #4f7a4c; border-color: rgba(47, 138, 58, .35);
  box-shadow: none; }

/* ---- Shop cards ---- */
#side .shopItem { background: var(--glass-chip); border-color: rgba(47, 90, 40, .18); }
#side .shopItem:hover:not(:disabled) { background: rgba(255, 255, 255, .82); border-color: var(--green2); }
#side .shopItem.checked { background: rgba(200, 235, 190, .88); border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, .25); }
#side .shopItem.fresh { background: rgba(255, 248, 220, .9); border-color: #f2b705; }
#side .shopItem.fresh.checked { background: rgba(255, 233, 160, .92); }
#side .shopItem:disabled { background: rgba(240, 243, 235, .38); border-color: rgba(47, 90, 40, .10); }
#side .shopItem:disabled .shopIcon { opacity: .55; filter: saturate(.6); }
#side .shopItem:disabled .shopName { color: #7f8a75; }   /* #a3ad99 was too faint on glass */
#side .shopItem:disabled .shopCost { color: #c0410c; }
.shopKey { background: rgba(255, 255, 255, .8); }

/* Plant info + plant panel: slightly more solid sub-panels (lots of small text). */
#shopInfo, #towerPanel { background: rgba(255, 255, 255, .55); border-color: rgba(47, 90, 40, .18); }
#tpLevel, #tpStats td:first-child, #shopInfo i, #hint, #touchHint { color: #55644b; }   /* darker muted */

/* Wave footer: a soft divider instead of a hard box. */
#sideFoot { border-top: 1px solid rgba(47, 90, 40, .12); padding-top: 8px; }
#startWave { box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 3px 10px rgba(30, 90, 35, .3); }
#nextWave { color: var(--ink); }

/* Side toggle (phones): a glass tab. */
#sideToggle { background: var(--glass-strong) !important; border-color: var(--glass-edge) !important;
  box-shadow: var(--glass-shadow); }

/* ---- Toast and paused banner: dark glass ---- */
#toast { background: rgba(28, 44, 20, .74); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25); border: 1px solid rgba(255, 255, 255, .18); }
#toast.error { background: rgba(224, 83, 61, .9); }
#pausedBanner { background: rgba(20, 32, 14, .6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .2); box-shadow: 0 6px 24px rgba(0, 0, 0, .3); }
#btnZoomReset { opacity: 1; background: var(--glass-strong); border-color: var(--glass-edge); box-shadow: var(--glass-shadow); }

/* ---- Overlay cards ---- */
.overlay { background: rgba(20, 32, 14, .38); }
.card { background: var(--glass-strong);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, .6);
  box-shadow: 0 12px 40px rgba(10, 25, 5, .35), inset 0 1px 0 rgba(255, 255, 255, .8); }
.cardTitle { color: #22702c; }

/* ---- Phones (<= 560px tall): cheaper glass. The board redraws every frame, and a big blur radius
   over it costs on phone GPUs: smaller radius, a bit more fill so it still reads as glass. ---- */
@media (max-height: 560px) {
  :root { --glass: rgba(248, 252, 242, .74); --glass-blur: blur(8px) saturate(1.25); }
  /* Every px counts here (phone-fit: the plant panel + 🎯 + Cancel focus must fit above the footer). */
  #header { border-radius: 12px; padding: 1px 2px; }
  #side { border-radius: 12px; }
  #side::before { left: 10px; right: 10px; }
  #sideFoot { border-top: none; padding-top: 0; }
  .card { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}

/* ---- Tablets upright (portrait.css layout): the panel hugs its content (wave button right under the
   plant panel) instead of stretching to the bottom, so the garden shows below it. ---- */
@media (orientation: portrait) and (min-width: 600px) {
  #side { flex: 0 1 auto; }
  #sideBody { flex: 0 1 auto; }
}

/* ---- No backdrop-filter (Firefox < 103, old WebViews): same look, more opaque fills. ---- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: rgba(246, 250, 240, .93); --glass-strong: rgba(250, 253, 246, .97);
    --glass-chip: rgba(255, 255, 255, .85); }
  #toast { background: rgba(28, 44, 20, .92); }
  #pausedBanner { background: rgba(20, 32, 14, .85); }
}
/* Users who ask for less transparency (macOS/iOS setting; Chrome 118+): near-solid panels. */
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: rgba(246, 250, 240, .96); --glass-strong: #fbfdf7; --glass-chip: rgba(255, 255, 255, .92); }
}
