/* ============================================================
   WIZARD ACADEMY — ARCANE POLISH (refinement layer)
   Additive, performance-safe aesthetic lift. Loaded AFTER the
   theme + inline styles so it wins ties. No per-card backdrop
   blur and no layout-affecting animation: only color, gradient,
   shadow and transform/opacity, so the speed work stays intact.
   Structure, the Zeus/Hades hero and every menu are untouched.
   ============================================================ */

:root {
  --pol-gold: #f5c451;
  --pol-gold-soft: #ffe6a3;
  --pol-gold-deep: #a9761f;
  --pol-cyan: #35e6ff;
  --pol-violet: #a855f7;
  --pol-ink: #070a12;
  --pol-parchment: #f4ebd6;
  --pol-ash: #98a3b8;
}

/* ---------- document scrollbar, drawn in the shell's metal ---------- */
html:root {
  scrollbar-width: thin;
  scrollbar-color: var(--pol-gold-deep) rgba(255, 255, 255, .04);
  scroll-padding-top: 92px;
}
html:root::-webkit-scrollbar { width: 10px; height: 10px; }
html:root::-webkit-scrollbar-track { background: rgba(255, 255, 255, .03); }
html:root::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--pol-gold) 0%, var(--pol-gold-deep) 100%);
  border-radius: 99px;
  border: 2px solid #0b0e15;
}
html:root::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--pol-gold-soft) 0%, var(--pol-gold) 100%);
}
html:root body *::-webkit-scrollbar { width: 8px; height: 8px; }
html:root body *::-webkit-scrollbar-track { background: rgba(255, 255, 255, .03); }
html:root body *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--pol-gold-deep), #6b4a15);
  border-radius: 99px;
}
html:root body *::-webkit-scrollbar-thumb:hover { background: var(--pol-gold); }
html:root body ::selection { background: rgba(245, 196, 81, .3); color: #fff; }

/* ---------- game cards: readable titles over busy art ---------- */
/* A taller, smoother scrim so the title always sits on dark, never on art. */
html body .clean-card .relative::after,
html body #browser-games-grid .relative::after {
  height: 68% !important;
  background: linear-gradient(to top,
    rgba(5, 7, 13, .97) 0%, rgba(5, 7, 13, .78) 34%, rgba(5, 7, 13, .35) 62%, transparent 100%) !important;
}

/* The section-heading gradient must not leave card titles with a transparent fill. */
html body #browser-carousels-container#browser-carousels-container .clean-card :is(h4, h5),
html body #browser-games-grid#browser-games-grid .game-card :is(h4, h5) {
  color: #fff !important;
  -webkit-text-fill-color: currentColor !important;
  background: none !important;
  font-size: 12px !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 2px 10px rgba(0, 0, 0, .7) !important;
}
html body #browser-carousels-container#browser-carousels-container .clean-card :is(h4, h5) {
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2 !important;
  line-clamp: 2;
  white-space: normal !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

/* Rating / meta line: lift from dim gray to readable gold. */
html body .clean-card .text-amber-400,
html body #browser-games-grid .text-amber-400 {
  opacity: .95 !important;
  color: var(--pol-gold) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8) !important;
}

/* Duplicate IDs outrank theme rules, including on article cards. */
html body #browser-carousels-container#browser-carousels-container .clean-card,
html body #browser-games-grid#browser-games-grid > .game-card,
html body .wa-ag-card {
  border-color: rgba(245, 196, 81, .16) !important;
}
html body #browser-carousels-container#browser-carousels-container .clean-card:is(:hover, :focus-visible),
html body #browser-games-grid#browser-games-grid > .game-card:is(:hover, :focus-visible),
html body .wa-ag-card:is(:hover, :focus-visible) {
  border-color: rgba(245, 196, 81, .55) !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .55),
              0 0 0 1px rgba(245, 196, 81, .28),
              0 0 22px rgba(53, 230, 255, .16) !important;
}

/* ---------- shelf / section headings: gilded rune treatment ---------- */
html body #browser-carousels-container .wa-shelf > :first-child :is(h2, h3, h4),
html body .wa-ag-shelf-title h2 {
  background: linear-gradient(100deg, var(--pol-gold-soft) 0%, var(--pol-gold) 45%, #d99a2b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  letter-spacing: .02em;
  filter: drop-shadow(0 1px 6px rgba(245, 196, 81, .25));
}
/* Keep inline links (View More / Free to Play) their own readable colors. */
html body #browser-carousels-container .wa-shelf > :first-child :is(h2, h3, h4) :is(a, span) {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--pol-cyan) !important;
  -webkit-text-fill-color: currentColor;
  filter: none;
}

