:root{color-scheme:light;--ink:#332c25;--paper:#f3efe7;--line:#dcd5c8;--accent:#72563a}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font-family:"PingFang SC","Microsoft YaHei",system-ui,sans-serif}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer}header{max-width:1240px;padding:28px 24px;margin:auto;display:flex;align-items:center;gap:24px}.brand{color:var(--ink);text-decoration:none;font-size:29px;display:flex;gap:10px;align-items:center}.brand span{font:600 21px Georgia,serif}.edition{font-size:12px;letter-spacing:2px;color:#8e8070}.icon-button{margin-left:auto;border:1px solid var(--line);border-radius:50%;width:40px;height:40px;background:transparent;color:#746451}main{max-width:1240px;margin:auto;padding:12px 24px 24px}.intro{display:flex;justify-content:space-between;align-items:end;margin-bottom:32px}.eyebrow{font-size:10px;letter-spacing:4px;color:#8d755b;margin:0 0 12px}h1{font-family:Georgia,"Songti SC",serif;font-size:38px;font-weight:500;letter-spacing:1px;line-height:1.2;margin:0}.intro-note{font-size:13px;color:#897c6c;line-height:1.9;text-align:right;margin:0}.selector{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:16px}.selector button{padding:14px 20px;text-align:left;background:#ebe5da;border:1px solid transparent;border-radius:12px;display:flex;align-items:center;gap:13px;transition:background .2s,border-color .2s}.selector button[aria-pressed=true]{background:#faf8f3;border-color:#ad9270;box-shadow:0 2px 8px #4b351208}.selector span{font-size:15px;font-weight:600}.selector small{display:block;font-size:11px;font-weight:400;color:#948575;margin-top:3px}.selector b{margin-left:auto;font:italic 14px Georgia;color:#b8a58f}.dot{display:block;width:30px;height:30px;flex:none;border-radius:50%;box-shadow:inset -6px -3px 9px #0008,0 2px 4px #0002}.dot.earth{background:radial-gradient(ellipse at 30% 40%,#94a57b,transparent 35%),#236091}.dot.moon{background:radial-gradient(circle at 30% 50%,#79736a 8%,transparent 12%),#b9b5ac}.dot.sun{background:radial-gradient(circle at 30% 30%,#ffe9a6,#ee852a 65%,#923c18);box-shadow:0 0 12px #f1a45788}.workbench{height:640px;position:relative;border-radius:20px;overflow:hidden;background:#251e19;box-shadow:0 14px 36px #3b2a1514}#scene{display:block;width:100%;height:100%;touch-action:none;outline:none}#scene:focus-visible{outline:2px solid #dab684;outline-offset:-5px}.scene-label{position:absolute;left:28px;top:27px;pointer-events:none;color:#e7ded0}.scene-label span{font:10px Georgia;letter-spacing:4px;color:#b9a58a}.scene-label h2{font-size:19px;letter-spacing:4px;font-weight:400;margin:7px 0}.scene-caption{position:absolute;bottom:24px;left:28px;right:20px;display:flex;align-items:center;gap:9px;font-size:12px;letter-spacing:.5px;color:#c3b399;pointer-events:none}.pulse{width:5px;height:5px;border-radius:50%;background:#d4b488}.bottom{display:flex;align-items:center;justify-content:space-between;padding:25px 0 27px;gap:20px}.description p{font-size:17px;margin:0 0 7px}.description span{font-size:12px;color:#938371}.actions{display:flex;gap:10px;flex:none}.actions button{border:1px solid #cfc2b0;background:transparent;border-radius:9px;color:#705c45;padding:12px 20px;font-size:13px}#cut{background:#514232;border-color:#514232;color:#fff5e3;min-width:135px}#cut span{padding-left:20px}button:disabled{opacity:.4;cursor:default}button:focus-visible{outline:2px solid #a97a42;outline-offset:3px}footer{display:flex;justify-content:space-between;gap:16px;border-top:1px solid var(--line);padding-top:19px;font-size:10px;letter-spacing:.8px;color:#a19482}#loading{position:absolute;inset:0;background:#251e19;display:grid;place-items:center;color:#c6b296;font-size:13px;letter-spacing:2px;transition:opacity .3s}#loading.done{opacity:0;pointer-events:none}@media(min-width:1600px){.workbench{height:690px}}@media(max-width:700px){header{padding:20px 18px;gap:14px}.brand span{font-size:18px}.edition{font-size:9px;letter-spacing:1px}main{padding:6px 12px 20px}.intro{padding:0 6px;margin-bottom:23px}.eyebrow{font-size:8px;letter-spacing:2.5px}h1{font-size:28px}.intro-note{display:none}.selector{gap:6px;margin-bottom:10px}.selector button{padding:11px 9px;gap:7px;border-radius:10px}.selector b{display:none}.selector span{font-size:13px}.selector small{font-size:9px;letter-spacing:-.3px}.dot{width:22px;height:22px}.workbench{height:490px;border-radius:14px}.scene-label{top:20px;left:20px}.scene-caption{left:18px;bottom:19px;font-size:11px;letter-spacing:0}.bottom{align-items:stretch;flex-direction:column;padding:20px 5px;gap:18px}.description p{font-size:16px}.actions button{flex:1}.actions{width:100%}footer{padding:15px 5px;flex-direction:column;gap:7px;font-size:9px}}@media(max-width:420px){.edition{display:none}h1{font-size:25px}.intro{margin-bottom:20px}.actions button{padding:11px 10px}#cut{min-width:0}}@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
/* The cut rule stays visible during ordinary play; diagnostics stay on ?debug. */
#cut-count{display:block;margin-top:8px;font-size:12px;color:#765b3f}
#blade-trail{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:2;mix-blend-mode:screen}
#debug-hud{position:fixed;top:100px;right:16px;z-index:50;max-width:190px;padding:8px 10px;border-radius:8px;background:#171c20e8;color:#e4edef;font:11px/1.45 ui-monospace,monospace;white-space:pre-line;pointer-events:none;box-shadow:0 3px 12px #0005}
@media(max-width:700px){#debug-hud{top:174px;right:18px;max-width:160px;font-size:10px}#cut-count{font-size:11px}}
.planet-menu{display:flex;align-items:center;gap:7px;margin:-12px 0 16px;padding:6px;background:#e9e1d5;border-radius:12px;width:max-content;max-width:100%}
.planet-menu-label{font-size:12px;letter-spacing:1px;color:#735b40;padding:0 10px;white-space:nowrap}
.planet-menu button{min-width:75px;min-height:44px;border:1px solid transparent;border-radius:8px;background:transparent;color:#635647;font-size:13px;font-weight:600}
.planet-menu button[aria-pressed=true]{background:#fffaf2;border-color:#c9ac87;color:#442f20;box-shadow:0 2px 6px #422b1618}
.planet-menu button:disabled{opacity:.55}
@media(max-width:700px){.planet-menu{width:100%;margin:-5px 0 9px;gap:3px;padding:4px}.planet-menu-label{font-size:11px;padding:0 5px}.planet-menu button{flex:1;min-width:0;min-height:44px;padding:0 3px;font-size:12px}}

/* Star-chart desk: one photographic tabletop and a quiet, dark page shell. */
:root{color-scheme:dark;--ink:#e9e1d2;--paper:#11141c;--line:#3f414a;--accent:#c8a775}
body{background:linear-gradient(180deg,#1b202b 0,#11141c 320px,#101218 100%);color:var(--ink)}
.brand,.icon-button{color:#f3e8d5}
.edition,.intro-note{color:#ada89f}
.eyebrow{color:#c5a77f}
.planet-menu{background:#252936;border:1px solid #44444a}
.planet-menu-label{color:#cbb58f}
.planet-menu button{color:#ddd2c0}
.planet-menu button[aria-pressed=true]{background:#453c35;border-color:#a78960;color:#fff3dd;box-shadow:0 2px 9px #0004}
.icon-button{border-color:#686155}
.workbench{
 background:#101219 url('assets/star-chart-table.webp?v=79ba69f563') center top / auto 120% no-repeat;
 border:1px solid #62533f;box-shadow:0 22px 50px #0007,0 0 0 1px #a68b5424;
}
.scene-label{color:#fff0cf;text-shadow:0 2px 10px #000,0 1px 2px #000}
.scene-label span{color:#d7bd92}
.scene-caption{left:20px;right:auto;bottom:16px;max-width:calc(100% - 40px);padding:8px 12px;border:1px solid #baa27956;border-radius:7px;background:#101722cc;color:#f6e9d5;line-height:1.45;backdrop-filter:blur(6px);text-shadow:0 1px 2px #000}
.pulse{background:#e2bb77;flex:none}
.description span{color:#aaa69f}
#cut-count{color:#cfb48e}
.actions button{border-color:#665c50;color:#eadcc6;background:#1f232d}
#cut{background:#b68b51;border-color:#d8ac6c;color:#171518;font-weight:700}
footer{color:#a39d94}
#loading{background:#161a23;color:#e6d4b9}
button:focus-visible{outline-color:#e5ba75}
@media(max-width:700px){
 .workbench{background-size:auto 120%}
 .scene-caption{left:12px;bottom:12px;max-width:calc(100% - 24px);padding:7px 10px}
}
/* The photograph is selected in JS so only the chosen scene is requested. */
.selection-row{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.scene-picker{display:flex;align-items:center;gap:9px;margin-top:-12px;padding:5px 5px 5px 12px;min-height:56px;background:#252936;border:1px solid #44444a;border-radius:12px;white-space:nowrap}
.scene-picker label{font-size:12px;color:#cbb58f;letter-spacing:1px}
.scene-picker select{min-height:44px;max-width:164px;padding:0 28px 0 10px;border:1px solid #766b5c;border-radius:8px;background:#171b25;color:#f7ebd9;font:600 13px "PingFang SC","Microsoft YaHei",system-ui,sans-serif;cursor:pointer}
.scene-picker select:focus-visible{outline:2px solid #e5ba75;outline-offset:2px}
#codex-open{flex:none;min-width:96px;min-height:84px;margin-top:-12px;padding:0 12px;border:1px solid #b9945e;border-radius:12px;background:linear-gradient(155deg,#35332f,#1b2330);color:#ffe4ad;box-shadow:inset 0 0 0 1px #ffe3a51c,0 4px 15px #0005;font:700 14px "PingFang SC","Microsoft YaHei",system-ui,sans-serif;white-space:nowrap;cursor:pointer}
#codex-open:hover{background:linear-gradient(155deg,#4c4134,#252d3a)}
#codex-open.codex-pulse{animation:codex-button-pulse 1s ease-out}
@keyframes codex-button-pulse{0%,100%{box-shadow:inset 0 0 0 1px #ffe3a51c,0 4px 15px #0005}35%{box-shadow:0 0 0 5px #efc47766,0 0 30px #ffd687b3}}
@media(max-width:700px){#codex-open{min-width:100px;min-height:42px;margin:0 0 9px 0;padding:0 10px;font-size:12px}}
.workbench{background-color:#101219;background-image:none;background-position:center top;background-size:auto 120%}
/* Preserve the sharp photo's original 120% scale and table alignment. The
   lower copy supplies only the sides where this narrower scene ends. */
.workbench.scene-extended{isolation:isolate}
.scene-sidefill,.scene-photo{display:none;position:absolute;pointer-events:none}
.workbench.scene-extended .scene-sidefill,.workbench.scene-extended .scene-photo{display:block}
.scene-sidefill{inset:-28px;z-index:-2;background-position:center center;background-size:cover;filter:blur(18px) brightness(.78) saturate(.84)}
.scene-photo{top:0;bottom:0;left:50%;z-index:-1;transform:translateX(-50%);background-position:center center;background-size:auto 120%;-webkit-mask-image:linear-gradient(90deg,transparent,#000 4.5%,#000 95.5%,transparent);mask-image:linear-gradient(90deg,transparent,#000 4.5%,#000 95.5%,transparent)}
.workbench[data-scene="empty-board-and-space"]{background-position:center center}
.workbench[data-scene="future-lab-table"]{background-position:center top}
.workbench[data-scene="floating-energy-platform"]{background-position:center top}
.workbench[data-scene="altar-preferred"]{background-position:center 60%}
.workbench[data-scene="ice-crystal-table"]{background-position:center center}
.workbench[data-scene="minimal-void-platform"]{background-position:center top;background-size:cover}
.scene-label{top:13px;left:13px;padding:9px 13px;border-radius:8px;background:#111925a8;backdrop-filter:blur(5px)}
.actions{position:absolute;z-index:3;top:14px;right:14px;gap:7px}
.actions button{min-height:40px;padding:0 11px;border:1px solid #d3bb92;border-radius:8px;background:#111925e8;color:#fff4e3;box-shadow:0 2px 10px #0007;font-size:12px;line-height:1;white-space:nowrap;backdrop-filter:blur(6px)}
#cut{min-width:0;padding:0 12px;background:#c49b60eF;border-color:#f1d4a4;color:#1a1716}
#cut span{padding-left:5px}
.bottom{padding:18px 0 23px}
#loading{z-index:4}
@media(max-width:700px){
 .selection-row{flex-wrap:wrap;gap:0}
 .selection-row .planet-menu{width:100%;margin:-5px 0 9px}
 .scene-picker{margin:0 0 9px auto;min-height:42px;padding:3px 3px 3px 9px}
 .scene-picker select{min-height:36px;max-width:166px}
 .scene-label{top:11px;left:10px;padding:7px 10px}
 .scene-label span{font-size:9px;letter-spacing:2px}
 .scene-label h2{font-size:16px;letter-spacing:2px;margin:3px 0 0}
 .actions{top:11px;right:10px;width:auto;gap:5px}
 .actions button{flex:none;min-height:40px;padding:0 9px;font-size:11px}
 #cut{padding:0 10px}
 .bottom{padding:15px 5px 21px}
 .workbench[data-scene="minimal-void-platform"]{background-position:center top;background-size:auto 120%}
}

/* Links and credits sit below the play field at all viewport widths. */
footer{flex-wrap:wrap;align-items:center;line-height:1.5}footer>span:nth-child(2){max-width:800px}.game-links{display:flex;flex-wrap:wrap;gap:6px 16px;width:100%;font-size:12px;letter-spacing:0}.game-links a{display:inline-block;padding:5px 0;color:#e8d4ad;text-decoration:underline;text-underline-offset:3px}.game-links a:focus-visible{outline:2px solid #e5ba75;outline-offset:2px}@media(max-width:700px){footer{align-items:flex-start}.game-links{font-size:12px}}
/* Eleven-body shelf: each specimen is a direct render of its game material. */
.selection-row{min-width:0}
.planet-menu{flex:1;min-width:0;width:auto;max-width:none;align-items:stretch;margin:-12px 0 16px;padding:5px 5px 5px 8px}
.planet-menu-label{display:flex;align-items:center;justify-content:center;flex:none;width:40px;padding:0;font-size:11px}
.planet-menu-track{display:flex;gap:3px;min-width:0;overflow-x:auto;overscroll-behavior-inline:contain;scroll-snap-type:x proximity;scrollbar-width:thin;scrollbar-color:#8c7455 transparent}
.planet-menu button{display:flex;flex:0 0 70px;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-width:70px;min-height:74px;padding:4px 2px 5px;scroll-snap-align:center;line-height:1.1}
.planet-menu button span{display:block;white-space:nowrap}
.planet-thumb{display:block;width:46px;height:46px;object-fit:contain;pointer-events:none}
.planet-menu button[data-body=saturn] .planet-thumb{width:60px}
.planet-menu button[aria-pressed=true]{box-shadow:inset 0 0 0 1px #d9b985,0 1px 7px #0005}
#switch-status{position:absolute;z-index:6;top:13px;left:50%;transform:translateX(-50%);padding:7px 13px;border:1px solid #c6a46c;border-radius:8px;background:#111925e8;color:#fff0d5;box-shadow:0 5px 18px #0008;font-size:13px;letter-spacing:.04em;white-space:nowrap;opacity:0;transition:opacity .12s;pointer-events:none}
.workbench[data-switching=true] #switch-status{opacity:1}
@media(max-width:700px){#switch-status{top:56px;right:10px;left:auto;transform:none;padding:5px 8px;font-size:11px}}
.scene-picker{margin-top:-12px;min-height:84px;flex:none}
@media(max-width:700px){
 .selection-row{display:flex;flex-wrap:wrap}
 .selection-row .planet-menu{flex:1 1 100%;width:100%;max-width:100%;margin:-5px 0 9px;padding:4px 4px 4px 5px;gap:4px}
 .planet-menu-label{width:30px;font-size:10px}
 .planet-menu button{flex:0 0 67px;min-width:67px;min-height:69px;padding:3px 1px 4px;font-size:12px}
 .planet-thumb{width:43px;height:43px}
 .planet-menu button[data-body=saturn] .planet-thumb{width:58px}
 .scene-picker{margin:0 0 9px auto;min-height:42px}
}

/* Cut surprises: visual overlay, never an input target outside filled slots. */
.surprise-layer{position:absolute;inset:0;z-index:3;pointer-events:none;overflow:hidden;font-family:"PingFang SC","Microsoft YaHei",system-ui,sans-serif}
.surprise-tray{position:absolute;left:13px;top:85px;min-width:142px;padding:10px;border:1px solid #c6a46c;border-radius:10px;background:#111925d9;color:#fff0d5;box-shadow:0 6px 24px #0008,inset 0 0 0 1px #ffffff14;backdrop-filter:blur(7px);pointer-events:none;touch-action:manipulation}
.surprise-tray[hidden]{display:none}
.surprise-heading{display:flex;align-items:baseline;justify-content:space-between;gap:14px;font-size:11px;letter-spacing:2px;white-space:nowrap}
.surprise-count{color:#f5d99e;font:700 15px Georgia,serif;letter-spacing:0}
.surprise-slots{display:flex;justify-content:center;gap:6px;margin-top:9px}
.surprise-slot{display:grid;place-items:center;width:37px;height:39px;border:1px dashed #c2a77975;border-radius:6px;background:#070c1599;pointer-events:none}
.surprise-slot.filled{border-style:solid;background:#2c251dd9;box-shadow:0 0 12px #edc6784a;pointer-events:auto;cursor:pointer}
.surprise-slot.filled:focus-visible{outline:2px solid #ffe0a8;outline-offset:2px}
.surprise-actor{position:absolute;transform:translate(-50%,-50%);width:78px;height:78px;display:grid;place-items:center;filter:drop-shadow(0 0 13px var(--item-glow));will-change:left,top}
.surprise-token{display:grid;place-items:center;width:70px;height:70px;filter:drop-shadow(0 0 11px var(--item-glow));will-change:transform}
.surprise-tile{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;width:64px;height:68px;border:2px solid #f7cf83;border-radius:5px;background:linear-gradient(140deg,var(--tile-color,#283342),#101720 75%);color:#ffecb9;box-shadow:inset 0 0 0 1px #fff6c238,0 3px 14px #0009;font-family:system-ui,sans-serif}
.surprise-tile .surprise-atomic{position:absolute;top:4px;left:6px;font:600 10px system-ui,sans-serif}
.surprise-tile strong{font-size:31px;line-height:1;white-space:nowrap}
.surprise-tile strong.surprise-formula{font-size:25px;letter-spacing:-1px}
.surprise-tile .surprise-element{font:600 12px system-ui,sans-serif;margin-top:3px;white-space:nowrap}
.surprise-image{display:block;width:72px;height:72px;object-fit:contain;filter:drop-shadow(0 3px 5px #090909)}
.surprise-slot .surprise-tile{width:29px;height:31px;border-width:1px;border-radius:3px}
.surprise-slot .surprise-tile .surprise-atomic{font-size:6px;top:1px;left:2px}
.surprise-slot .surprise-tile strong{font-size:14px}
.surprise-slot .surprise-tile strong.surprise-formula{font-size:11px;letter-spacing:-.8px}
.surprise-slot .surprise-tile .surprise-element{font-size:7px;margin-top:0}
.surprise-slot .surprise-image{width:33px;height:33px}
.surprise-image.wiggle{animation:surprise-wiggle 1.35s ease-in-out infinite;transform-origin:55% 75%}
.surprise-image.wave{animation:surprise-wave 1.05s ease-in-out infinite;transform-origin:50% 80%}
@keyframes surprise-wiggle{0%,100%{transform:translateY(1px) rotate(-5deg) scale(1.02,.97)}50%{transform:translateY(-3px) rotate(5deg) scale(.97,1.04)}}
@keyframes surprise-wave{0%,100%{transform:translateY(1px) rotate(-5deg)}35%{transform:translateY(-5px) rotate(6deg)}65%{transform:translateY(-2px) rotate(-3deg)}}
.surprise-glint{position:absolute;width:40px;height:40px;transform:translate(-50%,-50%);border-radius:50%;background:radial-gradient(circle,#fffdf1 0 5%,#fff1abdd 12%,#f9d37044 40%,transparent 70%);box-shadow:0 0 16px 5px var(--item-glow,#ffe2a6);animation:surprise-glint var(--glint-duration,.35s) ease-out both;pointer-events:none}
.surprise-glint.near{width:20px;height:20px;opacity:.48;box-shadow:0 0 8px 2px #dae6ff}
.surprise-card.surprise-near-note{padding:5px 8px;font-size:12px;line-height:1.2;white-space:nowrap;color:#fff2d8;animation:surprise-near-note 1.2s ease-out both}
@keyframes surprise-near-note{0%{opacity:0;transform:translateY(4px)}15%,72%{opacity:1;transform:translateY(0)}100%{opacity:0;transform:translateY(-3px)}}
.surprise-peek{position:absolute;left:50%;top:50%;width:70px;height:70px;transform:translate(-50%,-50%) scale(.48);opacity:.93;filter:drop-shadow(0 0 8px var(--item-glow));overflow:visible}
.surprise-peek .surprise-tile,.surprise-peek .surprise-image{width:70px;height:70px}
@keyframes surprise-glint{0%{opacity:0;transform:translate(-50%,-50%) scale(.25)}35%{opacity:1;transform:translate(-50%,-50%) scale(1)}100%{opacity:0;transform:translate(-50%,-50%) scale(1.2)}}
.surprise-tray.complete{animation:surprise-complete 1.5s ease-out both}
.surprise-complete{position:absolute;left:calc(100% + 8px);top:0;padding:4px 8px;border:1px solid #ffe0a2;border-radius:6px;background:#102329ef;color:#fff4d4;font-size:14px;letter-spacing:1px;white-space:nowrap}
@keyframes surprise-complete{0%,100%{box-shadow:0 6px 24px #0008}35%{box-shadow:0 0 24px 8px #ffd684bd,inset 0 0 20px #ffe2a966}}
.surprise-card{position:absolute;display:flex;flex-direction:column;gap:5px;width:max-content;max-width:min(260px,calc(100% - 16px));padding:10px 12px;border:1px solid #dbb97c;border-radius:7px;background:#0b1422fa;color:#fff9ed;box-shadow:0 5px 18px #000c;font-size:14px;line-height:1.4;white-space:normal;overflow-wrap:anywhere;pointer-events:none}
.surprise-card[hidden]{display:none}
.surprise-card strong{color:#ffe5ae;font-size:16px;line-height:1.2}
.surprise-card-title{display:flex;align-items:center;gap:7px}
.surprise-card-symbol{font:700 12px/1 system-ui,sans-serif;color:#ffe3a5;font-style:normal;white-space:nowrap;flex:none;padding:3px 4px;border:1px solid #d2ad74;border-radius:3px;background:#223044}
.surprise-card span{display:block}
.codex-discovery{align-self:flex-start;margin-top:2px;padding:2px 7px;border:1px solid #e7bd6b;border-radius:4px;background:#6a481d;color:#fff2c5;font-size:11px;font-weight:700;letter-spacing:.06em}
.codex-discovery.collected{border-color:#788b9b;background:#263543;color:#d7e2e7}
.codex-item-history{display:block;margin-top:4px;padding-top:8px;border-top:1px solid #d9b77d66;color:#f3d8a6;font-size:12px;line-height:1.45}
.surprise-modal{position:absolute;inset:0;z-index:8;display:grid;place-items:center;padding:14px;background:#040a13c9;backdrop-filter:blur(7px);pointer-events:auto;cursor:zoom-out}
.surprise-modal[hidden]{display:none}
.surprise-modal-panel{position:relative;display:flex;flex-direction:column;align-items:center;gap:12px;width:min(390px,100%);max-height:100%;padding:12px 12px 14px;animation:surprise-modal-in .2s cubic-bezier(.2,.8,.2,1) both;cursor:zoom-out}
@keyframes surprise-modal-in{from{opacity:0;transform:scale(.86)}to{opacity:1;transform:scale(1)}}
.surprise-modal-display{position:relative;display:grid;place-items:center;width:min(350px,100%);height:min(350px,50vh);min-height:0;filter:drop-shadow(0 0 26px var(--item-glow));}
.surprise-modal-display .surprise-image{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 8px 12px #000b)}
.surprise-modal-display .surprise-tile{width:min(280px,78%);height:min(300px,100%);border-width:4px;border-radius:13px;box-shadow:inset 0 0 0 2px #fff6c238,0 16px 40px #000c}
.surprise-modal-display .surprise-tile .surprise-atomic{top:17px;left:20px;font-size:24px}
.surprise-modal-display .surprise-tile strong{font-size:112px}
.surprise-modal-display .surprise-tile strong.surprise-formula{font-size:83px;letter-spacing:-3px}
.surprise-modal-display .surprise-tile .surprise-element{font-size:27px;margin-top:7px}
.surprise-card.surprise-modal-card{position:relative;width:100%;max-width:360px;box-sizing:border-box;padding:13px 15px;text-align:center;align-items:center;pointer-events:none}
.surprise-modal-card .surprise-card-title{justify-content:center}
.surprise-modal-close{position:absolute;left:8px;top:2px;z-index:1;width:36px;height:36px;border:1px solid #e8c88c;border-radius:50%;background:#111925ec;color:#fff7df;font:18px/1 system-ui,sans-serif;cursor:pointer}
.surprise-modal-close:focus-visible{outline:2px solid #fff7df;outline-offset:2px}
/* Persistent collection ledger. It lives above the game, so closing a card never lands on the canvas. */
body.codex-open{overflow:hidden}
.codex-overlay{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px;background:#050a14df;backdrop-filter:blur(9px)}
.codex-overlay[hidden]{display:none}
.codex-panel{width:min(980px,100%);max-height:min(88vh,850px);overflow:auto;overscroll-behavior:contain;border:1px solid #c7a36b;border-radius:16px;background:linear-gradient(160deg,#202a37,#111824 62%,#151b26);color:#f7ead5;box-shadow:0 24px 70px #000d,inset 0 0 0 1px #ffe7b315;scrollbar-color:#a68559 #17202b}
.codex-top{position:sticky;top:0;z-index:2;display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:22px 25px 18px;border-bottom:1px solid #b99a694d;background:#17212df5;backdrop-filter:blur(9px)}
.codex-title>span{color:#d2ac75;font:700 10px Georgia,serif;letter-spacing:.25em}
.codex-title h2{margin:3px 0 4px;color:#ffe8b9;font:600 30px/1.2 Georgia,"Noto Serif SC","Songti SC",serif;letter-spacing:.05em}
.codex-title p{margin:0;color:#c9c9c5;font-size:12px}
.codex-close{flex:none;width:37px;height:37px;border:1px solid #d4b779;border-radius:50%;background:#27313d;color:#fff4df;font-size:17px;cursor:pointer}
.codex-header-actions{display:flex;align-items:center;gap:8px;flex:none}
.codex-header-actions .planet-book-share{min-height:36px;padding:5px 9px;border-color:#d7b477;background:#2c3846;color:#fff0d1;font-size:12px}
.surprise-modal-display .planet-item-share{position:absolute;z-index:2;top:0;right:0;min-height:38px;border-color:#f2cb86;background:#243340f2;color:#ffebc6;font-size:12px;pointer-events:auto;filter:none}
.scene-caption.share-active>.pulse,.scene-caption.share-active>#hint{display:none}
.scene-caption .planet-complete-banner{min-height:38px;max-width:100%;padding:7px 12px;border-color:#f7d08b;background:#142637f2;color:#fff0ce;font-size:12px;white-space:normal;text-align:left;pointer-events:auto;box-shadow:0 3px 16px #0009;animation:planet-share-complete 5s ease-out both}
@keyframes planet-share-complete{0%{opacity:0;transform:translateY(6px)}10%,84%{opacity:1;transform:none}100%{opacity:0;transform:translateY(-5px)}}
.scene-caption .planet-complete-banner::before{content:none}
.scene-caption .planet-complete-banner::after{content:'↗';font-size:16px}
.codex-celebration{display:flex;align-items:center;gap:14px;max-width:calc(100vw - 24px);animation-duration:6s;pointer-events:auto}
.codex-celebration .planet-all-share{min-height:36px;border-color:#f5dca8;background:#ead09a;color:#273543;font-size:12px}
@media(max-width:700px){.codex-header-actions{gap:5px}.codex-header-actions .planet-book-share{padding:4px 7px}.codex-celebration{gap:8px;padding:10px 12px;font-size:20px}}
.codex-list{display:grid;gap:16px;padding:20px 25px 25px}
.codex-section{padding:11px 13px 13px;border:1px solid #8f806b61;border-radius:10px;background:#0d1520b0}
.codex-section.complete{border-color:#cda768a3;box-shadow:inset 0 0 0 1px #ffd48315}
.codex-section-head{display:flex;align-items:center;gap:10px;margin-bottom:11px}
.codex-section-head img{width:42px;height:42px;object-fit:contain}
.codex-section-head h3{margin:0;color:#f7ead5;font:600 17px/1.2 Georgia,"Noto Serif SC","Songti SC",serif}
.codex-section-count{margin-left:auto;color:#e9ca90;font:700 13px Georgia,serif}
.codex-check{display:grid;place-items:center;width:19px;height:19px;border:1px solid #e9c985;border-radius:50%;color:#ffe9b9;font-size:13px}
.codex-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.codex-item{display:flex;align-items:center;gap:8px;min-width:0;min-height:70px;padding:6px 8px;border:1px solid #7f726459;border-radius:8px;background:#1c2633;color:#f5ead8;text-align:left;font-family:"PingFang SC","Microsoft YaHei",system-ui,sans-serif}
button.codex-item{cursor:pointer}
button.codex-item:hover,button.codex-item:focus-visible{border-color:#ebc37f;background:#303747;outline:none}
.codex-item.unknown{background:#111923;color:#9ca2a7}
.codex-item-art{flex:none;display:grid;place-items:center;width:55px;height:55px;overflow:hidden}
.codex-item-art .surprise-image{width:53px;height:53px}
.codex-item-art .surprise-tile{transform:scale(.70);flex:none}
.codex-item.unknown .surprise-image{filter:brightness(0);opacity:.42;animation:none}
.codex-blank-tile{width:42px;height:45px;border:1px solid #615b51;border-radius:4px;background:#090f17;box-shadow:inset 0 0 0 1px #ffffff0a}
.codex-item-copy{display:flex;flex-direction:column;gap:3px;min-width:0}
.codex-item-copy strong{overflow:hidden;color:inherit;font-size:13px;line-height:1.25;text-overflow:ellipsis;white-space:nowrap}
.codex-item-copy span{font-size:11px;line-height:1.3;color:#bcbcb8}
.planet-menu button.codex-complete .planet-thumb{border-radius:50%;outline:2px solid #e4bf75;outline-offset:1px;filter:drop-shadow(0 0 5px #edc77eaa)}
.codex-celebration{position:fixed;z-index:1100;top:12%;left:50%;transform:translateX(-50%);padding:14px 28px;border:1px solid #f2d69b;border-radius:12px;background:#152333f5;color:#ffe9b2;box-shadow:0 0 45px #f6c56f88;font:600 27px Georgia,"Noto Serif SC",serif;white-space:nowrap;animation:codex-celebrate 6s ease-out both;pointer-events:auto}
@keyframes codex-celebrate{0%{opacity:0;transform:translate(-50%,15px) scale(.8)}18%,75%{opacity:1;transform:translate(-50%,0) scale(1)}100%{opacity:0;transform:translate(-50%,-12px) scale(1.03)}}
.codex-celebration{position:relative;top:auto;left:auto;transform:none;width:max-content;max-width:calc(100% - 24px);margin:-14px auto 12px;justify-content:center;flex-wrap:wrap;text-align:center;white-space:normal;animation:codex-share-celebrate 6s ease-out both}
@keyframes codex-share-celebrate{0%{opacity:0;transform:translateY(12px) scale(.95)}18%,75%{opacity:1;transform:none}100%{opacity:0;transform:translateY(-8px)}}
@media(max-width:700px){.codex-celebration{padding:10px 12px;font-size:20px}}
@media(max-width:700px){
 .codex-overlay{padding:8px}
 .codex-panel{max-height:calc(100dvh - 16px);border-radius:12px}
 .codex-top{padding:16px 16px 13px}
 .codex-title h2{font-size:24px}
 .codex-title p{font-size:11px;line-height:1.35}
 .codex-list{gap:11px;padding:12px}
 .codex-section{padding:8px}
 .codex-section-head{margin-bottom:7px}
 .codex-section-head img{width:34px;height:34px}
 .codex-section-head h3{font-size:15px}
 .codex-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 .codex-item{gap:5px;min-height:60px;padding:4px 5px}
 .codex-item-art{width:42px;height:45px}
 .codex-item-art .surprise-image{width:42px;height:42px}
 .codex-item-art .surprise-tile{transform:scale(.54)}
 .codex-blank-tile{width:33px;height:36px}
 .codex-item-copy strong{font-size:13px}
 .codex-item-copy span{font-size:11px}
 .codex-item-history{font-size:11px}
}
.fragment-poof{position:absolute;z-index:5;width:14px;height:14px;pointer-events:none;border-radius:50%;background:#fff9df;box-shadow:0 0 18px 10px #f3d39ecc;animation:fragment-poof-flash .4s ease-out both}
.fragment-poof i{position:absolute;left:50%;top:50%;width:7px;height:7px;border-radius:50%;background:#fff5d7;box-shadow:0 0 9px #fff1bb;animation:fragment-poof-spark .4s ease-out both;transform:rotate(var(--angle)) translateX(0)}
@keyframes fragment-poof-flash{0%{opacity:0;transform:translate(-50%,-50%) scale(.35)}25%{opacity:1;transform:translate(-50%,-50%) scale(1)}100%{opacity:0;transform:translate(-50%,-50%) scale(1.8)}}
@keyframes fragment-poof-spark{0%{opacity:1;transform:rotate(var(--angle)) translateX(4px) scale(1)}100%{opacity:0;transform:rotate(var(--angle)) translateX(49px) scale(.25)}}
@media(max-width:700px){
 .surprise-tray{top:72px;left:10px;min-width:0;width:140px;padding:6px 8px}
 .surprise-heading{font-size:9px;letter-spacing:1px}
 .surprise-count{font-size:13px}
 .surprise-slots{gap:5px;margin-top:4px}
 .surprise-slot{width:31px;height:33px}
 .surprise-card{max-width:min(200px,calc(100% - 16px));padding:8px 10px;font-size:12.5px}
 .surprise-card strong{font-size:14px}
 .surprise-card-symbol{font-size:11px}
 .surprise-card.surprise-near-note{padding:5px 7px;font-size:11px}
 .surprise-modal{padding:8px}
 .surprise-modal-panel{width:min(270px,100%);gap:8px;padding:8px}
 .surprise-modal-display{width:min(240px,100%);height:min(240px,48vh)}
 .surprise-modal-display .surprise-tile{width:min(210px,86%);height:min(225px,100%)}
 .surprise-modal-display .surprise-tile .surprise-atomic{top:11px;left:14px;font-size:18px}
 .surprise-modal-display .surprise-tile strong{font-size:83px}
 .surprise-modal-display .surprise-tile strong.surprise-formula{font-size:62px}
 .surprise-modal-display .surprise-tile .surprise-element{font-size:20px}
 .surprise-card.surprise-modal-card{max-width:100%;padding:10px 11px}
}
