#page-dialog:has(#layer > .reward-preference) {
  inset:0; width:min(360px,calc(100% - 40px)); height:fit-content; max-width:none; max-height:62dvh;
  margin:auto; padding:0; border:0; border-radius:24px; color:#fff; overflow:hidden; background:#151326;
  box-shadow:0 0 28px #866eea4d,0 0 72px 12px #7866e82e;
}
#page-dialog:has(#layer > .reward-preference)::backdrop { background:rgb(0 0 0 / 70%); backdrop-filter:blur(10px); }
.reward-preference { isolation:isolate; position:relative; margin:0; padding:0; border-top:1px solid #ffffff26; border-radius:24px; }
.reward-preference::before { content:''; position:absolute; z-index:-1; inset:0; background:url('/reward-preferences-popup-bg.webp') center top/cover no-repeat; opacity:.8; }
#page-dialog .reward-preference > .close-layer { top:10px; right:10px; min-height:44px; min-width:44px; border:0; background:transparent; color:transparent; }
.reward-preference > .close-layer::after { content:'×'; display:grid; place-content:center; position:absolute; inset:7px; border:1px solid #ffffff2b; border-radius:50%; background:#ffffff18; color:white; font:24px/1 sans-serif; }
.rp-form,.rp-form .controls { display:flex; flex-direction:column; max-height:calc(62dvh - 1px); min-height:0; min-width:0; border:0; margin:0; padding:0; }
.rp-edges { position:relative; display:flex; flex-direction:column; min-height:0; }
.rp-edges::before,.rp-edges::after { content:''; pointer-events:none; position:absolute; z-index:1; inset-inline:0; backdrop-filter:blur(5px); }
.rp-edges::before { top:0; height:72px; opacity:var(--rp-top,0); mask-image:linear-gradient(#000,transparent); }
.rp-edges::after { bottom:0; height:64px; opacity:var(--rp-bottom,0); mask-image:linear-gradient(transparent,#000); }
.rp-scroll { overflow-y:auto; overscroll-behavior:contain; scrollbar-width:none; padding:24px 20px 8px; }
.rp-scroll::-webkit-scrollbar { display:none; }
.rp-scroll h1 { padding-right:40px; margin:0; font-size:22px; line-height:28px; font-weight:800; letter-spacing:normal; }
.rp-subtitle { margin:4px 0 16px; font-size:14px; line-height:20px; font-weight:500; color:#ffffffb3; }
.rp-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.rp-option { position:relative; display:flex; flex-direction:column; gap:0; padding:10px; border:2px solid #ffffff1a; border-radius:12px; background:#ffffff0d; cursor:pointer; }
.rp-option:has(:checked) { border-color:#f6c070; background:#f6c07026; }
.rp-option:has(:focus-visible),.rp-save:focus-visible,.rp-entry:focus-visible { outline:2px solid white; outline-offset:1px; }
.rp-image,.rp-gem { width:48px; height:48px; flex:none; object-fit:contain; }
.rp-gem { display:grid; place-items:center; border-radius:50%; background:#ffffff0d; }
.rp-gem svg { width:18px; height:18px; stroke:#ffffff99; stroke-width:1.8; fill:none; stroke-linejoin:round; }
.rp-option strong { margin-top:6px; color:white; font-size:16px; line-height:22px; font-weight:700; }
.rp-option small,.rp-entry small { font-size:12px; line-height:16px; color:#ffffff80; }
.rp-option small { margin-top:2px; }
.rp-radio { appearance:none; position:absolute; top:10px; right:10px; width:20px; height:20px; margin:0; padding:0; border:1.5px solid #ffffffb3; border-radius:50%; background:#0006; cursor:pointer; }
.rp-radio:checked { border-color:#f6c070; background:radial-gradient(circle,#000 0 4px,#f6c070 4.4px); }
.rp-footer { flex:none; padding:12px 20px 24px; }
.rp-save { width:100%; min-height:48px; border:1px solid #ffffff52; border-radius:999px; background:linear-gradient(115deg,#fdaa89,#fed898,#fbf5c2,#f499fa,#9693fa,#88b1fe); color:#19131e; font-weight:700; }
.rp-save:disabled,.rp-form .controls:disabled .rp-save { opacity:.5; cursor:default; }
.rp-error { margin:0 0 8px; color:#ffbcbb; font-size:13px; }
.rp-error:empty { display:none; }
.rp-state { display:grid; place-content:center; padding:80px 32px; max-height:62dvh; margin:0; text-align:center; color:#ffffff99; font-size:14px; }
.rp-spinner { width:22px; height:22px; border:2px solid #fff4; border-top-color:white; border-radius:50%; animation:rp-spin .8s linear infinite; }
@keyframes rp-spin { to { transform:rotate(1turn); } }
@media(prefers-reduced-motion:reduce) { .rp-spinner { animation:none; } }
.rp-entry { display:flex; align-items:center; gap:12px; margin:12px 0; padding:14px 20px; border:1px solid #ffffff19; border-radius:20px; background:#17142a; color:white; text-decoration:none; }
.rp-entry strong,.rp-entry small { display:block; }
.rp-entry::after { content:'›'; margin-left:auto; color:#ffffff80; font-size:22px; }
