* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ps-bg, #0b0820);
  color: #fff;
  font-family: var(--ps-font-body, system-ui, sans-serif);
}

#summon-root { position: fixed; inset: 0; }

.banner {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 20px 20px max(26px, calc(env(safe-area-inset-bottom) + 14px));
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}
.banner.is-away {
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
}

/* The Wish button: one hairline pill on the night sky, with the count stepper inside it. */
.wish {
  display: flex;
  align-items: center;
  height: 54px;
  padding: 0 5px;
  border-radius: 999px;
  border: 1px solid rgba(225, 232, 255, 0.24);
  background: rgba(9, 14, 34, 0.32);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
.wish:hover { border-color: rgba(225, 232, 255, 0.38); background: rgba(14, 20, 46, 0.4); }
.wish:has(.wish-go.is-charging) { border-color: rgba(240, 244, 255, 0.62); transition-duration: 1.2s; }

.wish button {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.wish button:focus-visible { outline: 2px solid rgba(240, 244, 255, 0.8); outline-offset: 2px; }

.wish-go {
  min-width: 9.6em;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  color: #f3f5ff;
  font: 500 17px/1 var(--ps-font-display);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  transition: transform 0.15s ease, background-color 0.2s ease;
}
.wish-go:hover { background: rgba(240, 244, 255, 0.06); }
.wish-go:active, .wish-go.is-charging { transform: scale(0.98); }

.wish-step {
  width: 40px;
  height: 44px;
  border-radius: 999px;
  color: rgba(236, 240, 255, 0.72);
  font: 400 26px/1 var(--ps-font-display);
  transition: color 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}
.wish-step span { display: block; transform: translateY(-2px); }
.wish-step:hover { color: #fff; }
.wish-step:active { transform: scale(0.94); }
.wish-step:disabled { opacity: 0.22; cursor: default; transform: none; }

/* The wish balance: one quiet line under the pill, with the way to redeem a code. */
.wallet {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 0;
  font-size: 12.5px;
  color: rgba(236, 240, 255, 0.7);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(10, 14, 40, 0.7);
}
.wallet-dot { opacity: 0.5; }
.wallet-link {
  padding: 4px 2px;
  margin: -4px -2px;
  border: 0;
  background: none;
  color: rgba(240, 244, 255, 0.86);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(240, 244, 255, 0.3);
  text-underline-offset: 3px;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.wallet-link:hover { color: #fff; text-decoration-color: rgba(240, 244, 255, 0.7); }
.wallet-link:focus-visible { outline: 2px solid rgba(240, 244, 255, 0.8); outline-offset: 2px; border-radius: 4px; }
.wallet.is-empty .wallet-link { color: #fff; text-decoration-color: rgba(240, 244, 255, 0.75); }
.wish.is-spent { opacity: 0.55; }
.wish-go:disabled { cursor: default; }
.wish-go:disabled:hover { background: none; }

/* Redeem a code: a dark translucent panel over the sky, one input, one quiet submit. */
.redeem {
  width: min(340px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(225, 232, 255, 0.2);
  border-radius: 22px;
  background: rgba(9, 14, 34, 0.62);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  color: #f3f5ff;
  box-shadow: 0 20px 60px rgba(2, 4, 16, 0.5);
}
.redeem::backdrop { background: rgba(3, 5, 16, 0.42); }
.redeem[open] { animation: redeem-in 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
.redeem[open]::backdrop { animation: redeem-fade 0.32s ease; }
@keyframes redeem-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes redeem-fade { from { opacity: 0; } }

.redeem-panel { padding: 22px 22px 18px; text-align: center; }
.redeem-title { margin: 0; font: 500 18px/1.2 var(--ps-font-display); letter-spacing: 0.02em; }
.redeem-hint { margin: 6px 0 16px; font-size: 13px; color: rgba(236, 240, 255, 0.62); }
.redeem-input {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border: 1px solid rgba(225, 232, 255, 0.24);
  border-radius: 999px;
  background: rgba(3, 6, 20, 0.4);
  color: #fff;
  font: 500 16px/1 var(--ps-font-display);
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.2s ease;
}
.redeem-input::placeholder { color: rgba(236, 240, 255, 0.3); }
.redeem-input:focus { border-color: rgba(240, 244, 255, 0.6); }
.redeem-input[aria-invalid="true"] { border-color: rgba(255, 170, 190, 0.55); }
.redeem-msg { min-height: 1.5em; margin: 10px 0 6px; font-size: 13px; color: rgba(255, 205, 215, 0.92); }
.redeem-msg.is-ok { color: rgba(220, 240, 255, 0.95); }
.redeem-actions { display: flex; justify-content: center; gap: 6px; }
.redeem-actions button {
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: rgba(236, 240, 255, 0.62);
  font: 500 15px/1 var(--ps-font-display);
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.redeem-actions button:hover { color: #fff; }
.redeem-actions .redeem-submit { border-color: rgba(225, 232, 255, 0.24); color: #f3f5ff; }
.redeem-actions .redeem-submit:hover { border-color: rgba(240, 244, 255, 0.45); background: rgba(240, 244, 255, 0.06); }
.redeem-actions button:focus-visible { outline: 2px solid rgba(240, 244, 255, 0.8); outline-offset: 2px; }
.redeem-actions button:disabled { opacity: 0.45; cursor: default; }

.rates {
  margin: 10px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 1px 4px rgba(10, 14, 40, 0.7);
}
.rates .wallet-dot { margin: 0 6px; }
.rates-link {
  padding: 4px 2px;
  margin: -4px -2px;
  border: 0;
  background: none;
  color: rgba(240, 244, 255, 0.8);
  font: inherit;
  white-space: nowrap;
  text-decoration: underline;
  text-decoration-color: rgba(240, 244, 255, 0.26);
  text-underline-offset: 3px;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.rates-link:hover { color: #fff; text-decoration-color: rgba(240, 244, 255, 0.7); }
.rates-link:focus-visible { outline: 2px solid rgba(240, 244, 255, 0.8); outline-offset: 2px; border-radius: 4px; }

/* The odds window: the redeem panel's dark glass, with the tiers in a list that scrolls on short screens. */
.odds {
  width: min(400px, calc(100vw - 32px));
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(225, 232, 255, 0.2);
  border-radius: 22px;
  background: rgba(9, 14, 34, 0.62);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  color: #f3f5ff;
  box-shadow: 0 20px 60px rgba(2, 4, 16, 0.5);
}
.odds::backdrop { background: rgba(3, 5, 16, 0.42); }
.odds[open] { animation: redeem-in 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
.odds[open]::backdrop { animation: redeem-fade 0.32s ease; }

.odds-panel {
  display: flex;
  flex-direction: column;
  max-height: min(720px, calc(100vh - 32px));
  max-height: min(720px, calc(100dvh - 32px));
  padding: 22px 0 16px;
}
.odds-title { margin: 0 22px; font: 500 18px/1.2 var(--ps-font-display); letter-spacing: 0.02em; text-align: center; }
.odds-hint { margin: 6px 22px 8px; font-size: 13px; color: rgba(236, 240, 255, 0.62); text-align: center; text-wrap: balance; }
.odds-list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(225, 232, 255, 0.22) transparent;
  /* demo.js sets the fades while there's more list above (--ft) or below (--fb) */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--ft, 0px), #000 calc(100% - var(--fb, 0px)), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 var(--ft, 0px), #000 calc(100% - var(--fb, 0px)), transparent);
}
.odds-tier { padding: 11px 0 10px; }
.odds-tier + .odds-tier { border-top: 1px solid rgba(225, 232, 255, 0.1); }
.odds-head { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.odds-label {
  margin: 0;
  font: 600 12px/1 var(--ps-font-body);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rg);
}
.odds-tier.rarity-mythic .odds-label {
  background: linear-gradient(90deg, #ffb3b3, #ffe08a, #b8ffd6, #a8dcff, #dcc0ff, #ffb0d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.odds-stars { display: flex; gap: 2px; font-size: 11px; line-height: 1; color: var(--rg); }
.odds-stars i { font-style: normal; }
.rarity-mythic .odds-stars i:nth-child(6n + 1) { color: #ffb3b3; }
.rarity-mythic .odds-stars i:nth-child(6n + 2) { color: #ffe08a; }
.rarity-mythic .odds-stars i:nth-child(6n + 3) { color: #b8ffd6; }
.rarity-mythic .odds-stars i:nth-child(6n + 4) { color: #a8dcff; }
.rarity-mythic .odds-stars i:nth-child(6n + 5) { color: #dcc0ff; }
.rarity-mythic .odds-stars i:nth-child(6n) { color: #ffb0d4; }
.odds-pct {
  margin-left: auto;
  font: 500 15px/1 var(--ps-font-display);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.odds-items { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.odds-items li {
  display: grid;
  grid-template-columns: 8.8em minmax(0, 1fr);
  gap: 12px;
  font-size: 13px;
  line-height: 1.38;
}
.odds-svc { font-weight: 600; color: #f3f5ff; }
.odds-opts { color: rgba(236, 240, 255, 0.66); overflow-wrap: anywhere; }
@media (max-width: 360px) {
  .odds-list { padding: 0 18px; }
  .odds-items li { grid-template-columns: 7.2em minmax(0, 1fr); gap: 10px; }
}
.odds-actions { display: flex; justify-content: center; padding: 12px 22px 0; }
.odds-close {
  height: 40px;
  padding: 0 22px;
  border: 1px solid rgba(225, 232, 255, 0.24);
  border-radius: 999px;
  background: none;
  color: #f3f5ff;
  font: 500 15px/1 var(--ps-font-display);
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.odds-close:hover { border-color: rgba(240, 244, 255, 0.45); background: rgba(240, 244, 255, 0.06); }
.odds-close:focus-visible { outline: 2px solid rgba(240, 244, 255, 0.8); outline-offset: 2px; }

.debug {
  position: fixed;
  z-index: 10;
  left: 12px;
  bottom: 12px;
  width: 230px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(8, 5, 22, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
}
.debug summary { cursor: pointer; font-weight: 700; }
@media (max-width: 640px) {
  .debug { top: max(12px, env(safe-area-inset-top)); bottom: auto; width: auto; max-width: 230px; }
  .debug[open] { width: 230px; }
}
.debug label { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.debug select, .debug input { width: 100%; }
.debug .dbg-check { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.debug .dbg-check input { width: auto; margin: 0; }
.debug select, .dbg-buttons button {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #1b1438;
  color: #fff;
  font: inherit;
}
.dbg-buttons { display: flex; gap: 6px; margin-top: 10px; }
.dbg-buttons button { flex: 1; cursor: pointer; }
.dbg-readout { margin: 8px 0 0; font-size: 11px; line-height: 1.5; opacity: 0.8; white-space: pre-wrap; }

/* The toast: a small glass capsule with one star, just above the controls. demo.js places it (bottom) and
   animates it: it rises in, the star twinkles once, then it drifts on up as it fades. */
.toast {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 160px;
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 8px 17px 8px 13px;
  border-radius: 18px;
  border: 1px solid rgba(225, 232, 255, 0.2);
  background: linear-gradient(180deg, rgba(240, 244, 255, 0.07), rgba(240, 244, 255, 0) 70%), rgba(9, 14, 34, 0.5);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 32px rgba(2, 4, 16, 0.38);
  color: #f3f5ff;
  font: 500 14px/1.3 var(--ps-font-display);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 6px rgba(4, 8, 24, 0.5);
  opacity: 0;
  pointer-events: none;
}
.toast-star {
  flex: none;
  width: 13px;
  height: 13px;
  fill: #fff5dc;
  filter: drop-shadow(0 0 3px rgba(255, 230, 175, 0.9)) drop-shadow(0 0 9px rgba(255, 214, 140, 0.45));
}

@media (prefers-reduced-motion: reduce) {
  .banner, .banner.is-away { transform: none; }
  .redeem[open] { animation-name: redeem-fade; }
  .odds[open] { animation-name: redeem-fade; }
}