/* ---------- keyboard focus: a consistent arcane ring ---------- */
html body a:focus-visible, html body button:focus-visible,
html body input:focus-visible, html body select:focus-visible,
html body [role="button"]:focus-visible {
  outline: 2px solid var(--pol-cyan);
  outline-offset: 2px;
  border-radius: 6px;
}

html:not([data-theme="zeus"]):not([data-theme="hades"]) body {
  background: radial-gradient(ellipse 900px 560px at 85% 0, rgba(109, 66, 170, .09), transparent 72%),
              radial-gradient(ellipse 700px 500px at 8% 240px, rgba(30, 155, 179, .08), transparent 72%),
              #080b13 !important;
}

html body > header,
html body .site-chrome-header {
  background: linear-gradient(110deg, #151821, #0b101b 65%, #131420) !important;
  border-bottom-color: rgba(245, 196, 81, .2) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .24) !important;
}

html body #canvas-container {
  border: 1px solid rgba(245, 196, 81, .38) !important;
  box-shadow: 0 18px 52px -20px rgba(0, 0, 0, .8),
              0 0 0 4px rgba(245, 196, 81, .035) !important;
}
html body #canvas-container::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(0deg, rgba(4, 8, 17, .58), transparent 35%),
              linear-gradient(90deg, rgba(53, 230, 255, .06), transparent 38%, transparent 62%, rgba(168, 85, 247, .08));
  box-shadow: inset 0 0 0 5px rgba(7, 10, 18, .18);
}

html body #standalone-search-section#standalone-search-section .relative.flex.items-center {
  border: 1px solid rgba(245, 196, 81, .25) !important;
  border-radius: 16px !important;
  background: linear-gradient(120deg, #141d2b, #10131e) !important;
  box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .8), inset 0 1px rgba(255, 255, 255, .035) !important;
}
html body #standalone-search-section#standalone-search-section .relative.flex.items-center:focus-within {
  border-color: var(--pol-cyan) !important;
  box-shadow: 0 0 0 3px rgba(53, 230, 255, .09) !important;
}
html body #global-game-search#global-game-search {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
html body #global-game-search::placeholder { color: #99a5b9 !important; opacity: 1; }
html body #standalone-search-section#standalone-search-section button[onclick="executeCurrentSearch()"] {
  background: linear-gradient(135deg, #ffe3a0, #edba4c) !important;
  color: #191409 !important;
  border-radius: 11px !important;
}

html body #catalog-section-title#catalog-section-title {
  font-size: clamp(23px, 2.4vw, 32px) !important;
  color: var(--pol-parchment) !important;
  -webkit-text-fill-color: currentColor !important;
  background: none !important;
}
html body #browser-lib-count#browser-lib-count,
html body .wa-ag-stat {
  background: rgba(245, 196, 81, .06) !important;
  color: var(--pol-gold-soft) !important;
  border-color: rgba(245, 196, 81, .2) !important;
}
html body #browser-carousels-container#browser-carousels-container .wa-shelf {
  padding: 18px !important;
  background: radial-gradient(ellipse at 0 0, rgba(245, 196, 81, .045), transparent 55%),
              linear-gradient(145deg, #141b29, #0d131f 70%) !important;
  border-color: rgba(171, 183, 209, .13) !important;
  border-radius: 20px !important;
  box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .75), inset 0 1px rgba(255, 255, 255, .045) !important;
}
html body #browser-carousels-container#browser-carousels-container .wa-shelf:has(#carousel-trending) {
  border-color: rgba(245, 196, 81, .3) !important;
  background: radial-gradient(ellipse at 10% 0, rgba(245, 196, 81, .09), transparent 65%),
              linear-gradient(145deg, #191d28, #101420 70%) !important;
}
html body #browser-carousels-container#browser-carousels-container .wa-shelf > :first-child {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: wrap;
  gap: 12px !important;
  padding-bottom: 14px !important;
  border-color: rgba(171, 183, 209, .12) !important;
}
html body #browser-carousels-container .wa-shelf > :first-child > :first-child { min-width: 0; flex: 1; }
html body #browser-carousels-container .wa-shelf > :first-child p {
  color: #9eabc0 !important;
  line-height: 1.5;
  margin-top: 3px;
}
html body #browser-carousels-container .shelf-nav-btns { margin-inline-start: auto; align-self: center !important; }
html body #browser-carousels-container .shelf-nav-btn {
  width: 38px;
  height: 38px;
  background: #0b111d;
  border-color: rgba(245, 196, 81, .25);
  color: var(--pol-gold-soft);
}
html body #browser-carousels-container .shelf-nav-btn:is(:hover, :focus-visible) {
  border-color: var(--pol-gold);
  background: rgba(245, 196, 81, .12);
}
html body #categories-drawer {
  background: linear-gradient(165deg, #171b28, #0c101b 65%) !important;
  border-color: rgba(245, 196, 81, .22) !important;
}

