/* Mr. Roo scene CSS: see the single positioning block at the end of this file. */
:root{--night:#142b32;--night2:#1e3d43;--sand:#f2e5c8;--paper:#fff8e9;--ink:#263238;--muted:#776d5c;--gold:#d6a64c;--gold2:#f0cf82;--red:#b94b42;--green:#477b58;--line:#d9c7a2;--shadow:0 18px 45px #09191d35;--radius:18px}
*{box-sizing:border-box}
html{background:var(--night)}
body{margin:0;min-height:100vh;background:radial-gradient(circle at 50% -20%,#35565a 0,#172f36 55%,#10252b 100%);color:var(--paper);font:15px/1.45 system-ui,-apple-system,Segoe UI,sans-serif}
button,select{font:inherit}
button{cursor:pointer;border:1px solid #cdb98f;border-radius:11px;background:#fff8e9;color:#29383b;padding:10px 14px;font-weight:700;transition:.16s transform,.16s filter,.16s border-color}
button:hover:not(:disabled){transform:translateY(-1px);filter:brightness(1.03);border-color:var(--gold)}
button:disabled{opacity:.42;cursor:not-allowed;filter:grayscale(.35)}
button.primary{background:linear-gradient(135deg,#e4bd69,#bd8434);border-color:#d5a24b;color:#2d261b}
button.dark{background:#24434a;color:#fff2d5;border-color:#49676b}
button.ghost{background:transparent;color:inherit;border-color:#698084}
button.danger{background:#8f3f37;color:#fff;border-color:#8f3f37}
.wrap{max-width:1260px;margin:0 auto;padding:22px 22px 40px}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:18px}
.brand{display:flex;align-items:center;gap:12px}
.brand-mark{width:46px;height:46px;border-radius:14px;background:linear-gradient(145deg,#f0d28c,#b98035);display:grid;place-items:center;color:#26383a;font-size:25px;box-shadow:0 7px 20px #0003}
.brand h1{font:800 19px/1.1 Georgia,serif;letter-spacing:.07em;margin:0}
.brand small{display:block;color:#c8c0a9;font-size:10px;letter-spacing:.2em;margin-top:4px}
.top-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.currency{background:#24434a;border:1px solid #49676b;padding:8px 13px;border-radius:999px;font-weight:800;color:#f4d48c}
.page{display:none}
.page.active{display:block;animation:appear .25s ease}
@keyframes appear{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.hero{display:grid;grid-template-columns:1.05fr .95fr;gap:20px;align-items:stretch}
.hero-copy,.hero-art,.panel{border:1px solid #456168;background:linear-gradient(145deg,#24434a,#1a353c);border-radius:var(--radius);box-shadow:var(--shadow)}
.hero-copy{padding:34px;display:flex;flex-direction:column;justify-content:center}
.eyebrow{color:var(--gold2);letter-spacing:.18em;text-transform:uppercase;font-size:11px;font-weight:800}
.hero h2{font:700 clamp(32px,4vw,54px)/1.03 Georgia,serif;margin:12px 0;color:#fff1d2}
.hero p{color:#d1d2c3;max-width:560px}
.hero-buttons{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}
.hero-art{min-height:340px;position:relative;overflow:hidden;background:linear-gradient(#e8b96c 0%,#eacb91 48%,#c38a4f 49%,#9b623b 100%);display:flex;align-items:end;justify-content:center}
.hero-art:before{content:"";position:absolute;inset:0;background:linear-gradient(0deg,#593b2c55,transparent 60%),radial-gradient(circle at 80% 20%,#fff7cf99 0 8%,transparent 8.5%)}
.hero-art svg{width:min(90%,540px);height:auto;position:relative;z-index:1;filter:drop-shadow(0 12px 12px #50301f55)}
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:18px 0}
.stat{background:#1d3940;border:1px solid #3d5c62;border-radius:14px;padding:12px 14px}
.stat small{display:block;color:#b8c6bd;font-size:11px;text-transform:uppercase;letter-spacing:.08em}
.stat strong{display:block;color:#f4d48c;font-size:21px;margin-top:3px}
.section-head{display:flex;align-items:end;justify-content:space-between;gap:12px;margin:24px 0 12px}
.section-head h3{margin:0;font:700 23px Georgia,serif;color:#fff0d0}
.section-head p{margin:3px 0 0;color:#b9c6bf;font-size:13px}
.levels{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.level-card{border:1px solid #516b6e;background:#1d3940;border-radius:15px;padding:16px;text-align:left;color:#fff1d2;min-height:124px}
.level-card strong{font:700 20px Georgia,serif;display:block}
.level-card span{display:block;color:#c1c7b7;font-size:12px;margin-top:5px}
.level-card em{display:block;color:#f0ca78;font-style:normal;font-size:12px;margin-top:9px}
.panel{padding:18px}
.panel.light{background:var(--paper);border-color:var(--line);color:var(--ink)}
.panel h3{font:700 21px Georgia,serif;margin:0 0 8px}
.muted{color:var(--muted)}
.tiny{font-size:12px}
.toolbar{display:flex;gap:8px;flex-wrap:wrap}
.game-top{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:12px}
.game-stats{display:flex;gap:8px;flex-wrap:wrap}
.pill{border:1px solid #49666b;background:#1c3940;border-radius:999px;padding:7px 12px;color:#f8e9c9;font-size:13px}
.pill b{color:#f0ca78}
.game-layout{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(280px,.85fr);gap:14px;align-items:start}
.stage{background:linear-gradient(180deg,#b67b43 0%,#6b432e 55%,#39271f 100%);border:2px solid #bd8745;border-radius:18px;overflow:hidden;position:relative;box-shadow:0 24px 65px #160d09a8,inset 0 0 0 4px #f0c47722;color:#2d312b}
.stage:before{content:"";position:absolute;inset:0;background:linear-gradient(0deg,#21140f88,transparent 44%,#ffd27a18);pointer-events:none;z-index:1}
.stage-top{position:relative;z-index:1;display:flex;justify-content:space-between;gap:10px;padding:14px 16px 0}
.category{background:#203f43;color:#f8e5b8;border-radius:999px;padding:6px 12px;font-size:11px;font-weight:900;letter-spacing:.1em;text-transform:uppercase}
.difficulty-tag{font-size:11px;font-weight:900;letter-spacing:.1em;color:#553d2a;background:#fff2d3b8;padding:6px 10px;border-radius:999px}
.stage.shake{animation:shake .35s}
@keyframes shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-5px)}75%{transform:translateX(5px)}}
.question-box{position:relative;z-index:1;margin:0 16px 15px;background:#fff8e9eF;border:1px solid #d9bd8c;border-radius:14px;padding:15px 17px;box-shadow:0 8px 18px #58371d22}
.question-label{font-size:10px;letter-spacing:.15em;text-transform:uppercase;color:#99713e;font-weight:900}
.question{font:700 clamp(18px,2.1vw,24px)/1.22 Georgia,serif;margin:6px 0 10px;color:#28383a}
.mystery{border-left:3px solid #c18b42;padding:6px 0 6px 11px;color:#6e5940;font:italic 15px/1.4 Georgia,serif}
.answer-panel{background:#fff8e9;border:1px solid #d8c49e;border-radius:16px;padding:16px;color:#29383b;margin-top:13px}
.answer-slots{display:flex;gap:5px;justify-content:center;flex-wrap:wrap;min-height:48px}
.slot{width:31px;height:39px;border-bottom:3px solid #a98a59;display:grid;place-items:center;font:800 22px Georgia,serif;color:#243c40}
.slot.space{width:16px;border:0}
.slot.punct{border:0;width:auto;min-width:8px}
.mistakes{display:flex;justify-content:center;gap:7px;margin:13px 0 2px}
.heart{font-size:18px;color:#b44d43;opacity:.25}
.heart.live{opacity:1}
.keyboard{display:grid;grid-template-columns:repeat(13,minmax(0,1fr));gap:5px;margin-top:13px}
.key{padding:9px 0;border-radius:8px;font-weight:900;font-size:14px;background:#f8ecd4;border:1px solid #d7c39d;color:#2c3939}
.key.correct{background:#4d805e;color:white;border-color:#4d805e}
.key.wrong{background:#a94a40;color:white;border-color:#a94a40}
.key.blocked{opacity:.25}
.side-stack{display:grid;gap:12px}
.side-panel{background:#1d3940;border:1px solid #456168;border-radius:16px;padding:15px}
.side-panel h3{font:700 18px Georgia,serif;color:#f5dfb1;margin:0 0 4px}
.side-panel p{font-size:12px;color:#bdc9bf;margin:0 0 10px}
.perk-list{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.perk-btn{min-height:76px;text-align:left;background:#27474d;color:#fff1d3;border:1px solid #4e6b6e;padding:9px;border-radius:11px;font-size:12px;line-height:1.25}
.perk-btn strong{display:block;font-size:12px}
.perk-btn small{display:block;color:#c2c9b9;font-size:10px;margin-top:4px}
.perk-btn .qty{float:right;color:#f1cf81}
.perk-btn.used{opacity:.35}
.perk-btn.active{border-color:#e9bf69;box-shadow:0 0 0 1px #e9bf69 inset}
.usage-note{font-size:11px!important;color:#e2c889!important;margin-top:9px!important}
.clue-reveal{background:#344e4f;border:1px solid #668080;border-radius:10px;padding:11px;color:#f7e8c8;font:italic 14px Georgia,serif;margin-top:10px}
.bottom-actions{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-top:12px}
.modal-backdrop{position:fixed;inset:0;background:#07191dcc;z-index:20;display:grid;place-items:center;padding:16px;overflow:auto}
.modal{width:min(760px,100%);max-height:92vh;overflow:auto;background:#fff8e9;color:#29383b;border:1px solid #d4bd90;border-radius:19px;box-shadow:0 25px 80px #0007;padding:22px;animation:appear .2s ease}
.modal h2{font:700 27px Georgia,serif;margin:0 0 5px}
.modal-sub{color:#7d705b;margin:0 0 16px;font-size:13px}
.modal-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.perk-card{border:1px solid #ddcba7;border-radius:13px;padding:12px;background:#fffdf6}
.perk-card strong{display:block;font:700 16px Georgia,serif}
.perk-card p{font-size:12px;color:#6d6252;margin:6px 0}
.rarity{font-size:10px;letter-spacing:.1em;text-transform:uppercase;font-weight:900;color:#99723b}
.price{font-weight:900;color:#916021}
.modal-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;margin-top:16px}
.shop-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.shop-item{background:#fffdf6;border:1px solid #ddcba7;border-radius:13px;padding:12px;display:flex;flex-direction:column;gap:6px}
.shop-item h4{font:700 15px Georgia,serif;margin:0}
.shop-item p{font-size:12px;color:#6f6657;margin:0;flex:1}
.shop-item .shop-foot{display:flex;align-items:center;justify-content:space-between;gap:8px}
.shop-item button{padding:7px 10px;font-size:12px}
.locked-note{font-size:10px;color:#9b5148;font-weight:800}
.inventory-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.inv-item{border:1px solid #ddcba7;border-radius:10px;padding:10px;background:#fffdf6}
.inv-item strong{display:block;font-size:13px}
.inv-item span{font-size:11px;color:#796e5b}
.result-banner{padding:14px;border-radius:13px;background:linear-gradient(135deg,#f3e0b5,#e8c985);text-align:center;margin:12px 0}
.result-banner h3{font:800 12px system-ui;letter-spacing:.2em;margin:0;color:#7e5423}
.result-answer{font:800 clamp(25px,4vw,40px) Georgia,serif;color:#243a3d;margin-top:5px;overflow-wrap:anywhere}
.reveal-content{display:grid;gap:10px}
.reveal-clue{padding:13px 15px;background:#f5eddc;border-left:4px solid #c28a3f;border-radius:9px;font:italic 15px/1.45 Georgia,serif;color:#5b503e}
.education{background:#f0eadb;border:1px solid #ddd0b3;border-radius:12px;padding:14px}
.education h4{font:800 11px system-ui;letter-spacing:.15em;text-transform:uppercase;color:#91652e;margin:0 0 7px}
.education p{margin:0;white-space:pre-wrap}
.references{display:flex;gap:8px;flex-wrap:wrap}
.references a{color:#77501d;font-weight:800;text-decoration:underline;background:#f1e3c5;border-radius:999px;padding:7px 11px;font-size:12px}
.toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:#10272d;color:#fff2d5;padding:11px 16px;border:1px solid #698184;border-radius:12px;z-index:50;box-shadow:var(--shadow);max-width:min(90vw,520px);text-align:center}
.footer-note{color:#aebdb4;text-align:center;font-size:11px;margin:24px 0 0}
@media(max-width:900px){
.hero{grid-template-columns:1fr}
.hero-art{min-height:260px}
.game-layout{grid-template-columns:1fr}
.side-stack{grid-template-columns:1fr 1fr}
.shop-grid{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:620px){
.wrap{padding:13px}
.topbar{align-items:flex-start}
.brand h1{font-size:15px}
.brand-mark{width:38px;height:38px}
.top-actions button{font-size:12px;padding:8px}
.stats{grid-template-columns:repeat(2,1fr)}
.levels{grid-template-columns:repeat(2,1fr)}
.hero-copy{padding:23px}
.hero-art{min-height:220px}
.game-top{align-items:flex-start;flex-direction:column}
.keyboard{grid-template-columns:repeat(7,minmax(0,1fr))}
.side-stack{grid-template-columns:1fr}
.perk-list{grid-template-columns:repeat(2,1fr)}
.modal-grid,.shop-grid,.inventory-grid{grid-template-columns:1fr}
.modal{padding:16px}
.slot{width:25px;height:34px;font-size:19px}
}
:root{--temple-ink:#2b2118;--temple-gold:#e6b85f;--temple-glow:#ffc85e}
#gamePage.active{position:fixed;inset:0;z-index:10;display:block!important;overflow-y:auto;overflow-x:hidden;padding:clamp(10px,2vw,26px);background:radial-gradient(ellipse at 50% 35%,#76502c 0%,#3d291b 48%,#171c1a 100%)}
#gamePage.active:before{content:"";position:fixed;inset:0;pointer-events:none;opacity:.32;background:radial-gradient(ellipse at 50% 25%,#ffc45a55,transparent 54%),linear-gradient(90deg,#120e0b66,transparent 18%,transparent 82%,#120e0b66);z-index:-1}
#gamePage .game-top{position:relative;z-index:3;max-width:1500px;margin:0 auto 10px;align-items:center}
#gamePage .game-top>button:first-child{background:#382719d9;border-color:#b78a4b;color:#ffe8b5}
#gamePage .game-stats{justify-content:flex-end}
#gamePage .game-layout{display:block;max-width:1500px;margin:0 auto}
#gamePage .game-layout>div:first-child{width:100%;min-width:0}
#gamePage .stage{min-height:clamp(390px,55vh,650px);border:3px solid #b98943;border-radius:20px;background:linear-gradient(180deg,#e7bd79 0%,#c68a4e 54%,#765039 55%,#49301f 100%);box-shadow:0 24px 70px #080604a8,inset 0 0 35px #3d210d66;overflow:hidden}
#gamePage .stage:before{background:radial-gradient(ellipse at 50% 44%,#fff0b355,transparent 48%),radial-gradient(circle at 50% 20%,#ffe3a7aa 0 5%,transparent 5.5%),linear-gradient(0deg,#2c180b55,transparent 50%)}
#gamePage .stage-top{padding:16px 18px 0}
#gamePage .question-box{max-width:1120px;margin:0 auto 18px;width:calc(100% - 34px);padding:clamp(15px,2vw,24px);border:2px solid #c79a55;border-radius:15px;background:linear-gradient(145deg,#fff5df,#e9d0a3);box-shadow:0 12px 30px #2a160b55,inset 0 1px #fff9e8}
#gamePage .question{font-size:clamp(20px,2.3vw,30px)}
#gamePage .answer-panel{max-width:1200px;margin:14px auto 0;padding:clamp(14px,2vw,24px);background:linear-gradient(145deg,#fff8e9,#e7d3ac);border:2px solid #c9a66e;box-shadow:0 18px 45px #08060477,inset 0 1px #fff}
#gamePage .answer-slots{min-height:54px;gap:7px}
#gamePage .slot{width:clamp(27px,3.2vw,43px);height:clamp(38px,4vw,52px);font-size:clamp(21px,2.3vw,30px);border-bottom:4px solid #a47b40;color:#24383b}
#gamePage .slot.space{width:clamp(12px,1.5vw,22px)}
#gamePage .mistakes{margin:13px 0 8px}
#gamePage .keyboard{max-width:1050px;margin:16px auto 0;gap:clamp(5px,.8vw,10px)}
#gamePage .key{min-height:clamp(43px,5vw,62px);border:2px solid #d0ad72;border-bottom-width:5px;border-radius:10px;background:linear-gradient(150deg,#fff1d2,#d8b77f);box-shadow:0 4px 9px #4a2c1244;color:#34291e;font-size:clamp(14px,1.4vw,19px)}
#gamePage .key:hover:not(:disabled){transform:translateY(-3px);box-shadow:0 7px 14px #4a2c1266}
#gamePage .key.correct{background:linear-gradient(145deg,#8bb88c,#396f4c);border-color:#b9df9c;color:white}
#gamePage .key.wrong{background:linear-gradient(145deg,#9b6754,#57372e);border-color:#b17a5d;color:#f0d4bd}
#gamePage .bottom-actions{max-width:1200px;margin:12px auto 0}
#gamePage .bottom-actions button{display:none}
#gamePage .side-stack{position:fixed;z-index:42;right:0;top:0;bottom:0;width:min(430px,92vw);padding:76px 18px 22px;background:linear-gradient(160deg,#3a291c 0%,#211b17 100%);border-left:3px solid #bd914e;box-shadow:-24px 0 65px #0009;display:grid;grid-auto-rows:max-content;gap:12px;overflow-y:auto;transform:translateX(105%);visibility:hidden;transition:transform .28s cubic-bezier(.2,.8,.2,1),visibility .28s}
#gamePage .side-stack.drawer-open{transform:translateX(0);visibility:visible}
#gamePage .side-panel{background:linear-gradient(145deg,#493522,#30251c);border:1px solid #96703e;border-radius:13px;box-shadow:inset 0 1px #ffffff16}
#gamePage .side-panel h3{color:#f7d995}
#gamePage .side-panel p{color:#e1cfaa}
#gamePage .perk-btn{background:linear-gradient(145deg,#60472c,#382b20);border-color:#9b7949;color:#fff0d0}
#gamePage .perk-btn small{color:#d9c7a5}
.drawer-scrim{position:fixed;inset:0;z-index:40;background:#080705a8;opacity:0;visibility:hidden;transition:opacity .25s,visibility .25s}
.drawer-scrim.visible{opacity:1;visibility:visible}
.drawer-toggle{display:inline-flex;align-items:center;gap:8px;background:linear-gradient(145deg,#e9c57d,#a97836)!important;color:#2d2115!important;border:1px solid #f3d99d!important;font-weight:900;box-shadow:0 5px 18px #0005}
.drawer-close{position:absolute;right:16px;top:16px;background:#63482b!important;color:#fff1d2!important;border-color:#b28a4f!important}
.drawer-shortcuts{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.drawer-shortcuts button{background:#5a4229;color:#fff0d0;border-color:#a27c49}
body.drawer-is-open{overflow:hidden}
body.drawer-is-open #gamePage .stats-drawer-tab{opacity:0;pointer-events:none}
@media(max-width:700px){
#gamePage.active{padding:8px}
#gamePage .game-top{align-items:stretch;flex-wrap:wrap}
#gamePage .game-top .game-stats{justify-content:flex-start;width:100%}
#gamePage .stage{min-height:390px}
#gamePage .keyboard{grid-template-columns:repeat(7,minmax(0,1fr))}
#gamePage .key{min-height:44px}
#gamePage .side-stack{width:min(390px,94vw);padding:68px 12px 16px}
#gamePage .perk-list{grid-template-columns:1fr 1fr}
}
@media(min-width:701px) and (max-height:760px){
#gamePage .stage{min-height:330px}
}
.stage-top{z-index:3}
.question-box{z-index:3;background:linear-gradient(135deg,#fff0cfef,#e8c58fee);border:2px solid #d6a75e;box-shadow:0 12px 30px #21140f66,inset 0 1px #fff8d8}
@media (min-width:701px){
#gamePage .game-layout{display:block;
    grid-template-columns:minmax(0,1fr);}
#gamePage .game-layout > :first-child{width:100%;
    min-width:0;}
}
#gamePage .stage{width:100%;
  min-width:0;}
@media (min-width:701px){
#gamePage .game-top{max-width:none;width:100%;}
#gamePage .game-layout{display:block;
    width:100%;
    max-width:none;
    margin:0;}
#gamePage .game-layout > div:first-child{width:100%;max-width:none;min-width:0;}
#gamePage .stage{width:100%;max-width:none;}
}
#gamePage .key{display:block;position:relative;min-width:0;aspect-ratio:1.08 / 1;
  padding:0 !important;border:0 !important;border-radius:0 !important;
  background:transparent !important;box-shadow:none !important;
  color:transparent !important;font-size:0 !important;line-height:0;
  filter:drop-shadow(0 3px 2px #28160755);}
#gamePage .key img{display:block;width:100%;height:100%;object-fit:contain;
  user-select:none;-webkit-user-drag:none;pointer-events:none;}
#gamePage .key:hover:not(:disabled){transform:translateY(-2px);filter:brightness(1.08) drop-shadow(0 5px 3px #28160766)}
#gamePage .key.correct img{filter:sepia(.2) hue-rotate(65deg) saturate(1.2) brightness(.88)}
#gamePage .key.wrong img{filter:grayscale(.65) brightness(.72)}
#gamePage .key:disabled{opacity:.48;filter:grayscale(.55) brightness(.82)}

/* =====================================================================
   MR. ROO + STONE DOOR SCENE  —  single positioning system
   ---------------------------------------------------------------------
   Coordinate space: the temple background's native pixels (1672 x 941).
   Every position below is written in those units and converted to % of
   the scene, so the background, both slabs and Mr. Roo scale together
   as one uniform stage. Nothing is positioned from the browser viewport.

   To re-tune the scene, edit ONLY the variables in section 1 (global),
   section 2 (slabs) and section 5 (per-mistake stages).
   ===================================================================== */

/* ---- 1. STAGE FRAME + GLOBAL ANCHORS ---------------------------------- */
#gamePage .stage{min-height:0;background:radial-gradient(ellipse at 50% 46%,#5b3a1d 0%,#2d1b0e 52%,#150d07 100%)}  /* letterbox bars when the viewport is wider than the 1672:941 scene */
#gamePage .scene{
  --W:1672;                 /* background width  (units = background px)      */
  --H:941;                  /* background height                              */
  --cx:836;                 /* horizontal centre of the doorway opening       */
  --floor:650;              /* ONE floor baseline: slab bottoms + Roo's feet  */
  --roo-stature:432;        /* Stage 11: +8% visual scale; standing height, hat to boots */
  --contact-ov:3;           /* how far a palm presses into a slab face, units */
  --gap:280;                /* half-width between slab faces (open = idle)    */
  --step-time:.3s;          /* door travel time for mistakes 1-5              */
  --close-time:.82s;        /* final slam; Roo6 stays visible in foreground   */

  --scene-max-h:clamp(250px,58vh,660px);   /* tallest the scene may get       */
  position:relative;z-index:2;isolation:isolate;overflow:hidden;
  width:min(100%,calc(var(--scene-max-h) * 1672 / 941));   /* letterbox, never stretch */
  aspect-ratio:1672 / 941;height:auto;margin:0 auto;
  background:#4b2d19;
}
#gamePage .temple-backdrop{position:absolute;inset:0;z-index:0;overflow:hidden}
#gamePage .temple-backdrop img{display:block;width:100%;height:100%;object-fit:cover}
#gamePage .scene:after{content:"";position:absolute;inset:0;z-index:1;pointer-events:none;
  background:linear-gradient(0deg,#28170d55,transparent 40%,#ffd47a10)}
#gamePage .roo-stage{position:absolute;inset:0;z-index:2}

/* ---- 2. DOOR SLABS ----------------------------------------------------
   Native aspect ratios are preserved (width set, height:auto). The opening
   is controlled ONLY by moving the slabs horizontally via --gap.
   Visible (non-transparent) edges, in source pixels:
     slab_left.webp  788x708 : inner edge x=780, bottom y=701
     slab_right.webp 789x709 : inner edge x=8,   bottom y=702               */
#gamePage .roo-stage .slab{
  --slab-k:.72;             /* units per slab pixel -> visible height ~500 */
  position:absolute;z-index:2;height:auto;max-width:none;
  user-select:none;-webkit-user-drag:none;pointer-events:none;
  filter:drop-shadow(0 10px 9px #160d08b8);
  transition:left var(--step-time) cubic-bezier(.22,.78,.22,1);
}
#gamePage .roo-stage .slab.left{
  width:calc(788 * var(--slab-k) * 100% / var(--W));
  left:calc((var(--cx) - var(--gap) - 780 * var(--slab-k)) * 100% / var(--W));
  top:calc((var(--floor) - 701 * var(--slab-k)) * 100% / var(--H));
}
#gamePage .roo-stage .slab.right{
  width:calc(789 * var(--slab-k) * 100% / var(--W));
  left:calc((var(--cx) + var(--gap) - 8 * var(--slab-k)) * 100% / var(--W));
  top:calc((var(--floor) - 702 * var(--slab-k)) * 100% / var(--H));
}
#gamePage .scene[data-mistakes="6"] .roo-stage .slab{transition-duration:var(--close-time)}

/* ---- 3. MR. ROO — shared anchor model ---------------------------------
   Every Roo image is placed by three numbers measured from its PNG:
     --p-ax  x of his stance centre (midpoint of the two boots), source px
     --p-fy  y of the floor line under his boots, source px
     --k     units per source pixel (keeps one body scale; no stretching)
   Width is set and height is auto, so the PNG aspect ratio is never altered.
   The stance centre sits at --cx + --p-dx, and the boots rest on --floor.  */
#gamePage .roo-stage .roo-idle,
#gamePage .roo-stage .roo-pose{
  position:absolute;height:auto;max-width:none;z-index:4;
  user-select:none;-webkit-user-drag:none;pointer-events:none;
  filter:drop-shadow(0 10px 9px #160d08b8);
}
#gamePage .roo-stage .roo-idle{
  --k:calc(var(--roo-stature) / 1476);     /* idle figure is 1476 px tall    */
  width:calc(1024 * var(--k) * 100% / var(--W));
  left:calc((var(--cx) - 544 * var(--k)) * 100% / var(--W));   /* ax = 544  */
  top:calc((var(--floor) - 1488 * var(--k)) * 100% / var(--H)); /* fy = 1488 */
}
/* Pose PNGs share one 1400x1200 canvas. */
#gamePage .scene{--p-k:calc(var(--roo-stature) / 1073 * var(--p-mult,1))}
#gamePage .roo-stage .roo-pose{
  /* Palm contact: his right palm presses --contact-ov into the right slab.
     (For poses with two raised/outstretched hands the stage's --gap is
      derived so the left palm lands on the left slab in the same way.)   */
  --p-dx:var(--p-dx-override,calc(var(--gap) + var(--contact-ov) - (var(--p-hr) - var(--p-ax)) * var(--p-k)));
  width:calc(1400 * var(--p-k) * 100% / var(--W));
  left:calc((var(--cx) + var(--p-dx) - var(--p-ax) * var(--p-k)) * 100% / var(--W));
  top:calc((var(--floor) - var(--p-fy) * var(--p-k)) * 100% / var(--H));
}

/* ---- 4. (reserved) ---------------------------------------------------- */

/* ---- 5. PER-MISTAKE STAGES --------------------------------------------
   data-mistakes is written by game.js (drawGame / guess).
   --gap     half-opening between slab faces at this stage
   --p-mult  small pose-specific scale trim (lunging poses are art-scaled
             larger than a standing Roo; 1 = same body scale as Idle/Roo6)
   --p-ax / --p-fy / --p-hr / --p-hl  measured from the PNG (source px):
             stance centre, floor line, right-palm x, left-palm x         */
#gamePage .scene[data-mistakes="0"]{--gap:280}

/* Mistakes 1-3: Roo braces his right hand against the RIGHT slab. */
#gamePage .scene[data-mistakes="1"]{--gap:250;--p-mult:.93;--p-ax:711;--p-fy:1143;--p-hr:1253}
#gamePage .scene[data-mistakes="2"]{--gap:228;--p-mult:.93;--p-ax:617;--p-fy:1141;--p-hr:1288}
#gamePage .scene[data-mistakes="3"]{--gap:210;--p-mult:.93;--p-ax:652;--p-fy:1152;--p-hr:1266}

/* Mistake 4: one palm on each slab — gap follows the arm span. */
#gamePage .scene[data-mistakes="4"]{
  --p-mult:.93;--p-ax:675;--p-fy:1150;--p-hr:1304;--p-hl:210;
  --gap:calc((var(--p-hr) - var(--p-hl)) / 2 * var(--p-k) - var(--contact-ov));
}
/* Mistake 5: palms raised beside his head, slabs close on his body. */
#gamePage .scene[data-mistakes="5"]{
  --p-mult:1;--p-ax:703;--p-fy:1135;--p-hr:990;--p-hl:481;
  --gap:calc((var(--p-hr) - var(--p-hl)) / 2 * var(--p-k) - var(--contact-ov));
}
/* Mistake 6: doors slam shut behind Roo6, who remains visible in front. */
#gamePage .scene[data-mistakes="6"]{
  --gap:0;--p-mult:1;--p-ax:740;--p-fy:1153;--p-dx-override:0;
}


/* ---- STAGE 12: TRANSPARENT GAMEPLAY FOREGROUND OVERLAY -----------------
   Decorative frame artwork sits above the temple, slabs, and Roo.
   Its transparent centre keeps all gameplay artwork visible. The asset is
   1671x941 and is contained within the 1672x941 scene without distortion. */
#gamePage .scene > .gameplay-overlay{
  position:absolute;
  inset:0;
  z-index:5;
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  object-position:center;
  pointer-events:none;
  user-select:none;
  -webkit-user-drag:none;
}


/* ---- STAGE 13: THREE-ROW FLOOR KEYBOARD -------------------------------
   The existing A-Z PNG buttons are arranged on the temple floor.
   Answer slots and mistake hearts stay directly above the keyboard.
   Button IDs and data-letter behavior are unchanged for game.js. */
#gamePage .scene{position:relative;isolation:isolate;overflow:hidden}
#gamePage .floor-game-hud{
  position:absolute;
  left:16%;
  right:16%;
  bottom:2.4%;
  z-index:7;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:clamp(1px,.35vw,5px);
  pointer-events:none;
}
#gamePage .floor-game-hud .answer-slots,
#gamePage .floor-game-hud .mistakes,
#gamePage .floor-game-hud .keyboard{pointer-events:auto}
#gamePage .floor-game-hud .answer-slots{
  min-height:clamp(20px,3.8vw,42px);
  width:100%;
  gap:clamp(2px,.35vw,6px);
  align-items:end;
}
#gamePage .floor-game-hud .slot{
  width:clamp(13px,2.1vw,29px);
  height:clamp(18px,3vw,35px);
  border-bottom-width:2px;
  font-size:clamp(12px,1.8vw,21px);
  color:#f7e5bd;
  text-shadow:0 2px 3px #2b1608,0 0 5px #2b1608;
  border-color:#e4b96c;
}
#gamePage .floor-game-hud .slot.space{width:clamp(7px,1vw,14px)}
#gamePage .floor-game-hud .mistakes{
  width:100%;
  margin:0;
  gap:clamp(2px,.35vw,5px);
  justify-content:center;
}
#gamePage .floor-game-hud .heart{
  font-size:clamp(8px,1vw,12px);
  color:#ffcf73;
  text-shadow:0 1px 3px #281506;
}
#gamePage .floor-game-hud .keyboard{
  width:100%;
  display:grid;
  grid-template-columns:repeat(10,minmax(0,1fr));
  gap:clamp(1px,.25vw,4px) clamp(2px,.45vw,7px);
  margin:0;
  align-items:center;
  justify-items:center;
}
#gamePage .floor-game-hud .key{
  width:100%;
  max-width:clamp(25px,5.1vw,62px);
  aspect-ratio:1.08 / 1;
  min-height:0;
}
#gamePage .floor-game-hud .key:nth-child(21){grid-column:3;grid-row:3}
#gamePage .floor-game-hud .key:nth-child(22){grid-column:4;grid-row:3}
#gamePage .floor-game-hud .key:nth-child(23){grid-column:5;grid-row:3}
#gamePage .floor-game-hud .key:nth-child(24){grid-column:6;grid-row:3}
#gamePage .floor-game-hud .key:nth-child(25){grid-column:7;grid-row:3}
#gamePage .floor-game-hud .key:nth-child(26){grid-column:8;grid-row:3}
#gamePage .floor-game-hud .key:hover:not(:disabled){transform:translateY(-2px)}
#gamePage .floor-game-hud .key:disabled{opacity:.55}
#gamePage .answer-panel{display:none!important}
@media(max-width:700px){
  #gamePage .floor-game-hud{left:13%;right:13%;bottom:2.1%;gap:2px}
  #gamePage .floor-game-hud .keyboard{gap:1px 2px}
  #gamePage .floor-game-hud .key{max-width:clamp(20px,6vw,38px)}
}


/* ---- STAGE 14: DEDICATED PUZZLE INFORMATION PANELS ---------------------
   Question/category/clues occupy the top parchment. Answer slots sit on
   their own stone plaque above Roo. Mistake hearts live in the overlay's
   upper-right board. The keyboard remains on the temple floor. */
#gamePage .stage-top{display:none!important}
#gamePage .scene{position:relative;isolation:isolate;overflow:hidden}
#gamePage .top-info-banner{
  position:absolute;
  z-index:8;
  top:1.2%;
  left:24%;
  width:52%;
  aspect-ratio:808 / 157;
  pointer-events:none;
}
#gamePage .top-info-banner > img{
  position:absolute;inset:0;width:100%;height:100%;object-fit:contain;
}
#gamePage .top-info-copy{
  position:absolute;
  inset:14% 7% 13%;
  display:flex;flex-direction:column;justify-content:center;
  gap:2px;text-align:center;overflow:hidden;
  color:#39210d;text-shadow:0 1px 0 #fff0c8;
}
#gamePage .top-info-meta{
  display:flex;align-items:center;justify-content:center;gap:8px;
  min-height:12px;line-height:1;
}
#gamePage .top-info-meta .category{
  display:inline-block;background:#69431f;color:#fff0c9;
  border-radius:999px;padding:2px 7px;font-size:clamp(6px,.55vw,9px);
  font-weight:900;letter-spacing:.08em;text-transform:uppercase;
}
#gamePage .top-info-meta .difficulty-tag{
  display:inline-block;color:#70451d;font-size:clamp(5px,.48vw,8px);
  font-weight:900;letter-spacing:.07em;text-transform:uppercase;
}
#gamePage .top-info-copy .question{
  margin:0;font:700 clamp(8px,.95vw,15px)/1.12 Georgia,serif;
  color:#3b240f;overflow:hidden;
}
#gamePage .top-info-copy .mystery{
  border:0;padding:0;margin:0;
  font:italic clamp(6px,.66vw,10px)/1.15 Georgia,serif;
  color:#63451f;overflow:hidden;
}
#gamePage .top-info-copy .clue-reveal{
  font:italic clamp(6px,.62vw,9px)/1.12 Georgia,serif;
  color:#5a3617;overflow:hidden;
}
#gamePage .answer-plaque{
  position:absolute;z-index:8;
  top:19%;left:50%;transform:translateX(-50%);
  width:32%;aspect-ratio:2048 / 260;
  display:grid;place-items:center;pointer-events:none;
}
#gamePage .answer-plaque > img{
  position:absolute;inset:0;width:100%;height:100%;object-fit:fill;
}
#gamePage .answer-plaque .answer-slots{
  position:absolute;inset:16% 7% 17%;
  display:flex;align-items:center;justify-content:center;flex-wrap:nowrap;
  gap:clamp(1px,.16vw,3px);min-height:0;width:86%;margin:auto;
  overflow:hidden;pointer-events:auto;
}
#gamePage .answer-plaque .slot{
  flex:0 1 auto;width:clamp(8px,1.45vw,21px);
  min-width:0;height:100%;max-height:36px;
  border-bottom:2px solid #f3c36b;color:#fff0c9;
  font:800 clamp(8px,1.05vw,15px)/1 Georgia,serif;
  text-shadow:0 2px 3px #281303,0 0 4px #281303;
}
#gamePage .answer-plaque .slot.space{width:clamp(3px,.5vw,8px);border:0;flex:0 0 auto}
#gamePage .answer-plaque .slot.punct{border:0;width:auto;min-width:4px}
#gamePage .scene > #mistakeDots{
  position:absolute;z-index:9;
  top:7.5%;right:4.3%;width:17.5%;
  min-height:3.2%;margin:0;padding:0;
  display:flex;align-items:center;justify-content:center;
  gap:clamp(2px,.35vw,6px);pointer-events:none;
}
#gamePage .scene > #mistakeDots .heart{
  font-size:clamp(7px,.9vw,13px);line-height:1;
  color:#ffcb58;text-shadow:0 1px 3px #2a1003;
}
#gamePage .floor-game-hud{
  position:absolute;z-index:9;left:16%;right:16%;bottom:2.4%;
  display:flex;flex-direction:column;align-items:center;
  pointer-events:none;
}
#gamePage .floor-game-hud .keyboard{pointer-events:auto}
#gamePage .floor-game-hud .keyboard{
  width:100%;display:grid;grid-template-columns:repeat(10,minmax(0,1fr));
  gap:clamp(1px,.25vw,4px) clamp(2px,.45vw,7px);
  margin:0;align-items:center;justify-items:center;
}
@media(max-width:700px){
  #gamePage .top-info-banner{left:23%;width:54%;top:1.5%}
  #gamePage .top-info-copy{inset:13% 6% 12%;gap:1px}
  #gamePage .top-info-meta{gap:3px;min-height:8px}
  #gamePage .top-info-meta .category{padding:1px 4px;font-size:5px}
  #gamePage .top-info-meta .difficulty-tag{font-size:4.5px}
  #gamePage .top-info-copy .question{font-size:clamp(6px,1.35vw,9px)}
  #gamePage .top-info-copy .mystery,
  #gamePage .top-info-copy .clue-reveal{font-size:clamp(5px,1vw,7px)}
  #gamePage .answer-plaque{top:19%;width:36%}
  #gamePage .answer-plaque .slot{width:clamp(6px,1.7vw,11px);font-size:clamp(6px,1.2vw,8px)}
  #gamePage .scene > #mistakeDots{right:4%;width:18%;top:7.7%}
  #gamePage .floor-game-hud{left:12%;right:12%;bottom:2.2%}
}


/* =====================================================================
   STAGE 15 — REVISED GAMEPLAY HIERARCHY (based on user's reference)
   Top parchment: category + question + mystery/perk clue.
   Roo remains the centrepiece.
   Answer plaque: directly below Roo, above the alphabet.
   Alphabet: three compact rows at the bottom.
   Mistake hearts: larger, directly UNDER the "Mistakes" heading.
   All coordinates are relative to the fixed-ratio .scene.
   ===================================================================== */
#gamePage .scene{
  container-type:inline-size;
}

/* Keep the question copy within the overlay's existing top parchment.
   Do not enlarge the artwork beyond the parchment's frame. */
#gamePage .top-info-banner{
  top:1.3%;
  left:23%;
  width:54%;
  aspect-ratio:808 / 157;
}
#gamePage .top-info-copy{
  inset:13% 7% 12%;
  gap:clamp(2px,.35cqw,5px);
}
#gamePage .top-info-meta{gap:clamp(5px,.8cqw,12px);min-height:0}
#gamePage .top-info-meta .category{
  padding:clamp(2px,.25cqw,4px) clamp(6px,.7cqw,10px);
  font-size:clamp(8px,1.05cqw,14px);
}
#gamePage .top-info-meta .difficulty-tag{
  font-size:clamp(7px,.82cqw,11px);
}
#gamePage .top-info-copy .question{
  font-size:clamp(11px,1.65cqw,22px);
  line-height:1.12;
}
#gamePage .top-info-copy .mystery,
#gamePage .top-info-copy .clue-reveal{
  font-size:clamp(9px,1.15cqw,15px);
  line-height:1.12;
}

/* The answer plaque belongs at Roo's feet, not beneath the top banner. */
#gamePage .answer-plaque{
  top:62%;
  left:50%;
  width:60%;
  aspect-ratio:2048 / 260;
  z-index:10;
}
#gamePage .answer-plaque .answer-slots{
  inset:16% 7% 16%;
  width:88%;
  gap:clamp(1px,.22cqw,4px);
}
#gamePage .answer-plaque .slot{
  width:clamp(10px,2.15cqw,27px);
  max-height:80%;
  font-size:clamp(10px,1.65cqw,21px);
  border-bottom-width:2px;
}
#gamePage .answer-plaque .slot.space{width:clamp(4px,.75cqw,10px)}

/* Hearts are centred below the word MISTAKES inside its wooden holder. */
#gamePage .scene > #mistakeDots{
  top:13.4%;
  right:3.3%;
  width:19.5%;
  min-height:4.2%;
  gap:clamp(4px,.7cqw,10px);
  justify-content:center;
  z-index:11;
}
#gamePage .scene > #mistakeDots .heart{
  font-size:clamp(12px,2.05cqw,27px);
  line-height:1;
}

/* Keep the 26 existing clickable PNG buttons in three compact floor rows.
   The 10 / 10 / 6 grid is preserved; only their footprint is tuned. */
#gamePage .floor-game-hud{
  left:11%;
  right:11%;
  bottom:1.5%;
  z-index:10;
}
#gamePage .floor-game-hud .keyboard{
  width:100%;
  grid-template-columns:repeat(10,minmax(0,1fr));
  gap:clamp(1px,.3cqw,4px) clamp(2px,.45cqw,7px);
}
#gamePage .floor-game-hud .key{
  width:100%;
  max-width:clamp(25px,4.2cqw,50px);
  aspect-ratio:1.08 / 1;
}
#gamePage .floor-game-hud .key:nth-child(21){grid-column:3;grid-row:3}
#gamePage .floor-game-hud .key:nth-child(22){grid-column:4;grid-row:3}
#gamePage .floor-game-hud .key:nth-child(23){grid-column:5;grid-row:3}
#gamePage .floor-game-hud .key:nth-child(24){grid-column:6;grid-row:3}
#gamePage .floor-game-hud .key:nth-child(25){grid-column:7;grid-row:3}
#gamePage .floor-game-hud .key:nth-child(26){grid-column:8;grid-row:3}

@media(max-width:700px){
  #gamePage .top-info-banner{left:21%;width:58%;top:1.5%}
  #gamePage .top-info-copy{inset:13% 6% 12%;gap:1px}
  #gamePage .top-info-copy .question{font-size:clamp(9px,1.8cqw,13px)}
  #gamePage .top-info-copy .mystery,
  #gamePage .top-info-copy .clue-reveal{font-size:clamp(7px,1.35cqw,10px)}
  #gamePage .answer-plaque{top:62%;width:64%}
  #gamePage .scene > #mistakeDots{top:13.6%;right:3%;width:20%}
  #gamePage .floor-game-hud{left:8%;right:8%;bottom:1.3%}
  #gamePage .floor-game-hud .key{max-width:clamp(22px,4.2cqw,34px)}
}

/* Stage 16 — Perks of Wisdom dedicated owned during-game perk collection */
.wisdom-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:8px}
.wisdom-heading h2{margin:0 0 4px}
.wisdom-heading .modal-sub{margin:0}
.wisdom-count{white-space:nowrap;font-size:11px;font-weight:800;color:#88612c;background:#f3e4c4;border:1px solid #d9bf8c;border-radius:999px;padding:7px 10px}
.wisdom-filters{display:flex;gap:7px;flex-wrap:wrap;margin:13px 0}
.wisdom-filter{background:#f6ecd8;border:1px solid #d9c49a;color:#66543a;border-radius:999px;padding:7px 12px;font-size:11px;font-weight:800}
.wisdom-filter.active{background:#29484b;color:#fff1d2;border-color:#29484b}
.wisdom-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.wisdom-card{display:flex;align-items:center;gap:9px;min-width:0;min-height:91px;text-align:left;padding:8px;background:#fffdf6;border:1px solid #ddc79b;border-radius:12px;color:#29383b;box-shadow:0 2px 4px #6e512015;transition:border-color .15s,transform .15s,box-shadow .15s}
.wisdom-card:hover,.wisdom-card.selected{border-color:#bd8734;box-shadow:0 0 0 2px #dfbd77 inset;transform:translateY(-1px)}
.wisdom-icon-wrap{width:66px;height:66px;flex:0 0 66px;display:grid;place-items:center;background:radial-gradient(circle,#f8e9c8 0,#f0dfbd 68%,#ead5ac 100%);border-radius:10px;overflow:hidden}
.wisdom-icon-wrap img{width:100%;height:100%;object-fit:contain}
.wisdom-card-copy{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0}
.wisdom-card-copy strong{font:700 13px/1.12 Georgia,serif;overflow-wrap:anywhere}
.wisdom-card-copy small{font-size:10px;color:#76684f}
.rarity-tag{display:inline-block;padding:3px 8px;border-radius:999px;color:white;font-size:9px;line-height:1.2;font-weight:900;letter-spacing:.03em;background:#8a8175}
.rarity-tag.common{background:#858078}.rarity-tag.rare{background:#2475b9}.rarity-tag.epic{background:#8543a5}.rarity-tag.legendary{background:#b77a13}
.wisdom-detail{display:flex;align-items:center;gap:14px;margin-top:13px;padding:12px;background:#f7ecd5;border:1px solid #d9c49a;border-radius:13px}
.wisdom-detail img{width:88px;height:88px;object-fit:contain;flex:0 0 88px}
.wisdom-detail h3{font:700 18px Georgia,serif;margin:5px 0}
.wisdom-detail p{font-size:12px;line-height:1.45;color:#665b49;margin:0 0 6px}
.wisdom-detail small{font-size:10px;color:#806c4c}
.wisdom-empty{grid-column:1/-1;padding:22px;text-align:center;color:#82745d;background:#fffdf6;border:1px dashed #d9c49a;border-radius:12px}
@media(max-width:620px){.wisdom-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.wisdom-card{min-height:80px;padding:6px;gap:6px}.wisdom-icon-wrap{width:54px;height:54px;flex-basis:54px}.wisdom-card-copy strong{font-size:11px}.wisdom-heading{display:block}.wisdom-count{display:inline-block;margin-top:7px}}
@media(max-width:390px){.wisdom-grid{grid-template-columns:1fr}.wisdom-card{min-height:74px}.wisdom-icon-wrap{width:58px;height:58px;flex-basis:58px}}

/* Stage 17: dedicated gameplay perk launcher and separate activation panel */
#gamePage .bottom-actions{align-items:center;}
#gamePage .bottom-actions .use-perk-launch{display:inline-flex!important;align-items:center;justify-content:center;gap:8px;margin-left:auto;padding:11px 18px;border:1px solid #e7c77f;border-radius:12px;background:linear-gradient(145deg,#f1d18e,#a97836);color:#342516;font-weight:900;letter-spacing:.04em;box-shadow:0 4px 14px #0004;cursor:pointer;}
#gamePage .bottom-actions .use-perk-launch:hover{filter:brightness(1.08);transform:translateY(-1px)}
.use-perk-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;max-height:48vh;overflow:auto;padding:2px}
.use-perk-card{display:flex;align-items:center;gap:10px;min-width:0;text-align:left;padding:9px;border:1px solid #ddc79b;border-radius:12px;background:#fffdf6;color:#29383b;cursor:pointer;}
.use-perk-card img{width:58px;height:58px;flex:0 0 58px;object-fit:contain;background:#f3e4c5;border-radius:9px}
.use-perk-card span{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0}
.use-perk-card strong{font:700 13px/1.15 Georgia,serif}
.use-perk-card small{font-size:10px;color:#76684f}
.use-perk-card.selected{border:2px solid #bd8734;box-shadow:0 0 0 2px #dfbd77 inset}
.use-perk-card.unavailable{opacity:.55;cursor:not-allowed;background:#f1eadc}
.use-perk-card .unavailable-note{color:#965b36;font-style:italic}
.use-perk-confirm{display:flex;align-items:center;gap:14px;padding:12px;border:1px solid #ddc79b;border-radius:12px;background:#fffdf6;margin:12px 0}
.use-perk-confirm img{width:82px;height:82px;object-fit:contain;flex:0 0 82px}
.use-perk-confirm h3{font:700 18px Georgia,serif;margin:0 0 5px}
.use-perk-confirm p{font-size:12px;color:#665b49;margin:0 0 6px}
.use-perk-confirm small{font-size:10px;color:#806c4c}
@media(max-width:560px){.use-perk-grid{grid-template-columns:1fr}.use-perk-card{min-height:76px}#gamePage .bottom-actions .use-perk-launch{padding:9px 12px;font-size:11px}}

/* STAGE 19 — gameplay scene refinements (based on the supplied Stage 18 ZIP) */
#gamePage .scene .top-info-banner{
  top:0%;
  left:22%;
  width:56%;
  height:26.4%; /* Stage 23: 20% taller than the previous 22% parchment */
  aspect-ratio:auto;
}
#gamePage .scene .top-info-banner > img{object-fit:fill}
#gamePage .scene .top-info-copy{
  inset:16% 7% 14%;
  gap:clamp(2px,.32cqw,5px);
}
#gamePage .scene .top-info-meta{gap:0;min-height:0}
#gamePage .scene .top-info-meta .category{
  padding:clamp(2px,.24cqw,4px) clamp(7px,.72cqw,11px);
  font-size:clamp(8px,1.02cqw,14px);
}
#gamePage .scene .top-info-copy .question{
  font-size:clamp(12px,1.8cqw,25px);
  line-height:1.1;
}
#gamePage .scene .top-info-copy .mystery,
#gamePage .scene .top-info-copy .clue-reveal{
  font-size:clamp(9px,1.12cqw,15px);
  line-height:1.1;
}
/* Difficulty is no longer inside the question parchment. */
#gamePage .scene .scene-difficulty{
  position:absolute;z-index:12;left:3.2%;top:16.2%;
  display:inline-flex;align-items:center;justify-content:center;
  padding:clamp(3px,.38cqw,6px) clamp(7px,.8cqw,12px);
  border:1px solid #d8a34b;border-radius:999px;
  background:linear-gradient(145deg,#ffe6ad,#c58a35);
  color:#4a2c12;font-size:clamp(7px,.85cqw,12px);
  font-weight:900;letter-spacing:.07em;text-transform:uppercase;
  box-shadow:0 2px 5px #1b0e0877;
}
/* Hearts sit in one contained row in the lower portion of the Mistakes plaque. */
#gamePage .scene > #mistakeDots{
  top:9.2%;right:3.2%;width:17.2%;height:4.2%;min-height:0;
  padding:0;box-sizing:border-box;overflow:hidden;
  display:flex;align-items:center;justify-content:center;
  gap:clamp(2px,.42cqw,7px);
}
#gamePage .scene > #mistakeDots .heart{
  display:block;flex:0 1 auto;min-width:0;margin:0;padding:0;
  font-size:clamp(11px,1.65cqw,22px);line-height:1;
}
/* Place the existing functional perk launcher in the left letterbox beside the jar.
   It stays attached to the stage and does not alter the scene's aspect ratio. */
#gamePage .stage{--stage-scene-width:min(100%,calc(clamp(250px,58vh,660px) * 1672 / 941));}
#gamePage .scene-perk-launch{
  position:absolute;z-index:20;left:max(8px,calc(50% - var(--stage-scene-width) / 2 - 56px));
  top:76%;width:46px;height:46px;padding:0;margin:0;
  display:flex!important;align-items:center;justify-content:center;
  border:2px solid #e7c77f;border-radius:50%;
  background:linear-gradient(145deg,#f1d18e,#a97836);color:#342516;
  font-size:21px;font-weight:900;line-height:1;
  box-shadow:0 4px 14px #0007;cursor:pointer;
}
#gamePage .scene-perk-launch:hover{filter:brightness(1.1);transform:translateY(-1px)}
#gamePage .scene-perk-launch:disabled{opacity:.5;cursor:not-allowed}
@media(max-width:700px){
  #gamePage .scene .top-info-banner{left:20%;width:60%;top:0%;height:26.4%;aspect-ratio:auto}
  #gamePage .scene .top-info-copy{inset:16% 6% 14%;gap:1px}
  #gamePage .scene .top-info-copy .question{font-size:clamp(9px,1.85cqw,14px)}
  #gamePage .scene .top-info-copy .mystery,
  #gamePage .scene .top-info-copy .clue-reveal{font-size:clamp(7px,1.25cqw,10px)}
  #gamePage .scene .scene-difficulty{left:2%;top:16.5%;font-size:clamp(6px,1cqw,9px)}
  #gamePage .scene > #mistakeDots{top:9.6%;right:3%;width:18%;height:4.1%;gap:clamp(1px,.35cqw,4px)}
  #gamePage .scene > #mistakeDots .heart{font-size:clamp(9px,1.55cqw,14px)}
  #gamePage .scene-perk-launch{left:8px;top:76%;width:38px;height:38px;font-size:18px}
}


/* STAGE 24 — Perk launcher uses a matching sandstone tile.
   It occupies the first slot of row three; U–Z remain in columns 2–7. */
#gamePage .floor-game-hud .keyboard{
  grid-template-columns:repeat(10,minmax(0,1fr));
}
#gamePage .floor-game-hud .keyboard > .key:nth-child(21){grid-column:2;grid-row:3}
#gamePage .floor-game-hud .keyboard > .key:nth-child(22){grid-column:3;grid-row:3}
#gamePage .floor-game-hud .keyboard > .key:nth-child(23){grid-column:4;grid-row:3}
#gamePage .floor-game-hud .keyboard > .key:nth-child(24){grid-column:5;grid-row:3}
#gamePage .floor-game-hud .keyboard > .key:nth-child(25){grid-column:6;grid-row:3}
#gamePage .floor-game-hud .keyboard > .key:nth-child(26){grid-column:7;grid-row:3}
#gamePage .floor-game-hud .keyboard > .perk-key{
  grid-column:1;grid-row:3;
  max-width:100%;
}
#gamePage .floor-game-hud .perk-key img{width:100%;height:100%;object-fit:contain}
#gamePage .floor-game-hud .perk-key:hover:not(:disabled){
  transform:translateY(-2px);filter:brightness(1.08) drop-shadow(0 5px 3px #28160766);
}
#gamePage .floor-game-hud .perk-key:disabled{opacity:.48;filter:grayscale(.55) brightness(.82)}
@media(max-width:700px){
  #gamePage .floor-game-hud .perk-key{max-width:100%}
}


/* STAGE 25: User-supplied wide sandstone USE A PERK artwork.
   Stage 26 below tunes its height to match the alphabet row. */
#gamePage .floor-game-hud .keyboard > .perk-key {
  grid-column: 1 / span 2 !important;
  grid-row: 3 !important;
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  align-self: stretch;
  justify-self: stretch;
  padding: 0;
  overflow: hidden;
}
#gamePage .floor-game-hud .keyboard > .perk-key img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

/* STAGE 27 — Correct third-row alignment.
   The perk spacebar begins at the same left edge as A and K.
   U–Z shift right; Z ends directly below J and T. */
#gamePage .floor-game-hud .keyboard > .perk-key {
  grid-column: 1 / span 4 !important;
  grid-row: 3 !important;
  width: 100%;
  height: 100%;
  max-width: none;
  align-self: stretch;
  justify-self: stretch;
}
#gamePage .floor-game-hud .keyboard > .key:nth-child(21) { grid-column: 5 !important; grid-row: 3 !important; }
#gamePage .floor-game-hud .keyboard > .key:nth-child(22) { grid-column: 6 !important; grid-row: 3 !important; }
#gamePage .floor-game-hud .keyboard > .key:nth-child(23) { grid-column: 7 !important; grid-row: 3 !important; }
#gamePage .floor-game-hud .keyboard > .key:nth-child(24) { grid-column: 8 !important; grid-row: 3 !important; }
#gamePage .floor-game-hud .keyboard > .key:nth-child(25) { grid-column: 9 !important; grid-row: 3 !important; }
#gamePage .floor-game-hud .keyboard > .key:nth-child(26) { grid-column: 10 !important; grid-row: 3 !important; }

/* STAGE 28 — Spacebar geometry: same vertical height as one letter key.
   The perk key spans four columns; U–Z occupy columns 5–10. */
#gamePage .floor-game-hud .keyboard > .perk-key {
  grid-column: 1 / span 4 !important;
  grid-row: 3 !important;
  width: 100% !important;
  max-width: none !important;
  height: clamp(25px, 3.8889cqw, 46.3px) !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  align-self: center !important;
  justify-self: stretch !important;
  padding: 0 !important;
  overflow: hidden;
}
#gamePage .floor-game-hud .keyboard > .perk-key img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
#gamePage .floor-game-hud .keyboard > .key:nth-child(21) { grid-column: 5 !important; grid-row: 3 !important; }
#gamePage .floor-game-hud .keyboard > .key:nth-child(22) { grid-column: 6 !important; grid-row: 3 !important; }
#gamePage .floor-game-hud .keyboard > .key:nth-child(23) { grid-column: 7 !important; grid-row: 3 !important; }
#gamePage .floor-game-hud .keyboard > .key:nth-child(24) { grid-column: 8 !important; grid-row: 3 !important; }
#gamePage .floor-game-hud .keyboard > .key:nth-child(25) { grid-column: 9 !important; grid-row: 3 !important; }
#gamePage .floor-game-hud .keyboard > .key:nth-child(26) { grid-column: 10 !important; grid-row: 3 !important; }
@media (max-width:700px) {
  #gamePage .floor-game-hud .keyboard > .perk-key {
    height: calc(clamp(20px, 6vw, 38px) / 1.08) !important;
  }
}


/* STAGE 29 — Preserve the supplied USE A PERK artwork's native proportions.
   Match the alphabet key height; derive width from the PNG's 1917:632 ratio.
   The four-column grid placement remains a positioning lane, not an image stretch. */
#gamePage .floor-game-hud .keyboard > .perk-key {
  grid-column: 1 / span 4 !important;
  grid-row: 3 !important;
  height: calc(clamp(22px, 4.2cqw, 34px) / 1.08) !important;
  width: calc(clamp(22px, 4.2cqw, 34px) / 1.08 * 3.033) !important;
  min-height: 0 !important;
  max-width: 100% !important;
  aspect-ratio: 1917 / 632 !important;
  align-self: center !important;
  justify-self: start !important;
  padding: 0 !important;
  overflow: visible !important;
}
#gamePage .floor-game-hud .keyboard > .perk-key img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}
@media (max-width:700px) {
  #gamePage .floor-game-hud .keyboard > .perk-key {
    height: calc(clamp(20px, 6vw, 38px) / 1.08) !important;
    width: calc(clamp(20px, 6vw, 38px) / 1.08 * 3.033) !important;
  }
}


/* =====================================================================
   STAGE 30 — Perk button + keyboard layout
   - Perk art is use_a_perk_button.webp (3.033:1). It spans exactly two
     keyboard columns; its height follows from its width, so the art is
     never stretched or letterboxed.
   - Row 3 is centred under rows 1-2: [blank][PERK x2][U V W X Y Z][blank].
   - The keyboard sits between the jar and the treasure chest instead of
     running underneath the chest.
   ===================================================================== */
#gamePage .floor-game-hud{
  left:12.5% !important;
  right:22.5% !important;
}
#gamePage .floor-game-hud .keyboard{
  grid-template-columns:repeat(10,minmax(0,1fr)) !important;
  gap:clamp(1px,.3cqw,4px) clamp(2px,.45cqw,7px) !important;
  align-items:center !important;
}
#gamePage .floor-game-hud .keyboard > .perk-key{
  grid-column:2 / span 2 !important;
  grid-row:3 !important;
  justify-self:stretch !important;
  align-self:center !important;
  width:100% !important;
  max-width:none !important;
  height:auto !important;
  min-height:0 !important;
  aspect-ratio:1917 / 632 !important;
  padding:0 !important;
  overflow:visible !important;
  filter:drop-shadow(0 2px 3px #2a160788);
}
#gamePage .floor-game-hud .keyboard > .perk-key img{
  display:block;width:100% !important;height:100% !important;object-fit:contain !important;
}
#gamePage .floor-game-hud .keyboard > .perk-key:hover:not(:disabled){
  transform:translateY(-2px);filter:brightness(1.1) drop-shadow(0 5px 4px #28160777);
}
#gamePage .floor-game-hud .keyboard > .key:nth-child(21){grid-column:4 !important;grid-row:3 !important}
#gamePage .floor-game-hud .keyboard > .key:nth-child(22){grid-column:5 !important;grid-row:3 !important}
#gamePage .floor-game-hud .keyboard > .key:nth-child(23){grid-column:6 !important;grid-row:3 !important}
#gamePage .floor-game-hud .keyboard > .key:nth-child(24){grid-column:7 !important;grid-row:3 !important}
#gamePage .floor-game-hud .keyboard > .key:nth-child(25){grid-column:8 !important;grid-row:3 !important}
#gamePage .floor-game-hud .keyboard > .key:nth-child(26){grid-column:9 !important;grid-row:3 !important}


/* =====================================================================
   STAGE 31 — Phone keyboard tray (<=700px)
   The keyboard leaves the scene and becomes a full-width tray below it.
   9 / 9 / 8 letters (row 3 centred) + a wide, proportional perk button.
   Keys are ~42 x 44px cells instead of ~22 x 20px.
   ===================================================================== */
.keyboard-tray[hidden]{display:none !important}
@media (max-width:700px){
  #gamePage .keyboard-tray{
    margin:10px 0 0;padding:10px 8px 12px;
    border:2px solid #b98a45;border-radius:14px;
    background:radial-gradient(ellipse at 50% 0%,#4a2f17 0%,#24160b 72%);
    box-shadow:inset 0 0 18px #0008,0 4px 14px #0006;
  }
  #gamePage .keyboard-tray .floor-game-hud{
    position:static !important;left:auto !important;right:auto !important;bottom:auto !important;
    width:100%;display:block;pointer-events:auto;
  }
  #gamePage .keyboard-tray .floor-game-hud .keyboard{
    display:grid !important;width:100% !important;
    grid-template-columns:repeat(18,minmax(0,1fr)) !important;
    gap:6px 0 !important;justify-items:stretch !important;align-items:center !important;
  }
  #gamePage .keyboard-tray .floor-game-hud .keyboard > .key:nth-child(n){
    grid-column:span 2 !important;grid-row:auto !important;
    width:100% !important;max-width:none !important;height:44px !important;
    aspect-ratio:auto !important;padding:0 2px !important;
  }
  #gamePage .keyboard-tray .floor-game-hud .keyboard > .key:nth-child(n) img{
    display:block;width:100%;height:100%;object-fit:contain;
  }
  #gamePage .keyboard-tray .floor-game-hud .keyboard > .key:nth-child(19){grid-column:2 / span 2 !important}
  #gamePage .keyboard-tray .floor-game-hud .keyboard > .key.perk-key:nth-child(n){
    grid-column:6 / span 8 !important;grid-row:auto !important;
    height:auto !important;aspect-ratio:1917 / 632 !important;
    margin-top:6px;padding:0 !important;
  }
}


/* =====================================================================
   STAGE 32 — Perk state: count badge, ready/empty look, low-chance glow
   ===================================================================== */
#gamePage .keyboard > .perk-key{position:relative}
#gamePage .keyboard > .perk-key .perk-badge{
  position:absolute;top:-8px;right:-6px;min-width:21px;height:21px;padding:0 5px;box-sizing:border-box;
  display:flex;align-items:center;justify-content:center;
  border-radius:999px;border:2px solid #f4d38a;background:#8b1e1e;color:#fff4d6;
  font:800 12px/1 Inter,system-ui,sans-serif;box-shadow:0 2px 4px #0008;pointer-events:none;
}
#gamePage .keyboard > .perk-key.perk-empty{filter:grayscale(.55) brightness(.78);opacity:.8}
#gamePage .keyboard > .perk-key.perk-urgent{animation:perkPulse 1.7s ease-in-out infinite}
@keyframes perkPulse{
  0%,100%{filter:drop-shadow(0 2px 3px #2a160788)}
  50%{filter:drop-shadow(0 0 11px #ffd36af0) brightness(1.1)}
}
@media (prefers-reduced-motion:reduce){
  #gamePage .keyboard > .perk-key.perk-urgent{animation:none;filter:drop-shadow(0 0 9px #ffd36acc) brightness(1.08)}
}


/* =====================================================================
   STAGE 33 — Answer slots, hearts, hint text
   - Slots are sized per puzzle (JS sets --n = weighted slot count) so a
     4-letter answer gets big tiles and a 29-character answer still fits.
   - On phones the answer moves into the keyboard tray (see game.js) and
     wraps by WORD onto as many lines as needed, with large tiles.
   ===================================================================== */
#gamePage .word{display:contents}

/* ---- Desktop / tablet: answer plaque ---------------------------------- */
#gamePage .answer-plaque .answer-slots{
  --sw:min(3.5cqw,calc(51cqw / var(--n,20)));
  gap:calc(var(--sw) * .14) !important;
}
#gamePage .answer-plaque .slot{
  width:var(--sw) !important;height:min(78%,calc(var(--sw) * 1.55)) !important;max-height:none !important;
  font-size:calc(var(--sw) * .98) !important;
  border-bottom:max(2px,.26cqw) solid #ffd77a !important;
  color:#fff4d2 !important;
  background:linear-gradient(#ffffff12,#ffffff00);
  text-shadow:0 2px 3px #1d0d03,0 0 5px #1d0d03;
  box-shadow:0 2px 6px -2px #ffc65a66;
}
#gamePage .answer-plaque .slot.space{width:calc(var(--sw) * .5) !important;border:0 !important;background:none;box-shadow:none}
#gamePage .answer-plaque .slot.punct{width:auto !important;min-width:calc(var(--sw) * .45);border:0 !important;background:none;box-shadow:none}

/* ---- Hearts ------------------------------------------------------------ */
#gamePage .scene > #mistakeDots{gap:clamp(2px,.4cqw,6px)}
#gamePage .scene > #mistakeDots .heart{font-size:clamp(14px,2.2cqw,28px);text-shadow:0 1px 2px #1d0d03}
#gamePage .scene > #mistakeDots .heart.live{color:#ffd36a;text-shadow:0 0 7px #ffb83088,0 1px 2px #1d0d03}
#gamePage .scene > #mistakeDots .heart:not(.live){color:#7b5a35;text-shadow:none;opacity:.85}

/* ---- Hint text --------------------------------------------------------- */
#gamePage #inputHelp{color:#e6d2a6;font-size:14px;letter-spacing:.01em;opacity:1}
#gamePage .bottom-actions{justify-content:center}

/* ---- Phone: answer strip inside the tray ------------------------------- */
@media (max-width:700px){
  #gamePage .answer-plaque{display:none !important}
  #gamePage .scene > #mistakeDots{gap:1px}
  #gamePage .scene > #mistakeDots .heart{font-size:9.5px}
  #gamePage .answer-strip{padding:2px 4px 10px;margin:0 0 10px;border-bottom:1px solid #b98a4566}
  #gamePage .answer-strip .answer-slots{
    position:static !important;display:flex !important;flex-wrap:wrap !important;justify-content:center;align-items:flex-end;
    gap:10px 14px !important;width:100% !important;min-height:0 !important;inset:auto !important;overflow:visible !important;
    /* tile width shrinks only when the longest word needs it (e.g. SYROPHOENICIAN) */
    --sw:min(clamp(16px,5.6vw,26px),calc((100vw - 60px) / var(--wordmax,10) - 4px));
  }
  #gamePage .answer-strip .word{display:inline-flex;gap:4px}
  #gamePage .answer-strip .slot{
    width:var(--sw) !important;height:34px !important;max-height:none !important;
    display:grid;place-items:center;
    font:800 min(23px,calc(var(--sw) * 1.05))/1 Georgia,serif !important;color:#fff4d2 !important;
    border-bottom:3px solid #ffd77a !important;background:linear-gradient(#ffffff14,#ffffff00);
    text-shadow:0 2px 3px #1d0d03;
  }
  #gamePage .answer-strip .slot.space{display:none !important}
  #gamePage .answer-strip .slot.punct{width:auto !important;min-width:8px;border:0 !important;background:none}
}


/* =====================================================================
   STAGE 35 — Puzzle information panel
   Parchment = Mystery Clue (default) or Main Question, with the two
   action buttons inside its bottom section; category plaque under the
   Mistakes board; Word of Wisdom popup; phone info card (<=700px).
   ===================================================================== */
#gamePage .info-body [hidden]{display:none !important}
#gamePage .scene .top-info-copy{
  display:flex;flex-direction:column;align-items:stretch;justify-content:space-between;
  inset:18% 7.5% 18% !important;gap:clamp(2px,.3cqw,5px) !important;
}
#gamePage .top-info-copy .info-mode{
  flex:none;text-align:center;text-transform:uppercase;
  font:800 clamp(7px,.82cqw,11px)/1 Inter,system-ui,sans-serif;letter-spacing:.2em;color:#7a4b1f;
}
#gamePage .top-info-copy .info-body{
  flex:1 1 auto;min-height:0;display:flex;align-items:center;justify-content:center;text-align:center;overflow:hidden;
}
#gamePage .top-info-copy .info-body .question,
#gamePage .top-info-copy .info-body .mystery{
  margin:0;max-width:100%;line-height:1.12;color:#2f1c0b;font-size:clamp(12px,1.9cqw,24px);
  font-family:Georgia,"Times New Roman",serif;
}
#gamePage .top-info-copy .info-body .question{font-weight:800}
#gamePage .top-info-copy .info-body .mystery{font-style:italic;font-weight:600}
#gamePage .top-info-copy .info-actions{flex:none;display:flex;justify-content:center;gap:clamp(6px,.9cqw,14px)}

#gamePage .info-btn{
  flex:1 1 0;min-width:0;max-width:49%;position:relative;
  display:inline-flex;align-items:center;justify-content:center;gap:.5em;
  height:clamp(22px,2.7cqw,36px);padding:0 .9em;
  border-radius:999px;border:1.5px solid #4f2f10;
  background:linear-gradient(#b27c33,#6d4219);color:#ffeec4;
  font:800 clamp(7px,.92cqw,13px)/1 Inter,system-ui,sans-serif;letter-spacing:.07em;text-transform:uppercase;white-space:nowrap;
  box-shadow:inset 0 1px 0 #ffd89a88,0 2px 4px #3a210a66;cursor:pointer;
  transition:filter .15s,transform .15s;
}
#gamePage .info-btn:hover:not(:disabled){filter:brightness(1.12);transform:translateY(-1px)}
#gamePage .info-btn:disabled{opacity:.5;cursor:not-allowed}
#gamePage .info-btn .info-ico{width:1.25em;height:1.25em;flex:none}
#gamePage .info-btn .info-label{overflow:hidden;text-overflow:ellipsis}
#gamePage .info-btn .info-price{
  flex:none;padding:.25em .6em;border-radius:999px;background:#2a1708;color:#ffd77a;font-size:.88em;letter-spacing:.04em;
}
/* Word of Wisdom: gold, with a ready / revealed / empty state */
#gamePage .info-w{background:linear-gradient(#f6d57e,#c18a30);color:#3a2108;border-color:#6d4219;box-shadow:inset 0 1px 0 #fff4c4aa,0 2px 5px #3a210a66}
#gamePage .info-w[data-state="ready"]{box-shadow:inset 0 1px 0 #fff4c4aa,0 0 10px #ffd36a99,0 2px 5px #3a210a66}
#gamePage .info-w[data-state="empty"]{filter:grayscale(.5) brightness(.85);opacity:.85}
#gamePage .info-w .info-count,
#gamePage .info-w .info-check{
  position:absolute;top:-7px;right:-5px;min-width:1.75em;height:1.75em;padding:0 .35em;box-sizing:border-box;
  display:flex;align-items:center;justify-content:center;border-radius:999px;
  border:2px solid #f4d38a;background:#8b1e1e;color:#fff4d6;font-size:.95em;letter-spacing:0;pointer-events:none;
}
#gamePage .info-w .info-check{background:#2f6b3a}

/* ---- Category plaque (under the Mistakes board) ----------------------- */
#gamePage .scene > .category-plaque{
  position:absolute;z-index:11;right:3.2%;top:19%;width:17.2%;height:3.9%;
  display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:0 .6em;
  border:1.5px solid #5b3714;border-radius:7px;
  background:linear-gradient(#ecd09a,#b98745);
  box-shadow:inset 0 1px 0 #fff3cfaa,inset 0 -2px 3px #7a4b1f66,0 2px 5px #20100699;
  color:#3b2410;font:800 clamp(7px,.9cqw,12px)/1 Inter,system-ui,sans-serif;letter-spacing:.12em;text-transform:uppercase;
  white-space:nowrap;overflow:hidden;
}

/* ---- Word of Wisdom popup --------------------------------------------- */
#modalRoot .modal.wow-popup{
  position:relative;width:min(580px,92vw);max-width:none;padding:30px 30px 24px;text-align:center;overflow:hidden;
  background:radial-gradient(ellipse at 50% 0%,#fff6d4 0%,#f1d99c 52%,#d8b26a 100%);
  border:3px solid #b98a45;border-radius:22px;color:#3a2412;
  box-shadow:0 0 0 2px #6b4421,0 0 44px #ffd36acc,0 0 120px #ffb83066,inset 0 0 40px #b98a4566;
}
#modalRoot .wow-popup > *{position:relative}
#modalRoot .wow-popup .wow-glow{
  position:absolute;inset:-30% -10% 40% -10%;pointer-events:none;
  background:radial-gradient(circle at 50% 100%,#fff8dccc 0%,#ffe9a855 40%,transparent 70%);
  animation:wowGlow 3.4s ease-in-out infinite;
}
@keyframes wowGlow{0%,100%{opacity:.55;transform:scale(.96)}50%{opacity:1;transform:scale(1.04)}}
@media (prefers-reduced-motion:reduce){#modalRoot .wow-popup .wow-glow{animation:none;opacity:.8}}
#modalRoot .wow-popup .wow-icon{width:88px;height:88px;object-fit:contain;filter:drop-shadow(0 0 14px #ffd36a)}
#modalRoot .wow-popup .wow-title{margin:6px 0 8px;font:700 29px/1.1 Georgia,serif;letter-spacing:.05em;color:#4a2c12}
#modalRoot .wow-popup .wow-ref{
  display:inline-block;padding:5px 14px;border-radius:999px;background:#6d4219;color:#ffeec4;
  font:800 12px/1 Inter,system-ui,sans-serif;letter-spacing:.16em;text-transform:uppercase;
}
#modalRoot .wow-popup .wow-text{margin:16px 6px 10px;font:600 clamp(20px,3.6vw,27px)/1.35 Georgia,serif;color:#2f1c0b}
#modalRoot .wow-popup .wow-foot{margin:0 0 4px;font-size:12px;color:#7a5530}
#modalRoot .wow-popup .modal-actions{justify-content:center;margin-top:14px}
#modalRoot .wow-popup .wow-close{min-width:160px}

/* ---- Phone: info card between the scene and the keyboard tray --------- */
.info-card[hidden]{display:none !important}
@media (max-width:700px){
  #gamePage .top-info-banner{display:none !important}
  #gamePage .info-card{
    margin:10px 0 0;padding:10px 12px 12px;border:2px solid #b98a45;border-radius:14px;
    background:linear-gradient(#f6e6bd,#dfc182);color:#2f1c0b;
    box-shadow:inset 0 0 18px #b98a4555,0 4px 14px #0006;
  }
  #gamePage .info-card-head{display:none}
  /* The scene art has an empty carved sign at the top centre; on phones it carries the category. */
  #gamePage .scene > .category-plaque{
    left:29.6%;right:auto;top:2.2%;width:40.8%;height:10.6%;
    background:none;border:0;box-shadow:none;border-radius:0;
    color:#4a2c12;font-size:clamp(8px,2.6cqw,11px);letter-spacing:.1em;
    text-shadow:0 1px 0 #fff3cf88;
  }
  #gamePage .info-card .top-info-copy{
    position:static !important;inset:auto !important;display:flex;flex-direction:column;gap:8px !important;
  }
  #gamePage .info-card .info-mode{font-size:10px}
  #gamePage .info-card .info-body{min-height:76px;height:auto;flex:none}
  #gamePage .info-card .info-actions{flex-direction:column;gap:8px}
  #gamePage .info-card .info-btn{flex:none;max-width:none;width:100%;height:46px;font-size:12px}
}

/* The parchment banner is pointer-events:none (so it never blocks the scene); only the buttons are clickable. */
#gamePage .info-btn{pointer-events:auto}
#gamePage .info-card,#gamePage .info-card *{pointer-events:auto}


/* =====================================================================
   STAGE 36 — VIEWPORT-FIT GAMEPLAY + CENTERED TEMPLE MENU
   ===================================================================== */
@media (min-width:701px){
  .wrap:has(#gamePage.active){width:100%;max-width:none;margin:0;padding:10px clamp(10px,1.4vw,24px) 14px}
  #gamePage.active{width:100%;max-width:none;margin:0;padding:0}
  #gamePage .game-top{width:100%;margin:0 0 10px}
  #gamePage .game-layout{width:100%;max-width:none;margin:0}
  #gamePage .game-layout > div:first-child{width:100%;max-width:none;min-width:0}
  #gamePage .stage{width:100%;max-width:none;min-height:0;--stage-scene-width:min(100%,calc(min(1100px,100dvh - 150px) * 1672 / 941))}
  #gamePage .scene{
    --scene-max-h:min(1100px,calc(100dvh - 150px));
    width:min(100%,calc(var(--scene-max-h) * 1672 / 941));
    max-width:none;height:auto;aspect-ratio:1672 / 941;margin:0 auto;
  }
  /* Centered overlay: independent of the gameplay layout. */
  #gamePage .side-stack{
    position:fixed;z-index:42;left:50%;right:auto;top:50%;bottom:auto;
    width:min(900px,94vw);max-height:min(84dvh,900px);
    padding:76px 24px 24px;border:3px solid #bd914e;border-radius:24px;
    background:radial-gradient(ellipse at 50% 0%,#76512d 0%,#3a291c 55%,#211b17 100%);
    box-shadow:0 28px 90px #000c,inset 0 0 0 2px #e9c57d22;
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:max-content;
    gap:14px;overflow-y:auto;transform:translate(-50%,-48%) scale(.97);
    opacity:0;visibility:hidden;pointer-events:none;
    transition:transform .24s ease,opacity .24s ease,visibility .24s;
  }
  #gamePage .side-stack.drawer-open{transform:translate(-50%,-50%) scale(1);opacity:1;visibility:visible;pointer-events:auto}
  #gamePage .side-stack > .side-panel:first-of-type{grid-column:1 / -1}
  #gamePage .side-stack .drawer-shortcuts{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
  #gamePage .side-stack .side-panel{min-width:0;padding:16px}
  #gamePage .side-stack .drawer-close{position:absolute;top:14px;right:14px}
}
@media (min-width:701px) and (max-height:620px){
  .wrap:has(#gamePage.active){padding-top:6px;padding-bottom:6px}
  #gamePage .game-top{margin-bottom:6px}
  #gamePage .scene{--scene-max-h:calc(100dvh - 112px)}
  #gamePage .side-stack{max-height:90dvh;padding-top:64px}
}
@media (max-width:700px){
  /* Preserve the existing phone drawer and keyboard-tray behavior. */
  #gamePage .side-stack{position:fixed;left:auto;right:0;top:0;bottom:0;width:min(390px,94vw);max-height:none;border-radius:0;transform:translateX(105%);opacity:1;pointer-events:auto}
  #gamePage .side-stack.drawer-open{transform:translateX(0)}
}


/* =====================================================================
   STAGE 37 — TEMPLE MENU VISUAL REDESIGN
   Carved sandstone, bronze-gold trim, parchment typography.
   ===================================================================== */
#gamePage .side-stack{
  color:#f7e7c3;
  border:4px solid #9b682d !important;
  outline:1px solid #f2d18a;outline-offset:-9px;border-radius:26px !important;
  background:radial-gradient(ellipse at 50% 0%,#a8793d 0%,transparent 44%),linear-gradient(145deg,#624321 0%,#3b2919 48%,#24190f 100%) !important;
  box-shadow:0 30px 100px #000d,0 0 0 3px #4c2b12,inset 0 2px 0 #ffe5a466,inset 0 -10px 24px #1b100b99 !important;
  gap:14px !important;
}
#gamePage .side-stack::before{
  content:"";position:absolute;left:50%;top:13px;transform:translateX(-50%);
  width:min(52%,380px);height:42px;border-radius:12px;border:2px solid #d7a852;
  background:linear-gradient(#f6dfaa,#c18b43 48%,#86501f);
  box-shadow:inset 0 2px 3px #fff5c8,0 4px 10px #160d08aa;pointer-events:none;
}
#gamePage .side-stack .drawer-close{
  z-index:2;right:22px !important;top:19px !important;width:42px;height:42px;padding:0 !important;
  border-radius:50% !important;display:flex;align-items:center;justify-content:center;
  background:radial-gradient(circle at 35% 25%,#f4d48b,#a75a24 72%,#633013) !important;
  border:2px solid #f4cf78 !important;color:#fff4d5 !important;
  box-shadow:0 3px 8px #160c08aa,inset 0 1px 3px #fff8d5 !important;font-size:0 !important;
}
#gamePage .side-stack .drawer-close::after{content:"×";font:900 30px/1 Georgia,serif;color:#fff0c7;text-shadow:0 2px 2px #4a1d0b}
#gamePage .side-stack .side-panel{
  background:linear-gradient(155deg,#f5dfad 0%,#e4c17d 56%,#c9944c 100%) !important;
  border:3px solid #8b561f !important;border-radius:15px !important;color:#3b2410 !important;
  box-shadow:inset 0 2px 0 #fff7d9,inset 0 -5px 10px #96602d66,0 5px 12px #160d0877 !important;
}
#gamePage .side-stack .side-panel h3{
  color:#4a2a10 !important;text-align:center;font:900 23px/1.15 Georgia,serif !important;
  letter-spacing:.08em;text-transform:uppercase;text-shadow:0 1px 0 #fff1c7;
}
#gamePage .side-stack .side-panel p{color:#654321 !important;text-align:center}
#gamePage .side-stack .menu-heading{padding:20px 20px 18px !important;text-align:center}
#gamePage .side-stack .menu-heading h3{position:relative;margin:0 0 5px !important;font-size:25px !important}
#gamePage .side-stack .menu-heading > p{margin:0 0 15px !important;font:italic 14px Georgia,serif !important}
#gamePage .side-stack .menu-ornament{color:#a66b25;font:22px Georgia,serif;margin:-4px 0 3px;text-shadow:0 1px 0 #fff2c9}
#gamePage .side-stack .drawer-shortcuts{
  display:grid !important;grid-template-columns:repeat(3,minmax(0,1fr)) !important;gap:12px !important;
}
#gamePage .side-stack .drawer-shortcuts .menu-tile{
  min-height:112px;padding:10px 8px !important;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;
  border:2px solid #8b531e !important;border-radius:12px !important;color:#3a210e !important;
  background:linear-gradient(145deg,#ffe8b2 0%,#e6bd70 48%,#bd8037 100%) !important;
  box-shadow:inset 0 2px 0 #fff9d9,inset 0 -5px 7px #88501e55,0 4px 0 #704019,0 7px 10px #3a1d0b66 !important;
  font:800 14px/1.15 Georgia,serif !important;text-align:center;white-space:normal;
  transition:transform .14s ease,filter .14s ease,box-shadow .14s ease;
}
#gamePage .side-stack .drawer-shortcuts .menu-tile:hover{
  transform:translateY(-2px);filter:brightness(1.08);
  box-shadow:inset 0 2px 0 #fff9d9,inset 0 -5px 7px #88501e55,0 6px 0 #704019,0 10px 15px #3a1d0b77 !important;
}
#gamePage .side-stack .drawer-shortcuts .menu-tile:active{transform:translateY(2px)}
#gamePage .side-stack .menu-icon{display:flex;align-items:center;justify-content:center;width:48px;height:44px;font-size:30px;line-height:1;filter:drop-shadow(0 2px 1px #75451d66)}
#gamePage .side-stack .menu-label{display:block;max-width:100%}
#gamePage .side-stack .side-panel:not(.menu-heading){padding:13px 16px !important}
#gamePage .side-stack .side-panel:not(.menu-heading) h3{text-align:left;font-size:16px !important;letter-spacing:.04em}
#gamePage .side-stack .side-panel:not(.menu-heading) p{text-align:left;font-size:12px;line-height:1.45;margin:0 !important}
#gamePage .side-stack .menu-note{padding-top:7px;border-top:1px solid #9a6b32;font-style:italic;font-size:11px !important}
#gamePage .side-stack .side-panel button:not(.menu-tile){background:linear-gradient(#f2d99e,#c28c45) !important;color:#3a230f !important;border:1px solid #8d5c26 !important}
#gamePage .drawer-scrim{background:#100a05b8 !important;backdrop-filter:blur(2px)}
@media (min-width:701px){
  #gamePage .side-stack{width:min(820px,94vw) !important;padding:76px 25px 22px !important;grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:13px !important}
  #gamePage .side-stack .menu-heading{grid-column:1 / -1}
  #gamePage .side-stack .menu-heading .drawer-shortcuts{grid-template-columns:repeat(3,minmax(0,1fr)) !important}
  #gamePage .side-stack .side-panel:not(.menu-heading){min-height:80px}
}
@media (max-width:700px){
  #gamePage .side-stack{padding:76px 15px 20px !important;border-left:4px solid #9b682d !important;border-radius:20px 0 0 20px !important}
  #gamePage .side-stack .menu-heading{padding:16px 10px 14px !important}
  #gamePage .side-stack .menu-heading h3{font-size:20px !important}
  #gamePage .side-stack .drawer-shortcuts{grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:9px !important}
  #gamePage .side-stack .drawer-shortcuts .menu-tile{min-height:88px;font-size:12px !important}
  #gamePage .side-stack .menu-icon{height:34px;font-size:25px}
}


/* =====================================================================
   STAGE 39 — WIDE TEMPLE MENU LAYOUT
   Uses the approved illustrated header, navigation buttons and close art.
   Desktop follows the supplied 3-column / 2-row menu composition.
   ===================================================================== */
#gamePage .side-stack{
  position:fixed !important;
  left:50% !important;right:auto !important;top:50% !important;bottom:auto !important;
  transform:translate(-50%,-50%) scale(.985) !important;
  width:min(1080px,96vw) !important;
  max-height:min(94vh,940px) !important;
  padding:30px 34px 26px !important;
  display:grid !important;
  grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  grid-auto-rows:max-content !important;
  gap:14px 18px !important;
  overflow-y:auto !important;overflow-x:hidden !important;
  background:
    radial-gradient(ellipse at 50% 0%,#80572f 0%,transparent 42%),
    linear-gradient(155deg,#4b321d 0%,#2a1d14 58%,#1c1712 100%) !important;
  border:4px solid #b9853e !important;
  outline:2px solid #f3d28b !important;outline-offset:-9px !important;
  border-radius:27px !important;
  box-shadow:0 0 0 3px #4b2a10,0 22px 75px #000c,inset 0 2px 0 #ffe5a466 !important;
  scrollbar-width:thin;scrollbar-color:#c18b3e #342316;
}
#gamePage .side-stack.drawer-open{transform:translate(-50%,-50%) scale(1) !important}
#gamePage .side-stack::-webkit-scrollbar{width:10px}
#gamePage .side-stack::-webkit-scrollbar-track{background:#2b1d13;border-radius:8px}
#gamePage .side-stack::-webkit-scrollbar-thumb{background:linear-gradient(90deg,#8b541f,#e1b65d,#8b541f);border:2px solid #2b1d13;border-radius:8px}
#gamePage .side-stack .drawer-close{
  position:absolute !important;top:15px !important;right:16px !important;left:auto !important;
  z-index:8;width:58px !important;height:58px !important;padding:0 !important;
  border:0 !important;background:transparent !important;box-shadow:none !important;
}
#gamePage .side-stack .drawer-close img{display:block;width:100%;height:100%;object-fit:contain}
#gamePage .side-stack .menu-heading{
  grid-column:1 / -1 !important;
  background:transparent !important;border:0 !important;box-shadow:none !important;
  padding:0 0 4px !important;text-align:center !important;
}
#gamePage .temple-menu-header-art{
  display:block;width:min(590px,72%);height:auto;object-fit:contain;margin:-8px auto 0;
}
#gamePage .side-stack .menu-heading > p{
  margin:0 0 14px !important;color:#f6dfb2 !important;
  font:italic clamp(13px,1.45vw,18px) Georgia,serif !important;
  text-align:center !important;
}
#gamePage .side-stack .drawer-shortcuts{
  display:grid !important;grid-column:1 / -1 !important;
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  align-items:center !important;gap:12px 14px !important;
}
#gamePage .side-stack .drawer-shortcuts .menu-tile{
  display:flex !important;position:relative !important;align-items:center !important;justify-content:center !important;
  width:100% !important;min-width:0 !important;min-height:0 !important;height:auto !important;
  aspect-ratio:auto !important;padding:0 !important;margin:0 !important;
  overflow:visible !important;border:0 !important;border-radius:0 !important;
  background:transparent !important;box-shadow:none !important;cursor:pointer !important;
}
#gamePage .side-stack .drawer-shortcuts .menu-tile img{
  display:block !important;width:100% !important;height:auto !important;object-fit:contain !important;
  filter:drop-shadow(0 4px 4px #120a04b8);transition:filter .15s ease,transform .15s ease;
}
#gamePage .side-stack .drawer-shortcuts .menu-tile:hover img{
  filter:brightness(1.08) drop-shadow(0 5px 6px #120a04);transform:translateY(-2px)
}
#gamePage .side-stack .drawer-shortcuts .menu-tile-perks img{content:url("../assets/menu/nav_perks_wisdom.webp")}
#gamePage .side-stack .drawer-shortcuts .menu-tile-perks span{
  position:absolute;left:18%;right:8%;top:50%;transform:translateY(-50%);
  color:#51280d;font:700 clamp(13px,1.45vw,20px) Georgia,serif;
  text-shadow:0 1px #fff0c6;pointer-events:none;
}
#gamePage .side-stack .side-panel:not(.menu-heading){
  min-width:0;
  background:linear-gradient(145deg,#f6d99b,#d9a957) !important;color:#4a2a12 !important;
  border:3px solid #a96d2c !important;border-radius:17px !important;
  box-shadow:inset 0 1px #fff2c8,0 4px 9px #130b0566 !important;
  padding:16px 18px !important;
}
#gamePage .side-stack .side-panel:not(.menu-heading) h3{color:#553014 !important;font-family:Georgia,serif !important}
#gamePage .side-stack .side-panel:not(.menu-heading) p{color:#684421 !important}
#gamePage .side-stack .side-panel:nth-of-type(4){grid-column:1 / -1 !important}
@media(max-width:760px){
  #gamePage .side-stack{
    width:96vw !important;max-height:94vh !important;padding:22px 14px 18px !important;
    grid-template-columns:1fr !important;gap:10px !important;border-radius:20px !important;
  }
  #gamePage .side-stack .menu-heading{grid-column:1 !important;padding-top:20px !important}
  #gamePage .temple-menu-header-art{width:min(470px,82%);margin:0 auto}
  #gamePage .side-stack .drawer-shortcuts{
    grid-column:1 !important;grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:8px !important;
  }
  #gamePage .side-stack .side-panel:nth-of-type(4){grid-column:1 !important}
  #gamePage .side-stack .drawer-close{width:46px !important;height:46px !important;top:8px !important;right:8px !important}
}
@media(max-width:420px){
  #gamePage .side-stack .drawer-shortcuts{grid-template-columns:1fr !important}
  #gamePage .side-stack .drawer-shortcuts .menu-tile{max-width:340px;margin:0 auto !important}
}



/* STAGE 40 — Use the user's complete illustrated Temple Menu as the menu itself.
   Transparent semantic hit areas preserve all existing navigation actions. */
#gamePage .side-stack.temple-menu-artboard{
  position:fixed !important;left:50% !important;top:50% !important;right:auto !important;bottom:auto !important;
  width:min(1120px,96vw) !important;height:auto !important;aspect-ratio:3 / 2 !important;
  max-height:94vh !important;max-width:96vw !important;padding:0 !important;margin:0 !important;
  display:block !important;overflow:visible !important;
  transform:translate(-50%,-50%) scale(.97) !important;opacity:0;visibility:hidden;pointer-events:none;
  border:0 !important;outline:0 !important;border-radius:0 !important;
  background:transparent !important;box-shadow:none !important;
  transition:transform .22s ease,opacity .22s ease,visibility .22s ease !important;
  z-index:45 !important;
}
#gamePage .side-stack.temple-menu-artboard.drawer-open{
  transform:translate(-50%,-50%) scale(1) !important;opacity:1 !important;visibility:visible !important;pointer-events:auto !important;
}
#gamePage .temple-menu-full-art{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;display:block;user-select:none;pointer-events:none}
#gamePage .temple-menu-artboard .menu-hotspot{
  position:absolute !important;display:block !important;padding:0 !important;margin:0 !important;
  min-width:0 !important;min-height:0 !important;border:0 !important;border-radius:12px !important;
  background:transparent !important;box-shadow:none !important;opacity:1 !important;
  cursor:pointer !important;z-index:3 !important;
}
#gamePage .temple-menu-artboard .menu-hotspot:hover{background:#ffdf8a18 !important;outline:2px solid #ffdf8a66 !important}
#gamePage .temple-menu-artboard .menu-close-hotspot{left:81.8%;top:3.5%;width:9%;height:13%}
#gamePage .temple-menu-artboard .menu-shop-hotspot{left:15.3%;top:23.7%;width:23%;height:14.7%}
#gamePage .temple-menu-artboard .menu-inventory-hotspot{left:38.7%;top:23.7%;width:23%;height:14.7%}
#gamePage .temple-menu-artboard .menu-wisdom-hotspot{left:62%;top:23.7%;width:23%;height:14.7%}
#gamePage .temple-menu-artboard .menu-blessing-hotspot{left:15.3%;top:39.7%;width:23%;height:14.7%}
#gamePage .temple-menu-artboard .menu-howto-hotspot{left:38.7%;top:39.7%;width:23%;height:14.7%}
#gamePage .temple-menu-artboard .menu-map-hotspot{left:62%;top:39.7%;width:23%;height:14.7%}
#gamePage .temple-menu-artboard .menu-active-perk-hotspot{left:56.4%;top:67.4%;width:23%;height:6.5%}
@media(max-width:700px){
 #gamePage .side-stack.temple-menu-artboard{width:min(96vw,calc(94vh * 1.5)) !important;max-height:94vh !important}
 #gamePage .temple-menu-artboard .menu-hotspot{border-radius:7px !important}
}

/* STAGE 42 — menu integration rebuilt on the untouched Stage 40 gameplay baseline. */
#gamePage #gameDrawer.temple-menu-pieces{
  position:fixed!important;left:50%!important;top:50%!important;right:auto!important;bottom:auto!important;
  display:flex!important;flex-direction:column!important;align-items:stretch!important;
  width:min(1120px,96vw,calc(90vh * 1.5))!important;height:auto!important;max-width:96vw!important;max-height:92vh!important;
  box-sizing:border-box!important;margin:0!important;padding:clamp(12px,2vw,24px)!important;
  gap:clamp(7px,1.15vw,13px)!important;overflow-y:auto!important;overflow-x:hidden!important;
  transform:translate(-50%,-50%) scale(.83)!important;opacity:0!important;visibility:hidden!important;pointer-events:none!important;
  border:2px solid #d69a3d!important;border-radius:22px!important;
  background:linear-gradient(145deg,#58351d 0%,#2b1a10 75%,#1c120c 100%)!important;
  box-shadow:0 0 0 4px #28170d,0 0 0 6px #e6b65e,0 18px 55px #000b!important;
  transition:transform .22s ease,opacity .22s ease,visibility .22s ease!important;z-index:100!important;
}
#gamePage #gameDrawer.temple-menu-pieces.drawer-open{
  transform:translate(-50%,-50%) scale(.86)!important;opacity:1!important;visibility:visible!important;pointer-events:auto!important;
}
#gamePage .temple-menu-topline{position:relative;display:flex;align-items:center;justify-content:center;min-height:clamp(82px,14vw,150px);flex:0 0 auto}
#gamePage .temple-menu-header-piece{display:block;width:min(72%,780px);height:auto;max-height:clamp(90px,15vw,165px);object-fit:contain;user-select:none;pointer-events:none}
#gamePage .menu-image-button{appearance:none!important;-webkit-appearance:none!important;background:transparent!important;border:0!important;box-shadow:none!important;padding:0!important;margin:0!important;min-width:0!important;min-height:0!important;display:block!important;cursor:pointer!important;line-height:0!important;border-radius:12px!important;overflow:visible!important}
#gamePage .menu-image-button img{display:block;width:100%;height:auto;object-fit:contain;user-select:none;pointer-events:none;transition:filter .16s ease,transform .16s ease}
#gamePage .menu-image-button:hover img{filter:brightness(1.12) drop-shadow(0 3px 4px #ffcf5c88);transform:translateY(-2px)}
#gamePage .menu-image-button:active img{transform:translateY(1px) scale(.985)}
#gamePage .menu-image-button:focus-visible{outline:3px solid #ffe39a!important;outline-offset:3px!important}
#gamePage .menu-close-button{position:absolute!important;right:0;top:0;width:clamp(52px,7.5vw,88px);z-index:2}
#gamePage .temple-menu-nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:center;gap:clamp(4px,.8vw,10px);flex:0 0 auto}
#gamePage .temple-menu-nav .menu-image-button{width:100%}
#gamePage .temple-menu-info-grid{display:grid;grid-template-columns:1fr 1fr;gap:clamp(5px,.8vw,10px);align-items:stretch;flex:0 0 auto}
#gamePage .temple-menu-info-grid>img,#gamePage .menu-blessing-panel>img,#gamePage .temple-menu-quick-guide{display:block;width:100%;height:auto;object-fit:contain;user-select:none;pointer-events:none}
#gamePage .menu-blessing-panel{position:relative;min-width:0}
#gamePage .menu-active-perk-button{position:absolute!important;left:17%;top:66%;width:66%;height:25%}
#gamePage .temple-menu-quick-guide{flex:0 0 auto}
#gamePage .drawer-scrim{z-index:90!important}
@media(max-width:560px){
 #gamePage #gameDrawer.temple-menu-pieces{width:96vw!important;max-height:94vh!important;padding:10px!important;gap:7px!important;border-radius:14px!important}
 #gamePage .temple-menu-topline{min-height:64px}
 #gamePage .temple-menu-header-piece{width:78%;max-height:95px}
 #gamePage .menu-close-button{width:48px}
 #gamePage .temple-menu-nav{gap:3px}
 #gamePage .temple-menu-info-grid{gap:3px}
}

/* ================================================================
   STAGE 47 — Main Menu layout, native background ratio, unified buttons
   ================================================================ */
html,body{min-height:100%;margin:0;}
.wrap{width:100%;max-width:none;min-height:100vh;padding:0;}
.topbar{display:none!important;}
main{width:100%;max-width:none;margin:0;padding:0;}
.page.main-menu-page,.page.adventure-map-page{display:none;}
.page.main-menu-page.active,.page.adventure-map-page.active{display:block!important;}
.main-menu-page,.adventure-map-page{width:100vw;height:100vh;min-height:560px;overflow:hidden;background:#183a37;}
.main-menu-scene,.adventure-map-scene{position:relative;width:100%;height:100%;overflow:hidden;isolation:isolate;}
/* Preserve the original 1670×941 artwork ratio; letterbox rather than stretch. */
.main-menu-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;object-position:center;z-index:-2;}
/* The supplied leafy parchment is the actual tagline panel. */
.main-menu-tagline{position:absolute;left:1.2%;top:1.2%;width:29%;aspect-ratio:2/1;display:grid;place-items:center;z-index:3;transform:rotate(-1deg);}
.main-menu-tagline>img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;}
.main-menu-tagline>span{position:relative;z-index:1;width:74%;margin-left:4%;margin-top:-1%;text-align:center;color:#48240f;font:900 clamp(15px,1.55vw,27px)/1.18 Georgia,'Times New Roman',serif;text-shadow:0 1px 0 #fff0c5;}
.main-menu-roo{position:absolute;left:1.8%;bottom:14%;height:61%;width:44%;object-fit:contain;object-position:left bottom;filter:drop-shadow(0 10px 10px #24170d88);z-index:1;}
/* Larger title logo, centered over the button column. */
.main-menu-logo{position:absolute;right:3.2%;top:.5%;width:30%;height:27%;object-fit:contain;object-position:center;z-index:3;}
.main-menu-actions{position:absolute;right:4.2%;top:28%;width:23.5%;height:57%;display:flex;flex-direction:column;justify-content:space-between;gap:1.2%;z-index:4;}
.main-menu-button{position:relative;display:block;flex:1 1 0;min-height:0;min-width:0;width:100%;padding:0;border:0;background:transparent;cursor:pointer;isolation:isolate;}
.main-menu-button img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;object-position:center;pointer-events:none;}
.main-menu-button span{position:absolute;left:24%;right:5%;top:50%;transform:translateY(-50%);font-family:Georgia,'Times New Roman',serif;font-size:clamp(12px,1.12vw,19px);font-weight:900;letter-spacing:.01em;line-height:1.05;color:#51280f;text-shadow:0 1px 0 #ffe9a2,1px 2px 2px #f5d078;text-align:center;white-space:nowrap;pointer-events:none;}
.main-menu-button:hover:not(:disabled){filter:brightness(1.1) drop-shadow(0 0 8px #ffd35b99);transform:translateY(-1px);}
.main-menu-button:active:not(:disabled){transform:scale(.985);}
.main-menu-button:disabled{cursor:not-allowed;filter:brightness(.48) saturate(.55);}
.main-menu-button:disabled span{color:#80694b;text-shadow:none;}
.continue-hint{position:absolute;right:0;bottom:-6%;width:100%;text-align:center;color:#fff0c5;font:600 clamp(9px,.72vw,12px) Georgia,serif;text-shadow:0 2px 3px #251306;}
.main-menu-stats{position:absolute;left:25%;width:49%;bottom:.8%;height:auto;aspect-ratio:5.12/1;z-index:5;}
.main-menu-stats>img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;}
.main-menu-stat{position:absolute;top:30%;height:55%;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#ffe9a8;text-shadow:0 2px 3px #1e0e05;}
.main-menu-stat.coin-stat{left:17%;width:14%;}.main-menu-stat.relic-stat{left:50%;width:14%;}.main-menu-stat.solved-stat{left:83%;width:14%;}
.main-menu-stat small{font:900 clamp(8px,.72vw,12px) Georgia,serif;letter-spacing:.04em;white-space:nowrap;}.main-menu-stat strong{font:900 clamp(15px,1.35vw,23px) Georgia,serif;color:#fff4c7;}

/* The supplied parchment map is a complete screen image with its own Back art. */
.adventure-map-art{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;object-position:center;background:#25170f;}
.map-hotspot{position:absolute;border:0;background:transparent;cursor:pointer;border-radius:18px;z-index:2;}
.map-hotspot:hover{outline:3px solid #ffe08a;box-shadow:0 0 24px #ffd04b99;background:#ffdc4b18;}
/* Hotspots sit over the four parchment temple plaques in the new map. */
.map-pharaoh{left:7%;top:51%;width:23%;height:17%;}
.map-petra{left:28%;top:38%;width:23%;height:17%;}
.map-babylon{left:51%;top:47%;width:24%;height:18%;}
.map-solomon{left:75%;top:41%;width:23%;height:17%;}
/* Transparent hit area over the Back button already painted into the map. */
.map-back{position:absolute;left:1%;bottom:2%;width:17%;height:15%;z-index:5;
 padding:0;border:0;background:transparent;cursor:pointer;}
@media(max-width:900px){
 .main-menu-tagline{left:1%;top:1%;width:30%;}
 .main-menu-tagline>span{font-size:clamp(12px,1.7vw,18px);}
 .main-menu-roo{left:.5%;bottom:14%;height:56%;width:47%;}
 .main-menu-logo{right:2%;top:1%;width:31%;height:24%;}
 .main-menu-actions{right:2%;top:26%;width:29%;height:59%;}
 .main-menu-button span{font-size:clamp(10px,1.35vw,15px);}
 .main-menu-stats{left:22%;width:56%;bottom:1%;aspect-ratio:5.12/1;}
}
@media(max-width:560px){
 .main-menu-page,.adventure-map-page{min-height:480px;}
 .main-menu-tagline{width:32%;}
 .main-menu-tagline>span{font-size:11px;}
 .main-menu-roo{height:47%;width:47%;bottom:17%;}
 .main-menu-logo{width:33%;height:21%;right:1%;}
 .main-menu-actions{width:34%;right:1%;top:23%;height:60%;}
 .main-menu-button span{font-size:10px;left:22%;right:3%;}
 .main-menu-stats{left:18%;width:64%;bottom:1%;aspect-ratio:5.12/1;}
 .main-menu-stat small{font-size:7px;}.main-menu-stat strong{font-size:12px;}
 .map-back{width:20%;height:14%;}
}


/* STAGE 48 — Main menu asset proportion and statistics panel refinement */
.main-menu-bg{
  object-fit:contain;
  object-position:center;
}
.main-menu-button img{
  object-fit:contain;
  object-position:center;
}
.main-menu-button span{
  left:25%;
  right:5%;
  font-size:clamp(13px,1.25vw,21px);
  letter-spacing:0;
  white-space:nowrap;
}
.main-menu-logo{
  width:33%;
  height:29%;
  right:2.5%;
  top:.2%;
}
.main-menu-actions{
  right:3.8%;
  width:24%;
  top:28.5%;
  height:55%;
  gap:1%;
}
.main-menu-stats{
  left:24%;
  width:52%;
  bottom:1.2%;
  aspect-ratio:4.9/1;
}
.main-menu-stats>img{object-fit:contain;}
.main-menu-stat.coin-stat{left:17%;width:14%;}
.main-menu-stat.relic-stat{left:50%;width:14%;}
.main-menu-stat.solved-stat{left:83%;width:14%;}
.main-menu-stat{top:30%;height:55%;}
.main-menu-stat small{font-size:clamp(9px,.78vw,13px);}
.main-menu-stat strong{font-size:clamp(16px,1.45vw,24px);}
@media(max-width:900px){
  .main-menu-button span{font-size:clamp(10px,1.35vw,16px);}
  .main-menu-logo{width:31%;height:27%;}
}


/* STAGE 49 — Main Menu asset replacement and centered floating adventure map */
.main-menu-actions{
  top:28%;
  right:3.8%;
  width:25%;
  height:51%;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:1.2%;
  z-index:5;
}
.main-menu-button{
  flex:1 1 0;
  min-height:0;
  width:100%;
}
.main-menu-button img{
  object-fit:contain;
  object-position:center;
}
.main-menu-button.primary-adventure-button{
  flex:1.35 1 0;
}
.main-menu-button span{
  left:25%;
  right:4%;
  font-size:clamp(13px,1.2vw,21px);
  white-space:nowrap;
}
.main-menu-button:not(.primary-adventure-button) span{
  font-size:clamp(12px,1.05vw,18px);
}
.main-menu-button.is-continue{
  filter:drop-shadow(0 0 7px #ffd05b55);
}
.main-menu-stats{
  left:24%;
  width:52%;
  bottom:1%;
  aspect-ratio:4.9/1;
  z-index:3;
}
.main-menu-tagline>img{
  /* The parchment PNG has its outer neutral background removed; retain its art. */
  object-fit:contain;
}
.floating-map-overlay{
  position:absolute;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  z-index:100;
}
.floating-map-overlay.is-open{display:flex;}
.floating-map-dim{
  position:absolute;
  inset:0;
  background:rgba(8,17,18,.72);
  backdrop-filter:blur(3px);
}
.floating-map-frame{
  position:relative;
  width:min(91%,1420px);
  height:min(88%,820px);
  aspect-ratio:1672/941;
  z-index:1;
  filter:drop-shadow(0 18px 28px rgba(0,0,0,.65));
}
.adventure-map-art{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:contain;
  background:transparent;
}
.floating-map-frame .map-hotspot{z-index:3;}
.floating-map-close{
  position:absolute;
  z-index:5;
  top:1.5%;
  right:1.2%;
  width:4.5%;
  aspect-ratio:1;
  border:3px solid #4a210d;
  border-radius:50%;
  background:linear-gradient(#ffe9a0,#d8891c);
  color:#54270b;
  font:bold clamp(16px,2vw,30px) Georgia,serif;
  cursor:pointer;
  box-shadow:0 3px 8px #160b06aa;
}
.floating-map-close:hover{filter:brightness(1.15);}
@media(max-width:900px){
 .main-menu-actions{right:2%;top:27%;width:29%;height:52%;}
 .main-menu-button span{font-size:clamp(10px,1.35vw,16px);}
 .main-menu-button:not(.primary-adventure-button) span{font-size:clamp(10px,1.15vw,15px);}
 .main-menu-stats{left:20%;width:58%;}
 .floating-map-frame{width:96%;height:auto;max-height:84%;}
}
@media(max-width:560px){
 .main-menu-actions{right:1%;top:25%;width:35%;height:55%;}
 .main-menu-stats{left:14%;width:72%;}
 .floating-map-frame{width:98%;height:auto;max-height:78%;}
 .floating-map-close{width:7%;border-width:2px;}
}


/* STAGE 50 — Fixed 16:9 stage so art and overlays line up like the target */
.main-menu-page{display:none;}
.main-menu-page.active{display:flex!important;align-items:center;justify-content:center;}
.main-menu-scene{
  flex:none;
  width:min(100vw,calc(100vh * 1670 / 941));
  height:min(100vh,calc(100vw * 941 / 1670));
  min-height:0;
  container-type:inline-size;
}
.main-menu-bg{object-fit:fill;}
.main-menu-tagline{left:5.5%;top:1.2%;width:25%;aspect-ratio:2/1;transform:rotate(-2deg);}
.main-menu-tagline>span{font-size:clamp(13px,2.05cqw,34px);width:72%;}
.main-menu-roo{left:1%;bottom:2%;height:76%;width:48%;}
.main-menu-logo{right:3.5%;top:.5%;width:46%;height:36%;}
.main-menu-actions{right:9%;top:35%;width:32.5%;height:49%;gap:1.6%;}
.main-menu-button.primary-adventure-button{flex:1.25 1 0;}
.main-menu-button span,
.main-menu-button:not(.primary-adventure-button) span{
  left:26%;right:6%;
  font-size:clamp(14px,2.2cqw,38px);
  letter-spacing:0;
  text-transform:capitalize;
}
.main-menu-stats{left:22%;width:56%;bottom:.8%;}
.main-menu-stat small{font-size:clamp(9px,1.5cqw,26px);text-transform:capitalize;white-space:nowrap;}
.main-menu-stat strong{font-size:clamp(16px,2.6cqw,44px);}
.main-menu-stat.solved-stat{left:82%;width:16%;}
.main-menu-stat.solved-stat small{white-space:normal;text-align:center;line-height:1.05;}
.main-menu-page.active{display:flex!important;align-items:center;justify-content:center;}
.main-menu-actions{top:33%;height:44%;gap:1.2%;}
.main-menu-button span,
.main-menu-button:not(.primary-adventure-button) span{left:27%;right:7%;font-size:clamp(13px,1.85cqw,32px);}
.main-menu-stats{left:23%;width:54%;bottom:.6%;}
.main-menu-stat small{font-size:clamp(9px,1.35cqw,23px);}
.main-menu-stat strong{font-size:clamp(16px,2.3cqw,40px);}
.main-menu-stat.coin-stat{left:20%;}
.main-menu-stat.relic-stat{left:50%;}
.main-menu-stat.solved-stat{left:80%;width:17%;}
.page.main-menu-page.active{display:flex!important;align-items:center;justify-content:center;}
.main-menu-scene{margin:auto;}
.main-menu-button span,
.main-menu-button:not(.primary-adventure-button) span{left:26%;right:9%;font-size:clamp(12px,1.6cqw,28px);}

/* STAGE 51 — Match target menu hierarchy: large primary, compact secondary stack, larger title */
.main-menu-logo{
  right:2.8%;
  top:0%;
  width:49%;
  height:38%;
  object-fit:contain;
  object-position:center;
}
.main-menu-actions{
  right:7.5%;
  top:32.5%;
  width:34%;
  height:47%;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:.45%;
}
.main-menu-button{
  flex:0.86 1 0;
  min-height:0;
  width:100%;
}
.main-menu-button.primary-adventure-button{
  flex:1.42 1 0;
}
.main-menu-button img{
  object-fit:contain;
  object-position:center;
}
.main-menu-button span{
  left:26%;
  right:7%;
  font-size:clamp(13px,1.75cqw,30px);
  line-height:1.02;
  white-space:nowrap;
  text-align:center;
}
.main-menu-button:not(.primary-adventure-button) span{
  font-size:clamp(12px,1.5cqw,26px);
}
@media(max-width:900px){
  .main-menu-logo{width:48%;height:36%;}
  .main-menu-actions{right:5%;width:36%;top:32%;height:48%;gap:.5%;}
}
@media(max-width:560px){
  .main-menu-logo{width:47%;height:33%;}
  .main-menu-actions{right:3%;width:39%;top:30%;height:50%;gap:.6%;}
  .main-menu-button span{left:25%;right:5%;font-size:clamp(11px,1.8cqw,18px);}
  .main-menu-button:not(.primary-adventure-button) span{font-size:clamp(10px,1.55cqw,16px);}
}


/* STAGE 52 — Primary/secondary button scale and statistics panel typography */
/* Preserve the Stage 51 layout while scaling the visible button artwork. */
.main-menu-button.primary-adventure-button{
  transform:scale(1.2);
  transform-origin:center;
  z-index:2;
}
.main-menu-button:not(.primary-adventure-button){
  /* 80% of the enlarged Start/Continue Adventure button (1.2 × 0.8 = 0.96). */
  transform:scale(.96);
  transform-origin:center;
}
/* Reduce the tagline lettering so the approved two-line wording fits its parchment. */
.main-menu-tagline>span{
  font-size:clamp(10px,1.5cqw,25px);
  line-height:1.08;
  width:78%;
}
/* Enlarge both the statistic labels and their live values. */
.main-menu-stat small{
  font-size:clamp(11px,1.65cqw,28px);
}
.main-menu-stat strong{
  color:#ffe36a;
  font-size:clamp(19px,2.8cqw,48px);
  text-shadow:0 2px 2px #3b1b08, 0 0 3px #8b4c08;
}
/* Shift the Puzzles Solved group inward from the panel's right edge. */
.main-menu-stat.solved-stat{
  left:73%;
  width:20%;
}
.main-menu-stat.solved-stat small{
  text-align:center;
  line-height:1.02;
}


/* STAGE 54 — Secondary buttons at 90% of primary; enlarge tilted parchment lettering */
.main-menu-actions{
  top:27%;
  height:56%;
  gap:.35%;
}
.main-menu-button{
  flex:1.278 1 0;
}
.main-menu-button.primary-adventure-button{
  flex:1.42 1 0;
  transform:scale(1.2);
  transform-origin:center;
  z-index:2;
}
.main-menu-button:not(.primary-adventure-button){
  transform:scale(1.08);
  transform-origin:center;
}
.main-menu-tagline{
  transform:rotate(-2deg);
}
.main-menu-tagline>span{
  width:80%;
  font-size:clamp(13px,1.9cqw,31px);
  line-height:1.08;
  transform:rotate(0deg);
}


/* STAGE 55 — Match the "Jungle Adventure" reference layout (16:9 scene, all values are % of the scene)
   Roo is a separate asset: he stands on the stone slab at the bottom-left of the background. */
.main-menu-roo{
  left:2.6%;
  bottom:15%;
  width:48%;
  height:auto;
  aspect-ratio:1311/1024;
  object-fit:contain;
  object-position:left bottom;
  z-index:1;
}
.main-menu-tagline{
  left:6.1%;
  top:0;
  width:24%;
  aspect-ratio:2/1;
  transform:rotate(-2deg);
}
.main-menu-logo{
  left:55.9%;
  right:auto;
  top:.2%;
  width:37.2%;
  height:36%;
  object-fit:contain;
  object-position:center;
  z-index:3;
}
/* Buttons: each box is the visible button art; the PNG is offset so its solid area fills the box. */
.main-menu-actions{
  position:absolute;
  inset:0;
  width:auto;
  height:auto;
  display:block;
  gap:0;
  pointer-events:none;
  z-index:4;
}
.main-menu-actions .main-menu-button{
  position:absolute;
  flex:none;
  width:26.9%;
  height:11.05%;
  left:61.35%;
  transform:none;
  pointer-events:auto;
}
.main-menu-actions .main-menu-button.primary-adventure-button{
  width:31.2%;
  height:13.18%;
  left:59.2%;
  top:35.07%;
  transform:none;
  z-index:2;
}
.main-menu-actions .main-menu-button:nth-of-type(2){top:49.32%;}
.main-menu-actions .main-menu-button:nth-of-type(3){top:60.58%;}
.main-menu-actions .main-menu-button:nth-of-type(4){top:71.95%;}
.main-menu-actions .main-menu-button img{
  position:absolute;
  inset:auto;
  object-fit:fill;
  max-width:none;
}
.main-menu-actions .main-menu-button:nth-of-type(1) img{width:102.6%;height:143.98%;left:-1.2%;top:-21.05%;}
.main-menu-actions .main-menu-button:nth-of-type(2) img{width:102.91%;height:148.05%;left:-1.41%;top:-23.38%;}
.main-menu-actions .main-menu-button:nth-of-type(3) img{width:103.17%;height:148.58%;left:-1.51%;top:-23.75%;}
.main-menu-actions .main-menu-button:nth-of-type(4) img{width:102.91%;height:148.58%;left:-1.41%;top:-23.75%;}
.main-menu-actions .main-menu-button span{
  left:28%;
  right:4%;
  font-size:clamp(12px,2.1cqw,36px);
}
.main-menu-actions .main-menu-button.primary-adventure-button span{
  font-size:clamp(13px,2.35cqw,40px);
}
.main-menu-actions .continue-hint{
  position:absolute;
  left:76.5%;
  top:83%;
  width:21%;
  text-align:center;
  pointer-events:none;
}
.main-menu-stats{
  left:29.2%;
  width:41.5%;
  bottom:1.2%;
  aspect-ratio:4.9/1;
  z-index:5;
}

/* STAGE 56 — Illustrated Difficulty Map with individual clickable temples */
.adventure-map-page{background:#203b31;}
.adventure-map-scene{background:radial-gradient(ellipse at 50% 48%,#42634a 0%,#1d352c 75%);}
.adventure-map-art{background:transparent;z-index:0;}
.map-destination{position:absolute;inset:0;z-index:2;pointer-events:none;}
.map-temple-button{position:absolute;display:block;padding:0;border:0;background:transparent;cursor:pointer;pointer-events:auto;transform-origin:center bottom;transition:transform .2s ease,filter .2s ease;filter:drop-shadow(0 5px 5px #2c160c66);}
.map-temple-button img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;user-select:none;}
.map-temple-button:hover,.map-temple-button:focus-visible{transform:translateY(-5px) scale(1.055);filter:drop-shadow(0 0 8px #ffdc65) drop-shadow(0 0 20px #ffb51b);outline:none;}
.map-temple-button:focus-visible{filter:drop-shadow(0 0 4px #fff2b5) drop-shadow(0 0 17px #ffbd32);}
.map-destination:has(.map-temple-button:hover) .map-tablet,.map-destination:has(.map-temple-button:focus-visible) .map-tablet{filter:brightness(1.12) drop-shadow(0 0 9px #ffcf4c);transform:translateY(-2px);}
.map-tablet{position:absolute;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;text-align:center;color:#59300f;text-shadow:0 1px 0 #fff0c5;transition:filter .2s ease,transform .2s ease;pointer-events:none;padding:1.1% 1.5%;}
.map-temple-name{font:900 clamp(9px,.88vw,15px)/1.05 Georgia,'Times New Roman',serif;letter-spacing:.025em;white-space:nowrap;max-width:100%;}
.map-difficulty{font:900 clamp(9px,.82vw,14px)/1.05 Georgia,'Times New Roman',serif;color:#8c3e0b;letter-spacing:.14em;}
.map-meta{font:700 clamp(7px,.63vw,11px)/1.1 Georgia,'Times New Roman',serif;white-space:nowrap;}
.map-progress{font:900 clamp(8px,.72vw,12px)/1.1 Georgia,'Times New Roman',serif;color:#62300c;}
.map-availability{font:900 clamp(6px,.52vw,9px)/1.1 Arial,sans-serif;letter-spacing:.07em;color:#8b4b13;white-space:nowrap;}
/* Temple illustrations sit on the four raised map platforms; tablet copy aligns with the parchment plaques. */
.map-destination-pharaoh .map-temple-button{left:8.4%;top:29.2%;width:15.8%;height:20.2%;}
.map-destination-pharaoh .map-tablet{left:7.7%;top:51.7%;width:18.2%;height:11.8%;}
.map-destination-petra .map-temple-button{left:28.8%;top:18.0%;width:16.2%;height:22.0%;}
.map-destination-petra .map-tablet{left:28.0%;top:41.0%;width:18.2%;height:11.8%;}
.map-destination-babylon .map-temple-button{left:51.2%;top:27.0%;width:16.5%;height:21.7%;}
.map-destination-babylon .map-tablet{left:51.0%;top:50.1%;width:18.2%;height:11.8%;}
.map-destination-solomon .map-temple-button{left:74.2%;top:20.0%;width:16.5%;height:21.8%;}
.map-destination-solomon .map-tablet{left:73.5%;top:42.0%;width:18.2%;height:11.8%;}
.map-back{position:absolute;left:2.4%;bottom:7.6%;width:16.5%;height:12.8%;z-index:6;padding:0;border:0;background:transparent;cursor:pointer;}
.map-back img{display:block;width:100%;height:100%;object-fit:contain;transition:filter .18s ease,transform .18s ease;}
.map-back:hover img,.map-back:focus-visible img{filter:brightness(1.15) drop-shadow(0 0 9px #ffcf58);transform:translateX(-2px);}
.map-back:focus-visible{outline:2px solid #ffdf81;outline-offset:3px;border-radius:14px;}
@media(max-width:900px){
 .map-temple-name{font-size:clamp(7px,1.05vw,11px)}
 .map-difficulty{font-size:clamp(7px,.95vw,10px)}
 .map-meta{font-size:clamp(6px,.72vw,8px)}
 .map-progress{font-size:clamp(7px,.82vw,9px)}
 .map-availability{font-size:clamp(5px,.62vw,7px)}
 .map-tablet{gap:1px;padding:1% .7%;}
}
@media(max-width:560px){
 .map-temple-name{font-size:clamp(5px,1.45vw,8px)}
 .map-difficulty{font-size:clamp(5px,1.2vw,7px)}
 .map-meta{font-size:clamp(4px,.95vw,6px)}
 .map-progress{font-size:clamp(5px,1.05vw,7px)}
 .map-availability{font-size:clamp(4px,.75vw,5px)}
 .map-back{left:2%;bottom:7%;width:18%;height:13%;}
}
@media(prefers-reduced-motion:reduce){.map-temple-button,.map-tablet,.map-back img{transition:none!important;}}

/* Stage 58 — compact difficulty tablets with the supplied relic-tier icons. */
.map-tablet{gap:3px;padding:.6% .8%;}
.map-temple-name{font:900 clamp(9px,.78vw,13px)/1.05 Georgia,'Times New Roman',serif;letter-spacing:.015em;white-space:nowrap;}
.map-difficulty{font:900 clamp(9px,.72vw,12px)/1.05 Georgia,'Times New Roman',serif;color:#8c3e0b;letter-spacing:.08em;}
.map-relic-progress{display:flex;align-items:center;justify-content:center;gap:5px;font:900 clamp(9px,.72vw,12px)/1 Georgia,'Times New Roman',serif;color:#62300c;}
.map-relic-progress img{display:block;width:clamp(18px,2.05vw,32px);height:clamp(18px,2.05vw,32px);object-fit:contain;filter:drop-shadow(0 1px 1px #6b3b17aa);}
@media(max-width:900px){.map-relic-progress{font-size:clamp(7px,.9vw,10px);gap:3px}.map-relic-progress img{width:clamp(14px,2.3vw,22px);height:clamp(14px,2.3vw,22px)}}
@media(max-width:560px){.map-temple-name{font-size:clamp(6px,1.25vw,8px)}.map-difficulty{font-size:clamp(6px,1.1vw,8px)}.map-relic-progress{font-size:clamp(6px,1.05vw,8px);gap:2px}.map-relic-progress img{width:clamp(12px,2.5vw,17px);height:clamp(12px,2.5vw,17px)}}


/* Stage 59 — map text aligned to the baked-in plaques */
/* Stage keeps art + overlays in the art's own 1661x947 box, so percentages never drift when the window is not 16:9 */
.adventure-map-scene{container-type:size;display:flex;align-items:center;justify-content:center;}
.map-stage{container-type:inline-size;position:relative;flex:none;width:min(100vw,calc(100vh * 1661 / 947));aspect-ratio:1661/947;width:min(100cqw,calc(100cqh * 1661 / 947));}
.map-stage .adventure-map-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;}
/* plaque rectangles measured from adventure_map.webp (percent of art) */
.map-destination-pharaoh .map-tablet{left:8.2%;top:54.1%;width:17.3%;height:10.7%;}
.map-destination-petra .map-tablet{left:29.0%;top:41.4%;width:17.3%;height:10.8%;}
.map-destination-babylon .map-tablet{left:52.3%;top:50.4%;width:17.0%;height:11.0%;}
.map-destination-solomon .map-tablet{left:75.3%;top:45.3%;width:16.4%;height:11.4%;}
/* icon left, text right, text scales with the plaque (cqw/cqh) */
.map-tablet{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:.5cqw;padding:0 1.3cqw 0 1.6cqw;box-sizing:border-box;text-align:left;}
.map-relic-icon{flex:0 0 3.4cqw;width:3.4cqw;height:auto;max-height:80%;object-fit:contain;filter:drop-shadow(0 1px 1px #6b3b17aa);}
.map-tablet-text{flex:1 1 0;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:4%;min-width:0;}
.map-tablet .map-temple-name{font:900 clamp(7px,1.24cqw,19px)/1.05 Georgia,'Times New Roman',serif;letter-spacing:.01em;white-space:nowrap;}
.map-tablet .map-difficulty{font:900 clamp(6px,1.08cqw,16px)/1.05 Georgia,'Times New Roman',serif;letter-spacing:.14em;text-transform:uppercase;color:var(--tier,#8c3e0b);text-shadow:0 1px 0 #fff0c5;}
.map-progress-row{display:flex;align-items:center;gap:6%;width:100%;}
.map-bar{flex:1;height:clamp(4px,.7cqw,10px);min-height:4px;border-radius:99px;background:#6b3b1740;box-shadow:inset 0 0 0 1px #6b3b1766;overflow:hidden;}
.map-bar i{display:block;height:100%;width:0;background:var(--tier,#8c3e0b);transition:width .4s ease;}
.map-progress-count{font:900 clamp(6px,.98cqw,15px)/1 Georgia,'Times New Roman',serif;color:#62300c;white-space:nowrap;}
.tier-1{--tier:#2b6f9e}.tier-2{--tier:#a3261a}.tier-3{--tier:#2f7a2a}.tier-4{--tier:#7a2c93}
@media(prefers-reduced-motion:reduce){.map-bar i{transition:none}}

/* Stage 59b — name breathing room + temple sprite nudges */
.map-tablet{padding-right:1.9cqw;gap:.4cqw;}
.map-relic-icon{flex-basis:3.1cqw;width:3.1cqw;}
.map-tablet .map-temple-name{font-size:clamp(7px,1.1cqw,17px);letter-spacing:0;}
.map-destination-pharaoh .map-temple-button{top:31.6%;}   /* was 29.2% — moved forward toward the cliff edge */
.map-destination-solomon .map-temple-button{left:76.4%;} /* was 74.2% — moved right onto the platform */


/* Stage 60 — Petra Sanctuary door slabs. The supplied mirrored camel reliefs
   use a 1323 x 1189 canvas; preserve their native proportions and align the
   inner edges and bottom baseline to the shared doorway/floor coordinates. */
#gamePage .scene[data-temple-theme="petra"] .roo-stage .slab{--slab-k:.43}
#gamePage .scene[data-temple-theme="petra"] .roo-stage .slab.left{
  width:calc(1323 * var(--slab-k) * 100% / var(--W));
  left:calc((var(--cx) - var(--gap) - 1286 * var(--slab-k)) * 100% / var(--W));
  top:calc((var(--floor) - 1189 * var(--slab-k)) * 100% / var(--H));
}
#gamePage .scene[data-temple-theme="petra"] .roo-stage .slab.right{
  width:calc(1323 * var(--slab-k) * 100% / var(--W));
  left:calc((var(--cx) + var(--gap)) * 100% / var(--W));
  top:calc((var(--floor) - 1189 * var(--slab-k)) * 100% / var(--H));
}


/* Stage 62 — temple-specific relief slabs (Petra, Babylon, Solomon).
   All supplied relief pairs use a 1323 x 1189 canvas and share the same
   doorway anchors so the existing mistake-driven slide animation is retained. */
#gamePage .scene[data-temple-theme="petra"] .roo-stage .slab,
#gamePage .scene[data-temple-theme="babylon"] .roo-stage .slab,
#gamePage .scene[data-temple-theme="solomon"] .roo-stage .slab{--slab-k:.43}
#gamePage .scene[data-temple-theme="petra"] .roo-stage .slab.left,
#gamePage .scene[data-temple-theme="babylon"] .roo-stage .slab.left,
#gamePage .scene[data-temple-theme="solomon"] .roo-stage .slab.left{
  width:calc(1323 * var(--slab-k) * 100% / var(--W));
  left:calc((var(--cx) - var(--gap) - 1286 * var(--slab-k)) * 100% / var(--W));
  top:calc((var(--floor) - 1189 * var(--slab-k)) * 100% / var(--H));
}
#gamePage .scene[data-temple-theme="petra"] .roo-stage .slab.right,
#gamePage .scene[data-temple-theme="babylon"] .roo-stage .slab.right,
#gamePage .scene[data-temple-theme="solomon"] .roo-stage .slab.right{
  width:calc(1323 * var(--slab-k) * 100% / var(--W));
  left:calc((var(--cx) + var(--gap)) * 100% / var(--W));
  top:calc((var(--floor) - 1189 * var(--slab-k)) * 100% / var(--H));
}


/* =====================================================================
   STAGE 71 — FLAT PARCHMENT CLUE CONTROLS
   Keep the existing buttons and handlers; restyle and place them directly
   beneath the question/clue. The controls remain side-by-side with a
   vertical divider and a quiet gold underline.
   ===================================================================== */
#gamePage .scene .top-info-copy{
  justify-content:center !important;
  gap:clamp(3px,.42cqw,7px) !important;
}
#gamePage .scene .top-info-copy .info-body{
  flex:0 1 auto !important;
  min-height:0;
  width:100%;
  padding:0 1% clamp(2px,.22cqw,4px);
}
#gamePage .scene .top-info-copy .info-actions{
  position:relative;
  display:flex;
  flex:0 0 auto;
  align-self:stretch;
  justify-content:stretch;
  align-items:stretch;
  gap:0;
  margin:0 auto;
  padding:0 0 clamp(3px,.35cqw,5px);
  width:min(100%, 520px);
}
#gamePage .scene .top-info-copy .info-actions::after{
  content:"";
  position:absolute;
  left:14%;
  right:14%;
  bottom:0;
  height:1px;
  background:linear-gradient(90deg,transparent,#b98a45 18%,#d0a65e 50%,#b98a45 82%,transparent);
  opacity:.72;
  pointer-events:none;
}
#gamePage .scene .info-btn{
  flex:1 1 50%;
  width:50%;
  max-width:50%;
  min-width:0;
  height:auto;
  min-height:clamp(19px,2.2cqw,30px);
  padding:clamp(2px,.3cqw,4px) clamp(4px,.65cqw,9px);
  border:0;
  border-radius:0;
  background:linear-gradient(180deg,#fff7dfaa 0%,#ead09a55 100%);
  color:#654018;
  box-shadow:none;
  font:800 clamp(7px,.86cqw,12px)/1.12 Inter,system-ui,sans-serif;
  letter-spacing:.055em;
  text-align:center;
  white-space:normal;
  text-shadow:0 1px 0 #fff7df;
  transform:none;
}
#gamePage .scene .info-btn + .info-btn{
  border-left:1px solid #a97835a8;
}
#gamePage .scene .info-btn:hover:not(:disabled){
  background:linear-gradient(180deg,#fff9e8 0%,#f0d9a8aa 100%);
  color:#3f260f;
  filter:none;
  transform:none;
}
#gamePage .scene .info-btn:disabled{
  opacity:.55;
  background:transparent;
}
#gamePage .scene .info-btn .info-ico{
  width:1em;
  height:1em;
}
#gamePage .scene .info-btn .info-label{
  overflow:visible;
  text-overflow:clip;
}
#gamePage .scene .info-btn .info-price{
  padding:0;
  border-radius:0;
  background:transparent;
  color:#80551f;
  font-size:.82em;
}

/* The phone layout uses the same two-control parchment strip. */
@media(max-width:700px){
  #gamePage .info-card .top-info-copy{
    justify-content:center !important;
    gap:7px !important;
  }
  #gamePage .info-card .info-body{
    min-height:0;
    height:auto;
    flex:0 1 auto;
    padding-bottom:2px;
  }
  #gamePage .info-card .info-actions{
    flex-direction:row;
    gap:0;
    width:100%;
    padding-bottom:5px;
  }
  #gamePage .info-card .info-btn{
    flex:1 1 50%;
    width:50%;
    max-width:50%;
    min-height:34px;
    height:auto;
    padding:6px 5px;
    font-size:10px;
    border-radius:0;
  }
}

/* Stage 72 — distinct victory, defeat, and saved-puzzle presentation */
#modalRoot .result-modal--win{position:relative;overflow:hidden;border-color:#d7a43f;background:linear-gradient(160deg,#fff9e8 0%,#fff0c9 52%,#f8dfa0 100%);box-shadow:0 25px 90px #0008,0 0 0 3px #e7bf6a55}
#modalRoot .result-modal--win>h2{color:#8b5b13;text-align:center;font-size:30px}
#modalRoot .result-modal--win>.modal-sub{text-align:center;color:#8a672e}
#modalRoot .result-modal--win .result-banner{position:relative;z-index:1;background:linear-gradient(135deg,#ffe7a1,#f5c65e 52%,#ffeab0);border:1px solid #d9a33c;box-shadow:inset 0 1px #fff9,0 5px 18px #a56b2525}
#modalRoot .result-modal--win .result-banner h3{color:#70430b}
#modalRoot .result-modal--win .result-answer{color:#583a12;font-weight:900}
#modalRoot .result-modal--loss{border-color:#77736a;background:linear-gradient(160deg,#f2eee5,#e2ddd2);box-shadow:0 25px 80px #0008,inset 0 0 35px #4a40351a}
#modalRoot .result-modal--loss>h2{color:#514b43}
#modalRoot .result-modal--loss>.modal-sub{color:#756d62}
#modalRoot .result-modal--loss .result-banner{background:linear-gradient(135deg,#d9d1c3,#bdb4a6);border:1px solid #a69b8a}
#modalRoot .result-modal--loss .result-banner h3{color:#51483d}
#modalRoot .result-modal--pass .result-banner{background:linear-gradient(135deg,#e6eadb,#cbd6b8)}
.victory-particles{position:absolute;inset:0 0 auto;height:210px;pointer-events:none;overflow:hidden;z-index:2}
.victory-particles i{position:absolute;left:var(--x);top:-18px;width:8px;height:13px;border-radius:2px;background:hsl(calc(var(--i)*29),78%,52%);opacity:0;transform:rotate(var(--rot));animation:hangaroo-confetti 2.6s cubic-bezier(.15,.65,.35,1) var(--delay) forwards}
.victory-particles i:nth-child(3n){width:11px;height:7px;border-radius:50%}
.victory-particles i:nth-child(4n){width:10px;height:14px;border-radius:80% 0 80% 0;background:#c99a35}
@keyframes hangaroo-confetti{0%{opacity:0;transform:translate3d(0,-15px,0) rotate(0deg)}12%{opacity:1}100%{opacity:0;transform:translate3d(calc((var(--i) - 17)*2px),230px,0) rotate(680deg)}}
@media(prefers-reduced-motion:reduce){.victory-particles i{animation:none;display:none}}

/* Stage 73 — immersive split victory scene: Mr. Roo + live parchment content */
#modalRoot .modal.result-modal--win{width:min(1120px,96vw);max-height:94vh;padding:0;border:3px solid #bd8b36;border-radius:22px;background:linear-gradient(135deg,#5a351c,#9b682b 24%,#e9c77d 25%,#fff0c7 70%,#9b682b);box-shadow:0 28px 100px #000b,0 0 0 3px #f4d58b55;overflow:hidden}
#modalRoot .result-modal--win .victory-scene{display:grid;grid-template-columns:minmax(260px,36%) minmax(0,1fr);min-height:620px;max-height:94vh;gap:0;background:radial-gradient(ellipse at 20% 45%,#b97928 0%,#50351f 55%,#211d16 100%)}
#modalRoot .result-modal--win .victory-roo-stage{position:relative;display:flex;align-items:flex-end;justify-content:center;min-height:600px;padding:24px 6px 20px;overflow:hidden;background:radial-gradient(ellipse at 50% 65%,#f7c45d55,transparent 58%),linear-gradient(180deg,#3c3324aa,#201c16cc)}
#modalRoot .result-modal--win .victory-roo-stage:before{content:"";position:absolute;inset:auto 7% 5%;height:18%;border-radius:50%;background:#f7c45d33;filter:blur(24px)}
#modalRoot .result-modal--win .victory-roo-stage img{position:relative;z-index:1;width:100%;height:100%;max-height:580px;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 14px 18px #0009);animation:roo-victory-arrive .65s cubic-bezier(.2,.8,.2,1) both}
#modalRoot .result-modal--win .victory-roo-caption{position:absolute;z-index:2;bottom:12px;left:10px;right:10px;text-align:center;color:#ffe7a8;font:italic 15px Georgia,serif;text-shadow:0 2px 5px #241508}
#modalRoot .result-modal--win .victory-parchment{position:relative;align-self:stretch;margin:14px 14px 14px 0;padding:25px 30px 22px;border:5px solid #c18a36;border-radius:15px;background:radial-gradient(ellipse at 50% 0%,#fffbe8,#f6e3b5 75%,#e9c987);box-shadow:inset 0 0 0 2px #fff8d5,inset 0 0 35px #9d6a2825,0 12px 30px #0006;overflow-y:auto;color:#44301b}
#modalRoot .result-modal--win .victory-parchment:before,#modalRoot .result-modal--win .victory-parchment:after{content:"";position:absolute;left:10px;right:10px;height:5px;border-radius:50%;background:linear-gradient(90deg,#a66a24,#f4d47d,#a66a24);opacity:.8;pointer-events:none}
#modalRoot .result-modal--win .victory-parchment:before{top:7px}#modalRoot .result-modal--win .victory-parchment:after{bottom:7px}
#modalRoot .result-modal--win .victory-heading{text-align:center;margin-bottom:12px}
#modalRoot .result-modal--win .victory-heading h2{margin:0;color:#8b4e12;font:700 clamp(25px,3vw,36px) Georgia,serif;text-shadow:0 1px #fff}
#modalRoot .result-modal--win .victory-heading p{margin:5px 0 0;color:#7b592e;font-size:12px}
#modalRoot .result-modal--win .result-banner{margin:10px 0 12px;padding:10px;border:1px solid #d7a03a;border-radius:11px;background:linear-gradient(135deg,#ffe7a1,#f5c65e 52%,#ffeab0);box-shadow:inset 0 1px #fff9,0 5px 18px #a56b2525}
#modalRoot .result-modal--win .result-banner h3{color:#70430b;font-size:11px}
#modalRoot .result-modal--win .result-answer{font-size:clamp(28px,3.4vw,42px);color:#583a12;font-weight:900}
#modalRoot .result-modal--win .reveal-content{gap:8px}
#modalRoot .result-modal--win .reveal-clue{padding:10px 13px;background:#fff8e9;border-left:4px solid #a85d26;border-radius:9px;font-size:14px}
#modalRoot .result-modal--win .education{padding:11px 13px;background:#f4ead2;border:1px solid #ddc18a}
#modalRoot .result-modal--win .education h4{color:#95601e}
#modalRoot .result-modal--win .victory-section-label{margin:2px 0 7px;color:#94601f;font-size:10px;letter-spacing:.14em;text-transform:uppercase}
#modalRoot .result-modal--win .references a{background:#f0dfb9;border:1px solid #ddbd7b;text-decoration:none}
#modalRoot .result-modal--win .victory-reward-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:12px;padding:11px 14px;border:2px solid #a95b16;border-radius:10px;background:linear-gradient(90deg,#8e2e12,#bd5b1a,#81250f);color:#fff2bf;box-shadow:inset 0 1px #ffdc8b}
#modalRoot .result-modal--win .victory-reward-bar span{font-weight:800;font-size:13px}
#modalRoot .result-modal--win .victory-reward-bar strong{color:#ffe37a;font:800 14px Georgia,serif;text-align:right}
#modalRoot .result-modal--win .modal-actions{margin-top:13px;justify-content:space-between}
#modalRoot .result-modal--win .modal-actions button{border-radius:10px;font-weight:800}
#modalRoot .result-modal--win .modal-actions .primary{background:linear-gradient(135deg,#a52d13,#d66b1b);border-color:#8e3e12;color:#fff4d1}
#modalRoot .result-modal--win .victory-particles{height:100%;position:absolute;inset:0;z-index:4}
@keyframes roo-victory-arrive{from{opacity:0;transform:translateY(24px) scale(.94)}to{opacity:1;transform:translateY(0) scale(1)}}
@media(max-width:760px){#modalRoot .modal.result-modal--win{width:min(96vw,620px)}#modalRoot .result-modal--win .victory-scene{grid-template-columns:1fr;max-height:94vh;overflow-y:auto}#modalRoot .result-modal--win .victory-roo-stage{min-height:210px;height:230px;padding:4px 8px 0}#modalRoot .result-modal--win .victory-roo-stage img{max-height:225px;width:auto;max-width:80%}#modalRoot .result-modal--win .victory-roo-caption{bottom:4px;font-size:12px}#modalRoot .result-modal--win .victory-parchment{margin:8px;padding:19px 15px 16px}#modalRoot .result-modal--win .victory-reward-bar{align-items:flex-start;flex-direction:column}#modalRoot .result-modal--win .victory-reward-bar strong{text-align:left}}
@media(prefers-reduced-motion:reduce){#modalRoot .result-modal--win .victory-roo-stage img{animation:none}}


/* Stage 74 — user-supplied transparent parchment and victory controls */
#modalRoot .modal.result-modal--split{
  width:min(1160px,97vw);max-height:95vh;padding:0;border:0;border-radius:20px;
  background:radial-gradient(ellipse at 22% 48%,#9a6228 0%,#49301d 58%,#211910 100%);
  box-shadow:0 28px 100px #000c,0 0 0 2px #e4b95d88;overflow:hidden
}
#modalRoot .result-modal--split .victory-scene{
  display:grid;grid-template-columns:minmax(250px,34%) minmax(0,1fr);
  min-height:650px;max-height:95vh;gap:0;position:relative;
  background:radial-gradient(ellipse at 20% 48%,#b8792c55,transparent 60%)
}
#modalRoot .result-modal--split .victory-roo-stage{
  position:relative;display:flex;align-items:flex-end;justify-content:center;
  min-height:630px;padding:20px 2px 16px;overflow:hidden;
  background:radial-gradient(ellipse at 50% 75%,#f9d16b55,transparent 58%)
}
#modalRoot .result-modal--split .victory-roo-stage:before{
  content:"";position:absolute;left:7%;right:7%;bottom:5%;height:15%;
  border-radius:50%;background:#f7c45d44;filter:blur(25px)
}
#modalRoot .result-modal--split .victory-roo-stage img{
  position:relative;z-index:1;width:100%;height:100%;max-height:610px;
  object-fit:contain;object-position:center bottom;filter:drop-shadow(0 14px 18px #0009);
  animation:roo-victory-arrive .65s cubic-bezier(.2,.8,.2,1) both
}
#modalRoot .result-modal--split .victory-roo-caption{
  position:absolute;z-index:2;bottom:10px;left:8px;right:8px;text-align:center;
  color:#ffe7a8;font:italic 15px Georgia,serif;text-shadow:0 2px 5px #241508
}
#modalRoot .result-modal--split .victory-parchment{
  position:relative;align-self:stretch;min-width:0;min-height:0;margin:8px 10px 8px 0;
  padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:hidden;
  color:#44301b
}
#modalRoot .result-modal--split .victory-parchment-art{
  position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none;z-index:0
}
#modalRoot .result-modal--split .victory-parchment-content{
  position:absolute;z-index:1;inset:3.8% 7.2% 4.2%;
  display:flex;flex-direction:column;min-height:0;overflow-y:auto;
  scrollbar-width:thin;scrollbar-color:#bd873a transparent
}
#modalRoot .result-modal--split .victory-heading{
  flex:0 0 15%;min-height:74px;text-align:center;margin:0;
  display:flex;flex-direction:column;justify-content:center
}
#modalRoot .result-modal--split .victory-heading h2{
  margin:0;color:#8b3510;font:900 clamp(23px,2.7vw,34px) Georgia,serif;
  text-shadow:0 1px #fff7
}
#modalRoot .result-modal--split .victory-heading p{
  margin:3px 0 0;color:#7b4d20;font-size:clamp(10px,1vw,12px);font-weight:700
}
#modalRoot .result-modal--split .result-banner{
  flex:0 0 auto;margin:0 0 10px;padding:7px 12px;border:0;border-radius:0;
  background:transparent;box-shadow:none;text-align:center
}
#modalRoot .result-modal--split .result-banner h3{
  margin:0;color:#70400a;font-size:clamp(10px,1vw,12px);letter-spacing:.16em
}
#modalRoot .result-modal--split .result-answer{
  margin:0;color:#63330b;font:900 clamp(27px,3vw,42px) Georgia,serif;
  line-height:1.05;text-shadow:0 1px #fff8
}
#modalRoot .result-modal--split .reveal-content{display:flex;flex-direction:column;gap:7px;min-height:0}
#modalRoot .result-modal--split .reveal-clue{
  padding:8px 11px;background:#fff6dfd9;border:1px solid #d9a64c;
  border-left:4px solid #a85d26;border-radius:9px;font:italic clamp(11px,1.1vw,14px) Georgia,serif
}
#modalRoot .result-modal--split .education{
  padding:8px 11px;background:#f8edcfdf;border:1px solid #d7b36e;border-radius:9px
}
#modalRoot .result-modal--split .education h4{margin:0 0 4px;color:#95601e;font-size:10px;letter-spacing:.13em;text-transform:uppercase}
#modalRoot .result-modal--split .education p{margin:0;font-size:clamp(11px,1vw,13px);line-height:1.35;color:#3f3426}
#modalRoot .result-modal--split .victory-section-label{
  margin:4px 0 5px;color:#94601f;font-size:10px;letter-spacing:.14em;text-transform:uppercase
}
#modalRoot .result-modal--split .references{display:flex;gap:8px;flex-wrap:wrap}
#modalRoot .result-modal--split .references a{
  padding:5px 10px;background:#f0dfb9;border:1px solid #ddbd7b;border-radius:15px;
  color:#74480e;text-decoration:none;font-size:11px;font-weight:800
}
#modalRoot .result-modal--split .tiny{font-size:9px;margin:4px 0 0}
#modalRoot .result-modal--split .victory-reward-art{
  position:relative;flex:0 0 58px;height:58px;margin:8px 0 3px;
  display:flex;align-items:center;justify-content:flex-end;padding:0 8% 0 28%;gap:8px
}
#modalRoot .result-modal--split .victory-reward-art>img{
  position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:0
}
#modalRoot .result-modal--split .victory-reward-label,
#modalRoot .result-modal--split .victory-reward-art strong{
  position:relative;z-index:1;color:#fff0b0;font-weight:900;
  font:800 clamp(11px,1.1vw,14px) Georgia,serif;text-shadow:0 2px 3px #4b1008
}
#modalRoot .result-modal--split .victory-reward-label{margin-right:auto}
#modalRoot .result-modal--split .victory-reward-art strong{text-align:right;color:#ffe56d}
#modalRoot .result-modal--split .victory-asset-actions{
  flex:0 0 58px;display:flex;align-items:center;justify-content:space-between;gap:12px;
  margin:3px 1% 0
}
#modalRoot .result-modal--split .victory-image-button{
  position:relative;display:flex;align-items:center;justify-content:center;
  width:48%;height:58px;padding:0;border:0;background:transparent;cursor:pointer;
  color:#38220b;font:900 clamp(12px,1.25vw,17px) Georgia,serif;
  text-shadow:0 1px #fff8;isolation:isolate
}
#modalRoot .result-modal--split .victory-image-button img{
  position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:-1;
  pointer-events:none
}
#modalRoot .result-modal--split .victory-image-button span{position:relative;z-index:1}
#modalRoot .result-modal--split .next-puzzle-image-button{color:#fff2bf;text-shadow:0 2px 3px #641006}
#modalRoot .result-modal--split .victory-image-button:hover{filter:brightness(1.08)}
#modalRoot .result-modal--split .victory-particles{height:100%;position:absolute;inset:0;z-index:4}
@media(max-width:760px){
 #modalRoot .modal.result-modal--split{width:min(96vw,620px)}
 #modalRoot .result-modal--split .victory-scene{grid-template-columns:1fr;max-height:94vh;min-height:0;overflow-y:auto}
 #modalRoot .result-modal--split .victory-roo-stage{min-height:190px;height:205px;padding:3px 8px 0}
 #modalRoot .result-modal--split .victory-roo-stage img{max-height:200px;width:auto;max-width:80%}
 #modalRoot .result-modal--split .victory-parchment{height:600px;min-height:600px;margin:0 5px 7px}
 #modalRoot .result-modal--split .victory-parchment-content{inset:4% 7% 5%}
 #modalRoot .result-modal--split .victory-heading{flex-basis:14%;min-height:70px}
 #modalRoot .result-modal--split .victory-reward-art{flex-basis:48px;height:48px}
 #modalRoot .result-modal--split .victory-asset-actions{flex-basis:50px}
 #modalRoot .result-modal--split .victory-image-button{height:50px}
}
@media(prefers-reduced-motion:reduce){
 #modalRoot .result-modal--split .victory-roo-stage img{animation:none}
}

/* Stage 75 — victory screen: NO stretched sprites.
   Parchment = 3-slice (top/bottom caps keep native ratio, only the plain middle stretches).
   Reward panel + buttons = trimmed PNGs shown at their native aspect ratio (aspect-ratio + height, never fill).
   Everything inside the parchment is sized in cqw (container query width), so it scales with the art. */
#modalRoot .result-modal--split .victory-scene{grid-template-columns:minmax(250px,44%) minmax(0,1fr);min-height:650px}
#modalRoot .result-modal--split .victory-parchment{
  container-type:inline-size;display:flex;flex-direction:column;margin:8px 12px 8px 0;overflow:visible
}
#modalRoot .result-modal--split .vp-art{position:absolute;inset:0;display:flex;flex-direction:column;pointer-events:none;z-index:0}
#modalRoot .result-modal--split .vp-top,
#modalRoot .result-modal--split .vp-bottom{display:block;flex:none;width:100%;height:auto;object-fit:contain}
#modalRoot .result-modal--split .vp-mid{flex:1 1 auto;min-height:0;margin:-1px 0;background:url(../assets/victory/parchment_mid.webp) center top/100% 100% no-repeat}
#modalRoot .result-modal--split .victory-parchment-art{display:none}

/* content layer: regions are placed relative to the art (top cap = 430/1344 of width) */
#modalRoot .result-modal--split .victory-parchment-content{
  position:absolute;inset:0;z-index:1;display:flex;flex-direction:column;overflow:hidden;
  padding:0 8cqw 4.2cqw
}
#modalRoot .result-modal--split .victory-heading{
  flex:none;min-height:0;height:13cqw;margin:2.4cqw 0 0;justify-content:center
}
#modalRoot .result-modal--split .victory-heading h2{font-size:max(20px,4.3cqw);line-height:1.05}
#modalRoot .result-modal--split .victory-heading p{font-size:max(10px,1.8cqw);margin-top:.5cqw}
/* gold plaque is baked into the parchment art: 15.9cqw -> 28.3cqw */
#modalRoot .result-modal--split .result-banner{
  flex:none;margin:.5cqw 8cqw 0;height:12.2cqw;padding:0 8.5cqw;
  display:flex;flex-direction:column;align-items:center;justify-content:center
}
#modalRoot .result-modal--split .result-banner h3{font-size:max(9px,1.45cqw);line-height:1;margin:0 0 .3cqw}
#modalRoot .result-modal--split .result-answer{
  max-width:100%;white-space:nowrap;overflow:hidden;font-size:max(22px,5.1cqw);line-height:1.1
}
/* scrolling text area */
#modalRoot .result-modal--split .victory-body{
  flex:1 1 0;min-height:0;overflow-y:auto;margin-top:1.6cqw;padding-right:.6cqw;
  scrollbar-width:thin;scrollbar-color:#bd873a transparent
}
#modalRoot .result-modal--split .reveal-clue{font-size:max(11px,2.1cqw)}
#modalRoot .result-modal--split .education h4,
#modalRoot .result-modal--split .victory-section-label{font-size:max(9px,1.5cqw)}
#modalRoot .result-modal--split .education p{font-size:max(11px,1.95cqw)}
#modalRoot .result-modal--split .references a{font-size:max(11px,1.9cqw)}
#modalRoot .result-modal--split .tiny{font-size:max(9px,1.45cqw)}
/* pinned footer */
#modalRoot .result-modal--split .victory-footer{flex:none;display:flex;flex-direction:column;gap:1.2cqw;padding-top:1.6cqw}

/* reward panel: exact native ratio of the trimmed PNG (2044x245) */
#modalRoot .result-modal--split .victory-reward-art{
  position:relative;flex:none;display:block;width:100%;height:auto;margin:0 auto;padding:0;
  aspect-ratio:2044/245
}
#modalRoot .result-modal--split .victory-reward-art>img{
  position:absolute;inset:0;width:100%;height:100%;object-fit:contain
}
#modalRoot .result-modal--split .victory-reward-label,
#modalRoot .result-modal--split .victory-reward-art strong{
  position:absolute;top:0;bottom:0;display:flex;align-items:center;margin:0;white-space:nowrap;
  font:800 max(11px,2.2cqw) Georgia,serif
}
#modalRoot .result-modal--split .victory-reward-label{left:17.5%;width:23%;justify-content:center}
#modalRoot .result-modal--split .victory-reward-art strong{left:44%;right:6%;justify-content:flex-end}

/* buttons: height drives size, width comes from each PNG's own ratio */
#modalRoot .result-modal--split .victory-asset-actions{
  flex:none;display:flex;align-items:center;justify-content:center;gap:2cqw;margin:0
}
#modalRoot .result-modal--split .victory-image-button{
  position:relative;flex:none;width:auto;height:9cqw;padding:0;
  display:flex;align-items:center;justify-content:center;
  font:900 max(12px,2.4cqw) Georgia,serif;white-space:nowrap
}
#modalRoot .result-modal--split .back-map-image-button{aspect-ratio:2018/508;padding-left:12%}
#modalRoot .result-modal--split .next-puzzle-image-button{aspect-ratio:1979/478;padding:0 12% 0 8%}
#modalRoot .result-modal--split .victory-image-button img{
  position:absolute;inset:0;width:100%;height:100%;object-fit:contain
}

@media(max-width:760px){
  #modalRoot .result-modal--split .victory-scene{grid-template-columns:1fr}
  #modalRoot .result-modal--split .victory-parchment{height:auto;min-height:0;aspect-ratio:1/1.3;margin:0 5px 12px}
  #modalRoot .result-modal--split .victory-heading p{display:none}
  #modalRoot .result-modal--split .victory-parchment-content{inset:0}
  #modalRoot .result-modal--split .victory-heading{flex-basis:auto;min-height:0;height:13cqw}
  #modalRoot .result-modal--split .victory-reward-art{flex-basis:auto;height:auto}
  #modalRoot .result-modal--split .victory-asset-actions{flex-basis:auto}
  #modalRoot .result-modal--split .victory-image-button{height:9cqw}
}

/* Stage 76 — everything below the gold plaque scrolls (clues, text, scripture, rewards, buttons).
   Text uses readable px sizes that grow a little with the parchment; sprites keep native ratios. */
#modalRoot .result-modal--split .victory-body{padding-bottom:1cqw}
#modalRoot .result-modal--split .victory-footer{padding-top:2cqw;gap:2cqw}
#modalRoot .result-modal--split .reveal-clue{font-size:clamp(14px,2.5cqw,18px);line-height:1.35;padding:9px 13px}
#modalRoot .result-modal--split .education{padding:10px 13px}
#modalRoot .result-modal--split .education h4,
#modalRoot .result-modal--split .victory-section-label{font-size:clamp(11px,1.7cqw,13px)}
#modalRoot .result-modal--split .education p{font-size:clamp(14px,2.4cqw,17px);line-height:1.45}
#modalRoot .result-modal--split .references a{font-size:clamp(13px,2.2cqw,16px);padding:6px 14px}
#modalRoot .result-modal--split .tiny{font-size:clamp(11px,1.7cqw,13px)}
#modalRoot .result-modal--split .victory-reward-label,
#modalRoot .result-modal--split .victory-reward-art strong{font-size:clamp(12px,2.4cqw,17px)}
#modalRoot .result-modal--split .victory-image-button{font-size:clamp(14px,2.7cqw,19px)}
/* soft fade at the bottom edge of the scrolling area (extra padding keeps the last button clear of it) */
#modalRoot .result-modal--split .victory-body{
  padding-bottom:22px;
  -webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 22px),transparent);
  mask-image:linear-gradient(to bottom,#000 calc(100% - 22px),transparent)
}

/* Stage 77 — transparent victory overlay: Roo + parchment float in front of the gameplay (no box) */
#modalRoot .modal-backdrop:has(.result-modal--split){background:#07191d4d;backdrop-filter:none}
#modalRoot .modal.result-modal--split{
  background:transparent;border:0;box-shadow:none;border-radius:0;overflow:visible
}
#modalRoot .result-modal--split .victory-scene{background:transparent}
#modalRoot .result-modal--split .victory-roo-stage{background:transparent;overflow:visible}
#modalRoot .result-modal--split .victory-roo-stage:before{display:none}
#modalRoot .result-modal--split .victory-roo-stage img{filter:drop-shadow(0 12px 16px #000a)}
#modalRoot .result-modal--split .victory-parchment{filter:drop-shadow(0 14px 22px #000a)}
#modalRoot .result-modal--split .victory-roo-caption{text-shadow:0 2px 6px #000,0 0 12px #000}

/* Stage 78 — defeat variant of the split scene (red plaque parchment + kneeling Roo) */
#modalRoot .result-modal--loss .result-banner h3{color:#ffe7b0;text-shadow:0 1px 2px #4a1006}
#modalRoot .result-modal--loss .result-answer{color:#fff3cf;text-shadow:0 2px 3px #4a1006}
#modalRoot .result-modal--loss .victory-heading h2{color:#6b2a10}
#modalRoot .result-modal--loss .victory-heading p{color:#6b4520}
#modalRoot .result-modal--loss .victory-roo-stage img{animation:roo-defeat-arrive .6s ease-out both}
@keyframes roo-defeat-arrive{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}


/* Stage 82 — Perk Inventory: one fixed 3:2 stage, everything positioned/sized relative to it (matches mockup) */
#modalRoot .modal-backdrop:has(.perk-inventory-shell){
  position:fixed;inset:0;padding:0;margin:0;width:100vw;height:100vh;height:100dvh;
  display:flex;align-items:center;justify-content:center;overflow:hidden;
  background:radial-gradient(ellipse at 50% 40%,#0d2b2c,#030c0d 78%)
}
#modalRoot .modal.perk-inventory-modal{
  position:relative;inset:auto;flex:0 0 auto;width:min(100vw,150vh);height:auto;aspect-ratio:3/2;
  max-width:none;max-height:none;margin:0;padding:0;border:0;border-radius:0;overflow:visible;
  background:transparent;box-shadow:none
}
#modalRoot .perk-inventory-shell{
  position:relative;display:block;width:100%;aspect-ratio:3/2;container-type:inline-size;
  padding:0;gap:0;box-sizing:border-box;isolation:isolate;color:#4b2c12;font-family:Georgia,"Times New Roman",serif;
  background:url("../assets/inventory_ui/stone_tablet_frame.webp") center/100% 100% no-repeat
}
#modalRoot .perk-inventory-shell:before{content:none}
/* recessed inner panel (the wall art is flat, so this gives the carved-in border of the mockup) */
#modalRoot .inv-panel{position:absolute;left:6.7%;top:13.7%;width:86.6%;height:68.1%;border-radius:1.3cqw;pointer-events:none;
  box-shadow:inset 0 0 0 .22cqw #6d3f12cc,inset 0 0 0 .5cqw #e2b25a55,inset 0 0 3cqw #3a1b04bb;z-index:0}
#modalRoot .inventory-title-art{position:absolute;z-index:5;left:27%;top:-.3%;width:46%;height:auto;margin:0;filter:drop-shadow(0 .3cqw .4cqw #321b0d88);pointer-events:none}
#modalRoot .inventory-info-ribbon{
  position:absolute;z-index:3;left:15.1%;top:19.2%;width:70%;height:10%;margin:0;padding:0 3.4cqw;box-sizing:border-box;
  display:flex;align-items:center;justify-content:center;
  border-style:solid;border-width:0 3.4cqw;
  border-image:url("../assets/inventory_ui/parchment_info_ribbon.webp") 0 78 0 78 fill / 0 3.4cqw 0 3.4cqw stretch;
  padding:0;
}
#modalRoot .inventory-info-ribbon p{margin:0;max-width:100%;text-align:center;color:#5b3513;font:700 max(9px,1.22cqw)/1.2 Georgia,serif;text-shadow:0 1px #fff8;white-space:nowrap;margin-top:.2cqw}
#modalRoot .inventory-scroll-frame{
  position:absolute;z-index:2;left:13.6%;top:29.3%;width:69.6%;height:51.6%;margin:0;padding:.3cqw;box-sizing:border-box;
  overflow-y:auto;overflow-x:hidden;scrollbar-width:none;overscroll-behavior:contain
}
#modalRoot .inventory-scroll-frame::-webkit-scrollbar{display:none}
#modalRoot .inventory-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:6.4cqw;gap:.45cqw .75cqw;padding:0;align-content:start}
#modalRoot .inventory-grid .inv-item{position:relative;display:block;min-width:0;min-height:0;height:100%;padding:0;border:0;border-radius:0;background:none;box-shadow:none;overflow:visible}
#modalRoot .inventory-grid .inv-item:after{content:none}
#modalRoot .inv-card-bg{position:absolute;left:-1.1%;top:-6.8%;width:103.1%;height:114.2%;pointer-events:none;filter:drop-shadow(0 .25cqw .3cqw #4a280a55)}
#modalRoot .inv-item-icon{
  position:absolute;left:3.3%;top:6.8%;width:23.6%;height:80.2%;flex:none;display:grid;place-items:center;
  border:0;border-radius:0;background:none;box-shadow:none
}
#modalRoot .inv-item-icon img{width:84%;height:84%;object-fit:contain;clip-path:polygon(14% 0,86% 0,100% 14%,100% 86%,86% 100%,14% 100%,0 86%,0 14%);filter:drop-shadow(0 .15cqw .2cqw #2a140655)}
#modalRoot .inv-item-copy{position:absolute;left:31%;right:2.5%;top:0;bottom:0;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:.25cqw;min-width:0}
#modalRoot .inv-item-copy strong{display:block;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font:800 max(9px,1.48cqw)/1.05 Georgia,serif;color:#5a1d0c;text-shadow:0 1px 0 #fff3cf99}
#modalRoot .inv-item-copy strong.long{font-size:max(8px,1.32cqw)}
#modalRoot .inv-item-copy .inv-type{display:block;white-space:nowrap;font:600 max(8px,1cqw)/1.1 Georgia,serif;color:#7a5f3b}
#modalRoot .inv-item-copy .inv-rarity{display:inline;font:inherit;font-weight:700;letter-spacing:0;text-transform:none}
#modalRoot .inv-item.rarity-common .inv-rarity{color:#7a6a55}
#modalRoot .inv-item.rarity-rare .inv-rarity{color:#2b67a6}
#modalRoot .inv-item.rarity-epic .inv-rarity{color:#7a3a9e}
#modalRoot .inv-item.rarity-legendary .inv-rarity{color:#b0700a}
#modalRoot .inv-item-copy .inv-owned{display:inline-block;padding:.18cqw 1.2cqw;border-radius:99px;border:1px solid #d7a84c;background:linear-gradient(#fbe4a6,#efc566);box-shadow:inset 0 1px #fff6d2,0 1px 2px #5a360f44;font:800 max(8px,1.16cqw)/1.15 Georgia,serif;color:#4a2a0c}
#modalRoot .inv-item.is-empty .inv-owned{filter:saturate(.6);opacity:.85}
/* custom gold scrollbar, built from the (previously unused) gold_scrollbar.webp slices */
#modalRoot .inv-sb{position:absolute;z-index:4;left:83.8%;top:29.6%;width:2.15%;height:51.2%;display:flex;flex-direction:column}
#modalRoot .inv-sb-cap{flex:0 0 auto;width:100%;aspect-ratio:62/76;padding:0;border:0;background:url("../assets/inventory_ui/sb_cap_top.webp") center/100% 100% no-repeat;cursor:pointer}
#modalRoot .inv-sb-cap.down{aspect-ratio:62/72;background-image:url("../assets/inventory_ui/sb_cap_bottom.webp")}
#modalRoot .inv-sb-cap:hover{filter:brightness(1.12)}
#modalRoot .inv-sb-track{position:relative;flex:1 1 auto;min-height:0;background:url("../assets/inventory_ui/sb_track.webp") center/100% 100% no-repeat}
#modalRoot .inv-sb-thumb{position:absolute;left:27.4%;width:45.2%;top:0;height:20%;background:url("../assets/inventory_ui/sb_thumb.webp") center/100% 100% no-repeat;cursor:grab;touch-action:none}
#modalRoot .inv-sb.idle .inv-sb-thumb{cursor:default;opacity:.9}
#modalRoot .inv-sb.idle .inv-sb-cap{cursor:default}
/* bottom buttons: art buttons positioned at the mockup's coordinates */
#modalRoot .inventory-actions{display:contents}
#modalRoot .inventory-art-button{position:absolute;z-index:4;padding:0;border:0;background:transparent;cursor:pointer;transition:transform .14s ease,filter .14s ease;height:auto;max-width:none;flex:none}
#modalRoot .inventory-art-button img{display:block;width:100%;height:auto;filter:drop-shadow(0 .3cqw .3cqw #321b0b66)}
#modalRoot .inventory-art-button.inv-btn-close{left:16.4%;top:84.2%;width:16.9%}
#modalRoot .inventory-art-button.inv-btn-wisdom{left:34.3%;top:82.8%;width:28.1%}
#modalRoot .inventory-art-button.inv-btn-shop{left:62.4%;top:83.3%;width:24.5%}
#modalRoot .inventory-art-button:hover{transform:translateY(-.25cqw);filter:brightness(1.1)}
#modalRoot .inventory-art-button:active{transform:translateY(.1cqw) scale(.98)}
@media(prefers-reduced-motion:reduce){#modalRoot .inventory-art-button{transition:none}}


/* Stage 83 — Perk Store: fixed 1535:1024 stage, container units, card/ribbon/scrollbar art reused from the inventory */
#modalRoot .perk-store-backdrop{padding:0;overflow:hidden;isolation:isolate;background:#07191d}
#modalRoot .perk-store-backdrop:before{content:"";position:absolute;inset:-24px;z-index:-1;background:linear-gradient(#0b1a1ccc,#1a0d06cc),url("../assets/temple_background.webp") center/cover;filter:blur(7px) saturate(1.1)}
#modalRoot .modal.perk-store-modal{
 position:relative;width:min(100vw,149.9vh);height:auto;aspect-ratio:1535/1024;max-width:none;max-height:none;
 padding:0;border:0;border-radius:0;overflow:hidden;background:transparent;box-shadow:none
}
#modalRoot .perk-store-shell{
 position:relative;width:100%;aspect-ratio:1535/1024;overflow:hidden;container-type:inline-size;isolation:isolate;
 background:url("../assets/perk_store/perk_store_stall.webp") center/100% 100% no-repeat;
 color:#44240e;font-family:Georgia,"Times New Roman",serif
}
#modalRoot .perk-store-fox{position:absolute;z-index:3;left:-1.5%;bottom:8.5%;height:61%;width:25%;object-fit:contain;object-position:left bottom;filter:drop-shadow(0 .45cqw .45cqw #1b0e0888);pointer-events:none}
/* info ribbon (9-sliced so the curls keep their shape) */
#modalRoot .store-info-ribbon{
 position:absolute;z-index:3;left:24.2%;top:22.6%;width:53.2%;height:6.8%;box-sizing:border-box;
 display:flex;align-items:center;justify-content:center;gap:.9cqw;padding:0;
 border-style:solid;border-width:0 2.3cqw;
 border-image:url("../assets/inventory_ui/parchment_info_ribbon.webp") 0 78 0 78 fill / 0 2.3cqw 0 2.3cqw stretch
}
#modalRoot .store-info-ribbon p{margin:.15cqw 0 0;white-space:nowrap;color:#4a2a0c;font:700 max(8px,1.34cqw)/1.1 Georgia,serif;text-shadow:0 1px #fff8}
#modalRoot .store-info-ribbon i,#modalRoot .store-price i{flex:none;width:1.9cqw;height:1.9cqw;border-radius:50%;background:radial-gradient(circle at 38% 32%,#fff3a8,#f1b92f 55%,#b8741a);border:.14cqw solid #9a5a16;box-shadow:inset 0 0 0 .22cqw #f9d96a,0 1px 2px #4a280a66}
/* cards */
#modalRoot .perk-store-scroll{
 position:absolute;z-index:2;left:24.6%;top:29.4%;width:50.4%;height:36.6%;padding:.3cqw;box-sizing:border-box;margin:0;
 overflow-y:auto;overflow-x:hidden;scrollbar-width:none;overscroll-behavior:contain;background:none;border-radius:0
}
#modalRoot .perk-store-scroll::-webkit-scrollbar{display:none}
#modalRoot .perk-store-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:7.7cqw;gap:.4cqw 1cqw;align-content:start}
#modalRoot .store-perk-card{position:relative;display:block;min-width:0;min-height:0;height:100%;padding:0;border:0;border-radius:0;background:none;box-shadow:none;color:#4a260f;overflow:visible}
#modalRoot .store-perk-card:after{content:none}
#modalRoot .store-card-bg{position:absolute;left:-1.1%;top:-6.8%;width:103.1%;height:114.2%;pointer-events:none;filter:drop-shadow(0 .25cqw .3cqw #2a14069a)}
#modalRoot .store-perk-icon{position:absolute;left:3.3%;top:6.8%;width:23.6%;height:80.2%;display:grid;place-items:center;border:0;border-radius:0;background:none;box-shadow:none}
#modalRoot .store-perk-icon img{width:84%;height:84%;object-fit:contain;clip-path:polygon(14% 0,86% 0,100% 14%,100% 86%,86% 100%,14% 100%,0 86%,0 14%);filter:drop-shadow(0 .15cqw .2cqw #2a140655)}
#modalRoot .store-perk-copy{position:absolute;left:30%;right:3.2%;top:.9cqw;bottom:.55cqw;display:flex;flex-direction:column;min-width:0;gap:.12cqw}
#modalRoot .store-perk-card h3{margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font:800 max(9px,1.38cqw)/1.1 Georgia,serif;color:#5a1d0c;text-shadow:0 1px 0 #fff3cf99}
#modalRoot .store-perk-card h3.long{font-size:max(8px,1.22cqw)}
#modalRoot .store-perk-card p{margin:0;color:#5f4326;font:600 max(7px,.86cqw)/1.12 Georgia,serif;display:-webkit-box;-webkit-line-clamp:3;line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
#modalRoot .store-perk-foot{margin-top:auto;display:flex;align-items:center;gap:.6cqw;min-width:0}
#modalRoot .store-rarity{flex:none;padding:.2cqw 1cqw;border-radius:99px;border:1px solid #fff5;font:800 max(7px,.82cqw)/1.1 Georgia,serif;color:#fff;letter-spacing:.03em;box-shadow:0 1px 2px #0004}
#modalRoot .store-rarity.common{background:linear-gradient(#cdb27a,#9d8250);color:#4a3412;text-shadow:0 1px #fff6}
#modalRoot .store-rarity.rare{background:linear-gradient(#3c8fe0,#1f65b3)}
#modalRoot .store-rarity.epic{background:linear-gradient(#9a5bd0,#6d2f9f)}
#modalRoot .store-rarity.legendary{background:linear-gradient(#e0a02a,#a4660a)}
#modalRoot .store-type{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font:600 max(7px,.8cqw)/1 Georgia,serif;color:#7a5f3b}
#modalRoot .store-type.locked-note{color:#9b2f12;font-weight:800}
#modalRoot .store-price{margin-left:auto;flex:none;display:inline-flex;align-items:center;gap:.45cqw;padding:.12cqw 1.1cqw .12cqw .5cqw;border-radius:99px;border:1px solid #8e4e13;background:linear-gradient(#ffe48f,#e0a02f 60%,#c27a22);box-shadow:inset 0 1px #fff7cf,0 .2cqw .3cqw #4b260b66;font:900 max(8px,1.2cqw)/1.15 Georgia,serif;color:#43240c;cursor:pointer;transition:transform .12s,filter .12s}
#modalRoot .store-price i{width:1.25cqw;height:1.25cqw}
#modalRoot .store-price:hover:not(:disabled){transform:translateY(-.15cqw);filter:brightness(1.08)}
#modalRoot .store-price:disabled{cursor:not-allowed;filter:grayscale(.75) brightness(.92);box-shadow:none}
/* gold scrollbar (slices of gold_scrollbar.webp) */
#modalRoot .store-sb{position:absolute;z-index:4;left:75.5%;top:29.8%;width:2%;height:35.4%;display:flex;flex-direction:column}
#modalRoot .store-sb .inv-sb-cap{flex:0 0 auto;width:100%;aspect-ratio:62/76;padding:0;border:0;background:url("../assets/inventory_ui/sb_cap_top.webp") center/100% 100% no-repeat;cursor:pointer}
#modalRoot .store-sb .inv-sb-cap.down{aspect-ratio:62/72;background-image:url("../assets/inventory_ui/sb_cap_bottom.webp")}
#modalRoot .store-sb .inv-sb-track{position:relative;flex:1 1 auto;min-height:0;background:url("../assets/inventory_ui/sb_track.webp") center/100% 100% no-repeat}
#modalRoot .store-sb .inv-sb-thumb{position:absolute;left:27.4%;width:45.2%;top:0;height:20%;background:url("../assets/inventory_ui/sb_thumb.webp") center/100% 100% no-repeat;cursor:grab;touch-action:none}
#modalRoot .store-sb.idle .inv-sb-thumb,#modalRoot .store-sb.idle .inv-sb-cap{cursor:default}
/* bottom bar */
#modalRoot .perk-store-bottom{position:absolute;z-index:4;left:8%;right:7%;bottom:1.3%;height:10%;display:flex;align-items:center;justify-content:space-between;pointer-events:none}
#modalRoot .perk-store-bottom button,#modalRoot .store-coin-balance{pointer-events:auto}
#modalRoot .store-back-button{position:relative;display:grid;place-items:center;width:19%;aspect-ratio:3/1;padding:0;border:0;background:transparent;color:#49250c;font:900 max(12px,2.1cqw) Georgia,serif;text-shadow:0 1px #fff8;cursor:pointer;isolation:isolate;transition:transform .14s,filter .14s}
#modalRoot .store-back-button:hover{transform:translateY(-.2cqw);filter:brightness(1.08)}
#modalRoot .store-back-button img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;z-index:-1;pointer-events:none}
#modalRoot .store-back-button span{margin-left:22%}
#modalRoot .store-coin-balance{position:relative;display:flex;align-items:center;justify-content:flex-end;gap:.6cqw;width:31%;aspect-ratio:3/1;padding:0 7% 0 31%;border:0;background:transparent;color:#ffe6a0;font-weight:900;font-size:max(11px,1.9cqw);isolation:isolate}
#modalRoot .store-coin-balance>img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:-1;pointer-events:none}
#modalRoot .store-coin-balance span{white-space:nowrap;text-shadow:0 2px 3px #290c04}
#modalRoot .store-coin-balance strong{color:#fff1c5;text-shadow:0 2px 3px #290c04}
#modalRoot .perk-store-tier{position:absolute;right:10%;bottom:11%;z-index:4;color:#ffe0a0;font-size:max(8px,.8cqw);text-shadow:0 1px 3px #210d04;opacity:.9}
@media(prefers-reduced-motion:reduce){#modalRoot .store-price,#modalRoot .store-back-button{transition:none}}

/* Stage 79 — match the defeat parchment's scroll behavior to the victory screen */
#modalRoot .result-modal--loss .victory-parchment-content{
  min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;
  scrollbar-width:thin;scrollbar-color:#9b754d transparent;
  -webkit-overflow-scrolling:touch;
}
#modalRoot .result-modal--loss .victory-parchment-content::-webkit-scrollbar{width:9px}
#modalRoot .result-modal--loss .victory-parchment-content::-webkit-scrollbar-track{background:#6e62534a;border-radius:8px}
#modalRoot .result-modal--loss .victory-parchment-content::-webkit-scrollbar-thumb{background:linear-gradient(90deg,#65594c,#c5b49a,#65594c);border:1px solid #756653;border-radius:8px}
#modalRoot .result-modal--loss .victory-body{min-height:0}
@media(max-width:760px){
  #modalRoot .result-modal--loss .victory-scene--defeat{grid-template-columns:1fr;max-height:94vh;min-height:0;overflow-y:auto}
  #modalRoot .result-modal--loss .victory-parchment{height:600px;min-height:600px}
  #modalRoot .result-modal--loss .victory-parchment-content{inset:4% 7% 5%}
}



/* STAGE 81 — Use a Perk open book, scaled as one unit with container units (cqw) */
#modalRoot .modal.use-perk-book-modal{
 width:min(1120px,96vw,132vh);height:auto;max-width:none;max-height:none;
 padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;
 overflow:visible;color:#4b2d16;
}
.use-perk-book-shell{position:relative;width:100%;aspect-ratio:3/2;container-type:inline-size;isolation:isolate;font-family:Georgia,"Times New Roman",serif}
.use-perk-book-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:-1;pointer-events:none;filter:drop-shadow(0 18px 28px #0008)}
.use-perk-book-title{position:absolute;z-index:4;top:-3.5%;left:50%;transform:translateX(-50%);width:40%;height:auto;pointer-events:none;filter:drop-shadow(0 5px 5px #32160088)}

/* ---- left page ---- */
.upb-left{position:absolute;left:13.6%;top:17%;width:31.6%;height:67%;display:flex;flex-direction:column;min-height:0}
.upb-sub{margin:0 0 1.1cqw;text-align:center;font:600 max(10px,1.22cqw)/1.35 Georgia,serif;color:#5a3a1c}
.use-perk-book-list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:.8cqw;padding:.5cqw 1cqw .5cqw .4cqw;scrollbar-width:thin;scrollbar-color:#b27a2c #ead4a6}
.use-perk-book-list::-webkit-scrollbar{width:.95cqw;min-width:9px}
.use-perk-book-list::-webkit-scrollbar-track{background:#d9bd83;border:2px solid #f3e2bd;border-radius:12px}
.use-perk-book-list::-webkit-scrollbar-thumb{background:linear-gradient(90deg,#8c541e,#f0c45a,#9b6228);border:1px solid #70431d;border-radius:12px}
.use-perk-book-card{position:relative;flex:0 0 auto;display:flex;align-items:center;gap:1.1cqw;width:100%;height:5.7cqw;padding:.55cqw 1.3cqw .55cqw .6cqw;text-align:left;border:1px solid #c9a45a;border-radius:1cqw;background:linear-gradient(110deg,#fbe9bf,#f3d9a1);color:#4a2c14;box-shadow:0 2px 4px #70431c33,inset 0 1px 0 #fff3cf;cursor:pointer;transition:transform .14s,box-shadow .14s,filter .14s}
.use-perk-book-card:hover{transform:translateX(.2cqw);filter:brightness(1.04)}
.use-perk-book-card.selected{border:2px solid #d9962a;background:linear-gradient(180deg,#ffe892,#f4bd3e);box-shadow:0 0 0 .22cqw #ffd45e,0 0 1.7cqw .5cqw #ffc84fb0,inset 0 0 1cqw #fff4c4}
.use-perk-book-card.selected::before,.use-perk-book-card.selected::after{content:"";position:absolute;top:50%;width:1cqw;height:1cqw;background:#ffd45e;border:1px solid #a9681b;transform:translateY(-50%) rotate(45deg)}
.use-perk-book-card.selected::before{left:-.75cqw}.use-perk-book-card.selected::after{right:-.75cqw}
.use-perk-book-card.unavailable{filter:saturate(.55) brightness(.97)}
.use-perk-book-card.unavailable.selected{filter:saturate(.8)}
.upb-icon{flex:0 0 4.5cqw;width:4.5cqw;height:4.5cqw;display:grid;place-items:center;border:1px solid #b98a3e;border-radius:.9cqw;background:radial-gradient(circle at 50% 35%,#fff0b8,#e0a93f);box-shadow:inset 0 0 .7cqw #8a521a66}
.upb-icon img{width:88%;height:88%;object-fit:contain;filter:drop-shadow(0 .15cqw .2cqw #4a2c1455)}
.use-perk-book-card-copy{flex:1;min-width:0;display:flex;flex-direction:column;gap:.45cqw}
.use-perk-book-card-copy strong{font:700 max(11px,1.6cqw)/1.1 Georgia,serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:0 1px 0 #fff3cf99}
.upb-meta{display:flex;align-items:center;justify-content:space-between;gap:1cqw}
.use-perk-book-card .rarity-tag{font:800 max(8px,.95cqw)/1 Georgia,serif;padding:.4cqw 1.2cqw;letter-spacing:.04em;border:1px solid #fff4;box-shadow:0 1px 2px #0004}
.use-perk-book-card .rarity-tag.common{background:linear-gradient(#a79f93,#7f786d)}
.use-perk-book-card .rarity-tag.rare{background:linear-gradient(#3c8fe0,#1f65b3)}
.use-perk-book-card .rarity-tag.epic{background:linear-gradient(#9a5bd0,#6d2f9f)}
.use-perk-book-card .rarity-tag.legendary{background:linear-gradient(#e5a52a,#a96d0a)}
.use-perk-book-card small{font:700 max(9px,1.1cqw)/1 Georgia,serif;color:#5a3a1c;white-space:nowrap}
.use-perk-book-empty{margin:auto;text-align:center;color:#80633e;font:700 max(12px,1.5cqw) Georgia,serif}
.use-perk-book-close{position:relative;flex:0 0 auto;align-self:flex-start;margin-top:.9cqw;width:17cqw;padding:0;border:0;background:none;cursor:pointer;filter:drop-shadow(0 .3cqw .4cqw #3b190b88);transition:transform .15s,filter .15s}
.use-perk-book-close img{display:block;width:100%;height:auto}
.use-perk-book-close span{position:absolute;left:34%;right:10%;top:50%;transform:translateY(-52%);text-align:center;font:800 max(12px,2cqw)/1 Georgia,serif;color:#6a3510;text-shadow:0 1px 0 #fff0bd}
.use-perk-book-close:hover{transform:scale(1.04);filter:brightness(1.08) drop-shadow(0 .4cqw .5cqw #3b190b99)}

/* ---- right page ---- */
.upb-right{position:absolute;left:55%;top:15.5%;width:32%;height:68.5%;display:flex;flex-direction:column;align-items:center;min-height:0}
.upb-hero{position:relative;flex:0 0 auto;width:14.8cqw;aspect-ratio:720/747;filter:drop-shadow(0 .5cqw .8cqw #5a2f0a66)}
.upb-hero-art{position:absolute;inset:0;-webkit-mask:url(../assets/use_perk/perk_hero_arch_mask.webp) center/100% 100% no-repeat;mask:url(../assets/use_perk/perk_hero_arch_mask.webp) center/100% 100% no-repeat;background:radial-gradient(circle at 50% 46%,#fff2b0cc 0,#ffb53a66 32%,#00000000 66%),linear-gradient(#2b1a0acc,#2b1a0acc),url(../assets/petra_temple_background.webp) center/cover;display:grid;place-items:center}
.upb-hero-art img{width:60%;height:60%;object-fit:contain;filter:drop-shadow(0 0 .9cqw #ffd45e) drop-shadow(0 0 .3cqw #fff1b0)}
.upb-hero-frame{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.use-perk-book-ribbon{position:relative;z-index:2;flex:0 0 auto;width:23cqw;aspect-ratio:3/1;margin-top:-3.1cqw;display:grid;place-items:center}
.use-perk-book-ribbon img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:-1;filter:drop-shadow(0 .3cqw .4cqw #3b0f0488)}
.use-perk-book-ribbon strong{max-width:68%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font:700 max(11px,1.75cqw) Georgia,serif;color:#ffe9b0;text-shadow:0 .15cqw .15cqw #4b1604,0 0 .5cqw #7b300c;text-align:center;margin-top:-.4cqw}
.use-perk-book-ribbon strong.long{font-size:max(10px,1.4cqw)}
.upb-rarity{flex:0 0 auto;margin-top:-1.1cqw;position:relative;z-index:3}
.upb-rarity .rarity-tag{font:800 max(9px,1.15cqw)/1 Georgia,serif;padding:.55cqw 2.2cqw;letter-spacing:.05em;border:1px solid #fff5;box-shadow:0 .2cqw .4cqw #0005}
.upb-rarity .rarity-tag.common{background:linear-gradient(#a79f93,#7f786d)}
.upb-rarity .rarity-tag.rare{background:linear-gradient(#3c8fe0,#1f65b3)}
.upb-rarity .rarity-tag.epic{background:linear-gradient(#9a5bd0,#6d2f9f)}
.upb-rarity .rarity-tag.legendary{background:linear-gradient(#e5a52a,#a96d0a)}
.use-perk-book-detail{position:relative;flex:0 0 auto;width:27cqw;aspect-ratio:2048/741;margin-top:.7cqw;display:grid;place-items:center}
.use-perk-book-detail-parchment{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;filter:drop-shadow(0 .25cqw .35cqw #68401944)}
.use-perk-book-detail p{position:relative;width:78%;margin:0;text-align:center;font:700 max(10px,1.12cqw)/1.32 Georgia,serif;color:#4c2b12}
.upb-rules{flex:0 0 auto;width:25cqw;margin-top:.9cqw}
.upb-rules h4{margin:0 auto .5cqw;width:max-content;padding:.25cqw 2.6cqw;font:800 max(10px,1.2cqw)/1.1 Georgia,serif;color:#5b2f0b;background:linear-gradient(#ffe29a,#e4b04a);border:1px solid #b27a2c;border-radius:.6cqw;box-shadow:0 .15cqw .3cqw #5a2f0a55}
.upb-rules ul{list-style:none;margin:0;padding:.5cqw 1.2cqw;border:1px solid #cfa65e88;border-radius:.8cqw;background:#fff1cb66}
.upb-rules li{display:flex;align-items:flex-start;gap:.8cqw;font:600 max(9px,1.02cqw)/1.3 Georgia,serif;color:#4c2b12;padding:.12cqw 0}
.upb-rules li i{flex:0 0 1.35cqw;height:1.35cqw;margin-top:.02cqw;border-radius:50%;display:grid;place-items:center;font:900 max(8px,.95cqw)/1 Arial,sans-serif;font-style:normal;color:#fff;background:radial-gradient(circle at 35% 30%,#7bd45a,#2f8a2a);box-shadow:0 0 0 1px #1f5d1c}
.upb-rules li.no i{background:radial-gradient(circle at 35% 30%,#e86a4a,#a52a12);box-shadow:0 0 0 1px #6d1a0a}
.upb-rules li.no{color:#8a2d12}
.use-perk-book-activate{position:relative;flex:0 0 auto;margin-top:auto;width:20cqw;padding:0;border:0;background:transparent;cursor:pointer;filter:drop-shadow(0 .4cqw .5cqw #4b1b0d88);transition:transform .15s,filter .15s}
.use-perk-book-activate img{display:block;width:100%;height:auto}
.use-perk-book-activate:hover:not(:disabled){transform:translateY(-.3cqw);filter:brightness(1.08) drop-shadow(0 .6cqw .6cqw #4b1b0d99)}
.use-perk-book-activate:disabled{opacity:.55;cursor:not-allowed;filter:grayscale(.55) drop-shadow(0 .3cqw .4cqw #4b1b0d66)}
.use-perk-book-prompt{margin:auto;text-align:center;padding:8%;color:#68451e}
.use-perk-book-prompt strong{font:700 max(16px,2.4cqw) Georgia,serif}
.use-perk-book-prompt p{font:600 max(11px,1.3cqw)/1.5 Georgia,serif}


/* Stage 84 — Before-game perk selection, using the Inventory's stone-and-gold visual system */
#modalRoot .before-perk-backdrop{
 position:fixed;inset:0;padding:0;display:flex;align-items:center;justify-content:center;overflow:hidden;
 background:radial-gradient(ellipse at 50% 42%,#173335dd,#020a0bee 82%);backdrop-filter:blur(3px)
}
#modalRoot .modal.before-perk-modal{
 position:relative;flex:0 0 auto;width:min(88vw,132vh);height:auto;aspect-ratio:3/2;max-width:none;max-height:none;
 margin:0;padding:0;border:0;border-radius:0;overflow:visible;background:transparent;box-shadow:none
}
#modalRoot .before-perk-shell{
 position:relative;width:100%;aspect-ratio:3/2;container-type:inline-size;isolation:isolate;overflow:hidden;
 color:#4b2c12;font-family:Georgia,"Times New Roman",serif;
 background:url("../assets/before_perk/before_perk_stone_frame.webp") center/100% 100% no-repeat
}
#modalRoot .before-perk-title{
 position:absolute;z-index:3;left:28%;top:3.1%;width:44%;height:13.2%;display:flex;align-items:center;justify-content:center;
 border:.22cqw solid #f3c66a;border-radius:1.1cqw;
 background:linear-gradient(180deg,#8d3514,#541707 55%,#351006);
 box-shadow:inset 0 .2cqw .25cqw #ffdf8b88,inset 0 -.25cqw .35cqw #260900aa,0 .25cqw .35cqw #1b0d0788;
}
#modalRoot .before-perk-title:before{content:"";position:absolute;inset:.35cqw;border:.1cqw solid #d89b3d;border-radius:.7cqw;pointer-events:none}
#modalRoot .before-perk-title span{position:relative;color:#ffe08a;text-align:center;font:900 2.45cqw/1 Georgia,serif;text-shadow:0 .15cqw .2cqw #210800,0 0 .5cqw #ffb52f}
#modalRoot .before-perk-info{
 position:absolute;z-index:2;left:15%;top:18%;width:70%;height:9.2%;display:flex;align-items:center;justify-content:center;
 padding:0 2.2cqw;box-sizing:border-box;border-style:solid;border-width:0 2.2cqw;
 border-image:url("../assets/inventory_ui/parchment_info_ribbon.webp") 0 78 0 78 fill / 0 2.2cqw 0 2.2cqw stretch
}
#modalRoot .before-perk-info p{margin:0;text-align:center;color:#573313;font:700 max(8px,1.05cqw)/1.16 Georgia,serif;text-shadow:0 1px #fff8}
#modalRoot .before-perk-grid{
 position:absolute;z-index:2;left:13%;top:29%;width:74%;height:48%;display:grid;
 grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:1.1cqw 1.25cqw
}
#modalRoot .before-perk-card{position:relative;display:block;min-width:0;min-height:0;padding:0;border:0;background:none;cursor:pointer;isolation:isolate}
#modalRoot .before-perk-card-bg{position:absolute;inset:-2% -1%;width:102%;height:104%;object-fit:fill;z-index:-1;filter:drop-shadow(0 .22cqw .28cqw #26130688);pointer-events:none}
#modalRoot .before-perk-card input{position:absolute;z-index:4;left:3.5%;top:15%;width:2.15cqw;height:2.15cqw;accent-color:#b8791e;cursor:pointer}
#modalRoot .before-perk-icon{position:absolute;left:4%;top:22%;width:27%;height:68%;display:grid;place-items:center;pointer-events:none}
#modalRoot .before-perk-icon img{width:88%;height:88%;object-fit:contain;filter:drop-shadow(0 .15cqw .2cqw #28130666)}
#modalRoot .before-perk-copy{position:absolute;left:32%;right:4%;top:12%;bottom:8%;display:flex;flex-direction:column;align-items:flex-start;gap:.35cqw;min-width:0;overflow:hidden}
#modalRoot .before-perk-copy>strong{font:800 max(10px,1.45cqw)/1.06 Georgia,serif;color:#5a1d0c;text-shadow:0 1px #fff4cf;white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}
#modalRoot .before-perk-meta{display:flex;align-items:center;gap:.5cqw;flex-wrap:wrap}
#modalRoot .before-perk-meta .rarity-tag{font:800 max(7px,.78cqw)/1.1 Georgia,serif;padding:.18cqw .75cqw;border-radius:99px;color:white}
#modalRoot .before-perk-meta .rarity-tag.common{background:linear-gradient(#b7a174,#75603b)}
#modalRoot .before-perk-meta .rarity-tag.rare{background:linear-gradient(#438fd0,#205a9c)}
#modalRoot .before-perk-meta .rarity-tag.epic{background:linear-gradient(#a45ac5,#632b88)}
#modalRoot .before-perk-meta b{font:700 max(7px,.82cqw)/1 Georgia,serif;color:#79572d}
#modalRoot .before-perk-description{font:600 max(7px,.86cqw)/1.17 Georgia,serif;color:#594027;display:-webkit-box;-webkit-line-clamp:3;line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
#modalRoot .before-perk-lock{font:800 max(7px,.76cqw)/1 Georgia,serif;color:#a42d17}
#modalRoot .before-perk-card:has(input:checked) .before-perk-card-bg{filter:drop-shadow(0 0 .32cqw #ffd45a) drop-shadow(0 .22cqw .25cqw #26130688) brightness(1.04)}
#modalRoot .before-perk-card:has(input:checked):after{content:"";position:absolute;inset:0;border:.18cqw solid #d28b22;border-radius:1cqw;pointer-events:none}
#modalRoot .before-perk-card.is-disabled{cursor:not-allowed;filter:saturate(.55);opacity:.78}
#modalRoot .before-perk-card.is-disabled input{cursor:not-allowed}
#modalRoot .before-perk-actions{position:absolute;z-index:4;left:23%;right:23%;bottom:6.5%;height:11%;display:flex;align-items:center;justify-content:space-between;gap:3cqw}
#modalRoot .before-perk-cancel,#modalRoot .before-perk-start{position:relative;height:100%;width:42%;display:flex;align-items:center;justify-content:center;gap:.7cqw;border:0;cursor:pointer;transition:transform .14s,filter .14s}
#modalRoot .before-perk-cancel{background:transparent;padding:0;color:#4b2c12;font:900 1.7cqw Georgia,serif;text-shadow:0 1px #fff8}
#modalRoot .before-perk-cancel img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:-1}
#modalRoot .before-perk-cancel span{margin-left:14%}
#modalRoot .before-perk-start{border:.18cqw solid #ffdc79;border-radius:1.15cqw;background:linear-gradient(#ffe78d,#f2b72f 48%,#b96a0d);box-shadow:inset 0 .2cqw .25cqw #fff8c9, inset 0 -.25cqw .35cqw #7e3907,0 .25cqw .35cqw #2b150888;color:#4b1c06;font:900 1.75cqw Georgia,serif;text-shadow:0 1px #fff5}
#modalRoot .before-play-icon{font-size:1.55cqw}
#modalRoot .before-perk-cancel:hover,#modalRoot .before-perk-start:hover{transform:translateY(-.2cqw);filter:brightness(1.08)}
#modalRoot .before-perk-cancel:active,#modalRoot .before-perk-start:active{transform:translateY(.1cqw) scale(.985)}
@media(max-width:700px){
 #modalRoot .before-perk-title span{font-size:3.1cqw}
 #modalRoot .before-perk-grid{left:10%;width:80%;top:28%;height:51%;gap:1cqw}
 #modalRoot .before-perk-copy{left:29%;right:3%}
 #modalRoot .before-perk-copy>strong{font-size:max(8px,1.6cqw)}
 #modalRoot .before-perk-description{font-size:max(6px,.95cqw)}
 #modalRoot .before-perk-actions{left:18%;right:18%;bottom:5%;height:10%}
}
@media(prefers-reduced-motion:reduce){#modalRoot .before-perk-cancel,#modalRoot .before-perk-start{transition:none}}



/* Stage 85 — use the supplied title-plaque tablet and matching button artwork */
#modalRoot .before-perk-title{
  left:29%;top:7.6%;width:42%;height:10.8%;
  border:0;border-radius:0;background:transparent;box-shadow:none;
}
#modalRoot .before-perk-title:before{display:none}
#modalRoot .before-perk-title span{
  color:#ffe08a;font-size:2.55cqw;line-height:1;
  text-shadow:0 .12cqw .12cqw #310d03,0 0 .35cqw #ffbd43;
}
#modalRoot .before-perk-info{
  left:14%;top:19.4%;width:72%;height:8.7%;
}
#modalRoot .before-perk-info p{font-size:max(8px,1.02cqw)}
#modalRoot .before-perk-grid{
  left:12.5%;top:30%;width:75%;height:49%;
  gap:1cqw 1.2cqw;
}
#modalRoot .before-perk-actions{
  left:18%;right:18%;bottom:4.2%;height:12%;
  justify-content:center;gap:3%;
}
#modalRoot .before-perk-cancel,
#modalRoot .before-perk-start{
  height:100%;padding:0;border:0;border-radius:0;background:transparent;
  box-shadow:none;display:flex;align-items:center;justify-content:center;
}
#modalRoot .before-perk-cancel{width:27%}
#modalRoot .before-perk-start{width:35%}
#modalRoot .before-perk-cancel img,
#modalRoot .before-perk-start img{
  position:relative;inset:auto;display:block;width:100%;height:100%;
  object-fit:contain;z-index:1;pointer-events:none;
}
#modalRoot .before-perk-cancel:hover,
#modalRoot .before-perk-start:hover{transform:translateY(-.18cqw);filter:brightness(1.08)}
#modalRoot .before-perk-cancel:active,
#modalRoot .before-perk-start:active{transform:translateY(.08cqw) scale(.985)}

/* Stage 87 — refreshed store stall, inventory stone artwork, and compact before-game tablet */
#modalRoot .modal.before-perk-modal{
  width:min(61.6vw,92.4vh); /* 70% of the Stage 86 modal dimensions */
}


/* Stage 90 — Use a Perk book refinements (based on Stage 89) */
#modalRoot .use-perk-book-title{
  top:1.5%;
  left:29.4%;
  transform:translateX(-50%);
  width:32%;
}
#modalRoot .upb-left{top:18.5%}
#modalRoot .use-perk-book-list{
  padding:1.15cqw 1.35cqw 1.15cqw 1cqw;
  border:1px solid #b88743;
  border-radius:1.1cqw;
  background:
    linear-gradient(180deg,#f8e9c9dd,#ead2a5e8),
    url(../assets/use_perk/perk_description_parchment.webp) center/100% 100% no-repeat;
  box-shadow:inset 0 0 1.2cqw #9b6b3544,0 .2cqw .45cqw #56301433;
}
#modalRoot .upb-right{top:12.5%}
#modalRoot .upb-hero{width:17.76cqw;transform:translateY(-.3cqw)}
#modalRoot .use-perk-book-ribbon{
  width:27.6cqw;
  margin-top:-4.1cqw;
  transform:translateY(-.4cqw);
}

/* Stage 91 — Use a Perk book: fix missing hero art + keep left page content on the page */
/* Root cause: url(assets/...) inside css/main.css resolved to css/assets/... (404), so the arch mask,
   hero backdrop and list parchment never loaded. Paths above now use ../assets/. */
#modalRoot .upb-left{top:17.5%;height:61.5%;left:14%;width:31%}
#modalRoot .upb-sub{margin-bottom:.8cqw}
#modalRoot .use-perk-book-list{
  background:
    linear-gradient(180deg,#f8e9c9cc,#ead2a5d9),
    url(../assets/use_perk/perk_description_parchment.webp) center/100% 100% no-repeat;
}
#modalRoot .use-perk-book-card{
  background:
    linear-gradient(110deg,#fbe9bfd9,#f3d9a1d9),
    url(../assets/use_perk/perk_description_parchment.webp) center/cover no-repeat;
}
#modalRoot .use-perk-book-card.selected{
  background:
    linear-gradient(180deg,#ffe892e6,#f4bd3ee6),
    url(../assets/use_perk/perk_description_parchment.webp) center/cover no-repeat;
}
#modalRoot .use-perk-book-close{width:14cqw;margin-top:.6cqw}
#modalRoot .upb-hero-art{min-height:100%}

/* Stage 91b — visible parchment: the old banner image has torn transparent edges and was buried under
   85% overlays, so it looked flat. Use a clean parchment texture cropped from the book page. */
#modalRoot .use-perk-book-list{
  background:
    linear-gradient(180deg,#c8934a22,#a8672a33),
    url(../assets/use_perk/perk_list_parchment.webp) center/cover no-repeat;
  border:2px solid #b07a35;
  box-shadow:inset 0 0 1.6cqw #7a4a1a77,inset 0 0 0 .18cqw #f3d890aa,0 .2cqw .5cqw #56301444;
}
#modalRoot .use-perk-book-card{
  background:
    linear-gradient(110deg,#fff4d455,#f3d9a144),
    url(../assets/use_perk/perk_list_parchment.webp) 30% 40%/160% auto no-repeat;
  border:1px solid #b88743;
}
#modalRoot .use-perk-book-card.selected{
  background:
    linear-gradient(180deg,#ffe58a99,#f4bd3e88),
    url(../assets/use_perk/perk_list_parchment.webp) 30% 40%/160% auto no-repeat;
  border:2px solid #d9962a;
}

/* Stage 91c — every perk row is its own parchment card on a darker recessed list */
#modalRoot .use-perk-book-list{
  background:url(../assets/use_perk/perk_list_parchment_dark.webp) center/cover no-repeat;
  border:2px solid #8f5f26;
  box-shadow:inset 0 0 1.8cqw #4a2a0a99,0 .2cqw .5cqw #56301455;
}
#modalRoot .use-perk-book-card{
  background:url(../assets/use_perk/perk_row_parchment.webp) center/cover no-repeat;
  border:2px solid #a8742f;
  border-radius:.9cqw;
  box-shadow:0 .25cqw .5cqw #3d210a77,inset 0 0 .9cqw #b8803a88,inset 0 .12cqw 0 #fff6d8;
}
#modalRoot .use-perk-book-card.selected{
  background:
    linear-gradient(180deg,#ffe58a88,#f6c24e77),
    url(../assets/use_perk/perk_row_parchment.webp) center/cover no-repeat;
  border:2px solid #e0a02c;
  box-shadow:0 0 0 .22cqw #ffd45e,0 0 1.7cqw .5cqw #ffc84fb0,inset 0 0 1cqw #fff0b0;
}

/* Stage 91d — no list background; each perk row uses the Perk Inventory card art (perk_card_blank.webp) */
#modalRoot .use-perk-book-list{
  background:none;border:0;box-shadow:none;border-radius:0;
  padding:.9cqw 1.3cqw .9cqw .9cqw;gap:.6cqw;
}
#modalRoot .use-perk-book-card{
  position:relative;display:block;width:100%;height:7cqw;padding:0;border:0;border-radius:0;
  background:none;box-shadow:none;overflow:visible;
  filter:drop-shadow(0 .25cqw .3cqw #4a280a55);
}
#modalRoot .use-perk-book-card:hover{transform:translateX(.2cqw);filter:drop-shadow(0 .25cqw .3cqw #4a280a55) brightness(1.04)}
#modalRoot .upb-card-bg{position:absolute;left:-1%;top:-6%;width:102%;height:112%;object-fit:fill;pointer-events:none}
#modalRoot .upb-icon{
  position:absolute;left:3.3%;top:6.8%;width:23.6%;height:80.2%;flex:none;display:grid;place-items:center;
  border:0;border-radius:0;background:none;box-shadow:none
}
#modalRoot .upb-icon img{width:84%;height:84%;object-fit:contain;
  clip-path:polygon(14% 0,86% 0,100% 14%,100% 86%,86% 100%,14% 100%,0 86%,0 14%);
  filter:drop-shadow(0 .15cqw .2cqw #2a140655)}
#modalRoot .use-perk-book-card-copy{position:absolute;left:30%;right:4%;top:0;bottom:0;display:flex;flex-direction:column;justify-content:center;gap:.5cqw;min-width:0}
#modalRoot .use-perk-book-card-copy strong{color:#5a1d0c}
#modalRoot .use-perk-book-card.selected{
  background:none;border:0;
  filter:drop-shadow(0 0 .5cqw #ffd45e) drop-shadow(0 0 1.3cqw #ffc84fcc) brightness(1.06);
  box-shadow:none;
}
#modalRoot .use-perk-book-card.selected::before,#modalRoot .use-perk-book-card.selected::after{z-index:2}
#modalRoot .use-perk-book-card.unavailable{filter:drop-shadow(0 .25cqw .3cqw #4a280a55) saturate(.55)}


/* Stage 92 — Inventory Perks of Wisdom opens the shared book in read-only mode */
.use-perk-book-shell.upb-browse-mode .upb-browse-title{
 position:absolute;z-index:4;top:-3.2%;left:50%;transform:translateX(-50%);
 width:48%;margin:0;text-align:center;white-space:nowrap;
 font:700 clamp(20px,2.65cqw,34px)/1 Georgia,"Times New Roman",serif;
 letter-spacing:.035em;color:#6b3d17;
 text-shadow:0 1px 0 #fff0c4,0 2px 3px #3a1b0b88;
 pointer-events:none;
}
.use-perk-book-shell.upb-browse-mode .upb-right{justify-content:flex-start}
.use-perk-book-shell.upb-browse-mode .use-perk-book-detail{margin-top:.7cqw}

/* STAGE 93 — Gameplay viewport fit: match the Main Menu's proportional stage model.
   The gameplay scene keeps its native 1672:941 ratio, fills the available height
   below the compact toolbar, and never stretches to fill excess horizontal space. */
#gamePage.active{
  position:fixed;inset:0;z-index:10;
  display:flex!important;flex-direction:column;
  width:100vw;height:100vh;height:100dvh;
  min-height:0;padding:0;margin:0;
  overflow:hidden;
  background:radial-gradient(ellipse at 50% 35%,#76502c 0%,#3d291b 48%,#171c1a 100%);
}
#gamePage.active:before{position:absolute;inset:0;z-index:0;pointer-events:none}
#gamePage .game-top{
  position:relative;z-index:12;flex:0 0 clamp(40px,4.5vh,52px);
  width:min(100vw,calc((100dvh - clamp(40px,4.5vh,52px))*1672/941));
  max-width:none;height:clamp(40px,4.5vh,52px);
  margin:0 auto;padding:3px 8px;
  display:flex;align-items:center;justify-content:space-between;gap:8px;
}
#gamePage .game-top>button{padding:5px 12px;white-space:nowrap;font-size:clamp(11px,1vw,14px)}
#gamePage .game-stats{display:flex;flex:1;min-width:0;justify-content:center;gap:6px;overflow:hidden}
#gamePage .game-stats .pill{padding:4px 9px;font-size:clamp(9px,.9vw,12px);white-space:nowrap}
#gamePage .game-layout{
  position:relative;z-index:1;flex:1 1 auto;min-height:0;
  display:flex!important;align-items:center;justify-content:center;
  width:100%;max-width:none;height:auto;margin:0;padding:0;
}
#gamePage .game-layout>div:first-child{
  display:flex;flex:1 1 auto;align-items:center;justify-content:center;
  width:100%;height:100%;min-width:0;min-height:0;margin:0;padding:0;
}
#gamePage .stage{
  display:grid;place-items:center;flex:none;
  width:100%;height:100%;min-height:0;max-width:none;max-height:none;
  padding:0;margin:0;border:0;border-radius:0;
  background:transparent;box-shadow:none;overflow:visible;
}
#gamePage .stage:before{display:none}
#gamePage .scene{
  --scene-max-h:calc(100dvh - clamp(40px,4.5vh,52px));
  flex:none;
  width:min(100vw,calc(var(--scene-max-h)*1672/941));
  height:min(var(--scene-max-h),calc(100vw*941/1672));
  max-width:100vw;max-height:var(--scene-max-h);
  aspect-ratio:1672/941;margin:0 auto;
}
#gamePage .bottom-actions{display:none}
@media(max-width:700px){
  #gamePage .game-top{width:100%;padding-inline:6px;gap:5px}
  #gamePage .game-top .game-stats{justify-content:flex-start}
  #gamePage .game-stats .pill{padding:3px 6px;font-size:9px}
  #gamePage .game-top>button{padding:4px 7px;font-size:10px}
}


/* STAGE 95 — Replace ONLY the in-game Temple Menu panel background.
   All other screens and the menu's existing controls/layout remain unchanged. */
#gamePage #gameDrawer.temple-menu-pieces{
  background: url("../assets/menu/temple_menu_parchment_frame.webp") center / 100% 100% no-repeat !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}


/* STAGE 96 — Fit every gameplay Temple Menu element inside the parchment holder.
   Scoped exclusively to #gamePage #gameDrawer; other menus/screens are untouched. */
#gamePage #gameDrawer.temple-menu-pieces{
  display:grid!important;
  grid-template-rows:18% 34% 28% 10%!important;
  grid-template-columns:minmax(0,1fr)!important;
  align-content:stretch!important;
  justify-items:stretch!important;
  gap:2%!important;
  width:min(900px,92vw,calc(72vh * 1.5))!important;
  height:auto!important;
  aspect-ratio:3 / 2!important;
  max-width:92vw!important;
  max-height:72vh!important;
  min-height:0!important;
  box-sizing:border-box!important;
  padding:4.2% 4.2% 5%!important;
  overflow:hidden!important;
  background:url("../assets/menu/temple_menu_parchment_frame.webp") center / 100% 100% no-repeat!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-topline{
  grid-row:1!important;grid-column:1!important;
  min-height:0!important;height:100%!important;width:100%!important;
  display:flex!important;align-items:center!important;justify-content:center!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-header-piece{
  width:72%!important;height:100%!important;max-height:100%!important;
  object-fit:contain!important;
}
#gamePage #gameDrawer.temple-menu-pieces .menu-close-button{
  width:8%!important;height:auto!important;right:0!important;top:0!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-nav{
  grid-row:2!important;grid-column:1!important;
  display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;
  grid-template-rows:repeat(2,minmax(0,1fr))!important;
  gap:3% 2%!important;width:100%!important;height:100%!important;
  min-height:0!important;align-items:stretch!important;justify-items:stretch!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-nav .menu-image-button{
  width:100%!important;height:100%!important;min-height:0!important;
  display:flex!important;align-items:center!important;justify-content:center!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-nav .menu-image-button img{
  width:100%!important;height:100%!important;object-fit:contain!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-info-grid{
  grid-row:3!important;grid-column:1!important;
  display:grid!important;grid-template-columns:1fr 1fr!important;
  gap:2%!important;width:100%!important;height:100%!important;
  min-height:0!important;align-items:stretch!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-info-grid>img,
#gamePage #gameDrawer.temple-menu-pieces .menu-blessing-panel>img{
  width:100%!important;height:100%!important;object-fit:fill!important;
}
#gamePage #gameDrawer.temple-menu-pieces .menu-blessing-panel{height:100%!important;min-height:0!important}
#gamePage #gameDrawer.temple-menu-pieces .menu-active-perk-button{left:17%!important;top:66%!important;width:66%!important;height:25%!important}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-quick-guide{
  grid-row:4!important;grid-column:1!important;
  width:100%!important;height:100%!important;min-height:0!important;
  object-fit:contain!important;
}
@media(max-width:560px){
  #gamePage #gameDrawer.temple-menu-pieces{
    width:94vw!important;max-width:94vw!important;max-height:68vh!important;
    padding:5% 4% 6%!important;gap:1.5%!important;
  }
}


/* STAGE 97 — Enlarge Temple Menu information and make the lower information area scrollable.
   Navigation buttons remain fixed; only the information below them scrolls. */
#gamePage #gameDrawer.temple-menu-pieces{
  grid-template-rows:18% 34% minmax(0,1fr)!important;
  gap:2%!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-info-scroll{
  grid-row:3!important;grid-column:1!important;
  width:100%!important;height:100%!important;min-height:0!important;
  overflow-y:auto!important;overflow-x:hidden!important;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scrollbar-color:#9a6425 #f2d49a;
  padding:1.2% 1.4% 2%!important;
  box-sizing:border-box!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-info-content{
  display:flex!important;flex-direction:column!important;
  gap:clamp(12px,1.5vw,22px)!important;
  width:100%!important;height:auto!important;min-height:100%!important;
  align-items:stretch!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-info-grid{
  display:grid!important;grid-template-columns:1fr 1fr!important;
  gap:clamp(10px,1.2vw,18px)!important;
  width:100%!important;height:auto!important;min-height:0!important;
  flex:0 0 auto!important;align-items:start!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-info-grid>img,
#gamePage #gameDrawer.temple-menu-pieces .menu-blessing-panel>img{
  display:block!important;width:100%!important;height:auto!important;
  object-fit:contain!important;
}
#gamePage #gameDrawer.temple-menu-pieces .menu-blessing-panel{
  position:relative!important;width:100%!important;height:auto!important;
  min-height:0!important;
}
#gamePage #gameDrawer.temple-menu-pieces .menu-active-perk-button{
  left:17%!important;top:66%!important;width:66%!important;height:25%!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-quick-guide{
  display:block!important;flex:0 0 auto!important;
  width:100%!important;height:auto!important;object-fit:contain!important;
}
@media(max-width:560px){
  #gamePage #gameDrawer.temple-menu-pieces .temple-menu-info-grid{
    grid-template-columns:1fr!important;gap:12px!important;
  }
}

/* STAGE 98 — Remove the inherited decorative brown bar above the in-game Temple Menu title.
   This pseudo-element came from the generic .side-stack styling and is not part of the menu artwork. */
#gamePage #gameDrawer.temple-menu-pieces::before{
  content:none!important;
  display:none!important;
}


/* Stage 99 — Before-game Blessing readability and layout refinement.
   Scoped exclusively to the Prepare for [difficulty] modal. */
#modalRoot .modal.before-perk-modal{
  width:min(75vw,112.5vh);
}
#modalRoot .before-perk-shell{
  overflow:hidden;
}
#modalRoot .before-perk-title{
  left:28%;
  top:5.5%;
  width:44%;
  height:11.5%;
}
#modalRoot .before-perk-title span{
  font-size:clamp(18px,2.8cqw,30px);
}
#modalRoot .before-perk-info{
  left:10%;
  top:18.5%;
  width:80%;
  height:10.5%;
  padding:0 3cqw;
}
#modalRoot .before-perk-info p{
  font-size:clamp(12px,1.45cqw,17px);
  line-height:1.25;
  max-width:100%;
}
#modalRoot .before-perk-grid{
  left:8.5%;
  top:30.5%;
  width:83%;
  height:49%;
  gap:1.2cqw 1.4cqw;
  grid-template-columns:repeat(2,minmax(0,1fr));
  grid-template-rows:repeat(2,minmax(12cqw,1fr));
  align-content:start;
  overflow-y:auto;
  overflow-x:hidden;
  padding:.4cqw .8cqw .8cqw .4cqw;
  box-sizing:border-box;
  scrollbar-width:thin;
  scrollbar-color:#a66a22 #ead09a;
}
#modalRoot .before-perk-card{
  min-height:12cqw;
}
#modalRoot .before-perk-card input{
  width:2.6cqw;
  height:2.6cqw;
}
#modalRoot .before-perk-icon{
  left:3%;
  width:28%;
}
#modalRoot .before-perk-icon img{
  width:94%;
  height:94%;
}
#modalRoot .before-perk-copy{
  left:31%;
  right:4%;
  top:10%;
  bottom:7%;
  gap:.45cqw;
  overflow-y:auto;
  overflow-x:hidden;
  scrollbar-width:thin;
}
#modalRoot .before-perk-copy>strong{
  font-size:clamp(14px,1.9cqw,22px);
  line-height:1.1;
  white-space:normal;
  overflow:visible;
  text-overflow:clip;
}
#modalRoot .before-perk-meta{
  gap:.65cqw;
}
#modalRoot .before-perk-meta .rarity-tag{
  font-size:clamp(10px,1.05cqw,13px);
  padding:.22cqw .8cqw;
}
#modalRoot .before-perk-meta b{
  font-size:clamp(10px,1.1cqw,14px);
}
#modalRoot .before-perk-description{
  display:block;
  font-size:clamp(12px,1.35cqw,16px);
  line-height:1.28;
  overflow:visible;
}
#modalRoot .before-perk-lock{
  font-size:clamp(10px,1.05cqw,13px);
}
#modalRoot .before-perk-actions{
  left:8%;
  right:8%;
  bottom:3.2%;
  height:12%;
  justify-content:space-between;
  gap:0;
}
#modalRoot .before-perk-cancel{
  width:25%;
  height:100%;
}
#modalRoot .before-perk-start{
  width:30%;
  height:100%;
}
@media(max-width:700px){
  #modalRoot .modal.before-perk-modal{width:min(94vw,141vh)}
  #modalRoot .before-perk-title span{font-size:clamp(15px,3.1cqw,22px)}
  #modalRoot .before-perk-info{left:8%;width:84%;height:12%;top:17.5%}
  #modalRoot .before-perk-info p{font-size:clamp(11px,1.7cqw,14px)}
  #modalRoot .before-perk-grid{
    left:7%;width:86%;top:30%;height:49%;
    grid-template-rows:repeat(2,minmax(14cqw,1fr));
  }
  #modalRoot .before-perk-card{min-height:14cqw}
  #modalRoot .before-perk-copy>strong{font-size:clamp(12px,2.1cqw,17px)}
  #modalRoot .before-perk-description{font-size:clamp(10px,1.5cqw,13px)}
  #modalRoot .before-perk-actions{left:6%;right:6%;bottom:2.5%;height:11%}
  #modalRoot .before-perk-cancel{width:27%}
  #modalRoot .before-perk-start{width:32%}
}


/* Stage 100 — illustrated in-game exit confirmation only */
.modal.exit-confirmation-modal{
  width:min(1160px,96vw);
  max-width:1160px;
  max-height:none;
  overflow:visible;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
.exit-confirmation-shell{
  position:relative;
  width:100%;
  aspect-ratio:3 / 1;
  color:#48220d;
  isolation:isolate;
}
.exit-confirmation-panel{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:fill;
  z-index:-1;
  pointer-events:none;
}
.exit-confirmation-content{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  padding:8.5% 6.7% 7.5%;
  text-align:left;
}
.exit-confirmation-content h2{
  margin:0 0 1.1%;
  color:#4a210d;
  font:700 clamp(22px,2.6vw,40px)/1.08 Georgia,serif;
  text-shadow:0 1px 0 #fff0c9;
}
.exit-confirmation-content p{
  margin:0;
  max-width:100%;
  color:#4b260f;
  font:700 clamp(12px,1.25vw,20px)/1.28 Georgia,serif;
}
.exit-confirmation-actions{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:1.2%;
  margin-top:auto;
  width:100%;
}
.exit-confirmation-button{
  display:block;
  flex:0 1 24%;
  width:24%;
  aspect-ratio:3 / 1;
  min-width:0;
  padding:0;
  border:0;
  border-radius:0;
  background-color:transparent;
  background-position:center;
  background-repeat:no-repeat;
  background-size:100% 100%;
  box-shadow:none;
  cursor:pointer;
  transition:transform .12s ease,filter .12s ease;
}
.exit-confirmation-button:hover{transform:translateY(-2px);filter:brightness(1.12)}
.exit-confirmation-button:active{transform:translateY(1px) scale(.99)}
.exit-confirmation-button:focus-visible{outline:3px solid #fff2a8;outline-offset:3px}
.exit-confirmation-button.keep-playing{background-image:url("../assets/exit_confirmation/keep_playing.webp")}
.exit-confirmation-button.save-exit{background-image:url("../assets/exit_confirmation/save_exit.webp")}
.exit-confirmation-button.give-up{background-image:url("../assets/exit_confirmation/give_up.webp")}
@media(max-width:640px){
  .modal.exit-confirmation-modal{width:98vw}
  .exit-confirmation-content{padding:9% 6% 8%}
  .exit-confirmation-content h2{font-size:clamp(17px,4vw,26px)}
  .exit-confirmation-content p{font-size:clamp(9px,1.9vw,13px)}
  .exit-confirmation-actions{gap:.6%}
  .exit-confirmation-button{flex-basis:29%;width:29%}
}


/* Stage 102 — Prepare for difficulty title and instruction strip alignment.
   Scoped only to the Before-game Blessing modal; all perk cards and controls
   retain the Stage 101 layout. */
#modalRoot .before-perk-title{
  top:7%;
}
#modalRoot .before-perk-info{
  top:20%;
}
@media(max-width:700px){
  #modalRoot .before-perk-info{top:19%}
}

/* Stage 104 — Inventory perk information template. Scoped only to the inventory detail popup. */
#modalRoot .modal.perk-info-popup-modal{
  width:min(90vw,88vh);height:auto;max-width:none;max-height:90vh;padding:0;border:0;border-radius:0;
  overflow:visible;background:transparent;box-shadow:none
}
#modalRoot .perk-info-popup-shell{position:relative;width:100%;aspect-ratio:1/1;container-type:inline-size;isolation:isolate;color:#542b0d;font-family:Georgia,"Times New Roman",serif}
#modalRoot .perk-info-popup-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:-1;pointer-events:none}
#modalRoot .perk-info-popup-hero{position:absolute;left:7.2%;top:12.1%;width:27.7%;height:26.2%;display:grid;place-items:center;overflow:hidden;border-radius:2cqw}
#modalRoot .perk-info-popup-hero img{width:88%;height:88%;object-fit:contain;filter:drop-shadow(0 .6cqw .55cqw #63330d66)}
#modalRoot .perk-info-popup-name{position:absolute;left:38%;right:7%;top:12.7%;height:7.2%;margin:0;display:flex;align-items:center;justify-content:center;text-align:center;color:#542006;font:900 clamp(17px,3.25cqw,39px)/1.02 Georgia,serif;text-shadow:0 1px #fff2c8,0 2px 2px #8b4c1b66;overflow:hidden}
#modalRoot .perk-info-popup-rarity{position:absolute;left:51%;top:20%;width:30%;height:4.6%;display:flex;align-items:center;justify-content:center;text-align:center;color:#fff2d6;font:900 clamp(11px,1.8cqw,21px)/1 Georgia,serif;text-shadow:0 2px 2px #22052c;letter-spacing:.025em}
#modalRoot .perk-info-popup-rarity.rarity-common{color:#fff1c9}
#modalRoot .perk-info-popup-rarity.rarity-rare{color:#e3f2ff}
#modalRoot .perk-info-popup-rarity.rarity-epic{color:#fff0ff}
#modalRoot .perk-info-popup-rarity.rarity-legendary{color:#fff0a9}
#modalRoot .perk-info-popup-intro{position:absolute;left:38%;right:8%;top:26.3%;height:8.3%;margin:0;display:flex;align-items:center;justify-content:center;text-align:center;padding:0 2%;overflow:auto;color:#572b0e;font:italic 700 clamp(11px,1.65cqw,19px)/1.24 Georgia,serif}
#modalRoot .perk-info-popup-details{position:absolute;left:4.2%;top:48.8%;width:31.2%;height:23.8%;display:grid;grid-template-rows:repeat(4,1fr);color:#542b0d}
#modalRoot .perk-info-popup-details>div{display:grid;grid-template-columns:48% 52%;align-items:center;min-height:0;font:700 clamp(10px,1.75cqw,20px)/1.12 Georgia,serif}
#modalRoot .perk-info-popup-details>div span{padding-left:2%;white-space:nowrap}
#modalRoot .perk-info-popup-details>div strong{padding:0 4%;font-weight:800;text-align:left;overflow-wrap:anywhere}
#modalRoot .perk-info-popup-section{position:absolute;left:39%;right:5.5%;overflow:auto;scrollbar-width:thin;scrollbar-color:#a96b25 #f4d28c;color:#5d3718;padding:.45cqw 1cqw .35cqw 1.2cqw;font:700 clamp(10px,1.48cqw,17px)/1.22 Georgia,serif}
#modalRoot .perk-info-popup-section p{margin:0}
#modalRoot .perk-info-what{top:38.2%;height:8.9%}
#modalRoot .perk-info-usage{top:51%;height:8.5%}
#modalRoot .perk-info-requirements{top:64.3%;height:6.6%}
#modalRoot .perk-info-conditions{top:76.1%;height:15.3%;padding-top:.6cqw}
#modalRoot .perk-info-conditions ul{margin:0;padding-left:1.55em}
#modalRoot .perk-info-conditions li{margin:0 0 .22em;padding-left:.1em}
#modalRoot .perk-info-popup-back{position:absolute;right:3.6%;top:2.6%;width:13.5%;padding:0;border:0;background:transparent;box-shadow:none;z-index:2;cursor:pointer}
#modalRoot .perk-info-popup-back img{display:block;width:100%;height:auto;filter:drop-shadow(0 .25cqw .25cqw #61320b66)}
#modalRoot .perk-info-popup-back:focus-visible{outline:.22cqw solid #ffdc78;outline-offset:.15cqw;border-radius:.5cqw}
#modalRoot .inventory-grid .inv-item{cursor:pointer}
#modalRoot .inventory-grid .inv-item:focus-visible{outline:.22cqw solid #ffdc78;outline-offset:.12cqw;border-radius:.7cqw}
@media(max-aspect-ratio:1/1){#modalRoot .modal.perk-info-popup-modal{width:min(94vw,82vh)}}
@media(max-width:520px){
 #modalRoot .perk-info-popup-section{font-size:clamp(9px,1.65cqw,12px)}
 #modalRoot .perk-info-popup-details>div{font-size:clamp(9px,1.8cqw,12px)}
 #modalRoot .perk-info-popup-intro{font-size:clamp(9px,1.8cqw,12px)}
}
/* In-game WEB Bible reader — art-based layout (coordinates are % of the 1536x1024 frame) */
#modalRoot .modal.web-reader-modal{width:min(1500px,98vw,144vh);max-width:none;max-height:none;height:auto;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible;color:#3b2412}
.web-reader-shell{position:relative;width:100%;aspect-ratio:3/2;container-type:inline-size;isolation:isolate;font-family:Georgia,"Times New Roman",serif;user-select:none}
.web-reader-shell>*{position:absolute}
.web-reader-shell img{display:block;-webkit-user-drag:none}
.web-reader-shell button{font-family:inherit;-webkit-tap-highlight-color:transparent}
.web-reader-shell .web-art{inset:0;width:100%;height:100%;object-fit:fill;z-index:0;pointer-events:none;filter:drop-shadow(0 18px 34px #000a)}
.web-reader-shell>:not(.web-art){z-index:2}
/* close */
.web-close{left:92.3%;top:4.8%;width:5.2%;padding:0;border:0;background:none;cursor:pointer;z-index:5!important;filter:drop-shadow(0 .3cqw .4cqw #0009);transition:transform .12s,filter .12s}
.web-close img{width:100%;height:auto}
.web-close:hover{transform:scale(1.06);filter:drop-shadow(0 .3cqw .4cqw #0009) brightness(1.1)}
.web-close:focus-visible,.web-tab:focus-visible,.web-btn:focus-visible,.web-book-option:focus-visible,.web-chapter-option:focus-visible{outline:.25cqw solid #fff2a6;outline-offset:.15cqw}
/* testament tabs: each state is its own art */
.web-tab{top:19.2%;width:11.4%;aspect-ratio:560/251;padding:0;border:0;background:center/100% 100% no-repeat;cursor:pointer;filter:drop-shadow(0 .2cqw .25cqw #0008);transition:transform .12s,filter .12s}
.web-tab-old{left:6.2%;background-image:url("../assets/bible_reader/tab_old_inactive.webp")}
.web-tab-old.active{background-image:url("../assets/bible_reader/tab_old_active.webp")}
.web-tab-new{left:15.7%;background-image:url("../assets/bible_reader/tab_new_inactive.webp")}
.web-tab-new.active{background-image:url("../assets/bible_reader/tab_new_active.webp")}
.web-tab:not(.active){filter:drop-shadow(0 .2cqw .25cqw #0008) brightness(.92)}
.web-tab:hover{transform:translateY(-.1cqw);filter:drop-shadow(0 .2cqw .25cqw #0008) brightness(1.1)}
.web-tab.active{filter:drop-shadow(0 0 .7cqw #ffcf5acc) drop-shadow(0 .2cqw .25cqw #0008)}
/* book list */
.web-book-list{left:8.2%;top:28.1%;width:15.4%;height:47.1%;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;display:flex;flex-direction:column;gap:.42cqw;padding:.15cqw .1cqw .15cqw .1cqw;scrollbar-width:none;position:absolute}
.web-book-list::-webkit-scrollbar{display:none}
.web-book-option{position:relative;flex:0 0 auto;width:100%;height:2.55cqw;padding:0 .8cqw;display:flex;align-items:center;justify-content:center;text-align:center;font:700 max(10px,1.38cqw)/1 Georgia,serif;color:#4a2610;background:linear-gradient(#f9e7b6,#e9c681);border:1px solid #b88a45;border-radius:.45cqw;box-shadow:inset 0 1px #fff7d6,inset 0 -2px #cf9f4f99,0 .12cqw .2cqw #6b431a55;cursor:pointer;text-shadow:0 1px #fff3c8aa;transition:filter .1s,transform .1s}
.web-book-option:hover{filter:brightness(1.06);transform:translateX(.15cqw)}
.web-book-option.active{background:linear-gradient(#ffe68a,#f2b72a);border:2px solid #c78a17;color:#4b2208;box-shadow:inset 0 1px #fff8c8,0 0 .9cqw .15cqw #ffcc4acc}
.web-book-option.active::before{content:"";position:absolute;left:.55cqw;top:50%;width:.8cqw;height:.8cqw;background:#fff4b0;border:1px solid #a9681b;transform:translateY(-50%) rotate(45deg)}
/* gold scrollbars (reuse the inventory slices) */
#modalRoot .web-sb{z-index:3}
#modalRoot .web-sb-books{left:23.7%;top:27.9%;width:1.7%;height:47.4%}
#modalRoot .web-sb-verses{left:85.35%;top:27.2%;width:1.7%;height:41.2%}
/* chapter title lives on the scroll banner */
.web-title{left:47.6%;top:17.4%;width:21.2%;height:7.4%;margin:0;display:flex;align-items:center;justify-content:center;text-align:center;overflow:hidden;white-space:nowrap}
.web-title span{display:inline-block;font:700 4.3cqw/1 Georgia,"Times New Roman",serif;color:#7a1a10;text-shadow:0 .12cqw 0 #fff1c2,0 .25cqw .35cqw #5a1b0a66}
/* verses on the parchment */
.web-verse-list{left:30.7%;top:27.7%;width:54.2%;height:39.8%;overflow-y:auto;overscroll-behavior:contain;padding:.2cqw 1cqw .2cqw .2cqw;font:500 max(11px,1.5cqw)/1.4 Georgia,"Times New Roman",serif;color:#33200f;scrollbar-width:none;user-select:text;outline:none}
.web-verse-list::-webkit-scrollbar{display:none}
.web-verse{display:grid;grid-template-columns:2.4em 1fr;gap:.2em;margin:0 0 .55cqw;scroll-margin-top:.4cqw}
.web-verse b{color:#9b2316;text-align:center;font-weight:700}
/* art buttons */
.web-btn{padding:0;border:0;background:none;cursor:pointer;filter:drop-shadow(0 .25cqw .3cqw #3a1b0a88);transition:transform .12s,filter .12s}
.web-btn img{width:100%;height:auto}
.web-btn:hover:not(:disabled){transform:translateY(-.15cqw);filter:drop-shadow(0 .3cqw .4cqw #3a1b0a88) brightness(1.1)}
.web-btn:active:not(:disabled){transform:scale(.98)}
.web-btn:disabled{cursor:not-allowed;filter:grayscale(.75) brightness(.78) drop-shadow(0 .2cqw .25cqw #3a1b0a66);opacity:.7}
.web-btn-prev{left:29.3%;top:69.6%;width:15.5%}
.web-btn-search{left:47.85%;top:68.2%;width:21%}
.web-btn-next{left:71.9%;top:69.6%;width:15.5%}
/* chapter strip */
.web-chapter-label{left:8%;top:80.2%;width:19.6%;height:7%;display:flex;align-items:center;justify-content:center;text-align:center;padding:0 2.2cqw;filter:drop-shadow(0 .2cqw .25cqw #6a431a88)}
.web-chapter-label::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(#fbebc2,#e8cb92);clip-path:polygon(0 0,100% 0,96.5% 50%,100% 100%,0 100%,3.5% 50%);border-radius:.3cqw}
.web-chapter-label::after{content:"";position:absolute;inset:.35cqw 1.1cqw;z-index:-1;border-top:1px solid #c9a15a;border-bottom:1px solid #c9a15a;pointer-events:none}
.web-chapter-label span{font:700 max(10px,1.55cqw)/1.1 Georgia,serif;color:#3f2410;text-shadow:0 1px #fff3c8}
.web-chapter-list{left:29.6%;top:80.4%;width:55.4%;height:6.6%;display:flex;align-items:center;gap:.5cqw;overflow:hidden}
.web-chapter-option{flex:0 0 3.7cqw;width:3.7cqw;height:3.7cqw;padding:0;font:700 max(10px,1.85cqw)/1 Georgia,serif;color:#4a2610;background:linear-gradient(#f9e8b8,#e3bd73);border:.17cqw solid #b58a43;border-radius:.5cqw;box-shadow:inset 0 .1cqw #fff8dc,inset 0 -.2cqw #c9964399,0 .15cqw .3cqw #6b431a66;cursor:pointer;transition:filter .1s,transform .1s}
.web-chapter-option:hover{filter:brightness(1.07);transform:translateY(-.1cqw)}
.web-chapter-option.active{background:linear-gradient(#ffe786,#f0a81c);border-color:#c8881a;color:#4b2108;box-shadow:inset 0 .1cqw #fff9ca,0 0 .9cqw .2cqw #ffc94acc}
.web-chapter-gap{background:transparent;border-color:transparent;box-shadow:none;letter-spacing:.1em}
/* reference search card */
.web-search-panel{left:28%;top:34%;width:48%;z-index:6!important;padding:2cqw;background:linear-gradient(#fff2cd,#ecc977);border:.3cqw solid #c28a2b;border-radius:1.2cqw;box-shadow:0 1.2cqw 4cqw #2c1306cc,inset 0 0 0 .15cqw #fff0b5}
.web-search-panel[hidden]{display:none}
.web-search-panel form{display:flex;flex-direction:column;gap:.9cqw}
.web-search-panel label{font:700 max(13px,1.9cqw) Georgia,serif;color:#4a2610}
.web-search-panel input{width:100%;box-sizing:border-box;padding:.9cqw 1.1cqw;border:.17cqw solid #a66a27;border-radius:.6cqw;background:#fffaf0;font:max(13px,1.7cqw) Georgia,serif;color:#33200f;user-select:text}
.web-search-actions{display:flex;gap:.8cqw}
.web-search-actions button{flex:1;padding:.8cqw;border:.17cqw solid #d6a143;border-radius:.6cqw;background:linear-gradient(#b02c26,#6a1118);color:#ffeeb8;font:700 max(12px,1.5cqw) Georgia,serif;cursor:pointer}
.web-search-actions button:hover{filter:brightness(1.12)}
.web-search-panel p{margin:0;font:max(11px,1.25cqw) Georgia,serif;color:#5a3a1c}
.web-reference-link{border:1px solid #a66b25;border-radius:6px;background:linear-gradient(#ffe7a4,#e8b85f);color:#68200f;padding:5px 10px;margin:3px;font-weight:bold;cursor:pointer}
@media(prefers-reduced-motion:reduce){.web-tab,.web-btn,.web-close,.web-book-option,.web-chapter-option{transition:none}}

/* Stage 107 — keep the Continue Adventure label fully inside its button */
.main-menu-actions .main-menu-button.primary-adventure-button span.is-two-line{
  white-space:normal;
  line-height:.92;
  text-align:center;
  display:flex;
  align-items:center;
  justify-content:center;
  height:100%;
  top:50%;
  transform:translateY(-50%);
  font-size:clamp(12px,1.9cqw,31px);
}

/* Stage 109 — earned puzzle stars on the victory parchment */
#modalRoot .result-modal--win .puzzle-star-rating{
  flex:0 0 auto;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:2px;margin:-5px 0 8px;padding:2px 8px 4px;text-align:center;
}
#modalRoot .result-modal--win .puzzle-star-icons{display:flex;align-items:center;justify-content:center;gap:clamp(5px,.8vw,10px);line-height:1}
#modalRoot .result-modal--win .puzzle-star-icons span{font-family:Georgia,serif;font-size:clamp(25px,2.7vw,36px);text-shadow:0 2px 2px #6a3d1670}
#modalRoot .result-modal--win .puzzle-star-icons .earned{color:#e6ad27;text-shadow:0 1px #fff2,0 2px 3px #75440b99}
#modalRoot .result-modal--win .puzzle-star-icons .unearned{color:#8b7655;opacity:.48}
#modalRoot .result-modal--win .puzzle-star-caption{font:700 clamp(8px,.75vw,10px) system-ui,sans-serif;letter-spacing:.13em;color:#82551d}
@media(max-width:700px){
 #modalRoot .result-modal--win .puzzle-star-rating{margin:-3px 0 6px}
 #modalRoot .result-modal--win .puzzle-star-icons span{font-size:25px}
}

/* Stage 110 — functional Book of Discoveries (visual redesign intentionally deferred) */
.discoveries-menu-button{position:relative}
.discoveries-menu-icon{font-size:clamp(18px,2.1cqw,30px);line-height:1}
.book-discoveries{width:min(1120px,94vw);max-height:min(88vh,900px);overflow:hidden;display:flex;flex-direction:column;gap:12px;padding:clamp(14px,2vw,24px);background:linear-gradient(145deg,#fff6df,#ead3a0);border:3px solid #9b6729;border-radius:14px;box-shadow:inset 0 0 0 2px #fff0c5,0 18px 60px #160d08aa;color:#3e2915}
.discovery-book-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.discovery-book-heading h2{margin:0;color:#6f2818;font:700 clamp(22px,2.5vw,32px) Georgia,serif}
.discovery-book-heading .modal-sub{margin:4px 0 0}
.discovery-close{width:36px;height:36px;border:1px solid #a77a3e;border-radius:50%;background:#f7e5b9;color:#6a2b19;font-size:25px;cursor:pointer}
.discovery-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.discovery-summary>div{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:10px 5px;background:#f7e8c5;border:1px solid #c39a5b;border-radius:8px}
.discovery-summary b{font:700 23px Georgia,serif;color:#7a301b}.discovery-summary small{font:700 10px system-ui,sans-serif;color:#785b34;text-transform:uppercase;letter-spacing:.04em}
.discovery-tabs,.discovery-levels{display:flex;gap:7px;flex-wrap:wrap}
.discovery-tabs button,.discovery-levels button,.discovery-read-bible{border:1px solid #a77b40;border-radius:7px;padding:8px 12px;background:#f8e7bd;color:#60351b;font-weight:700;cursor:pointer}
.discovery-tabs button.active,.discovery-levels button.active{background:#7d2d1d;color:#fff1cb;border-color:#672015}
.discovery-browser{display:grid;grid-template-columns:minmax(210px,30%) minmax(0,1fr);gap:12px;min-height:260px;max-height:52vh;flex:1;overflow:hidden}
.discovery-list{overflow:auto;display:flex;flex-direction:column;gap:6px;padding:2px 6px 2px 2px}
.discovery-entry{display:grid;grid-template-columns:1fr auto;gap:3px 8px;text-align:left;padding:9px 10px;border:1px solid #c7a16b;border-radius:7px;background:#fff5dd;color:#4a3018;cursor:pointer}
.discovery-entry.active{border:2px solid #9a541c;background:#f9e3a9}
.discovery-entry-name{font:700 15px Georgia,serif}.discovery-entry-meta{font-size:11px;color:#7b6546}.discovery-entry-stars{grid-column:1/-1;color:#c18a16;letter-spacing:2px;font-size:15px}
.discovery-reading-area{overflow:auto;padding:14px;background:#fff8e8;border:1px solid #d1b17b;border-radius:8px}
.discovery-detail>header{padding-bottom:10px;border-bottom:1px solid #ddc79f}.discovery-detail-kicker{font:700 10px system-ui,sans-serif;letter-spacing:.12em;color:#95601f}.discovery-detail h3{margin:4px 0;color:#6d2818;font:700 clamp(22px,2.4vw,30px) Georgia,serif}.discovery-detail-stars{color:#c28b18;font-size:23px;letter-spacing:2px}.discovery-detail-stars small{font:700 10px system-ui,sans-serif;letter-spacing:0;color:#816b4b}
.discovery-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin:12px 0}.discovery-stats>div{display:flex;flex-direction:column;gap:3px;padding:8px;background:#f6e9cc;border-radius:6px}.discovery-stats small{font-size:10px;color:#7e6746}.discovery-stats b{font-size:13px;color:#57391d}
.discovery-learning-field{margin:12px 0}.discovery-learning-field h4{margin:0 0 4px;color:#81361f;font:700 15px Georgia,serif}.discovery-learning-field p{margin:0;white-space:pre-wrap;line-height:1.5;font-size:13px}.discovery-unavailable{color:#88765a;font-style:italic}.discovery-read-bible{margin-top:8px;padding:6px 10px;font-size:12px}
.discovery-personal-history ul{list-style:none;margin:0;padding:0}.discovery-personal-history li{display:flex;justify-content:space-between;gap:8px;padding:5px 0;border-bottom:1px solid #ead9b8;font-size:12px}.discovery-personal-history li b{color:#9a671a}.discovery-empty,.discovery-empty-detail{padding:20px;text-align:center;color:#826d4d;font-size:13px}.discovery-footnote{margin:0;padding-top:8px;border-top:1px solid #d7bd8e;color:#806b4d;font-size:11px;line-height:1.4}
@media(max-width:680px){.book-discoveries{width:96vw;max-height:92vh;padding:11px;gap:9px}.discovery-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.discovery-browser{grid-template-columns:minmax(105px,34%) minmax(0,1fr);gap:7px;max-height:54vh}.discovery-entry{padding:7px 6px}.discovery-entry-name{font-size:12px}.discovery-entry-meta{font-size:9px}.discovery-reading-area{padding:9px}.discovery-stats{grid-template-columns:1fr 1fr}.discovery-tabs button,.discovery-levels button{padding:7px 8px;font-size:11px}}
#modalRoot .discoveries-modal{width:min(1200px,96vw);max-height:94vh;padding:10px;overflow:hidden;background:transparent;border:0;border-radius:0;box-shadow:none}
#modalRoot .discoveries-modal .book-discoveries{width:100%;max-height:92vh;box-sizing:border-box}


/* Stage 112 — custom stone-and-parchment Book of Discoveries menu button */
.main-menu-actions .discoveries-menu-button{
  overflow:visible;
}
.main-menu-actions .discoveries-menu-button img{
  position:absolute;
  inset:0;
  left:0;
  top:0;
  width:100%;
  height:100%;
  max-width:none;
  object-fit:fill;
  object-position:center;
  pointer-events:none;
}
.main-menu-actions .discoveries-menu-button span{
  left:29%;
  right:7%;
  top:50%;
  transform:translateY(-50%);
  text-align:center;
  color:#51280f;
  font-family:Georgia,'Times New Roman',serif;
  font-weight:900;
  text-shadow:0 1px 0 #ffe9a2,1px 2px 2px #f5d078;
  white-space:normal;
  pointer-events:none;
}

/* Stage 113 — illustrated two-page Book of Discoveries */
#modalRoot .discoveries-modal{width:min(98vw, calc(92vh * 2.167));height:auto;max-height:92vh;padding:0;background:transparent;border:0;box-shadow:none;overflow:visible}
#modalRoot .book-spread{position:relative;display:grid;grid-template-columns:30.77% 69.23%;width:100%;aspect-ratio:2.167;max-height:92vh;overflow:hidden;color:#4b260e}
.book-left-page{position:relative;min-width:0;min-height:0;background:url('../assets/discoveries/my_discoveries_panel.webp') center/100% 100% no-repeat;overflow:hidden}
.book-right-page{position:relative;min-width:0;min-height:0;background:url('../assets/discoveries/book_detail_panel.webp') center/100% 100% no-repeat;overflow:hidden}
.book-close-image{position:absolute;z-index:5;left:calc(30.77% - 4.2%);top:2.4%;width:4.2%;aspect-ratio:1;border:0;background:transparent;padding:0;cursor:pointer}
.book-close-image img{width:100%;height:100%;object-fit:contain}
.book-left-count{position:absolute;left:34%;top:12.1%;width:17%;height:5.6%;display:flex;align-items:center;justify-content:center;font:700 clamp(12px,1.2vw,24px) Georgia,serif;color:#6a2b10}
.book-search{position:absolute;left:15%;top:19.4%;width:78%;height:7.2%;border:0;outline:0;background:transparent;padding:0 5%;font:600 clamp(10px,.85vw,17px) Georgia,serif;color:#60300e}
.book-search::placeholder{color:#875d35;opacity:1}
.book-difficulty-grid{position:absolute;left:16%;top:28.1%;width:75%;height:19%;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;gap:5% 3.5%}
.book-difficulty{position:relative;border:0;background-image:url('../assets/discoveries/difficulty_badges.webp');background-repeat:no-repeat;background-size:200% 200%;background-color:transparent;cursor:pointer;min-width:0;min-height:0}
.book-difficulty.easy{background-position:0 0}.book-difficulty.hard{background-position:100% 0}.book-difficulty.medium{background-position:0 100%}.book-difficulty.expert{background-position:100% 100%}
.book-difficulty span{position:absolute;right:14%;bottom:12%;font:700 clamp(10px,.9vw,18px) Georgia,serif;color:#fff2b8;text-shadow:0 2px 3px #361400}
.book-difficulty.active{filter:brightness(1.18) drop-shadow(0 0 4px #fff1a0)}
.book-category-toggle{position:absolute;left:15%;top:48.1%;width:78%;height:6.3%;border:0;background:transparent;color:#fff0c8;text-shadow:0 2px 3px #321000;font:700 clamp(11px,1.1vw,22px) Georgia,serif;text-align:left;padding:0 9%;cursor:pointer}
.book-category-toggle span{float:right;font-size:1.35em}
.book-category-options{position:absolute;z-index:4;left:17%;top:54%;width:72%;max-height:18%;overflow:auto;padding:5px;background:#f6dfa7;border:2px solid #9a4c13;border-radius:8px;box-shadow:0 4px 12px #3b1b0b88}
.book-category-options[hidden]{display:none}.book-category-option{display:block;width:100%;padding:5px 8px;border:0;border-bottom:1px solid #dfbd7c;background:transparent;text-align:left;color:#582b10;font:700 12px Georgia,serif;cursor:pointer}.book-category-option.active{background:#e9bd58}
.book-list-heading{position:absolute;left:17%;top:54.2%;width:73%;height:5.1%;display:flex;align-items:center;justify-content:space-between;padding-left:10%;font:700 clamp(11px,1.15vw,22px) Georgia,serif;color:#54270d}
.book-list-heading button{border:0;background:transparent;color:#54270d;font-size:clamp(18px,1.8vw,34px);cursor:pointer}
.book-discovery-list{position:absolute;left:15%;top:59.4%;width:78%;height:35.7%;overflow-y:auto;display:flex;flex-direction:column;gap:1.1%;padding:0 1.5% 0 0;scrollbar-color:#78400e #d7a65b;scrollbar-width:thin}
.book-discovery-row{flex:0 0 23%;min-height:23%;display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:1px;padding:2% 5%;border:0;background:linear-gradient(90deg,#fff0c9aa,#ffefc1aa);border-radius:12px;text-align:left;color:#4e260e;cursor:pointer;box-shadow:inset 0 0 0 1px #c88b3d66}
.book-discovery-row.active{background:linear-gradient(90deg,#ffd76a,#ffedb2);box-shadow:inset 0 0 0 2px #bd741c,0 0 5px #e6a52a}
.book-row-name{font:700 clamp(11px,1vw,19px) Georgia,serif;text-transform:uppercase}.book-row-meta{font:600 clamp(8px,.68vw,13px) Georgia,serif}.book-row-stars{font:700 clamp(11px,1vw,19px) Georgia,serif;letter-spacing:1px;color:#d49413;text-shadow:0 1px #fff2}
.book-no-discoveries{margin:4%;padding:12px;text-align:center;font:700 clamp(10px,.8vw,15px) Georgia,serif;color:#70451f}
.book-detail-content{position:absolute;inset:0;font-family:Georgia,'Times New Roman',serif;color:#4c250d}
.book-discovery-number{position:absolute;right:6.5%;top:5.2%;width:17%;height:7%;display:flex;align-items:center;justify-content:center;font:700 clamp(11px,1.2vw,22px) Georgia,serif;color:#63300e}
.book-field{position:absolute;overflow:hidden;display:flex;flex-direction:column;justify-content:center;padding:1.2% 2%;text-align:center}
.book-field h3{display:none}.book-field p{margin:0;font:700 clamp(10px,.95vw,18px) Georgia,serif;line-height:1.2;overflow:auto;white-space:pre-wrap}
.book-word{left:22%;top:14.2%;width:35%;height:10%}.book-reference{left:69%;top:14.2%;width:26%;height:10%}.book-category{left:22%;top:26%;width:29%;height:8.4%}.book-level{left:57%;top:26%;width:29%;height:8.4%}.book-question{left:22%;top:38.5%;width:71%;height:13.5%;justify-content:center;text-align:left;padding:1% 3%}.book-wisdom{left:21%;top:54.3%;width:31%;height:25%;justify-content:flex-start;text-align:left;padding:4% 2% 1% 3%;gap:3%}.book-wisdom p{font-size:clamp(9px,.82vw,15px);font-style:italic;line-height:1.25}.book-wisdom p b{font-style:normal;color:#8d2411}.book-lesson{left:55%;top:54.3%;width:38%;height:25%;justify-content:flex-start;padding:4% 3% 1%;text-align:left}.book-lesson p{font-size:clamp(10px,.95vw,18px);line-height:1.3}.book-rating{left:23%;top:83.2%;width:21%;height:12%;justify-content:center}.book-rating p{font-size:clamp(17px,2vw,36px);letter-spacing:1px;color:#f4b51f;text-shadow:0 1px #7c390a,0 2px 2px #fff8}.book-rating small{font:700 clamp(7px,.6vw,11px) system-ui,sans-serif;color:#633b1a}
.book-nav{position:absolute;left:47%;top:83.2%;width:48%;height:11%;display:flex;align-items:center;justify-content:space-around;gap:1%;padding:0 2%}.book-nav button{width:39%;height:78%;border:0;background:transparent;color:#fff0c9;text-shadow:0 2px 3px #3d1604;font:700 clamp(10px,.95vw,18px) Georgia,serif;cursor:pointer}.book-nav button:disabled{opacity:.35;cursor:default}.book-nav span{font:700 clamp(9px,.9vw,16px) Georgia,serif;color:#54270e;white-space:nowrap}
.book-detail-empty{position:absolute;left:22%;top:40%;width:70%;text-align:center;color:#76451e;font:700 clamp(12px,1vw,19px) Georgia,serif}
@media(max-width:850px){#modalRoot .discoveries-modal{width:98vw;max-height:94vh}#modalRoot .book-spread{aspect-ratio:2.167;max-height:94vh}.book-search{font-size:10px}.book-field p{font-size:9px}.book-wisdom p,.book-lesson p{font-size:8px}.book-nav button{font-size:9px}}
@media(max-width:560px){#modalRoot .discoveries-modal{width:98vw;max-height:90vh;overflow:auto}#modalRoot .book-spread{min-width:680px;max-height:none}.book-close-image{position:fixed}}

.book-nav button{font-size:0;background-repeat:no-repeat;background-size:100% 100%;background-position:center}
.book-nav button:first-child{background-image:url('../assets/discoveries/book_navigation_previous.webp')}
.book-nav button:last-child{background-image:url('../assets/discoveries/book_navigation_next.webp')}


/* Stage 114 — puzzle illustration integration */
.book-discovery-row{flex-direction:row;align-items:center;justify-content:flex-start;gap:3%;padding:1.8% 3%;}
.book-row-thumb{display:block;flex:0 0 23%;width:23%;aspect-ratio:1;object-fit:cover;border:2px solid #c98a2f;border-radius:8px;box-shadow:0 1px 4px #5a2a0b66;background:#f4d99d;}
.book-row-copy{min-width:0;display:flex;flex:1;flex-direction:column;justify-content:center;gap:2px;overflow:hidden;}
.book-row-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.book-detail-content .book-illustration{position:absolute;left:4.5%;top:15%;width:22%;height:29%;object-fit:cover;transform:rotate(-5deg);border:clamp(3px,.35vw,7px) solid #f8d994;border-radius:3px;box-shadow:0 2px 8px #4b210b99;z-index:1;}
@media(max-width:850px){.book-detail-content .book-illustration{border-width:3px;}}


/* Stage 115 — first-time discovery reward card */
#modalRoot .result-modal--win .victory-scene--new-discovery{
  grid-template-columns:minmax(190px,25%) minmax(190px,25%) minmax(390px,50%);
}
#modalRoot .result-modal--win .victory-scene--new-discovery .victory-roo-stage{
  min-width:0;
}
#modalRoot .result-modal--win .new-discovery-card{
  position:relative;align-self:center;justify-self:center;width:min(100%,330px);
  aspect-ratio:2/3;min-width:0;isolation:isolate;filter:drop-shadow(0 12px 18px #0009);
  animation:new-discovery-arrive .7s cubic-bezier(.18,.82,.25,1) both;
}
#modalRoot .result-modal--win .new-discovery-art{
  position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:0;
}
#modalRoot .result-modal--win .new-discovery-ribbon{
  position:absolute;z-index:1;left:13%;right:13%;top:16.5%;height:9.5%;
  display:flex;align-items:center;justify-content:center;text-align:center;
  color:#ffe9a5;font:900 clamp(10px,1vw,17px) Georgia,serif;
  text-shadow:0 2px 3px #451000,0 0 8px #a94708;letter-spacing:.035em;
}
#modalRoot .result-modal--win .new-discovery-picture{
  position:absolute;z-index:1;left:24%;top:27%;width:52%;height:28.5%;
  overflow:hidden;border-radius:5px;background:#241509;
  box-shadow:inset 0 0 0 2px #f5c45b,0 2px 7px #4b210b;
}
#modalRoot .result-modal--win .new-discovery-picture img{
  width:100%;height:100%;display:block;object-fit:cover;
}
#modalRoot .result-modal--win .new-discovery-word{
  position:absolute;z-index:1;left:17%;right:17%;top:57.5%;height:8%;
  display:flex;align-items:center;justify-content:center;text-align:center;
  color:#6f2b0c;font:900 clamp(12px,1.25vw,20px) Georgia,serif;
  text-shadow:0 1px #fff2bd;overflow-wrap:anywhere;line-height:1.05;
}
#modalRoot .result-modal--win .new-discovery-message{
  position:absolute;z-index:1;left:19%;right:19%;top:68%;height:19%;
  display:flex;align-items:center;justify-content:center;text-align:center;
  color:#684019;font:italic clamp(10px,.9vw,15px)/1.35 Georgia,serif;
  padding:2px;overflow:hidden;
}
@keyframes new-discovery-arrive{
  from{opacity:0;transform:translateY(22px) scale(.94)}
  to{opacity:1;transform:translateY(0) scale(1)}
}
@media(max-width:1100px){
 #modalRoot .result-modal--win .victory-scene--new-discovery{
  grid-template-columns:minmax(140px,22%) minmax(150px,24%) minmax(330px,54%);
 }
 #modalRoot .result-modal--win .new-discovery-card{width:100%}
}
@media(max-width:760px){
 #modalRoot .result-modal--win .victory-scene--new-discovery{
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  grid-template-rows:minmax(230px,34vh) auto auto;
  max-height:92vh;overflow-y:auto;
 }
 #modalRoot .result-modal--win .victory-scene--new-discovery .victory-roo-stage{grid-column:1;min-height:230px}
 #modalRoot .result-modal--win .victory-scene--new-discovery .new-discovery-card{
  grid-column:2;grid-row:1;width:min(100%,230px);align-self:center;
 }
 #modalRoot .result-modal--win .victory-scene--new-discovery .victory-parchment{
  grid-column:1 / -1;grid-row:2;margin:0 10px 12px;
 }
}


/* Stage 116 — Discovery card keeps its full size.
   The card is sized from the viewport HEIGHT (not from a squeezed grid column), so the Discovery
   picture can no longer shrink. The modal widens for first-time discoveries to make room.
   Picture sits UNDER the frame art and is sized to the frame's transparent opening
   (measured: x 24.5-69.8%, y 27.8-53.6% of the PNG), so nothing is covered or cropped by the frame. */
#modalRoot .modal.result-modal--new-discovery{width:min(1500px,98vw)}
#modalRoot .result-modal--new-discovery .new-discovery-card{
  --disc-w:min(calc(min(88vh,680px)*2/3),32vw);
  width:var(--disc-w);max-width:none;container-type:inline-size;
}
#modalRoot .result-modal--new-discovery .new-discovery-art{z-index:2;pointer-events:none}
#modalRoot .result-modal--new-discovery .new-discovery-picture{
  z-index:1;left:23.6%;top:26.9%;width:47.1%;height:27.5%;border-radius:0;box-shadow:none;
}
#modalRoot .result-modal--new-discovery .new-discovery-ribbon,
#modalRoot .result-modal--new-discovery .new-discovery-word,
#modalRoot .result-modal--new-discovery .new-discovery-message{z-index:3}
#modalRoot .result-modal--new-discovery .new-discovery-ribbon{font-size:clamp(9px,4.6cqw,24px);left:11%;right:15%}
#modalRoot .result-modal--new-discovery .new-discovery-word{font-size:clamp(11px,4.1cqw,22px);left:15%;right:19%}
#modalRoot .result-modal--new-discovery .new-discovery-message{font-size:clamp(9px,3.7cqw,18px);left:17%;right:21%}
@media(min-width:761px){
  #modalRoot .result-modal--new-discovery .victory-scene--new-discovery{
    grid-template-columns:minmax(150px,.8fr) min-content minmax(340px,2fr);
  }
}
@media(max-width:760px){
  #modalRoot .result-modal--new-discovery .new-discovery-card{--disc-w:min(100%,230px)}
}


/* Stage 117 — Roo and the Discovery card stand side by side (like the reference).
   Roo's column is sized from the window height too, so he is large; his image hugs the card's edge
   and the card overlaps him slightly instead of leaving a gap. */
@media(min-width:761px){
  #modalRoot .result-modal--new-discovery .victory-scene--new-discovery{
    --roo-w:min(calc(min(88vh,680px)*.62),26vw);
    grid-template-columns:var(--roo-w) min-content minmax(330px,1fr);
  }
  #modalRoot .result-modal--new-discovery .victory-roo-stage{padding:20px 0 16px;justify-content:flex-end}
  #modalRoot .result-modal--new-discovery .victory-roo-stage img{
    width:100%;height:auto;max-height:100%;object-fit:contain;object-position:right bottom;
  }
  #modalRoot .result-modal--new-discovery .victory-roo-caption{left:0;right:8%}
  #modalRoot .result-modal--new-discovery .new-discovery-card{margin-left:-7%;z-index:2}
}


/* Stage 118 — no gap between Roo and the Discovery card (Roo's size unchanged).
   Roo's image ends ~10% short of his column edge and the card art starts ~11% inside its box,
   so the card is pulled left by ~30% of its own width: ribbon tip meets Roo's fist, laurels meet his side. */
@media(min-width:761px){
  #modalRoot .result-modal--new-discovery .new-discovery-card{margin-left:calc(var(--disc-w)*-.25)}
  #modalRoot .result-modal--new-discovery .victory-roo-stage{z-index:3;pointer-events:none}
}


/* Stage 119 — victory scroll tucks behind the Discovery plaque (plaque's right edge overlaps the scroll's left roller),
   closing the last gap so Roo + plaque + scroll read as one group. The plaque stays in front (z-index 2);
   the scroll simply widens leftwards, so the group's right edge and the centered modal are unchanged. */
@media(min-width:761px){
  #modalRoot .result-modal--new-discovery .victory-scene--new-discovery{justify-content:center}
  #modalRoot .result-modal--new-discovery .victory-parchment{
    margin-left:calc(min(calc(min(88vh,680px)*2/3),32vw)*-.18);z-index:1;
  }
}

/* Stage 119b — keep the scroll at its previous width: shrink the (centered) modal by exactly the overlap,
   so the whole group stays centered and the scroll's text size / layout does not change. */
@media(min-width:761px){
  #modalRoot .modal.result-modal--new-discovery{
    width:calc(min(1500px,98vw) - min(calc(min(88vh,680px)*2/3),32vw)*.18);
  }
}


/* Stage 120 — new plaque art (title + congratulation text are baked into the PNG, so those overlays are removed).
   The parchment panel is opaque, so the Discovery picture sits ON TOP of the art, inside the panel
   (kept clear of the laurels and ribbon curls); the puzzle name goes on the blank scroll banner. */
#modalRoot .result-modal--win .new-discovery-ribbon,
#modalRoot .result-modal--win .new-discovery-message{display:none}
#modalRoot .result-modal--new-discovery .new-discovery-art{z-index:0}
#modalRoot .result-modal--new-discovery .new-discovery-picture{
  z-index:1;left:21.8%;top:26.4%;width:56.4%;height:31.8%;border-radius:3px;
  box-shadow:inset 0 0 0 2px #d9a73f,0 0 0 2px #fff0b8aa,0 3px 8px #4b2a0b99;
}
#modalRoot .result-modal--new-discovery .new-discovery-word{
  z-index:2;left:22%;right:22%;top:59.4%;height:7.6%;font-size:clamp(11px,4.3cqw,23px);
}


/* Stage 114 — give the illustrated Book of Discoveries a true viewport-sized overlay.
   The modal must not inherit the small generic dialog sizing. */
#modalRoot .discoveries-backdrop{
  position:fixed;inset:0;z-index:1000;
  display:flex;align-items:center;justify-content:center;
  width:100vw;height:100vh;height:100dvh;
  box-sizing:border-box;padding:2vh 2vw;overflow:hidden;
  background:rgba(4,12,10,.82);
}
#modalRoot .discoveries-backdrop>.discoveries-modal{
  flex:0 1 auto;width:min(96vw,1760px,calc(94dvh * 2.167)) !important;
  max-width:none !important;height:auto !important;max-height:94dvh !important;
  margin:0;padding:0 !important;box-sizing:border-box;
  overflow:visible !important;background:transparent !important;
  border:0 !important;border-radius:0 !important;box-shadow:none !important;
}
#modalRoot .discoveries-backdrop .book-spread{
  display:grid;width:100%;height:auto;max-height:94dvh;aspect-ratio:2.167/1;
  grid-template-columns:30.77% 69.23%;overflow:hidden;
}
/* Increase small labels and text while preserving the artwork's proportional layout. */
@media(max-width:700px){
 #modalRoot .discoveries-backdrop{padding:1vh 1vw;overflow:auto}
 #modalRoot .discoveries-backdrop>.discoveries-modal{width:98vw !important;max-height:none !important}
 #modalRoot .discoveries-backdrop .book-spread{aspect-ratio:2.167/1}
}


/* Stage 117 — Book of Discoveries: every label, value and badge count is anchored to a slot measured on the art.
   .book-spread is a size container, so 1cqw = 1% of the book's width and all type scales with the book. */
#modalRoot .book-spread{container-type:inline-size}
#modalRoot .book-spread *{box-sizing:border-box}
#modalRoot .book-left-page,#modalRoot .book-right-page{background-size:100% 100%;overflow:visible}

/* ---- left page ---- */
#modalRoot .book-left-count{left:26.6%;top:9.7%;width:44.8%;height:4.4%;gap:.35em;font:700 1.4cqw/1 Georgia,serif;color:#6a2b10;white-space:nowrap}
#modalRoot .book-left-count b{font-size:1.25em}
#modalRoot .book-search{left:13.2%;top:15.3%;width:76%;height:5%;padding:0 3% 0 14.5%;font:600 1.1cqw Georgia,serif;color:#60300e}
#modalRoot .book-ribbon-label{position:absolute;left:24.8%;top:22.1%;width:39.4%;height:3.8%;display:flex;align-items:center;justify-content:center;font:700 1.05cqw/1 Georgia,serif;color:#fff0c8;text-shadow:0 .15cqw .2cqw #321000;white-space:nowrap;pointer-events:none}
#modalRoot .book-difficulty-grid{left:12%;top:27.3%;width:76%;height:17.2%;grid-template-columns:1fr 1fr;grid-template-rows:auto auto;align-content:space-between;gap:0 3%}
#modalRoot .book-difficulty{width:100%;aspect-ratio:3/1;height:auto;padding:0;background-size:200% 200%;transition:filter .15s,transform .15s}
#modalRoot .book-difficulty:hover{filter:brightness(1.1)}
#modalRoot .book-difficulty .book-diff-count{position:absolute;right:3%;bottom:-8%;right:3%;min-width:31%;height:33%;padding:0 .6cqw;display:flex;align-items:center;justify-content:center;gap:.05em;
  font:700 .85cqw/1 Georgia,serif;color:#fff3c4;white-space:nowrap;text-shadow:0 .1cqw .15cqw #2a0f00;
  background:linear-gradient(90deg,#d99a22 var(--p,0%),#3b1d0b var(--p,0%));border:.12cqw solid #f1c35c;border-radius:99px;box-shadow:0 .2cqw .4cqw #2a0f0099,inset 0 0 .25cqw #0006;z-index:2}
#modalRoot .book-difficulty .book-diff-count b{font-size:1.2em;color:#fff}
#modalRoot .book-category-toggle{left:12.6%;top:45.5%;width:77.6%;height:3.9%;padding:0 12% 0 15.7%;font:700 1.1cqw/1 Georgia,serif;display:flex;align-items:center}
#modalRoot .book-category-options{left:13%;top:49.6%;width:76%;max-height:20%;z-index:6}
#modalRoot .book-category-option{font:700 1cqw Georgia,serif;padding:.45cqw .7cqw}
#modalRoot .book-list-heading{left:12.6%;top:50.4%;width:77.6%;height:4.2%;padding:0 2% 0 3%;font:700 1.25cqw/1 Georgia,serif;color:#54270d}
#modalRoot .book-list-heading button{font-size:1.7cqw;line-height:1;padding:0 .4cqw}
#modalRoot .book-discovery-list{left:12.5%;top:55.2%;width:77%;height:35.5%;gap:.45cqw;padding:0 .7cqw 0 0}
#modalRoot .book-discovery-row{flex:0 0 auto;height:4.6cqw;min-height:0;padding:.35cqw .8cqw;gap:.8cqw;border-radius:.9cqw}
#modalRoot .book-row-thumb{flex:0 0 auto;width:auto;height:100%;aspect-ratio:1;border-width:.15cqw;border-radius:.55cqw}
#modalRoot .book-row-copy{gap:.15cqw}
#modalRoot .book-row-name{font:700 1.1cqw/1.1 Georgia,serif}
#modalRoot .book-row-meta{font:600 .8cqw/1.1 Georgia,serif}
#modalRoot .book-row-stars{font:700 1cqw/1 Georgia,serif;letter-spacing:.1em}
#modalRoot .book-no-discoveries{font:700 1cqw/1.3 Georgia,serif}

/* ---- right page ---- */
#modalRoot .book-discovery-number{left:78.3%;right:auto;top:5.2%;width:17%;height:9%;font:700 1.1cqw/1 Georgia,serif;white-space:nowrap;color:#63300e}
#modalRoot .book-field{position:absolute;display:flex;flex-direction:column;justify-content:center;overflow:hidden;padding:0 1.2cqw;text-align:center}
#modalRoot .book-field h3{display:none}
#modalRoot .book-field p{margin:0;overflow:visible;white-space:normal;overflow-wrap:anywhere;font-size:max(8px,calc(var(--s,1.5cqw) * var(--fit,1)));line-height:1.18;font-family:Georgia,serif}
#modalRoot .book-word{left:29.4%;top:19.2%;width:35.4%;height:6.8%;--s:2.3cqw}
#modalRoot .book-word p{font-weight:800;color:#8a1c14;text-transform:uppercase;letter-spacing:.02em;line-height:1.05}
#modalRoot .book-reference{left:67.2%;top:20.6%;width:26.2%;height:5.5%;--s:1.45cqw}
#modalRoot .book-category{left:30.2%;top:31.8%;width:29.2%;height:5.1%;--s:1.5cqw}
#modalRoot .book-level{left:61.8%;top:31.8%;width:31.4%;height:5.1%;--s:1.5cqw}
#modalRoot .book-question{left:30.4%;top:42.7%;width:65.5%;height:10.6%;--s:1.5cqw;text-align:left;padding:0 1.8cqw}
#modalRoot .book-wisdom{left:29.2%;top:60.8%;width:31.1%;height:19.3%;justify-content:flex-start;text-align:left;padding:.7cqw 1.3cqw;--s:1.25cqw}
#modalRoot .book-wisdom p{font-style:italic;line-height:1.25;margin:0 0 .55em}
#modalRoot .book-wisdom p b{font-style:normal;color:#8d2411}
#modalRoot .book-lesson{left:62.5%;top:60.8%;width:32.8%;height:19.5%;justify-content:flex-start;text-align:left;padding:.9cqw 1.5cqw;--s:1.5cqw}
#modalRoot .book-lesson p{line-height:1.3}
#modalRoot .book-rating{left:30%;top:86.5%;width:21.1%;height:5%;padding:0;justify-content:center;align-items:center}
#modalRoot .book-rating p{display:flex;gap:.25cqw;font-size:2cqw;line-height:1;letter-spacing:0}
#modalRoot .book-rating i{font-style:normal;font-size:1em;line-height:1}
#modalRoot .book-rating i.on{color:#ffc928;-webkit-text-stroke:.07cqw #8a4a08;text-shadow:0 .12cqw 0 #8a4a08}
#modalRoot .book-rating i.off{color:#d9e8f7;opacity:.6;-webkit-text-stroke:.07cqw #32658f}
#modalRoot .book-detail-content .book-illustration{left:10%;top:18.3%;width:18%;height:27.6%;transform:none;border:0;border-radius:.3cqw;box-shadow:inset 0 0 .4cqw #4b210b88}
#modalRoot .book-nav{left:53%;top:85.6%;width:43%;height:9%;padding:0}
#modalRoot .book-nav span{font:700 1.1cqw/1 Georgia,serif}
#modalRoot .book-detail-empty{left:30%;top:42%;width:62%;font:700 1.5cqw/1.3 Georgia,serif}

/* Stage 118 — Previous / Next buttons use their own artwork at the art's true aspect ratio (no sprite stretching) */
#modalRoot .book-nav{justify-content:space-between;gap:0}
#modalRoot .book-nav button{flex:0 0 auto;width:10.6cqw;height:auto;aspect-ratio:2.73;padding:0;border:0;background-color:transparent;background-repeat:no-repeat;background-size:100% 100%;background-position:center;font-size:0;filter:drop-shadow(0 .2cqw .3cqw #3b190b88);transition:transform .12s,filter .12s}
#modalRoot .book-nav button:first-child{background-image:url('../assets/discoveries/book_nav_previous.webp')}
#modalRoot .book-nav button:last-child{background-image:url('../assets/discoveries/book_nav_next.webp')}
#modalRoot .book-nav button:hover:not(:disabled){transform:translateY(-.15cqw);filter:brightness(1.1) drop-shadow(0 .3cqw .4cqw #3b190b99)}
#modalRoot .book-nav button:active:not(:disabled){transform:translateY(0) scale(.97)}
#modalRoot .book-nav button:disabled{opacity:.4;filter:grayscale(.6);cursor:default}
#modalRoot .book-nav{left:53%;top:84.4%;width:39%;height:8.6%}

/* Stage 119 — discovery picture sits UNDER the frame art, tilted to match the polaroid (measured -7.7deg).
   Layers inside the right page: parchment bed (-1) < picture (0) < page art with transparent window (1) < text/controls (2). */
#modalRoot .book-right-page{background:none;isolation:isolate;overflow:hidden}
#modalRoot .book-right-page::before{content:"";position:absolute;inset:0;z-index:1;pointer-events:none;background:url('../assets/discoveries/book_detail_panel.webp') center/100% 100% no-repeat}
#modalRoot .book-right-page::after{content:"";position:absolute;z-index:-1;left:10.19%;top:19.4%;width:17.07%;height:25.6%;transform:rotate(-7.7deg);background:radial-gradient(circle at 50% 45%,#f4d28c,#d9a957);pointer-events:none}
#modalRoot .book-detail-content>*,#modalRoot .book-right-page>.book-detail-empty{z-index:2}
#modalRoot .book-detail-content>.book-illustration{z-index:0;left:10.19%;top:19.4%;width:17.07%;height:25.6%;transform:rotate(-7.7deg);transform-origin:50% 50%;object-fit:cover;border:0;border-radius:0;box-shadow:none}

/* Stage 118 — clickable Scripture references (Discovery Book, victory, defeat) */
.web-reference-link:hover{filter:brightness(1.08)}
.web-reference-link:focus-visible{outline:2px solid #fff3c4;outline-offset:2px}
.scripture-ref-inline{border:0;background:none;padding:0 .08em;margin:0;font:inherit;font-weight:800;color:#7a2d12;border-radius:3px;text-decoration:underline;text-decoration-color:rgba(122,45,18,.45);text-underline-offset:.14em;cursor:pointer;text-align:inherit}
.scripture-ref-inline:hover,.scripture-ref-inline:focus-visible{color:#a8340f;background:rgba(232,184,95,.38);outline:none}
.scripture-ref-sep{font-weight:700}
.scripture-ref-plain{font-weight:700}
.web-verse.is-target{background:linear-gradient(90deg,rgba(255,213,102,.55),rgba(255,213,102,.14));border-radius:.4cqw;box-shadow:inset .3cqw 0 0 #c98a1b}

/* Gameplay stats drawer — illustrated panel overlay, independent of the Temple Menu */
#gamePage .stats-drawer-tab{position:fixed;z-index:48;left:0;top:50%;transform:translateY(-50%);width:clamp(76px,7.2vw,118px);padding:0;border:0!important;background:transparent!important;box-shadow:none!important;cursor:pointer;transition:opacity .18s,transform .22s;}
#gamePage .stats-drawer-tab img{display:block;width:100%;height:auto;filter:drop-shadow(3px 5px 7px #0008)}
#gamePage .stats-drawer-tab.is-hidden{opacity:0;pointer-events:none;transform:translate(-24px,-50%)}
#gamePage .game-stats-drawer{position:fixed;z-index:44;left:0;top:50%;width:min(61.3vh,610px,88vw);height:auto;aspect-ratio:2/3;transform:translate(-105%,-50%);visibility:hidden;transition:transform .34s cubic-bezier(.2,.8,.2,1),visibility .34s;}
#gamePage .game-stats-drawer.is-open{transform:translate(0,-50%);visibility:visible}
#gamePage .stats-drawer-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none;filter:drop-shadow(8px 8px 18px #0008)}
#gamePage .stats-drawer-close{position:absolute;z-index:2;left:68%;top:2.5%;width:16%;height:10%;border:0!important;border-radius:50%;background:transparent!important;box-shadow:none!important;cursor:pointer}
#gamePage .stats-drawer-values{position:absolute;inset:0;z-index:1;pointer-events:none}
#gamePage .stats-drawer-value{position:absolute;left:39%;width:51%;height:5.3%;display:flex;align-items:center;justify-content:center;color:#4b2b0b;font-family:Georgia,serif;font-size:clamp(17px,1.45vw,25px);font-weight:900;text-shadow:0 1px #fff4c8,0 2px 2px #7b4a13a8;white-space:nowrap}
#gamePage #drawerCoins{top:20.2%}#gamePage #drawerStreak{top:32%}#gamePage #drawerRelics{top:43.3%}#gamePage #drawerSolved{top:54.4%}#gamePage #drawerStarRating{top:65.2%}
#gamePage .stats-drawer-action{position:absolute;z-index:3;left:16%;width:80%;height:8.4%;padding:0;border:0!important;background:transparent!important;box-shadow:none!important;cursor:pointer;}
#gamePage .stats-drawer-action img{display:block;width:100%;height:100%;object-fit:fill;filter:drop-shadow(0 3px 3px #542b0b66)}
#gamePage .stats-drawer-map{top:78.2%}#gamePage .stats-drawer-options{top:88.2%}
@media(max-width:700px){
 #gamePage .game-stats-drawer{width:min(61.3vh,88vw);height:auto}
 #gamePage .stats-drawer-tab{width:74px}
 #gamePage .stats-drawer-value{font-size:clamp(15px,3.8vw,20px)}
}


/* STAGE 121 — Keep the gameplay statistics drawer entirely inside the temple artwork.
   The drawer and its trigger are anchored to the 1672:941 scene, not the browser viewport. */
#gamePage .scene .stats-drawer-tab{
  position:absolute;z-index:60;left:0;top:50%;transform:translateY(-50%);
  width:clamp(72px,11cqw,150px);height:auto;padding:0;margin:0;
  display:block;border:0!important;border-radius:0!important;
  background:transparent!important;box-shadow:none!important;cursor:pointer;
  transition:opacity .18s,transform .24s;
}
#gamePage .scene .stats-drawer-tab img{display:block;width:100%;height:auto;object-fit:contain;filter:drop-shadow(3px 5px 7px #0008)}
#gamePage .scene .stats-drawer-tab.is-hidden{opacity:0;pointer-events:none;transform:translate(-110%,-50%)}
#gamePage .scene .game-stats-drawer{
  position:absolute;z-index:59;left:0;top:50%;
  width:clamp(190px,31cqw,365px);height:auto;aspect-ratio:2/3;
  transform:translate(-105%,-50%);visibility:hidden;
  transition:transform .34s cubic-bezier(.2,.8,.2,1),visibility .34s;
  filter:drop-shadow(7px 7px 14px #0009);
}
#gamePage .scene .game-stats-drawer.is-open{transform:translate(0,-50%);visibility:visible}
#gamePage .scene .stats-drawer-art{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none}
#gamePage .scene .stats-drawer-close{position:absolute;z-index:4;left:68%;top:2.5%;width:16%;height:10%;padding:0;border:0!important;border-radius:50%;background:transparent!important;box-shadow:none!important;cursor:pointer}
#gamePage .scene .stats-drawer-values{position:absolute;inset:0;z-index:2;pointer-events:none}
#gamePage .scene .stats-drawer-value{
  position:absolute;left:39%;width:51%;height:5.3%;display:flex;align-items:center;justify-content:center;
  color:#4b2b0b;font-family:Georgia,serif;font-size:clamp(10px,2.0cqw,18px);
  font-weight:900;text-shadow:0 1px #fff4c8,0 2px 2px #7b4a13a8;white-space:nowrap
}
#gamePage .scene #drawerCoins{top:20.2%}#gamePage .scene #drawerStreak{top:32%}
#gamePage .scene #drawerRelics{top:43.3%}#gamePage .scene #drawerSolved{top:54.4%}
#gamePage .scene #drawerStarRating{top:65.2%}
#gamePage .scene .stats-drawer-action{
  position:absolute;z-index:5;left:22%;width:58%;height:auto;aspect-ratio:3/1;
  padding:0;margin:0;border:0!important;border-radius:0!important;
  background:transparent!important;box-shadow:none!important;cursor:pointer;
}
#gamePage .scene .stats-drawer-action img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 2px 3px #542b0b66)}
#gamePage .scene .stats-drawer-map{top:75.5%}#gamePage .scene .stats-drawer-options{top:86.5%}
@media(max-width:700px){
  #gamePage .scene .stats-drawer-tab{width:clamp(58px,12cqw,88px)}
  #gamePage .scene .game-stats-drawer{width:clamp(170px,36cqw,245px)}
  #gamePage .scene .stats-drawer-value{font-size:clamp(9px,2.4cqw,13px)}
  #gamePage .scene .stats-drawer-action{left:24%;width:54%}
}

/* STAGE 122 — Main-menu Bible Reader and utility controls */
.main-menu-actions .main-menu-button img{object-fit:contain!important;}
.main-menu-actions .discoveries-menu-button img,
.main-menu-actions .bible-reader-menu-button img{width:100%!important;height:100%!important;inset:0!important;object-fit:fill!important;}
.main-menu-actions .discoveries-menu-button span,
.main-menu-actions .bible-reader-menu-button span{left:29%;right:6%;font-size:clamp(11px,1.75cqw,28px);}
.main-menu-utility-actions{position:absolute;top:2.8%;right:2.7%;z-index:8;display:flex;flex-direction:column;align-items:center;gap:1.2vh;width:clamp(48px,5.8vw,92px);}
.main-menu-utility-button{display:block;position:relative;width:100%;aspect-ratio:1/1;padding:0;border:0;background:transparent;cursor:pointer;filter:drop-shadow(0 3px 5px #24130799);}
.main-menu-utility-button img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;}
.main-menu-utility-button:hover{filter:brightness(1.12) drop-shadow(0 0 8px #ffdb72aa);transform:scale(1.04);}
.main-menu-utility-button:active{transform:scale(.96);}
@media(max-width:680px){.main-menu-utility-actions{top:2%;right:2%;width:clamp(40px,8vw,58px);gap:1vh;}}
.main-menu-actions .discoveries-menu-button img,
.main-menu-actions .bible-reader-menu-button img{left:0!important;top:50%!important;width:100%!important;height:auto!important;max-height:100%!important;transform:translateY(-50%)!important;object-fit:contain!important;}

/* STAGE 124 — Replace the existing main-menu button artwork with the supplied transparent assets.
   Keep the button boxes at the supplied artwork's 3:1 aspect ratio so the PNGs are never stretched. */
.main-menu-actions .discoveries-menu-button,
.main-menu-actions .bible-reader-menu-button{
  left:65.45%!important;
  width:18.7%!important;
  height:11.05%!important;
  overflow:visible;
}
.main-menu-actions .discoveries-menu-button img,
.main-menu-actions .bible-reader-menu-button img{
  position:absolute!important;
  left:0!important;
  top:0!important;
  width:100%!important;
  height:100%!important;
  max-height:none!important;
  transform:none!important;
  object-fit:contain!important;
  object-position:center!important;
}
.main-menu-actions .discoveries-menu-button span,
.main-menu-actions .bible-reader-menu-button span{
  left:32%!important;
  right:5%!important;
  top:50%!important;
  transform:translateY(-50%)!important;
  white-space:nowrap!important;
  text-align:center!important;
  font-size:clamp(10px,1.25cqw,21px)!important;
  line-height:1!important;
  color:#51280f!important;
  text-shadow:0 1px 0 #ffe9a2,1px 2px 2px #f5d078!important;
}
.main-menu-settings-button img{
  object-fit:contain!important;
}


/* STAGE 126 — Match the visible plaque height to Inventory.
   All three controls share the same button box (26.9% x 11.05%).
   Inventory visible artwork extends to 148.05% of that box height;
   apply the same artwork scale and offset to both parchment plaques. */
.main-menu-actions .discoveries-menu-button,
.main-menu-actions .bible-reader-menu-button{
  left:61.35%!important;
  width:26.9%!important;
  height:11.05%!important;
  overflow:visible!important;
}
.main-menu-actions .discoveries-menu-button img,
.main-menu-actions .bible-reader-menu-button img{
  position:absolute!important;
  left:-1.41%!important;
  top:-23.38%!important;
  width:102.91%!important;
  height:148.05%!important;
  max-width:none!important;
  max-height:none!important;
  transform:none!important;
  object-fit:fill!important;
  object-position:center!important;
}
.main-menu-actions .discoveries-menu-button span,
.main-menu-actions .bible-reader-menu-button span{
  left:30%!important; right:5%!important; top:50%!important; transform:translateY(-50%)!important;
  white-space:nowrap!important; text-align:center!important;
  font-size:clamp(10px,1.35cqw,22px)!important; line-height:1!important;
  color:#51280f!important; text-shadow:0 1px 0 #ffe9a2,1px 2px 2px #f5d078!important;
}
.main-menu-utility-button img{object-fit:contain!important;}


/* STAGE 128 — Stats drawer: never covers the keyboard, buttons live inside the panel, values centred.
   The panel is sized from the SCENE HEIGHT so it ends above the first keyboard row
   (keyboard starts ~77% down the scene), letting the player keep it open while playing. */
#gamePage .scene .game-stats-drawer{
  top:1%;height:72%;width:auto;aspect-ratio:2/3;
  transform:translate(-105%,0);
}
#gamePage .scene .game-stats-drawer.is-open{transform:translate(0,0)}
#gamePage .scene .stats-drawer-tab{top:36%}
#gamePage .scene .stats-drawer-tab.is-hidden{transform:translate(-110%,-50%)}
/* value text centred inside each parchment value pill */
#gamePage .scene .stats-drawer-value{
  left:34%;width:37.5%;height:5.6%;
  font-size:clamp(10px,1.9cqw,19px);line-height:1;
}
#gamePage .scene #drawerCoins{top:18.9%}
#gamePage .scene #drawerStreak{top:30.7%}
#gamePage .scene #drawerRelics{top:42.4%}
#gamePage .scene #drawerSolved{top:53.6%}
#gamePage .scene #drawerStarRating{top:64.5%}
/* Back to Map / Options placed on the empty parchment inside the frame */
#gamePage .scene .stats-drawer-action{left:24.5%;width:40%;aspect-ratio:3/1;height:auto}
#gamePage .scene .stats-drawer-map{top:72.2%}
#gamePage .scene .stats-drawer-options{top:81.6%}
@media(max-width:700px){
  #gamePage .scene .game-stats-drawer{width:auto;height:72%}
  #gamePage .scene .stats-drawer-action{left:24.5%;width:40%}
  #gamePage .scene .stats-drawer-value{font-size:clamp(8px,2.4cqw,13px)}
}


/* STAGE 129 — Keep the "Biblical Hangaroo" title visible; wider Back to Map / Options buttons.
   The drawer now starts below the title logo and ends above the keyboard. */
#gamePage .scene .game-stats-drawer{top:19.5%;height:57%}
#gamePage .scene .stats-drawer-tab{top:48%}
#gamePage .scene .stats-drawer-action{
  left:15.5%;width:56%;height:9.8%;aspect-ratio:auto;
}
#gamePage .scene .stats-drawer-action img{object-fit:fill}
#gamePage .scene .stats-drawer-map{top:71.2%}
#gamePage .scene .stats-drawer-options{top:81.4%}
@media(max-width:700px){
  #gamePage .scene .game-stats-drawer{height:57%}
  #gamePage .scene .stats-drawer-action{left:15.5%;width:56%}
}

/* Stage 130 — floating rarity chest reveal and collectible reward */
/* ===== STAGE 131 — Treasure chest layer, Treasure Vault, rarity effects ===== */
#chestLayer{position:fixed;inset:0;z-index:40;pointer-events:none}
#chestLayer:empty{display:none}
#chestLayer .chest-backdrop{pointer-events:auto;position:absolute;inset:0;display:grid;place-items:center;padding:14px;overflow:auto;background:radial-gradient(ellipse at 50% 42%,#173b4cdd 0%,#07141ef2 72%);backdrop-filter:blur(6px);animation:chest-fade .35s ease both}
.chest-shell{--glow:#56c8ff;--glow2:#2c91d3;--spark:#bfeaff;position:relative;width:min(640px,100%);display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;padding:18px 14px;color:#fff0c8;font-family:Georgia,serif}
.chest-shell.rarity-rare{--glow:#e3edf7;--glow2:#9db4c9;--spark:#ffffff}
.chest-shell.rarity-epic{--glow:#ffd25a;--glow2:#d9902a;--spark:#fff0a8}
.chest-shell.rarity-legendary{--glow:#c36bff;--glow2:#ffd25a;--spark:#f1d4ff}
.chest-heading{position:relative;z-index:3}
.chest-kicker{display:block;color:#e6bd70;font:900 10px/1.3 Georgia,serif;letter-spacing:.2em;text-shadow:0 2px 5px #0008}
.chest-heading h2{margin:7px 0 3px;color:#fff0c8;font:900 clamp(24px,4vw,34px) Georgia,serif;text-shadow:0 3px 8px #000a}
.chest-heading p{margin:0 auto;color:#d4c4a4;font:italic 13px Georgia,serif;max-width:46ch}
.chest-stage{position:relative;width:min(70vw,380px);height:min(70vw,380px);max-height:38vh;display:grid;place-items:center;margin:2px 0}
.chest-stage img{position:relative;z-index:2;display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 16px 20px #0009)}
.chest-stage img.is-floating{animation:chest-float 3s ease-in-out infinite}
.chest-aura{position:absolute;inset:14%;border-radius:50%;background:radial-gradient(circle,var(--glow) 0%,transparent 68%);opacity:.38;animation:chest-aura-pulse 2.2s ease-in-out infinite alternate}
.chest-rays{position:absolute;inset:-14%;display:none;border-radius:50%;opacity:0;background:repeating-conic-gradient(from 0deg,var(--glow) 0 6deg,transparent 6deg 24deg);-webkit-mask:radial-gradient(circle,#000 0%,transparent 66%);mask:radial-gradient(circle,#000 0%,transparent 66%);animation:chest-spin 14s linear infinite}
.rarity-epic .chest-rays,.rarity-legendary .chest-rays{display:block}
.chest-shell.is-lit .chest-rays,.chest-earned .chest-rays{opacity:.5}
.chest-shell.is-lit .chest-aura{opacity:.95;transform:scale(1.18)}
.rarity-rare.is-lit .chest-aura{box-shadow:0 0 70px 24px #e3edf788}
.chest-stage img.is-entering{animation:chest-enter .95s cubic-bezier(.2,.9,.25,1.25) both}
.chest-stage img.is-entering.is-floating{animation:chest-enter .95s cubic-bezier(.2,.9,.25,1.25) both,chest-float 3s ease-in-out .95s infinite}
.chest-opening .chest-stage img.is-shaking{animation:chest-shake .12s linear infinite;filter:drop-shadow(0 0 22px var(--glow)) drop-shadow(0 16px 20px #0009)}
.chest-opening .chest-stage img.is-open{animation:chest-pop .5s ease-out both;filter:drop-shadow(0 0 30px var(--glow)) drop-shadow(0 16px 20px #0009)}
.chest-sparks{position:absolute;inset:0;z-index:3;pointer-events:none}
.chest-sparks i{position:absolute;left:50%;top:46%;width:9px;height:9px;border-radius:50%;background:var(--spark);box-shadow:0 0 12px 3px var(--glow);opacity:0}
.chest-stage.burst .chest-sparks i{animation:chest-spark 1.2s ease-out forwards;animation-delay:calc(var(--i)*16ms)}
.chest-flash{position:fixed;inset:0;z-index:1;background:radial-gradient(circle at 50% 42%,#fff 0%,var(--glow) 40%,transparent 75%);opacity:0;pointer-events:none}
.chest-flash.go{animation:chest-flash .9s ease-out both}
.rarity-rare .chest-flash.go{animation-duration:.7s}
.is-cinematic .chest-flash.go{animation:chest-flash-big 1.6s ease-out both}
.chest-bars i{position:fixed;left:0;right:0;height:5vh;background:#000;z-index:0;animation:chest-bar 1s ease-out both}
.is-cinematic{padding:7vh 14px}
.chest-shell.has-rewards .chest-stage{width:min(42vw,230px);height:min(42vw,230px);max-height:25vh;transition:width .5s,height .5s,max-height .5s}
.chest-bars i:first-child{top:0;transform-origin:top}.chest-bars i:last-child{bottom:0;transform-origin:bottom}
.screen-shake{animation:chest-screen-shake .55s linear 1}
.chest-prompt{min-height:22px;margin-top:6px;color:#f1dba9;font:italic 14px Georgia,serif;text-shadow:0 2px 5px #000a;z-index:3}
.chest-rewards{width:min(420px,100%);display:flex;flex-direction:column;gap:8px;z-index:3}
.chest-reward-row{display:flex;align-items:center;gap:12px;padding:9px 14px;border:1px solid #e2b85f;border-radius:12px;background:linear-gradient(180deg,#f7e9c4,#d9b872);color:#4a2a08;text-align:left;box-shadow:inset 0 1px #fff9,0 6px 14px #0006;animation:chest-rise .45s ease both}
.chest-rewards.no-anim .chest-reward-row{animation:none}
.chest-reward-row .cr-ico{width:48px;height:48px;object-fit:contain;font-size:38px;line-height:48px;text-align:center;flex:none}
.chest-reward-row small{display:block;font:900 9.5px Georgia,serif;letter-spacing:.14em;color:#7a4a14}
.chest-reward-row strong{display:block;font:900 22px/1.15 Georgia,serif;color:#5a2d06}
.chest-reward-row.coin strong{font-size:34px}
.chest-reward-row.bonus{border-color:#fff1a8;box-shadow:inset 0 1px #fff9,0 0 18px #ffd25a99,0 6px 14px #0006}
.chest-reward-row.relic{background:linear-gradient(180deg,#efe3ff,#c9a8ee);border-color:#e6caff}
.chest-actions{display:flex;justify-content:center;gap:10px;flex-wrap:wrap;margin-top:8px;z-index:3}
.chest-btn{min-height:44px;padding:10px 22px;border:1px solid #f5d17a;border-radius:10px;background:linear-gradient(180deg,#f3cf79,#b9792a 58%,#824719);color:#3b1d05;font:900 14px Georgia,serif;box-shadow:inset 0 1px #fff9,0 3px 0 #5b3214,0 6px 12px #0004;cursor:pointer}
.chest-btn:hover{filter:brightness(1.08);transform:translateY(-1px)}
.chest-btn.secondary{background:linear-gradient(180deg,#e5d4ad,#9c7540);border-color:#e5c58b}
.chest-btn.small{min-height:36px;padding:6px 16px;font-size:13px}
.chest-skip{position:fixed;top:14px;right:14px;z-index:5;min-height:38px;padding:6px 16px;border:1px solid #e5c58b;border-radius:999px;background:#0b1d27cc;color:#ffe9b3;font:900 12px Georgia,serif;letter-spacing:.08em;cursor:pointer}
.chest-skip[hidden]{display:none}
.chest-skip:hover{background:#17394b}
/* Vault */
.vault-shell{width:min(560px,100%);max-height:92vh}
.vault-chips{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;z-index:3}
.vault-chip{padding:6px 12px;border:1px solid #8c7442;border-radius:999px;background:#0b1d27aa;color:#e9d7aa;font:700 12px Georgia,serif;cursor:pointer}
.vault-chip b{margin-left:4px;color:#ffe49a}
.vault-chip.is-active{background:linear-gradient(180deg,#f3cf79,#b9792a);border-color:#f5d17a;color:#3b1d05}
.vault-chip.is-active b{color:#3b1d05}
.vault-list{width:100%;max-height:44vh;overflow:auto;display:flex;flex-direction:column;gap:8px;padding:2px 4px;z-index:3}
.vault-row{display:flex;align-items:center;gap:12px;padding:8px 12px;border:1px solid #8c7442;border-radius:12px;background:#0b1d27cc;text-align:left}
.vault-row img{width:56px;height:56px;object-fit:contain;flex:none}
.vault-row-text{flex:1;min-width:0}
.vault-row-text strong{display:block;color:#ffe9b3;font:900 15px Georgia,serif}
.vault-row-text small{display:block;color:#bfae86;font:italic 12px Georgia,serif}
.vault-row.rarity-rare{border-color:#c9d6e3}.vault-row.rarity-epic{border-color:#e5b94e}.vault-row.rarity-legendary{border-color:#b56cf0}.vault-row.rarity-common{border-color:#56a9d8}
.vault-empty{padding:30px 10px;color:#d4c4a4;font:italic 15px Georgia,serif}
.vault-progress{display:flex;flex-wrap:wrap;justify-content:center;gap:4px 12px;color:#a99869;font:700 11px Georgia,serif;z-index:3}
/* Map entry */
.map-vault{position:absolute;right:2.4%;bottom:3.5%;width:11%;min-width:84px;z-index:6;padding:0;border:0;background:transparent;cursor:pointer;display:flex;flex-direction:column;align-items:center;filter:drop-shadow(0 6px 8px #0008)}
.map-vault img{width:100%;max-width:120px;height:auto;opacity:.75}
.map-vault.has-chests img{opacity:1;animation:chest-float 2.6s ease-in-out infinite}
.map-vault-label{margin-top:-6px;padding:3px 10px;border:1px solid #e2b85f;border-radius:999px;background:#2a1805e6;color:#ffe9b3;font:900 11px Georgia,serif;letter-spacing:.06em;white-space:nowrap}
.map-vault b{position:absolute;top:0;right:12%;min-width:24px;height:24px;padding:0 6px;border-radius:999px;background:#d63b2f;border:2px solid #fff0c8;color:#fff;font:900 13px/20px Georgia,serif}
.map-vault b[hidden]{display:none}
/* Victory screen fallback button (reopens the earned-chest popup) */
#modalRoot .treasure-open-cta{display:flex;align-items:center;justify-content:center;gap:10px;min-height:42px;padding:8px 16px;border:1px solid #f0c66c;border-radius:10px;background:linear-gradient(180deg,#f2d27f,#bd792a 58%,#824719);color:#3d2108;font:900 13px Georgia,serif;box-shadow:inset 0 1px #fff9,0 3px 0 #5b3214,0 6px 12px #0003;cursor:pointer}
#modalRoot .treasure-open-cta:hover{filter:brightness(1.08);transform:translateY(-1px)}
#modalRoot .treasure-open-gem{color:#fff2b2;text-shadow:0 1px 3px #6a330a;font-size:17px}
#modalRoot .treasure-open-cta small{padding:3px 6px;border-radius:6px;background:#562b0c;color:#ffe7a5;font:900 9px Georgia,serif;letter-spacing:.08em}
@keyframes chest-fade{from{opacity:0}to{opacity:1}}
@keyframes chest-float{0%,100%{transform:translateY(0)}50%{transform:translateY(-8px)}}
@keyframes chest-aura-pulse{from{transform:scale(.94)}to{transform:scale(1.08)}}
@keyframes chest-spin{to{transform:rotate(360deg)}}
@keyframes chest-enter{0%{opacity:0;transform:translateY(-120px) scale(.35) rotate(-6deg)}60%{opacity:1;transform:translateY(10px) scale(1.06) rotate(1deg)}100%{opacity:1;transform:none}}
@keyframes chest-shake{0%{transform:translate(0,0) rotate(0)}25%{transform:translate(-5px,2px) rotate(-1.6deg)}50%{transform:translate(4px,-2px) rotate(1.4deg)}75%{transform:translate(-3px,1px) rotate(-1deg)}100%{transform:translate(0,0) rotate(0)}}
@keyframes chest-pop{0%{transform:scale(.94)}55%{transform:scale(1.07)}100%{transform:scale(1)}}
@keyframes chest-spark{0%{opacity:1;transform:translate(0,0) scale(1.2)}100%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.2)}}
@keyframes chest-flash{0%{opacity:.95}100%{opacity:0}}
@keyframes chest-flash-big{0%{opacity:1}30%{opacity:.85}100%{opacity:0}}
@keyframes chest-bar{from{transform:scaleY(0)}to{transform:scaleY(1)}}
@keyframes chest-screen-shake{0%,100%{transform:translate(0)}20%{transform:translate(-6px,3px)}40%{transform:translate(5px,-4px)}60%{transform:translate(-4px,-2px)}80%{transform:translate(3px,3px)}}
@keyframes chest-rise{from{opacity:0;transform:translateY(16px) scale(.96)}to{opacity:1;transform:none}}
@media(max-width:600px){.chest-stage{width:min(80vw,340px);height:min(80vw,340px);max-height:34vh}.chest-actions{flex-direction:column;width:100%}.chest-actions .chest-btn{width:100%}.map-vault{width:20%}}
@media(prefers-reduced-motion:reduce){.chest-stage img,.chest-aura,.chest-rays,.screen-shake,.map-vault img{animation:none!important}.chest-flash.go{animation-duration:.2s!important}}


/* STAGE 132 — Dedicated Settings Page */
#modalRoot .settings-page{width:min(760px,100%);color:#3d2b19;background:radial-gradient(ellipse at 50% 0%,#fff9e9 0%,#f4e5c4 72%,#ead3a5 100%);border:5px solid #9b6b32;border-radius:18px;padding:clamp(16px,3vw,28px);box-shadow:inset 0 0 0 2px #fbe9bd,inset 0 0 28px #8c5d2728}
#modalRoot .settings-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;border-bottom:2px solid #c49a5b;padding-bottom:13px;margin-bottom:15px}
#modalRoot .settings-eyebrow{font:900 10px/1.2 Georgia,serif;letter-spacing:.2em;color:#99703c;margin:0 0 5px}
#modalRoot .settings-header h2{font:700 clamp(25px,4vw,34px)/1.1 Georgia,serif;color:#51351c;margin:0 0 4px}
#modalRoot .settings-header .modal-sub{margin:0}
#modalRoot .settings-close{width:36px;height:36px;border-radius:50%;border:2px solid #9d743e;background:linear-gradient(#fff3d4,#d9b779);color:#51351c;font-size:25px;line-height:1;cursor:pointer}
#modalRoot .settings-section{background:#fff9e9b8;border:1px solid #d5b982;border-radius:13px;padding:14px;margin:12px 0;box-shadow:inset 0 1px #fff}
#modalRoot .settings-section-heading{display:flex;align-items:center;gap:11px;margin-bottom:12px}
#modalRoot .settings-section-icon{display:grid;place-items:center;flex:0 0 38px;height:38px;border-radius:10px;background:linear-gradient(145deg,#79512a,#bd8a43);color:#fff0c8;font-size:22px;box-shadow:inset 0 1px #f9d99b}
#modalRoot .settings-section-heading h3{font:700 18px Georgia,serif;margin:0;color:#593b1e}
#modalRoot .settings-section-heading p{font-size:11px;color:#806b4c;margin:3px 0 0}
#modalRoot .settings-volume-list{display:grid;gap:8px}
#modalRoot .settings-volume-row{display:grid;grid-template-columns:minmax(130px,1fr) minmax(100px,1.6fr) 42px;align-items:center;gap:12px;padding:8px 10px;background:#f5e8ca;border:1px solid #e0c99d;border-radius:8px;font-size:12px;font-weight:700}
#modalRoot .settings-volume-row input{width:100%;accent-color:#9a692e}
#modalRoot .settings-volume-row output{text-align:right;color:#795326;font-variant-numeric:tabular-nums}
#modalRoot .settings-inline-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;margin-top:10px}
#modalRoot .settings-action-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 0;border-top:1px solid #dfc99f}
#modalRoot .settings-action-row>div{display:grid;gap:4px;min-width:0}
#modalRoot .settings-action-row strong{font:700 14px Georgia,serif;color:#51371f}
#modalRoot .settings-action-row small{font-size:11px;line-height:1.4;color:#806b4c}
#modalRoot .settings-page button:not(.settings-close){border:1px solid #9d743e;border-radius:8px;padding:8px 12px;background:linear-gradient(#fff2d0,#e4c58d);color:#51351c;font-weight:800;font-size:11px;cursor:pointer}
#modalRoot .settings-page button.settings-danger,#modalRoot .settings-confirm button.settings-danger{background:linear-gradient(#a64b39,#7c2d25);border-color:#70251f;color:#fff5e6}
#modalRoot .settings-dev-note{margin-top:10px;padding:9px 11px;border-left:3px solid #b58a4c;background:#f3e5c7;color:#806b4c;font-size:10px;line-height:1.45}
#modalRoot .settings-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:15px;color:#806b4c;font-size:10px}
#modalRoot .settings-page button.settings-done{min-width:105px;background:linear-gradient(#8b6332,#65431f);border-color:#573719;color:#fff0cf}
#modalRoot .settings-confirm{padding:8px 2px}
#modalRoot .settings-confirm h2{color:#593b1e}
#modalRoot .settings-confirm p{font-size:13px;line-height:1.55;color:#6e5a40}
#modalRoot .settings-confirm .settings-warning{font-weight:900;color:#9a3e2e}
@media(max-width:520px){#modalRoot .settings-volume-row{grid-template-columns:1fr 40px;gap:6px}#modalRoot .settings-volume-row input{grid-column:1/3;grid-row:2}#modalRoot .settings-action-row{align-items:flex-start;flex-direction:column}#modalRoot .settings-footer{align-items:flex-start;flex-direction:column}}

/* STAGE 133 — Developer difficulty override and solved-puzzle seeding */
#modalRoot .settings-dev-toggle{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 10px;margin:8px 0;background:#f5e8ca;border:1px solid #ddc397;border-radius:9px;cursor:pointer}
#modalRoot .settings-dev-toggle>span{display:grid;gap:4px}
#modalRoot .settings-dev-toggle strong,#modalRoot .settings-dev-seed>strong{font:700 13px Georgia,serif;color:#51371f}
#modalRoot .settings-dev-toggle small{font-size:11px;line-height:1.45;color:#806b4c}
#modalRoot .settings-dev-toggle input{width:20px;height:20px;flex:0 0 20px;accent-color:#8b6332}
#modalRoot .settings-dev-seed{padding:12px 10px;margin:10px 0;background:#fff8e8;border:1px solid #ddc397;border-radius:9px}
#modalRoot .settings-dev-seed>p{font-size:11px;line-height:1.5;color:#806b4c;margin:5px 0 11px}
#modalRoot .settings-dev-seed-controls{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:10px}
#modalRoot .settings-dev-seed-controls label{display:grid;gap:5px;font-size:11px;font-weight:800;color:#684821}
#modalRoot .settings-dev-seed-controls select,#modalRoot .settings-dev-seed-controls input{width:100%;min-width:0;padding:9px;border:1px solid #cdb98f;border-radius:7px;background:#fffdf7;color:#51351c;font:600 12px Georgia,serif}
#modalRoot .settings-page button.settings-dev-seed-button{width:100%;background:linear-gradient(#8b6332,#65431f);border-color:#573719;color:#fff0cf;padding:10px 14px}
@media(max-width:520px){#modalRoot .settings-dev-seed-controls{grid-template-columns:1fr}}


/* STAGE 135 — Relic-gated temple unlocking and cinematic unlock flash */
.map-destination.is-locked .map-temple-button img{filter:brightness(.42) saturate(.62) sepia(.12);}
.map-destination.is-locked .map-temple-button::after{content:"🔒";position:absolute;left:50%;top:45%;transform:translate(-50%,-50%);font:900 clamp(18px,2.5vw,38px)/1 Arial,sans-serif;text-shadow:0 2px 8px #000,0 0 14px #f2d28a;filter:none;pointer-events:none;}
.map-destination.is-locked .map-tablet{filter:grayscale(.55) brightness(.72);}
.map-destination.is-unlocked .map-temple-button img{filter:drop-shadow(0 0 5px #f4d27b66);}
.map-hotspot.is-locked{background:radial-gradient(ellipse,#111b 0%,transparent 72%);}
.map-hotspot.is-locked::after{content:"🔒";position:absolute;inset:0;display:grid;place-items:center;font-size:clamp(18px,2.2vw,34px);filter:drop-shadow(0 2px 5px #000);pointer-events:none;}
.stage-locked-panel{text-align:center;max-width:430px;padding:24px 22px;color:#4d2c13;background:linear-gradient(145deg,#f8e8bd,#d7b77a);border:5px ridge #9b6a2e;border-radius:18px;box-shadow:0 16px 55px #0009;}
.stage-locked-symbol{font-size:34px;margin-bottom:6px}.stage-locked-panel h2{font:900 25px Georgia,serif;margin:5px 0 10px}.stage-locked-panel .modal-sub{color:#68451f;line-height:1.45}
.stage-locked-progress{margin:18px auto 8px;max-width:320px}.stage-locked-progress strong{display:block;font:900 27px Georgia,serif;margin-bottom:9px}.stage-locked-track{height:13px;border-radius:20px;background:#78552d55;overflow:hidden;border:1px solid #805c2c}.stage-locked-track i{display:block;height:100%;background:linear-gradient(90deg,#b77c26,#f6d777);box-shadow:0 0 12px #ffdf83;}
.stage-locked-progress small{display:block;margin-top:8px;font-weight:800;letter-spacing:.04em}
.stage-unlock-flash{position:fixed;inset:0;z-index:100000;display:grid;place-items:center;background:radial-gradient(ellipse at center,#f8d98cdd 0%,#9d681dcc 32%,#120e0beF 78%);opacity:0;transition:opacity .4s ease;overflow:hidden;padding:24px;text-align:center;color:#fff4cf;}
.stage-unlock-flash.is-visible{opacity:1}.stage-unlock-rays{position:absolute;width:130vmax;aspect-ratio:1;border-radius:50%;background:repeating-conic-gradient(from 0deg,#ffe9a122 0deg 5deg,transparent 5deg 15deg);animation:stageUnlockSpin 32s linear infinite;mask-image:radial-gradient(circle,black 0%,transparent 68%);}
.stage-unlock-content{position:relative;z-index:1;max-width:760px;padding:clamp(24px,5vw,56px);border:2px solid #f7d98b;border-radius:22px;background:linear-gradient(145deg,#2b1b12ee,#65411ceF);box-shadow:0 0 0 8px #d8a94b33,0 0 70px #ffe09b99;transform:translateY(18px) scale(.96);transition:transform .55s cubic-bezier(.2,.8,.2,1);}
.stage-unlock-flash.is-visible .stage-unlock-content{transform:translateY(0) scale(1)}.stage-unlock-emblem{font-size:clamp(44px,8vw,82px);color:#ffe69b;text-shadow:0 0 22px #ffcf55;animation:stageUnlockPulse 1.6s ease-in-out infinite}.stage-unlock-kicker{font:800 12px Arial,sans-serif;letter-spacing:.28em;color:#e9c77f;margin:8px 0}.stage-unlock-content h2{font:900 clamp(24px,5vw,46px)/1.05 Georgia,serif;margin:10px 0;text-shadow:0 3px 10px #000}.stage-unlock-name{font:700 clamp(17px,3vw,27px) Georgia,serif;color:#ffe4a0}.stage-unlock-copy{font:500 14px Arial,sans-serif;color:#f1dfbd;margin:18px 0 24px}.stage-unlock-continue{border:2px solid #f8d98c;border-radius:9px;padding:12px 30px;background:linear-gradient(#e5bd67,#9c6729);color:#321d0e;font-weight:900;letter-spacing:.12em;cursor:pointer;box-shadow:0 5px 0 #563516}.stage-unlock-continue:hover{filter:brightness(1.12);transform:translateY(-1px)}
@keyframes stageUnlockSpin{to{transform:rotate(360deg)}}@keyframes stageUnlockPulse{50%{transform:scale(1.12);filter:brightness(1.25)}}
@media(prefers-reduced-motion:reduce){.stage-unlock-rays,.stage-unlock-emblem{animation:none!important}.stage-unlock-flash,.stage-unlock-content{transition:none!important}}


/* Stage 136 — temple selection panels */
.temple-selection-panel{position:relative;width:min(900px,94vw);max-height:min(90vh,820px);overflow:auto;box-sizing:border-box;padding:clamp(22px,3vw,38px);border:3px solid #9a6a32;border-radius:20px;background:linear-gradient(145deg,#f8e7bd 0%,#e8c98d 48%,#f4dfb0 100%);box-shadow:0 18px 55px #160d08a8,inset 0 0 0 3px #fff2c4,inset 0 0 30px #8d5a2538;color:#4b2d16}
.temple-selection-panel h2{margin:4px 46px 10px 0;color:#58351b;text-align:center;font-family:Georgia,serif;font-size:clamp(23px,3vw,34px);line-height:1.12;text-shadow:0 1px #fff4d4}
.temple-panel-close{position:absolute;z-index:5;top:12px;right:12px;width:42px;height:42px;border:2px solid #6f3f20;border-radius:50%;background:linear-gradient(#b8793c,#713c20);color:#fff0c8;font-size:30px;font-weight:700;line-height:1;cursor:pointer;box-shadow:0 3px 0 #482514,inset 0 1px 2px #fff7}
.temple-panel-close:hover{filter:brightness(1.16);transform:translateY(-1px)}
.temple-unlocked-panel{display:grid;grid-template-columns:minmax(230px,38%) 1fr;gap:clamp(18px,3vw,30px);align-items:center}
.temple-unlocked-art{height:100%;min-height:330px;display:flex;align-items:center;justify-content:center;overflow:hidden;border:2px solid #a77942;border-radius:14px;background:linear-gradient(180deg,#b98b56,#6f492d);box-shadow:inset 0 0 24px #38200b66}
.temple-unlocked-art img{width:100%;height:100%;max-height:430px;object-fit:cover}
.temple-unlocked-content{min-width:0;padding:8px 4px}
.temple-panel-kicker{text-align:center;margin:0;color:#916027;font-size:11px;font-weight:900;letter-spacing:.2em}
.temple-difficulty-line{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:10px 12px;margin:12px 0 16px;border:1px solid #a77b45;border-radius:9px;background:#d8b77d;color:#543419;font-size:12px;font-weight:800}
.temple-reward-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.temple-reward-item,.temple-progress-stats>div{padding:12px;border:1px solid #bd9862;border-radius:10px;background:#fff0cc9c;box-shadow:inset 0 1px #fff}
.temple-stat-label,.temple-progress-stats span{display:block;margin-bottom:6px;color:#815a31;font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.06em}
.temple-reward-item strong{display:flex;align-items:center;gap:7px;color:#543419;font-size:14px}
.temple-reward-item strong img,.temple-progress-stats img{width:30px;height:30px;object-fit:contain;vertical-align:middle}
.temple-coin-icon{font-size:25px}
.temple-progress-stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}
.temple-progress-stats strong{display:flex;align-items:center;gap:7px;font-size:21px;color:#513116}
.temple-enter-button,.temple-understood-button{display:block;width:min(310px,80%);padding:0;margin:20px auto 2px;border:0;background:transparent;cursor:pointer;filter:drop-shadow(0 4px 3px #51351b66);transition:transform .15s,filter .15s}
.temple-enter-button img,.temple-understood-button img{display:block;width:100%;height:auto}
.temple-enter-button:hover,.temple-understood-button:hover{transform:translateY(-2px);filter:brightness(1.08) drop-shadow(0 5px 4px #51351b77)}
.stage-locked-panel.temple-selection-panel{width:min(600px,92vw);padding:30px 34px 26px;text-align:center}
.temple-locked-art{display:block;width:clamp(90px,15vw,140px);height:clamp(90px,15vw,140px);object-fit:contain;margin:2px auto 8px;filter:drop-shadow(0 5px 4px #59381955)}
.temple-sealed-message{margin:0 0 8px;font-size:17px;font-weight:800;color:#71431f}
.temple-unlock-instruction{max-width:440px;margin:0 auto 16px;line-height:1.5;color:#644322}
.temple-relic-progress{max-width:420px;margin:0 auto;padding:13px 16px;border:1px solid #b48b54;border-radius:12px;background:#fff0cc9c}
.temple-relic-progress-heading{display:flex;align-items:center;justify-content:center;gap:12px;margin-bottom:8px;font-size:20px}
.temple-relic-progress-heading img{width:42px;height:42px;object-fit:contain}
.stage-locked-panel .stage-locked-track{height:15px;margin:0 0 8px;border:1px solid #79512d;border-radius:20px;background:#765333;overflow:hidden}
.stage-locked-panel .stage-locked-track i{display:block;height:100%;border-radius:20px;background:linear-gradient(90deg,#d5a33c,#ffe28a);box-shadow:inset 0 1px #fff8}
.temple-relic-progress small{font-weight:800;color:#76502a}
.temple-understood-button{width:min(240px,68%);margin-top:18px}
@media(max-width:650px){.temple-unlocked-panel{grid-template-columns:1fr;gap:12px;padding:20px}.temple-unlocked-art{min-height:150px;height:180px}.temple-unlocked-art img{max-height:180px;object-fit:contain}.temple-unlocked-panel h2{font-size:23px}.temple-difficulty-line{font-size:11px}.temple-reward-item{padding:9px}.temple-reward-item strong{font-size:12px}.stage-locked-panel.temple-selection-panel{padding:26px 18px 20px}}


/* Stage 137 — retractable difficulty-specific streak progress dock */
.streak-progress-dock{position:fixed;z-index:80;top:50%;right:0;transform:translateY(-50%);width:238px;max-width:34vw;pointer-events:none;opacity:0;visibility:hidden;transition:opacity .2s,visibility .2s}
.streak-progress-dock.is-game-active{opacity:1;visibility:visible}
.streak-dock-panel{position:relative;width:100%;padding:8px 8px 8px 12px;box-sizing:border-box;transform:translateX(calc(100% - 0px));transition:transform .38s cubic-bezier(.2,.8,.2,1);pointer-events:auto;filter:drop-shadow(-8px 5px 12px #0008)}
.streak-progress-dock.is-open .streak-dock-panel{transform:translateX(0)}
.streak-dock-art-wrap{position:relative;width:100%;max-height:86vh;display:flex;justify-content:center;align-items:center}
.streak-dock-art{display:block;width:100%;height:auto;max-height:86vh;object-fit:contain;user-select:none;pointer-events:none}
.streak-dock-toggle{position:absolute;z-index:3;left:-59px;top:50%;transform:translateY(-50%);width:62px;height:96px;padding:0;border:0;background:transparent;cursor:pointer;pointer-events:auto;filter:drop-shadow(0 4px 5px #0008);transition:left .38s cubic-bezier(.2,.8,.2,1)}
.streak-dock-toggle img{display:block;width:100%;height:100%;object-fit:contain}
.streak-progress-dock.is-open .streak-dock-toggle{left:-47px}
.streak-dock-toggle:hover{filter:brightness(1.12) drop-shadow(0 4px 6px #0009)}
.streak-square-grid{position:absolute;left:44%;top:45%;width:12%;height:37%;display:grid;grid-template-rows:repeat(10,1fr);gap:.5%;align-content:stretch;pointer-events:none}
.streak-square{display:block;width:100%;min-height:0;border:1px solid #8e5b20;border-radius:4px;box-sizing:border-box;background:linear-gradient(135deg,#24160fdd,#5a351dcc);box-shadow:inset 0 1px 3px #000b,0 0 2px #ffcf6a44}
.streak-square.is-earned{background:linear-gradient(135deg,#fff1a3,#e6a52d 48%,#9a4e0b);border-color:#fff0a3;box-shadow:inset 0 1px 4px #fff9,0 0 8px #ffc34fbb}
.streak-progress-count{position:absolute;left:50%;bottom:8%;transform:translateX(-50%);padding:3px 9px;border:1px solid #8d5a22;border-radius:12px;background:#2c180de8;color:#ffe5a1;font-size:12px;font-weight:900;letter-spacing:.05em;text-shadow:0 1px #000;white-space:nowrap;pointer-events:none}
@media(max-width:700px){.streak-progress-dock{width:190px;max-width:42vw}.streak-dock-toggle{left:-49px;width:53px;height:82px}.streak-progress-dock.is-open .streak-dock-toggle{left:-41px}.streak-square-grid{left:44%;top:45%;width:12%;height:37%}.streak-progress-count{font-size:10px}}


/* STAGE 138 — Temple popups: the transparent temple artwork IS the popup (locked + unlocked) */
.modal.temple-frame-modal{width:min(94vw,1000px,calc(88vh * 1.5));max-height:none;padding:0;overflow:visible;background:none;border:0;border-radius:0;box-shadow:none}
.temple-frame-shell{position:relative;width:100%;container-type:inline-size;color:#4b2d16;font-family:Georgia,serif}
.temple-frame-art{display:block;width:100%;height:auto;filter:drop-shadow(0 1.8cqw 2.4cqw #000b);user-select:none;pointer-events:none}
.temple-frame-lock{position:absolute;top:-4%;left:50%;width:17cqw;height:auto;transform:translateX(-50%);filter:drop-shadow(0 .8cqw 1cqw #000c);pointer-events:none;z-index:2}
.temple-frame-shell .temple-panel-close{top:5%;right:14%;width:max(30px,4cqw);height:max(30px,4cqw);font-size:max(22px,3cqw);z-index:5}
.temple-frame-content{position:absolute;left:27%;right:27%;top:47.5%;bottom:17%;display:flex;flex-direction:column;justify-content:center;align-items:stretch;gap:.9cqw;overflow:auto;min-width:0}
.tf-diff{display:flex;justify-content:space-between;gap:1cqw;padding:.7cqw 1.2cqw;border:1px solid #a77b45;border-radius:.8cqw;background:#d8b77dcc;color:#543419;font-size:max(9px,1.15cqw);font-weight:800}
.tf-grid{display:grid;grid-template-columns:1fr 1fr;gap:.9cqw}
.tf-grid>div{min-width:0;padding:.8cqw 1.1cqw;border:1px solid #bd9862;border-radius:.9cqw;background:#fff0ccb0;box-shadow:inset 0 1px #fff}
.tf-grid span{display:block;margin-bottom:.3cqw;color:#815a31;font-size:max(8px,1cqw);font-weight:800;text-transform:uppercase;letter-spacing:.05em}
.tf-grid strong{display:flex;align-items:center;gap:.6cqw;color:#513116;font-size:max(11px,1.7cqw)}
.tf-grid strong img{width:2.6cqw;height:2.6cqw;object-fit:contain}
.tf-coin{font-style:normal}
.tf-button{align-self:center;width:21cqw;padding:0;border:0;background:transparent;cursor:pointer;filter:drop-shadow(0 .4cqw .3cqw #51351b66);transition:transform .15s,filter .15s}
.tf-button img{display:block;width:100%;height:auto}
.tf-button:hover{transform:translateY(-2px);filter:brightness(1.08) drop-shadow(0 .5cqw .4cqw #51351b77)}
/* locked variant */
.temple-frame-locked .temple-frame-content{text-align:center;align-items:center;top:46%;left:25%;right:25%}
.tf-message{margin:0;max-width:40cqw;font-size:max(10px,1.6cqw);line-height:1.3;font-weight:700;color:#5a3516}
.tf-count{display:flex;align-items:center;justify-content:center;gap:1.2cqw;color:#6b1414}
.tf-count img{width:3.6cqw;height:3.6cqw;object-fit:contain}
.tf-count strong{font-size:max(18px,3.6cqw);line-height:1}
.tf-track{width:80%;height:1.8cqw;border:.25cqw solid #8a5a22;border-radius:2cqw;background:#5a3a1c;overflow:hidden}
.tf-track i{display:block;height:100%;border-radius:2cqw;background:linear-gradient(90deg,#d99a1c,#ffe27a)}
.tf-need{font-size:max(9px,1.4cqw);font-weight:800;color:#76502a}
.temple-frame-locked .tf-button{width:19cqw}


/* STAGE 138 — Streak panel: number sits in the artwork's blank slot before "/ 10"; squares fill bottom-up */
.streak-dock-art-wrap{container-type:inline-size}
.streak-progress-count,.streak-progress-dock .streak-progress-count{position:absolute;left:35.5%;bottom:auto;top:36.4%;width:11.5%;height:5.8%;transform:none;display:flex;align-items:center;justify-content:center;padding:0;border:0;border-radius:0;background:none;color:#f6e3a4;font:900 7cqw/1 Georgia,serif;letter-spacing:0;text-shadow:0 .4cqw .5cqw #000c;white-space:nowrap;pointer-events:none}
.streak-square.is-earned{background:linear-gradient(180deg,#ffd75e,#e49a1a 55%,#a85a08);border-color:#ffe08a;box-shadow:inset 0 1px 2px #fff6,0 0 6px #ffb62d99}

/* STAGE 138 — temple popups use assets/menu/close_button.webp */
.temple-frame-shell .temple-panel-close{top:4%;right:13%;width:max(38px,6.2cqw);height:max(38px,6.2cqw);padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;font-size:0;filter:drop-shadow(0 .4cqw .5cqw #000a)}
.temple-frame-shell .temple-panel-close img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}
.temple-frame-shell .temple-panel-close:hover{filter:brightness(1.15) drop-shadow(0 .4cqw .5cqw #000a);transform:translateY(-1px)}
.temple-frame-shell.tf-medium .temple-panel-close{top:13%;right:17%}

/* STAGE 138 — "Prepare for …" title centred on the red banner (banner centre = 14.5% of popup height) */
#modalRoot .before-perk-title{top:8.75%;display:flex;align-items:center;justify-content:center}


/* STAGE 138 — Streak drawer: lives inside the game background, slides in from its right edge.
   The toggle is a child of the sliding panel, pinned to the panel's left edge, so closed = flush with the background's right edge, open = left of the panel. */
#stage .streak-progress-dock{position:absolute;z-index:60;top:50%;right:0;left:auto;bottom:auto;transform:translateY(-50%);width:clamp(190px,22%,310px);max-width:58vh;pointer-events:none}
#stage .streak-dock-panel{position:relative;width:100%;padding:0;box-sizing:border-box;transform:translateX(100%);transition:transform .4s cubic-bezier(.2,.8,.2,1);pointer-events:auto;filter:drop-shadow(-8px 5px 12px #0008)}
#stage .streak-progress-dock.is-open .streak-dock-panel{transform:translateX(0)}
#stage .streak-dock-toggle{position:absolute;z-index:3;top:50%;right:100%;left:auto;transform:translateY(-50%);width:clamp(45px,4.32vw,67px);height:auto;aspect-ratio:350/704;padding:0;border:0;background:transparent;cursor:pointer;pointer-events:auto;filter:drop-shadow(0 4px 6px #000a);transition:filter .15s}
#stage .streak-progress-dock.is-open .streak-dock-toggle{left:auto;right:100%}
#stage .streak-dock-toggle img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}
#stage .streak-dock-toggle:hover{filter:brightness(1.15) drop-shadow(0 4px 7px #000b)}
@media(max-width:700px){#stage .streak-progress-dock{width:clamp(150px,30%,230px)}#stage .streak-dock-toggle{width:clamp(35px,6.4vw,48px);left:auto;right:100%}#stage .streak-progress-dock.is-open .streak-dock-toggle{left:auto;right:100%}}

/* STAGE 138 — streak drawer sizing: size by the VISIBLE artwork (the PNG has ~26% transparent margin each side), so the drawer sits flush at the background's right edge and is larger */
#stage .streak-progress-dock{width:clamp(110px,12.8%,170px);max-width:21vh}
#stage .streak-dock-art-wrap{width:210.1%;max-width:none;max-height:none;margin-left:-55.05%}
#stage .streak-dock-art{max-height:none;width:100%}
@media(max-width:700px){#stage .streak-progress-dock{width:clamp(90px,16%,140px);max-width:21vh}}

/* ===== FIX: Main menu stats panel (Coins / Relics / Puzzles Solved) =====
   The panel is its own size container, so every font size and position is
   relative to the PANEL (not the whole menu scene). Text sits inside the
   three brown compartments, to the right of each icon. */
.main-menu-stats{
  container-type:inline-size;
  aspect-ratio:1100/224;
}
.main-menu-stats .main-menu-stat{
  position:absolute;
  top:16%;
  height:68%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:1.5cqw;
  box-sizing:border-box;
  padding:0;
  overflow:hidden;
  text-align:center;
  pointer-events:none;
}
/* compartment text areas (right of each icon, inside the gold dividers) */
.main-menu-stats .main-menu-stat.coin-stat  {left:21.2%;width:14.6%;}
.main-menu-stats .main-menu-stat.relic-stat {left:46.6%;width:15.0%;}
.main-menu-stats .main-menu-stat.solved-stat{left:75.0%;width:15.0%;}

.main-menu-stats .main-menu-stat small{
  display:block;
  max-width:100%;
  font-size:clamp(8px,2.6cqw,22px);
  line-height:1.05;
  letter-spacing:0;
  text-transform:capitalize;
  white-space:normal;          /* lets "Puzzles Solved" wrap to 2 lines */
  text-align:center;
}
.main-menu-stats .main-menu-stat strong{
  display:block;
  max-width:100%;
  font-size:clamp(12px,4.6cqw,38px);
  line-height:1;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
  text-align:center;
}
.main-menu-stats .main-menu-stat.solved-stat small{
  text-align:center;
  line-height:1.05;
}

/* ===== FIX: Inventory > Perk Information popup (parchment) =====
   All sizes are in cqw (% of the parchment's width) so text, boxes and the
   artwork always scale together. Coordinates were measured from
   assets/inventory_ui/perk_info_parchment.webp (1254x1254). */

/* hero picture: fill the gold frame */
#modalRoot .perk-info-popup-hero{left:8%;top:12.3%;width:25.4%;height:24.4%;border-radius:1.5cqw}
#modalRoot .perk-info-popup-hero img{width:96%;height:96%}

/* perk name: centred in the banner, between the two laurels */
#modalRoot .perk-info-popup-name{
  left:45.5%;right:11.5%;top:12.6%;height:6.4%;
  font:900 clamp(16px,3.9cqw,48px)/1.02 Georgia,serif;
}
/* rarity pill (purple plate) */
#modalRoot .perk-info-popup-rarity{
  left:51.2%;top:19.7%;width:29.6%;height:4.5%;
  font:900 clamp(11px,2.2cqw,28px)/1 Georgia,serif;
}
/* intro sentence between the pill and the gold divider */
#modalRoot .perk-info-popup-intro{
  left:40%;right:7%;top:25%;height:7.8%;padding:0 1%;
  font:italic 700 clamp(11px,2.05cqw,26px)/1.22 Georgia,serif;
  overflow:hidden;
}

/* Perk Details table: labels are already printed on the art, so hide the
   duplicate text labels and centre each value in its cell */
#modalRoot .perk-info-popup-details{
  left:4.2%;top:48.9%;width:31.3%;height:22.8%;
  grid-template-rows:49fr 51fr 51fr 54fr;
}
#modalRoot .perk-info-popup-details>div{
  grid-template-columns:52% 48%;
  font:800 clamp(10px,1.8cqw,24px)/1.08 Georgia,serif;
}
#modalRoot .perk-info-popup-details>div span{
  position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;
}
#modalRoot .perk-info-popup-details>div strong{
  grid-column:2;
  display:flex;align-items:center;justify-content:center;
  height:100%;padding:0 3%;text-align:center;
  font-weight:800;overflow-wrap:normal;word-break:normal;
}

/* the four information boxes: text starts at the top of each box and wraps
   around the brown header tab (a floated spacer the size of the tab) */
#modalRoot .perk-info-popup-section{
  left:39.4%;right:4.2%;
  padding:0 .6cqw;
  font:700 clamp(10px,1.9cqw,26px)/1.2 Georgia,serif;
  color:#4e2810;
  overflow:hidden;
}
#modalRoot .perk-info-popup-section::before{content:"";float:left}
#modalRoot .perk-info-what        {top:38.5%;height:8.6%}
#modalRoot .perk-info-what::before{width:27.4cqw;height:2cqw}
#modalRoot .perk-info-usage        {top:51.1%;height:8.4%}
#modalRoot .perk-info-usage::before{width:24.6cqw;height:2cqw}
#modalRoot .perk-info-requirements        {top:63.3%;height:6.9%}
#modalRoot .perk-info-requirements::before{width:28.3cqw;height:2cqw}
#modalRoot .perk-info-conditions        {top:74.2%;height:15.4%;padding-top:0;font-size:clamp(10px,1.8cqw,24px)}
#modalRoot .perk-info-conditions::before{width:27.2cqw;height:2cqw}
#modalRoot .perk-info-conditions ul{margin:0;padding:0;list-style:none}
#modalRoot .perk-info-conditions li{
  margin:0 0 .35cqw;padding-left:1.1em;text-indent:-1.1em;
}
#modalRoot .perk-info-conditions li::before{content:"\2022";display:inline-block;width:1.1em;text-indent:0;text-align:center;color:#8a4b14}

@media(max-width:520px){
  #modalRoot .perk-info-popup-section{font-size:clamp(8px,2.15cqw,14px);line-height:1.1;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#a96b25 transparent}
  #modalRoot .perk-info-conditions li{margin-bottom:.15cqw}
  #modalRoot .perk-info-conditions{font-size:clamp(8px,2cqw,13px)}
  #modalRoot .perk-info-popup-intro{font-size:clamp(8px,2.2cqw,14px)}
  #modalRoot .perk-info-popup-details>div{font-size:clamp(8px,1.95cqw,14px)}
}

/* ===== FIX: Perk Store merchant fox — bigger, tail no longer clipped ===== */
#modalRoot .perk-store-fox{
  left:.7%;            /* was -1.5%: the tail starts at the very edge of the image, so it was cut off */
  bottom:5.3%;
  width:30%;           /* was 25% */
  height:auto;         /* was 61% (the width was the real limit) */
  object-fit:contain;
  object-position:left bottom;
}

/* ===== FIX: Perk Store "My Coins" panel — bigger text, Shop tier inside the panel ===== */
#modalRoot .store-coin-balance{
  box-sizing:border-box;
  align-self:flex-end;                 /* sit on the bottom edge so the panel is no longer cut off */
  width:36cqw;                         /* panel width (was ~32cqw, but its height was doubled by padding) */
  aspect-ratio:1100/366;               /* exact aspect of store_coins_panel.webp */
  /* keep text inside the red area, to the right of the coin pile */
  padding:2cqw 2.9cqw 2.7cqw 12.4cqw;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:.1cqw;text-align:center;
}
#modalRoot .store-coin-balance span{
  font:900 1.95cqw/1.05 Georgia,"Times New Roman",serif;
  color:#ffe6a0;
}
#modalRoot .store-coin-balance strong{
  font:900 3.5cqw/1.05 Georgia,"Times New Roman",serif;
  color:#fff1c5;
  max-width:100%;white-space:nowrap;
}
/* Shop tier now lives inside the panel, same font family and gold tone */
#modalRoot .store-coin-balance .perk-store-tier{
  position:static;right:auto;bottom:auto;
  font:800 1.45cqw/1.1 Georgia,"Times New Roman",serif;
  color:#ffd98a;opacity:1;white-space:nowrap;
  text-shadow:0 2px 3px #290c04;
}
#modalRoot .store-coin-balance .perk-store-tier b{color:#fff1c5;font-weight:900}


/* STAGE 138 — Mr. Roo's Caravan House and its four clickable resource boards */
.map-caravan-house{
 position:absolute;left:66%;top:66%;width:14.5%;height:27%;
 z-index:5;padding:0;border:0;background:transparent;cursor:pointer;
 display:flex;flex-direction:column;align-items:center;justify-content:flex-end;
}
.map-caravan-house img{
 display:block;width:100%;height:88%;object-fit:contain;
 filter:drop-shadow(0 5px 8px #0009);
 transition:transform .18s ease,filter .18s ease;
}
.map-caravan-house span{
 margin-top:-2%;padding:3px 8px;border:1px solid #e3b85f;border-radius:999px;
 background:#2a1805e8;color:#ffedc2;font:900 clamp(8px,.72vw,12px) Georgia,serif;
 white-space:nowrap;text-shadow:0 1px 2px #421d06;
}
.map-caravan-house:hover img,.map-caravan-house:focus-visible img{
 transform:translateY(-4px) scale(1.04);
 filter:drop-shadow(0 0 10px #ffd56b);
}
.map-caravan-house:focus-visible{outline:2px solid #ffe08a;outline-offset:3px;border-radius:12px;}

.page.caravan-house-page{display:none!important;}
.page.caravan-house-page.active{display:block!important;}
.caravan-house-page{
 width:100vw;height:100vh;min-height:480px;overflow:hidden;background:#090706;
}
.caravan-house-scene{
 position:relative;width:100%;height:100%;overflow:hidden;isolation:isolate;
 background:#090706;
}
.caravan-house-background{
 position:absolute;inset:0;width:100%;height:100%;
 object-fit:contain;object-position:center;
}
.caravan-house-actions{
 position:absolute;left:4.7%;right:4.7%;top:78.2%;height:18.8%;
 display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
 column-gap:1.7%;align-items:center;z-index:3;
}
.caravan-house-action{
 position:relative;display:flex;align-items:center;justify-content:center;
 min-width:0;min-height:0;width:100%;height:100%;
 padding:0;border:0;background:transparent;cursor:pointer;
}
.caravan-house-action img{
 display:block;width:100%;height:100%;object-fit:contain;
 filter:drop-shadow(0 3px 5px #0009);
 transition:transform .16s ease,filter .16s ease;
}
.caravan-house-action:hover img,.caravan-house-action:focus-visible img{
 transform:translateY(-5px) scale(1.06);
 filter:drop-shadow(0 0 9px #ffdb78);
}
.caravan-house-action:focus-visible{outline:2px solid #ffe08a;outline-offset:2px;border-radius:12px;}
.caravan-house-back{
 position:absolute;left:2.3%;top:2.4%;z-index:5;
 padding:9px 16px;border:2px solid #e9bd63;border-radius:12px;
 background:linear-gradient(180deg,#7b4a20,#3c210f);
 color:#ffedbd;font:900 clamp(11px,1vw,16px) Georgia,serif;
 text-shadow:0 1px 2px #301506;box-shadow:inset 0 1px #fff7,0 3px 7px #0009;
 cursor:pointer;
}
.caravan-house-back:hover{filter:brightness(1.15);}
@media(max-width:700px){
 .map-caravan-house{left:65%;top:68%;width:16%;height:25%;}
 .caravan-house-actions{left:4%;right:4%;top:78.5%;height:18%;column-gap:.5%;}
 .caravan-house-back{left:1.5%;top:1.5%;padding:7px 10px;}
}


/* STAGE 139 — Illustrated Treasure Vault redesign; reward logic remains in game.js */
.vault-shell{
 width:min(980px,96vw);max-height:min(94vh,940px);overflow:hidden;gap:clamp(8px,1.25vh,14px);
 padding:clamp(16px,2.4vw,30px);color:#4b2b12;text-align:left;overflow-x:hidden;overflow-y:auto;
 border:5px solid #85501f;border-radius:24px;
 background:linear-gradient(180deg,rgba(255,247,222,.94),rgba(235,207,157,.96)),url("../assets/victory/victory_parchment.webp") center/cover no-repeat;
 box-shadow:inset 0 0 0 2px #fff4cf,inset 0 0 0 7px #c18b3d,inset 0 0 36px #8a571c55,0 24px 70px #000b;
}
.vault-shell:before{content:"";position:absolute;inset:10px;border:1px solid #a87532;border-radius:15px;pointer-events:none;opacity:.75}
.vault-heading{position:relative;z-index:2;width:100%;display:flex;align-items:center;justify-content:space-between;gap:18px;padding:0 4px 12px;border-bottom:2px solid #b8894e}
.vault-heading-main{display:flex;align-items:center;gap:14px;min-width:0}
.vault-emblem{width:clamp(70px,9vw,112px);height:clamp(70px,9vw,112px);object-fit:contain;filter:drop-shadow(0 5px 5px #5c341b55);flex:none}
.vault-heading-copy{min-width:0}
.vault-heading .chest-kicker{color:#9a6427;text-shadow:none;font-size:10px;letter-spacing:.23em}
.vault-heading h2{margin:3px 0 4px;color:#4b2b12;font:900 clamp(26px,3.5vw,39px)/1.05 Georgia,serif;text-shadow:0 1px #fff5d8}
.vault-heading p{margin:0;color:#79552e;font:italic clamp(11px,1.15vw,14px) Georgia,serif}
.vault-header-stats{display:flex;align-items:center;gap:10px;flex:none}
.vault-coins-panel{width:clamp(110px,15vw,164px);height:54px;padding:8px 12px 7px 46px;display:flex;flex-direction:column;justify-content:center;align-items:flex-start;background:url("../assets/perk_store/store_coins_panel.webp") center/100% 100% no-repeat;filter:drop-shadow(0 3px 3px #5b351b55)}
.vault-coins-panel small{font:900 8px Georgia,serif;color:#fce7ab;letter-spacing:.11em;text-shadow:0 1px 2px #542a08}
.vault-coins-panel strong{font:900 18px/1 Georgia,serif;color:#fff0b6;text-shadow:0 2px 3px #512806}
.vault-chest-total{min-width:62px;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px 9px;border:1px solid #9b6a30;border-radius:10px;background:linear-gradient(#fff1c8,#dfbd7d);box-shadow:inset 0 1px #fff,0 2px 4px #76471b44}
.vault-chest-total small{color:#815321;font:900 8px Georgia,serif;letter-spacing:.09em}
.vault-chest-total b{color:#4b2b12;font:900 22px/1.05 Georgia,serif}
.vault-chips{width:100%;display:flex;flex-wrap:nowrap;justify-content:center;align-items:stretch;gap:clamp(5px,.8vw,10px);padding:3px 0 6px}
.vault-chip{position:relative;flex:1 1 0;max-width:154px;min-width:0;min-height:76px;padding:6px 5px;border:2px solid #a77a3b;border-radius:12px;background:linear-gradient(180deg,#f9eac6,#dfc18b);color:#563514;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;font:900 11px Georgia,serif;box-shadow:inset 0 1px #fff,0 3px 6px #71451533;cursor:pointer;transition:transform .15s,filter .15s,box-shadow .15s}
.vault-chip img{width:36px;height:36px;object-fit:contain;filter:drop-shadow(0 2px 2px #59351444)}
.vault-chip span{line-height:1.1;white-space:nowrap}
.vault-chip b{position:absolute;top:4px;right:5px;min-width:19px;height:19px;padding:0 5px;border-radius:999px;background:#543015;color:#fff0c8;font:900 10px/19px Georgia,serif;text-align:center;box-shadow:0 1px 3px #0005}
.vault-chip:hover{transform:translateY(-2px);filter:brightness(1.05)}
.vault-chip.is-active{border-color:#70401a;background:linear-gradient(180deg,#f9d77d,#b87529);color:#432309;box-shadow:inset 0 1px #fff9,0 0 0 2px #f9e4ab,0 5px 12px #6c421c55}
.vault-chip.is-active b{background:#fff0be;color:#57300f}
.vault-chip.chip-rare{border-color:#9ba8b7}.vault-chip.chip-epic{border-color:#c28d37}.vault-chip.chip-legendary{border-color:#9f70b3}
.vault-inventory-heading{position:relative;z-index:2;width:100%;display:flex;align-items:center;justify-content:space-between;padding:0 4px;color:#68451e}
.vault-inventory-heading span{font:900 10px Georgia,serif;letter-spacing:.18em}
.vault-inventory-heading small{font:italic 11px Georgia,serif;color:#916c3b}
.vault-list{position:relative;z-index:2;width:100%;max-height:min(33vh,310px);min-height:90px;overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(min(255px,100%),1fr));align-content:start;gap:10px;padding:3px 5px 7px}
.vault-chest-card{--card-accent:#6aa6c6;display:flex;align-items:center;gap:10px;min-width:0;min-height:128px;padding:9px;border:1.5px solid var(--card-accent);border-radius:14px;background:linear-gradient(140deg,#51351f,#2b1b12 72%);box-shadow:inset 0 1px #fff3,0 5px 10px #603d1c44;color:#fff0c8;text-align:left}
.vault-chest-card.rarity-rare{--card-accent:#c3d0dc}.vault-chest-card.rarity-epic{--card-accent:#edbd54}.vault-chest-card.rarity-legendary{--card-accent:#c28be5}
.vault-chest-art{flex:0 0 98px;width:98px;height:102px;display:grid;place-items:center;border-radius:10px;background:radial-gradient(circle,#fff3c51f,transparent 70%)}
.vault-chest-art img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 5px 5px #0008)}
.vault-chest-info{display:flex;flex:1;flex-direction:column;align-items:flex-start;gap:3px;min-width:0}
.vault-chest-info>strong{color:#ffe2a0;font:900 15px Georgia,serif;text-shadow:0 2px 3px #000}
.vault-chest-origin{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#f3d9a7;font:700 10px Georgia,serif}
.vault-chest-info small{color:#c9b48d;font:italic 10px Georgia,serif}
.vault-chest-info .chest-btn{align-self:flex-start;margin-top:4px;min-height:30px;padding:5px 13px;font-size:11px;border-radius:8px}
.vault-empty-state{grid-column:1/-1;display:flex;align-items:center;justify-content:center;gap:18px;min-height:116px;padding:10px 16px;border:1px dashed #ad854b;border-radius:15px;background:#fff4d7a8;color:#5a3918;text-align:left}
.vault-empty-state img{width:94px;height:94px;object-fit:contain;filter:drop-shadow(0 4px 5px #68411d44)}
.vault-empty-state strong{display:block;color:#573516;font:900 clamp(16px,2vw,20px) Georgia,serif}
.vault-empty-state p{margin:5px 0 0;max-width:42ch;color:#81613a;font:italic 12px/1.45 Georgia,serif}
.vault-streak-section{position:relative;z-index:2;width:100%;padding:9px 12px 10px;border:1px solid #bc9151;border-radius:13px;background:linear-gradient(180deg,#f9ebcdbb,#e6c58dbb);box-shadow:inset 0 1px #fff9}
.vault-streak-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px}
.vault-streak-heading strong{font:900 9px Georgia,serif;letter-spacing:.15em;color:#71471e}
.vault-streak-heading span{font:italic 10px Georgia,serif;color:#916c3b}
.vault-progress{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;width:100%}
.vault-streak-card{display:flex;align-items:center;gap:7px;min-width:0;padding:5px 7px;border:1px solid #c4a06a;border-radius:9px;background:#fff6dfb5}
.vault-streak-card img{width:31px;height:38px;object-fit:contain;flex:none;filter:drop-shadow(0 2px 2px #6a431e33)}
.vault-streak-meta{flex:1;min-width:0}
.vault-streak-meta>div{display:flex;align-items:center;justify-content:space-between;gap:3px;color:#65401d;font:900 10px Georgia,serif}
.vault-streak-meta>div b{font-variant-numeric:tabular-nums;color:#8b5d2a}
.vault-streak-track{display:block;height:6px;margin-top:5px;overflow:hidden;border:1px solid #a77b43;border-radius:99px;background:#d6b982}
.vault-streak-track i{display:block;height:100%;border-radius:99px;background:linear-gradient(90deg,#8d531d,#e1a841);box-shadow:0 0 5px #e8bd65;transition:width .25s ease}
.vault-streak-card.tier-2 .vault-streak-track i{background:linear-gradient(90deg,#788b9c,#d9e1e8)}
.vault-streak-card.tier-3 .vault-streak-track i{background:linear-gradient(90deg,#a46d25,#f5d05d)}
.vault-streak-card.tier-4 .vault-streak-track i{background:linear-gradient(90deg,#754b9a,#d8a8f5)}
.vault-footer{position:relative;z-index:2;width:100%;display:flex;align-items:center;justify-content:center;gap:10px;padding-top:1px}
.vault-footer .chest-btn{min-width:120px;min-height:39px;padding:8px 19px}
.vault-footer .vault-open-all{background:linear-gradient(180deg,#f6d77e,#bd792c 58%,#814719);color:#3b1d05}
.vault-footer .vault-close{background:linear-gradient(180deg,#e6d5ad,#9d7641);color:#452b12}
.vault-footer-hint{color:#8a6738;font:italic 11px Georgia,serif}
@media(max-width:700px){
 .vault-shell{width:min(620px,97vw);max-height:96vh;overflow-y:auto;padding:15px 13px 13px;gap:8px;border-width:4px;border-radius:18px}
 .vault-heading{gap:7px;padding-bottom:8px}.vault-heading-main{gap:7px}.vault-emblem{width:58px;height:58px}.vault-heading .chest-kicker{font-size:8px}.vault-heading h2{font-size:clamp(20px,5vw,27px)}.vault-heading p{font-size:10px;max-width:25ch}
 .vault-header-stats{gap:4px}.vault-coins-panel{width:96px;height:40px;padding:5px 5px 5px 30px}.vault-coins-panel small{font-size:6px}.vault-coins-panel strong{font-size:14px}.vault-chest-total{min-width:42px;padding:3px 5px}.vault-chest-total small{font-size:6px}.vault-chest-total b{font-size:17px}
 .vault-chips{gap:4px}.vault-chip{min-height:61px;padding:4px 2px;border-width:1px;border-radius:8px;font-size:9px}.vault-chip img{width:27px;height:27px}.vault-chip b{top:2px;right:2px;min-width:15px;height:15px;padding:0 3px;font-size:8px;line-height:15px}
 .vault-inventory-heading span{font-size:8px}.vault-inventory-heading small{font-size:9px}
 .vault-list{grid-template-columns:1fr;max-height:24vh;min-height:68px;gap:6px}.vault-chest-card{min-height:82px;padding:5px 8px;gap:8px}.vault-chest-art{flex-basis:68px;width:68px;height:70px}.vault-chest-info>strong{font-size:12px}.vault-chest-origin,.vault-chest-info small{font-size:9px}.vault-chest-info .chest-btn{min-height:25px;padding:3px 10px;margin-top:1px;font-size:10px}
 .vault-empty-state{min-height:75px;gap:8px;padding:5px 8px}.vault-empty-state img{width:65px;height:65px}.vault-empty-state strong{font-size:15px}.vault-empty-state p{font-size:10px}
 .vault-streak-section{padding:7px}.vault-streak-heading{margin-bottom:4px}.vault-streak-heading strong{font-size:8px}.vault-streak-heading span{font-size:8px}.vault-progress{gap:4px}.vault-streak-card{gap:3px;padding:3px}.vault-streak-card img{width:22px;height:29px}.vault-streak-meta>div{font-size:8px}.vault-streak-track{height:5px;margin-top:3px}
 .vault-footer .chest-btn{min-width:100px;min-height:34px;padding:6px 14px;font-size:12px}
}
@media(max-width:390px){.vault-heading p{display:none}.vault-emblem{width:49px;height:49px}.vault-coins-panel{width:82px}.vault-streak-heading span{display:none}.vault-streak-card img{width:18px;height:25px}.vault-streak-meta>div{font-size:7px}}


/* ===== STAGE 140 — Illustrated Treasure Vault scene and custom rarity boards ===== */
#chestLayer .chest-backdrop.vault-backdrop{
 position:absolute;inset:0;display:block;padding:0;overflow:hidden;
 background:#201207 url("../assets/vault_ui/Treasure_Vault_Background.webp") center/100% 100% no-repeat;
 backdrop-filter:none;animation:chest-fade .28s ease both;
}
#chestLayer .chest-shell.vault-shell{
 position:absolute;inset:0;width:100%;height:100%;max-width:none;max-height:none;
 margin:0;padding:0;border:0;border-radius:0;box-shadow:none;background:transparent;
 display:block;overflow:hidden;color:#4b2c12;text-align:center;
}
#chestLayer .vault-topline{position:absolute;inset:0 0 auto;height:25%;pointer-events:none;z-index:2}
#chestLayer .vault-ribbon-copy{
 position:absolute;left:22.5%;top:18.8%;width:40.5%;height:6%;
 display:flex;align-items:center;justify-content:center;flex-direction:column;gap:2px;
 color:#633914;text-shadow:0 1px #fff0c9;overflow:hidden;
}
#chestLayer .vault-ribbon-copy span{font:900 clamp(9px,1.05vw,15px) Georgia,serif;letter-spacing:.16em}
#chestLayer .vault-ribbon-copy p{margin:0;font:italic clamp(8px,.85vw,12px) Georgia,serif}
#chestLayer .vault-top-coins{
 position:absolute;left:74.4%;top:8.3%;width:8.1%;height:7.4%;
 display:flex;align-items:center;justify-content:center;flex-direction:column;gap:1px;
 color:#fff0b4;text-shadow:0 2px 3px #532804;overflow:hidden;
}
#chestLayer .vault-top-coins small{font:900 clamp(6px,.58vw,9px) Georgia,serif;letter-spacing:.1em}
#chestLayer .vault-top-coins strong{font:900 clamp(12px,1.35vw,20px)/1 Georgia,serif}
#chestLayer .vault-top-total{
 position:absolute;right:6.4%;top:7.2%;width:6.4%;height:10.3%;
 display:flex;align-items:center;justify-content:center;flex-direction:column;gap:0;
 color:#633914;text-shadow:0 1px #fff5d4;
}
#chestLayer .vault-top-total strong{font:900 clamp(20px,2.2vw,32px)/1 Georgia,serif}
#chestLayer .vault-top-total small{font:900 clamp(6px,.6vw,9px) Georgia,serif;letter-spacing:.12em}
#chestLayer .vault-chips{
 position:absolute;left:4.6%;top:27.2%;width:90.8%;height:12.2%;
 display:flex;align-items:stretch;justify-content:space-between;gap:1.05%;
 z-index:4;overflow:visible;
}
#chestLayer .vault-chip.vault-filter-button{
 position:relative;flex:1 1 0;min-width:0;min-height:0;height:100%;
 margin:0;padding:0;border:0;border-radius:0;background:transparent;
 box-shadow:none;overflow:visible;cursor:pointer;
 transition:transform .15s ease,filter .15s ease;
}
#chestLayer .vault-filter-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;display:block;pointer-events:none;filter:drop-shadow(0 3px 3px #6d3b1855)}
#chestLayer .vault-filter-copy{
 position:absolute;left:32%;right:7%;top:12%;bottom:12%;
 display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
 color:#623714;text-shadow:0 1px #fff0c4;pointer-events:none;
}
#chestLayer .vault-filter-copy strong{font:900 clamp(9px,1.05vw,15px)/1 Georgia,serif;letter-spacing:.04em;white-space:nowrap}
#chestLayer .vault-filter-copy b{
 min-width:24px;padding:1px 8px;border-radius:999px;
 background:linear-gradient(#fff0bc,#d39a45);border:1px solid #946025;
 color:#4c290d;font:900 clamp(9px,.95vw,14px)/1.1 Georgia,serif;
}
#chestLayer .vault-chip.vault-filter-button:hover{transform:translateY(-3px);filter:brightness(1.08)}
#chestLayer .vault-chip.vault-filter-button.is-active{transform:translateY(-3px);filter:brightness(1.13) drop-shadow(0 0 5px #fff0a0)}
#chestLayer .vault-inventory-heading{
 position:absolute;left:8.5%;right:8.5%;top:40.1%;height:3.2%;
 display:flex;align-items:center;justify-content:space-between;z-index:3;
 color:#77471d;text-shadow:0 1px #ffe6ad;
}
#chestLayer .vault-inventory-heading span{font:900 clamp(9px,1vw,14px) Georgia,serif;letter-spacing:.16em}
#chestLayer .vault-inventory-heading small{font:italic clamp(8px,.8vw,11px) Georgia,serif}
#chestLayer .vault-list{
 position:absolute;left:7.7%;right:7.7%;top:43.3%;height:35.8%;max-height:none;min-height:0;
 padding:8px 9px;overflow-y:auto;overflow-x:hidden;
 display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-content:start;align-items:stretch;
 gap:9px 11px;background:transparent;border:0;border-radius:0;z-index:3;
 scrollbar-width:thin;scrollbar-color:#a76c2e #f0d097;
}
#chestLayer .vault-chest-card{
 min-width:0;min-height:0;padding:7px 7px 6px;display:flex;flex-direction:column;
 align-items:center;justify-content:flex-start;gap:3px;
 border:1px solid #a97839;border-radius:11px;
 background:linear-gradient(180deg,#fff0d9df,#e8c386d9);
 box-shadow:inset 0 1px 0 #fff9,0 2px 5px #77451e3b;
 text-align:center;overflow:hidden;
}
#chestLayer .vault-chest-art{width:100%;height:clamp(48px,8.4vh,82px);flex:none;display:grid;place-items:center}
#chestLayer .vault-chest-art img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 3px 3px #5d371f44)}
#chestLayer .vault-chest-info{min-width:0;width:100%;display:flex;flex-direction:column;align-items:center;gap:2px}
#chestLayer .vault-chest-info strong{font:900 clamp(10px,.95vw,14px)/1.1 Georgia,serif;color:#583315}
#chestLayer .vault-chest-origin{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#79552e;font:700 clamp(8px,.7vw,10px)/1.1 Georgia,serif}
#chestLayer .vault-chest-info small{color:#8d704d;font:italic clamp(7px,.62vw,9px)/1.1 Georgia,serif}
#chestLayer .vault-chest-info .chest-btn{min-height:23px;margin-top:2px;padding:3px 12px;font-size:10px;line-height:1}
#chestLayer .vault-chest-card.rarity-common{border-color:#b77c3f}
#chestLayer .vault-chest-card.rarity-rare{border-color:#8797a8}
#chestLayer .vault-chest-card.rarity-epic{border-color:#cf9b35}
#chestLayer .vault-chest-card.rarity-legendary{border-color:#9d65be}
#chestLayer .vault-empty-state{
 grid-column:1/-1;min-height:100%;display:flex;align-items:center;justify-content:center;gap:16px;
 padding:14px;border:1px dashed #a8793c;border-radius:15px;
 background:#fff0d1b8;color:#563314;text-align:left;
}
#chestLayer .vault-empty-state img{width:clamp(55px,8vh,84px);height:clamp(55px,8vh,84px);object-fit:contain}
#chestLayer .vault-empty-state strong{display:block;font:900 clamp(14px,1.6vw,21px) Georgia,serif}
#chestLayer .vault-empty-state p{margin:5px 0 0;color:#78542f;font:italic clamp(9px,.85vw,12px)/1.4 Georgia,serif}
#chestLayer .vault-streak-section{
 position:absolute;left:9%;right:9%;top:80%;height:8.2%;padding:5px 9px;
 border:1px solid #aa7638;border-radius:11px;
 background:linear-gradient(180deg,#fff0d5df,#e3bb7cdb);
 box-shadow:inset 0 1px #fff9;z-index:3;overflow:hidden;
}
#chestLayer .vault-streak-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 0 3px}
#chestLayer .vault-streak-heading strong{font:900 clamp(7px,.7vw,10px) Georgia,serif;letter-spacing:.12em;color:#71471e}
#chestLayer .vault-streak-heading span{font:italic clamp(7px,.65vw,9px) Georgia,serif;color:#916c3b}
#chestLayer .vault-progress{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;width:100%}
#chestLayer .vault-streak-card{display:flex;align-items:center;gap:5px;min-width:0;padding:2px 5px;border:1px solid #c4a06a;border-radius:7px;background:#fff6dfb5}
#chestLayer .vault-streak-card img{width:clamp(17px,2vw,27px);height:clamp(20px,3vh,30px);object-fit:contain;flex:none}
#chestLayer .vault-streak-meta{flex:1;min-width:0}
#chestLayer .vault-streak-meta>div{display:flex;align-items:center;justify-content:space-between;gap:2px;color:#67421f;font:900 clamp(7px,.67vw,9px) Georgia,serif}
#chestLayer .vault-streak-track{display:block;height:4px;margin-top:3px;border-radius:999px;background:#b78d5d55;overflow:hidden}
#chestLayer .vault-streak-track i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#b97b2c,#f2c86c)}
#chestLayer .vault-footer{
 position:absolute;left:9%;right:9%;bottom:1.3%;height:6.2%;display:flex;align-items:center;justify-content:space-between;
 gap:10px;z-index:5;pointer-events:none;
}
#chestLayer .vault-footer>*{pointer-events:auto}
#chestLayer .vault-footer .chest-btn{min-width:110px;min-height:34px;padding:6px 18px;font-size:12px}
#chestLayer .vault-footer-hint{color:#603a17;font:italic 11px Georgia,serif;text-shadow:0 1px #fff4cc}
#chestLayer .vault-close{margin-left:auto}
@media(max-width:900px){
 #chestLayer .vault-chips{left:3%;width:94%;gap:.5%}
 #chestLayer .vault-filter-copy strong{font-size:clamp(7px,1.35vw,11px)}
 #chestLayer .vault-list{left:5%;right:5%;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;padding:5px}
 #chestLayer .vault-streak-section{left:5%;right:5%}
 #chestLayer .vault-footer{left:5%;right:5%}
}
@media(max-width:600px){
 #chestLayer .vault-ribbon-copy p{display:none}
 #chestLayer .vault-ribbon-copy{top:19%;height:5%}
 #chestLayer .vault-chips{top:27%;height:11%;left:2%;width:96%;gap:.25%}
 #chestLayer .vault-filter-copy{left:31%;right:4%}
 #chestLayer .vault-filter-copy strong{font-size:clamp(6px,1.6vw,9px)}
 #chestLayer .vault-filter-copy b{font-size:8px;min-width:17px;padding:1px 4px}
 #chestLayer .vault-list{top:42%;height:37%;left:3%;right:3%;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;padding:4px}
 #chestLayer .vault-chest-card{padding:4px 3px;gap:2px}
 #chestLayer .vault-chest-art{height:clamp(35px,7vh,58px)}
 #chestLayer .vault-chest-info strong{font-size:9px}
 #chestLayer .vault-chest-origin{font-size:7px}
 #chestLayer .vault-chest-info small{font-size:6px}
 #chestLayer .vault-chest-info .chest-btn{min-height:19px;padding:2px 7px;font-size:8px}
 #chestLayer .vault-streak-section{left:3%;right:3%;top:80%;height:8.5%;padding:3px 4px}
 #chestLayer .vault-streak-heading strong{font-size:6px}
 #chestLayer .vault-streak-heading span{font-size:6px}
 #chestLayer .vault-progress{gap:2px}
 #chestLayer .vault-streak-card{gap:2px;padding:1px 2px}
 #chestLayer .vault-streak-card img{width:14px;height:19px}
 #chestLayer .vault-streak-meta>div{font-size:6px}
 #chestLayer .vault-streak-track{height:3px}
 #chestLayer .vault-footer{left:3%;right:3%;bottom:1%;height:6%}
 #chestLayer .vault-footer .chest-btn{min-width:76px;min-height:25px;padding:4px 10px;font-size:9px}
}


/* ===== STAGE 141 — Treasure Vault layout matched to the design plan =====
   The scene is a 16:9 stage that is letterboxed to fit any screen, so every
   percentage below lines up with the painted background. Sizes use cqw
   (1% of the stage width) so text scales with the art. */
#chestLayer .chest-backdrop.vault-backdrop{display:grid;place-items:center;background:#120a04;padding:0;overflow:hidden}
#chestLayer .vault-backdrop .chest-shell.vault-shell{
 --u:1cqw;
 position:relative;inset:auto;display:block;overflow:hidden;
 width:min(100vw,calc(100vh*1672/941));height:min(100vh,calc(100vw*941/1672));
 width:min(100vw,calc(100dvh*1672/941));height:min(100dvh,calc(100vw*941/1672));
 max-width:none;max-height:none;margin:0;padding:0;border:0;border-radius:0;box-shadow:none;
 container-type:size;color:#4b2c12;text-align:center;
 background:#201207 url("../assets/vault_ui/Treasure_Vault_Background.webp") center/100% 100% no-repeat;
}
#chestLayer .vault-shell .vault-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* header text that sits on the painted ribbon, coin plate and inventory sign */
#chestLayer .vault-shell .vault-topline{position:absolute;inset:0;height:auto;pointer-events:none;z-index:2}
#chestLayer .vault-shell .vault-ribbon-copy{position:absolute;left:23.6%;top:19.3%;width:38.4%;height:4.7%;display:flex;align-items:center;justify-content:center;overflow:hidden}
#chestLayer .vault-shell .vault-ribbon-copy p{margin:0;font:italic 700 max(9px,1.3cqw)/1.1 Georgia,serif;color:#5a3512;text-shadow:0 1px #fff0c8;white-space:nowrap}
#chestLayer .vault-shell .vault-top-coins{position:absolute;left:74.3%;top:8.1%;width:8.6%;height:7.4%;display:flex;align-items:center;justify-content:center;overflow:hidden}
#chestLayer .vault-shell .vault-top-coins strong{font:900 max(12px,2.4cqw)/1 Georgia,serif;color:#fff1c2;text-shadow:0 .15cqw .25cqw #3d1c05;letter-spacing:.02em}
#chestLayer .vault-shell .vault-top-total{position:absolute;left:86.1%;top:7.2%;width:8.8%;height:10.6%;right:auto;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;color:#4a2a10;text-shadow:0 1px #fff2cc}
#chestLayer .vault-shell .vault-top-total small{font:900 max(7px,.95cqw)/1.15 Georgia,serif;letter-spacing:.05em}
#chestLayer .vault-shell .vault-top-total strong{font:900 max(16px,3cqw)/1 Georgia,serif}

/* rarity filter boards */
#chestLayer .vault-shell .vault-chips{position:absolute;left:11.2%;top:26%;width:77.6%;height:11%;display:flex;align-items:stretch;justify-content:space-between;gap:1.2%;flex-wrap:nowrap;padding:0;z-index:4}
#chestLayer .vault-shell .vault-chip.vault-filter-button{position:relative;flex:1 1 0;min-width:0;min-height:0;height:100%;max-width:none;margin:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible;cursor:pointer;transition:transform .15s ease}
#chestLayer .vault-shell .vault-filter-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none;filter:saturate(.8) brightness(.9) drop-shadow(0 .25cqw .3cqw #5b341355);transition:filter .15s ease}
#chestLayer .vault-shell .vault-filter-copy{position:absolute;left:30%;right:3%;top:0;bottom:0;display:flex;align-items:center;justify-content:center;pointer-events:none;color:#5a3210;text-shadow:0 1px #ffeab8}
#chestLayer .vault-shell .vault-filter-copy strong{font:900 max(9px,1.55cqw)/1 Georgia,serif;letter-spacing:.01em;white-space:nowrap}
#chestLayer .vault-shell .vault-filter-count{position:absolute;right:5.5%;top:9%;min-width:1.9cqw;height:1.9cqw;padding:0 .5cqw;box-sizing:border-box;border-radius:99px;background:#4f2c12;border:.12cqw solid #f1cc7a;color:#ffefbd;font:900 max(7px,1cqw)/1.55cqw Georgia,serif;text-align:center}
#chestLayer .vault-shell .vault-chip.vault-filter-button:hover{transform:translateY(-.3cqw)}
#chestLayer .vault-shell .vault-chip.vault-filter-button:hover .vault-filter-art{filter:saturate(1) brightness(1.04) drop-shadow(0 .25cqw .3cqw #5b341355)}
#chestLayer .vault-shell .vault-chip.vault-filter-button.is-active{transform:translateY(-.3cqw);filter:none}
#chestLayer .vault-shell .vault-chip.vault-filter-button.is-active .vault-filter-art{filter:saturate(1.7) hue-rotate(-6deg) brightness(1.2) drop-shadow(0 0 .55cqw #ffe27a) drop-shadow(0 .25cqw .3cqw #5b3413)}
#chestLayer .vault-shell .vault-chip.vault-filter-button.is-active .vault-filter-copy{color:#3d1d05}

/* Vault Collection banner + sort */
#chestLayer .vault-shell .vault-collection-ribbon{position:absolute;left:34%;top:38.2%;width:32%;height:5.6%;z-index:3;display:grid;place-items:center;pointer-events:none}
#chestLayer .vault-shell .vault-collection-ribbon::before{content:"";position:absolute;left:0;right:0;top:20%;bottom:-9%;background:linear-gradient(#7a1417,#560c0f);clip-path:polygon(0 0,100% 0,95.5% 50%,100% 100%,0 100%,4.5% 50%);filter:drop-shadow(0 .2cqw .2cqw #3a160855)}
#chestLayer .vault-shell .vault-collection-ribbon::after{content:"";position:absolute;left:5%;right:5%;top:0;bottom:5%;background:linear-gradient(#d23c36,#a1221f 55%,#821517);border-top:.2cqw solid #efb556;border-bottom:.15cqw solid #5f0e11;box-shadow:0 .35cqw .5cqw #3b1a0a55}
#chestLayer .vault-shell .vault-collection-ribbon span{position:relative;z-index:1;margin-top:0;font:900 max(12px,2.15cqw)/1 Georgia,serif;color:#ffdc83;text-shadow:0 .18cqw .2cqw #4e0a0d;letter-spacing:.01em}
#chestLayer .vault-shell .vault-sort{position:absolute;right:11.9%;top:39.2%;width:12.6%;height:3.7%;z-index:4}
#chestLayer .vault-shell .vault-sort select{appearance:none;-webkit-appearance:none;width:100%;height:100%;padding:0 2.2cqw 0 .9cqw;border:.1cqw solid #cdb27a;border-radius:.9cqw;background:#faf0d6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5z' fill='%234a2a10'/%3E%3C/svg%3E") right .7cqw center/.9cqw no-repeat;color:#4a2c12;font:800 max(9px,1.3cqw) Georgia,serif;cursor:pointer;box-shadow:inset 0 1px #fff,0 .15cqw .3cqw #6d44152e}
#chestLayer .vault-shell .vault-sort select:focus-visible{outline:.15cqw solid #c47f21;outline-offset:.1cqw}

/* collection panel (empty state / summary) */
#chestLayer .vault-shell .vault-collection-panel{position:absolute;left:11.8%;top:44.6%;width:76.4%;height:18.4%;overflow:visible;border-radius:1.4cqw;background:linear-gradient(180deg,#f9edcfd9,#ecd6a4cc);border:.1cqw solid #d6bb82;box-shadow:inset 0 0 2.2cqw #fff3,inset 0 .1cqw #fff8;color:#b88f4c;z-index:3}
#chestLayer .vault-shell .vault-scenery{position:absolute;inset:0;width:100%;height:100%;opacity:.3;pointer-events:none;clip-path:inset(0 round 1.4cqw)}
#chestLayer .vault-shell .vault-hero-chest{position:absolute;left:3.6%;top:-9%;height:112%;width:auto;aspect-ratio:1;object-fit:contain;filter:drop-shadow(0 .5cqw .5cqw #5a3a1566);pointer-events:none}
#chestLayer .vault-shell .vault-laurel{position:absolute;top:50%;width:2.6cqw;height:6.5cqw;transform:translateY(-50%);color:#c9a35c;opacity:.9}
#chestLayer .vault-shell .vault-laurel.is-left{left:27.5%}
#chestLayer .vault-shell .vault-laurel.is-right{right:27.5%;transform:translateY(-50%) scaleX(-1)}
#chestLayer .vault-shell .vault-hero-copy{position:absolute;left:30%;right:30%;top:50%;transform:translateY(-50%);display:flex;flex-direction:column;align-items:center;gap:.5cqw}
#chestLayer .vault-shell .vault-hero-copy strong{font:900 max(13px,2.55cqw)/1.1 Georgia,serif;color:#3b2311;text-shadow:0 1px #fff3cf}
#chestLayer .vault-shell .vault-hero-copy p{margin:0;font:italic 600 max(9px,1.55cqw)/1.3 Georgia,serif;color:#5a3a1a}

/* Your Vault Treasures banner */
#chestLayer .vault-shell .vault-treasures-ribbon{position:absolute;left:34.6%;top:64.3%;width:30.8%;height:4.7%;z-index:3;display:grid;place-items:center;pointer-events:none;filter:drop-shadow(0 .3cqw .35cqw #4b2b1155)}
#chestLayer .vault-shell .vault-treasures-ribbon::before,#chestLayer .vault-shell .vault-treasures-ribbon::after{content:"";position:absolute;clip-path:polygon(2.5% 0,97.5% 0,100% 50%,97.5% 100%,2.5% 100%,0 50%)}
#chestLayer .vault-shell .vault-treasures-ribbon::before{inset:0;background:linear-gradient(#f0c46a,#a76d23)}
#chestLayer .vault-shell .vault-treasures-ribbon::after{inset:.22cqw;background:linear-gradient(#8f5d2c,#5f3a18)}
#chestLayer .vault-shell .vault-treasures-ribbon span{position:relative;z-index:1;font:900 max(11px,1.95cqw)/1 Georgia,serif;color:#fff0cc;text-shadow:0 .15cqw .2cqw #35190a}

/* slot grid */
#chestLayer .vault-shell .vault-list{position:absolute;left:13.2%;right:auto;top:69%;width:73.6%;height:18.8%;max-height:none;min-height:0;box-sizing:border-box;padding:.9cqw 1cqw;overflow-x:hidden;overflow-y:auto;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));grid-auto-rows:calc(18.8cqh - 1.8cqw);align-content:start;gap:.9cqw 1.1cqw;background:linear-gradient(180deg,#fff5dc66,#f1dcaa55);border:.1cqw solid #d2b57a;border-radius:1.3cqw;box-shadow:inset 0 0 1.6cqw #fff5;z-index:3;scrollbar-width:thin;scrollbar-color:#a76c2e #f0d097}
#chestLayer .vault-shell .vault-slot{display:grid;place-items:center;border:.15cqw solid #d6bd88;border-radius:1.2cqw;background:linear-gradient(180deg,#f6e6c3aa,#ead2a0aa);box-shadow:inset 0 .15cqw .5cqw #b98d4a33;overflow:hidden}
#chestLayer .vault-shell .vault-slot img{width:62%;height:62%;object-fit:contain;filter:grayscale(1) sepia(.55) brightness(1.35) contrast(.7);opacity:.3}
#chestLayer .vault-shell .vault-chest-card{min-width:0;min-height:0;padding:.5cqw .5cqw .6cqw;display:flex;flex-direction:column;align-items:center;justify-content:space-between;gap:.2cqw;border:.17cqw solid #b77c3f;border-radius:1.2cqw;background:linear-gradient(180deg,#fff2d6,#ebca8d);box-shadow:inset 0 .1cqw #fffa,0 .2cqw .5cqw #77451e44;overflow:hidden}
#chestLayer .vault-shell .vault-chest-card.rarity-common{border-color:#4f8fc2}
#chestLayer .vault-shell .vault-chest-card.rarity-rare{border-color:#b04a43}
#chestLayer .vault-shell .vault-chest-card.rarity-epic{border-color:#4f9a4a}
#chestLayer .vault-shell .vault-chest-card.rarity-legendary{border-color:#9157bd}
#chestLayer .vault-shell .vault-chest-art{position:relative;flex:1 1 0;min-height:0;width:100%;height:auto}
#chestLayer .vault-shell .vault-chest-art img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;transform:scale(1.45);transform-origin:50% 52%;filter:drop-shadow(0 .25cqw .25cqw #5d371f55)}
#chestLayer .vault-shell .vault-chest-info{flex:none;width:100%;display:flex;flex-direction:column;align-items:center;gap:.1cqw}
#chestLayer .vault-shell .vault-chest-info strong{font:900 max(8px,1.2cqw)/1.1 Georgia,serif;color:#50300f}
#chestLayer .vault-shell .vault-chest-origin{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:700 max(6px,.85cqw)/1.1 Georgia,serif;color:#7a5530}
#chestLayer .vault-shell .vault-chest-info .chest-btn{min-height:0;height:2cqw;margin-top:.25cqw;padding:0 1.6cqw;border-radius:.7cqw;font:900 max(8px,1.05cqw)/1 Georgia,serif;box-shadow:inset 0 1px #fff9,0 .15cqw 0 #5b3214}

/* next-treasure streak strip */
#chestLayer .vault-shell .vault-streak-section{position:absolute;left:13.2%;right:auto;top:88.7%;width:73.6%;height:3%;box-sizing:border-box;padding:0 .8cqw;display:flex;align-items:center;gap:1cqw;border:.1cqw solid #c29a5a;border-radius:.9cqw;background:linear-gradient(180deg,#fbeccdcc,#e7c98fcc);box-shadow:inset 0 .1cqw #fff9;z-index:3;overflow:hidden}
#chestLayer .vault-shell .vault-streak-heading{flex:none;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin:0;gap:0}
#chestLayer .vault-shell .vault-streak-heading strong{font:900 max(6px,.8cqw)/1.1 Georgia,serif;letter-spacing:.1em;color:#6d431a}
#chestLayer .vault-shell .vault-streak-heading span{font:italic 600 max(5px,.62cqw)/1.1 Georgia,serif;color:#8a6334}
#chestLayer .vault-shell .vault-progress{flex:1;min-width:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.7cqw;width:auto}
#chestLayer .vault-shell .vault-streak-card{display:flex;align-items:center;gap:.4cqw;min-width:0;padding:0 .4cqw;border:0;background:transparent}
#chestLayer .vault-shell .vault-streak-card img{width:1.5cqw;height:1.9cqw;object-fit:contain;flex:none}
#chestLayer .vault-shell .vault-streak-meta{flex:1;min-width:0}
#chestLayer .vault-shell .vault-streak-meta>div{display:flex;justify-content:space-between;gap:.3cqw;font:900 max(6px,.8cqw)/1.1 Georgia,serif;color:#5e3a17}
#chestLayer .vault-shell .vault-streak-track{display:block;height:.35cqw;margin-top:.15cqw;border-radius:99px;background:#a8814d55;overflow:hidden}
#chestLayer .vault-shell .vault-streak-track i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#b97b2c,#f2c86c)}

/* buttons on the stone ledge */
#chestLayer .vault-shell .vault-footer{position:absolute;left:25%;right:25%;width:auto;top:92.6%;bottom:auto;height:5.2%;display:flex;align-items:center;justify-content:center;gap:1.6cqw;padding:0;z-index:5;pointer-events:none}
#chestLayer .vault-shell .vault-footer>*{pointer-events:auto}
#chestLayer .vault-shell .vault-footer .chest-btn{min-width:11cqw;min-height:0;height:100%;margin:0;padding:0 2cqw;border-radius:.9cqw;font:900 max(9px,1.45cqw)/1 Georgia,serif}
#chestLayer .vault-shell .vault-close{margin-left:0}


/* ===== STAGE 142 — Treasure Vault re-arranged to the "Collection Adventure" plan =====
   New background (header, frame, ledge from the plan; panels left empty for live content).
   Coordinates are percentages of the 1672 x 941 stage. */
#chestLayer .vault-backdrop .chest-shell.vault-shell{background:#201207 url("../assets/vault_ui/Treasure_Vault_Background_Stage142.webp") center/100% 100% no-repeat}

/* coin value + inventory sign (painted plates are empty) */
#chestLayer .vault-shell .vault-top-coins{left:73.9%;top:4.6%;width:8%;height:7.6%}
#chestLayer .vault-shell .vault-top-coins strong{font:900 max(12px,2.65cqw)/1 Georgia,serif;color:#fff0c0}
#chestLayer .vault-shell .vault-top-total{left:85.7%;top:3.6%;width:10.4%;height:11%;gap:.1cqw;color:#4b2c0f}
#chestLayer .vault-shell .vault-top-total small{font:900 max(8px,1.2cqw)/1 Georgia,serif;letter-spacing:.03em}
#chestLayer .vault-shell .vault-top-total strong{font:900 max(18px,3.4cqw)/1 Georgia,serif}

/* rarity boards */
#chestLayer .vault-shell .vault-chips{left:6.3%;top:20.3%;width:87.3%;height:10.3%;gap:.85%}
#chestLayer .vault-shell .vault-filter-copy{left:31%;right:2%}
#chestLayer .vault-shell .vault-filter-copy strong{font:900 max(9px,1.8cqw)/1 Georgia,serif}
#chestLayer .vault-shell .vault-filter-count{right:-.4%;top:-13%;min-width:2.4cqw;height:2.4cqw;border:.17cqw solid #f0c25f;background:#3a1d0a;font:900 max(8px,1.35cqw)/2.05cqw Georgia,serif;z-index:2}

/* banner + sort */
#chestLayer .vault-shell .vault-collection-ribbon{left:29.9%;top:31.5%;width:40.4%;height:6.6%}
#chestLayer .vault-shell .vault-collection-ribbon span{font:900 max(14px,2.8cqw)/1 Georgia,serif;color:#fff2c6}
#chestLayer .vault-shell .vault-sort{left:auto;right:6.8%;top:32.1%;width:16.2%;height:4.9%}
#chestLayer .vault-shell .vault-sort select{font:800 max(10px,1.5cqw) Georgia,serif;border-radius:1.6cqw;padding:0 3cqw 0 1.3cqw;background-position:right 1.2cqw center;background-size:1.3cqw}

/* collection panel */
#chestLayer .vault-shell .vault-collection-panel{left:6.3%;top:38.8%;width:87.4%;height:16.3%;border-radius:1.6cqw;background:linear-gradient(180deg,#fcf2d9f0,#f4e2b9ee)}
#chestLayer .vault-shell .vault-scenery{opacity:.34}
#chestLayer .vault-shell .vault-hero-chest{left:4.2%;top:-52%;height:196%}
#chestLayer .vault-shell .vault-laurel{width:3.7cqw;height:7.6cqw}
#chestLayer .vault-shell .vault-laurel.is-left{left:28.2%}
#chestLayer .vault-shell .vault-laurel.is-right{right:14.2%}
#chestLayer .vault-shell .vault-hero-copy{left:31%;right:21%;gap:.3cqw}
#chestLayer .vault-shell .vault-hero-copy strong{font:900 max(16px,3.5cqw)/1.05 Georgia,serif;color:#2f1c0d}
#chestLayer .vault-shell .vault-hero-copy p{font:italic 700 max(10px,1.72cqw)/1.25 Georgia,serif;color:#3f2814}

/* treasures banner */
#chestLayer .vault-shell .vault-treasures-ribbon{left:31.1%;top:55.7%;width:37.7%;height:4.9%}
#chestLayer .vault-shell .vault-treasures-ribbon span{font:900 max(12px,2.3cqw)/1 Georgia,serif}

/* 4-column chest cards */
#chestLayer .vault-shell .vault-list{left:5.7%;top:58%;width:88.8%;height:25.4%;padding:1.95cqw 1.6cqw .8cqw;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:11.6cqw;gap:1.6cqw;border-radius:1.8cqw;background:linear-gradient(180deg,#fbf1d8f0,#f2dfb6ee);scroll-snap-type:y mandatory;scroll-padding-top:1.95cqw}
#chestLayer .vault-shell .vault-list>*{scroll-snap-align:start}
#chestLayer .vault-shell .vault-slot{border-radius:1.4cqw}
#chestLayer .vault-shell .vault-slot img{width:46%;height:60%}
#chestLayer .vault-shell .vault-chest-card{padding:.4cqw 1.6cqw .9cqw;justify-content:flex-start;gap:0;border-width:.2cqw;border-radius:1.4cqw;background:linear-gradient(180deg,#fff8e8,#f6e5be)}
#chestLayer .vault-shell .vault-chest-art{flex:1 1 0}
#chestLayer .vault-shell .vault-chest-art img{transform:scale(1.2)}
#chestLayer .vault-shell .vault-chest-info{gap:.3cqw}
#chestLayer .vault-shell .vault-chest-info strong{font:900 max(10px,1.9cqw)/1.05 Georgia,serif;color:#2f1c0d}
#chestLayer .vault-shell .vault-chest-info .chest-btn{width:70%;height:2.7cqw;margin:0;border-radius:.9cqw;font:900 max(10px,1.9cqw)/1 Georgia,serif;background:linear-gradient(180deg,#ffe273,#f4b928 55%,#dd9411);border:.12cqw solid #c07d12;color:#3a1f05;box-shadow:inset 0 .12cqw #fff8,0 .2cqw 0 #a96c0c}

/* next-treasure strip with colored bars */
#chestLayer .vault-shell .vault-streak-section{left:5.7%;top:83.6%;width:88.8%;height:6.7%;padding:0 1.2cqw;gap:.8cqw;border:.1cqw solid #d3b682;border-radius:1.5cqw;background:linear-gradient(180deg,#fcf3dcf2,#f2e0b8f0)}
#chestLayer .vault-shell .vault-streak-heading{width:15%;gap:.15cqw}
#chestLayer .vault-shell .vault-streak-heading strong{font:900 max(8px,1.3cqw)/1.05 Georgia,serif;letter-spacing:.01em;color:#2f1c0d}
#chestLayer .vault-shell .vault-streak-heading span{font:italic 700 max(6px,.9cqw)/1.15 Georgia,serif;color:#4a3118}
#chestLayer .vault-shell .vault-progress{gap:.6cqw}
#chestLayer .vault-shell .vault-streak-card{gap:.7cqw;padding:0 .5cqw;position:relative}
#chestLayer .vault-shell .vault-streak-card+.vault-streak-card:before{content:"";position:absolute;left:-.4cqw;top:12%;bottom:12%;width:.1cqw;background:#d0b27c}
#chestLayer .vault-shell .vault-streak-card img{width:2.5cqw;height:3.2cqw}
#chestLayer .vault-shell .vault-streak-meta>div{font:900 max(8px,1.45cqw)/1.1 Georgia,serif;color:#2f1c0d}
#chestLayer .vault-shell .vault-streak-meta>div b{font-weight:700;color:#3f2814}
#chestLayer .vault-shell .vault-streak-track{height:.75cqw;margin-top:.3cqw;background:#bdb7ab;border-radius:99px;box-shadow:inset 0 .08cqw .12cqw #0003}
#chestLayer .vault-shell .vault-streak-card.tier-1 .vault-streak-track i{background:linear-gradient(#58b2ff,#1f78d6)}
#chestLayer .vault-shell .vault-streak-card.tier-2 .vault-streak-track i{background:linear-gradient(#ff6a5c,#d62a22)}
#chestLayer .vault-shell .vault-streak-card.tier-3 .vault-streak-track i{background:linear-gradient(#5fd06c,#2e9d3d)}
#chestLayer .vault-shell .vault-streak-card.tier-4 .vault-streak-track i{background:linear-gradient(#b570f2,#7a2fc4)}

/* big buttons on the stone ledge */
#chestLayer .vault-shell .vault-footer{left:26.7%;right:auto;width:44.9%;top:90.8%;height:7.6%;gap:1.8cqw}
#chestLayer .vault-shell .vault-footer .chest-btn{height:100%;min-width:0;padding:0;border-radius:1.4cqw;font:900 max(14px,2.5cqw)/1 Georgia,serif;text-shadow:0 .1cqw .1cqw #fff7}
#chestLayer .vault-shell .vault-footer .vault-open-all{width:23.2cqw;background:linear-gradient(180deg,#ffe56e,#f6b821 52%,#d98d0e);border:.25cqw solid #fff0a6;box-shadow:0 0 0 .22cqw #a5650b,0 .45cqw .6cqw #4a280a99,inset 0 .15cqw #fffa;color:#4a2606}
#chestLayer .vault-shell .vault-footer .vault-close{width:19.9cqw;background:linear-gradient(180deg,#f4efe4,#cfc7b6 55%,#9d9483);border:.25cqw solid #fff7e6;box-shadow:0 0 0 .22cqw #6c6252,0 .45cqw .6cqw #4a280a99,inset 0 .15cqw #fffc;color:#2b2218}

/* Stage 142 refinements */
#chestLayer .vault-shell .vault-hero-chest{left:5.2%;top:-36%;height:152%}
#chestLayer .vault-shell .vault-treasures-ribbon{z-index:5}
#chestLayer .vault-shell .vault-hero-copy p{text-wrap:balance}
#chestLayer .vault-shell .vault-chest-info .chest-btn{align-self:center;width:72%}
#chestLayer .vault-shell .vault-hero-chest{left:4.6%;top:-44%;height:172%}


/* ===== STAGE 143 — Custom Treasure Vault art assets (cut from / drawn to match the plan) ===== */
#chestLayer .vault-shell .vault-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* banners: art carries the lettering */
#chestLayer .vault-shell .vault-collection-ribbon{left:30.3%;top:31.3%;width:39.4%;height:7.5%;background:url("../assets/vault_ui/Vault_Collection_Banner.webp") center/100% 100% no-repeat;filter:drop-shadow(0 .3cqw .35cqw #3b1a0a66)}
#chestLayer .vault-shell .vault-collection-ribbon::before,#chestLayer .vault-shell .vault-collection-ribbon::after{display:none}
#chestLayer .vault-shell .vault-treasures-ribbon{left:32%;top:55.6%;width:36%;height:5.1%;background:url("../assets/vault_ui/Vault_Treasures_Ribbon.webp") center/100% 100% no-repeat;filter:drop-shadow(0 .3cqw .35cqw #3b1a0a55)}
#chestLayer .vault-shell .vault-treasures-ribbon::before,#chestLayer .vault-shell .vault-treasures-ribbon::after{display:none}

/* collection panel art (includes the desert scenery) */
#chestLayer .vault-shell .vault-collection-panel{background:url("../assets/vault_ui/Vault_Collection_Panel.webp") center/100% 100% no-repeat;border:0;box-shadow:none;border-radius:0;overflow:visible}
#chestLayer .vault-shell .vault-laurel{width:4.3cqw;height:auto;opacity:1;color:inherit}
#chestLayer .vault-shell .vault-laurel.is-left{left:28.4%}
#chestLayer .vault-shell .vault-laurel.is-right{right:14.3%}

/* sort pill */
#chestLayer .vault-shell .vault-sort::before{content:"";position:absolute;inset:-.36cqw;background:url("../assets/vault_ui/Vault_Sort_Pill.webp") center/100% 100% no-repeat;pointer-events:none}
#chestLayer .vault-shell .vault-sort select{position:relative;background-color:transparent;border:0;box-shadow:none}

/* count badges */
#chestLayer .vault-shell .vault-filter-count{background:url("../assets/vault_ui/Vault_Count_Badge.webp") center/100% 100% no-repeat;border:0;border-radius:0;width:3.1cqw;height:3.1cqw;min-width:0;padding:0;right:-1%;top:-19%;color:#fff4d2;font:900 max(8px,1.45cqw)/3.1cqw Georgia,serif;text-shadow:0 .1cqw .15cqw #2a1204}

/* chest card frames */
#chestLayer .vault-shell .vault-chest-card{position:relative;isolation:isolate;overflow:visible;background:none;border:0;box-shadow:none}
#chestLayer .vault-shell .vault-chest-card::before{content:"";position:absolute;inset:-.6cqw;z-index:-1;background:var(--frame) center/100% 100% no-repeat}
#chestLayer .vault-shell .vault-chest-card.rarity-common{--frame:url("../assets/vault_ui/Vault_Card_Common.webp")}
#chestLayer .vault-shell .vault-chest-card.rarity-rare{--frame:url("../assets/vault_ui/Vault_Card_Rare.webp")}
#chestLayer .vault-shell .vault-chest-card.rarity-epic{--frame:url("../assets/vault_ui/Vault_Card_Epic.webp")}
#chestLayer .vault-shell .vault-chest-card.rarity-legendary{--frame:url("../assets/vault_ui/Vault_Card_Legendary.webp")}

/* footer buttons use the art */
#chestLayer .vault-shell .vault-footer{left:26.7%;width:46.5%;top:90.8%;height:7.9%}
#chestLayer .vault-shell .vault-footer .chest-btn{border:0;box-shadow:none;border-radius:0;background-color:transparent;background-repeat:no-repeat;background-position:center;background-size:100% 100%;filter:drop-shadow(0 .35cqw .45cqw #3b1a0a88);transition:transform .12s ease,filter .12s ease}
#chestLayer .vault-shell .vault-footer .chest-btn:hover{transform:translateY(-.25cqw);filter:brightness(1.06) drop-shadow(0 .45cqw .5cqw #3b1a0aaa)}
#chestLayer .vault-shell .vault-footer .vault-open-all{width:23.6cqw;background-image:url("../assets/vault_ui/Vault_Button_OpenAll.webp");color:#4a2606;text-shadow:0 .1cqw 0 #ffe9a266}
#chestLayer .vault-shell .vault-footer .vault-close{width:19.9cqw;background-image:url("../assets/vault_ui/Vault_Button_Close.webp")}


/* Before Game Perk title ribbon asset (WebP, transparent background) */
.before-perk-title {
  position: absolute;
  z-index: 5;
  left: 17.5%;
  top: -4%;
  width: 65%;
  height: 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.before-perk-title img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}


/* ===== STAGE 144 — Treasure Vault layout and information polish ===== */
/* Keep the supplied banner artwork at its natural aspect ratio. */
#chestLayer .vault-shell .vault-collection-ribbon{
  left:32.5%;top:30.7%;width:35%;height:7.9%;
  background:url("../assets/vault_ui/Vault_Collection_Banner_Cropped.webp") center/contain no-repeat;
  filter:drop-shadow(0 .28cqw .32cqw #3b1a0a66);
}
#chestLayer .vault-shell .vault-collection-ribbon::before,
#chestLayer .vault-shell .vault-collection-ribbon::after{display:none}

/* Use the correctly proportioned, tightly cropped 602 × 47 ribbon. */
#chestLayer .vault-shell .vault-treasures-ribbon{
  left:32%;top:53.35%;width:36%;height:5%;
  background:url("../assets/vault_ui/1Vault_Treasures_Ribbon.webp") center/contain no-repeat;
  filter:drop-shadow(0 .22cqw .28cqw #3b1a0a55);
}
#chestLayer .vault-shell .vault-treasures-ribbon::before,
#chestLayer .vault-shell .vault-treasures-ribbon::after{display:none}

/* Compact the hero summary so more room belongs to the actual collection. */
#chestLayer .vault-shell .vault-collection-panel{
  left:10%;top:39.1%;width:80%;height:14.1%;
  background-size:100% 100%;
}
#chestLayer .vault-shell .vault-hero-chest{left:4.2%;top:-7%;height:120%;width:auto}
#chestLayer .vault-shell .vault-laurel{width:3.1cqw;height:5.4cqw}
#chestLayer .vault-shell .vault-laurel.is-left{left:27.8%}
#chestLayer .vault-shell .vault-laurel.is-right{right:14.5%}
#chestLayer .vault-shell .vault-hero-copy{left:31%;right:20%;gap:.22cqw}
#chestLayer .vault-shell .vault-hero-copy strong{font:900 max(15px,3.05cqw)/1.05 Georgia,serif}
#chestLayer .vault-shell .vault-hero-copy p{font:italic 700 max(9px,1.42cqw)/1.2 Georgia,serif;max-width:92%}

/* More useful card content, with four cards per row and a scrollable history. */
#chestLayer .vault-shell .vault-list{
  left:5.7%;top:58.05%;width:88.8%;height:25.15%;
  padding:1.75cqw 1.6cqw .8cqw;
  grid-template-columns:repeat(4,minmax(0,1fr));
  grid-auto-rows:11.6cqw;gap:1.45cqw;
  scroll-padding-top:1.75cqw;
}
#chestLayer .vault-shell .vault-chest-card{padding:.45cqw 1.45cqw .8cqw;gap:.12cqw}
#chestLayer .vault-shell .vault-chest-art{flex:1 1 0;min-height:0}
#chestLayer .vault-shell .vault-chest-art img{transform:scale(1.08)}
#chestLayer .vault-shell .vault-chest-info{gap:.18cqw}
#chestLayer .vault-shell .vault-chest-info strong{font:900 max(10px,1.58cqw)/1.05 Georgia,serif}
#chestLayer .vault-shell .vault-chest-meta{width:100%;display:flex;flex-direction:column;align-items:center;gap:.08cqw;line-height:1.05}
#chestLayer .vault-shell .vault-chest-origin,
#chestLayer .vault-shell .vault-chest-date{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:700 max(7px,.92cqw)/1.12 Georgia,serif;color:#76502a}
#chestLayer .vault-shell .vault-chest-date{color:#5d3b1d;font-weight:800}
#chestLayer .vault-shell .vault-chest-info .chest-btn{width:66%;height:2.05cqw;margin:.12cqw 0 0;padding:0 .7cqw;border-radius:.72cqw;font:900 max(9px,1.38cqw)/1 Georgia,serif}

/* Keep the streak tracker and footer separated, with buttons sized to their artwork. */
#chestLayer .vault-shell .vault-streak-section{top:84.05%;height:6.25%}
#chestLayer .vault-shell .vault-footer{
  left:35%;right:auto;width:30%;top:91.05%;height:7.4%;
  justify-content:center;gap:1.25cqw;
}
#chestLayer .vault-shell .vault-footer .chest-btn{
  width:13.4cqw;height:100%;min-width:0;flex:0 0 13.4cqw;
  padding:0;background-size:contain;background-repeat:no-repeat;background-position:center;
}
#chestLayer .vault-shell .vault-footer .vault-open-all,
#chestLayer .vault-shell .vault-footer .vault-close{width:13.4cqw;flex-basis:13.4cqw}
#chestLayer .vault-shell .vault-footer .vault-open-all{font:900 max(10px,1.42cqw)/1 Georgia,serif}
#chestLayer .vault-shell .vault-footer .vault-close{color:transparent}

/* ===== STAGE 145 — Before Game Perk visual refinement =====
   Match the approved large red ribbon / spacious two-column perk-card reference.
   Presentation-only overrides: perk selection, ownership, streak checks and start logic are unchanged. */
#modalRoot .before-perk-backdrop{
  background:rgba(0,0,0,.91);
  backdrop-filter:blur(2px);
}
#modalRoot .modal.before-perk-modal{
  width:min(75vw,112.5vh);
}
#modalRoot .before-perk-shell{
  overflow:visible;
}
/* The supplied title artwork already contains the complete red-and-gold banner. */
#modalRoot .before-perk-title{
  left:17.5%;
  top:-3.5%;
  width:65%;
  height:22%;
  overflow:visible;
}
#modalRoot .before-perk-title img{
  width:100%;
  height:100%;
  object-fit:contain;
  object-position:center;
}
/* Wider, taller instruction strip with a readable two-line message. */
#modalRoot .before-perk-info{
  left:8%;
  top:20.5%;
  width:84%;
  height:11%;
  padding:0 3.2cqw;
}
#modalRoot .before-perk-info p{
  max-width:100%;
  font-size:clamp(12px,1.55cqw,19px);
  line-height:1.22;
  font-weight:800;
}
/* Four large cards: keep all four visible without an internal scroll area. */
#modalRoot .before-perk-grid{
  left:7.2%;
  top:34%;
  width:85.6%;
  height:46.5%;
  gap:1.05cqw 1.25cqw;
  padding:.25cqw;
  grid-template-columns:repeat(2,minmax(0,1fr));
  grid-template-rows:repeat(2,minmax(0,1fr));
  align-content:stretch;
  overflow:visible;
}
#modalRoot .before-perk-card{
  min-height:0;
  overflow:visible;
}
#modalRoot .before-perk-card-bg{
  inset:-2% -1%;
  width:102%;
  height:104%;
  object-fit:fill;
}
#modalRoot .before-perk-card input{
  left:4%;
  top:12%;
  width:2.9cqw;
  height:2.9cqw;
  margin:0;
  accent-color:#b8791e;
  filter:drop-shadow(0 1px 2px #6b390d88);
}
#modalRoot .before-perk-icon{
  left:3.5%;
  top:17%;
  width:29%;
  height:76%;
}
#modalRoot .before-perk-icon img{
  width:96%;
  height:96%;
  object-fit:contain;
}
#modalRoot .before-perk-copy{
  left:33.5%;
  right:4%;
  top:8.5%;
  bottom:7%;
  gap:.38cqw;
  overflow:visible;
}
#modalRoot .before-perk-copy>strong{
  max-width:100%;
  font-size:clamp(15px,2.15cqw,27px);
  line-height:1.06;
  white-space:normal;
  overflow:visible;
  text-overflow:clip;
}
#modalRoot .before-perk-meta{
  gap:.65cqw;
  flex-wrap:nowrap;
}
#modalRoot .before-perk-meta .rarity-tag{
  font-size:clamp(10px,1.08cqw,14px);
  padding:.2cqw .85cqw;
  white-space:nowrap;
}
#modalRoot .before-perk-meta b{
  font-size:clamp(10px,1.12cqw,14px);
  white-space:nowrap;
}
#modalRoot .before-perk-description{
  display:block;
  font-size:clamp(12px,1.58cqw,19px);
  line-height:1.2;
  overflow:visible;
  -webkit-line-clamp:unset;
}
#modalRoot .before-perk-lock{
  font-size:clamp(10px,1.05cqw,13px);
  font-style:italic;
  font-weight:900;
}
#modalRoot .before-perk-card.is-disabled{
  opacity:.82;
}
/* Larger image buttons, retaining their native artwork proportions. */
#modalRoot .before-perk-actions{
  left:8%;
  right:8%;
  bottom:3.1%;
  height:12.5%;
  justify-content:space-between;
  gap:0;
}
#modalRoot .before-perk-cancel{
  width:29%;
  height:100%;
}
#modalRoot .before-perk-start{
  width:35%;
  height:100%;
}
#modalRoot .before-perk-cancel img,
#modalRoot .before-perk-start img{
  width:100%;
  height:100%;
  object-fit:contain;
}
@media(max-width:700px){
  #modalRoot .modal.before-perk-modal{width:min(94vw,141vh)}
  #modalRoot .before-perk-title{left:17%;width:66%;top:-1%;height:19%}
  #modalRoot .before-perk-info{left:7%;width:86%;top:19%;height:12%}
  #modalRoot .before-perk-info p{font-size:clamp(10px,1.65cqw,14px)}
  #modalRoot .before-perk-grid{left:6%;width:88%;top:31%;height:49%;gap:1cqw}
  #modalRoot .before-perk-card input{width:3.2cqw;height:3.2cqw}
  #modalRoot .before-perk-copy{left:32%;right:3%;gap:.35cqw}
  #modalRoot .before-perk-copy>strong{font-size:clamp(11px,2.1cqw,17px)}
  #modalRoot .before-perk-meta .rarity-tag,
  #modalRoot .before-perk-meta b{font-size:clamp(8px,1.15cqw,11px)}
  #modalRoot .before-perk-description{font-size:clamp(9px,1.45cqw,12px);line-height:1.16}
  #modalRoot .before-perk-lock{font-size:clamp(8px,1.05cqw,10px)}
  #modalRoot .before-perk-actions{left:6%;right:6%;bottom:2.5%;height:11%}
  #modalRoot .before-perk-cancel{width:29%}
  #modalRoot .before-perk-start{width:36%}
}


/* STAGE 146 — Persistent opt-out for the Before Game Perks screen. */
#modalRoot .modal.before-perk-modal{
  width:min(75vw,112.5vh);height:auto;max-height:94vh;aspect-ratio:auto;
  display:flex;flex-direction:column;align-items:stretch;gap:clamp(7px,.8vh,12px);
  overflow:visible;background:transparent;box-shadow:none;padding:0;border:0;
}
#modalRoot .modal.before-perk-modal .before-perk-shell{flex:0 0 auto;width:100%;aspect-ratio:3/2;}
#modalRoot .before-perk-optout{
  flex:0 0 auto;display:flex;align-items:center;justify-content:center;gap:10px;
  width:max-content;max-width:94%;align-self:center;box-sizing:border-box;
  padding:9px 18px;border:1px solid #d8b36a;border-radius:12px;
  color:#f8e8c4;background:linear-gradient(180deg,#45301dF2,#21170ff2);
  box-shadow:0 4px 16px #0008,inset 0 1px #fff3;font-family:Georgia,"Times New Roman",serif;
  cursor:pointer;text-align:left;
}
#modalRoot .before-perk-optout input{width:20px;height:20px;flex:0 0 20px;accent-color:#d69b31;cursor:pointer}
#modalRoot .before-perk-optout span{display:flex;flex-direction:column;gap:2px}
#modalRoot .before-perk-optout strong{font-size:clamp(12px,1.05vw,16px);line-height:1.2}
#modalRoot .before-perk-optout small{font-size:clamp(10px,.82vw,12px);color:#e8c98d;line-height:1.2}
#modalRoot .before-perk-skip-confirm{max-width:min(620px,88vw);padding:clamp(18px,2.4vw,30px);border:2px solid #d5a54d;border-radius:18px;background:linear-gradient(145deg,#fff0c9,#e8c58c 55%,#c89b5c);color:#4b2a12;box-shadow:0 16px 55px #0009;font-family:Georgia,"Times New Roman",serif}
#modalRoot .before-perk-skip-confirm h2{margin:0 0 12px;text-align:center;font-size:clamp(22px,2vw,30px);color:#642d13}
#modalRoot .before-perk-skip-confirm p{font-size:clamp(13px,1.05vw,16px);line-height:1.45;margin:10px 0}
#modalRoot .before-perk-skip-confirm .before-perk-reactivate-note{padding:10px 12px;border-left:4px solid #a66b22;background:#fff8e6a8;border-radius:6px}
#modalRoot .before-perk-skip-confirm .modal-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:18px}
#modalRoot .before-perk-skip-confirm .modal-actions button{padding:10px 16px;border:1px solid #8d5c25;border-radius:9px;background:#f7e5bd;color:#4b2a12;font-weight:800;cursor:pointer}
#modalRoot .before-perk-skip-confirm .modal-actions button.primary{background:linear-gradient(180deg,#f7c65c,#b87519);color:#381b07}
#gamePage .menu-image-button.menu-before-perk-reactivate{
 display:flex!important;align-items:center;justify-content:center;min-height:clamp(54px,6vw,86px)!important;
 padding:8px!important;border:2px solid #d7a64d!important;border-radius:12px!important;
 background:linear-gradient(145deg,#f8df9d,#b8792d)!important;
 box-shadow:inset 0 1px #fff9,0 3px 8px #0007!important;line-height:1.1!important;
}
#gamePage .menu-image-button.menu-before-perk-reactivate span{display:block;color:#43240d;font:900 clamp(12px,1.15vw,17px)/1.15 Georgia,serif;text-align:center;text-shadow:0 1px #fff8}
@media(max-width:700px){
 #modalRoot .modal.before-perk-modal{width:94vw;max-height:96vh;gap:6px}
 #modalRoot .before-perk-optout{max-width:98%;padding:7px 10px;gap:7px}
 #modalRoot .before-perk-optout input{width:18px;height:18px;flex-basis:18px}
 #modalRoot .before-perk-optout strong{font-size:11px}
 #modalRoot .before-perk-optout small{font-size:9px}
}

#gamePage .menu-image-button.menu-before-perk-active{
 display:flex!important;align-items:center;justify-content:center;min-height:clamp(54px,6vw,86px)!important;
 padding:7px!important;border:2px solid #d7a64d!important;border-radius:12px!important;
 background:linear-gradient(145deg,#fff0b8,#d99a35 55%,#8c4f17)!important;
 box-shadow:inset 0 1px #fff9,0 3px 8px #0007!important;line-height:1.1!important;
}
#gamePage .menu-image-button.menu-before-perk-active span{display:flex;flex-direction:column;gap:4px;align-items:center;text-align:center;color:#43240d}
#gamePage .menu-image-button.menu-before-perk-active small{font:900 clamp(8px,.7vw,10px)/1 Georgia,serif;letter-spacing:.06em}
#gamePage .menu-image-button.menu-before-perk-active strong{font:900 clamp(12px,1.05vw,16px)/1.08 Georgia,serif;text-shadow:0 1px #fff8}

#gamePage .menu-active-perk-name{
 position:absolute;z-index:2;left:12%;top:31%;width:76%;min-height:20%;box-sizing:border-box;
 display:flex;align-items:center;justify-content:center;padding:2px 5px;border-radius:7px;
 background:linear-gradient(180deg,#f7e4b8f5,#e6c78ff5);border:1px solid #bd873e;
 color:#542b12;font:900 clamp(11px,1vw,15px)/1.1 Georgia,serif;text-align:center;
 text-shadow:0 1px #fff9;box-shadow:0 2px 5px #3b1e0c55;pointer-events:none;
}
#gamePage .menu-active-perk-name[hidden]{display:none!important}


/* STAGE 147 — Larger Temple Menu + illustrated Before-game Blessing reactivation.
   The supplied nav_blessing_user.webp is used as the reactivation control as well
   as the normal Before-game Blessing menu item. */
#gamePage #gameDrawer.temple-menu-pieces{
  width:min(1180px,94vw,calc(86vh * 1.5))!important;
  max-width:94vw!important;
  max-height:86vh!important;
  transform:translate(-50%,-50%) scale(.98)!important;
  padding:4.2% 4.2% 5%!important;
  gap:1.6%!important;
  grid-template-rows:17% 37% minmax(0,1fr) 10%!important;
}
#gamePage #gameDrawer.temple-menu-pieces.drawer-open{
  transform:translate(-50%,-50%) scale(.98)!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-topline{
  min-height:0!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-header-piece{
  width:75%!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-nav{
  gap:2.5% 2.2%!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-nav .menu-image-button{
  min-width:0!important;
  min-height:0!important;
}
#gamePage #gameDrawer.temple-menu-pieces .temple-menu-nav .menu-image-button img{
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
}
#gamePage #gameDrawer.temple-menu-pieces .menu-image-button.menu-before-perk-reactivate{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-height:0!important;
  padding:0!important;
  border:0!important;
  border-radius:12px!important;
  background:transparent!important;
  box-shadow:none!important;
}
#gamePage #gameDrawer.temple-menu-pieces .menu-image-button.menu-before-perk-reactivate img{
  display:block!important;
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
  filter:drop-shadow(0 2px 4px #0008);
}
#gamePage #gameDrawer.temple-menu-pieces .menu-image-button.menu-before-perk-reactivate:hover img{
  filter:brightness(1.1) drop-shadow(0 3px 6px #ffcf5caa);
}
@media(max-width:700px){
  #gamePage #gameDrawer.temple-menu-pieces{
    width:min(94vw,calc(86vh * 1.5))!important;
    max-width:94vw!important;
    max-height:86vh!important;
    transform:translate(-50%,-50%) scale(1)!important;
    grid-template-rows:16% 37% minmax(0,1fr) 9%!important;
    padding:5% 4% 6%!important;
    gap:1.4%!important;
  }
  #gamePage #gameDrawer.temple-menu-pieces.drawer-open{
    transform:translate(-50%,-50%) scale(1)!important;
  }
  #gamePage #gameDrawer.temple-menu-pieces .temple-menu-header-piece{
    width:78%!important;
  }
}



/* STAGE 150 — Caravan Player Hub: illustrated menu, floating map, relocated player stats */
.page.caravan-house-page{display:none!important;}
.page.caravan-house-page.active{display:block!important;}
.caravan-house-page{
 width:100vw;height:100vh;min-height:480px;overflow:hidden;background:#090706;
}
.caravan-house-scene{
 position:relative;width:100%;height:100%;overflow:hidden;isolation:isolate;
 background:#090706;
}
.caravan-house-background{
 position:absolute;inset:0;width:100%;height:100%;
 object-fit:contain;object-position:center;
}
.caravan-hub-menu-frame{
 position:absolute;right:3.4%;top:7.2%;width:23%;height:85%;
 z-index:3;pointer-events:none;
 filter:drop-shadow(0 5px 9px #0009);
}
.caravan-hub-menu-frame>img{width:100%;height:100%;object-fit:fill;display:block;}
.caravan-hub-menu{
 position:absolute;right:5.25%;top:22.3%;width:19.3%;height:62%;
 z-index:4;display:flex;flex-direction:column;justify-content:space-between;
 gap:1.1%;
}
.caravan-hub-menu-button{
 flex:1 1 0;min-height:0;width:100%;padding:0;border:0;
 border-radius:0;background:transparent;display:flex;align-items:center;justify-content:center;
 box-shadow:none;
}
.caravan-hub-menu-button img{
 display:block;width:100%;height:100%;object-fit:contain;
 filter:drop-shadow(0 2px 3px #2a1208a8);
 transition:transform .16s ease,filter .16s ease;
}
.caravan-hub-menu-button:hover img,.caravan-hub-menu-button:focus-visible img{
 transform:scale(1.045);filter:drop-shadow(0 0 8px #ffdf7d);
}
.caravan-hub-menu-button:focus-visible{outline:2px solid #ffe08a;outline-offset:2px;border-radius:10px;}
.caravan-floating-map{
 position:absolute;left:2.2%;bottom:2.4%;width:25%;height:auto;aspect-ratio:3/2;
 z-index:5;padding:0;border:0;background:transparent;border-radius:0;
 filter:drop-shadow(0 5px 7px #26130799);
}
.caravan-floating-map img{
 display:block;width:100%;height:100%;object-fit:contain;
 transition:transform .18s ease,filter .18s ease;
}
.caravan-floating-map:hover img,.caravan-floating-map:focus-visible img{
 transform:translateY(-5px) scale(1.035);filter:drop-shadow(0 0 10px #ffd66b);
}
.caravan-floating-map:focus-visible{outline:2px solid #ffe08a;outline-offset:3px;border-radius:12px;}

/* Existing three-slot Main Menu player panel now lives at the front edge of the Caravan desk. */
.caravan-player-stats{
 position:absolute;left:29.5%;bottom:2.1%;width:40%;height:auto;container-type:inline-size;
 aspect-ratio:1100/224;z-index:5;
 filter:drop-shadow(0 4px 5px #28130699);
}
.caravan-player-stats>img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;}
.caravan-player-stats .main-menu-stat{
 position:absolute;top:27%;height:62%;
 display:flex;flex-direction:column;align-items:center;justify-content:center;
 color:#ffe9a8;text-shadow:0 2px 3px #1e0e05;
}
.caravan-player-stats .main-menu-stat.coin-stat{left:17%;width:14%;}
.caravan-player-stats .main-menu-stat.relic-stat{left:50%;width:14%;}
.caravan-player-stats .main-menu-stat.solved-stat{left:83%;width:14%;}
.caravan-player-stats .main-menu-stat small{
 font:900 clamp(7px,.65cqw,12px) Georgia,serif;letter-spacing:.025em;white-space:nowrap;
}
.caravan-player-stats .main-menu-stat strong{
 font:900 clamp(12px,1.15cqw,21px) Georgia,serif;color:#fff4c7;
}
@media(max-width:900px){
 .caravan-hub-menu-frame{right:2%;top:7%;width:25%;height:86%;}
 .caravan-hub-menu{right:4%;top:22%;width:21%;height:63%;}
 .caravan-floating-map{left:1.5%;bottom:2%;width:27%;}
 .caravan-player-stats{left:29%;width:42%;bottom:2%;}
 .caravan-player-stats .main-menu-stat small{font-size:clamp(6px,1vw,9px);}
 .caravan-player-stats .main-menu-stat strong{font-size:clamp(10px,1.6vw,15px);}
}
@media(max-width:560px){
 .caravan-hub-menu-frame{right:1%;top:8%;width:29%;height:82%;}
 .caravan-hub-menu{right:3.2%;top:23%;width:24%;height:60%;}
 .caravan-floating-map{left:1%;bottom:2%;width:29%;}
 .caravan-player-stats{left:30%;width:39%;bottom:1.5%;}
 .caravan-player-stats .main-menu-stat small{font-size:5px;}
 .caravan-player-stats .main-menu-stat strong{font-size:9px;}
}


/* Caravan Hub — local player statistics and reserved online profile area */
.player-stats-shell h2{margin:0 0 4px;font:800 28px Georgia,serif;color:#4a2b16;}
.player-stats-summary{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;margin:14px 0 20px;}
.player-stats-summary article{padding:12px 8px;text-align:center;border:1px solid #d8bd8a;border-radius:12px;background:linear-gradient(145deg,#fff5dc,#ead4a5);}
.player-stats-summary small{display:block;font-size:10px;font-weight:900;letter-spacing:.06em;text-transform:uppercase;color:#80613b;}
.player-stats-summary strong{display:block;margin-top:5px;font:800 22px Georgia,serif;color:#4b2b13;}
.player-stats-shell h3{margin:14px 0 8px;color:#4a2b16;font:700 18px Georgia,serif;}
.player-stats-table{display:grid;gap:5px;}
.player-stats-row{display:grid;grid-template-columns:1.1fr 1fr .8fr .8fr;gap:8px;align-items:center;padding:8px 10px;border:1px solid #e1cfaa;border-radius:8px;background:#fffdf7;font-size:12px;color:#59452e;}
.player-stats-row strong{color:#573517;}
.player-online-note{display:grid;gap:4px;margin-top:14px;padding:12px 14px;border:1px dashed #bd9555;border-radius:10px;background:#f8edda;color:#60492e;font-size:12px;}
.player-online-note strong{font:700 15px Georgia,serif;color:#4a2b16;}
@media(max-width:560px){
 .player-stats-summary{grid-template-columns:repeat(2,minmax(0,1fr));}
 .player-stats-row{font-size:10px;gap:4px;padding:7px 6px;}
}


/* MAIN MENU UPDATE — primary Start Game + three secondary destinations */
.main-menu-actions{
  top:19%;
  height:66%;
  justify-content:center;
  gap:1.35%;
}
.main-menu-button{
  flex:0 0 auto;
  width:100%;
  height:auto;
  aspect-ratio:1100 / 367;
  min-height:0;
}
.main-menu-button img{
  object-fit:fill;
}
.main-menu-button.primary-adventure-button{
  width:108%;
  margin-left:-4%;
  flex:0 0 auto;
}
.main-menu-button:not(.primary-adventure-button) span{
  left:25%;
  right:4%;
  font-size:clamp(12px,1.02vw,18px);
}
.main-menu-button.primary-adventure-button span{
  left:25%;
  right:4%;
  font-size:clamp(14px,1.25vw,22px);
}
.main-menu-button:disabled{
  opacity:.82;
  filter:saturate(.82) brightness(.92);
}
.main-menu-button:disabled:hover{
  transform:none;
  filter:saturate(.82) brightness(.92);
}
.main-menu-button:disabled span{
  color:#68401c;
  text-shadow:0 1px 0 #ffe9a2,1px 2px 2px #f5d078;
}
.main-menu-button:not(:disabled):focus-visible{
  outline:3px solid #fff0a8;
  outline-offset:4px;
  border-radius:12px;
}
@media(max-width:900px){
  .main-menu-actions{top:17%;height:70%;gap:1.2%;}
  .main-menu-button:not(.primary-adventure-button) span{font-size:clamp(10px,1.2vw,15px);}
}
@media(max-width:560px){
  .main-menu-actions{top:15%;height:73%;width:37%;right:1.5%;gap:1.1%;}
  .main-menu-button:not(.primary-adventure-button) span{font-size:clamp(9px,2.1vw,13px);}
  .main-menu-button.primary-adventure-button span{font-size:clamp(11px,2.3vw,15px);}
}


/* ==========================================================
   MAIN MENU — NEW REFERENCE COMPOSITION
   16:9 scene: title top-center, menu center-left, Mr. Roo right.
   ========================================================== */
.main-menu-tagline{
  left:0%;
  top:0%;
  width:30%;
  height:20%;
  aspect-ratio:auto;
  transform:rotate(-2deg);
  z-index:3;
}
.main-menu-tagline>img{
  width:100%;
  height:100%;
  object-fit:contain;
}
.main-menu-tagline>span{
  width:78%;
  margin-left:3%;
  margin-top:0;
  font-size:clamp(13px,1.9cqw,32px);
  line-height:1.08;
}
.main-menu-logo{
  left:32.5%;
  right:auto;
  top:0%;
  width:36%;
  height:33%;
  object-fit:contain;
  object-position:center top;
  z-index:3;
}
/* The replacement character is a portrait transparent WebP. */
.main-menu-roo{
  left:59.5%;
  right:auto;
  bottom:6%;
  width:auto;
  height:74%;
  max-width:38%;
  object-fit:contain;
  object-position:center bottom;
  filter:drop-shadow(0 10px 10px #24170d88);
  z-index:2;
}
/* Keep the navigation overlay full-scene so every button is placed
   against the same 1670 × 941 composition as the reference. */
.main-menu-actions{
  position:absolute;
  inset:0;
  left:0;
  right:0;
  top:0;
  width:auto;
  height:auto;
  display:block;
  gap:0;
  pointer-events:none;
  z-index:5;
}
.main-menu-actions .main-menu-button{
  position:absolute;
  flex:none;
  min-width:0;
  min-height:0;
  height:10.7%;
  width:28.2%;
  left:32.8%;
  padding:0;
  transform:none;
  pointer-events:auto;
}
.main-menu-actions .main-menu-button img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  max-width:none;
  max-height:none;
  object-fit:fill;
  object-position:center;
}
.main-menu-actions .main-menu-button span{
  left:27%;
  right:5%;
  top:50%;
  transform:translateY(-50%);
  font-size:clamp(12px,2.05cqw,34px);
  line-height:1;
  white-space:nowrap;
  text-align:center;
}
.main-menu-actions .main-menu-button.primary-adventure-button{
  left:30.4%;
  top:35.1%;
  width:32.5%;
  height:12.3%;
  flex:none;
  transform:none;
  z-index:2;
}
.main-menu-actions .main-menu-button:nth-of-type(2){top:48.3%;}
.main-menu-actions .main-menu-button:nth-of-type(3){top:59.5%;}
.main-menu-actions .main-menu-button:nth-of-type(4){top:70.8%;}
.main-menu-actions .main-menu-button.primary-adventure-button span{
  left:25%;
  right:5%;
  font-size:clamp(14px,2.45cqw,41px);
}
.main-menu-actions .continue-hint{
  position:absolute;
  left:33%;
  top:83%;
  width:28%;
  text-align:center;
  pointer-events:none;
}
.main-menu-actions .main-menu-button:disabled{
  opacity:1;
  filter:none;
  cursor:not-allowed;
}
.main-menu-actions .main-menu-button:disabled span{
  color:#51280f;
  text-shadow:0 1px 0 #ffe9a2,1px 2px 2px #f5d078;
}
/* Preserve the existing top-right utility controls. */
@media(max-width:900px){
  .main-menu-tagline{width:30%;height:19%;}
  .main-menu-roo{left:59%;height:70%;bottom:5%;max-width:40%;}
  .main-menu-actions .main-menu-button{height:10.5%;width:29%;left:32%;}
  .main-menu-actions .main-menu-button.primary-adventure-button{
    left:29.8%;width:33.5%;height:12%;
  }
  .main-menu-actions .main-menu-button span{font-size:clamp(10px,2.1cqw,24px);}
  .main-menu-actions .main-menu-button.primary-adventure-button span{font-size:clamp(11px,2.4cqw,27px);}
}
@media(max-width:560px){
  .main-menu-tagline{width:32%;height:17%;}
  .main-menu-roo{left:61%;height:58%;bottom:5%;max-width:38%;}
  .main-menu-logo{left:31%;width:39%;height:28%;}
  .main-menu-actions .main-menu-button{left:30%;width:34%;height:9.5%;}
  .main-menu-actions .main-menu-button.primary-adventure-button{
    left:27.5%;width:39%;height:10.5%;top:34%;
  }
  .main-menu-actions .main-menu-button:nth-of-type(2){top:46%;}
  .main-menu-actions .main-menu-button:nth-of-type(3){top:56.5%;}
  .main-menu-actions .main-menu-button:nth-of-type(4){top:67%;}
  .main-menu-actions .main-menu-button span{font-size:clamp(9px,2.2cqw,14px);}
  .main-menu-actions .main-menu-button.primary-adventure-button span{font-size:clamp(10px,2.4cqw,16px);}
}


/* ==========================================================
   CARAVAN HUB — CONTAINED 16:9 LAYOUT CORRECTION
   All overlays now share the exact 1672 × 941 background
   coordinate space. Letterboxing happens outside the scene,
   never underneath the floating map or menu.
   ========================================================== */
.caravan-house-page{
  position:relative;
  width:100vw;
  height:100vh;
  min-height:0;
  overflow:hidden;
  background:#090706;
}
.caravan-house-scene{
  position:absolute;
  left:50%;
  top:50%;
  width:min(100vw,177.789vh);
  height:min(100vh,56.25vw);
  transform:translate(-50%,-50%);
  overflow:hidden;
  isolation:isolate;
  background:#090706;
}
.caravan-house-background{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:fill;
  object-position:center;
}

/* Right-side menu: larger, evenly spaced and fully inside frame. */
.caravan-hub-menu-frame{
  position:absolute;
  right:1.4%;
  top:7.5%;
  width:27.2%;
  height:85%;
  z-index:3;
  pointer-events:none;
  filter:drop-shadow(0 5px 9px #0009);
}
.caravan-hub-menu-frame>img{
  display:block;
  width:100%;
  height:100%;
  object-fit:fill;
}
.caravan-hub-menu{
  position:absolute;
  right:3.35%;
  top:21.5%;
  width:22.6%;
  height:65%;
  z-index:4;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:1%;
}
.caravan-hub-menu-button{
  flex:1 1 0;
  min-height:0;
  width:100%;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:none;
}
.caravan-hub-menu-button img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  filter:drop-shadow(0 2px 3px #2a1208a8);
  transition:transform .16s ease,filter .16s ease;
}
.caravan-hub-menu-button:hover img,
.caravan-hub-menu-button:focus-visible img{
  transform:scale(1.035);
  filter:drop-shadow(0 0 8px #ffdf7d);
}
.caravan-hub-menu-button:focus-visible{
  outline:2px solid #ffe08a;
  outline-offset:2px;
  border-radius:10px;
}

/* Floating map: entire scroll and compass remain within the scene. */
.caravan-floating-map{
  position:absolute;
  left:1.8%;
  bottom:2.2%;
  width:29%;
  height:auto;
  aspect-ratio:3/2;
  z-index:5;
  padding:0;
  border:0;
  background:transparent;
  border-radius:0;
  filter:drop-shadow(0 5px 7px #26130799);
}
.caravan-floating-map img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  transition:transform .18s ease,filter .18s ease;
}
.caravan-floating-map:hover img,
.caravan-floating-map:focus-visible img{
  transform:translateY(-4px) scale(1.025);
  filter:drop-shadow(0 0 10px #ffd66b);
}
.caravan-floating-map:focus-visible{
  outline:2px solid #ffe08a;
  outline-offset:3px;
  border-radius:12px;
}

/* Player totals: larger, legible labels and values. */
.caravan-player-stats{
  position:absolute;
  left:30%;
  bottom:2.2%;
  width:40%;
  height:auto;
  container-type:inline-size;
  aspect-ratio:1100/224;
  z-index:5;
  filter:drop-shadow(0 4px 5px #28130699);
}
.caravan-player-stats>img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:contain;
}
.caravan-player-stats .main-menu-stat{
  position:absolute;
  top:22%;
  height:72%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:1.2cqw;
  color:#ffe9a8;
  text-shadow:0 2px 3px #1e0e05;
  overflow:visible;
  white-space:nowrap;
}
.caravan-player-stats .main-menu-stat.coin-stat{left:17%;width:14%;}
.caravan-player-stats .main-menu-stat.relic-stat{left:50%;width:14%;}
.caravan-player-stats .main-menu-stat.solved-stat{left:83%;width:14%;}
.caravan-player-stats .main-menu-stat small{
  display:block;
  font:900 clamp(13px,2.15cqw,21px) Georgia,serif;
  letter-spacing:.025em;
  line-height:1.05;
  white-space:nowrap;
}
.caravan-player-stats .main-menu-stat strong{
  display:block;
  font:900 clamp(20px,3.45cqw,34px) Georgia,serif;
  line-height:1;
  color:#fff4c7;
}

/* Responsive scaling is handled by the 16:9 scene itself. */
@media(max-width:900px){
  .caravan-hub-menu-frame{right:1.4%;top:7.5%;width:27.2%;height:85%;}
  .caravan-hub-menu{right:3.35%;top:21.5%;width:22.6%;height:65%;}
  .caravan-floating-map{left:1.8%;bottom:2.2%;width:29%;}
  .caravan-player-stats{left:30%;width:40%;bottom:2.2%;}
}
@media(max-width:560px){
  .caravan-hub-menu-frame{right:1.2%;top:8%;width:28%;height:83%;}
  .caravan-hub-menu{right:3.1%;top:22%;width:23%;height:63%;}
  .caravan-floating-map{left:1.5%;bottom:2%;width:28%;}
  .caravan-player-stats{left:29%;width:42%;bottom:2%;}
  .caravan-player-stats .main-menu-stat small{font-size:clamp(10px,2.15cqw,15px);}
  .caravan-player-stats .main-menu-stat strong{font-size:clamp(15px,3.4cqw,23px);}
}

/* ==========================================================================
   TARGET LAYOUT — Main Menu + Caravan Hub aligned to the reference mock-ups
   All values are percentages of the 16:9 scene (reference frame 1675 x 939).
   Delete this whole block to revert to the previous layout.
   ========================================================================== */

#homePage .main-menu-tagline{left:5.10%;top:0.21%;width:24.48%;height:21.83%;right:auto;bottom:auto; aspect-ratio:auto;transform:rotate(-2deg);}
#homePage .main-menu-tagline>img{width:100%;height:100%;object-fit:contain;}
#homePage .main-menu-logo{left:33.25%;top:0.50%;width:33.67%;height:32.80%;right:auto;bottom:auto; object-fit:contain;object-position:center;}
#homePage .main-menu-roo{left:59.78%;top:19.53%;width:35.16%;height:72.52%;right:auto;bottom:auto; max-width:none;object-fit:contain;object-position:center;}
#homePage .main-menu-actions .main-menu-button.primary-adventure-button{left:30.93%;top:35.68%;width:32.36%;height:12.03%;right:auto;bottom:auto; transform:none;margin:0;}
#homePage .main-menu-actions .main-menu-button.primary-adventure-button img{position:absolute;width:102.61%;height:143.36%;left:-1.21%;top:-20.70%;right:auto;bottom:auto;object-fit:fill!important;max-width:none;max-height:none;}
#homePage .main-menu-actions .main-menu-button.primary-adventure-button span{left:31.6%;right:12.4%;}
#homePage .main-menu-actions .main-menu-button:nth-of-type(2){left:33.91%;top:48.46%;width:26.87%;height:10.65%;right:auto;bottom:auto; transform:none;margin:0;}
#homePage .main-menu-actions .main-menu-button:nth-of-type(2) img{position:absolute;width:106.56%;height:135.32%;left:-3.38%;top:-15.28%;right:auto;bottom:auto;object-fit:fill!important;max-width:none;max-height:none;}
#homePage .main-menu-actions .main-menu-button:nth-of-type(2) span{left:35.4%;right:14.6%;}
#homePage .main-menu-actions .main-menu-button:nth-of-type(3){left:33.91%;top:59.85%;width:26.87%;height:10.44%;right:auto;bottom:auto; transform:none;margin:0;}
#homePage .main-menu-actions .main-menu-button:nth-of-type(3) img{position:absolute;width:101.29%;height:139.18%;left:-0.69%;top:-18.37%;right:auto;bottom:auto;object-fit:fill!important;max-width:none;max-height:none;}
#homePage .main-menu-actions .main-menu-button:nth-of-type(3) span{left:40.3%;right:9.7%;}
#homePage .main-menu-actions .main-menu-button:nth-of-type(4){left:33.91%;top:71.57%;width:26.87%;height:10.65%;right:auto;bottom:auto; transform:none;margin:0;}
#homePage .main-menu-actions .main-menu-button:nth-of-type(4) img{position:absolute;width:100.89%;height:119.86%;left:-0.54%;top:-7.38%;right:auto;bottom:auto;object-fit:fill!important;max-width:none;max-height:none;}
#homePage .main-menu-actions .main-menu-button:nth-of-type(4) span{left:40.3%;right:9.7%;}
#homePage .main-menu-tagline>span{font-size:clamp(13px,1.95cqw,34px);font-weight:900!important;line-height:1.1;white-space:nowrap;width:auto;margin-left:0;}
#homePage .main-menu-actions .main-menu-button span{font-weight:900!important;font-size:clamp(12px,1.95cqw,34px)!important;}
#homePage .main-menu-actions .main-menu-button.primary-adventure-button span{font-size:clamp(14px,2.5cqw,42px)!important;}
#homePage .main-menu-utility-actions{position:absolute;inset:0;width:auto;gap:0;display:block;pointer-events:none;}
#homePage .main-menu-utility-button{position:absolute;aspect-ratio:auto;pointer-events:auto;}
#homePage .main-menu-exit-button{left:93.34%;top:2.17%;width:5.55%;height:9.90%;right:auto;bottom:auto;}
#homePage .main-menu-settings-button{left:93.25%;top:12.44%;width:5.77%;height:10.29%;right:auto;bottom:auto;}
#caravanHousePage .caravan-hub-menu-frame{left:72.57%;top:5.89%;width:25.18%;height:74.41%;right:auto;bottom:auto;}
#caravanHousePage .caravan-hub-menu-frame>img{object-fit:fill;}
#caravanHousePage .caravan-hub-menu{position:absolute;inset:0;width:auto;height:auto;display:block;pointer-events:none;}
#caravanHousePage .caravan-hub-menu-button{position:absolute;flex:none;padding:0;pointer-events:auto;}
#caravanHousePage .caravan-hub-menu-button img{width:100%;height:100%;object-fit:fill;}
#caravanHousePage .caravan-hub-menu-button:nth-child(1){left:76.09%;top:17.76%;width:17.67%;height:11.35%;right:auto;bottom:auto;}
#caravanHousePage .caravan-hub-menu-button:nth-child(2){left:76.09%;top:29.29%;width:17.67%;height:10.75%;right:auto;bottom:auto;}
#caravanHousePage .caravan-hub-menu-button:nth-child(3){left:76.09%;top:40.79%;width:17.67%;height:10.23%;right:auto;bottom:auto;}
#caravanHousePage .caravan-hub-menu-button:nth-child(4){left:76.09%;top:52.14%;width:17.67%;height:9.98%;right:auto;bottom:auto;}
#caravanHousePage .caravan-hub-menu-button:nth-child(5){left:76.09%;top:63.12%;width:17.67%;height:10.51%;right:auto;bottom:auto;}
#caravanHousePage .caravan-floating-map{left:0.70%;top:61.61%;width:26.59%;height:31.63%;right:auto;bottom:auto; aspect-ratio:auto;}
#caravanHousePage .caravan-player-stats{left:27.31%;top:76.25%;width:45.37%;height:15.02%;right:auto;bottom:auto; aspect-ratio:auto;container-type:inline-size;}
#caravanHousePage .caravan-player-stats>img{object-fit:fill;}
#caravanHousePage .caravan-player-stats .main-menu-stat{top:10%;height:78%;width:22%;gap:.6cqw;}
#caravanHousePage .caravan-player-stats .main-menu-stat.coin-stat{left:16.5%;}
#caravanHousePage .caravan-player-stats .main-menu-stat.relic-stat{left:44.2%;}
#caravanHousePage .caravan-player-stats .main-menu-stat.solved-stat{left:71.8%;}
#caravanHousePage .caravan-player-stats .main-menu-stat small{font-size:3cqw;color:#f6e6b4;}
#caravanHousePage .caravan-player-stats .main-menu-stat strong{font-size:5.4cqw;color:#fffaf0;}

/* STAGE 152 — Full-screen Settings built on the supplied mock-up art (delete from here to the end to revert to the popup) */
#modalRoot .modal-backdrop.settings-backdrop{position:fixed;inset:0;width:100vw;height:100vh;height:100dvh;padding:0;display:block;overflow:hidden;background:#0b1a14;backdrop-filter:none;z-index:60}
#modalRoot .modal.settings-modal{position:absolute;inset:0;width:100%;max-width:none;height:100%;max-height:none;margin:0;padding:0;border:0;border-radius:0;background:none;box-shadow:none;overflow:hidden;animation:appear .2s ease}
#modalRoot .settings-modal .settings-page{position:absolute;inset:0;width:100%;height:100%;max-width:none;padding:0;border:0;border-radius:0;background:none;box-shadow:none;overflow:hidden;display:grid;place-items:center}
/* letterbox fill: same art, blurred, covers the leftover screen so the real scene is never stretched */
#modalRoot .settings-blur{position:absolute;inset:-4%;width:108%;height:108%;object-fit:cover;filter:blur(22px) brightness(.55) saturate(1.1);pointer-events:none}
/* the scene keeps the mock-up's exact 1672:941 ratio and is as large as fits the screen */
#modalRoot .settings-scene{position:relative;aspect-ratio:1672/941;width:min(100vw,calc(100vh * 1672 / 941));width:min(100vw,calc(100dvh * 1672 / 941));container-type:inline-size;overflow:hidden}
#modalRoot .settings-art{position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none;user-select:none}
#modalRoot .settings-modal .settings-close{position:absolute;left:81.2%;top:6%;width:4.8%;height:8.5%;border:0;border-radius:50%;background:transparent;cursor:pointer;padding:0;z-index:5}
#modalRoot .settings-modal .settings-close:hover{background:#ffffff22;box-shadow:0 0 18px #ffe08a}
#modalRoot .settings-modal .settings-close:focus-visible{outline:3px solid #fff3b0}
/* live controls sit exactly inside the parchment */
#modalRoot .settings-content{position:absolute;left:25.2%;width:52.6%;top:21.6%;height:69%;overflow-y:auto;overflow-x:hidden;padding:0 1.4cqw 0 .3cqw;font-size:1cqw;color:#3b2412;scrollbar-width:thin;scrollbar-color:#d99a22 #5b3a1c;overscroll-behavior:contain}
#modalRoot .settings-content::-webkit-scrollbar{width:1.1cqw}
#modalRoot .settings-content::-webkit-scrollbar-track{background:#5b3a1c;border-radius:1cqw;border:.15cqw solid #e9b84a}
#modalRoot .settings-content::-webkit-scrollbar-thumb{background:linear-gradient(90deg,#ffd45a,#d38a14);border-radius:1cqw;border:.12cqw solid #8a560e}
#modalRoot .settings-content .settings-section{background:transparent;border:0;box-shadow:none;border-radius:0;padding:0;margin:0 0 1.5cqw}
#modalRoot .settings-content .settings-section:first-child{padding-top:.2cqw}
/* red ribbon headings */
#modalRoot .settings-content .settings-section-heading{display:flex;align-items:center;gap:0;margin:0 0 .6cqw;position:relative}
#modalRoot .settings-content .settings-section-icon{position:relative;z-index:2;flex:0 0 3.4cqw;width:3.4cqw;height:3.4cqw;border-radius:50%;margin-right:-1.2cqw;display:grid;place-items:center;font-size:2cqw;color:#ffd45a;background:radial-gradient(circle at 35% 30%,#a8281d,#5c0f0a);border:.25cqw solid #e0a63a;box-shadow:0 .2cqw .5cqw #0006}
#modalRoot .settings-content .settings-section-heading>div{display:flex;align-items:center;gap:1.2cqw;flex:1;min-width:0;flex-wrap:nowrap}
#modalRoot .settings-content .settings-section-heading h3{margin:0;flex:0 0 auto;padding:.6cqw 3.2cqw .6cqw 2.2cqw;font:700 2cqw/1.1 Georgia,"Times New Roman",serif;color:#ffe9b0;text-shadow:0 .15cqw .2cqw #3a0b06;background:linear-gradient(#b8301f,#7d1a12);clip-path:polygon(0 0,100% 0,94% 50%,100% 100%,0 100%);box-shadow:inset 0 .12cqw #ff8b6a66}
#modalRoot .settings-content .settings-section-heading p{margin:0;font:500 1.15cqw/1.25 Georgia,serif;color:#4a3320}
/* slider rows */
#modalRoot .settings-content .settings-volume-list{display:grid;gap:.45cqw;padding:.5cqw;background:#fff7dc99;border:.15cqw solid #e1c487;border-radius:1cqw}
#modalRoot .settings-content .settings-volume-row{display:grid;grid-template-columns:minmax(0,1fr) 46% 5.4cqw;align-items:center;gap:1.4cqw;padding:.55cqw 1cqw;background:linear-gradient(90deg,#f6e3b6,#fbeecb 60%,#f6e3b6);border:.1cqw solid #e7d2a0;border-radius:1cqw;font:700 1.45cqw Georgia,serif;color:#33200f}
#modalRoot .settings-content .settings-volume-row>span{display:flex;align-items:center;gap:1.1cqw;min-width:0}
#modalRoot .settings-content .sv-ico{font-style:normal;width:2.6cqw;text-align:center;font-size:1.9cqw;color:#4a2c14}
#modalRoot .settings-content .settings-volume-row input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:1.1cqw;border-radius:1cqw;background:#6b645a;border:.12cqw solid #8a8070;outline:none;accent-color:#e9a418;cursor:pointer}
#modalRoot .settings-content .settings-volume-row input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:2.3cqw;height:2.3cqw;border-radius:50%;background:radial-gradient(circle at 35% 30%,#ffe590,#e79a12 65%,#b8700a);border:.2cqw solid #fff0b8;box-shadow:0 .2cqw .5cqw #0008}
#modalRoot .settings-content .settings-volume-row input[type=range]::-moz-range-thumb{width:2cqw;height:2cqw;border-radius:50%;background:radial-gradient(circle at 35% 30%,#ffe590,#e79a12 65%,#b8700a);border:.2cqw solid #fff0b8}
#modalRoot .settings-content .settings-volume-row input[type=range]::-moz-range-progress{background:linear-gradient(#ffd45a,#d9930f);height:1.1cqw;border-radius:1cqw}
#modalRoot .settings-content .settings-volume-row output{justify-self:end;min-width:5cqw;text-align:center;padding:.25cqw .6cqw;background:#fbefcf;border:.15cqw solid #dcc28a;border-radius:1cqw;font:700 1.35cqw Georgia,serif;color:#3b2412}
/* buttons */
#modalRoot .settings-content .settings-inline-actions{gap:1.4cqw;margin-top:.9cqw;justify-content:flex-end}
#modalRoot .settings-content button{font:800 1.35cqw Georgia,serif;padding:.7cqw 1.8cqw;border-radius:.9cqw;border:.2cqw solid #a8670e;background:linear-gradient(#ffdd7a,#e9a521 55%,#cf8a12);color:#4a2808;box-shadow:0 .3cqw .5cqw #0004,inset 0 .15cqw #fff3b8;cursor:pointer}
#modalRoot .settings-content button:hover{filter:brightness(1.08)}
#modalRoot .settings-content button.settings-danger{background:linear-gradient(#b8301f,#7d1a12);border-color:#5a0f09;color:#ffe9b0;text-shadow:0 .1cqw .15cqw #2b0603}
/* action rows */
#modalRoot .settings-content .settings-action-row{padding:.7cqw 1cqw;border:.1cqw solid #e7d2a0;border-top-width:.1cqw;border-radius:1cqw;margin:.45cqw 0;background:linear-gradient(90deg,#f6e3b6,#fbeecb 60%,#f6e3b6)}
#modalRoot .settings-content .settings-action-row strong,#modalRoot .settings-content .settings-dev-toggle strong,#modalRoot .settings-content .settings-dev-seed>strong{font:700 1.5cqw Georgia,serif;color:#33200f}
#modalRoot .settings-content .settings-action-row small,#modalRoot .settings-content .settings-dev-toggle small{font:500 1.05cqw/1.3 Georgia,serif;color:#4a3320}
#modalRoot .settings-content .settings-dev-toggle{padding:.8cqw 1cqw;border-radius:1cqw;border:.1cqw solid #e7d2a0;background:linear-gradient(90deg,#f6e3b6,#fbeecb 60%,#f6e3b6);margin:.45cqw 0}
#modalRoot .settings-content .settings-dev-toggle input{width:2.6cqw;height:2.6cqw;flex:0 0 2.6cqw;accent-color:#e9a418}
#modalRoot .settings-content .settings-dev-seed{padding:.9cqw 1cqw;border-radius:1cqw;background:#fbefcf;border:.1cqw solid #e1c487}
#modalRoot .settings-content .settings-dev-seed>p,#modalRoot .settings-content .settings-dev-note{font:500 1.05cqw/1.4 Georgia,serif;color:#4a3320}
#modalRoot .settings-content .settings-dev-seed-controls label{font:700 1.1cqw Georgia,serif;color:#4a3320}
#modalRoot .settings-content .settings-dev-seed-controls select,#modalRoot .settings-content .settings-dev-seed-controls input{font:600 1.2cqw Georgia,serif;padding:.6cqw .8cqw;border-radius:.6cqw}
#modalRoot .settings-content button.settings-dev-seed-button{width:100%}
#modalRoot .settings-content .settings-footer{display:flex;align-items:center;justify-content:space-between;margin:1cqw 0 .5cqw;font:italic 1.05cqw Georgia,serif;color:#5a4128}
#modalRoot .settings-content button.settings-done{min-width:9cqw}
/* narrow phones in portrait: the whole scene would be tiny, so fall back to a plain full-screen sheet over the art */
@media(max-aspect-ratio:1/1){
 #modalRoot .settings-scene{width:100vw;height:100dvh;aspect-ratio:auto;container-type:inline-size}
 #modalRoot .settings-art{object-fit:cover;object-position:50% 20%;filter:brightness(.6)}
 #modalRoot .settings-content{left:3%;width:94%;top:12%;height:84%;font-size:2.6cqw;background:#f7e5b8ee;border-radius:3cqw;padding:3cqw;border:.6cqw solid #9b6b32}
 #modalRoot .settings-modal .settings-close{left:auto;right:3%;top:2%;width:11cqw;height:11cqw;background:radial-gradient(circle at 35% 30%,#e0503f,#a21f18 70%);border:.8cqw solid #f2c96a}
 #modalRoot .settings-modal .settings-close:after{content:"✕";color:#fff3d6;font-size:6cqw;font-weight:900}
}

#modalRoot .settings-modal .settings-page .settings-content button:not(.settings-close){font:800 1.35cqw Georgia,serif;padding:.7cqw 1.8cqw;border-radius:.9cqw;border:.2cqw solid #a8670e;background:linear-gradient(#ffdd7a,#e9a521 55%,#cf8a12);color:#4a2808;box-shadow:0 .3cqw .5cqw #0004,inset 0 .15cqw #fff3b8}
#modalRoot .settings-modal .settings-page .settings-content button.settings-danger{background:linear-gradient(#b8301f,#7d1a12);border-color:#5a0f09;color:#ffe9b0}
#modalRoot .settings-modal .settings-page .settings-content button.settings-done{background:linear-gradient(#ffdd7a,#e9a521 55%,#cf8a12);color:#4a2808}
#modalRoot .settings-content .settings-volume-row input[type=range]{background:linear-gradient(90deg,#ffc928 var(--p,50%),#6b645a var(--p,50%))}
#modalRoot .settings-content .settings-volume-row{grid-template-columns:minmax(0,1fr) 42% 5.4cqw;font-size:1.35cqw;padding:.4cqw 1cqw}
#modalRoot .settings-content .settings-volume-row>span{white-space:nowrap}
#modalRoot .settings-content .settings-action-row strong{font-size:1.4cqw}

/* STAGE 153 — the three buttons under Start Game share one size, one art scale and even spacing (delete this block to revert) */
#homePage .main-menu-actions .main-menu-button:nth-of-type(2),
#homePage .main-menu-actions .main-menu-button:nth-of-type(3),
#homePage .main-menu-actions .main-menu-button:nth-of-type(4){left:33.91%;width:26.87%;height:10.6%;right:auto;bottom:auto;transform:none;margin:0}
#homePage .main-menu-actions .main-menu-button:nth-of-type(2){top:48.4%}
#homePage .main-menu-actions .main-menu-button:nth-of-type(3){top:59.9%}
#homePage .main-menu-actions .main-menu-button:nth-of-type(4){top:71.4%}
#homePage .main-menu-actions .main-menu-button:nth-of-type(2) img,
#homePage .main-menu-actions .main-menu-button:nth-of-type(3) img,
#homePage .main-menu-actions .main-menu-button:nth-of-type(4) img{position:absolute;width:106.56%;height:135.32%;left:-3.38%;top:-15.28%;right:auto;bottom:auto;object-fit:fill!important;max-width:none;max-height:none}
#homePage .main-menu-actions .main-menu-button:nth-of-type(2) span,
#homePage .main-menu-actions .main-menu-button:nth-of-type(3) span,
#homePage .main-menu-actions .main-menu-button:nth-of-type(4) span{left:40%;right:8%}

/* STAGE 154 — Mr. Roo's Caravan House moved to the spot shown in the supplied map screenshot; floating Treasure Vault icon removed from the map (delete this block to revert the caravan position) */
#mapPage .map-caravan-house,
#mapPage .map-caravan-house:hover{left:27.15%;top:66.5%;width:19.2%;height:21.8%;right:auto;bottom:auto;display:block}
#mapPage .map-caravan-house img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
#mapPage .map-caravan-house span{display:none}
@media(max-width:700px){#mapPage .map-caravan-house{left:27.15%;top:66.5%;width:19.2%;height:21.8%}}
.map-vault{display:none!important}

/* STAGE 155 — "Your Vault Treasures" ribbon: the old rule pointed at a missing file (1Vault_Treasures_Ribbon.webp). Uses the tightly cropped supplied art at its natural 7.2:1 ratio, centred directly under the laurel/collection panel (delete this block to revert) */
#chestLayer .vault-shell .vault-treasures-ribbon{
  left:37.1%;top:53.6%;width:25.8%;height:6.4%;z-index:5;
  background:url("../assets/vault_ui/Vault_Treasures_Ribbon_Cropped.webp") center/contain no-repeat;
  filter:drop-shadow(0 .25cqw .3cqw #3b1a0a66);
}
#chestLayer .vault-shell .vault-treasures-ribbon::before,
#chestLayer .vault-shell .vault-treasures-ribbon::after{display:none}

/* ==========================================================================
   STAGE 158 — Player Profile, sprite-based layout matched to the reference mock-ups
   Art: assets/player_profile/ui/*.webp (sliced from the supplied icon / button sheets).
   Sizes are in em: 1em = 1.75cqw of .pf-content. Delete from here to the end to remove the profile styling.
   Content rectangle (left/top/width/height of .pf-content) is the only thing tied to the scene art.
   ========================================================================== */
#modalRoot .profile-page{--pf-ink:#47260c;--pf-edge:#c9974a}
#modalRoot .profile-page .pf-heading{position:absolute;left:31.5cqw;top:3.4cqw;width:37cqw;height:7.2cqw;margin:0;display:flex;align-items:center;justify-content:center;pointer-events:none;z-index:3}
#modalRoot .profile-page .pf-heading img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;filter:drop-shadow(0 .3cqw .4cqw #0006)}
#modalRoot .profile-page .pf-heading span{position:relative;top:-.15cqw;font:900 3.7cqw/1 Georgia,"Times New Roman",serif;color:#4a2208;text-shadow:0 .12cqw 0 #ffe9a8aa,0 .3cqw .5cqw #5a350f55;white-space:nowrap}
#modalRoot .profile-page button.pf-close{position:absolute;left:81.1cqw;top:3.3cqw;width:4.4cqw;height:4.4cqw;padding:0;border-radius:50%;border:.35cqw solid #f2c96a;background:radial-gradient(circle at 35% 30%,#e0503f,#a21f18 70%);color:#fff3d6;font:900 2.3cqw/1 Georgia,serif;cursor:pointer;z-index:6;box-shadow:0 .3cqw .7cqw #0008,inset 0 .15cqw #ff9a86aa;display:grid;place-items:center}
#modalRoot .profile-page button.pf-close:hover{filter:brightness(1.12)}
#modalRoot .profile-page button.pf-close:focus-visible{outline:.3cqw solid #fff3b0}
#modalRoot .profile-page .pf-content{position:absolute;left:23.9%;width:55%;top:21.3%;height:70%;container-type:inline-size;overflow-x:hidden;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#d99a22 #5b3a1c;z-index:2}
#modalRoot .profile-page .pf-root{font:500 1.75cqw/1.2 Georgia,"Times New Roman",serif;color:#3b2412;height:100%;display:flex;flex-direction:column;gap:.6em}
#modalRoot .profile-page .pf-root *{box-sizing:border-box}
#modalRoot .profile-page .pf-root h3,#modalRoot .profile-page .pf-root h4,#modalRoot .profile-page .pf-root p{margin:0;font-family:Georgia,"Times New Roman",serif}
#modalRoot .profile-page .pf-img{display:block;max-width:100%;max-height:100%;object-fit:contain;user-select:none;-webkit-user-drag:none}

/* shared parchment cards */
#modalRoot .profile-page .pf-id,#modalRoot .profile-page .pf-overall,#modalRoot .profile-page .pf-chip,#modalRoot .profile-page .pf-panel,#modalRoot .profile-page .pf-note,#modalRoot .profile-page .pf-records{background:linear-gradient(rgba(255,244,208,.78),rgba(243,215,148,.72));border:.12em solid var(--pf-edge);border-radius:1em;box-shadow:inset 0 0 0 .08em #fff3cdaa,0 .1em .3em #4a2a0a45}
#modalRoot .profile-page .pf-bar{display:block;height:.85em;border-radius:1em;background:linear-gradient(#a99068,#c9b183);border:.1em solid #d29a16;overflow:hidden;box-shadow:0 0 0 .07em #5a3a0e,inset 0 .12em .2em #0005}
#modalRoot .profile-page .pf-bar>i{display:block;height:100%;border-radius:1em;background:linear-gradient(#a6f46a 0,#3fc026 45%,#1f8a10 100%);box-shadow:inset 0 .12em #e6ffc8aa}

/* header */
#modalRoot .profile-page .pf-top{display:grid;grid-template-columns:1fr;gap:.7em;height:auto;flex:none}
#modalRoot .profile-page .pf-id{display:flex;flex-direction:column;align-items:center;gap:.8em;padding:.6em 1em;overflow:visible}
#modalRoot .profile-page .pf-avatar{position:relative;isolation:isolate;flex:none;width:21.3em;height:19.65em;margin:0;filter:drop-shadow(0 .14em .2em #0008)}
#modalRoot .profile-page .pf-avatar .pf-avatar-portrait-window{position:absolute;z-index:1;left:18.5%;top:13.5%;width:63%;height:67%;overflow:hidden;border-radius:50%;clip-path:circle(49% at 50% 50%)}
#modalRoot .profile-page .pf-avatar .pf-avatar-portrait{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center;transform:scale(1.22)}
#modalRoot .profile-page .pf-avatar .pf-avatar-frame{position:absolute;z-index:2;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none}
#modalRoot .profile-page .pf-avatar-change-badge{z-index:3}
#modalRoot .profile-page .pf-id-text{display:flex;flex-direction:column;align-items:center;gap:.3em;min-width:0;width:100%;flex:none}
#modalRoot .profile-page .pf-name-row{display:flex;align-items:center;gap:.5em;max-width:100%}
#modalRoot .profile-page #pfName{font-weight:900;font-size:2.05em;line-height:1.05;color:var(--pf-ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:0 .05em 0 #fff3c9}
#modalRoot .profile-page input.pf-name-input{font:900 .95em Georgia,serif;width:9.5em;color:var(--pf-ink);background:#fff8e2;border:.1em solid #a8670e;border-radius:.4em;padding:.05em .3em;outline:none}
#modalRoot .profile-page button.pf-edit{flex:none;width:1.8em;height:1.8em;padding:0;border:0;background:none;cursor:pointer;filter:drop-shadow(0 .08em .1em #0006)}
#modalRoot .profile-page button.pf-edit img{width:100%;height:100%}
#modalRoot .profile-page button.pf-edit:hover{filter:brightness(1.12) drop-shadow(0 .08em .1em #0006)}
#modalRoot .profile-page .pf-rank span{display:inline-block;padding:.22em 1.3em;border-radius:1em;background:linear-gradient(#7b441a,#52290e);border:.1em solid #2e1707;color:#fff0cf;font-weight:800;font-size:1.1em;white-space:nowrap;box-shadow:inset 0 .1em #c89a5e66}
#modalRoot .profile-page .pf-rank span::before{content:"❦ ";color:#e9b84a}#modalRoot .profile-page .pf-rank span::after{content:" ❦";color:#e9b84a}
#modalRoot .profile-page .pf-overall{display:flex;align-items:center;gap:.6em;padding:.3em .9em .3em .6em}
#modalRoot .profile-page .pf-overall-ico{flex:none;width:4.2em;height:4.2em;filter:drop-shadow(0 .08em .1em #0005)}
#modalRoot .profile-page .pf-overall-ico img{width:100%;height:100%}
#modalRoot .profile-page .pf-overall>div{flex:1;min-width:0;display:flex;flex-direction:column;gap:.3em}
#modalRoot .profile-page .pf-overall h4{font-weight:900;font-size:1.35em;text-align:center;color:var(--pf-ink)}
#modalRoot .profile-page .pf-overall .pf-bar{height:1em}
#modalRoot .profile-page .pf-overall p{font-weight:800;font-size:1.05em;text-align:center;color:var(--pf-ink)}

/* stat chips */
#modalRoot .profile-page .pf-chips{display:grid;grid-template-columns:repeat(6,1fr);gap:.5em;height:4.2em;flex:none}
#modalRoot .profile-page .pf-chip{display:flex;align-items:center;justify-content:center;gap:.35em;padding:.2em .35em;min-width:0;border-radius:.9em}
#modalRoot .profile-page .pf-chip-ico{flex:none;width:2.6em;height:2.9em;display:grid;place-items:center;filter:drop-shadow(0 .06em .08em #0005)}
#modalRoot .profile-page .pf-chip-ico img{width:100%;height:100%}
#modalRoot .profile-page .pf-chip-txt{display:flex;flex-direction:column;min-width:0}
#modalRoot .profile-page .pf-chip-txt strong{font-weight:900;font-size:1.45em;line-height:1.05;color:#3a1f08}
#modalRoot .profile-page .pf-chip-txt small{font-weight:800;font-size:.85em;color:#4b2d12;white-space:nowrap}

/* tabs (sprite buttons) */
#modalRoot .profile-page .pf-tabs{display:flex;gap:.1em;height:3.4em;flex:none;align-items:stretch}
#modalRoot .profile-page button.pf-tab{position:relative;flex:1 1 0;min-width:0;padding:0;border:0;background:none;cursor:pointer;filter:drop-shadow(0 .12em .2em #0006)}
#modalRoot .profile-page button.pf-tab img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none}
#modalRoot .profile-page button.pf-tab .on{display:none}
#modalRoot .profile-page button.pf-tab.is-active .on{display:block}
#modalRoot .profile-page button.pf-tab.is-active .off{display:none}
#modalRoot .profile-page button.pf-tab:hover:not(.is-active){filter:brightness(1.15) drop-shadow(0 .12em .2em #0006)}
#modalRoot .profile-page button.pf-tab:focus-visible{outline:.2em solid #fff3b0;outline-offset:.1em;border-radius:.6em}

/* body + panel titles (banner sprite, 3-slice) */
#modalRoot .profile-page .pf-body-host{flex:1 1 0;min-height:19em}
#modalRoot .profile-page .pf-body{height:100%;display:grid;gap:.6em;min-height:0}
#modalRoot .profile-page .pf-panel{display:flex;flex-direction:column;min-height:0;padding:.4em .6em .6em}
#modalRoot .profile-page h4.pf-title{flex:none;align-self:center;min-width:62%;max-width:100%;text-align:center;font-weight:900;font-size:1.3em;line-height:1;color:var(--pf-ink);margin:-.1em 0 .35em;padding:.55em 2.6em .6em;border:solid transparent;border-width:0 3.3em;border-image:url("../assets/player_profile/ui/banner_a.webp") 0 105 0 105 fill/0 2.3em 0 2.3em stretch;text-shadow:0 .05em 0 #fff3c9;white-space:nowrap}
#modalRoot .profile-page h4.pf-title span{display:block;margin:0 -2.6em}

/* OVERVIEW */
#modalRoot .profile-page .pf-body--overview{grid-template-columns:1.1fr 1fr}
#modalRoot .profile-page .pf-tiles{flex:1;min-height:0;display:grid;grid-template-columns:repeat(4,1fr);grid-template-rows:1fr 1fr;gap:.45em}
#modalRoot .profile-page .pf-tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.05em;padding:.3em .15em;border-radius:.8em;border:.1em solid #d7ac5f;background:linear-gradient(rgba(255,248,222,.85),rgba(240,216,157,.8));box-shadow:inset 0 .08em #fff7de;text-align:center;min-width:0;min-height:0}
/* STAGE 159 FIX: keep each summary icon in its own reserved row.
   The image is explicitly kept in normal flow so it cannot cover the label/value. */
#modalRoot .profile-page .pf-tile-ico{
  position:relative;
  display:flex;
  flex:0 0 2.15em;
  align-items:center;
  justify-content:center;
  width:100%;
  min-height:2.15em;
  overflow:hidden;
  filter:drop-shadow(0 .06em .06em #0004);
}
#modalRoot .profile-page .pf-tile-ico img{
  position:static;
  inset:auto;
  display:block;
  flex:none;
  width:auto;
  height:100%;
  max-width:86%;
  max-height:100%;
  object-fit:contain;
}
#modalRoot .profile-page .pf-tile small{
  position:relative;
  z-index:1;
  display:block;
  flex:0 0 auto;
  font-weight:800;
  font-size:.84em;
  line-height:1.08;
  color:#4b2d12;
}
#modalRoot .profile-page .pf-tile strong{
  position:relative;
  z-index:1;
  display:block;
  flex:0 0 auto;
  font-weight:900;
  font-size:1.75em;
  line-height:1.1;
  color:#3a1f08;
}
#modalRoot .profile-page .pf-learn-list{flex:1;min-height:0;display:grid;grid-template-rows:repeat(7,1fr);padding:.15em .4em;border-radius:.8em;background:rgba(255,246,217,.55);border:.09em solid #e0c487}
#modalRoot .profile-page .pf-learn-row{display:grid;grid-template-columns:2em 9.6em 1fr 4.2em;align-items:center;gap:.5em;border-bottom:.07em solid #e0c48788;min-height:0}
#modalRoot .profile-page .pf-learn-row:last-child{border-bottom:0}
#modalRoot .profile-page .pf-learn-ico{width:2em;height:1.7em;display:grid;place-items:center;filter:drop-shadow(0 .04em .05em #0004)}
#modalRoot .profile-page .pf-learn-ico img{width:100%;height:100%}
#modalRoot .profile-page .pf-learn-name{font-weight:800;font-size:.98em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#modalRoot .profile-page .pf-learn-n{font-weight:800;font-size:.92em;text-align:right;white-space:nowrap}
#modalRoot .profile-page .pf-learn .pf-bar{height:.7em}

/* PROGRESS */
#modalRoot .profile-page .pf-body--progress{grid-template-columns:1.62fr 1fr;grid-template-rows:1fr auto}
#modalRoot .profile-page .pf-temple-grid{flex:1;min-height:0;display:grid;grid-template-columns:repeat(4,1fr);gap:.4em}
#modalRoot .profile-page .pf-temple{display:flex;flex-direction:column;align-items:center;gap:.2em;padding:.25em .25em .35em;min-width:0;min-height:0;border-radius:1em;border:.12em solid #d7a24a;background:linear-gradient(rgba(255,248,222,.85),rgba(240,216,157,.8));box-shadow:inset 0 .08em #fff7de;text-align:center}
#modalRoot .profile-page .pf-temple-pic{position:relative;flex:1;min-height:0;width:100%;border-radius:.8em;overflow:hidden;background:linear-gradient(#bfe2f7,#f3e2b0)}
#modalRoot .profile-page .pf-temple-pic>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 20%;display:block}
#modalRoot .profile-page .pf-temple-name{position:absolute;left:.15em;right:.15em;bottom:.15em;padding:.22em .1em .28em;border-radius:.7em .7em .5em .5em;border:.09em solid #b07c28;background:linear-gradient(#fbe7a8,#e8bb5c);font-weight:900;font-size:.82em;line-height:1.08;color:#3f2108;box-shadow:0 .1em .2em #0005}
#modalRoot .profile-page .pf-diff{display:inline-block;min-width:4.2em;padding:.04em .9em;border-radius:1em;font-weight:900;font-size:.95em;color:#fff;border:.1em solid rgba(0,0,0,.35);text-shadow:0 .06em .1em #0007;box-shadow:inset 0 .1em #ffffff55}
#modalRoot .profile-page .pf-lv-easy .pf-diff{background:linear-gradient(#52c443,#23800f)}
#modalRoot .profile-page .pf-lv-medium .pf-diff{background:linear-gradient(#4a9af0,#1a56b8)}
#modalRoot .profile-page .pf-lv-hard .pf-diff{background:linear-gradient(#a56cf0,#6226b8)}
#modalRoot .profile-page .pf-lv-expert .pf-diff{background:linear-gradient(#f0594a,#b0150d)}
#modalRoot .profile-page .pf-temple-count{font-weight:800;font-size:.95em}
#modalRoot .profile-page .pf-temple .pf-bar{width:92%;height:.65em;flex:none}
#modalRoot .profile-page .pf-temple-pct{font-weight:900;font-size:1.2em;line-height:1}
#modalRoot .profile-page .pf-temple-stars{display:flex;align-items:center;gap:.25em;font-weight:800;font-size:.9em;white-space:nowrap}
#modalRoot .profile-page .pf-temple-stars img{height:1.2em;width:auto}
#modalRoot .profile-page .pf-adv-list{flex:1;min-height:0;display:grid;grid-template-rows:repeat(6,1fr);padding:.15em .4em;border-radius:.8em;background:rgba(255,246,217,.55);border:.09em solid #e0c487}
#modalRoot .profile-page .pf-adv-row{display:grid;grid-template-columns:2.2em 1fr;align-items:center;gap:.5em;border-bottom:.07em solid #e0c48788;min-height:0}
#modalRoot .profile-page .pf-adv-row:last-child{border-bottom:0}
#modalRoot .profile-page .pf-adv-ico{width:2.1em;height:1.9em;display:grid;place-items:center;filter:drop-shadow(0 .05em .06em #0004)}
#modalRoot .profile-page .pf-adv-ico img{width:100%;height:100%}
#modalRoot .profile-page .pf-adv-main{min-width:0;display:flex;flex-direction:column;gap:.15em}
#modalRoot .profile-page .pf-adv-line{display:flex;justify-content:space-between;gap:.4em;font-size:.92em;font-weight:800;white-space:nowrap}
#modalRoot .profile-page .pf-adv-line b{font-weight:900}
#modalRoot .profile-page .pf-adv-main .pf-bar{height:.55em}
#modalRoot .profile-page .pf-tiers{display:flex;gap:.9em;align-items:center}
#modalRoot .profile-page .pf-tier{display:inline-flex;align-items:center;gap:.25em;font-weight:900;font-size:.92em}
#modalRoot .profile-page .pf-tier img{height:1.35em;width:auto;filter:drop-shadow(0 .05em .05em #0005)}
#modalRoot .profile-page .pf-note{grid-column:1/-1;display:flex;align-items:center;gap:.6em;padding:.25em .9em;font-weight:700;font-size:.9em;border-radius:.8em}
#modalRoot .profile-page .pf-note span{flex:none;width:2.1em;height:1.7em;display:grid;place-items:center}
#modalRoot .profile-page .pf-note span img{width:100%;height:100%}

/* PERFORMANCE */
#modalRoot .profile-page .pf-body--performance{grid-template-columns:1.1fr 1fr;grid-template-rows:1fr auto}
#modalRoot .profile-page .pf-gameplay-inner{flex:1;min-height:0;display:grid;grid-template-columns:8.6em 1fr;gap:.5em;align-items:stretch}
#modalRoot .profile-page .pf-trophy{display:flex;align-items:center;justify-content:center;min-height:0}
#modalRoot .profile-page .pf-emblem{position:relative;width:8.6em;height:9.4em}
#modalRoot .profile-page .pf-emblem .pf-emblem-laurel{position:absolute;left:0;top:0;width:100%;height:78%;object-fit:contain;filter:drop-shadow(0 .08em .1em #0004)}
#modalRoot .profile-page .pf-emblem .pf-emblem-cup{position:absolute;left:25%;top:9%;width:50%;height:48%;object-fit:contain;filter:drop-shadow(0 .1em .12em #0005)}
#modalRoot .profile-page .pf-ribbon{position:absolute;left:-4%;right:-4%;bottom:0;height:42%}
#modalRoot .profile-page .pf-ribbon img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;max-width:none;max-height:none;filter:drop-shadow(0 .1em .12em #0005)}
#modalRoot .profile-page .pf-ribbon>span{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#fff;text-shadow:0 .07em .1em #3a0805;line-height:1.02;padding-top:.15em}
#modalRoot .profile-page .pf-ribbon small{font-weight:800;font-size:.95em}
#modalRoot .profile-page .pf-ribbon strong{font-weight:900;font-size:1.65em}
#modalRoot .profile-page .pf-ribbon strong.pf-ribbon-sm{font-size:1em;letter-spacing:.01em}
#modalRoot .profile-page .pf-stat-list{display:grid;grid-template-rows:repeat(6,1fr);padding:.15em .5em;border-radius:.8em;background:rgba(255,246,217,.55);border:.09em solid #e0c487;min-height:0}
#modalRoot .profile-page .pf-stat{display:grid;grid-template-columns:2em 1fr auto;align-items:center;gap:.5em;border-bottom:.07em solid #e0c48788;min-height:0}
#modalRoot .profile-page .pf-stat:last-child{border-bottom:0}
#modalRoot .profile-page .pf-stat-ico{width:2em;height:1.5em;display:grid;place-items:center;filter:drop-shadow(0 .04em .05em #0004)}
#modalRoot .profile-page .pf-stat-ico img{width:100%;height:100%}
#modalRoot .profile-page .pf-stat-label{font-weight:800;font-size:.92em;line-height:1.05}
#modalRoot .profile-page .pf-stat b{font-weight:900;font-size:1.2em}
#modalRoot .profile-page .pf-right-col{display:grid;grid-template-rows:auto 1fr;gap:.6em;min-height:0}
#modalRoot .profile-page .pf-star-row{display:grid;grid-template-columns:repeat(5,1fr);gap:.35em}
#modalRoot .profile-page .pf-star{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.1em;padding:.25em .1em;border-radius:.7em;border:.1em solid #d7ac5f;background:linear-gradient(rgba(255,248,222,.85),rgba(240,216,157,.8));min-width:0}
#modalRoot .profile-page .pf-star img{height:1.05em;width:auto;max-width:92%}
#modalRoot .profile-page .pf-star b{font-weight:900;font-size:1.5em;line-height:1.1}
#modalRoot .profile-page .pf-use-list{flex:1;min-height:0;display:grid;grid-template-rows:repeat(3,1fr);padding:.15em .5em;border-radius:.8em;background:rgba(255,246,217,.55);border:.09em solid #e0c487}
#modalRoot .profile-page .pf-use{display:grid;grid-template-columns:2em 1fr auto;align-items:center;gap:.5em;border-bottom:.07em solid #e0c48788;min-height:0}
#modalRoot .profile-page .pf-use:last-child{border-bottom:0}
#modalRoot .profile-page .pf-use-ico{width:2em;height:1.8em;display:grid;place-items:center}
#modalRoot .profile-page .pf-use-ico img{width:100%;height:100%}
#modalRoot .profile-page .pf-use-label{font-weight:800;font-size:.92em;line-height:1.1}
#modalRoot .profile-page .pf-use-label small{display:block;font-weight:600;font-size:.7em;color:#5a4128}
#modalRoot .profile-page .pf-use b{font-weight:900;font-size:1em;white-space:nowrap}
#modalRoot .profile-page .pf-records{grid-column:1/-1;display:grid;grid-template-columns:1fr repeat(4,1.35fr);gap:.5em;align-items:center;padding:.3em .7em;height:4.2em}
#modalRoot .profile-page .pf-records-title{display:flex;align-items:center;gap:.4em;font-weight:900;font-size:1.25em;line-height:1;color:var(--pf-ink)}
#modalRoot .profile-page .pf-records-title img{height:2.3em;width:auto}
#modalRoot .profile-page .pf-record{display:flex;align-items:center;gap:.5em;padding-left:.6em;border-left:.1em solid #c79a4e;min-width:0}
#modalRoot .profile-page .pf-record>img{height:2.3em;width:auto;flex:none}
#modalRoot .profile-page .pf-record small{display:block;font-weight:800;font-size:.9em;white-space:nowrap}
#modalRoot .profile-page .pf-record b{display:block;font-weight:900;font-size:1.2em;white-space:nowrap;line-height:1.1}

/* COLLECTIONS */
#modalRoot .profile-page .pf-body--collections{grid-template-columns:.78fr 1.25fr 1.25fr;grid-template-rows:1fr 1fr;grid-template-areas:"book relics vault" "book perks summary"}
#modalRoot .profile-page .pf-collection-book{grid-area:book}#modalRoot .profile-page .pf-collection-relics{grid-area:relics}#modalRoot .profile-page .pf-collection-vault{grid-area:vault}#modalRoot .profile-page .pf-collection-perks{grid-area:perks}#modalRoot .profile-page .pf-collection-summary{grid-area:summary}
#modalRoot .profile-page .pf-body--collections h4.pf-title{font-size:1.12em;min-width:70%}
#modalRoot .profile-page .pf-collection-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:.3em;flex:1;min-height:0}
#modalRoot .profile-page .pf-ctile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.05em;min-width:0;min-height:0;padding:.2em .1em;border:.09em solid #d7ac5f;border-radius:.7em;background:linear-gradient(rgba(255,248,222,.85),rgba(240,216,157,.8));font-size:.82em;text-align:center}
#modalRoot .profile-page .pf-ctile img{height:2.9em;width:auto;max-width:90%;filter:drop-shadow(0 .06em .08em #0005)}
#modalRoot .profile-page .pf-ctile span{font-weight:800;white-space:nowrap}
#modalRoot .profile-page .pf-ctile b{font-size:1.3em;font-weight:900;line-height:1}
#modalRoot .profile-page .pf-perk-common img{filter:grayscale(1) brightness(1.1) drop-shadow(0 .06em .08em #0005)}
#modalRoot .profile-page .pf-perk-rare img{filter:hue-rotate(-95deg) saturate(1.3) drop-shadow(0 .06em .08em #0005)}
#modalRoot .profile-page .pf-perk-legendary img{filter:hue-rotate(95deg) saturate(1.5) brightness(1.15) drop-shadow(0 .06em .08em #0005)}
#modalRoot .profile-page .pf-collection-total{display:flex;justify-content:center;align-items:center;gap:.6em;padding:.3em .3em 0;margin-top:.3em;font-size:.88em;font-weight:800;flex-wrap:wrap}
#modalRoot .profile-page .pf-collection-total b{font-size:1.1em}
#modalRoot .profile-page .pf-book-feature{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:space-between;gap:.25em;text-align:center}
#modalRoot .profile-page .pf-book-art{flex:1;min-height:0;width:86%;object-fit:contain;filter:drop-shadow(0 .12em .18em #0005)}
#modalRoot .profile-page .pf-book-feature strong{font-size:1.4em;font-weight:900;line-height:1}
#modalRoot .profile-page .pf-book-feature>span{font-size:.85em;font-weight:800}
#modalRoot .profile-page .pf-book-feature .pf-bar{width:92%;height:.7em;flex:none}
#modalRoot .profile-page .pf-purple{padding:.28em 1.3em;border:.12em solid #3d1148;border-radius:.9em;background:linear-gradient(#c05ad6,#7a2590 55%,#5d1a70);color:#fff4d2;font:900 .95em Georgia,serif;text-shadow:0 .07em .1em #270d2e;box-shadow:inset 0 .1em #ffffff66,0 0 0 .1em #d9a62c,0 .12em .2em #0005;cursor:pointer}
#modalRoot .profile-page .pf-purple.pf-small{font-size:.85em;padding:.15em .9em}
#modalRoot .profile-page .pf-purple:hover{filter:brightness(1.12)}
#modalRoot .profile-page .pf-sum-list{flex:1;min-height:0;display:grid;grid-template-rows:repeat(4,1fr);padding:.1em .4em;border-radius:.8em;background:rgba(255,246,217,.55);border:.09em solid #e0c487}
#modalRoot .profile-page .pf-sum-row{display:grid;grid-template-columns:1.6em 1fr auto;align-items:center;gap:.4em;font-size:.9em;font-weight:800;border-bottom:.07em solid #e0c48788;min-height:0}
#modalRoot .profile-page .pf-sum-row:last-child{border-bottom:0}
#modalRoot .profile-page .pf-sum-row img{height:1.3em;width:auto}

/* ACHIEVEMENTS */
#modalRoot .profile-page .pf-body--achievements{grid-template-columns:.62fr 2.1fr;grid-template-rows:1.55fr 1fr;grid-template-areas:"sum list" "sum cats"}
#modalRoot .profile-page .pf-ach-summary{grid-area:sum;align-items:center;justify-content:center;gap:.35em;text-align:center}
#modalRoot .profile-page .pf-ach-list{grid-area:list}#modalRoot .profile-page .pf-ach-cats{grid-area:cats}
#modalRoot .profile-page .pf-emblem--ach{width:100%;max-width:10em;height:10.5em;flex:none}
#modalRoot .profile-page .pf-ach-count{font-size:1.9em;font-weight:900;line-height:1}
#modalRoot .profile-page .pf-ach-sub{font-size:.95em;font-weight:800}
#modalRoot .profile-page .pf-ach-summary .pf-bar{width:92%;height:.8em}
#modalRoot .profile-page .pf-achievement-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:.4em;flex:1;min-height:0}
#modalRoot .profile-page .pf-achievement{display:flex;flex-direction:column;align-items:center;gap:.12em;min-width:0;min-height:0;padding:.25em .25em .35em;border:.12em solid #d7a24a;border-radius:.9em;background:linear-gradient(rgba(255,248,222,.88),rgba(240,216,157,.82));box-shadow:inset 0 .08em #fff8e4;text-align:center}
#modalRoot .profile-page .pf-achievement-art{flex:1;min-height:0;width:100%;border-radius:.7em;overflow:hidden;border:.08em solid #b07c28}
#modalRoot .profile-page .pf-achievement-art img{width:100%;height:100%;object-fit:cover;display:block}
#modalRoot .profile-page .pf-achievement.is-locked .pf-achievement-art img{filter:grayscale(.85) brightness(.8)}
#modalRoot .profile-page .pf-achievement strong{font-size:.85em;font-weight:900;line-height:1.05}
#modalRoot .profile-page .pf-ach-desc{font-size:.66em;font-weight:700;line-height:1.1;min-height:2.2em}
#modalRoot .profile-page .pf-unlocked{font-style:normal;font-size:.74em;font-weight:900;padding:.08em .9em;border-radius:.8em;color:#fff;background:linear-gradient(#35b82a,#1b7410);border:.1em solid #0f4a08;box-shadow:inset 0 .1em #ffffff55}
#modalRoot .profile-page .pf-achievement-progress{width:88%;height:.5em;border:.07em solid #624a2b;border-radius:1em;background:#8c7657;overflow:hidden}
#modalRoot .profile-page .pf-achievement-progress i{display:block;height:100%;background:linear-gradient(#9af05e,#2c9b1b)}
#modalRoot .profile-page .pf-achievement small{font-size:.7em;font-weight:800}
#modalRoot .profile-page .pf-ach-categories{display:grid;grid-template-columns:repeat(4,1fr);gap:.4em;flex:1;min-height:0}
#modalRoot .profile-page .pf-ach-category{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.08em;min-width:0;padding:.2em .3em;border:.09em solid #d7ac5f;border-radius:.7em;background:linear-gradient(rgba(255,248,222,.85),rgba(240,216,157,.8));font-size:.82em;font-weight:800;text-align:center}
#modalRoot .profile-page .pf-ach-category img{height:2em;width:auto;filter:drop-shadow(0 .05em .06em #0005)}
#modalRoot .profile-page .pf-ach-category b{font-size:1.15em;font-weight:900}
#modalRoot .profile-page .pf-ach-category .pf-bar{width:88%;height:.5em}

/* portrait phones: the 16:9 scene would be tiny, so the profile becomes a scrolling sheet over the dimmed art */
@media(max-aspect-ratio:1/1){
 #modalRoot .profile-page .settings-scene{width:100vw;height:100dvh;aspect-ratio:auto}
 #modalRoot .profile-page .settings-art{object-fit:cover;object-position:50% 20%;filter:brightness(.55)}
 #modalRoot .profile-page .pf-heading{left:8cqw;width:84cqw;top:1.5cqw;height:13cqw}
 #modalRoot .profile-page .pf-heading span{font-size:7cqw}
 #modalRoot .profile-page button.pf-close{left:auto;right:3cqw;top:2.6cqw;width:9cqw;height:9cqw;font-size:5cqw}
 #modalRoot .profile-page .pf-content{left:2%;width:96%;top:15cqw;height:calc(100dvh - 16.5cqw);padding-bottom:3cqw}
 #modalRoot .profile-page .pf-root{font-size:3.2cqw}
 #modalRoot .profile-page .pf-top{grid-template-columns:1fr;height:auto}
 #modalRoot .profile-page .pf-id{padding:.5em .8em}
 #modalRoot .profile-page .pf-overall{padding:.6em .9em}
 #modalRoot .profile-page .pf-chips{grid-template-columns:repeat(3,1fr);height:auto}
 #modalRoot .profile-page .pf-tabs{flex-wrap:wrap;height:auto;gap:.3em}
 #modalRoot .profile-page button.pf-tab{flex:1 1 30%;height:3.2em}
 #modalRoot .profile-page .pf-body-host{flex:none}
 #modalRoot .profile-page .pf-body{grid-template-columns:1fr;grid-template-rows:none;grid-template-areas:none;height:auto}
 #modalRoot .profile-page .pf-collection-book,#modalRoot .profile-page .pf-collection-relics,#modalRoot .profile-page .pf-collection-vault,#modalRoot .profile-page .pf-collection-perks,#modalRoot .profile-page .pf-collection-summary,#modalRoot .profile-page .pf-ach-summary,#modalRoot .profile-page .pf-ach-list,#modalRoot .profile-page .pf-ach-cats{grid-area:auto}
 #modalRoot .profile-page .pf-tiles{grid-template-columns:repeat(2,1fr);grid-template-rows:none}
 #modalRoot .profile-page .pf-tile{padding:.6em .3em}
 #modalRoot .profile-page .pf-learn-list,#modalRoot .profile-page .pf-adv-list,#modalRoot .profile-page .pf-use-list,#modalRoot .profile-page .pf-stat-list,#modalRoot .profile-page .pf-sum-list{grid-template-rows:none;gap:.5em}
 #modalRoot .profile-page .pf-learn-row,#modalRoot .profile-page .pf-adv-row,#modalRoot .profile-page .pf-stat,#modalRoot .profile-page .pf-use,#modalRoot .profile-page .pf-sum-row{padding:.3em 0}
 #modalRoot .profile-page .pf-temple-grid{grid-template-columns:repeat(2,1fr)}
 #modalRoot .profile-page .pf-temple-pic{flex:none;height:8em}
 #modalRoot .profile-page .pf-records{grid-template-columns:1fr 1fr;height:auto;row-gap:.6em}
 #modalRoot .profile-page .pf-records-title{grid-column:1/-1}
 #modalRoot .profile-page .pf-gameplay-inner{grid-template-columns:1fr}
 #modalRoot .profile-page .pf-right-col{grid-template-rows:none}
 #modalRoot .profile-page .pf-collection-grid{min-height:6em}
 #modalRoot .profile-page .pf-book-feature{min-height:12em}
 #modalRoot .profile-page .pf-achievement-grid{grid-template-columns:repeat(2,1fr)}
 #modalRoot .profile-page .pf-achievement{min-height:11em}
 #modalRoot .profile-page .pf-ach-categories{grid-template-columns:repeat(2,1fr)}
}


/* STAGE 160 — unified Settings / Player Profile title treatment and shared close asset */
#modalRoot .settings-page-title{
 position:absolute;z-index:4;left:29%;top:3.8%;width:42%;height:13%;
 margin:0;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:1.1cqw;
 color:#64200f;font:800 3.25cqw/1 Georgia,"Times New Roman",serif;
 text-shadow:0 .12cqw .08cqw #fff1c4,0 .2cqw .25cqw #6d3514;
 pointer-events:none;
}
#modalRoot .settings-page-title-icon{font-size:4.1cqw;line-height:1;color:#6b3514;text-shadow:0 .12cqw .1cqw #fff1c4}
#modalRoot .settings-page-title>span:nth-child(2){white-space:nowrap}
#modalRoot .settings-page-title small{
 position:absolute;left:0;right:0;top:70%;text-align:center;
 font:600 1.25cqw/1.2 Georgia,"Times New Roman",serif;color:#4a3019;
 text-shadow:0 .06cqw #fff1c4;
}
#modalRoot .settings-modal .settings-close{
 left:auto;right:8.2%;top:5.2%;width:5.2%;height:9.2%;
 border:0;border-radius:50%;background:transparent;padding:0;z-index:8;
}
#modalRoot .settings-modal .settings-close img{display:block;width:100%;height:100%;object-fit:contain}
#modalRoot .settings-modal .settings-close:hover{background:transparent;filter:brightness(1.12) drop-shadow(0 0 .55cqw #ffe08a)}
#modalRoot .profile-page .pf-heading{
 left:29%;width:42%;top:3.2%;height:10%;
 margin:0;display:flex;align-items:center;justify-content:center;
 background:none!important;border:0!important;box-shadow:none!important;
}
#modalRoot .profile-page .pf-heading img{display:none!important}
#modalRoot .profile-page .pf-heading span{
 display:block;font:800 4.1cqw/1 Georgia,"Times New Roman",serif;
 color:#64200f;text-shadow:0 .12cqw .08cqw #fff1c4,0 .2cqw .25cqw #6d3514;
 white-space:nowrap;
}
#modalRoot .profile-page button.pf-close{
 left:auto;right:8.2%;top:5.2%;width:5.2%;height:9.2%;
 padding:0;border:0;background:transparent;box-shadow:none;border-radius:50%;
}
#modalRoot .profile-page button.pf-close img{display:block;width:100%;height:100%;object-fit:contain}
#modalRoot .profile-page button.pf-close:hover{filter:brightness(1.12) drop-shadow(0 0 .55cqw #ffe08a)}
@media(max-aspect-ratio:1/1){
 #modalRoot .settings-page-title{left:8%;width:84%;top:3%;height:10%;font-size:5cqw}
 #modalRoot .settings-page-title-icon{font-size:6cqw}
 #modalRoot .settings-page-title small{font-size:2.1cqw;top:70%}
 #modalRoot .settings-modal .settings-close{right:3%;top:2%;width:11cqw;height:11cqw}
 #modalRoot .profile-page .pf-heading{left:12%;width:76%;top:3%;height:9%}
 #modalRoot .profile-page .pf-heading span{font-size:6cqw}
 #modalRoot .profile-page button.pf-close{right:3%;top:2%;width:11cqw;height:11cqw}
}




/* STAGE 161 — lightweight layered Mr. Roo idle animation.
   Existing character artwork is reused; only small transparent cutouts are added. */
#gamePage .roo-stage .roo-idle,
#gamePage .roo-stage .roo-motion-layer{
  rotate:0deg;
  translate:0 0;
  transform-origin:50% 82%;
  animation:roo-character-sway 9s ease-in-out infinite;
}
#gamePage .roo-stage .roo-idle{
  scale:1 1;
  animation:
    roo-character-sway 9s ease-in-out infinite,
    roo-breathe 6.8s ease-in-out infinite;
}
#gamePage .roo-stage .roo-motion-layer{
  position:absolute;
  height:auto;
  max-width:none;
  user-select:none;
  -webkit-user-drag:none;
  pointer-events:none;
}
#gamePage .roo-stage .roo-tail-layer{
  --k:calc(var(--roo-stature) / 1476);
  z-index:3;
  width:calc(1024 * var(--k) * 100% / var(--W));
  left:calc((var(--cx) - 544 * var(--k)) * 100% / var(--W));
  top:calc((var(--floor) - 1488 * var(--k)) * 100% / var(--H));
  transform-origin:36.5% 62%;
  animation:
    roo-character-sway 9s ease-in-out infinite,
    roo-tail-sway 7.4s ease-in-out infinite;
}
#gamePage .roo-stage .roo-ear-layer{
  --k:calc(var(--roo-stature) / 1476);
  z-index:5;
  width:calc(1024 * var(--k) * 100% / var(--W));
  left:calc((var(--cx) - 544 * var(--k)) * 100% / var(--W));
  top:calc((var(--floor) - 1488 * var(--k)) * 100% / var(--H));
}
#gamePage .roo-stage .roo-ear-left{
  transform-origin:37.5% 15.5%;
  animation:
    roo-character-sway 9s ease-in-out infinite,
    roo-ear-left-twitch 8.6s ease-in-out infinite;
}
#gamePage .roo-stage .roo-ear-right{
  transform-origin:60% 14%;
  animation:
    roo-character-sway 9s ease-in-out infinite,
    roo-ear-right-twitch 11.2s ease-in-out infinite;
}
#gamePage .roo-stage .roo-blink-overlay{
  --k:calc(var(--roo-stature) / 1476);
  z-index:6;
  width:calc(1024 * var(--k) * 100% / var(--W));
  left:calc((var(--cx) - 544 * var(--k)) * 100% / var(--W));
  top:calc((var(--floor) - 1488 * var(--k)) * 100% / var(--H));
  opacity:0;
  animation:
    roo-character-sway 9s ease-in-out infinite,
    roo-natural-blink 7.2s linear infinite;
}
#gamePage .roo-stage #rooPose:not([hidden]) ~ .roo-motion-layer{
  display:none;
}
@keyframes roo-character-sway{
  0%,100%{rotate:0deg;translate:0 0}
  50%{rotate:.12deg;translate:0 -1px}
}
@keyframes roo-breathe{
  0%,100%{scale:1 1}
  48%{scale:1 1.006}
  58%{scale:1 1.008}
}
@keyframes roo-tail-sway{
  0%,100%{transform:rotate(0deg)}
  30%{transform:rotate(-.45deg)}
  68%{transform:rotate(.55deg)}
}
@keyframes roo-ear-left-twitch{
  0%,38%,42%,100%{transform:rotate(0deg)}
  40%{transform:rotate(-.8deg)}
}
@keyframes roo-ear-right-twitch{
  0%,56%,60%,100%{transform:rotate(0deg)}
  58%{transform:rotate(.7deg)}
}
@keyframes roo-natural-blink{
  0%,48%,50%,88%,90%,100%{opacity:0}
  48.35%,49.45%,88.35%,89.45%{opacity:1}
}
@media (prefers-reduced-motion:reduce){
  #gamePage .roo-stage .roo-idle,
  #gamePage .roo-stage .roo-motion-layer{animation:none!important}
  #gamePage .roo-stage .roo-blink-overlay{display:none!important}
}


/* STAGE 162 — Mr. Roo's lightweight action reactions.
   These short wrapper animations add movement without new character frames. */
#gamePage .roo-stage .roo-actor{
  position:absolute;inset:0;width:100%;height:100%;z-index:3;
  transform-origin:50% 82%;pointer-events:none;
}
#gamePage .roo-stage .roo-actor.roo-action-acknowledge{
  animation:roo-acknowledge .42s cubic-bezier(.2,.75,.25,1) both;
}
#gamePage .roo-stage .roo-actor.roo-action-impact{
  animation:roo-mistake-impact .46s ease-out both;
}
#gamePage .roo-stage .roo-actor.roo-action-struggle{
  animation:roo-struggle-pulse .76s ease-in-out both;
}
#gamePage .roo-stage .roo-actor.roo-action-final-strain{
  animation:roo-final-strain .72s cubic-bezier(.3,.7,.3,1) both;
}
#gamePage .roo-stage .roo-actor.roo-action-celebrate{
  animation:roo-celebrate-hop .72s cubic-bezier(.2,.8,.25,1) both;
}
@keyframes roo-acknowledge{
  0%,100%{transform:translateY(0) rotate(0)}
  42%{transform:translateY(-5px) rotate(-.35deg)}
  72%{transform:translateY(-1px) rotate(.12deg)}
}
@keyframes roo-mistake-impact{
  0%,100%{transform:translateX(0) rotate(0)}
  22%{transform:translateX(-3px) rotate(-.35deg)}
  48%{transform:translateX(2px) rotate(.22deg)}
  72%{transform:translateX(-1px) rotate(-.1deg)}
}
@keyframes roo-struggle-pulse{
  0%,100%{transform:translateX(0) translateY(0) rotate(0)}
  18%{transform:translateX(-3px) translateY(1px) rotate(-.42deg)}
  38%{transform:translateX(3px) translateY(0) rotate(.38deg)}
  58%{transform:translateX(-2px) translateY(1px) rotate(-.25deg)}
  78%{transform:translateX(1px) translateY(0) rotate(.12deg)}
}
@keyframes roo-final-strain{
  0%{transform:translateY(0) rotate(0)}
  32%{transform:translateY(2px) rotate(-.45deg)}
  62%{transform:translateY(4px) rotate(.25deg)}
  100%{transform:translateY(0) rotate(0)}
}
@keyframes roo-celebrate-hop{
  0%,100%{transform:translateY(0) rotate(0) scale(1)}
  34%{transform:translateY(-13px) rotate(-.8deg) scale(1.012)}
  62%{transform:translateY(-5px) rotate(.35deg) scale(1.006)}
}
@media(prefers-reduced-motion:reduce){
  #gamePage .roo-stage .roo-actor[class*="roo-action-"]{animation:none!important}
}


/* =====================================================================
   STAGE 163 — Richer Roo reactions, eyes on every pose, and feedback FX.
   Later rules intentionally override the Stage 162 reaction keyframes.
   Only transform / opacity / filter / individual transform properties are
   animated, so everything stays smooth on low-end phones.
   ===================================================================== */

/* ---- Eyes on the reaction poses (blink · flinch · happy) -------------- */
#gamePage .roo-stage .roo-pose-eyes{
  position:absolute;z-index:5;pointer-events:none;aspect-ratio:1000/857;
  --p-dx:var(--p-dx-override,calc(var(--gap) + var(--contact-ov) - (var(--p-hr) - var(--p-ax)) * var(--p-k)));
  width:calc(1400 * var(--p-k) * 100% / var(--W));
  left:calc((var(--cx) + var(--p-dx) - var(--p-ax) * var(--p-k)) * 100% / var(--W));
  top:calc((var(--floor) - var(--p-fy) * var(--p-k)) * 100% / var(--H));
}
#gamePage .roo-stage .roo-pose-eyes[hidden]{display:none}
#gamePage .roo-stage .roo-pose-eyes img{
  position:absolute;left:var(--ex);top:var(--ey);width:var(--ew);height:var(--eh);
  max-width:none;opacity:0;user-select:none;-webkit-user-drag:none;
  animation:roo-pose-blink 6.4s linear infinite;
}
#gamePage .roo-stage .roo-pose-eyes[data-eyes="closed"] img,
#gamePage .roo-stage .roo-pose-eyes[data-eyes="happy"] img{animation:none;opacity:1}
@keyframes roo-pose-blink{
  0%,36%{opacity:0} 37%,39.2%{opacity:1} 40.2%,80%{opacity:0}
  81%,82.8%{opacity:1} 83.8%,85.4%{opacity:0} 86.4%,88.2%{opacity:1} 89.2%,100%{opacity:0}
}
/* Idle Roo: hold the existing blink overlay shut for a flinch / happy squint. */
#gamePage .roo-stage .roo-actor.roo-idle-squint .roo-blink-overlay{
  animation:roo-character-sway 9s ease-in-out infinite;opacity:1;
}

/* ---- Roo body reactions: anticipation → hit → settle -------------------
   --amp (set from game.js) makes them stronger as the doors close in.    */
#gamePage .roo-stage .roo-actor.roo-action-acknowledge{animation:roo-acknowledge .62s cubic-bezier(.25,.8,.3,1) both}
#gamePage .roo-stage .roo-actor.roo-action-acknowledge-big{animation:roo-acknowledge-big .92s cubic-bezier(.25,.8,.3,1) both}
#gamePage .roo-stage .roo-actor.roo-action-impact{animation:roo-mistake-impact .78s ease-out both}
#gamePage .roo-stage .roo-actor.roo-action-struggle{animation:roo-struggle-pulse .98s ease-in-out both}
#gamePage .roo-stage .roo-actor.roo-action-final-strain{animation:roo-final-strain 1.28s ease-in-out both}
#gamePage .roo-stage .roo-actor.roo-action-celebrate{animation:roo-celebrate-hop 1.18s cubic-bezier(.25,.8,.3,1) both}
#gamePage .roo-stage .roo-actor.roo-action-shield{animation:roo-shield-glow .92s ease-out both}
@keyframes roo-acknowledge{
  0%{transform:none}
  16%{transform:translateY(calc(2px * var(--amp,1))) scale(1.012,.98)}
  46%{transform:translateY(calc(-11px * var(--amp,1))) scale(.99,1.02) rotate(-.5deg)}
  72%{transform:translateY(0) scale(1.01,.985) rotate(.15deg)}
  100%{transform:none}
}
@keyframes roo-acknowledge-big{
  0%{transform:none}
  12%{transform:translateY(3px) scale(1.02,.97)}
  34%{transform:translateY(calc(-17px * var(--amp,1))) scale(.985,1.03) rotate(-1deg)}
  52%{transform:translateY(1px) scale(1.018,.972)}
  72%{transform:translateY(calc(-9px * var(--amp,1))) scale(.992,1.015) rotate(.7deg)}
  88%{transform:translateY(0) scale(1.008,.99)}
  100%{transform:none}
}
@keyframes roo-mistake-impact{
  0%{transform:none}
  10%{transform:translateY(calc(2px * var(--amp,1))) scale(1.012,.975)}
  24%{transform:translateX(calc(-7px * var(--amp,1))) rotate(-.9deg)}
  38%{transform:translateX(calc(6px * var(--amp,1))) rotate(.7deg)}
  52%{transform:translateX(calc(-4px * var(--amp,1))) rotate(-.4deg)}
  68%{transform:translateX(calc(2.5px * var(--amp,1)))}
  84%{transform:translateX(-1px)}
  100%{transform:none}
}
@keyframes roo-struggle-pulse{
  0%{transform:none}
  12%{transform:translateY(calc(3px * var(--amp,1))) scale(1.02,.965)}
  26%{transform:translateX(calc(-8px * var(--amp,1))) translateY(2px) rotate(-1deg) scale(1.015,.975)}
  40%{transform:translateX(calc(7px * var(--amp,1))) rotate(.9deg)}
  54%{transform:translateX(calc(-5px * var(--amp,1))) rotate(-.6deg)}
  68%{transform:translateX(4px) rotate(.4deg)}
  82%{transform:translateX(-2px) translateY(1px) scale(1.01,.985)}
  100%{transform:none}
}
@keyframes roo-final-strain{
  0%{transform:none}
  14%{transform:translateY(4px) scale(1.03,.955)}
  28%{transform:translateX(-9px) translateY(4px) rotate(-1.3deg)}
  42%{transform:translateX(8px) translateY(5px) rotate(1.1deg)}
  56%{transform:translateX(-6px) translateY(6px) rotate(-.8deg) scale(1.03,.95)}
  70%{transform:translateX(5px) translateY(6px) rotate(.6deg)}
  86%{transform:translateX(-2px) translateY(7px) scale(1.035,.945)}
  94%{transform:translateY(6px) scale(1.03,.95)}
  100%{transform:none}
}
@keyframes roo-celebrate-hop{
  0%{transform:none}
  10%{transform:translateY(3px) scale(1.02,.97)}
  30%{transform:translateY(-26px) scale(.985,1.035) rotate(-1.6deg)}
  46%{transform:translateY(2px) scale(1.025,.965) rotate(.4deg)}
  62%{transform:translateY(-14px) scale(.99,1.02) rotate(1.2deg)}
  78%{transform:translateY(1px) scale(1.012,.985)}
  100%{transform:none}
}
@keyframes roo-shield-glow{
  0%{filter:none;transform:none}
  30%{filter:drop-shadow(0 0 18px #ffe08a) drop-shadow(0 0 40px #ffc83a) brightness(1.18);transform:scale(1.02)}
  100%{filter:none;transform:none}
}

/* ---- Scene-wide feedback layer ---------------------------------------- */
#gamePage .scene > .fx-layer{position:absolute;inset:0;z-index:7;pointer-events:none;overflow:hidden}
.fx-flash{position:absolute;inset:0;opacity:0;pointer-events:none}
.fx-flash.red{background:radial-gradient(ellipse at 50% 55%,transparent 34%,rgba(200,20,8,.78) 100%);animation:fx-flash .76s ease-out forwards}
.fx-flash.gold{background:radial-gradient(ellipse at 50% 48%,rgba(255,228,140,.55),rgba(255,200,80,.12) 55%,transparent 72%);animation:fx-flash .95s ease-out forwards}
.fx-flash.doom{background:radial-gradient(ellipse at 50% 58%,transparent 22%,rgba(8,3,1,.86) 100%);animation:fx-doom 1.4s ease-in forwards}
@keyframes fx-flash{0%{opacity:0}16%{opacity:1}100%{opacity:0}}
@keyframes fx-doom{0%{opacity:0}100%{opacity:1}}
.fx-p{position:absolute;pointer-events:none;will-change:transform,opacity}
.fx-p.dust{width:34px;height:34px;border-radius:50%;background:radial-gradient(circle,rgba(238,212,168,.96),rgba(214,182,128,.55) 45%,rgba(180,146,98,0) 72%);filter:blur(1px)}
.fx-p.chip{width:11px;height:9px;border-radius:2px;background:linear-gradient(135deg,#d6b27a,#8a6538);box-shadow:inset -1px -1px 0 #4a321b,0 1px 3px #0006}
.fx-p.spark{width:30px;height:30px;background:radial-gradient(circle,#fffde8,#ffd75e 55%,#ff9f1c);clip-path:polygon(50% 0,60% 38%,100% 50%,60% 62%,50% 100%,40% 62%,0 50%,40% 38%);filter:drop-shadow(0 0 5px #ffe58a)}
.fx-p.ring{width:70px;height:70px;border-radius:50%;border:5px solid #ffe08a;box-shadow:0 0 18px #ffd36a,inset 0 0 14px #ffe9a8}

/* Whole stage (slabs + Roo) takes the hit. */
#gamePage .roo-stage.fx-shake{animation:stage-shake .56s linear both}
@keyframes stage-shake{
  0%,100%{translate:0 0}
  10%{translate:calc(-5px * var(--shk,1)) calc(2px * var(--shk,1))}
  24%{translate:calc(5px * var(--shk,1)) calc(-2px * var(--shk,1))}
  38%{translate:calc(-4px * var(--shk,1)) calc(1px * var(--shk,1))}
  54%{translate:calc(3px * var(--shk,1)) 0}
  72%{translate:calc(-1.5px * var(--shk,1)) 0}
}
/* Slabs rebound slightly as they stop against Roo. */
#gamePage .roo-stage .slab.left.fx-thud{animation:slab-thud-l .46s cubic-bezier(.3,.6,.3,1)}
#gamePage .roo-stage .slab.right.fx-thud{animation:slab-thud-r .46s cubic-bezier(.3,.6,.3,1)}
@keyframes slab-thud-l{0%{translate:0 0}30%{translate:calc(var(--thud,7px) * -1) 0}62%{translate:calc(var(--thud,7px) * .35) 0}100%{translate:0 0}}
@keyframes slab-thud-r{0%{translate:0 0}30%{translate:var(--thud,7px) 0}62%{translate:calc(var(--thud,7px) * -.35) 0}100%{translate:0 0}}

/* ---- Keyboard keys ----------------------------------------------------- */
#gamePage .keyboard .key.fx-correct{animation:key-correct .64s cubic-bezier(.2,.9,.3,1.15);z-index:3}
#gamePage .keyboard .key.fx-wrong{animation:key-wrong .58s ease-out;z-index:3}
@keyframes key-correct{
  0%{scale:1;filter:none}
  28%{scale:1.3;filter:brightness(1.5) drop-shadow(0 0 12px #ffe58a) drop-shadow(0 0 22px #ffc83a)}
  58%{scale:.94;filter:brightness(1.2) drop-shadow(0 0 8px #ffe58a)}
  100%{scale:1;filter:none}
}
@keyframes key-wrong{
  0%{translate:0 0;scale:1;filter:none}
  14%{translate:-6px 0;scale:.92;filter:brightness(.8) sepia(1) saturate(4) hue-rotate(-35deg)}
  30%{translate:6px 0;filter:brightness(.8) sepia(1) saturate(4) hue-rotate(-35deg)}
  46%{translate:-4px 0}
  62%{translate:3px 0}
  80%{translate:-1px 0;scale:.97}
  100%{translate:0 0;scale:1;filter:none}
}

/* ---- Answer letters ---------------------------------------------------- */
#gamePage .answer-slots .slot.fx-reveal{animation:slot-reveal .66s cubic-bezier(.2,.9,.25,1.2) var(--d,0ms) both}
@keyframes slot-reveal{
  0%{opacity:0;transform:translateY(-16px) scale(.4) rotate(-14deg);text-shadow:none}
  55%{opacity:1;transform:translateY(2px) scale(1.4);text-shadow:0 0 16px #ffd36a,0 0 5px #fff3b0}
  100%{opacity:1;transform:none;text-shadow:none}
}
#gamePage .answer-plaque.fx-plaque-wrong{animation:plaque-wrong .58s ease-out}
@keyframes plaque-wrong{
  0%,100%{translate:0 0;rotate:0deg;filter:none}
  14%{translate:-7px 0;rotate:-.5deg;filter:sepia(.6) saturate(3) hue-rotate(-30deg) brightness(.92)}
  30%{translate:6px 0;rotate:.4deg}
  48%{translate:-4px 0}
  66%{translate:2px 0}
}
#gamePage .answer-plaque.fx-plaque-win .answer-slots .slot:not(.space):not(.punct){animation:slot-wave .58s ease-in-out calc(var(--i,0) * 55ms) both}
@keyframes slot-wave{
  0%,100%{transform:none;text-shadow:none}
  45%{transform:translateY(-10px) scale(1.2);text-shadow:0 0 14px #ffd36a,0 0 4px #fff3b0}
}
.fx-shimmer{position:absolute;inset:4% 3%;overflow:hidden;pointer-events:none;border-radius:12px;z-index:3}
.fx-shimmer::before{content:"";position:absolute;top:-20%;bottom:-20%;left:-30%;width:26%;
  background:linear-gradient(100deg,transparent,rgba(255,244,190,.85),transparent);
  mix-blend-mode:screen;transform:skewX(-18deg) translateX(0);animation:fx-sweep 1s ease-in-out .08s both}
@keyframes fx-sweep{from{transform:skewX(-18deg) translateX(0)}to{transform:skewX(-18deg) translateX(560%)}}

/* ---- Hearts ------------------------------------------------------------ */
#gamePage #mistakeDots .heart{display:inline-block}
#gamePage #mistakeDots .heart.lost{animation:heart-lost .95s ease-out both}
@keyframes heart-lost{
  0%{scale:1.9;color:#ff4a36;filter:drop-shadow(0 0 10px #ff2f1c)}
  35%{scale:2.1;rotate:-14deg}
  60%{scale:1.15;rotate:8deg;color:#c0392b}
  100%{scale:1;rotate:0deg;filter:none}
}
#gamePage #mistakeDots .heart.danger{animation:heart-danger 1.05s ease-in-out infinite}
@keyframes heart-danger{
  0%,100%{scale:1;filter:none}
  50%{scale:1.28;filter:drop-shadow(0 0 8px #ff6a3a)}
}

@media(prefers-reduced-motion:reduce){
  #gamePage .roo-stage .roo-pose-eyes img{animation:none!important}
  #gamePage .roo-stage .roo-actor[class*="roo-action-"],
  #gamePage .roo-stage.fx-shake,
  #gamePage .roo-stage .slab.fx-thud,
  #gamePage .keyboard .key.fx-correct,
  #gamePage .keyboard .key.fx-wrong,
  #gamePage .answer-slots .slot.fx-reveal,
  #gamePage .answer-plaque.fx-plaque-wrong,
  #gamePage .answer-plaque.fx-plaque-win .slot,
  #gamePage #mistakeDots .heart.lost,
  #gamePage #mistakeDots .heart.danger{animation:none!important}
  .fx-shimmer,.fx-layer{display:none!important}
}


/* STAGE 164 — Animated Oasis reading scene (scene layers only; hub UI remains untouched). */
#caravanHousePage .caravan-reading-stage{position:absolute;inset:0;z-index:1;overflow:hidden;pointer-events:none;}
#caravanHousePage .caravan-reading-canvas{position:absolute;left:0;top:0;width:1675px;height:939px;transform-origin:0 0;transform:scale(var(--reading-scale,.5));overflow:hidden;}
#caravanHousePage .caravan-reading-canvas img{display:block;position:absolute;user-select:none;-webkit-user-drag:none;pointer-events:none;}
#caravanHousePage .cr-sway{z-index:1;animation:crSway var(--dur,7s) ease-in-out var(--delay,0s) infinite alternate;transform-origin:var(--ox,50%) var(--oy,50%);}
@keyframes crSway{from{transform:rotate(calc(var(--rot,1deg)*-1)) skewX(calc(var(--skew,1deg)*-1))}to{transform:rotate(var(--rot,1deg)) skewX(var(--skew,1deg))}}
#caravanHousePage .cr-fall{position:absolute;z-index:2;mix-blend-mode:screen;opacity:.55;background:repeating-linear-gradient(90deg,transparent 0 5px,rgba(255,255,255,.9) 6px 8px,transparent 9px 15px);-webkit-mask-image:repeating-linear-gradient(180deg,#000 0 22px,rgba(0,0,0,.15) 38px 64px);mask-image:repeating-linear-gradient(180deg,#000 0 22px,rgba(0,0,0,.15) 38px 64px);-webkit-mask-size:100% 128px;mask-size:100% 128px;animation:crFall .9s linear infinite}
#caravanHousePage .cr-fall.b{background-size:19px 100%;animation-duration:1.15s;opacity:.45}
@keyframes crFall{to{-webkit-mask-position:0 128px;mask-position:0 128px}}
#caravanHousePage .cr-mist{position:absolute;z-index:2;border-radius:50%;pointer-events:none;mix-blend-mode:screen;background:radial-gradient(closest-side,rgba(255,255,255,.75),rgba(255,255,255,.28) 55%,transparent);animation:crMist 4.2s ease-in-out infinite}
@keyframes crMist{0%,100%{transform:scale(.9);opacity:.45}50%{transform:scale(1.18);opacity:.8}}
#caravanHousePage .cr-pond{position:absolute;inset:0;z-index:2;pointer-events:none;clip-path:polygon(55.5% 42.6%,59.7% 41.1%,74.6% 40.7%,82.4% 42.8%,89.6% 46%,93.1% 50%,94.9% 55.4%,90.7% 57.5%,83.6% 55.4%,79.4% 53.2%,68.7% 53.2%,65.7% 55.4%,59.7% 55.4%,56.1% 50%)}
#caravanHousePage .cr-pond-shine{position:absolute;inset:-60px;mix-blend-mode:soft-light;opacity:.7;background:repeating-linear-gradient(105deg,transparent 0 38px,rgba(255,255,255,.55) 52px,transparent 70px);animation:crShine 9s linear infinite}
@keyframes crShine{to{transform:translateX(140px)}}
#caravanHousePage .cr-spark{position:absolute;width:14px;height:14px;margin:-7px 0 0 -7px;opacity:0;background:radial-gradient(circle,#fff 0 18%,transparent 62%);animation:crTwinkle var(--d,3s) ease-in-out var(--delay,0s) infinite}
#caravanHousePage .cr-spark:before,#caravanHousePage .cr-spark:after{content:"";position:absolute;left:50%;top:50%;background:#fff;border-radius:2px;transform:translate(-50%,-50%)}
#caravanHousePage .cr-spark:before{width:14px;height:1.5px}#caravanHousePage .cr-spark:after{width:1.5px;height:14px}
@keyframes crTwinkle{0%,100%{opacity:0;transform:scale(.3)}45%{opacity:.95;transform:scale(1) rotate(25deg)}70%{opacity:.2;transform:scale(.6) rotate(45deg)}}
#caravanHousePage .cr-glow{position:absolute;border-radius:50%;pointer-events:none;mix-blend-mode:screen;transform:translate(-50%,-50%)}
#caravanHousePage .cr-glow.lantern{background:radial-gradient(closest-side,rgba(255,214,120,.75),rgba(255,160,50,.32) 55%,transparent);animation:crFlicker 3.7s linear infinite}
#caravanHousePage .cr-glow.window{background:radial-gradient(closest-side,rgba(255,225,140,.55),rgba(255,190,80,.2) 60%,transparent);animation:crBreathe 5.5s ease-in-out infinite}
@keyframes crFlicker{0%,100%{opacity:.85}8%{opacity:1}14%{opacity:.7}22%{opacity:.95}35%{opacity:.78}47%{opacity:1}58%{opacity:.82}71%{opacity:.97}84%{opacity:.74}}
@keyframes crBreathe{0%,100%{opacity:.65;transform:translate(-50%,-50%) scale(.96)}50%{opacity:1;transform:translate(-50%,-50%) scale(1.05)}}
#caravanHousePage .cr-globe{position:absolute;border-radius:50%;overflow:hidden;pointer-events:none;mix-blend-mode:screen;transform:translate(-50%,-50%)}
#caravanHousePage .cr-globe:before{content:"";position:absolute;inset:-20%;background:linear-gradient(115deg,transparent 38%,rgba(255,244,200,.85) 50%,transparent 62%);background-size:260% 100%;animation:crGlint 6s ease-in-out infinite}
@keyframes crGlint{0%,35%{background-position:130% 0}70%,100%{background-position:-30% 0}}
#caravanHousePage .cr-steam{position:absolute;width:30px;height:30px;margin:-15px;border-radius:50%;filter:blur(4px);opacity:0;pointer-events:none;background:radial-gradient(closest-side,rgba(255,255,255,.85),transparent);animation:crSteam var(--d,3.6s) ease-out var(--delay,0s) infinite}
@keyframes crSteam{0%{opacity:0;transform:translate(0,0) scale(.5)}15%{opacity:.55}50%{transform:translate(var(--dx,8px),-38px) scale(1.1)}100%{opacity:0;transform:translate(calc(var(--dx,8px)*-.6),-86px) scale(1.7)}}
#caravanHousePage .cr-mote{position:absolute;width:var(--sz,4px);height:var(--sz,4px);border-radius:50%;background:rgba(255,246,210,.85);box-shadow:0 0 6px rgba(255,240,180,.8);opacity:0;animation:crMote var(--d,18s) linear var(--delay,0s) infinite}
@keyframes crMote{0%{opacity:0;transform:translate(0,0)}12%{opacity:.8}85%{opacity:.7}100%{opacity:0;transform:translate(var(--mx,60px),var(--my,-90px))}}
#caravanHousePage .cr-roo{position:absolute;left:250px;top:112px;width:1332px;height:1181px;transform:scale(.55);transform-origin:0 0;z-index:4}
#caravanHousePage .cr-layer{position:absolute}
#caravanHousePage .cr-chair{left:93px;top:396px;width:1034px;height:783px;z-index:0}
#caravanHousePage .cr-base{left:0;top:0;width:1332px;height:1181px;z-index:3}
#caravanHousePage .cr-tail{left:-49px;top:826px;width:438px;height:266px;transform-origin:434px 99px;transform:rotate(-14deg);z-index:1;animation:crTailSway 5.2s ease-in-out infinite}
@keyframes crTailSway{0%,100%{transform:rotate(-14deg)}30%{transform:rotate(-10.5deg)}65%{transform:rotate(-17.5deg)}}
@keyframes crTailFlick{0%{transform:rotate(-14deg)}18%{transform:rotate(-3deg)}42%{transform:rotate(-21deg)}68%{transform:rotate(-14deg)}100%{transform:rotate(-14deg)}}
#caravanHousePage .cr-tail.is-flick{animation:crTailFlick .8s cubic-bezier(.3,.1,.3,1) 1}
#caravanHousePage .cr-ear-l{left:527px;top:-101px;width:230px;height:255px;transform-origin:169px 251px;z-index:2}
#caravanHousePage .cr-ear-r{left:784px;top:-57px;width:215px;height:207px;transform-origin:32px 194px;z-index:2}
#caravanHousePage .cr-eyes{left:672px;top:240px;width:211px;height:124px;z-index:4;opacity:0;transition:opacity 55ms linear}
#caravanHousePage .cr-eyes.is-closed{opacity:1}
@keyframes crEarTwitchL{0%,100%{transform:rotate(0)}25%{transform:rotate(-7deg)}50%{transform:rotate(2deg)}75%{transform:rotate(-3deg)}}
@keyframes crEarTwitchR{0%,100%{transform:rotate(0)}25%{transform:rotate(8deg)}50%{transform:rotate(-2deg)}75%{transform:rotate(3deg)}}
@keyframes crEarPerkL{0%,100%{transform:rotate(0)}40%{transform:rotate(-5deg) translateY(-4px)}}
@keyframes crEarPerkR{0%,100%{transform:rotate(0)}40%{transform:rotate(5deg) translateY(-4px)}}
#caravanHousePage .cr-ear-l.is-twitch{animation:crEarTwitchL .42s ease-in-out 1}
#caravanHousePage .cr-ear-r.is-twitch{animation:crEarTwitchR .42s ease-in-out 1}
#caravanHousePage .cr-ear-l.is-perk{animation:crEarPerkL .6s ease-out 1}
#caravanHousePage .cr-ear-r.is-perk{animation:crEarPerkR .6s ease-out 1}
#caravanHousePage .cr-table{position:absolute;left:330px;top:380px;width:966px;z-index:5}
#caravanHousePage .caravan-reading-canvas.cr-paused *{animation-play-state:paused!important}
@media(prefers-reduced-motion:reduce){#caravanHousePage .caravan-reading-canvas .cr-sway,#caravanHousePage .caravan-reading-canvas .cr-fall,#caravanHousePage .caravan-reading-canvas .cr-mist,#caravanHousePage .caravan-reading-canvas .cr-pond-shine,#caravanHousePage .caravan-reading-canvas .cr-spark,#caravanHousePage .caravan-reading-canvas .cr-glow,#caravanHousePage .caravan-reading-canvas .cr-globe:before,#caravanHousePage .caravan-reading-canvas .cr-steam,#caravanHousePage .caravan-reading-canvas .cr-mote,#caravanHousePage .caravan-reading-canvas .cr-tail,#caravanHousePage .caravan-reading-canvas .cr-ear-l,#caravanHousePage .caravan-reading-canvas .cr-ear-r{animation:none!important}#caravanHousePage .caravan-reading-canvas .cr-spark,#caravanHousePage .caravan-reading-canvas .cr-steam,#caravanHousePage .caravan-reading-canvas .cr-mote{display:none}}


/* STAGE 166 — Correct Sanctuary drawer arrow direction, placement, and scale.
   Closed: left-pointing opener stays at the right screen edge.
   Open: right-pointing closer sits immediately left of the menu panel.
   Both controls are 80% of the previous size and remain inside the scene. */
#caravanHousePage .caravan-menu-drawer{
 position:absolute;inset:0;z-index:18;transform:translate3d(101%,0,0);
 transition:transform .52s cubic-bezier(.22,.78,.22,1);
 pointer-events:none;will-change:transform;
}
#caravanHousePage .caravan-menu-drawer.is-open{transform:translate3d(0,0,0);pointer-events:auto}
#caravanHousePage .caravan-menu-drawer .caravan-hub-menu-frame,
#caravanHousePage .caravan-menu-drawer .caravan-hub-menu{pointer-events:auto}
#caravanHousePage .caravan-menu-arrow{
 position:absolute;z-index:24;top:50%;width:4.28%;height:auto;
 aspect-ratio:346/699;padding:0;border:0;background:transparent;
 transform:translateY(-50%);cursor:pointer;filter:drop-shadow(0 3px 5px #160b05aa);
 transition:filter .16s ease,transform .16s ease;
}
#caravanHousePage .caravan-menu-open-arrow{right:1.15%}
#caravanHousePage .caravan-menu-close-arrow{right:27.1%}
#caravanHousePage .caravan-menu-arrow img{display:block;width:100%;height:100%;object-fit:contain}
#caravanHousePage .caravan-menu-arrow:hover{filter:brightness(1.12) drop-shadow(0 4px 7px #ffcf5c88);transform:translateY(-50%) scale(1.035)}
#caravanHousePage .caravan-menu-arrow:focus-visible{outline:2px solid #ffe08a;outline-offset:3px;border-radius:12px}
#caravanHousePage .caravan-menu-arrow[hidden]{display:none!important}
@media(max-width:700px){
 #caravanHousePage .caravan-menu-open-arrow{right:1%}
 #caravanHousePage .caravan-menu-close-arrow{right:27.1%}
}
@media(prefers-reduced-motion:reduce){#caravanHousePage .caravan-menu-drawer{transition:none}}

/* STAGE 167 — Sanctuary map click-through and modal title alignment.
   Keep the drawer's full-scene transition layer transparent to pointer input;
   only the visible menu controls should receive clicks. */
#caravanHousePage .caravan-menu-drawer,
#caravanHousePage .caravan-menu-drawer.is-open{
  pointer-events:none !important;
}
#caravanHousePage .caravan-menu-drawer .caravan-hub-menu-frame{
  pointer-events:none !important;
}
#caravanHousePage .caravan-menu-drawer .caravan-hub-menu,
#caravanHousePage .caravan-menu-drawer .caravan-hub-menu-button{
  pointer-events:auto;
}
#caravanHousePage .caravan-floating-map{
  pointer-events:auto;
}

/* Anchor both titles to the actual 1672:941 artwork canvas and align them
   with the center of the blank parchment header plaque. */
#modalRoot .settings-page .settings-scene > .settings-page-title{
  left:50%;
  width:42%;
  top:3.8%;
  height:13%;
  transform:translateX(-50%);
}
#modalRoot .settings-page.profile-page .settings-scene > .pf-heading{
  left:50%;
  width:42%;
  top:3.8%;
  height:13%;
  transform:translateX(-50%);
}
@media(max-aspect-ratio:1/1){
  #modalRoot .settings-page .settings-scene > .settings-page-title{
    left:50%;width:84%;top:3%;height:10%;transform:translateX(-50%);
  }
  #modalRoot .settings-page.profile-page .settings-scene > .pf-heading{
    left:50%;width:84%;top:3%;height:10%;transform:translateX(-50%);
  }
}

/* STAGE 170 — Sanctuary: map stays clickable with drawer open; red X exit button.
   The drawer's <nav> spans the whole scene, so it must never catch pointer input;
   only the individual menu buttons do. */
#caravanHousePage .caravan-menu-drawer .caravan-hub-menu{pointer-events:none!important}
#caravanHousePage .caravan-menu-drawer .caravan-hub-menu-button{pointer-events:auto!important}
#caravanHousePage .caravan-floating-map{z-index:30;pointer-events:auto}
#caravanHousePage .caravan-exit-x{
 position:absolute;right:1.2%;top:2%;width:5.2%;height:auto;aspect-ratio:146/133;
 z-index:40;padding:0;border:0;background:transparent;cursor:pointer;
 filter:drop-shadow(0 3px 5px #160b05aa);transition:filter .16s ease,transform .16s ease;
}
#caravanHousePage .caravan-exit-x img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}
#caravanHousePage .caravan-exit-x:hover{filter:brightness(1.12) drop-shadow(0 4px 7px #ff6a4a88);transform:scale(1.06)}
#caravanHousePage .caravan-exit-x:active{transform:scale(.95)}
#caravanHousePage .caravan-exit-x:focus-visible{outline:2px solid #ffe08a;outline-offset:3px;border-radius:12px}

/* STAGE 171 — Center Settings / Player Profile titles on the parchment plaque.
   Measured on settings_scene.webp (1671x941): plaque spans ~32%-68% across and
   ~9%-20.4% down (centre ≈ 50% / 14.8%). Landscape only; portrait uses a plain sheet. */
@media(min-aspect-ratio:1/1){
 #modalRoot .settings-page .settings-scene > .settings-page-title{
  left:50%;width:34%;top:9.2%;height:9.4%;transform:translateX(-50%);
  font-size:3cqw;gap:.9cqw;
 }
 #modalRoot .settings-page .settings-scene > .settings-page-title .settings-page-title-icon{font-size:3.4cqw}
 #modalRoot .settings-page .settings-scene > .settings-page-title small{top:78%;font-size:1.1cqw}
 #modalRoot .settings-page.profile-page .settings-scene > .pf-heading{
  left:50%;width:34%;top:9.1%;height:11.4%;transform:translateX(-50%);
 }
 #modalRoot .settings-page.profile-page .settings-scene > .pf-heading span{top:0;font-size:3.5cqw}
}

/* STAGE 172 — Lightweight Mr. Roo reading loading screen */
.app-loading-screen{position:fixed;inset:0;z-index:100000;display:flex;align-items:center;justify-content:center;overflow:hidden;background:#10272a;color:#f8e7bd;opacity:1;transition:opacity .38s ease;}
.app-loading-screen.loading-finished{opacity:0;pointer-events:none;}
.loading-scene{position:absolute;left:50%;top:50%;width:min(100vw,177.85vh);aspect-ratio:1675/939;transform:translate(-50%,-50%);overflow:hidden;}
.loading-scene-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;}
.loading-roo{position:absolute;inset:0;width:100%;height:100%;}
.loading-roo img,.loading-table{position:absolute;display:block;user-select:none;-webkit-user-drag:none;pointer-events:none;}
.loading-chair{left:18%;top:35.1%;width:33.95%;height:45.86%;z-index:0;}
.loading-tail{left:13.32%;top:60.3%;width:14.38%;height:15.58%;transform-origin:98.5% 37.2%;z-index:1;animation:loading-tail-sway 5.2s ease-in-out infinite;}
.loading-ear-left{left:31.31%;top:3.79%;width:7.55%;height:14.94%;transform-origin:73.5% 98.4%;z-index:2;animation:loading-ear-left 8.2s ease-in-out infinite;}
.loading-ear-right{left:41.39%;top:6.72%;width:7.06%;height:12.12%;transform-origin:14.9% 93.7%;z-index:2;animation:loading-ear-right 9.1s ease-in-out infinite;}
.loading-roo-body{left:14.925%;top:11.927%;width:43.74%;height:69.17%;z-index:3;}
.loading-roo-eyes{left:37%;top:26%;width:6.93%;height:7.24%;z-index:4;opacity:0;animation:loading-blink 5.8s steps(1,end) infinite;}
.loading-table{left:19.7%;top:40.47%;width:57.67%;height:auto;z-index:5;}
.loading-ui{position:absolute;z-index:8;left:50%;bottom:clamp(28px,6vh,70px);width:min(430px,82vw);transform:translateX(-50%);text-align:center;text-shadow:0 2px 8px #071719;}
.loading-brand{font-family:Georgia,serif;font-weight:800;letter-spacing:.18em;font-size:clamp(16px,2.1vw,24px);}
.loading-subtitle{margin-top:6px;font-size:10px;letter-spacing:.25em;color:#e5c98d;}
.loading-progress-track{height:10px;margin-top:22px;padding:2px;border:1px solid rgba(235,203,139,.85);border-radius:99px;background:rgba(16,31,29,.78);box-shadow:0 2px 12px #091b1c;overflow:hidden;}
.loading-progress-fill{width:0;height:100%;border-radius:99px;background:linear-gradient(90deg,#9b6b31,#e6c17a,#f8e4ad);transition:width .18s ease;}
.loading-progress-meta{display:flex;justify-content:space-between;gap:12px;margin-top:8px;font:12px Georgia,serif;color:#f3dfb4;}
@keyframes loading-blink{0%,39%,42%,74%,77%,100%{opacity:0}40%,41%,75%,76%{opacity:1}}
@keyframes loading-tail-sway{0%,100%{transform:rotate(-14deg)}30%{transform:rotate(-10.5deg)}65%{transform:rotate(-17.5deg)}}
@keyframes loading-ear-left{0%,100%{transform:rotate(0)}38%{transform:rotate(-1deg)}41%{transform:rotate(1.8deg)}45%{transform:rotate(0)}}
@keyframes loading-ear-right{0%,100%{transform:rotate(0)}56%{transform:rotate(1deg)}60%{transform:rotate(-1.8deg)}64%{transform:rotate(0)}}
@media(max-width:600px){.loading-ui{bottom:24px}}
@media(prefers-reduced-motion:reduce){.loading-tail,.loading-ear-left,.loading-ear-right,.loading-roo-eyes{animation:none!important}.loading-roo-eyes{opacity:0!important}}


/* STAGE 173 — Supabase account and guest authentication panel */
/* Reuse the existing Before-Perk stone tablet and shared menu close asset. */
.bh-auth-open{overflow:hidden}
.bh-auth-backdrop{position:fixed;inset:0;z-index:10050;display:grid;place-items:center;padding:18px;background:rgba(5,15,17,.78);backdrop-filter:blur(5px);animation:bh-auth-fade .18s ease}
.bh-auth-panel{position:relative;box-sizing:border-box;width:min(820px,96vw);max-height:min(90vh,820px);overflow:auto;padding:78px 10.5% 68px;border:0;border-radius:0;background:url("../assets/before_perk/before_perk_stone_frame.webp") center/100% 100% no-repeat;box-shadow:none;color:#452714;text-align:center}
.bh-auth-panel:before{content:none}
.bh-auth-close{position:absolute;z-index:3;right:7.6%;top:7.5%;display:block;width:44px;height:44px;padding:0;border:0;border-radius:0;background:transparent;line-height:0;cursor:pointer;filter:drop-shadow(0 2px 3px #26130688)}
.bh-auth-close img{display:block;width:100%;height:100%;object-fit:contain}
.bh-auth-close:hover{transform:scale(1.06);filter:brightness(1.08) drop-shadow(0 3px 4px #26130699)}
.bh-auth-close:focus-visible{outline:2px solid #754018;outline-offset:3px;border-radius:50%}
.bh-auth-brand{position:relative;z-index:1;margin:0 30px 13px;font:900 12px Georgia,serif;letter-spacing:.22em;color:#8b4b1c}
.bh-auth-content{position:relative;z-index:1;width:min(100%,540px);margin-inline:auto}
.bh-auth-emblem{margin:2px auto 7px;color:#a76625;font-size:29px;text-shadow:0 1px #fff}
.bh-auth-content h2{margin:0 0 8px;font:900 clamp(23px,5vw,29px) Georgia,serif;color:#542b15;text-shadow:0 1px #fff7}
.bh-auth-muted{margin:0 auto 18px;max-width:340px;color:#70451f;font:15px/1.45 Georgia,serif}
.bh-auth-content form{display:grid;gap:12px;text-align:left}
.bh-auth-content label{display:grid;gap:5px;color:#59351c;font:700 13px Georgia,serif}
.bh-auth-content input{box-sizing:border-box;width:100%;min-height:44px;padding:10px 12px;border:1px solid #a87943;border-radius:9px;background:#fff9e9;color:#392313;font:15px Arial,sans-serif;outline:none}
.bh-auth-content input:focus{border-color:#754018;box-shadow:0 0 0 3px #a96d2b35}
.bh-auth-primary,.bh-auth-secondary{width:100%;min-height:46px;margin-top:5px;padding:10px 16px;border-radius:12px;font:900 15px Georgia,serif;cursor:pointer}
.bh-auth-primary{border:2px solid #663711;background:linear-gradient(#8b4b1e,#5c2d12);color:#fff0c5;box-shadow:0 3px 0 #3d210f}
.bh-auth-primary:disabled{opacity:.65;cursor:wait}
.bh-auth-secondary{border:1px solid #98642e;background:#f4dba8;color:#5a3518}
.bh-auth-links{display:flex;justify-content:space-between;gap:12px;margin:13px 0 7px}
.bh-auth-links button,.bh-auth-switch button{border:0;background:none;color:#713d18;text-decoration:underline;font:700 13px Georgia,serif;cursor:pointer}
.bh-auth-switch{margin:16px 0 3px;color:#70451f;font:14px Georgia,serif}
.bh-auth-message,.bh-auth-config-warning{position:relative;z-index:1;margin:15px 0 0;padding:10px 12px;border-radius:9px;background:#fff4d8;color:#553517;font:13px/1.45 Arial,sans-serif;overflow-wrap:anywhere}
.bh-auth-message.is-error{background:#f8d9cc;color:#782d1e}
.bh-auth-message.is-success{background:#e7f0d7;color:#365325}
.bh-auth-config-warning{background:#fff0cb;border:1px solid #c18b43}
.bh-auth-config-warning code{font-size:12px;font-weight:700}
.bh-auth-account-email{display:block;margin:4px 0 14px;overflow-wrap:anywhere;color:#542b15}
.bh-auth-note{margin:14px 0;padding:12px;border:1px solid #c18b43;border-radius:10px;background:#fff3d6;color:#67431f;font:13px/1.45 Arial,sans-serif}
@keyframes bh-auth-fade{from{opacity:0}to{opacity:1}}
@media(max-width:600px){
 .bh-auth-backdrop{padding:8px}
 .bh-auth-panel{width:min(820px,98vw);max-height:92vh;padding:66px 9% 54px}
 .bh-auth-close{width:36px;height:36px;right:7%;top:7%}
 .bh-auth-content h2{font-size:clamp(21px,5.6vw,27px)}
 .bh-auth-muted{font-size:14px;margin-bottom:13px}
 .bh-auth-content form{gap:10px}
 .bh-auth-links{flex-direction:column;align-items:center;gap:8px}
}
@media(max-height:620px) and (min-width:601px){
 .bh-auth-panel{max-height:94vh;padding-top:58px;padding-bottom:48px}
}

/* ========================================================================== 
   STAGE 177 — HALL OF FAITH
   Hall crest entry in Sanctuary + responsive five-tab Hall of Faith overlay.
   ========================================================================== */
#caravanHousePage .caravan-hof-button{
  position:absolute;left:1.05%;top:1.3%;width:10.4%;height:16.8%;z-index:42;
  padding:0;border:0;background:transparent;box-shadow:none;border-radius:0;
  display:flex;align-items:center;justify-content:center;cursor:pointer;
  filter:drop-shadow(0 3px 5px #1b0c065e);transition:transform .16s ease,filter .16s ease;
}
#caravanHousePage .caravan-hof-button img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}
#caravanHousePage .caravan-hof-button:hover,
#caravanHousePage .caravan-hof-button:focus-visible{
  transform:translateY(-2px) scale(1.045);filter:brightness(1.12) drop-shadow(0 0 8px #ffd96e);
}
#caravanHousePage .caravan-hof-button:focus-visible{outline:2px solid #ffe08a;outline-offset:3px;border-radius:12px}

#modalRoot .hof-page .hof-scene{isolation:isolate}
#modalRoot .hof-page .hof-crest{
  position:absolute;z-index:4;left:20.7%;top:5.5%;width:10.5%;height:17%;object-fit:contain;
  filter:drop-shadow(0 .18cqw .22cqw #44200688);pointer-events:none;
}
#modalRoot .hof-page .hof-heading{
  position:absolute;z-index:4;left:31.2%;top:9.4%;width:47.2%;height:9.6%;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.24cqw;
  color:#67220e;text-align:center;pointer-events:none;
}
#modalRoot .hof-page .hof-heading h2{
  margin:0;font:900 3.05cqw/1 Georgia,"Times New Roman",serif;letter-spacing:.07em;
  color:#7a160f;text-shadow:0 .12cqw .1cqw #ffedb8,0 .22cqw .2cqw #5a240f;
  white-space:nowrap;
}
#modalRoot .hof-page .hof-heading p{
  max-width:95%;margin:0;font:italic 1.02cqw/1.15 Georgia,"Times New Roman",serif;
  color:#613c1e;text-shadow:0 .06cqw #fff1c5;
}
#modalRoot .hof-page .hof-close{
  position:absolute;z-index:8;right:17.2%;top:8.2%;width:4.7%;height:8.4%;
  padding:0;border:0;border-radius:50%;background:transparent;box-shadow:none;cursor:pointer;
}
#modalRoot .hof-page .hof-close img{display:block;width:100%;height:100%;object-fit:contain}
#modalRoot .hof-page .hof-close:hover{filter:brightness(1.13) drop-shadow(0 0 .5cqw #ffe08a);transform:scale(1.04)}
#modalRoot .hof-page .hof-close:focus-visible{outline:.2em solid #fff1b1;outline-offset:.12em}
#modalRoot .hof-page .hof-content{
  position:absolute;z-index:3;left:21.2%;top:21.3%;width:60.3%;height:69.1%;
  min-height:0;overflow:hidden;
}
#modalRoot .hof-page .hof-root{
  width:100%;height:100%;min-height:0;display:flex;flex-direction:column;gap:.52cqw;
  color:#4a2c12;font-family:Georgia,"Times New Roman",serif;font-size:.84cqw;
}
#modalRoot .hof-page .hof-tabs{flex:0 0 11.7%;min-height:0;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:.42cqw;align-items:stretch}
#modalRoot .hof-page .hof-tab{
  position:relative;min-width:0;min-height:0;padding:0;border:0;background:transparent;box-shadow:none;border-radius:0;
  cursor:pointer;transition:transform .15s ease,filter .15s ease;
}
#modalRoot .hof-page .hof-tab img{display:block;width:100%;height:100%;object-fit:fill;pointer-events:none;filter:drop-shadow(0 .13cqw .16cqw #3b1d0a77)}
#modalRoot .hof-page .hof-tab:hover{transform:translateY(-.18cqw);filter:brightness(1.1)}
#modalRoot .hof-page .hof-tab.is-active{transform:translateY(-.18cqw);filter:brightness(1.16) drop-shadow(0 0 .42cqw #ffd65b)}
#modalRoot .hof-page .hof-tab:focus-visible{outline:.18cqw solid #fff0a2;outline-offset:.04cqw;border-radius:.5cqw}
#modalRoot .hof-page .hof-body-host{flex:1 1 0;min-height:0;overflow:hidden}
#modalRoot .hof-page .hof-body{width:100%;height:100%;min-height:0;display:grid;gap:.55cqw}
#modalRoot .hof-page .hof-panel{
  min-width:0;min-height:0;display:flex;flex-direction:column;gap:.38cqw;padding:.48cqw .56cqw .55cqw;
  overflow:hidden;border:.12cqw solid #c18a3c;border-radius:.9cqw;
  background:linear-gradient(180deg,rgba(255,244,211,.94),rgba(239,207,145,.9));
  box-shadow:inset 0 .12cqw .12cqw #fff6d9,0 .12cqw .2cqw #74451b44;
}
#modalRoot .hof-page .hof-panel-title{
  position:relative;flex:0 0 auto;min-height:1.8cqw;display:flex;align-items:center;justify-content:center;gap:.34cqw;
  padding:.14cqw .5cqw .22cqw;border-radius:.42cqw;
  color:#fff0bd;font:900 1.04cqw/1 Georgia,"Times New Roman",serif;text-align:center;
  text-shadow:0 .09cqw .12cqw #3d1107;
  background:linear-gradient(180deg,#8e1a12,#4a0808 60%,#8a180d);
  border:.1cqw solid #d9a83c;box-shadow:inset 0 .08cqw #ffe8a766,0 .1cqw .12cqw #58280f66;
}
#modalRoot .hof-page .hof-panel-title img{max-width:1.7cqw;max-height:1.45cqw;object-fit:contain;filter:drop-shadow(0 .06cqw .08cqw #230e05)}
#modalRoot .hof-page .hof-img{display:block;object-fit:contain;max-width:100%;max-height:100%;filter:drop-shadow(0 .06cqw .08cqw #4c2a1244)}
#modalRoot .hof-page .hof-bar{display:block;width:100%;height:.5cqw;min-height:4px;overflow:hidden;border:.07cqw solid #79552e;border-radius:99px;background:linear-gradient(#9a754c,#68431f);box-shadow:inset 0 .06cqw .08cqw #3a1c0b66}
#modalRoot .hof-page .hof-bar i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#39a925,#a5ec61 55%,#48aa22);box-shadow:inset 0 .05cqw #eaffb7}
#modalRoot .hof-page .hof-bar--gold i{background:linear-gradient(90deg,#c78319,#ffdf6d 55%,#d18a1a)}
#modalRoot .hof-page .hof-bar--easy i{background:linear-gradient(90deg,#238d24,#a4ea66)}
#modalRoot .hof-page .hof-bar--medium i{background:linear-gradient(90deg,#1c5eb5,#68b5ff)}
#modalRoot .hof-page .hof-bar--hard i{background:linear-gradient(90deg,#7a2cbd,#d1a0ff)}
#modalRoot .hof-page .hof-bar--expert i{background:linear-gradient(90deg,#b92c18,#ff9a66)}

/* Overview */
#modalRoot .hof-page .hof-body-overview{grid-template-columns:1.1fr .9fr;grid-template-rows:1.12fr .9fr}
#modalRoot .hof-page .hof-record-layout{flex:1;min-height:0;display:grid;grid-template-columns:.58fr 1fr;gap:.45cqw;align-items:stretch}
#modalRoot .hof-page .hof-player-card{min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.12cqw;padding:.32cqw;border:.1cqw solid #d7a75a;border-radius:.65cqw;background:rgba(255,248,224,.56);text-align:center}
#modalRoot .hof-page .hof-player-avatar{width:4.6cqw;height:4.6cqw;object-fit:contain;border:.15cqw solid #c48a31;border-radius:50%;background:radial-gradient(#fff6ce,#d49b42);box-shadow:0 0 .28cqw #a9783266}
#modalRoot .hof-page .hof-player-card strong{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.93cqw;color:#5c2e10}
#modalRoot .hof-page .hof-player-card small{font-size:.64cqw;font-weight:700;color:#76512a}
#modalRoot .hof-page .hof-small-action{display:inline-flex;align-items:center;justify-content:center;min-height:1.35cqw;padding:.18cqw .55cqw;border:.08cqw solid #684019;border-radius:99px;background:linear-gradient(#f4d06e,#bd7d23);color:#4b2409;font:900 .67cqw Georgia,serif;box-shadow:inset 0 .07cqw #fff8cf,0 .07cqw .1cqw #4b250c55;cursor:pointer}
#modalRoot .hof-page .hof-small-action:hover{filter:brightness(1.1)}
#modalRoot .hof-page .hof-stat-grid{min-height:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(3,1fr);gap:.27cqw}
#modalRoot .hof-page .hof-stat-cell{min-width:0;min-height:0;display:grid;grid-template-columns:1.7cqw 1fr;grid-template-rows:auto auto;align-content:center;align-items:center;column-gap:.28cqw;padding:.18cqw .28cqw;border:.07cqw solid #d6ad68;border-radius:.42cqw;background:rgba(255,249,228,.65)}
#modalRoot .hof-page .hof-stat-icon{grid-row:1/3;width:1.55cqw;height:1.55cqw;display:grid;place-items:center}
#modalRoot .hof-page .hof-stat-icon img{width:100%;height:100%}
#modalRoot .hof-page .hof-stat-label{font-size:.64cqw;font-weight:800;line-height:1.05;color:#6b4824;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#modalRoot .hof-page .hof-stat-cell strong{font-size:1.08cqw;line-height:1.05;color:#49220d}
#modalRoot .hof-page .hof-ranking-panel{gap:.34cqw}
#modalRoot .hof-page .hof-rank-card{display:grid;grid-template-columns:2.35cqw 1fr auto;align-items:center;gap:.42cqw;min-height:2.28cqw;padding:.24cqw .38cqw;border:.08cqw solid #d2a35b;border-radius:.55cqw;background:linear-gradient(90deg,#fff5d7,#f2d89e)}
#modalRoot .hof-page .hof-rank-card>img{width:2.2cqw;height:2.1cqw;object-fit:contain}
#modalRoot .hof-page .hof-rank-card div{display:flex;flex-direction:column;min-width:0}
#modalRoot .hof-page .hof-rank-card strong{font-size:.83cqw;color:#55290e}
#modalRoot .hof-page .hof-rank-card small{font-size:.63cqw;color:#78552d}
#modalRoot .hof-page .hof-rank-card>b{font-size:.95cqw;color:#8d190f;text-align:right}
#modalRoot .hof-page .hof-unranked-state{display:flex;align-items:center;gap:.38cqw;margin-top:auto;padding:.36cqw .42cqw;border:.08cqw dashed #ad8043;border-radius:.5cqw;background:#fff1cd99}
#modalRoot .hof-page .hof-unranked-emblem{flex:0 0 2.2cqw;height:2cqw}
#modalRoot .hof-page .hof-unranked-emblem img{width:100%;height:100%;object-fit:contain}
#modalRoot .hof-page .hof-unranked-state>div:nth-child(2){flex:1;min-width:0}
#modalRoot .hof-page .hof-unranked-state strong{display:block;font-size:.78cqw;color:#772017}
#modalRoot .hof-page .hof-unranked-state p{margin:.08cqw 0;font-size:.61cqw;line-height:1.18;color:#634323}
#modalRoot .hof-page .hof-unranked-state small{display:block;font-size:.56cqw;line-height:1.15;color:#84633b}
#modalRoot .hof-page .hof-unranked-state .hof-small-action{flex:none}
#modalRoot .hof-page .hof-difficulty-panel{gap:.32cqw}
#modalRoot .hof-page .hof-difficulty-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.32cqw;flex:1;min-height:0}
#modalRoot .hof-page .hof-difficulty-card{min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.12cqw;padding:.2cqw;border:.08cqw solid #cc9a4d;border-radius:.55cqw;background:rgba(255,249,228,.7);text-align:center}
#modalRoot .hof-page .hof-difficulty-card img{width:2.65cqw;height:2.3cqw}
#modalRoot .hof-page .hof-difficulty-card strong{font-size:.78cqw}
#modalRoot .hof-page .hof-difficulty-card b{font-size:.9cqw}
#modalRoot .hof-page .hof-difficulty-card small{font-size:.58cqw;font-weight:800;color:#79572f}
#modalRoot .hof-page .hof-difficulty-card .hof-bar{height:.42cqw}
#modalRoot .hof-page .hof-milestone-track{display:flex;align-items:center;justify-content:space-around;gap:.25cqw;padding:.18cqw .15cqw .08cqw;border-radius:.5cqw;background:rgba(255,247,219,.65)}
#modalRoot .hof-page .hof-milestone{display:flex;flex-direction:column;align-items:center;gap:.12cqw;color:#714a21}
#modalRoot .hof-page .hof-milestone b{font-size:.74cqw}
#modalRoot .hof-page .hof-milestone span{width:1.65cqw;height:1.65cqw;display:grid;place-items:center;border:.1cqw solid #9e733d;border-radius:50%;background:linear-gradient(#fff0c3,#c69a53);font-size:.8cqw;font-weight:900;box-shadow:0 .08cqw .1cqw #55320e55}
#modalRoot .hof-page .hof-milestone.is-reached span{background:linear-gradient(#9aef69,#248f24);color:#fff;border-color:#287c1b}
#modalRoot .hof-page .hof-milestone-summary{margin:.05cqw 0;font-size:.74cqw;font-weight:900;text-align:center;color:#6d3817}
#modalRoot .hof-page .hof-milestone-panel>small{font-size:.58cqw;text-align:center;color:#785b38}

/* Common category navigation */
#modalRoot .hof-page .hof-body-leaderboards,
#modalRoot .hof-page .hof-body-fame,
#modalRoot .hof-page .hof-body-collections{grid-template-columns:22% 1fr}
#modalRoot .hof-page .hof-category-panel{gap:.38cqw}
#modalRoot .hof-page .hof-category-panel .hof-panel-title{font-size:.85cqw;min-height:1.75cqw}
#modalRoot .hof-page .hof-category-panel .hof-panel-title img{max-width:1.3cqw}
#modalRoot .hof-page .hof-category-list{display:flex;flex-direction:column;gap:.25cqw;flex:1;min-height:0;overflow:auto;padding-right:.08cqw;scrollbar-width:thin;scrollbar-color:#b98439 #f4dfb1}
#modalRoot .hof-page .hof-category-btn{display:flex;align-items:center;gap:.32cqw;min-height:2.55cqw;padding:.24cqw .3cqw;border:.08cqw solid #c99a53;border-radius:.48cqw;background:linear-gradient(#fff1ce,#e7c37f);color:#4f2b12;text-align:left;font:800 .69cqw/1.08 Georgia,serif;cursor:pointer;box-shadow:inset 0 .06cqw #fff8d9}
#modalRoot .hof-page .hof-category-btn img{flex:0 0 1.85cqw;width:1.85cqw;height:1.75cqw;object-fit:contain}
#modalRoot .hof-page .hof-category-btn span{min-width:0}
#modalRoot .hof-page .hof-category-btn strong{display:block}
#modalRoot .hof-page .hof-category-btn small{display:block;font-size:.58cqw;font-weight:700;color:#77552f}
#modalRoot .hof-page .hof-category-btn:hover{filter:brightness(1.09)}
#modalRoot .hof-page .hof-category-btn.is-active{color:#fff4cf;background:linear-gradient(#2677c6,#134b92);border-color:#f5c95e;box-shadow:inset 0 .08cqw #fff6a5,0 0 0 .12cqw #d99a2b;text-shadow:0 .07cqw .1cqw #1d210d}
#modalRoot .hof-page .hof-category-btn.is-active small{color:#f8dfab}

/* Leaderboards */
#modalRoot .hof-page .hof-leader-main{gap:.4cqw}
#modalRoot .hof-page .hof-leader-head{position:relative;display:grid;grid-template-columns:1fr auto;grid-template-rows:2.2cqw auto;align-items:center;gap:.18cqw .45cqw;min-height:3.2cqw}
#modalRoot .hof-page .hof-leader-head>img{position:absolute;left:6%;top:0;width:62%;height:2.5cqw;object-fit:fill;pointer-events:none}
#modalRoot .hof-page .hof-leader-head>div:first-of-type{position:relative;z-index:1;grid-column:1;grid-row:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding-right:28%;color:#fff0bd;text-shadow:0 .07cqw .1cqw #3d1107}
#modalRoot .hof-page .hof-leader-head>div:first-of-type strong{font-size:.92cqw}
#modalRoot .hof-page .hof-leader-head>div:first-of-type small{font-size:.55cqw}
#modalRoot .hof-page .hof-periods{grid-column:2;grid-row:1;display:flex;align-items:center;gap:.18cqw}
#modalRoot .hof-page .hof-period-btn{min-width:4.15cqw;padding:.26cqw .44cqw;border:.08cqw solid #b87d32;border-radius:.3cqw;background:linear-gradient(#fff2d0,#dfb56c);color:#5b3414;font:900 .66cqw Georgia,serif;cursor:pointer;box-shadow:inset 0 .05cqw #fff9d9}
#modalRoot .hof-page .hof-period-btn.is-active{background:linear-gradient(#ffeb9c,#c8851c);border-color:#fff0a2;box-shadow:0 0 0 .08cqw #d5951f,inset 0 .08cqw #fff9c9}
#modalRoot .hof-page .hof-table-head{display:grid;grid-template-columns:.55fr 1.6fr 1.35fr 1fr;gap:.2cqw;padding:.36cqw .48cqw;border:.08cqw solid #8d541e;border-radius:.42cqw;background:linear-gradient(#6e3214,#3d1709);color:#fff0c3;font-size:.72cqw;font-weight:900;text-align:center}
#modalRoot .hof-page .hof-leader-empty{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.32cqw;padding:.5cqw 1cqw;text-align:center;border:.09cqw dashed #b58a4a;border-radius:.6cqw;background:rgba(255,247,220,.58)}
#modalRoot .hof-page .hof-leader-empty img{width:5cqw;height:3.8cqw;object-fit:contain}
#modalRoot .hof-page .hof-leader-empty strong{font-size:.93cqw;color:#713114}
#modalRoot .hof-page .hof-leader-empty p{max-width:75%;margin:0;font-size:.68cqw;line-height:1.25;color:#6c4a26}
#modalRoot .hof-page .hof-your-rank-strip{position:relative;display:grid;grid-template-columns:1.05fr .75fr 1.3fr 1fr;gap:.35cqw;align-items:center;min-height:3.1cqw;padding:.3cqw .5cqw;border:.1cqw solid #bc8a36;border-radius:.55cqw;background:linear-gradient(90deg,#fff0c5,#edca7d);box-shadow:inset 0 .1cqw #fff6d7,0 .1cqw .14cqw #73441d55}
#modalRoot .hof-page .hof-your-rank-banner{width:100%;height:2.1cqw;object-fit:contain}
#modalRoot .hof-page .hof-your-rank-position{text-align:center;border-left:.08cqw solid #c79a4c}
#modalRoot .hof-page .hof-your-rank-position strong{display:block;color:#8d1a11;font-size:.94cqw}
#modalRoot .hof-page .hof-your-rank-position small{display:block;font-size:.56cqw}
#modalRoot .hof-page .hof-your-rank-player{display:flex;align-items:center;gap:.28cqw;min-width:0;border-left:.08cqw solid #c79a4c;padding-left:.35cqw}
#modalRoot .hof-page .hof-your-rank-player img{width:2.3cqw;height:2.25cqw;object-fit:contain}
#modalRoot .hof-page .hof-your-rank-player div{min-width:0}
#modalRoot .hof-page .hof-your-rank-player strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.74cqw}
#modalRoot .hof-page .hof-your-rank-player small{font-size:.56cqw}
#modalRoot .hof-page .hof-your-rank-value{text-align:center;border-left:.08cqw solid #c79a4c}
#modalRoot .hof-page .hof-your-rank-value strong{display:block;font-size:.95cqw;color:#622812}
#modalRoot .hof-page .hof-your-rank-value small{font-size:.56cqw}
#modalRoot .hof-page .hof-data-note{flex:none;margin:0;text-align:center;font-size:.55cqw;line-height:1.2;color:#795934}

/* Hall of Fame */
#modalRoot .hof-page .hof-fame-main{gap:.5cqw}
#modalRoot .hof-page .hof-fame-hero{display:grid;grid-template-columns:4.8cqw 1fr auto;align-items:center;gap:.5cqw;padding:.5cqw;border:.1cqw solid #c5923e;border-radius:.65cqw;background:linear-gradient(90deg,#ffe6a6,#fff5d6,#e8c17a)}
#modalRoot .hof-page .hof-fame-emblem{width:4.5cqw;height:4.5cqw;object-fit:contain}
#modalRoot .hof-page .hof-fame-hero span{font-size:.57cqw;font-weight:900;letter-spacing:.15em;color:#87531e}
#modalRoot .hof-page .hof-fame-hero h3{margin:.08cqw 0;font-size:1.25cqw;color:#6a2311}
#modalRoot .hof-page .hof-fame-hero p{margin:0;font-size:.67cqw;color:#704b23}
#modalRoot .hof-page .hof-fame-target{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:4.5cqw;padding:.3cqw;border:.09cqw solid #b47b2d;border-radius:.55cqw;background:linear-gradient(#fff1c0,#d9a449);font-size:1.5cqw;color:#742313}
#modalRoot .hof-page .hof-fame-target small{font-size:.57cqw;color:#603b18}
#modalRoot .hof-page .hof-your-milestone{display:flex;flex-direction:column;gap:.38cqw;padding:.55cqw .62cqw;border:.08cqw solid #d0a25b;border-radius:.6cqw;background:rgba(255,249,227,.65)}
#modalRoot .hof-page .hof-your-milestone-player{display:flex;align-items:center;gap:.38cqw}
#modalRoot .hof-page .hof-your-milestone-player img{width:2.5cqw;height:2.5cqw}
#modalRoot .hof-page .hof-your-milestone-player div{display:flex;flex-direction:column;flex:1}
#modalRoot .hof-page .hof-your-milestone-player strong{font-size:.85cqw}
#modalRoot .hof-page .hof-your-milestone-player small{font-size:.59cqw;color:#76532d}
#modalRoot .hof-page .hof-your-milestone-player>b{padding:.22cqw .7cqw;border:.08cqw solid #a16c2d;border-radius:99px;background:#f4d28c;font-size:.65cqw;color:#694217}
#modalRoot .hof-page .hof-your-milestone-player>b.is-reached{background:linear-gradient(#a6ed71,#318b22);color:#fff;border-color:#347d1c}
#modalRoot .hof-page .hof-milestone-count{font-size:.74cqw;font-weight:800;color:#714a23}
#modalRoot .hof-page .hof-milestone-count strong{font-size:1.4cqw;color:#762313}
#modalRoot .hof-page .hof-your-milestone p{margin:0;font-size:.63cqw;color:#6d4c27}
#modalRoot .hof-page .hof-global-honorees{display:flex;align-items:center;gap:.48cqw;margin-top:auto;padding:.48cqw;border:.08cqw dashed #ad8043;border-radius:.55cqw;background:#fff0cb99}
#modalRoot .hof-page .hof-global-honorees img{width:3.1cqw;height:2.6cqw}
#modalRoot .hof-page .hof-global-honorees strong{font-size:.76cqw;color:#713015}
#modalRoot .hof-page .hof-global-honorees p{margin:.1cqw 0 0;font-size:.61cqw;line-height:1.2;color:#704d28}

/* Achievements */
#modalRoot .hof-page .hof-body-achievements{grid-template-columns:17% 1fr;grid-template-rows:1fr}
#modalRoot .hof-page .hof-ach-summary{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.42cqw;padding:.5cqw;border:.1cqw solid #c48a3c;border-radius:.65cqw;background:linear-gradient(#fff1c6,#e6bf78);text-align:center}
#modalRoot .hof-page .hof-ach-summary>img{width:5.2cqw;height:5.2cqw;object-fit:contain}
#modalRoot .hof-page .hof-ach-summary div{display:flex;flex-direction:column;gap:.1cqw}
#modalRoot .hof-page .hof-ach-summary strong{font-size:1.3cqw;color:#6e220f}
#modalRoot .hof-page .hof-ach-summary span{font-size:.62cqw;font-weight:800}
#modalRoot .hof-page .hof-ach-list{gap:.35cqw}
#modalRoot .hof-page .hof-ach-filters{display:flex;gap:.22cqw;flex-wrap:wrap}
#modalRoot .hof-page .hof-filter-chip{padding:.18cqw .43cqw;border:.07cqw solid #b88845;border-radius:99px;background:linear-gradient(#fff0c8,#e6c17d);font:800 .58cqw Georgia,serif;color:#5c3818;cursor:pointer}
#modalRoot .hof-page .hof-filter-chip.is-active{background:linear-gradient(#226db6,#15477f);color:#fff0c6;border-color:#f2ca62}
#modalRoot .hof-page .hof-achievement-grid{flex:1;min-height:0;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:.34cqw;overflow:auto;align-content:stretch}
#modalRoot .hof-page .hof-achievement-card{display:flex;flex-direction:column;align-items:center;gap:.18cqw;min-width:0;min-height:0;padding:.32cqw;border:.08cqw solid #c99850;border-radius:.58cqw;background:linear-gradient(#fff5d8,#eacf91);text-align:center}
#modalRoot .hof-page .hof-achievement-card.is-locked{filter:saturate(.82)}
#modalRoot .hof-page .hof-achievement-art{position:relative;display:grid;place-items:center;flex:none;width:4.1cqw;height:3.45cqw;border-radius:.5cqw;background:radial-gradient(#fff9d8,#e6bd6b);border:.07cqw solid #bd8d43}
#modalRoot .hof-page .hof-achievement-art img{width:88%;height:88%;object-fit:contain}
#modalRoot .hof-page .hof-achievement-check{position:absolute;right:.06cqw;top:.02cqw;width:1.05cqw;height:1.05cqw;display:grid;place-items:center;border-radius:50%;background:#319b28;color:#fff;font-weight:900;font-size:.74cqw}
#modalRoot .hof-page .hof-achievement-card>strong{font-size:.72cqw;line-height:1.08;color:#5d2b12}
#modalRoot .hof-page .hof-achievement-card p{min-height:2em;margin:0;font-size:.57cqw;line-height:1.15;color:#6d4c2a}
#modalRoot .hof-page .hof-achievement-progress-label{width:100%;display:flex;justify-content:space-between;gap:.2cqw;font-size:.57cqw;font-weight:900}
#modalRoot .hof-page .hof-achievement-card .hof-bar{height:.46cqw}
#modalRoot .hof-page .hof-achievement-card>small{font-size:.57cqw;font-weight:900;color:#397a23}
#modalRoot .hof-page .hof-empty-copy{grid-column:1/-1;text-align:center;font-size:.8cqw}

/* Collections */
#modalRoot .hof-page .hof-collection-main{gap:.4cqw}
#modalRoot .hof-page .hof-collection-detail{flex:1;min-height:0;display:flex;flex-direction:column;gap:.42cqw;justify-content:center}
#modalRoot .hof-page .hof-collection-overview-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,1fr);gap:.38cqw;flex:1;min-height:0}
#modalRoot .hof-page .hof-collection-stat{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.12cqw;min-width:0;padding:.35cqw;border:.08cqw solid #d0a158;border-radius:.58cqw;background:rgba(255,249,227,.7);text-align:center}
#modalRoot .hof-page .hof-collection-stat>img{width:3.3cqw;height:2.5cqw}
#modalRoot .hof-page .hof-collection-stat strong{font-size:1.08cqw;color:#6c2612}
#modalRoot .hof-page .hof-collection-stat span{font-size:.69cqw;font-weight:900}
#modalRoot .hof-page .hof-collection-stat small{font-size:.56cqw;color:#75512a}
#modalRoot .hof-page .hof-collection-stat .hof-bar{width:90%;height:.42cqw}
#modalRoot .hof-page .hof-relic-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:.45cqw}
#modalRoot .hof-page .hof-relic-card{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.2cqw;padding:.4cqw .25cqw;border:.08cqw solid #d0a158;border-radius:.6cqw;background:rgba(255,249,227,.7)}
#modalRoot .hof-page .hof-relic-card img{width:4cqw;height:3.7cqw}
#modalRoot .hof-page .hof-relic-card strong{font-size:.75cqw}
#modalRoot .hof-page .hof-relic-card b{font-size:1.35cqw;color:#742411}
#modalRoot .hof-page .hof-relic-card small{font-size:.58cqw;color:#76542c}
#modalRoot .hof-page .hof-untracked-collection{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.35cqw;min-height:8cqw;padding:.75cqw;text-align:center;border:.09cqw dashed #b78b4c;border-radius:.7cqw;background:rgba(255,247,218,.6)}
#modalRoot .hof-page .hof-untracked-collection img{width:4.6cqw;height:3.7cqw}
#modalRoot .hof-page .hof-untracked-collection strong{font-size:.94cqw;color:#713014}
#modalRoot .hof-page .hof-untracked-collection p{max-width:80%;margin:0;font-size:.67cqw;line-height:1.22;color:#6e4f2a}
#modalRoot .hof-page .hof-untracked-collection span{font-size:.6cqw;font-weight:900;color:#8c531b}
#modalRoot .hof-page .hof-collection-rank-note{display:flex;align-items:center;gap:.4cqw;padding:.38cqw .5cqw;border:.08cqw dashed #b58a49;border-radius:.55cqw;background:#fff1ce99}
#modalRoot .hof-page .hof-collection-rank-note img{width:2.5cqw;height:2.4cqw}
#modalRoot .hof-page .hof-collection-rank-note div{display:flex;flex-direction:column;gap:.08cqw}
#modalRoot .hof-page .hof-collection-rank-note strong{font-size:.72cqw;color:#702717}
#modalRoot .hof-page .hof-collection-rank-note small{font-size:.58cqw;color:#6e4e2a}

/* Small laptop and portrait/tall screens: retain full controls and allow content scrolling. */
@media(max-width:1100px){
 #modalRoot .hof-page .hof-root{font-size:1cqw}
 #modalRoot .hof-page .hof-body{gap:.48cqw}
 #modalRoot .hof-page .hof-stat-label{font-size:.72cqw}
 #modalRoot .hof-page .hof-stat-cell strong{font-size:1.2cqw}
 #modalRoot .hof-page .hof-category-btn{font-size:.78cqw}
}
@media(max-aspect-ratio:1/1){
 #modalRoot .hof-page .settings-scene{width:100vw;height:100dvh;aspect-ratio:auto;container-type:inline-size}
 #modalRoot .hof-page .settings-art{object-fit:cover;object-position:50% 12%;filter:brightness(.66)}
 #modalRoot .hof-page .hof-crest{left:3%;top:1.3%;width:15%;height:12%}
 #modalRoot .hof-page .hof-heading{left:18%;top:2%;width:68%;height:10%}
 #modalRoot .hof-page .hof-heading h2{font-size:5.2cqw}
 #modalRoot .hof-page .hof-heading p{font-size:1.75cqw}
 #modalRoot .hof-page .hof-close{right:2.4%;top:1.6%;width:9%;height:8%}
 #modalRoot .hof-page .hof-content{left:3%;top:13%;width:94%;height:84%;padding:.8cqw;border:.35cqw solid #b7833d;border-radius:2cqw;background:rgba(250,231,188,.94);box-shadow:0 1cqw 2cqw #22120566;overflow:auto}
 #modalRoot .hof-page .hof-root{min-height:100%;height:auto;font-size:2.55cqw;gap:1.1cqw}
 #modalRoot .hof-page .hof-tabs{flex:0 0 auto;height:13cqw;gap:.35cqw}
 #modalRoot .hof-page .hof-body-host{flex:none;min-height:0;overflow:visible}
 #modalRoot .hof-page .hof-body{height:auto;min-height:0;grid-template-columns:1fr;grid-template-rows:auto;gap:1cqw}
 #modalRoot .hof-page .hof-panel{min-height:22cqw;padding:1cqw;gap:.75cqw;border-width:.25cqw;border-radius:1.5cqw}
 #modalRoot .hof-page .hof-panel-title{min-height:4.5cqw;font-size:2.8cqw;padding:.5cqw}
 #modalRoot .hof-page .hof-panel-title img{max-width:3.6cqw;max-height:3.4cqw}
 #modalRoot .hof-page .hof-body-overview{grid-template-columns:1fr;grid-template-rows:auto}
 #modalRoot .hof-page .hof-record-layout{grid-template-columns:.7fr 1fr;gap:.7cqw}
 #modalRoot .hof-page .hof-player-avatar{width:12cqw;height:12cqw}
 #modalRoot .hof-page .hof-player-card strong{font-size:2.2cqw}
 #modalRoot .hof-page .hof-player-card small{font-size:1.7cqw}
 #modalRoot .hof-page .hof-small-action{min-height:4cqw;padding:.5cqw 1cqw;font-size:1.7cqw}
 #modalRoot .hof-page .hof-stat-grid{gap:.55cqw}
 #modalRoot .hof-page .hof-stat-cell{grid-template-columns:5cqw 1fr;padding:.55cqw;gap:.35cqw;border-radius:.8cqw}
 #modalRoot .hof-page .hof-stat-icon{width:4.8cqw;height:4.8cqw}
 #modalRoot .hof-page .hof-stat-label{font-size:1.75cqw}
 #modalRoot .hof-page .hof-stat-cell strong{font-size:2.6cqw}
 #modalRoot .hof-page .hof-rank-card{grid-template-columns:6cqw 1fr auto;min-height:7cqw;padding:.6cqw;gap:.6cqw}
 #modalRoot .hof-page .hof-rank-card>img{width:5.7cqw;height:5.4cqw}
 #modalRoot .hof-page .hof-rank-card strong{font-size:2.25cqw}
 #modalRoot .hof-page .hof-rank-card small{font-size:1.7cqw}
 #modalRoot .hof-page .hof-rank-card>b{font-size:2.4cqw}
 #modalRoot .hof-page .hof-unranked-emblem{flex-basis:6cqw;height:6cqw}
 #modalRoot .hof-page .hof-unranked-state strong{font-size:2.05cqw}
 #modalRoot .hof-page .hof-unranked-state p{font-size:1.7cqw}
 #modalRoot .hof-page .hof-unranked-state small{font-size:1.45cqw}
 #modalRoot .hof-page .hof-difficulty-grid{gap:.6cqw}
 #modalRoot .hof-page .hof-difficulty-card{gap:.35cqw;padding:.6cqw}
 #modalRoot .hof-page .hof-difficulty-card img{width:8cqw;height:7cqw}
 #modalRoot .hof-page .hof-difficulty-card strong{font-size:2cqw}
 #modalRoot .hof-page .hof-difficulty-card b{font-size:2.25cqw}
 #modalRoot .hof-page .hof-difficulty-card small{font-size:1.6cqw}
 #modalRoot .hof-page .hof-difficulty-card .hof-bar{height:1cqw}
 #modalRoot .hof-page .hof-milestone span{width:5cqw;height:5cqw;font-size:2.5cqw}
 #modalRoot .hof-page .hof-milestone b{font-size:2cqw}
 #modalRoot .hof-page .hof-milestone-summary{font-size:2.1cqw}
 #modalRoot .hof-page .hof-milestone-panel>small{font-size:1.65cqw}
 #modalRoot .hof-page .hof-body-leaderboards,
 #modalRoot .hof-page .hof-body-fame,
 #modalRoot .hof-page .hof-body-collections{grid-template-columns:1fr}
 #modalRoot .hof-page .hof-category-panel{min-height:0}
 #modalRoot .hof-page .hof-category-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.55cqw}
 #modalRoot .hof-page .hof-category-btn{min-height:7.2cqw;padding:.6cqw;font-size:1.9cqw;gap:.6cqw}
 #modalRoot .hof-page .hof-category-btn img{flex-basis:5cqw;width:5cqw;height:5cqw}
 #modalRoot .hof-page .hof-category-btn small{font-size:1.5cqw}
 #modalRoot .hof-page .hof-leader-head{grid-template-rows:8cqw auto;min-height:12cqw}
 #modalRoot .hof-page .hof-leader-head>img{height:7cqw}
 #modalRoot .hof-page .hof-leader-head>div:first-of-type strong{font-size:2.3cqw}
 #modalRoot .hof-page .hof-leader-head>div:first-of-type small{font-size:1.5cqw}
 #modalRoot .hof-page .hof-period-btn{min-width:12cqw;padding:1cqw;font-size:1.7cqw}
 #modalRoot .hof-page .hof-table-head{font-size:1.9cqw;padding:.8cqw}
 #modalRoot .hof-page .hof-leader-empty{min-height:26cqw;padding:2cqw}
 #modalRoot .hof-page .hof-leader-empty img{width:16cqw;height:12cqw}
 #modalRoot .hof-page .hof-leader-empty strong{font-size:2.5cqw}
 #modalRoot .hof-page .hof-leader-empty p{font-size:1.8cqw;max-width:95%}
 #modalRoot .hof-page .hof-your-rank-strip{grid-template-columns:1fr 1fr;min-height:15cqw;padding:.8cqw;gap:.8cqw}
 #modalRoot .hof-page .hof-your-rank-banner{height:7cqw}
 #modalRoot .hof-page .hof-your-rank-position strong{font-size:2.4cqw}
 #modalRoot .hof-page .hof-your-rank-position small{font-size:1.6cqw}
 #modalRoot .hof-page .hof-your-rank-player img{width:7cqw;height:7cqw}
 #modalRoot .hof-page .hof-your-rank-player strong{font-size:2cqw}
 #modalRoot .hof-page .hof-your-rank-player small{font-size:1.5cqw}
 #modalRoot .hof-page .hof-your-rank-value strong{font-size:2.6cqw}
 #modalRoot .hof-page .hof-your-rank-value small{font-size:1.55cqw}
 #modalRoot .hof-page .hof-data-note{font-size:1.55cqw}
 #modalRoot .hof-page .hof-fame-hero{grid-template-columns:12cqw 1fr auto;padding:1.1cqw;gap:1cqw}
 #modalRoot .hof-page .hof-fame-emblem{width:11cqw;height:11cqw}
 #modalRoot .hof-page .hof-fame-hero span{font-size:1.5cqw}
 #modalRoot .hof-page .hof-fame-hero h3{font-size:3cqw}
 #modalRoot .hof-page .hof-fame-hero p{font-size:1.8cqw}
 #modalRoot .hof-page .hof-fame-target{min-width:12cqw;font-size:3.6cqw}
 #modalRoot .hof-page .hof-fame-target small{font-size:1.5cqw}
 #modalRoot .hof-page .hof-your-milestone{padding:1.2cqw;gap:1cqw}
 #modalRoot .hof-page .hof-your-milestone-player img{width:7cqw;height:7cqw}
 #modalRoot .hof-page .hof-your-milestone-player strong{font-size:2.3cqw}
 #modalRoot .hof-page .hof-your-milestone-player small{font-size:1.6cqw}
 #modalRoot .hof-page .hof-your-milestone-player>b{font-size:1.7cqw}
 #modalRoot .hof-page .hof-milestone-count{font-size:1.8cqw}
 #modalRoot .hof-page .hof-milestone-count strong{font-size:3.2cqw}
 #modalRoot .hof-page .hof-your-milestone p{font-size:1.7cqw}
 #modalRoot .hof-page .hof-global-honorees img{width:8cqw;height:7cqw}
 #modalRoot .hof-page .hof-global-honorees strong{font-size:1.9cqw}
 #modalRoot .hof-page .hof-global-honorees p{font-size:1.6cqw}
 #modalRoot .hof-page .hof-body-achievements{grid-template-columns:1fr;grid-template-rows:auto}
 #modalRoot .hof-page .hof-ach-summary{flex-direction:row;min-height:12cqw;padding:1cqw}
 #modalRoot .hof-page .hof-ach-summary>img{width:9cqw;height:9cqw}
 #modalRoot .hof-page .hof-ach-summary strong{font-size:3.2cqw}
 #modalRoot .hof-page .hof-ach-summary span{font-size:1.6cqw}
 #modalRoot .hof-page .hof-filter-chip{font-size:1.65cqw;padding:.7cqw 1.2cqw}
 #modalRoot .hof-page .hof-achievement-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:.8cqw;overflow:visible}
 #modalRoot .hof-page .hof-achievement-card{min-height:35cqw;padding:1cqw;gap:.5cqw}
 #modalRoot .hof-page .hof-achievement-art{width:18cqw;height:14cqw}
 #modalRoot .hof-page .hof-achievement-card>strong{font-size:2.1cqw}
 #modalRoot .hof-page .hof-achievement-card p{font-size:1.6cqw}
 #modalRoot .hof-page .hof-achievement-progress-label{font-size:1.6cqw}
 #modalRoot .hof-page .hof-achievement-card .hof-bar{height:1cqw}
 #modalRoot .hof-page .hof-achievement-card>small{font-size:1.5cqw}
 #modalRoot .hof-page .hof-collection-overview-grid{gap:.7cqw}
 #modalRoot .hof-page .hof-collection-stat{min-height:24cqw;padding:1cqw;gap:.5cqw}
 #modalRoot .hof-page .hof-collection-stat>img{width:10cqw;height:8cqw}
 #modalRoot .hof-page .hof-collection-stat strong{font-size:2.8cqw}
 #modalRoot .hof-page .hof-collection-stat span{font-size:1.8cqw}
 #modalRoot .hof-page .hof-collection-stat small{font-size:1.5cqw}
 #modalRoot .hof-page .hof-collection-stat .hof-bar{height:1cqw}
 #modalRoot .hof-page .hof-relic-grid{gap:.7cqw}
 #modalRoot .hof-page .hof-relic-card{padding:1cqw;gap:.4cqw}
 #modalRoot .hof-page .hof-relic-card img{width:10cqw;height:9cqw}
 #modalRoot .hof-page .hof-relic-card strong{font-size:1.9cqw}
 #modalRoot .hof-page .hof-relic-card b{font-size:3.2cqw}
 #modalRoot .hof-page .hof-relic-card small{font-size:1.5cqw}
 #modalRoot .hof-page .hof-untracked-collection{min-height:32cqw;padding:2cqw;gap:1.1cqw}
 #modalRoot .hof-page .hof-untracked-collection img{width:12cqw;height:10cqw}
 #modalRoot .hof-page .hof-untracked-collection strong{font-size:2.5cqw}
 #modalRoot .hof-page .hof-untracked-collection p{font-size:1.8cqw}
 #modalRoot .hof-page .hof-untracked-collection span{font-size:1.6cqw}
 #modalRoot .hof-page .hof-collection-rank-note{padding:1cqw;gap:1cqw}
 #modalRoot .hof-page .hof-collection-rank-note img{width:8cqw;height:8cqw}
 #modalRoot .hof-page .hof-collection-rank-note strong{font-size:1.9cqw}
 #modalRoot .hof-page .hof-collection-rank-note small{font-size:1.55cqw}
}


/* ========================================================================== 
   STAGE 179 — DISTINCT PLAYER AVATARS
   Circular portraits are shared by login, profile, Player Stats and Hall of Faith.
   ========================================================================== */
.bh-auth-panel--avatar{width:min(960px,97vw);max-height:min(92vh,900px);padding:72px 8% 48px}
.bh-auth-content--avatar{width:100%;max-width:790px}
.bh-avatar-select h2{margin:0 0 6px;font:900 clamp(24px,4vw,30px) Georgia,serif;color:#542b15;text-shadow:0 1px #fff7}
.bh-avatar-select>.bh-auth-muted{max-width:620px;margin:0 auto 13px}
.bh-avatar-layout{display:grid;grid-template-columns:148px minmax(0,1fr);gap:15px;align-items:stretch;text-align:left}
.bh-avatar-preview{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;min-height:350px;padding:10px 8px;border:1px solid #bd8744;border-radius:14px;background:linear-gradient(145deg,#fff2c9e8,#e8c27dcc);box-shadow:inset 0 0 0 2px #fff6,0 3px 7px #5a351b33;text-align:center}
.bh-avatar-preview-image{width:116px;height:116px;object-fit:contain;filter:drop-shadow(0 3px 3px #4a260a66)}
.bh-avatar-preview strong{max-width:100%;color:#512c13;font:900 14px Georgia,serif}
.bh-avatar-preview small{color:#956027;font:900 9px Georgia,serif;letter-spacing:.17em}
.bh-avatar-browser{min-width:0}
.bh-avatar-filters{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 8px}
.bh-avatar-filter{min-height:30px;padding:5px 13px;border:1px solid #a66a29;border-radius:999px;background:linear-gradient(#fff0c8,#dfb66b);color:#643b18;font:800 12px Georgia,serif;cursor:pointer;box-shadow:inset 0 1px #fff9}
.bh-avatar-filter.is-active{border-color:#5d2c0e;background:linear-gradient(#974e1d,#5d2d11);color:#fff0c5;box-shadow:0 2px 0 #4a230d,inset 0 1px #e6ad67}
.bh-avatar-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px;max-height:350px;overflow-y:auto;padding:4px 5px 6px 2px;scrollbar-width:thin;scrollbar-color:#b77a2a #f1d9a5}
.bh-avatar-option{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:2px;min-width:0;min-height:78px;padding:2px 1px 4px;border:1px solid transparent;border-radius:10px;background:transparent;color:#543016;cursor:pointer;transition:transform .12s,background .12s,border-color .12s}
.bh-avatar-option-image{display:block;width:58px;height:58px;object-fit:contain;filter:drop-shadow(0 1px 2px #3f220a55)}
.bh-avatar-option span{display:block;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;font:700 9px/1.2 Georgia,serif}
.bh-avatar-option i{position:absolute;top:1px;right:2px;display:none;width:19px;height:19px;border:2px solid #fff3c5;border-radius:50%;background:linear-gradient(#5bc83b,#26851b);color:white;font:900 12px/15px Arial,sans-serif;text-align:center;box-shadow:0 1px 3px #38200d88}
.bh-avatar-option:hover{transform:translateY(-2px);background:#fff1ce99}
.bh-avatar-option.is-selected{border-color:#a25d16;background:linear-gradient(#ffe99fdd,#dbac4ddd);box-shadow:inset 0 0 0 1px #fff8,0 1px 4px #70400e66}
.bh-avatar-option.is-selected i{display:block}
.bh-avatar-help{margin:8px 0 3px;color:#75491f;font:12px Georgia,serif;text-align:center}
.bh-avatar-confirm{display:block;width:min(320px,100%);margin:8px auto 0}
.bh-auth-account-avatar{width:104px;height:104px;margin:0 auto 9px;filter:drop-shadow(0 3px 4px #4a260a55)}
.bh-auth-account-avatar img{width:100%;height:100%;object-fit:contain}
.bh-auth-change-avatar{margin:0 0 8px}
.bh-auth-message.is-warning{background:#fff0cb;color:#714316;border:1px solid #c18b43}
#modalRoot .profile-page .pf-avatar-button{position:relative;display:block;padding:0;border:0;border-radius:50%;background:transparent;cursor:pointer;overflow:visible}
#modalRoot .profile-page .pf-avatar-button:focus-visible{outline:2px solid #9b641e;outline-offset:3px}
#modalRoot .profile-page .pf-avatar-button .pf-avatar-portrait{display:block;width:100%;height:100%;object-fit:contain}
#modalRoot .profile-page .pf-avatar-change-badge{position:absolute;right:-.12em;bottom:-.08em;width:1.8em;height:1.8em;padding:.2em;border:.12em solid #ffe6a4;border-radius:50%;background:linear-gradient(#9f531c,#5c2a0d);box-shadow:0 .08em .18em #3d220d88}
#modalRoot .profile-page .pf-avatar-change-badge img{display:block;width:100%;height:100%;object-fit:contain}
#modalRoot .hof-player-avatar{width:100%;height:100%;object-fit:contain}
@media(max-width:760px){
 .bh-auth-panel--avatar{width:min(960px,98vw);padding:62px 7% 38px}
 .bh-avatar-layout{grid-template-columns:112px minmax(0,1fr);gap:9px}
 .bh-avatar-preview{min-height:280px;padding:6px}
 .bh-avatar-preview-image{width:94px;height:94px}
 .bh-avatar-grid{grid-template-columns:repeat(4,minmax(0,1fr));max-height:292px;gap:4px}
 .bh-avatar-option-image{width:55px;height:55px}
}
@media(max-width:480px){
 .bh-avatar-layout{grid-template-columns:1fr;gap:8px}
 .bh-avatar-preview{min-height:0;display:grid;grid-template-columns:70px 1fr;grid-template-rows:auto auto;justify-content:start;text-align:left;padding:6px 12px}
 .bh-avatar-preview-image{grid-row:1/3;width:66px;height:66px}
 .bh-avatar-preview strong{text-align:left;align-self:end}
 .bh-avatar-preview small{text-align:left;align-self:start}
 .bh-avatar-grid{grid-template-columns:repeat(4,minmax(0,1fr));max-height:31vh}
 .bh-avatar-option{min-height:67px}
 .bh-avatar-option-image{width:49px;height:49px}
}


/* STAGE 180 — Compact bottom-right player HUD. All player data is live; the artwork is frame-only. */
#gamePage .game-player-hud{
  position:absolute;right:1.1%;bottom:22.5%;width:24%;height:auto;aspect-ratio:2170/704;
  z-index:12;pointer-events:none;isolation:isolate;
  filter:drop-shadow(0 .18em .3em #160b05a8);
}
#gamePage .game-player-hud-frame{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none;user-select:none}
#gamePage .game-player-hud-avatar{
  position:absolute;left:7.1%;top:5%;width:23%;height:72%;padding:0;border:0;border-radius:50%;
  background:transparent;display:grid;place-items:center;overflow:hidden;pointer-events:auto;cursor:pointer;
}
#gamePage .game-player-hud-avatar img{width:100%;height:100%;object-fit:contain;display:block;}
#gamePage .game-player-hud-name{
  position:absolute;left:34%;top:12%;width:54%;height:21%;padding:0;border:0;background:transparent;
  color:#fff5d9;font:900 clamp(10px,.88vw,16px)/1 Georgia,"Times New Roman",serif;
  text-align:left;text-shadow:0 2px 2px #321607,0 0 3px #321607;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:auto;cursor:pointer;
}
#gamePage .game-player-hud-title{
  position:absolute;left:42%;top:40%;width:38%;height:15%;display:flex;align-items:center;justify-content:center;
  color:#fff0c8;font:800 clamp(7px,.58vw,11px)/1 Georgia,"Times New Roman",serif;
  text-align:center;text-shadow:0 1px 2px #351607;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  pointer-events:none;
}
#gamePage .game-player-hud-value{
  position:absolute;top:64%;height:18%;display:flex;align-items:center;justify-content:center;
  color:#fff9ec;font:900 clamp(9px,.78vw,14px)/1 Georgia,"Times New Roman",serif;
  text-shadow:0 2px 2px #281105,0 0 3px #281105;white-space:nowrap;overflow:hidden;
  pointer-events:none;font-variant-numeric:tabular-nums;
}
#gamePage .game-player-hud-value.hud-coins{left:36%;width:9.2%}
#gamePage .game-player-hud-value.hud-relics{left:56%;width:7.2%}
#gamePage .game-player-hud-value.hud-discoveries{left:82%;width:13%;font-size:clamp(8px,.68vw,12px)}
#gamePage .game-player-hud-plus{
  position:absolute;top:60%;width:10%;height:27%;padding:0;border:0;border-radius:50%;
  background:transparent;pointer-events:auto;cursor:pointer;
}
#gamePage .game-player-hud-plus.hud-coins-plus{left:43.5%}
#gamePage .game-player-hud-plus.hud-relics-plus{left:63.5%}
#gamePage .game-player-hud-avatar:focus-visible,
#gamePage .game-player-hud-name:focus-visible,
#gamePage .game-player-hud-plus:focus-visible{outline:2px solid #fff2b5;outline-offset:2px}
@media(max-width:700px){
 #gamePage .game-player-hud{width:30%;right:.5%;bottom:23.5%}
 #gamePage .game-player-hud-name{font-size:clamp(8px,1.5vw,11px)}
 #gamePage .game-player-hud-title{font-size:clamp(6px,1vw,8px)}
 #gamePage .game-player-hud-value{font-size:clamp(7px,1.2vw,10px)}
 #gamePage .game-player-hud-value.hud-discoveries{font-size:clamp(6px,1vw,9px)}
}


/* STAGE 181 — Player HUD starts beside the right edge of the letter keyboard and can be repositioned. */
@media (min-width:701px){
 #gamePage .floor-game-hud{left:13% !important;right:27% !important;bottom:2.4% !important}
 #gamePage .game-player-hud{right:1.1%;bottom:1.7%;left:auto;top:auto;width:24%;max-width:420px;min-width:min(260px,24vw);pointer-events:auto;cursor:grab;touch-action:none}
}
@media (max-width:700px){
 #gamePage .game-player-hud{right:1%;bottom:1.4%;left:auto;top:auto;width:min(62%,260px);min-width:0;pointer-events:auto;cursor:grab;touch-action:none}
}
#gamePage .game-player-hud.is-dragging{cursor:grabbing;z-index:30;user-select:none;-webkit-user-select:none}
#gamePage .game-player-hud-avatar,
#gamePage .game-player-hud-name,
#gamePage .game-player-hud-plus{touch-action:manipulation;cursor:pointer}


/* PROFILE AVATAR — reference-matched desktop composition (Dec 2026)
   The portrait overlaps the upper-left edge of the identity card.
   Keep the frame near 200px at the reference 16:9 layout, not 300% oversized. */
@media (min-aspect-ratio: 1/1) {
  #modalRoot .profile-page .pf-top {
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    align-items: center;
    gap: .6em;
  }
  #modalRoot .profile-page .pf-id {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: .65em;
    min-width: 0;
    min-height: 5.5em;
    padding: .45em .7em .45em .4em;
    overflow: visible;
  }
  #modalRoot .profile-page .pf-avatar {
    position: relative;
    z-index: 3;
    flex: 0 0 auto;
    width: 12em;
    height: 10.6em;
    margin: 0 0 0 -.85em;
  }
  #modalRoot .profile-page .pf-id-text {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: .3em;
    min-width: 0;
    width: auto;
  }
  #modalRoot .profile-page .pf-name-row {
    align-items: center;
    max-width: 100%;
  }
  #modalRoot .profile-page .pf-rank {
    max-width: 100%;
  }
}


/* COLLECTIONS TAB — width-fit correction.
   Keep the existing two-row layout; remove the added vertical scrolling.
   Use shrinkable grid tracks and allow labels to wrap so the right-hand
   Collection Summary and Treasure Vault panels remain inside the profile. */
#modalRoot .profile-page .pf-body-host:has(.pf-body--collections) {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  scrollbar-width: none;
}
#modalRoot .profile-page .pf-body--collections {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  grid-template-columns: minmax(0, .72fr) minmax(0, 1.14fr) minmax(0, 1.14fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: .45em;
  overflow: visible;
}
#modalRoot .profile-page .pf-body--collections > .pf-panel {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  padding: .35em .42em .45em;
}
#modalRoot .profile-page .pf-body--collections h4.pf-title {
  min-width: 0;
  max-width: 100%;
  font-size: clamp(.78em, 1.02em, 1.08em);
  padding-left: 1.35em;
  padding-right: 1.35em;
  border-left-width: 1.8em;
  border-right-width: 1.8em;
}
#modalRoot .profile-page .pf-body--collections .pf-collection-grid {
  min-width: 0;
  min-height: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .22em;
  flex: 1 1 0;
}
#modalRoot .profile-page .pf-body--collections .pf-ctile {
  min-width: 0;
  padding: .16em .06em;
  font-size: clamp(.58em, .72em, .78em);
}
#modalRoot .profile-page .pf-body--collections .pf-ctile span {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.05;
}
#modalRoot .profile-page .pf-body--collections .pf-ctile img {
  max-width: 82%;
  height: 2.5em;
  object-fit: contain;
}
#modalRoot .profile-page .pf-body--collections .pf-collection-summary .pf-sum-list {
  min-width: 0;
  min-height: 0;
  flex: 1 1 0;
}
#modalRoot .profile-page .pf-body--collections .pf-sum-row {
  min-width: 0;
  grid-template-columns: 1.35em minmax(0, 1fr) auto;
  gap: .22em;
  font-size: clamp(.62em, .78em, .86em);
}
#modalRoot .profile-page .pf-body--collections .pf-sum-row > * {
  min-width: 0;
}
#modalRoot .profile-page .pf-body--collections .pf-collection-total {
  min-width: 0;
  gap: .3em;
  font-size: clamp(.62em, .78em, .86em);
  line-height: 1.15;
  flex-wrap: wrap;
}
@media (max-width: 900px) {
  #modalRoot .profile-page .pf-body-host:has(.pf-body--collections) {
    overflow-y: hidden;
  }
  #modalRoot .profile-page .pf-body--collections {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    height: auto;
  }
}


/* ==========================================================================
   STAGE 183 — Main menu: Mr. Roo stands ON the ground (not floating)
   - Roo is lowered so his boots rest on the stone path.
   - A soft contact shadow is painted on the ground directly under the boots,
     behind Roo (z-index 0 < Roo's 1) so he reads as grounded.
   Delete this block to revert.
   ========================================================================== */
#homePage .main-menu-roo{top:22.6%;}
#homePage::after{
  content:"";
  position:absolute;
  left:63.2%;
  top:92.6%;
  width:27.5%;
  height:3.4%;
  border-radius:50%;
  background:radial-gradient(ellipse at center, rgba(28,16,6,.62) 0%, rgba(28,16,6,.38) 45%, rgba(28,16,6,0) 72%);
  filter:blur(1.5px);
  pointer-events:none;
  z-index:0;
}


/* ==========================================================================
   STAGE 183 — Player Profile: larger, truly centred avatar + fitted panel banners
   Avatar sprites are 256px circles (diameter 228px, centred). avatar_frame.webp
   hole is x 250-1039, y 174-955 of 1312x1159 (19.05%/15.0%, 60.2% x 67.4%).
   The portrait is therefore sized to the hole and centred on it.
   Delete this block to revert.
   ========================================================================== */
@media (min-aspect-ratio: 1/1) {
  #modalRoot .profile-page .pf-id{
    position:relative;
    padding-left:15.6em;           /* room for the larger avatar that overlaps the card edge */
    min-height:8.4em;
  }
  #modalRoot .profile-page .pf-avatar{
    position:absolute;
    left:-.9em;
    top:-5em;
    width:18.2em;
    height:16.1em;                 /* 1312:1159 frame ratio */
    margin:0;
    z-index:6;
  }
  #modalRoot .profile-page .pf-id-text{flex:1 1 auto;min-width:0}
}
/* let the avatar overlap the card edge instead of being clipped by the content box */
#modalRoot .profile-page .pf-content{overflow:visible}
#modalRoot .profile-page .pf-avatar,
#modalRoot .profile-page .pf-avatar.pf-avatar-button{
  background:none!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  padding:0!important;
}
#modalRoot .profile-page .pf-avatar .pf-avatar-portrait-window{
  position:absolute;
  z-index:1;
  left:19.05%;
  top:15.0%;
  width:60.2%;
  height:67.4%;
  overflow:hidden;
  border-radius:50%;
  clip-path:none;
  background:#1d3b63;
}
#modalRoot .profile-page .pf-avatar .pf-avatar-portrait,
#modalRoot .profile-page .pf-avatar-button .pf-avatar-portrait{
  position:absolute;
  display:block;
  inset:auto;
  left:50%;
  top:50%;
  width:115%;                      /* 228px circle in a 256px sprite -> slightly overscan the hole */
  height:115%;
  max-width:none;
  transform:translate(-56.5%,-50%);
  object-fit:contain;
  object-position:center;
}

/* Collections tab: banners sized to their text so the ribbon curls never cover letters */
#modalRoot .profile-page .pf-body--collections h4.pf-title{
  box-sizing:border-box;
  min-width:0;
  max-width:100%;
  font-size:.9em;
  padding:.5em .4em .55em;
  border-width:0 2.1em;
  border-image-width:0 2.1em;
}
#modalRoot .profile-page .pf-body--collections h4.pf-title span{margin:0;white-space:nowrap}


/* ==========================================================================
   STAGE 183 — Gameplay player HUD: avatar centred in the frame's blue socket
   Socket (measured on player_profile_hud_frame.webp, 2170x704): centre 18.96% / 46.8%,
   diameter 490px. Button is a true circle of that socket (+2% overscan under the gold ring);
   the 228px avatar circle (in a 256px sprite) is scaled to fill it and centred.
   ========================================================================== */
#gamePage .game-player-hud-avatar{
  left:7.46%;top:11.3%;width:23%;height:71%;
  border-radius:50%;overflow:hidden;display:block;
}
#gamePage .game-player-hud-avatar img{
  position:absolute;left:50%;top:50%;width:115%;height:115%;max-width:none;
  transform:translate(-56.5%,-50%);object-fit:contain;
}


/* ==========================================================================
   STAGE 183 — Hall of Faith "My Record" avatar: centred in its holder
   The old 144x136 box + 50% radius + border clipped the portrait into an off-centre ellipse.
   Now a 146px square (228px avatar circle -> ~130px) centred on the holder (x=88, y=68 in the button).
   ========================================================================== */
#modalRoot .hofx-avatar-btn img.hofx-av.hof-player-avatar{
  left:16.5px;top:4.2px;width:123px;height:123px;z-index:0;
  border:0;border-radius:0;background:none;box-shadow:none;clip-path:circle(56px at calc(50% + 8.4px) 50%);
  object-fit:contain;object-position:center;
}
/* same gold laurel frame as the Player Profile; its opening is centred on the portrait */
#modalRoot .hofx-avatar-btn::after{
  content:"";position:absolute;left:0;top:-10px;width:176px;height:155.5px;
  background:url("../assets/player_profile/ui/avatar_frame.webp") center/100% 100% no-repeat;
  pointer-events:none;z-index:1;
}
#modalRoot .hofx-avatar-btn .hofx-plate,#modalRoot .hofx-avatar-btn b{z-index:2}

/* Stage 183: keep the avatar edit badge attached to the larger frame */
@media (min-aspect-ratio: 1/1){
  #modalRoot .profile-page .pf-avatar-change-badge{right:2.6em;bottom:1.7em}
}

/* Preserved Stage 183 tabbed settings layout */
/* STAGE 183 — Tabbed settings navigation with an independently scrollable content panel. */
#modalRoot .settings-content.settings-tab-layout{
 left:22.5%;width:55%;top:21.3%;height:64.5%;padding:0;overflow:hidden;
 display:grid;grid-template-columns:22% minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:1.2cqw;
}
#modalRoot .settings-tab-nav{min-width:0;display:flex;flex-direction:column;gap:.55cqw;padding:.35cqw .15cqw .35cqw 0;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#c28a35 transparent}
#modalRoot .settings-tab-button{width:100%;min-height:4.5cqw;display:flex;align-items:center;justify-content:flex-start;gap:.8cqw;padding:.65cqw .75cqw!important;border:.13cqw solid #9e7138!important;border-radius:.7cqw!important;background:linear-gradient(145deg,#f8e9c6,#d9b77c)!important;color:#573819!important;box-shadow:inset 0 .12cqw #fff5d9,0 .15cqw .3cqw #3c210b44;white-space:nowrap}
#modalRoot .settings-tab-button>span{flex:0 0 2.2cqw;width:2.2cqw;height:2.2cqw;display:grid;place-items:center;border-radius:50%;background:radial-gradient(circle at 35% 25%,#a62d20,#5c100b);border:.12cqw solid #e4b34f;color:#ffe6a2;font-size:1.45cqw;line-height:1}
#modalRoot .settings-tab-button b{font:700 1.15cqw/1.1 Georgia,serif;overflow:hidden;text-overflow:ellipsis}
#modalRoot .settings-tab-button.active{background:linear-gradient(145deg,#9f2b1d,#65140d)!important;border-color:#efc35e!important;color:#fff0c2!important;box-shadow:inset 0 .12cqw #ffb78b,0 .2cqw .5cqw #35100688}
#modalRoot .settings-tab-button.active>span{background:radial-gradient(circle at 35% 25%,#f7d77c,#a66a19);color:#61200f;border-color:#ffe6a0}
#modalRoot .settings-tab-panel{min-width:0;min-height:0;height:100%;overflow-y:auto;overflow-x:hidden;padding:0 .7cqw .5cqw .2cqw;scrollbar-width:thin;scrollbar-color:#d99a22 #5b3a1c;overscroll-behavior:contain}
#modalRoot .settings-tab-panel::-webkit-scrollbar{width:.8cqw}
#modalRoot .settings-tab-panel::-webkit-scrollbar-track{background:#5b3a1c;border-radius:1cqw;border:.1cqw solid #e9b84a}
#modalRoot .settings-tab-panel::-webkit-scrollbar-thumb{background:linear-gradient(90deg,#ffd45a,#d38a14);border-radius:1cqw;border:.1cqw solid #8a560e}
#modalRoot .settings-tab-panel .settings-section{margin:0 0 1.1cqw;padding:0 0 .6cqw}
#modalRoot .settings-tab-panel .settings-section-heading{flex-wrap:wrap;gap:.6cqw;margin-bottom:.7cqw}
#modalRoot .settings-tab-panel .settings-section-heading h3{font-size:1.65cqw}
#modalRoot .settings-tab-panel .settings-section-heading p{font-size:1cqw}
#modalRoot .settings-tab-panel .settings-volume-row{font-size:1.12cqw;grid-template-columns:minmax(0,1fr) 38% 4.2cqw;gap:.8cqw;padding:.5cqw .7cqw}
#modalRoot .settings-tab-panel .settings-volume-row .sv-ico{font-size:1.5cqw;width:2cqw}
#modalRoot .settings-tab-panel .settings-pref-list{display:grid;gap:.35cqw}
#modalRoot .settings-tab-panel .settings-pref-row{display:flex;align-items:center;justify-content:space-between;gap:.8cqw;padding:.65cqw .8cqw;background:linear-gradient(90deg,#f6e3b6,#fbeecb 60%,#f6e3b6);border:.1cqw solid #e7d2a0;border-radius:.65cqw;color:#38230f;cursor:pointer}
#modalRoot .settings-tab-panel .settings-pref-row>span{display:grid;gap:.15cqw;min-width:0}
#modalRoot .settings-tab-panel .settings-pref-row strong{font:700 1.15cqw/1.2 Georgia,serif}
#modalRoot .settings-tab-panel .settings-pref-row small{font:500 .9cqw/1.25 Georgia,serif;color:#806b4c}
#modalRoot .settings-tab-panel .settings-pref-row input{appearance:none;flex:0 0 2.8cqw;width:2.8cqw;height:1.55cqw;border:.12cqw solid #8a6a3b;border-radius:2cqw;background:#9a8970;position:relative;cursor:pointer}
#modalRoot .settings-tab-panel .settings-pref-row input:before{content:"";position:absolute;width:1.1cqw;height:1.1cqw;left:.12cqw;top:.1cqw;border-radius:50%;background:linear-gradient(#fff8df,#d5c39b);box-shadow:0 .08cqw .2cqw #0005;transition:transform .16s ease}
#modalRoot .settings-tab-panel .settings-pref-row input:checked{background:linear-gradient(#b77c20,#82500f);border-color:#71420d}
#modalRoot .settings-tab-panel .settings-pref-row input:checked:before{transform:translateX(1.2cqw);background:linear-gradient(#fff1a9,#f2bc38)}
#modalRoot .settings-tab-panel .settings-pref-list.is-disabled{opacity:.45;pointer-events:none}
#modalRoot .settings-tab-panel .settings-note{font:500 .95cqw/1.4 Georgia,serif;color:#70583a;margin:.7cqw 0;padding:.55cqw .7cqw;background:#fff2d4a8;border-left:.2cqw solid #b58a4c}
#modalRoot .settings-tab-panel .settings-test-button{margin-left:.5cqw;padding:.4cqw .7cqw!important;font-size:.9cqw!important}
#modalRoot .settings-tab-panel .settings-account-status{display:grid;gap:.3cqw;padding:.8cqw;background:#fff2d4;border:.1cqw solid #dfc99f;border-radius:.6cqw}
#modalRoot .settings-tab-panel .settings-account-status strong{font:700 1.2cqw Georgia,serif;color:#51371f}
#modalRoot .settings-tab-panel .settings-account-status small{font:500 1cqw/1.35 Georgia,serif;color:#806b4c}
#modalRoot .settings-tab-panel .settings-status-pill{font:700 .9cqw Georgia,serif;color:#69471e;background:#ead5a7;border-radius:2cqw;padding:.4cqw .7cqw}
#modalRoot .settings-page .settings-footer{position:absolute;left:22.5%;right:22.5%;bottom:3.2%;margin:0;font-size:.95cqw;z-index:6}
#modalRoot .settings-page button.settings-done{min-width:7.5cqw;padding:.65cqw 1cqw!important;font-size:1.05cqw!important}
@media(max-aspect-ratio:1/1){
 #modalRoot .settings-content.settings-tab-layout{left:7%;width:86%;top:17%;height:73%;grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr);gap:1.2cqw}
 #modalRoot .settings-tab-nav{flex-direction:row;overflow-x:auto;overflow-y:hidden;padding:.4cqw;gap:.7cqw}
 #modalRoot .settings-tab-button{width:auto;min-width:17cqw;min-height:8cqw;justify-content:center;padding:1cqw!important}
 #modalRoot .settings-tab-button>span{width:4cqw;height:4cqw;flex-basis:4cqw;font-size:2.5cqw}
 #modalRoot .settings-tab-button b{font-size:2.2cqw}
 #modalRoot .settings-tab-panel .settings-section-heading h3{font-size:3.1cqw}
 #modalRoot .settings-tab-panel .settings-section-heading p{font-size:1.9cqw}
 #modalRoot .settings-tab-panel .settings-volume-row{font-size:2.2cqw;grid-template-columns:minmax(0,1fr) 35% 7cqw}
 #modalRoot .settings-tab-panel .settings-volume-row .sv-ico{font-size:2.8cqw;width:4cqw}
 #modalRoot .settings-tab-panel .settings-pref-row strong{font-size:2.3cqw}
 #modalRoot .settings-tab-panel .settings-pref-row small{font-size:1.8cqw}
 #modalRoot .settings-tab-panel .settings-pref-row input{width:5.5cqw;height:3cqw;flex-basis:5.5cqw}
 #modalRoot .settings-tab-panel .settings-pref-row input:before{width:2.2cqw;height:2.2cqw}
 #modalRoot .settings-tab-panel .settings-pref-row input:checked:before{transform:translateX(2.4cqw)}
 #modalRoot .settings-tab-panel .settings-note{font-size:1.8cqw}
 #modalRoot .settings-tab-panel .settings-account-status strong{font-size:2.4cqw}
 #modalRoot .settings-tab-panel .settings-account-status small{font-size:1.9cqw}
 #modalRoot .settings-page .settings-footer{left:7%;right:7%;bottom:2%;font-size:1.7cqw}
 #modalRoot .settings-page button.settings-done{font-size:1.9cqw!important;min-width:16cqw;padding:1cqw 1.5cqw!important}
}

#modalRoot .settings-tab-button>span img{display:block;width:78%;height:78%;object-fit:contain;filter:drop-shadow(0 .08cqw .08cqw #0005)}
#modalRoot .settings-tab-button.active>span img{filter:brightness(1.12) drop-shadow(0 .08cqw .08cqw #0005)}
