*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:#030913;color:var(--uiText,#f7e6bd);font-family:"Songti SC","STSong",Georgia,serif}body{min-height:100svh;display:flex;align-items:center;justify-content:center;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;color:inherit;cursor:pointer}button:disabled{cursor:default}button:focus-visible,a:focus-visible{outline:3px solid #fff;outline-offset:3px}[hidden]{display:none!important}
#viewport{position:relative;width:540px;height:960px;flex:none;overflow:hidden;box-shadow:0 0 100px #132b4999}#game{--gold:#ddbd7e;--accent:#268eff;--ink:#081323;position:absolute;width:540px;height:960px;transform-origin:top left;background:linear-gradient(#03112611,#020a1411 50%,var(--subtitleShadow,#030a16)55),var(--background) center/cover;overflow:hidden}#game:after{content:"";position:absolute;inset:0;pointer-events:none;box-shadow:inset 0 0 55px #0007}#game>*{z-index:1}button{border:1px solid #b1945d;background:#071629cf}button:disabled{opacity:.48}
.tiers{position:absolute;top:26px;left:18px;display:flex;gap:7px}.tiers button{position:relative;width:100px;height:42px;border:0;background:var(--button) center/100% 100%;font-size:17px;text-shadow:0 2px 3px #000}.tiers button:not(.selected){filter:saturate(.3);opacity:.65}.tiers button small{display:block;font-size:8px;line-height:9px}.tiers .selected{filter:drop-shadow(0 0 7px #168cff)}.exit{position:absolute;right:18px;top:24px;width:44px;height:44px;display:grid;place-items:center;border:1px solid #ad9e7a;border-radius:50%;color:#ead8b7;text-decoration:none;font:29px sans-serif;background:#06101c99}
.heading{position:absolute;top:91px;left:50%;transform:translateX(-50%);width:408px;text-align:center;text-shadow:0 3px 3px black}.crest{font-size:49px;line-height:46px;color:#77caff;text-shadow:0 0 15px #0085ff,0 0 2px #fff}.heading h1{font-size:52px;letter-spacing:3px;line-height:1.25;margin:7px 0 0;background:linear-gradient(#fff9df 18%,#d6a25c 45%,#fff1bb 53%,#977045 85%);background-clip:text;color:transparent;filter:drop-shadow(0 3px 1px #090905)}.subtitle{margin:8px 14px 0;padding:9px 0;border-top:1px solid #baa17099;border-bottom:1px solid #baa17088;font-size:17px;color:#e6d297;background:linear-gradient(90deg,transparent,#091c35cc,transparent)}
.tools{position:absolute;right:9px;top:108px;display:grid;gap:17px}.tools button{border:0;background:none;font-size:11px;width:54px;height:62px;padding:0;text-shadow:0 2px 4px var(--toolShadow,black)}.tools span{display:grid;place-items:center;width:40px;height:40px;margin:0 auto 4px;border:1px solid #d0b277;border-radius:50%;font-size:26px;background:#04101ddd;color:#eed598}
.chest{position:absolute;top:241px;left:50%;transform:translateX(-50%);width:494px;height:310px;isolation:isolate}.chest img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;transition:opacity .65s,transform .65s;filter:drop-shadow(0 10px 8px #000a)}#chestOpen{opacity:0;transform:scale(.96)}.chest.open #chestOpen{opacity:1;transform:scale(1)}.chest.open #chestClosed{opacity:0}.aura{position:absolute;inset:25% 18% 6%;border-radius:50%;background:radial-gradient(ellipse,#50b8ff55,transparent 68%);filter:blur(15px)}.chest.open .aura{background:radial-gradient(ellipse,#ffd66388,#008cff44,transparent 70%)}.sparkles{position:absolute;top:10%;left:20%;right:20%;text-align:center;font-size:32px;letter-spacing:13px;opacity:0;text-shadow:0 0 15px #27b2ff;pointer-events:none}.chest.open .sparkles{animation:spark 2s ease-out forwards}@keyframes spark{0%{opacity:0;transform:translateY(60px)}30%{opacity:1}100%{opacity:0;transform:translateY(-30px)}}
.result-panel{position:absolute;top:505px;left:50%;transform:translateX(-50%);width:386px;height:99px;background:var(--frame) center/100% 100%;text-align:center;padding:11px 20px}#phase{font-size:18px;line-height:23px;color:#e2c897;letter-spacing:1px}#formula{font:26px/32px Georgia;white-space:nowrap;color:var(--formulaText,#fff2d5)}#formula b{color:#ffda7e;text-shadow:0 0 10px #e99047;font-size:31px}#message{font:13px/20px "Songti SC",serif;margin:1px 0 0;color:var(--messageText,#e4dbce)}
.wheels{position:absolute;top:624px;left:15px;right:15px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.wheel-card{min-width:0;text-align:center;padding-top:4px;border-top:1px solid #ae8c53;border-radius:17px 17px 0 0;background:linear-gradient(#051321cf,transparent)}.wheel-card h2{height:26px;margin:0 0 12px;font-size:17px;font-weight:400;line-height:26px;white-space:nowrap;color:#f1d397}.wheel-shell{width:164px;height:164px;position:relative;margin:0 auto}.wheel{position:absolute;inset:10px;border-radius:50%;transition:transform 2.8s cubic-bezier(.16,.72,.3,1);box-shadow:inset 0 0 20px #0008}.wheel span{position:absolute;left:50%;top:50%;font:bold 13px Georgia;color:#fff1da;white-space:nowrap;text-shadow:0 1px 3px var(--numberShadow,#000)}.wheel-rim{position:absolute;inset:0;background:var(--rim) center/contain;pointer-events:none}.hub{position:absolute;inset:60px;display:grid;place-items:center;border-radius:50%;border:2px solid var(--gold);font:26px Georgia;background:radial-gradient(var(--hubLight,#162639),var(--hubDark,#020915));box-shadow:0 2px 8px #0009}.pointer{position:absolute;top:-9px;left:50%;transform:translateX(-50%);width:18px;height:24px;background:var(--pointer) center/contain no-repeat;filter:drop-shadow(0 0 5px #058fff);z-index:2}.wheel-card output{display:block;font:21px/32px Georgia;width:122px;height:32px;margin:6px auto 0;background:var(--frame) center/100% 100%;color:#ffdfa2}.wheel-card.revealed output{color:#fff8d9;text-shadow:0 0 9px var(--accent)}
.actions{position:absolute;top:878px;left:18px;right:18px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;height:76px}.actions button{border:0;background:var(--button) center/100% 100%;position:relative;display:flex;align-items:center;justify-content:center;gap:5px;padding:6px 6px 13px;font-size:19px;text-shadow:0 2px 3px var(--buttonShadow,#061432);filter:drop-shadow(0 0 5px #006aff44)}.actions button[data-bet="500"]{background-image:var(--buttonTen,var(--button))}.actions button[data-bet="1000"]{background-image:var(--buttonFifty,var(--button))}.actions strong{display:block;font:27px/27px Georgia}.actions .key{font:35px Georgia;transform:rotate(-25deg);color:#ffe29e}.actions small{position:absolute;bottom:8px;font:9px system-ui;color:inherit;opacity:.8}
#resume,#stop{position:absolute;top:77px;left:18px;padding:5px 15px;min-height:30px;font-size:12px;border-radius:20px;background:#07182bee;z-index:4}
.heading h1{text-shadow:none}.actions .key{display:block;width:29px;height:43px;background:var(--key) center/contain no-repeat;font-size:0;transform:none}
.chest,.heading{pointer-events:none}#game>.tools{z-index:3}
#resume:not([hidden])~#stop{left:auto;right:18px}
dialog{width:min(92vw,440px);max-height:80svh;overflow:auto;background:linear-gradient(145deg,var(--dialogLight,#142943),var(--dialogDark,#060f1d));color:var(--dialogText,#e8dfcd);border:1px solid #c6a875;border-radius:12px;padding:25px;font:14px/1.8 system-ui;box-shadow:0 20px 100px #000}dialog::backdrop{background:#010610bb;backdrop-filter:blur(5px)}dialog h2{font:24px "Songti SC",serif;color:var(--dialogTitle,#efd3a0);margin:0 0 18px}dialog h3{font-size:14px;color:var(--dialogHeading,#e5c990)}dialog p{color:var(--dialogBody,#bacbdd)}dialog table{border-collapse:collapse;width:100%;font-size:12px}dialog td,dialog th{text-align:left;padding:8px 4px;border-bottom:1px solid #9a896033}#closePanel{float:right;border:0;background:none;font-size:25px;min-width:44px;min-height:44px;margin:-12px -12px 0 10px}@media(prefers-reduced-motion:reduce){.chest img{transition:none}.sparkles{animation:none!important}}
/* Royal art pass: restrained background, shared gold metal and centered anchors. */
#game{background:radial-gradient(ellipse at 50% 22%,#04122200 10%,#030a1444 48%,#01081499 95%),linear-gradient(#030b1733,#030b1744),var(--background) center/cover}
.heading{top:88px;width:380px;height:130px}
#titleArt{display:block;width:100%;height:127px;object-fit:contain;filter:drop-shadow(0 4px 5px #0008)}
.heading h1{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.subtitle{position:absolute;top:108px;left:0;right:0;margin:0;border:0;padding:0;background:none;font-size:14px;line-height:24px;letter-spacing:1px;color:var(--subtitleText,#fff0b7);text-shadow:0 2px 2px var(--subtitleShadow,#030a16)}
.chest{top:235px;width:468px;height:282px}
.pedestal{position:absolute;top:467px;left:50%;transform:translateX(-50%);width:420px;height:57px;background:var(--pedestal) center/contain no-repeat;pointer-events:none}
.chest img{filter:drop-shadow(0 9px 4px #000b)}
.result-panel{top:501px;width:406px;height:103px;padding-top:10px}
#phase{font-size:18px;line-height:24px}#formula{font-size:29px;line-height:35px}#formula b{font-size:35px}#message{font-size:14px;line-height:22px}
.wheels{top:621px}.wheel-card{border:0;background:linear-gradient(#071627dd,transparent);border-radius:14px 14px 0 0;padding-top:0}
.wheel-card h2{font-size:16px;height:27px;line-height:27px;margin-bottom:10px;background:var(--frame) center/100% 100%}
.wheel-shell{filter:drop-shadow(0 5px 6px #0008)}
.wheel:after{content:"";position:absolute;inset:0;border-radius:50%;background:radial-gradient(circle at 35% 18%,#ffffff24,transparent 48%,#0006 100%);pointer-events:none}
.wheel span{z-index:2;font-size:14px;font-weight:400}.wheel span b{display:block;font-weight:400;transition:transform 2.8s cubic-bezier(.16,.72,.3,1)}
.winner-sector{position:absolute;inset:0;border-radius:50%;opacity:0;transition:opacity .3s;pointer-events:none}
.revealed .winner-sector{opacity:1}.wheel-card.revealed .pointer{filter:drop-shadow(0 0 7px #62cdff)}
.wheel-card output{font-size:22px;margin-top:5px}
.actions{top:874px;height:70px;left:18px;right:18px;gap:10px}
.actions button{font-size:17px;gap:7px;padding:5px 6px 14px;filter:drop-shadow(0 4px 4px #000a)}
.actions strong{font-size:26px;line-height:25px}.actions .key{width:31px;height:43px}.actions small{bottom:8px;font-size:9px;line-height:10px}
.tools{top:103px;gap:18px}.tools .tool-icon{background-position:center;background-size:24px 24px;background-repeat:no-repeat;background-color:var(--toolFill,#06101fe8);border-color:var(--toolBorder,#c5a571);box-shadow:inset 0 0 0 3px var(--toolInset,#091320),0 3px 5px #0008}
.tools .rewards-icon{background-image:var(--iconRewards)}.tools .rules-icon{background-image:var(--iconRules)}.tools .record-icon{background-image:var(--iconRecord)}
.subtitle{top:89px;font-size:12px}.pedestal{filter:brightness(.68)}
#game>.heading,#game>.pedestal{z-index:1}#game>.chest{z-index:2}
/* Readability pass: reserve the bottom 5% and separate tiny-sector labels. */
.chest{top:213px;height:238px;width:450px}
.pedestal{top:406px;height:48px;width:394px}
.result-panel{top:439px;height:102px;width:406px}
#phase{font-size:17px;line-height:22px}#formula{font-size:30px;line-height:36px}#message{font-size:16px;line-height:23px}
.wheels{top:557px}.wheel span{font-size:16px}
.wheel-legend{display:flex;align-items:center;justify-content:center;gap:7px;height:27px;margin-top:3px;font:16px Georgia;color:#ede5d6}
.wheel-legend span{display:inline-flex;align-items:center;gap:3px;padding:2px 0;border-bottom:1px solid transparent}
.wheel-legend i{width:8px;height:8px;border:1px solid #dac7a2;border-radius:2px}
.wheel-legend .selected{color:#fff0b6;border-bottom-color:#f2cf85;text-shadow:0 0 5px #e6b95c}
.wheel-card output{margin-top:2px;height:31px;line-height:31px;font-size:23px}
.actions{top:832px;height:82px}
.actions button{font-size:18px;gap:5px;padding:5px 6px 22px}
.actions strong{font-size:29px;line-height:29px}
.actions small{bottom:9px;font-size:12px;line-height:14px}
.actions .key{width:28px;height:40px}
.chest[data-reward="empty"] .aura,.chest[data-reward="empty"] .sparkles{display:none}
.chest[data-reward="empty"] #chestClosed{filter:drop-shadow(0 8px 4px #0009) brightness(.85)}
.chest[data-reward="small"] .sparkles{display:none}
.chest[data-reward="small"] .aura{opacity:.25}
.chest[data-reward="small"] #chestOpen{filter:drop-shadow(0 8px 4px #0009) brightness(.72) saturate(.8)}
/* Compact two-line controls and complete sidebar. */
.tools{top:100px;gap:5px}.tools button{height:60px}
.tools #soundText{display:block;width:auto;height:auto;margin:0;border:0;border-radius:0;box-shadow:none;background:none;font:11px "Songti SC",serif}
.tools .notice-icon{background-image:var(--iconNotice)}.tools .sound-icon{background-image:var(--iconSound)}
#sound[aria-pressed="false"] .sound-icon{opacity:.55}
.wheel-card output{margin-top:21px}
.actions button{padding:8px 6px;gap:3px}
.actions .action-copy{display:flex;flex-direction:column;align-items:center;gap:6px;white-space:nowrap}
.actions .action-copy>span{font-size:15px;line-height:23px}
.actions .action-copy strong{display:inline;font:20px/23px Georgia}
.actions .action-copy small{position:static;display:block;font:17px/23px Georgia;opacity:1}
.actions .key{width:21px;height:35px;flex:none}

#formula{display:grid;grid-template-columns:48px 25px 36px 25px 48px 25px 74px 30px;justify-content:center;align-items:baseline;font-variant-numeric:tabular-nums;white-space:nowrap}#formula>*{text-align:center}
.chest img,.chest[data-reward="empty"] #chestClosed,.chest[data-reward="small"] #chestOpen{filter:none}
#game>.heading,#game>.tools,#game>.pedestal,#game>.chest,#game>.result-panel,#game>.wheels,#game>.actions,#game>#resume,#game>#stop{translate:none}

/* Reference layout: chest, wheels, result, then single-open actions. */
.back{position:absolute;top:24px;left:24px;width:40px;height:40px;display:grid;place-items:center;border:1px solid #e6bc64;border-radius:50%;background:var(--backFill,#04101ee6);text-decoration:none;color:var(--backText,#ffe2a0);font:42px/36px Georgia;padding-bottom:5px}
.heading{top:38px;width:382px;height:132px}
#titleArt{height:128px}
.subtitle{top:90px;font-size:13px;letter-spacing:0}
.tools{top:22px;right:10px;gap:7px}
.tools button{height:60px;font-size:12px}
.tools #soundText{font-size:12px}
.chest{top:162px;width:508px;height:294px}
.pedestal{top:408px;width:428px;height:46px;filter:none}
.wheels{top:450px;left:8px;right:8px;gap:4px}
.wheel-card{background:none}
.wheel-card h2{width:132px;height:32px;margin:0 auto 12px;line-height:32px;font-size:17px;background-image:var(--button);color:#fff1d1}
.wheel-card:nth-child(2) h2{background-image:var(--frame)}
.wheel-card:nth-child(3) h2{background-image:var(--frame)}
.wheel-shell{width:172px;height:172px}
.hub{inset:62px;font-size:30px}
.pointer{top:104px;bottom:auto;width:18px;height:24px;transform:translateX(-50%);pointer-events:none}
.wheel-card output{display:none}
.result-panel{top:698px;width:498px;height:104px;padding:12px 20px 0;background:radial-gradient(ellipse,#071321e8 40%,#06101baa 65%,transparent 73%);border-radius:50%;border-top:1px solid #b6924b;border-bottom:1px solid #b6924b;box-shadow:0 -2px 14px #238afa24,0 3px 16px #edb13e24}
#phase{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
#formula{grid-template-columns:58px 30px 43px 30px 58px 30px 85px 35px;font-size:32px;line-height:46px}
#formula b{font-size:40px}
#formula>span:last-child{font-size:34px;color:#ffda7e}
#message{font-size:17px;line-height:28px;margin-top:5px;padding-top:5px;border-top:1px solid #c0a15a80}
.actions{top:824px;height:97px;left:16px;right:16px;gap:7px}
.actions .key{width:25px;height:41px}
.actions .action-copy{gap:9px}
.actions .action-copy>span{font-size:16px}
.actions .action-copy strong{font-size:17px}
.actions .action-copy small{font-size:18px}
#resume,#stop{top:8px;left:80px}

/* Color semantics: tier colors belong to purchase controls; gold marks revealed values. */
#game{--selected:#ffda80;background:linear-gradient(180deg,#030a1200 35%,#02081025 73%,#02081000),var(--background) center/cover}
#game:after{box-shadow:inset 0 0 28px #0005}
#game>.foreground{position:absolute;left:0;right:0;bottom:-5px;height:180px;background:var(--foreground,none) center bottom/100% auto no-repeat;z-index:0;pointer-events:none}
.pedestal{top:319px;width:490px;height:145px}
.heading{top:35px}
.chest{top:156px;height:302px}
.wheel-card h2,.wheel-card:nth-child(2) h2,.wheel-card:nth-child(3) h2{background:var(--frame) center/100% 100% no-repeat;color:var(--labelText,#f5dfaf)}
.wheel span{font-size:18px;color:var(--wheelText,#f4ecdc)}
.wheel-card.revealed .wheel span.selected{color:var(--selected);text-shadow:0 0 8px #e6ae48,0 1px 2px #000}
.pointer,.wheel-card.revealed .pointer{filter:drop-shadow(0 1px 3px #000)}
.wheel-card.revealed .pointer{filter:drop-shadow(0 0 5px #ffd581)}
#formula .revealed-value{color:var(--selected);text-shadow:0 0 8px #b77e3f80}
#formula b,#formula>span:last-child{color:var(--selected)}
.result-panel{background:radial-gradient(ellipse,var(--resultFill,#07111ccb) 25%,var(--resultFade,#07111c88) 58%,transparent 73%);border:0;border-radius:0;box-shadow:none}
.result-panel:before{content:"";position:absolute;inset:-5px 3px 4px;border:1px solid #d4ad5755;border-radius:50%;box-shadow:0 0 18px #efb34b18;pointer-events:none}
#message{border-top:1px solid #c0a15a66}
#sound[aria-pressed="false"] .sound-icon{opacity:1}

/* Keep the longer gift-value result on one line within the result panel. */
#message{font-size:15px;white-space:nowrap}

/* Readability and unambiguous sector ownership; keep stage and timing unchanged. */
.tools{right:0}
.tools button{width:72px;font-size:12px;height:64px}
.tools #soundText{font-size:12px}
.wheel-card h2{font-size:20px}
.actions .action-copy>span,.actions .action-copy strong{font-size:20px}
.actions .action-copy small{font-size:20px}
.actions .key{width:23px}
#message{font-size:15px;line-height:28px;white-space:nowrap;margin-top:5px;padding-top:5px}
.sector-boundaries{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1}
.sector-boundaries line{stroke:var(--boundary,#e1d1ad);stroke-width:.65;stroke-opacity:.85}
.wheel-card.revealed .wheel span.selected{color:var(--revealed,var(--revealedText,#fff1c4));text-shadow:0 1px 3px var(--numberShadow,#000),0 0 5px #9b641d}
#formula .revealed-value{color:var(--revealedText,#fff1c4)}

#loading{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;background:#07111f;color:var(--dialogText,#e8dfcd);font:15px system-ui;text-align:center;padding:24px}#loading a{color:#b6c9db;font-size:13px}#retryTheme{padding:10px 24px;border-radius:8px}
/* Keep sector lines beneath the hub even before a rotation creates a stacking context. */
.wheel{z-index:0}
.balance{position:absolute;top:24px;left:76px;z-index:4;height:30px;display:flex;align-items:center;gap:7px;padding:0 11px;border:1px solid var(--gold);border-radius:15px;background:var(--ink);color:var(--gold);font:14px/1 system-ui;white-space:nowrap;pointer-events:none}
.balance span{color:var(--balanceText,#fff4dd);font-variant-numeric:tabular-nums}
/* Let controls inherit the optional theme foreground while keeping the royal default. */
#game{color:var(--uiText,#f7e6bd)}

/* NX1 reconnect only reads state; keep it clear of the balance and game controls. */
.nx1-channel #resume{top:auto;bottom:6px;left:50%;transform:translateX(-50%);max-width:calc(100% - 24px)}
.nx1-channel.nx1-paused #message{white-space:normal;overflow-wrap:anywhere;line-height:20px}

/* NX1-only advertising and explicit custom stake picker. */
.nx1-channel #nx1AdWall{position:absolute;top:22px;right:84px;left:auto;z-index:4;max-width:210px;min-height:30px;padding:4px 12px;border-radius:18px;font:14px/1.4 system-ui;white-space:normal;overflow-wrap:anywhere}
#nx1StakeOptions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
#nx1StakeOptions button,#nx1InsufficientAd{min-height:44px;padding:8px;white-space:normal;overflow-wrap:anywhere}
#adFeedback{white-space:normal;overflow-wrap:anywhere}

.nx1-channel .actions button:first-child{background-image:var(--button)}
.nx1-channel .actions button:nth-child(2){background-image:var(--buttonTen,var(--button))}
.nx1-channel .actions button:nth-child(3){background-image:var(--buttonFifty,var(--button))}
.nx1-channel .actions button:last-child .action-copy{min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere;gap:4px}
.nx1-channel .actions button:last-child .action-copy>span,.nx1-channel .actions button:last-child small{line-height:22px}
