/* Temple finale puzzle screens: all inputs are live buttons, server authoritative. */
#r20MiniGame .temple-gate-extra-challenge{--gate-glow:#ffdc83}
#r20MiniGame .temple-gate-extra-challenge .temple-gate-puzzle{display:grid;justify-items:center;gap:clamp(9px,1.7dvh,17px);width:min(100%,740px);margin-inline:auto;min-width:0}
#r20MiniGame .temple-gate-extra-challenge .temple-gate-directions{max-width:760px;margin-inline:auto;line-height:1.27}
#r20MiniGame .temple-gate-extra-challenge .temple-gate-puzzle>div{max-width:100%;box-sizing:border-box}
#r20MiniGame .temple-gate-extra-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:clamp(6px,2vw,16px);width:min(100%,520px)}
#r20MiniGame .temple-gate-extra-crystal,#r20MiniGame .temple-gate-extra-slot{
 display:grid;place-items:center;min-width:0;min-height:clamp(56px,10dvh,94px);
 font-size:clamp(28px,7vw,54px);border:3px solid #e3c67f;border-radius:15px;
 background:radial-gradient(ellipse at 50% 25%,#4b6b91,#182b53 78%);
 color:#f9f1c9;box-shadow:inset 0 2px 0 #fff6,0 7px 12px #0008;
}
#r20MiniGame button.temple-gate-extra-crystal{cursor:pointer;touch-action:manipulation}
#r20MiniGame button.temple-gate-extra-crystal:disabled{opacity:.4}
#r20MiniGame .temple-gate-extra-slots{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;width:min(100%,490px)}
#r20MiniGame .temple-gate-extra-slot{border-style:dashed;background:#17273f}
#r20MiniGame .temple-gate-extra-slot.is-filled{border-style:solid;background:radial-gradient(circle,#66528d,#30254c);box-shadow:0 0 13px #d4a5ff77}
#r20MiniGame .temple-gate-extra-small{min-height:44px;padding:7px 22px;border-radius:12px;border:2px solid #d9bb7b;background:#2c4360;color:#fff;font-weight:900}
#r20MiniGame .temple-gate-extra-feedback{padding:8px 13px;border-radius:12px;border:1px solid #ffd875;background:#41333d;color:#fff2b4;font-size:clamp(15px,4vw,22px);font-weight:1000;text-align:center}
#r20MiniGame .temple-gate-extra-mirrors{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(6px,2vw,15px);width:min(100%,610px)}
#r20MiniGame .temple-gate-extra-mirror{display:grid;justify-items:center;align-content:center;gap:7px;min-width:0;min-height:125px;padding:10px 4px;border:3px solid #91c3dc;border-radius:22px;background:radial-gradient(ellipse at 50% 5%,#4d76a2,#203453 75%);box-shadow:inset 0 0 19px #abceef55,0 8px 14px #0009}
#r20MiniGame .temple-gate-extra-mirror.is-lit{border-color:#ffe98a;background:radial-gradient(circle,#8c8447,#333b4a);box-shadow:0 0 22px #ffd869aa,inset 0 0 19px #ffe69f55}
#r20MiniGame .temple-gate-extra-mirror-index{font-weight:1000;color:#ffecb4;font-size:clamp(11px,2.4vw,18px)}
#r20MiniGame .temple-gate-extra-mirror .temple-gate-action{width:95%;padding:10px 2px;font-size:clamp(20px,5vw,35px);min-width:0}
#r20MiniGame .temple-gate-extra-mirror small{color:#c8f8ff;text-align:center;font-size:clamp(10px,2vw,14px)}
#r20MiniGame .temple-gate-extra-wheel{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px;width:min(100%,630px);padding:clamp(8px,2vw,19px);border:5px ridge #d5a85b;border-radius:70px;background:radial-gradient(ellipse at center,#604431,#1d283e);box-shadow:0 0 26px #e0b5626b,inset 0 0 24px #000}
#r20MiniGame .temple-gate-extra-wheel-rune{display:grid;place-items:center;aspect-ratio:1;min-width:0;border-radius:50%;border:2px solid #8f7e75;background:#1a3149;font-size:clamp(24px,5vw,42px);color:#d7dce8;transition:background .1s}
#r20MiniGame .temple-gate-extra-wheel-rune.is-target{border-color:#ffe8a0;box-shadow:inset 0 0 15px #ffd67c99}
#r20MiniGame .temple-gate-extra-wheel-rune.is-active{background:#c69b42;color:#171627;box-shadow:0 0 20px #ffe07fc9,inset 0 0 14px #ffe8be}
#r20MiniGame .temple-gate-extra-keyboard{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:3px;width:min(100%,370px);aspect-ratio:1;padding:8px;border:5px ridge #d9a35b;border-radius:15px;background:#362b2d}
#r20MiniGame .temple-gate-extra-keycell{display:grid;place-items:center;min-width:0;background:linear-gradient(145deg,#5e544e,#3c3944);border:1px solid #90776a;border-radius:5px;font-size:clamp(18px,5vw,33px)}
#r20MiniGame .temple-gate-extra-keycell.is-track{background:#23596e;box-shadow:inset 0 0 15px #82fbff75}
#r20MiniGame .temple-gate-extra-keycell.is-block{background:linear-gradient(160deg,#e4b26e,#825541);color:#372725;border:2px solid #ffe3ad}
#r20MiniGame .temple-gate-extra-keycell.is-key{background:#4b604f}
#r20MiniGame .temple-gate-extra-pillar-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;width:min(100%,520px)}
#r20MiniGame .temple-gate-extra-pillar{display:grid;gap:5px;justify-items:center;padding:9px 4px;border:2px solid #d4b478;border-radius:13px;background:#273b50;color:#ffdda3}
#r20MiniGame .temple-gate-extra-pillar strong{font-size:clamp(10px,2.7vw,17px)}
#r20MiniGame .temple-gate-extra-pillar-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;width:100%}
#r20MiniGame .temple-gate-extra-pillar-controls button{min-width:0;padding:8px 0;font-size:clamp(19px,4vw,27px)}
#r20MiniGame .temple-gate-extra-maze{display:grid;grid-template-columns:repeat(var(--maze-size,4),minmax(0,1fr));gap:3px;width:min(100%,345px);aspect-ratio:1;padding:6px;border:5px ridge #cca96a;border-radius:17px;background:#263448}
#r20MiniGame .temple-gate-extra-maze-cell{display:grid;place-items:center;border:1px solid #86b3b1;border-radius:5px;background:linear-gradient(145deg,#416471,#244253);font-size:clamp(16px,4vw,31px);color:#eaf8e9}
#r20MiniGame .temple-gate-extra-maze-cell.is-wall{background:repeating-linear-gradient(45deg,#564b55 0 7px,#363446 8px 14px);color:#655e62}
#r20MiniGame .temple-gate-extra-maze-cell.is-orb{position:relative;z-index:1;box-shadow:0 0 18px #eaa9ff,inset 0 0 12px #d4b1fa;background:#65528e}
#r20MiniGame .temple-gate-extra-maze-cell.is-exit{border-color:#ffde86;background:#85612d}
#r20MiniGame .temple-gate-extra-maze{background:radial-gradient(ellipse at center,#20374a,#080c1b 80%);box-shadow:inset 0 0 30px #000d,0 0 18px #8f79d644}
#r20MiniGame .temple-gate-extra-maze-cell.is-fog{position:relative;background:#080b17;border-color:#151b2c;color:transparent;box-shadow:inset 0 0 10px #02040b}
#r20MiniGame .temple-gate-extra-maze-cell.is-fog.is-exit{color:#ffe4a2;border-color:#755a33;background:radial-gradient(circle,#806d314a,#080b17 76%);text-shadow:0 0 16px #ffe89a}
#r20MiniGame .temple-gate-extra-maze-cell.is-explored{background:linear-gradient(145deg,#1d3446,#142338);border-color:#405b70;color:#b1c4d0;box-shadow:inset 0 0 7px #061021}
#r20MiniGame .temple-gate-extra-maze-cell.is-nearby{background:radial-gradient(circle,#527c8f,#25445c 77%);border-color:#92cbd2;box-shadow:0 0 10px #7ad3fa88}
#r20MiniGame .temple-gate-extra-maze-cell.is-nearby.is-wall{background:repeating-linear-gradient(45deg,#55566a 0 6px,#2a2a3e 7px 12px);border-color:#a498a8}
#r20MiniGame .temple-gate-extra-maze-cell.is-orb{background:radial-gradient(circle,#cdbaff,#7658b6 70%,#29254e);border-color:#eddfff;box-shadow:0 0 19px #b994ff,inset 0 0 12px #e2cbff}
#r20MiniGame .temple-gate-extra-maze-cell.is-fog.is-exit::after{content:'CROWN';position:absolute;transform:translateY(18px);color:#d0af6c;font-size:clamp(6px,1.3vw,9px)}
#r20MiniGame .temple-gate-extra-directions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;width:min(100%,480px)}
#r20MiniGame .temple-gate-extra-directions button{min-width:0;min-height:54px;font-size:clamp(21px,5vw,34px);padding:6px}
#r20MiniGame .temple-gate-extra-meter{position:relative;width:min(100%,570px);height:80px;border:4px solid #dba35d;border-radius:18px;background:repeating-linear-gradient(90deg,#18364f 0 10px,#23516b 11px 19px);box-shadow:inset 0 0 23px #000,0 7px 17px #0007;overflow:hidden}
#r20MiniGame .temple-gate-extra-zone{position:absolute;top:0;bottom:0;left:50%;width:22.22%;background:linear-gradient(#b9ffe7,#4ae2b8,#b9ffe7);box-shadow:0 0 25px #96ffdd;z-index:1}
#r20MiniGame .temple-gate-extra-needle{position:absolute;z-index:2;top:0;bottom:0;display:grid;place-items:center;width:5px;color:#fff8d2;font-size:30px;background:#fff3a8;box-shadow:0 0 10px #fff;transition:left .055s linear}
#r20MiniGame .temple-gate-extra-challenge .temple-gate-footnote{overflow-wrap:anywhere}
@media(max-height:680px){
 #r20MiniGame .temple-gate-extra-wheel{padding:5px}
 #r20MiniGame .temple-gate-extra-mirror{min-height:85px;padding:5px 2px;gap:3px}
 #r20MiniGame .temple-gate-extra-keyboard{width:min(100%,240px)}
 #r20MiniGame .temple-gate-extra-maze{width:min(100%,270px);gap:2px;padding:4px}
 #r20MiniGame .temple-gate-extra-meter{height:55px}
}
@media(prefers-reduced-motion:reduce){#r20MiniGame .temple-gate-extra-needle{transition:none}}


/* Seals visibly break open one by one when each independent lock is solved. */
#r20MiniGame .temple-gate-lock-seals{display:flex;justify-content:center;gap:clamp(10px,3vw,25px);width:100%;margin:clamp(6px,1dvh,13px) auto;flex-wrap:nowrap}
#r20MiniGame .temple-gate-lock-seal{
 display:grid;place-items:center;width:clamp(35px,9vw,63px);aspect-ratio:1;
 border:3px solid #ac865b;border-radius:50%;
 background:radial-gradient(circle at 38% 28%,#4f6276,#1c2a41 78%);
 box-shadow:inset 0 2px 0 #ffffff33,0 4px 0 #14192d,0 8px 15px #0009;
 color:#f6e9ca;font-size:clamp(19px,5vw,31px);font-weight:900;
}
#r20MiniGame .temple-gate-lock-seal.is-current{
 border-color:#fff0aa;background:radial-gradient(circle,#a67539,#573527 80%);
 box-shadow:0 0 22px #ffd25c96,inset 0 2px 0 #fff9b1,0 6px 15px #0009;
 animation:temple-gate-lock-pulse 1.7s ease-in-out infinite alternate;
}
#r20MiniGame .temple-gate-lock-seal.is-open{
 color:#241b22;border-color:#ffe5a4;
 background:radial-gradient(circle at 40% 25%,#ffffc1,#ffcb62 65%,#ad6a25);
 box-shadow:0 0 19px #ffd279a6,0 5px 13px #0007;
}
@keyframes temple-gate-lock-pulse{to{filter:brightness(1.3);transform:scale(1.05)}}
@media(prefers-reduced-motion:reduce){#r20MiniGame .temple-gate-lock-seal.is-current{animation:none}}


/* Four-barrier finale: clear gold openings, crisp synced sweep and level cue. */
#r20MiniGame .temple-gate-extra-sweep-caption{
 width:min(100%,570px);
 box-sizing:border-box;
 padding:7px 10px;
 border:1.5px solid #ffe098;
 border-radius:12px;
 background:linear-gradient(140deg,#273f5b,#142b4b);
 box-shadow:inset 0 2px 0 #ffffff24,0 4px 13px #0007;
 font-size:clamp(12px,3.5vw,18px);
 font-weight:950;
 text-align:center;
 letter-spacing:.03em;
 color:#fff1ba;
}
#r20MiniGame .temple-gate-extra-meter.is-four-barrier{
 border-color:#efc47c;
 background:repeating-linear-gradient(90deg,#112840 0 13px,#214865 14px 25px);
 box-shadow:inset 0 0 28px #000a,0 8px 19px #0009,0 0 17px #ffb95b40;
}
#r20MiniGame .temple-gate-extra-meter.is-four-barrier .temple-gate-extra-zone{
 background:linear-gradient(180deg,#fff9c4,#ffd75b 48%,#f5a733 100%);
 border-left:2px solid #fff9d3;
 border-right:2px solid #fff9d3;
 box-sizing:border-box;
 box-shadow:inset 0 0 13px #fff8a0a8,0 0 21px #ffd664aa;
}
#r20MiniGame .temple-gate-extra-meter.is-four-barrier .temple-gate-extra-zone::after{
 content:"";
 position:absolute;
 width:2px;
 height:100%;
 top:0;
 left:50%;
 background:#986024a1;
}
#r20MiniGame .temple-gate-extra-meter.is-four-barrier .temple-gate-extra-needle{
 width:5px;
 font-size:clamp(26px,5vw,36px);
 color:#effcff;
 background:#dcfaff;
 box-shadow:0 0 11px #b9f7ff,0 0 17px #76e6ff;
 transition:none!important; /* Motion stays frame-accurate with the server. */
}
@media(max-height:680px){
 #r20MiniGame .temple-gate-extra-sweep-caption{padding:4px 8px}
}