html body .wa-ag-hero,
html body .wa-ag-shelf,
html body div.wa-shop-panel.wa-shop-panel {
  background: radial-gradient(ellipse at 100% 0, rgba(168, 85, 247, .065), transparent 60%),
              linear-gradient(140deg, #151c2a, #0c111c) !important;
  border: 1px solid rgba(245, 196, 81, .2) !important;
  border-radius: 22px !important;
  box-shadow: 0 18px 42px -25px rgba(0, 0, 0, .85), inset 0 1px rgba(255, 255, 255, .035) !important;
}
html body .wa-ag-title-main,
html body #shop-heading h1 {
  color: var(--pol-parchment) !important;
  -webkit-text-fill-color: currentColor !important;
  font-size: clamp(24px, 3vw, 36px) !important;
  line-height: 1.2 !important;
  letter-spacing: -.025em !important;
}
html body .wa-ag-lead { font-size: 14px !important; line-height: 1.75 !important; color: #b5bfd0 !important; }
html body .wa-ag-catlinks { gap: 7px; }
html body .wa-ag-catlinks a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 12px;
  background: #0d1522;
  color: #c4cede;
  border-color: rgba(171, 183, 209, .17);
}
html body .wa-ag-catlinks a:is(:hover, :focus-visible) {
  background: rgba(245, 196, 81, .1);
  border-color: rgba(245, 196, 81, .5);
  color: var(--pol-gold-soft);
}
html body .wa-ag-card { aspect-ratio: auto; background: #0c1320; }
html body .wa-ag-poster { position: relative; aspect-ratio: 16 / 10; }
html body .wa-ag-shade { display: none; }
html body .wa-ag-foot {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  min-height: 76px;
  border-top: 1px solid rgba(171, 183, 209, .1);
}
html body .wa-ag-title {
  grid-column: 1 / -1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal;
  font-size: 12px !important;
  line-height: 1.4 !important;
  color: #eef2fa !important;
  -webkit-text-fill-color: currentColor !important;
}
html body .wa-ag-play {
  grid-column: 2;
  justify-self: end;
  background: rgba(245, 196, 81, .1);
  color: var(--pol-gold-soft);
  border: 1px solid rgba(245, 196, 81, .2);
  font-size: 10px !important;
}
html body .wa-ag-skel { padding-bottom: 76px; }
html body .wa-ag-more {
  background: linear-gradient(135deg, #ffe3a0, #edba4c);
  box-shadow: 0 8px 24px -12px rgba(245, 196, 81, .4);
}

html body div.wa-shop-panel.wa-shop-panel { padding: clamp(18px, 3vw, 32px) !important; }
html body #shop-heading { border-color: rgba(171, 183, 209, .14); }
html body div.wa-shop-panel.wa-shop-panel > div:has(> #shop-rewarded-ad-btn) {
  background: linear-gradient(125deg, rgba(245, 196, 81, .11), rgba(134, 93, 28, .04)) !important;
  border-color: rgba(245, 196, 81, .25) !important;
  box-shadow: none !important;
}
html body div.wa-shop-panel.wa-shop-panel .tab-btn {
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 40px;
  border-radius: 11px !important;
  padding: 9px 13px !important;
  background: #111927 !important;
  border: 1px solid rgba(171, 183, 209, .14) !important;
  color: #b8c3d5 !important;
}
html body div.wa-shop-panel.wa-shop-panel .tab-btn.active {
  background: rgba(245, 196, 81, .12) !important;
  color: var(--pol-gold-soft) !important;
  border-color: rgba(245, 196, 81, .45) !important;
}
html body #items-container .item-card {
  background: linear-gradient(155deg, #151d2c, #0c121e) !important;
  border-radius: 20px !important;
  box-shadow: 0 14px 32px -20px rgba(0, 0, 0, .75) !important;
}

@media (max-width: 639px) {
  html body #browser-carousels-container#browser-carousels-container .wa-shelf { padding: 14px !important; }
  html body #browser-carousels-container#browser-carousels-container .wa-shelf > :first-child {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px !important;
  }
  html body #browser-carousels-container .wa-shelf > :first-child > :first-child { grid-column: 1 / -1; }
  html body #browser-carousels-container .wa-shelf > :first-child > :first-child > :first-child { flex-shrink: 0; }
  html body #browser-carousels-container .wa-shelf > :first-child :is(h2, h3) { font-size: 16px !important; line-height: 1.35 !important; }
  html body #browser-carousels-container .wa-shelf > :first-child p { font-size: 11px !important; }
  html body #browser-carousels-container .shelf-nav-btns { grid-column: 2; }
  html body #browser-carousels-container .shelf-nav-btn { width: 40px; height: 40px; }
  html body #shop-heading > div:first-child { display: grid; grid-template-columns: 44px minmax(0, 1fr); width: 100%; }
  html body #shop-heading .wa-tap-chip { grid-column: 1 / -1; justify-self: start; }
  html body #shop-heading > div:last-child { flex-wrap: wrap; justify-content: center; }
  html body .wa-ag-catlinks a { min-height: 40px; }
}

/* ---------- tactile press on cards ---------- */
html body .clean-card,
html body #browser-games-grid > .game-card,
html body .wa-ag-card { -webkit-tap-highlight-color: transparent; }
html body .clean-card:active,
html body #browser-games-grid > .game-card:active,
html body .wa-ag-card:active { transform: scale(.985); }
@media (hover: none), (pointer: coarse) {
  html body .clean-card:hover,
  html body #browser-games-grid > .game-card:hover,
  html body .wa-ag-card:hover { transform: none !important; }
}

/* ---------- search dropdown: solid arcane panel, no live blur ---------- */
html body #search-suggestions-dropdown#search-suggestions-dropdown {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: linear-gradient(165deg, #161e2d, #0d1220) !important;
  border: 1px solid rgba(245, 196, 81, .22) !important;
  border-radius: 16px !important;
  box-shadow: 0 22px 48px -18px rgba(0, 0, 0, .88) !important;
}
html body .wa-search-item:focus-visible,
html body .wa-search-viewall:focus-visible {
  outline: 2px solid var(--pol-cyan);
  outline-offset: -2px;
  background: rgba(53, 230, 255, .07);
}

