/* Stock Pile: the Council's combined pot and the nightly "Winter is coming" draw.
 * Ice palette over the realm's dark base; one loud moment (the draw), calm otherwise. */
.stockpile { --ice: #9fe7ff; --ice-deep: #2a7bbf; --frost: #eaf8ff; --ember: #ffbf37;
  position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: minmax(220px, 280px) minmax(220px, 300px) minmax(0, 1fr);
  gap: 18px; align-items: center; margin: 0 0 20px; padding: 20px; border: 1px solid rgba(159, 231, 255, .35); border-radius: 22px;
  background: linear-gradient(160deg, #0b1424, #070a12 60%); color: var(--text, #eef); }
.stockpile[hidden] { display: none; }
.sp-aurora { position: absolute; inset: -40%; z-index: -1; opacity: .55; pointer-events: none;
  background: conic-gradient(from 200deg at 30% 40%, transparent 0 20%, rgba(80, 220, 255, .25) 28%, transparent 38%, rgba(155, 77, 255, .22) 52%, transparent 64%);
  filter: blur(40px); animation: sp-aurora 18s linear infinite; }
@keyframes sp-aurora { to { transform: rotate(1turn); } }

/* The orb: a frosted bubble holding the pot. */
.sp-orb { position: relative; display: grid; place-content: center; justify-items: center; gap: 2px; aspect-ratio: 1; padding: 18px; border-radius: 50%; text-align: center;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .5), rgba(159, 231, 255, .14) 22%, rgba(42, 123, 191, .25) 55%, rgba(8, 16, 30, .9) 78%);
  box-shadow: inset 0 0 40px rgba(159, 231, 255, .35), 0 0 60px rgba(80, 200, 255, .25); animation: sp-breathe 5s ease-in-out infinite; }
