.masthead-treasure {
    flex: none;
    display: block;
    width: clamp(3.6rem, 6.5vw, 5.4rem);
    border-radius: .45rem;
}
.masthead-treasure img { display: block; width: 100%; height: auto; }
.masthead-treasure:hover img { filter: brightness(1.12); }

.treasure-page-body {
    --focus: #ffe38d;
    --cave-stars: url("treasure-art/cave-stars.webp");
    position: relative;
    isolation: isolate;
    color: #fff1ff;
    background: #0b061c;
}
@media (prefers-reduced-motion: no-preference) {
    .treasure-page-body { --cave-stars: url("treasure-art/cave-stars.gif"); }
}
.treasure-page-backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background: #0b061c url("treasure-art/jewel-backdrop.webp") center / cover no-repeat;
}
.treasure-page-backdrop video { width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.treasure-page-backdrop video.is-playing { opacity: 1; }
.treasure-page-backdrop::after {
    position: absolute;
    inset: 0;
    content: "";
    background: linear-gradient(90deg, #0f052650, #11052a08 45%, #17033320);
}
.treasure-shell {
    max-width: 83rem;
    margin: 0 auto;
    padding: clamp(.65rem, 1.9vw, 1.55rem) clamp(.5rem, 3.7vw, 2.75rem) clamp(1.25rem, 4vw, 3rem);
}
.treasure-page-heading,
.treasure-page-body .treasure-panel {
    border: 1px solid #eec8ff;
    border-radius: clamp(.9rem, 2.9vw, 2rem);
    box-shadow: inset 0 0 0 2px #953bdf68, inset 0 3px 9px #f3bbff8a,
        0 0 1.25rem #934dff86, 0 .6rem 1.3rem #070012ac;
}
.treasure-page-heading {
    position: relative;
    isolation: isolate;
    display: grid;
    justify-items: start;
    align-content: center;
    gap: .45rem;
    min-height: clamp(11rem, 14vw, 13.1rem);
    margin-bottom: .85rem;
    padding: 2.05rem 31% 2.05rem clamp(1.8rem, 5vw, 4.45rem);
    overflow: hidden;
    text-align: left;
    background:
        radial-gradient(ellipse at -8% 90%, #460989 0%, transparent 63%),
        radial-gradient(ellipse at 22% 0%, #2d1474 0%, transparent 58%),
        #100525;
}
.treasure-page-heading::before {
    content: "";
    position: absolute;
    z-index: -2;
    inset: 0 0 0 47%;
    background: url("treasure-art/jewel-portrait.webp") 60% 35% / cover no-repeat;
    mask-image: linear-gradient(90deg, transparent, #000 44%);
}
.treasure-page-heading h1 {
    color: #fff1ff;
    font-size: clamp(2rem, 4.2vw, 4.2rem);
    letter-spacing: -.045em;
    line-height: .96;
    text-shadow: 0 3px #6729a2, 0 0 .95rem #b24cffb5;
}
.treasure-welcome { max-width: 27rem; color: #faebff; line-height: 1.4; text-shadow: 0 1px 3px #140127; }
.treasure-page-heading nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.treasure-page-heading nav .quiet-button {
    min-height: 2.3rem;
    color: #2e093a;
    border-color: #ffe9af;
    border-radius: 2rem;
    background: linear-gradient(#fff0b4, #fdc85e 66%, #ea9a37);
    box-shadow: inset 0 1px 2px #fff, 0 2px 0 #9c4d21, 0 0 1rem #ffca6879;
}
.treasure-page-heading nav .quiet-button:hover { background: #fff8d8; }
.treasure-heading-art { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.treasure-heading-art img,
.treasure-opening-decor img {
    display: block;
    position: absolute;
    object-fit: contain;
    filter: drop-shadow(0 .25rem .35rem #8e31585e);
}
.treasure-blue-chest { right: 3%; bottom: 6%; width: 10%; max-height: 49%; }
.treasure-orbs { right: 15%; bottom: 6%; width: 7%; max-height: 40%; }
.treasure-heading-art .treasure-gem {
    top: var(--y);
    left: var(--x);
    width: clamp(1.05rem, var(--size, 4%), 3.65rem);
    transform: rotate(var(--turn, 0deg));
}
.treasure-heading-art .treasure-gem:nth-of-type(3) { --x: 5.1%; --y: 5%; --size: 3.8%; --turn: -12deg; }
.treasure-heading-art .treasure-gem:nth-of-type(4) { --x: 11%; --y: 7%; --size: 3%; --turn: 14deg; }
.treasure-heading-art .treasure-gem:nth-of-type(5) { --x: 1.6%; --y: 66%; --size: 3.1%; }
.treasure-heading-art .treasure-gem:nth-of-type(6) { --x: 21%; --y: 82%; --size: 2.65%; --turn: 22deg; }
.treasure-heading-art .treasure-gem:nth-of-type(7) { --x: 25.8%; --y: 80%; --size: 3%; }
.treasure-heading-art .treasure-gem:nth-of-type(8) { --x: 31%; --y: 78%; --size: 3.1%; --turn: -15deg; }
.treasure-heading-art .treasure-gem:nth-of-type(9) { --x: 53%; --y: 9%; --size: 5%; }
.treasure-heading-art .treasure-gem:nth-of-type(10) { --x: 61%; --y: 5%; --size: 4.1%; --turn: -17deg; }
.treasure-heading-art .treasure-gem:nth-of-type(11) { --x: 92%; --y: 9%; --size: 4.5%; --turn: 15deg; }
.treasure-heading-art .treasure-gem:nth-of-type(12) { --x: 87%; --y: 13%; --size: 3.2%; --turn: 23deg; }
.treasure-heading-art .treasure-gem:nth-of-type(13) { --x: 95%; --y: 46%; --size: 3.3%; --turn: -20deg; }
.treasure-heading-art .treasure-gem:nth-of-type(14) { --x: 70%; --y: 71%; --size: 3.7%; --turn: -17deg; }

.chest-sign-in,
.treasure-sim-picker,
.treasure-shell > .panel {
    color: #fff1ff;
    border-color: #c583f1;
    background: linear-gradient(105deg, #2b0f55f5, #220935f2, #28155ce8);
    box-shadow: inset 0 1px 1px #e2a6ff95, 0 .16rem 0 #58258f;
}
.chest-sign-in { padding-block: .62rem; }
.chest-sign-in > summary { cursor: pointer; }
.chest-sign-in .login-form { max-width: 26rem; margin-top: 1rem; }
.treasure-sim-picker {
    display: grid;
    grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr);
    column-gap: 1rem;
    row-gap: .4rem;
}
.treasure-sim-picker h2 { margin-bottom: .3rem; font-size: 1.2rem; }
.treasure-sim-picker .sim-list { grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); }

.treasure-vault { position: relative; margin-top: 1rem; isolation: isolate; }
.treasure-page-body .treasure-panel {
    --muted: #e5dbff;
    --line: #bd8ad5;
    --deep-blue: #e6b8ff;
    --focus: #ffe38d;
    --glass-inset: linear-gradient(#552280, #2e0c4e);
    --glass-inset-shadow: inset 0 1px 1px #e5a1ff9c, 0 2px 0 #190527;
    position: relative;
    isolation: isolate;
    color: #fff1ff;
    padding: clamp(.55rem, 1.75vw, 1.35rem);
    text-shadow: none;
    background:
        radial-gradient(ellipse at 2% top, #750a697b 0%, transparent 24rem),
        radial-gradient(ellipse at 100% top, #13358478 0%, transparent 24rem),
        linear-gradient(155deg, #120420f7, #090416f7 54%, #1f0b40f0);
    backdrop-filter: none;
}
.treasure-page-body .treasure-panel::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 0 auto;
    height: min(100%, 60rem);
    border-radius: inherit;
    background: var(--cave-stars) center top / 420px auto repeat;
    mask-image: linear-gradient(#000 68%, transparent);
    mix-blend-mode: screen;
    opacity: .34;
    pointer-events: none;
}
.treasure-page-body .treasure-balance strong { color: #ffe48b; }
.treasure-page-body .treasure-notice[role="alert"] { color: #ffe1f2; border-color: #d372ac; }
.treasure-page-body .treasure-chest { width: 100%; margin-top: .65rem; }
.treasure-page-body .treasure-chest > summary { width: min(67%, 46rem); margin: 0 auto; }
.treasure-page-body .treasure-stage {
    place-items: center;
    border-color: #ffd987;
    background: #160b29;
    box-shadow: 0 0 0 1px #b06afa, 0 0 1.3rem #f13af184, 0 .5rem 1.4rem #11021eb5;
}
.treasure-opening-decor { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.treasure-panel:has(.treasure-balance) + .treasure-opening-decor { inset-block-start: 2.6rem; }
.treasure-coins {
    top: clamp(4rem, 11vw, 7rem);
    right: 4%;
    width: 13%;
    max-width: 10.8rem;
    transform: rotate(10deg);
}
.treasure-vault-chest {
    top: clamp(13rem, 25vw, 20.3rem);
    right: 5%;
    width: 13%;
    max-height: 10rem;
}
.treasure-charm {
    position: absolute;
    top: var(--charm-y);
    left: var(--charm-x);
    width: var(--charm-width);
    transform: rotate(var(--charm-tilt, 0deg));
}
.treasure-opening-decor .treasure-charm img { position: static; width: 100%; height: auto; }
.treasure-charm-gold-glimmer {
    --charm-x: 4%; --charm-y: 1%;
    --charm-width: 15%;
    opacity: .78;
    mask-image: radial-gradient(ellipse at center, #000 28%, transparent 72%);
    mix-blend-mode: screen;
}
.treasure-charm-gold-star {
    --charm-x: 16%; --charm-y: 2.05rem; --charm-tilt: -11deg;
    --charm-width: clamp(1.45rem, 5vw, 4.15rem);
    filter: drop-shadow(0 0 .55rem #ffe48c85);
}
.treasure-charm-silver-diamond {
    --charm-x: 16.8%; --charm-y: clamp(7.7rem, 14.5vw, 12.6rem); --charm-tilt: 7deg;
    --charm-width: clamp(1.6rem, 6vw, 5.3rem);
}
.treasure-charm-jewel-cluster {
    --charm-x: 5.5%; --charm-y: clamp(8.3rem, 19vw, 16rem);
    --charm-width: clamp(2.05rem, 10.5vw, 8.7rem);
}
.treasure-charm-pixel-coin {
    --charm-x: 92%; --charm-y: clamp(11.2rem, 23vw, 18.6rem); --charm-tilt: 13deg;
    --charm-width: clamp(1.35rem, 4.4vw, 3.8rem);
}
.treasure-charm-red-medallion {
    --charm-x: 82%; --charm-y: clamp(9.3rem, 20vw, 16.7rem); --charm-tilt: -13deg;
    --charm-width: clamp(1.4rem, 5.8vw, 4.8rem);
}
.treasure-charm-spinning-coin {
    --charm-x: 88%; --charm-y: 1.9rem;
    --charm-width: clamp(1.3rem, 4.6vw, 4rem);
}
.treasure-page-body .treasure-collection {
    --gem-margin: clamp(1.45rem, 10vw, 8rem);
    width: 100%;
    margin: clamp(.9rem, 3vw, 1.55rem) auto 0;
    padding: clamp(.7rem, 2.2vw, 1.75rem) var(--gem-margin) clamp(1rem, 3vw, 2rem);
    border-color: #e4acff;
    background:
        radial-gradient(ellipse at 1% 0%, #9b1990a0 0%, transparent 25rem),
        radial-gradient(ellipse at 100% 0%, #224cbbab 0%, transparent 29rem),
        linear-gradient(166deg, #351364, #1a0840 25%, #2a0c50 44%, #0b244d 70%, #260d45);
    box-shadow: inset 0 0 0 2px #c775ea94, inset 0 3px 9px #e6b0ff8f,
        inset 0 -3px 9px #4569cbb0, 0 0 1rem #c662ef79, 0 .4rem 1rem #09041896;
    backdrop-filter: none;
}
.treasure-page-body .treasure-collection::before {
    opacity: .26;
    background: url("treasure-art/jewel-portrait.webp") center top / min(100%, 74rem) auto repeat-y;
    mix-blend-mode: screen;
}
.treasure-crystal-scenes {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(.25rem, 1.2vw, .85rem);
    margin: .15rem auto clamp(.8rem, 2vw, 1.4rem);
    width: min(100%, 49rem);
}
.treasure-crystal-scenes img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1.36;
    object-fit: cover;
    border: 1px solid #f0aaff;
    border-radius: clamp(.22rem, 1vw, .7rem);
    box-shadow: 0 0 .65rem #b536fa82;
}
.treasure-page-body .treasure-collection-heading h3 {
    color: #fff1ff;
    font-size: clamp(1.14rem, 3.1vw, 2rem);
    text-align: center;
    text-shadow: 0 2px #490c73, 0 0 .65rem #ed92ffb5;
}
.treasure-heading-charm { display: grid; place-items: center; width: clamp(1.9rem, 6vw, 4rem); }
.treasure-heading-charm img {
    display: block;
    max-width: 100%;
    max-height: clamp(1.9rem, 6vw, 4rem);
    object-fit: contain;
    filter: drop-shadow(0 2px 3px #8a3e657f);
}
.treasure-page-body .treasure-grid {
    width: min(100%, 56rem);
    gap: clamp(1.25rem, 2.8vw, 2.6rem) var(--pedestal-gap);
}
.treasure-page-body .treasure-offer {
    --display-light: #d260ffb5;
    color: #fff4ff;
    text-shadow: 0 1px 3px #17022d, 0 0 4px #17022d;
}
.treasure-page-body .treasure-offer:nth-child(6n + 2) { --display-light: #ffae54d0; }
.treasure-page-body .treasure-offer:nth-child(6n + 3) { --display-light: #46cdffc5; }
.treasure-page-body .treasure-offer:nth-child(6n + 4) { --display-light: #ff569dbb; }
.treasure-page-body .treasure-offer:nth-child(6n + 5) { --display-light: #7590ffe0; }
.treasure-page-body .treasure-offer:nth-child(6n + 6) { --display-light: #4cffbabd; }
.treasure-page-body .treasure-offer h4 { min-block-size: 2.32em; margin: .15rem 0; }
.treasure-page-body .treasure-art::before {
    background: radial-gradient(ellipse at 50% 72%, var(--display-light), transparent 72%);
}
.treasure-page-body .treasure-art img { filter: drop-shadow(0 .2rem .3rem #180228c9); }
.treasure-page-body .treasure-price { color: #ffe894; }
.treasure-page-body .treasure-offer .quiet-button {
    white-space: normal;
    line-height: 1.2;
    text-shadow: none;
}
.treasure-page-body .treasure-offer .quiet-button:hover:not(:disabled) { color: #fff4b5; }

.treasure-gem-trails {
    position: absolute;
    z-index: 2;
    inset: clamp(13rem, 38vw, 30rem) clamp(.6rem, 3vw, 2.6rem) clamp(2rem, 4vw, 3.25rem);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}
.treasure-vault:not(:has(.treasure-chest[open]:not([data-opening]))) .treasure-gem-trails { visibility: hidden; }
.treasure-gem-trail {
    width: clamp(1.4rem, 7vw, 6.1rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.treasure-gem-trail img {
    display: block;
    width: 100%;
    height: auto;
    filter: saturate(1.18) drop-shadow(0 0 .55rem #bd6af3a3);
    transform: rotate(-12deg);
}
.treasure-gem-trail img:nth-child(2n) { width: 76%; transform: rotate(13deg); }
.treasure-gem-trail:nth-child(2) img:first-child { margin-top: 33%; }
.treasure-gem-trail img[data-gem="19"],
.treasure-gem-trail img[data-gem="21"] {
    border: 2px solid #e7b24c;
    border-radius: 38%;
    background: #fff;
}
.treasure-trail-charm { width: 100%; }
.treasure-trail-charm-diamond-shower img {
    border: 2px solid #ffd673;
    border-radius: 28%;
}
.treasure-footer-chest { display: block; width: clamp(4.5rem, 9vw, 7rem); margin: 1.3rem auto 0; }
.treasure-footer-chest img { display: block; width: 100%; height: auto; }
@media (max-width: 48rem) {
    .treasure-vault { margin-top: .85rem; }
    .treasure-page-body .treasure-offer { flex-basis: calc((100% - var(--pedestal-gap)) / 2); }
}
@media (max-width: 40rem) {
    .masthead-inner { gap: .55rem; padding-right: .75rem; padding-left: .75rem; }
    .masthead-logo { width: clamp(5rem, 18vw, 7rem); }
    .masthead-clock { font-size: .65rem; }
    .masthead-clock strong { font-size: .8rem; }
    .treasure-page-heading { min-height: 12.6rem; padding: 1.2rem 28% 2.3rem 6%; }
    .treasure-page-heading::before {
        inset: 0 0 0 33%;
        background-position: center 49%;
        mask-image: linear-gradient(90deg, transparent, #000 84%);
    }
    .treasure-page-heading h1 { font-size: clamp(1.8rem, 6.6vw, 2.6rem); }
    .treasure-welcome { max-width: 21rem; font-size: .9rem; }
    .treasure-heading-art .treasure-gem { top: auto; bottom: calc(2% + var(--y) * .08); }
    .treasure-heading-art .treasure-gem:nth-of-type(3) { --x: 4%; }
    .treasure-heading-art .treasure-gem:nth-of-type(4) { --x: 12%; }
    .treasure-heading-art .treasure-gem:nth-of-type(5) { --x: 20%; }
    .treasure-heading-art .treasure-gem:nth-of-type(6) { --x: 28%; }
    .treasure-heading-art .treasure-gem:nth-of-type(7) { --x: 35%; }
    .treasure-heading-art .treasure-gem:nth-of-type(8) { --x: 42%; }
    .treasure-blue-chest { width: 13%; bottom: 15%; right: 5%; max-height: 32%; }
    .treasure-orbs { width: 13%; bottom: 34%; right: 4%; max-height: 28%; }
    .treasure-sim-picker { grid-template-columns: minmax(0, 1fr); }
    .treasure-page-body .treasure-chest > summary { width: min(76%, 30rem); }
    .treasure-page-body .treasure-open-label { font-size: .75rem; bottom: 5%; }
    .treasure-page-body .treasure-close-label { top: .36rem; right: .36rem; padding: .3rem .45rem; }
    .treasure-coins { right: 1%; }
    .treasure-vault-chest { top: 10.35rem; right: 1.8%; width: 10.5%; }
    .treasure-charm-gold-star { --charm-x: 3%; --charm-y: 1.15rem; }
    .treasure-charm-silver-diamond { --charm-x: 3.2%; --charm-y: 7.75rem; }
    .treasure-charm-jewel-cluster { --charm-x: 1.6%; --charm-y: 9.7rem; }
    .treasure-charm-pixel-coin { --charm-x: 92%; --charm-y: 8rem; }
    .treasure-charm-red-medallion { --charm-x: 89%; --charm-y: 9.9rem; }
    .treasure-charm-spinning-coin { --charm-x: 91%; --charm-y: 1.3rem; }
    .treasure-page-body .treasure-collection { --gem-margin: clamp(1.6rem, 6.5vw, 2.5rem); }
    .treasure-gem-trails { inset-inline: .5rem; }
    .treasure-gem-trail { width: clamp(1.17rem, 5.7vw, 2.1rem); }
    .treasure-page-body .treasure-art { height: clamp(5rem, 23vw, 9rem); }
}
@media (max-width: 24rem) {
    .masthead-inner { gap: .4rem; }
    .masthead-treasure { width: 3rem; }
    .masthead-tso { width: 3rem; }
    .wordmark { width: 2.7rem; }
    .treasure-page-body .treasure-offer .quiet-button { padding-inline: .45rem; font-size: .81rem; }
}