/* ---------- living atmosphere: aurora blobs + rising embers ---------- */
.wa-ambient {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  mix-blend-mode: screen;
}
.wa-ambient i { position: absolute; display: block; }
.wa-ambient-blob { width: 52vmax; height: 52vmax; border-radius: 50%; opacity: .55; will-change: transform; }
.wa-ambient-blob-a {
  top: -18vmax; right: -14vmax;
  background: radial-gradient(circle, rgba(109, 66, 170, .10) 0%, rgba(109, 66, 170, .04) 42%, transparent 70%);
  animation: wa-drift-a 26s ease-in-out infinite alternate;
}
.wa-ambient-blob-b {
  bottom: -20vmax; left: -16vmax;
  background: radial-gradient(circle, rgba(30, 155, 179, .09) 0%, rgba(30, 155, 179, .035) 45%, transparent 70%);
  animation: wa-drift-b 32s ease-in-out infinite alternate;
}
@keyframes wa-drift-a { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-9vmax, 7vmax, 0) scale(1.12); } }
@keyframes wa-drift-b { from { transform: translate3d(0, 0, 0) scale(1.08); } to { transform: translate3d(8vmax, -6vmax, 0) scale(1); } }
.wa-ember {
  left: var(--x); bottom: -6px;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--pol-gold);
  box-shadow: 0 0 6px rgba(245, 196, 81, .55);
  opacity: 0;
  will-change: transform, opacity;
  animation: wa-ember-rise var(--t) linear infinite;
  animation-delay: var(--d);
}
@keyframes wa-ember-rise {
  0% { transform: translate3d(0, 0, 0) scale(var(--s)); opacity: 0; }
  10% { opacity: .38; }
  85% { opacity: .22; }
  100% { transform: translate3d(var(--sway), -108vh, 0) scale(var(--s)); opacity: 0; }
}
@media (max-width: 639px) { .wa-ember { display: none; } }

/* ---------- staged shelf reveal (opacity/transform only) ---------- */
html body .wa-prep { opacity: 0; transform: translateY(18px); }
html body .wa-prep.wa-in {
  opacity: 1;
  transform: none;
  animation: wa-rise .6s cubic-bezier(.2, .7, .2, 1) backwards;
  animation-delay: var(--rd, 0ms);
}
@keyframes wa-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .wa-ambient { display: none; }
  html body .wa-prep, html body .wa-prep.wa-in {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  html body .clean-card:active,
  html body #browser-games-grid > .game-card:active,
  html body .wa-ag-card:active { transform: none; }
  html body #browser-carousels-container#browser-carousels-container .clean-card,
  html body #browser-carousels-container#browser-carousels-container .clean-card:is(:hover, :focus-visible),
  html body #browser-carousels-container#browser-carousels-container .clean-card img:not(.wa3d-emoji),
  html body #browser-carousels-container#browser-carousels-container .clean-card:hover img:not(.wa3d-emoji),
  html body #browser-games-grid#browser-games-grid > .game-card,
  html body #browser-games-grid#browser-games-grid > .game-card:is(:hover, :focus-visible),
  html body #browser-games-grid#browser-games-grid > .game-card .game-poster,
  html body #browser-games-grid#browser-games-grid > .game-card:hover .game-poster,
  html body .wa-ag-card,
  html body .wa-ag-card:is(:hover, :focus-visible) {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}