.sp-orb::after { content: ""; position: absolute; inset: 8%; border-radius: 50%; border: 1px solid rgba(234, 248, 255, .25); }
.sp-kicker { color: var(--ice); font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.sp-amount { font-family: var(--heading, inherit); font-size: clamp(26px, 3.4vw, 38px); line-height: 1; color: var(--frost); text-shadow: 0 0 22px rgba(159, 231, 255, .7); font-variant-numeric: tabular-nums; }
.sp-amount-sub { color: var(--ice); font-weight: 800; font-variant-numeric: tabular-nums; }
.sp-seats { max-width: 16ch; margin-top: 6px; color: rgba(234, 248, 255, .7); font-size: 11px; }
@keyframes sp-breathe { 50% { box-shadow: inset 0 0 52px rgba(159, 231, 255, .45), 0 0 80px rgba(80, 200, 255, .35); } }

/* The frost dial and its result. */
.sp-stage { display: grid; justify-items: center; gap: 8px; text-align: center; }
.sp-dial { width: 100%; max-width: 260px; overflow: visible; }
.sp-dial-track { fill: rgba(8, 16, 30, .8); stroke: rgba(234, 248, 255, .1); stroke-width: 14; }
.sp-dial-winter { fill: none; stroke: var(--ice); stroke-width: 14; stroke-linecap: round; filter: drop-shadow(0 0 8px rgba(159, 231, 255, .9)); transition: d .9s ease; }
.sp-dial-winter.is-growing { animation: sp-grow 1.2s ease both; }
.sp-dial-tick { stroke: rgba(234, 248, 255, .25); stroke-width: 1.4; }
.sp-needle-blade { fill: var(--frost); filter: drop-shadow(0 0 6px rgba(159, 231, 255, .9)); }
.sp-needle-flake { fill: var(--ice-deep); font-size: 16px; }
.sp-result { min-height: 64px; display: grid; gap: 2px; justify-items: center; }
.sp-result-kicker { color: var(--ice); font-weight: 800; letter-spacing: .08em; }
.sp-result-title { font-family: var(--heading, inherit); font-size: clamp(22px, 3vw, 30px); letter-spacing: .04em; color: var(--frost); text-shadow: 0 0 24px rgba(159, 231, 255, .9); animation: sp-slam .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.sp-result-title.is-clear { color: var(--ember); text-shadow: 0 0 18px rgba(255, 191, 55, .5); }
.sp-result-copy { color: rgba(234, 248, 255, .85); font-size: 13px; }
.sp-verify { color: rgba(234, 248, 255, .55); font-size: 11px; font-variant-numeric: tabular-nums; }
@keyframes sp-slam { from { opacity: 0; transform: scale(1.8); letter-spacing: .3em; } }
@keyframes sp-grow { 40% { stroke-width: 20; } }

/* Odds, countdown and recent nights. */
.sp-side { display: grid; gap: 12px; align-content: start; }
.sp-frost-meter { display: grid; gap: 6px; }
.sp-frost-label { font-weight: 800; color: var(--frost); }
.sp-frost-bar { height: 12px; overflow: hidden; border-radius: 12px; background: rgba(234, 248, 255, .08); }
.sp-frost-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ice-deep), var(--ice), #fff); box-shadow: 0 0 14px rgba(159, 231, 255, .8); }
.sp-frost-note { color: rgba(234, 248, 255, .65); }
.sp-clock { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid rgba(159, 231, 255, .25); border-radius: 12px; }
.sp-clock-label { color: rgba(234, 248, 255, .7); font-size: 12px; }
.sp-countdown { font-family: var(--heading, inherit); font-size: 24px; color: var(--ice); font-variant-numeric: tabular-nums; }
.sp-history-title { margin: 0; font-size: 13px; color: rgba(234, 248, 255, .7); }
.sp-history { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sp-history li { padding: 4px 8px; border-radius: 999px; background: rgba(234, 248, 255, .06); color: rgba(234, 248, 255, .7); font-size: 11px; }
.sp-history li.is-winter { background: rgba(159, 231, 255, .2); color: var(--frost); }

/* Draw moments: the dial hums while spinning; Winter frosts the whole panel. */
.stockpile.is-drawing .sp-dial { animation: sp-hum .14s linear infinite; }
.stockpile.is-winter-hit::before { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: inherit;
  background: radial-gradient(circle at 50% 50%, transparent 35%, rgba(234, 248, 255, .55) 100%);
  box-shadow: inset 0 0 80px rgba(234, 248, 255, .8); animation: sp-frost-in 1.4s ease-out both; }
.stockpile.is-winter-hit .sp-orb { animation: sp-crack .5s ease 2; }
.stockpile.is-clear .sp-dial-winter { stroke: var(--ice); }
@keyframes sp-hum { 50% { transform: translate(.6px, -.6px); } }
@keyframes sp-frost-in { from { opacity: 0; } 40% { opacity: 1; } to { opacity: .7; } }
@keyframes sp-crack { 25% { transform: rotate(-3deg) scale(1.03); } 75% { transform: rotate(3deg) scale(.98); } }

/* Winter payout: Gems burst out of the orb toward the Council. */
.sp-burst { position: absolute; left: 16%; top: 50%; z-index: 4; pointer-events: none; }
.sp-burst i { position: absolute; font-style: normal; font-size: 18px; opacity: 0; animation: sp-burst 1.8s cubic-bezier(.2, .8, .3, 1) var(--t) forwards; }
.sp-burst i.is-dgen { color: var(--ember); } .sp-burst i.is-dgem { color: var(--ice); }
@keyframes sp-burst { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(.6); }
  70% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) scale(1.1); } }