/* TEMPLE STACK: six-level timing finale, compact and readable on phones. */
#r20MiniGame .temple-stack-status{
 width:min(100%,570px);display:flex;align-items:center;justify-content:space-between;
 gap:clamp(6px,2vw,15px);padding:4px 2px;box-sizing:border-box;min-width:0;
 color:#fff1c7;font-weight:900;text-align:center;
}
#r20MiniGame .temple-stack-status strong{font-size:clamp(15px,3.9vw,22px);white-space:nowrap;letter-spacing:.06em;text-shadow:0 2px 12px #ffe9a180}
#r20MiniGame .temple-stack-status span{
 font-size:clamp(12px,3vw,16px);color:#fff6d6;background:#4c3c5b;
 border:1px solid #dabd78;padding:5px 9px;border-radius:10px;white-space:nowrap;
}
#r20MiniGame .temple-stack-status small{font-size:clamp(10px,2.7vw,13px);color:#c3dfef;white-space:nowrap}
#r20MiniGame .temple-stack-board{
 position:relative;isolation:isolate;box-sizing:border-box;width:min(100%,570px);
 height:clamp(195px,31dvh,310px);min-width:0;overflow:hidden;border-radius:22px;
 border:4px ridge #f2c979;
 background:
 radial-gradient(ellipse at 50% 8%,#edb75e45,transparent 46%),
 repeating-linear-gradient(0deg,transparent 0 26px,#f2c97708 27px 28px),
 linear-gradient(135deg,#304864,#1a2d44 45%,#10172f 80%);
 box-shadow:0 0 27px #e2aa5377,inset 0 0 28px #050a1dcf,0 10px 28px #0006;
}
#r20MiniGame .temple-stack-board::before{
 content:"✦ ✧ ✦";position:absolute;z-index:0;top:3%;left:0;width:100%;
 text-align:center;color:#f5c9799c;letter-spacing:.8em;font-size:16px;pointer-events:none;
}
#r20MiniGame .temple-stack-aura{
 position:absolute;z-index:0;left:10%;width:80%;bottom:0;height:94%;
 background:radial-gradient(ellipse at 50% 65%,#ffe4a521,transparent 68%);
 pointer-events:none;
}
#r20MiniGame .temple-stack-columns{
 position:absolute;inset:5% 3% 4%;display:flex;justify-content:space-between;
 pointer-events:none;opacity:.53;
}
#r20MiniGame .temple-stack-columns span{
 display:block;width:10%;height:100%;border:2px solid #9d8669;border-radius:10px 10px 0 0;
 background:repeating-linear-gradient(90deg,#2e3c58 0 8px,#40536d 9px 16px);
 box-shadow:inset 0 0 18px #020b19,0 0 16px #142f3f;
}
#r20MiniGame .temple-stack-floor{
 position:absolute;z-index:1;left:4%;width:92%;bottom:1%;height:3%;
 border-radius:8px;background:linear-gradient(#fff0bc,#bf9552,#4b5268);
 box-shadow:0 0 17px #ffc87998;
}
#r20MiniGame .temple-stack-slab{
 position:absolute;box-sizing:border-box;z-index:2;height:10.8%;
 border:2px solid #ffe4a4;border-radius:6px 6px 4px 4px;
 display:flex;justify-content:center;align-items:center;white-space:nowrap;
 overflow:hidden;min-width:0;font-family:inherit;font-size:clamp(9px,2.6vw,15px);
 font-weight:1000;letter-spacing:.045em;color:#2a2335;text-shadow:0 1px #ffffff99;
 background:linear-gradient(180deg,#ffefc8 0%,#eab66f 21%,#b36b56 76%,#734665 100%);
 box-shadow:inset 0 3px 3px #fff9,inset 0 -4px 4px #53384c75,0 5px 5px #0008;
 transition:none;
}
#r20MiniGame .temple-stack-slab.is-foundation{
 z-index:2;border-color:#92f5e2;color:#e5ffff;
 background:linear-gradient(180deg,#4a9eaa,#2f657e 55%,#26415b);
 box-shadow:inset 0 2px 8px #c3fff588,0 0 16px #65dace88;
}
#r20MiniGame .temple-stack-slab.is-placed{
 color:#2b2b39;border-color:#feecc3;
 background:linear-gradient(180deg,#f6dba7,#dca86b 48%,#9a6260 95%);
}
#r20MiniGame .temple-stack-slab.is-placed.is-top{box-shadow:inset 0 2px 7px #ffeeda,0 0 16px #ffcf85a0,0 5px 6px #0009}
#r20MiniGame .temple-stack-slab.is-moving{
 z-index:4;border:2px solid #fdf4c6;color:#252137;
 background:linear-gradient(180deg,#fff8cc,#ffd96c 40%,#dc9a48 85%,#9f6a68);
 box-shadow:0 0 21px #ffe97de7,inset 0 3px 5px #ffffffad,0 6px 5px #000a;
 will-change:left;
}
#r20MiniGame .temple-stack-slab-mark{display:block;max-width:100%;overflow:hidden;text-overflow:clip;pointer-events:none}
#r20MiniGame .temple-stack-message{
 width:min(100%,570px);min-height:25px;padding:2px;text-align:center;
 color:#ffecc9;font-size:clamp(11px,2.8vw,16px);font-weight:800;line-height:1.25;
}
#r20MiniGame .temple-stack-message.is-perfect{color:#baffea;text-shadow:0 0 11px #71ffb7a6}
#r20MiniGame .temple-stack-message.is-collapse{color:#ffc9c1}
#r20MiniGame .temple-stack-board.is-collapse{animation:temple-stack-shake .35s ease-out both}
@keyframes temple-stack-shake{
 0%,100%{transform:translateX(0)}
 20%{transform:translateX(-5px)}45%{transform:translateX(5px)}70%{transform:translateX(-3px)}
}
#r20MiniGame button.temple-stack-drop-button{
 width:min(100%,570px);min-height:clamp(48px,7dvh,68px);
 padding:9px 20px;border-radius:16px;border:3px solid #fff2ae;
 background:linear-gradient(180deg,#fff3a0,#ffc743 53%,#df9227);
 box-shadow:inset 0 3px 2px #ffffff90,0 6px 0 #945a36,0 9px 19px #0008,0 0 17px #f5c56870;
 font-size:clamp(18px,4.5vw,26px);font-weight:1000;letter-spacing:.04em;
 color:#3e250b;text-shadow:0 1px #fff9;touch-action:manipulation;
}
#r20MiniGame button.temple-stack-drop-button:active{transform:translateY(3px);box-shadow:inset 0 3px 2px #ffffff60,0 3px 0 #945a36}
#r20MiniGame button.temple-stack-drop-button:disabled{opacity:.6}
@media(max-height:680px){
 #r20MiniGame .temple-stack-board{height:clamp(155px,27dvh,210px)}
 #r20MiniGame .temple-stack-status{padding:0}
 #r20MiniGame .temple-stack-message{min-height:0}
 #r20MiniGame button.temple-stack-drop-button{min-height:45px}
 #r20MiniGame .temple-gate-extra-challenge .temple-gate-puzzle:has(.temple-stack-board){gap:6px}
}
@media(prefers-reduced-motion:reduce){#r20MiniGame .temple-stack-board.is-collapse{animation:none}}


/* Consistent final-gate presentation, including the fixed target on Spinning Seal. */
#r20MiniGame .temple-gate-extra-target-label{
 display:block;width:min(100%,630px);margin:0 auto -4px;
 padding:6px 13px;border:2px solid #ffe49a;border-radius:12px;
 background:linear-gradient(100deg,#64421c,#44351f);color:#fff0b7;
 text-align:center;letter-spacing:.075em;font-weight:1000;
 font-size:clamp(14px,2.5vw,21px);
 box-shadow:0 0 15px #ffc45a63;
}
#r20MiniGame .temple-gate-extra-wheel-rune.is-target{
 position:relative;isolation:isolate;
 background:linear-gradient(145deg,#a66e1c,#f7d373 45%,#79541f)!important;
 color:#1f2944!important;border:4px solid #fff5c2!important;
 outline:3px solid #ffd057!important;outline-offset:2px;
 box-shadow:inset 0 0 11px #fff9d0,0 0 18px #ffd66bb5!important;
}
#r20MiniGame .temple-gate-extra-wheel-rune.is-target::after{
 content:"TARGET";position:absolute;bottom:-22px;left:50%;
 transform:translateX(-50%);font-size:clamp(9px,1.2vw,12px);
 font-weight:1000;letter-spacing:.05em;color:#ffe398;
 text-shadow:0 2px 4px #000b;
}
#r20MiniGame .temple-gate-extra-wheel-rune.is-active:not(.is-target){
 background:linear-gradient(145deg,#116e8a,#4cddf6)!important;
 color:#032b3f!important;border:3px solid #dbffff!important;
 box-shadow:0 0 19px #55eaffbb,inset 0 0 12px #d6ffff!important;
}
#r20MiniGame .temple-gate-extra-wheel-rune.is-target.is-active{
 box-shadow:0 0 0 5px #70eafe,0 0 24px #53ddff,0 0 38px #ffda6d!important;
}
#r20MiniGame .temple-gate-extra-wheel{overflow:visible;gap:clamp(5px,1.15vw,13px);margin-bottom:clamp(14px,2.8dvh,27px)}
@media(min-width:740px){
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-gate-extra-challenge .temple-gate-puzzle{width:min(100%,850px);max-width:850px}
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-gate-extra-wheel{width:min(100%,690px)}
}


/* Laptop player experience: share horizontal space instead of using a tall 590px phone column.
   Phone widths retain their compact vertical layouts. */
@media(min-width:800px) and (min-height:540px){
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"]:is([data-stage="escape_intro"],[data-stage="power_play"],[data-stage="gate_race"],[data-stage="vote"]) .r20-mg-layout{
  width:min(1250px,97vw)!important;
  max-width:1250px!important;
  margin-inline:auto!important;
  padding:clamp(6px,1dvh,12px) 12px clamp(6px,1dvh,12px)!important;
  gap:clamp(3px,.55dvh,8px)!important;
  align-items:center!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .r20-mg-center{
  flex:0 1 auto!important;width:100%!important;min-height:0!important;
  align-items:flex-start!important;justify-content:center!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .r20-mg-stage-main{
  width:min(1150px,100%)!important;
  max-width:1150px!important;
  margin-inline:auto!important;
  padding:clamp(3px,.6dvh,8px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell{
  width:min(1130px,100%)!important;max-width:none!important;
  margin-inline:auto!important;
  padding:clamp(4px,.6dvh,9px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-title{
  font-size:clamp(23px,3.2dvh,34px)!important;line-height:1.05!important;margin:0!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-kicker{
  font-size:clamp(10px,1.5dvh,15px)!important;margin:1px auto!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-hud{
  padding:0!important;gap:clamp(4px,.6dvh,8px)!important;
  max-width:none!important;
 }
 /* Great Escape briefing: horizontal objective cards, two balanced Spark rows
    and visible Ready controls; no information removed. */
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide{
  width:min(1090px,100%)!important;
  max-width:1090px!important;
  max-height:none!important;overflow:visible!important;
  padding:clamp(7px,.9dvh,12px)!important;
  gap:clamp(4px,.65dvh,8px)!important;
  margin:auto!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide-title{
  font-size:clamp(22px,3.2dvh,31px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide-lead{
  font-size:clamp(13px,1.7dvh,17px)!important;line-height:1.16!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide-steps{
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:7px!important;width:100%!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide-step{
  padding:clamp(5px,.7dvh,8px)!important;display:flex!important;align-items:center!important;
  text-align:left!important;gap:7px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide-icon{
  font-size:clamp(25px,3.7dvh,39px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide-copy{
  justify-items:start!important;gap:2px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide-copy b{
  font-size:clamp(15px,2.15dvh,22px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide-copy span{
  font-size:clamp(11px,1.55dvh,15px)!important;line-height:1.16!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-power-legend{
  grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:6px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-power-tile{
  padding:clamp(4px,.65dvh,7px)!important;gap:2px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-power-tile b{
  font-size:clamp(11px,1.6dvh,15px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-power-tile span{
  font-size:clamp(10px,1.45dvh,13px)!important;line-height:1.15!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-spark-grid{
  grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:5px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-spark-player{
  padding:3px 5px!important;gap:4px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-ready-count{
  font-size:clamp(14px,2dvh,19px)!important;
  padding:3px 10px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-ready-button{
  min-height:clamp(50px,6.5dvh,60px)!important;
  padding:5px 12px!important;
  font-size:clamp(17px,2.5dvh,23px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-save-note,
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide-foot{
  font-size:clamp(10px,1.45dvh,14px)!important;line-height:1.14!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .r20-mg-scores{
  display:none!important; /* The briefing already gives each player’s Gem/Spark progress. */
 }
 /* Spark phase: compact heading, 3 + 2 power grid and fixed-height save action. */
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="power_play"] .temple-power-phase{
  width:min(1100px,100%)!important;max-width:1100px!important;
  gap:clamp(5px,.85dvh,10px)!important;margin-inline:auto!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="power_play"] .temple-power-heading{
  font-size:clamp(21px,3.1dvh,32px)!important;line-height:1.06!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="power_play"] .temple-power-lead{
  font-size:clamp(13px,1.8dvh,17px)!important;line-height:1.18!important;
  margin:0!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="power_play"] .temple-power-options{
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:clamp(6px,.8dvh,10px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="power_play"] .temple-power-item{
  padding:clamp(6px,.8dvh,10px)!important;gap:4px!important;
  min-height:clamp(92px,13dvh,120px)!important;align-content:start;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="power_play"] .temple-power-item strong{
  font-size:clamp(14px,1.8dvh,19px)!important;line-height:1.16!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="power_play"] .temple-power-item small{
  font-size:clamp(12px,1.55dvh,15px)!important;line-height:1.2!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="power_play"] .temple-power-skip{
  min-height:46px!important;padding:7px!important;
  font-size:clamp(13px,1.7dvh,18px)!important;
 }
 /* Final gate: horizontal space for all 12 puzzle types, compact headings/controls. */
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-gate-variety{
  width:min(1020px,100%)!important;
  max-width:1020px!important;
  padding:clamp(7px,1.1dvh,13px)!important;
  gap:clamp(6px,1dvh,12px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-gate-variety>.temple-title{
  font-size:clamp(24px,3.5dvh,36px)!important;
  line-height:1.08!important;margin:0!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-gate-heading{
  font-size:clamp(19px,2.8dvh,27px)!important;
  line-height:1.14!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-gate-directions{
  font-size:clamp(14px,2dvh,19px)!important;line-height:1.18!important;
  margin:0 auto!important;max-width:900px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-gate-puzzle{
  width:min(100%,860px)!important;gap:clamp(6px,.9dvh,11px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-gate-lock-seals{
  margin:0!important;gap:clamp(8px,1.4vw,19px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-gate-footnote{
  margin:0!important;max-width:870px!important;
  font-size:clamp(11px,1.5dvh,14px)!important;line-height:1.16!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-gate-action{
  min-height:clamp(48px,6.8dvh,64px)!important;
  padding:8px 16px!important;
  font-size:clamp(18px,2.5dvh,26px)!important;
 }
 /* Countdown trap: keep actual clock, challenge and action together in the centre. */
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"]{
  width:min(900px,100%)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"] .temple-classic-panel{
  width:min(820px,100%)!important;max-width:none!important;
  margin-inline:auto!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"] .temple-trap-controls{
  width:min(820px,100%)!important;margin-inline:auto!important;
  display:flex!important;flex-direction:column!important;align-items:center!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"] :is(.temple-classic-start,.temple-classic-stop){
  min-height:clamp(48px,7dvh,62px)!important;
  width:min(630px,100%)!important;margin-inline:auto!important;
 }
}
@media(min-width:800px) and (min-height:540px) and (max-height:720px){
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide{
  gap:3px!important;padding:6px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-guide-step{
  padding:3px 6px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="escape_intro"] .temple-escape-power-tile{
  padding:3px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"][data-stage="power_play"] .temple-power-item{
  min-height:80px!important;padding:5px!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-gate-variety{
  padding:6px!important;gap:5px!important;
 }
}


/* Countdown's actual START/STOP control uses temple-stop-button, not classic-start. */
@media(min-width:800px) and (min-height:540px){
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"] .temple-stop-button{
  display:block!important;width:min(630px,100%)!important;min-height:clamp(52px,7dvh,64px)!important;
  margin:clamp(5px,.8dvh,9px) auto!important;justify-self:center!important;
  font-size:clamp(18px,2.6dvh,26px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"] .temple-question{
  width:min(760px,100%)!important;margin:6px auto!important;
  text-align:center!important;font-size:clamp(17px,2.6dvh,23px)!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"] .temple-classic-clock{
  width:clamp(98px,18dvh,160px)!important;
 }
}

/* Stop the Clock: centre the dial, prompt and action on narrow phones too.
   Keep the clock decorative: the elapsed time must stay hidden. */
@media(max-width:799px){
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"]{
  width:100%!important;min-width:0!important;margin-inline:auto!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"] :is(.temple-classic-panel,.temple-classic-layout,.temple-trap-controls){
  width:100%!important;max-width:100%!important;min-width:0!important;
  margin-inline:auto!important;justify-items:center!important;align-items:center!important;
  text-align:center!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"] .temple-classic-clock{
  display:grid!important;place-items:center!important;
  width:clamp(90px,25vw,145px)!important;aspect-ratio:1!important;
  margin-inline:auto!important;justify-self:center!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"] .temple-question{
  width:100%!important;max-width:100%!important;
  margin:6px auto!important;text-align:center!important;
 }
 #r20MiniGame.r20-mg-phone[data-game="temple_trouble"] .temple-shell[data-trap="countdown"] .temple-stop-button{
  display:block!important;box-sizing:border-box!important;
  width:min(100%,420px)!important;margin:8px auto!important;
  justify-self:center!important;text-align:center!important;
 }
}