@media (max-width: 860px) {
  .stockpile { grid-template-columns: 1fr 1fr; }
  .sp-side { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .stockpile { grid-template-columns: 1fr; justify-items: center; padding: 16px; }
  .sp-orb { width: min(240px, 70vw); }
  .sp-side { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .stockpile *, .stockpile::before { animation: none !important; transition: none !important; }
}

/* Realm Health: Stock Pile switch. */
.stockpile-admin .panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.stockpile-admin h3 { margin: 2px 0 4px; }
.sp-switch { position: relative; flex: none; min-width: 92px; min-height: 40px; padding: 0 14px 0 44px; border: 1px solid var(--line-strong, #3a3f55); border-radius: 999px;
  background: rgba(255, 255, 255, .06); color: var(--muted, #aab); font-weight: 800; text-align: left; cursor: pointer; transition: background .2s, color .2s; }
.sp-switch::before { content: ""; position: absolute; left: 6px; top: 50%; width: 28px; height: 28px; margin-top: -14px; border-radius: 50%; background: #5d6378; transition: transform .2s, background .2s; }
.sp-switch.is-on { padding: 0 44px 0 16px; border-color: rgba(159, 231, 255, .6); background: rgba(80, 200, 255, .2); color: #eaf8ff; }
.sp-switch.is-on::before { transform: translateX(calc(100% + 22px)); left: auto; right: 6px; transform: none; background: #9fe7ff; box-shadow: 0 0 12px rgba(159, 231, 255, .8); }
.sp-switch:disabled { opacity: .55; cursor: progress; }
.sp-admin-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.sp-admin-facts dt { color: var(--muted, #aab); font-size: 12px; }
.sp-admin-facts dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.sp-admin-nights-title { margin: 8px 0 4px; font-size: 13px; }
.sp-admin-nights { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted, #aab); font-variant-numeric: tabular-nums; }
.sp-admin-nights li.is-winter { color: #9fe7ff; }

/* Realm Health cleanup: compact hero, sticky section menu. */
[data-panel="health"] .health-heading h2 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.1; }
[data-panel="health"] .health-heading > div > p:not(.eyebrow) { max-width: 70ch; font-size: 13px; }
[data-panel="health"] .realm-health-nav { position: sticky; top: 0; z-index: 25; padding: 8px 0; background: rgba(8, 9, 14, .94); backdrop-filter: blur(10px); }
[data-panel="health"] .realm-health-section-title { scroll-margin-top: 64px; }

/* Winter draw staging (2026-10-16): snowfall, suspense, replay and sound controls. */
.sp-snow { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .35;
  background-image: radial-gradient(2px 2px at 20% 10%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 70% 30%, #fff 50%, transparent 51%),
    radial-gradient(2.5px 2.5px at 40% 60%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 85% 80%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 10% 75%, #fff 50%, transparent 51%);
  background-size: 180px 180px; animation: sp-snow 14s linear infinite; }
@keyframes sp-snow { to { background-position: 40px 540px, -30px 540px, 20px 540px, -50px 540px, 10px 540px; } }
.stockpile.is-drawing .sp-snow { opacity: .8; animation-duration: 3s; }
.stockpile.is-drawing::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 0 70px rgba(159, 231, 255, .35); animation: sp-creep 5s ease-in both; }
@keyframes sp-creep { from { box-shadow: inset 0 0 0 rgba(159, 231, 255, 0); } }
.stockpile.is-suspense .sp-dial { filter: drop-shadow(0 0 18px rgba(159, 231, 255, .8)); }
.stockpile.is-suspense .sp-result-kicker { animation: sp-pulse .6s ease-in-out infinite alternate; }
@keyframes sp-pulse { to { opacity: .45; } }
.stockpile.is-winter-hit .sp-snow { opacity: 1; animation-duration: 1.6s; }
.stockpile.is-clear .sp-aurora { background: conic-gradient(from 200deg at 30% 40%, transparent 0 20%, rgba(255, 191, 55, .22) 30%, transparent 44%); }
.sp-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-replay, .sp-sound { min-height: 34px; padding: 0 12px; border: 1px solid rgba(159, 231, 255, .4); border-radius: 999px; background: rgba(159, 231, 255, .1); color: var(--frost); font-weight: 800; font-size: 12px; cursor: pointer; }
.sp-replay:focus-visible, .sp-sound:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .sp-snow, .stockpile.is-drawing::after { animation: none !important; } }
