body[data-page="home"] #app{padding:0;max-width:none;margin:0}.temple-home{position:relative;height:calc(100svh - var(--temple-header,130px));min-height:420px;background:#e8dfcc;display:flex;flex-direction:column}.temple-home iframe{display:block;width:100%;flex:1;min-height:0;border:0}.temple-shortcuts{display:flex;justify-content:center;gap:24px;padding:9px 14px;background:#f5f0e5;color:#463b2c;font-size:14px;flex-shrink:0}.temple-shortcuts a{padding:5px 10px;text-decoration:none}.temple-shortcuts a:focus-visible{outline:2px solid #986f32}.temple-error{position:absolute;inset:35% 8% auto;background:#fff9ed;color:#463b2c;padding:20px;z-index:10}.temple-error[hidden]{display:none}body[data-page="home"]>.footer{display:none}@media(max-width:600px){.temple-home{min-height:390px}}/* Keep the embedded temple and its navigation inside the mobile viewport. */
body[data-page="home"]{width:100%;max-width:100%;overflow-x:clip}
body[data-page="home"] .header{width:100%;max-width:100%;box-sizing:border-box}
.temple-home{width:100%;max-width:100%;min-width:0;overflow:hidden;height:calc(100dvh - var(--temple-header,130px))}
.temple-home iframe{min-width:0;max-width:100%}
.temple-shortcuts{box-sizing:border-box;gap:12px;padding:4px 12px max(4px,env(safe-area-inset-bottom));flex-wrap:wrap}
.temple-shortcuts a{min-height:36px;display:flex;align-items:center}
@media(max-width:600px){
 body[data-page="home"] .header{grid-template-columns:minmax(0,1fr) auto!important;padding:0 12px!important}
 body[data-page="home"] .header .brand{min-width:0;max-width:100%}
 body[data-page="home"] .header nav{min-width:0;max-width:100%;gap:10px!important}
 .temple-home{min-height:300px}
}

/* A compact, consistent way back from both temple halls. */
.temple-return-bar{padding:8px 0 10px;position:relative;z-index:25}
.temple-return{display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:6px 13px;box-sizing:border-box;border:1px solid #c5a56b;border-radius:20px;background:#f5eddb;color:#513b1d!important;font:500 14px/1.3 sans-serif;text-decoration:none!important;box-shadow:0 2px 8px #00000012;white-space:nowrap}
.temple-return:hover{background:#e9d8b5}
.temple-return:focus-visible{outline:2px solid #bb873c;outline-offset:3px}
body[data-page="ziwei"] #app{position:relative}
body[data-page="ziwei"] .temple-return-bar{position:absolute;top:10px;left:14px;padding:0;z-index:30}
@media(max-width:600px){.temple-return-bar{padding:6px 0 8px}.temple-return{font-size:13px;min-height:36px;padding:6px 11px}}
/* Navigation drawer only while the temple game is active. */
body[data-page="home"].temple-playing .header{position:fixed!important;inset:0 0 auto!important;z-index:1001!important;transform:translateY(-100%);transition:transform .24s ease;visibility:hidden}
body[data-page="home"].temple-playing.temple-nav-open .header{transform:translateY(0);visibility:visible}
body[data-page="home"].temple-playing .temple-home{margin-top:12px}
.temple-nav-handle{position:fixed;left:50%;transform:translateX(-50%);z-index:1002;width:72px;height:44px;padding:0;border:0;border-radius:0;background:transparent;display:flex;align-items:flex-start;justify-content:center;touch-action:none;cursor:pointer;transition:top .24s ease}
.temple-nav-handle::before{content:"";position:absolute;inset:0 0 auto;height:15px;border-radius:0 0 9px 9px;background:#191510;z-index:-1}
.temple-nav-handle[hidden]{display:none}
.temple-nav-handle span{display:block;width:30px;height:3px;margin-top:5px;border-radius:4px;background:#d8b578}
.temple-nav-handle:focus-visible{outline:2px solid #f4d49e;outline-offset:2px}
@media(prefers-reduced-motion:reduce){body[data-page="home"].temple-playing .header,.temple-nav-handle{transition:none}}
/* Size the iframe from its containing viewport, not its intrinsic dimensions.
   Short landscape screens must not inherit the old 420px minimum height. */
body[data-page="home"] #app{width:100%;min-width:0}
.temple-home{min-height:0}
.temple-home iframe{position:absolute;inset:0;width:100%;height:100%;min-width:0;max-width:100%;box-sizing:border-box}

.temple-entrance{position:absolute;inset:0;z-index:5;display:grid;place-items:center;text-align:center;padding:24px;background:linear-gradient(180deg,rgba(16,12,10,.55),rgba(16,12,10,.66));color:#fff5df}
.temple-entrance[hidden]{display:none}
.temple-entrance-content{max-width:520px;text-shadow:0 2px 12px #0009}
.temple-entrance-content img{display:block;margin:0 auto 12px;filter:drop-shadow(0 2px 8px #0008)}
.temple-entrance h1{font:600 clamp(25px,5vw,42px)/1.25 Georgia,serif;letter-spacing:.03em;margin:0 0 12px;color:#fff1d5}
.temple-entrance p{font:15px/1.6 sans-serif;margin:0 0 24px;color:#f4e5cb}
.temple-enter{min-width:152px;min-height:40px;padding:9.6px 22.4px;border:.8px solid #e0bd7f;border-radius:24px;background:#b27a37;color:#fffaf0;font:700 12.8px sans-serif;cursor:pointer;box-shadow:0 3.2px 16px #0007}
.temple-enter:disabled{opacity:.7;cursor:wait}.temple-enter:focus-visible{outline:3px solid #fff2cf;outline-offset:4px}

/* Waiting visitors use a small cover; the 3D download starts after admission. */
.temple-home{background:#211b15 url('/assets/temple-game-cover-v1.jpg') center 48%/cover no-repeat}
.temple-home iframe{opacity:0;pointer-events:none}.temple-home.is-playing iframe[src]{opacity:1;pointer-events:auto}
.temple-home iframe:not([src]){visibility:hidden}
.temple-entrance{overflow:auto;box-sizing:border-box}
.temple-entrance-content{width:100%;max-width:540px;margin:auto}
.temple-rooms{display:grid;grid-template-columns:minmax(0,1fr);width:50%;gap:8px;margin:20px auto 12px;text-shadow:none}
.temple-room{display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto;align-items:center;column-gap:8px;box-sizing:border-box;min-width:0;min-height:47.6px;padding:4px 8px;border:1px solid #bda070;border-radius:12px;background:#231e17ed;color:#f9e8c9;text-align:left;cursor:pointer}
.temple-room strong,.temple-room small{display:block;line-height:1.45}.temple-room strong{grid-column:1;grid-row:1;font-size:16px;white-space:nowrap}.temple-room small{grid-column:2;grid-row:1;text-align:right;font-size:12px;color:#e3ceb0}.temple-room.is-full small{color:#f6b0a3}
.temple-room[aria-pressed=true]{outline:2px solid #f2d091;outline-offset:2px;background:#4c3620}.temple-room:focus-visible{outline:3px solid #fff3d4;outline-offset:3px}.temple-room:disabled{cursor:default;opacity:.8}
.temple-entrance .temple-lobby-status{min-height:44px;margin-bottom:14px;font-size:14px}.temple-queue-cancel{display:block;margin:12px auto 0;min-height:44px;padding:8px 16px;background:transparent;color:#fff0d7;border:1px solid #cbb18a;border-radius:22px;cursor:pointer}.temple-queue-cancel[hidden]{display:none}
@media(max-height:600px){.temple-entrance{place-items:start center;padding:16px}.temple-entrance-content img{width:40px;height:40px;margin-bottom:6px}.temple-entrance h1{font-size:24px}.temple-rooms{margin-top:10px}.temple-room{min-height:44.8px}.temple-entrance p{margin-bottom:10px}}

.temple-fallback-links{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;font-size:14px}.temple-fallback-links a{color:#fff1d3;min-height:36px;padding:6px;text-underline-offset:3px}

/* Share remains in the parent document to retain native share tap activation. */
.temple-share-trigger{display:none;position:absolute;z-index:4;right:18px;bottom:calc(302px + env(safe-area-inset-bottom,0px));width:52px;height:52px;padding:4px;box-sizing:border-box;flex-direction:column;align-items:center;justify-content:center;gap:2px;border:1.5px solid #d5ad69;border-radius:50%;background:#30180cd6;color:#fff3dc;font:600 10px/1.1 sans-serif;cursor:pointer;backdrop-filter:blur(6px)}
.temple-home.is-playing .temple-share-trigger{display:flex}.temple-share-trigger svg{width:22px;height:22px}.temple-share-trigger:focus-visible{outline:2px solid #ffe2a7;outline-offset:3px}.temple-share-trigger:active{background:#783a22}.temple-share-trigger:disabled{opacity:.65}
@media(max-width:600px),(max-height:500px){.temple-share-trigger{right:8px;bottom:calc(218px + env(safe-area-inset-bottom,0px));width:46px;height:46px;font-size:9px}.temple-share-trigger svg{width:20px;height:20px}}
@media(max-height:360px){.temple-share-trigger{right:64px;bottom:calc(10px + env(safe-area-inset-bottom,0px))}}
.temple-share-dialog{position:fixed;inset:0;width:min(420px,calc(100vw - 24px));max-height:calc(100dvh - 28px);margin:auto;padding:22px;box-sizing:border-box;overflow:auto;overscroll-behavior:contain;border:1px solid #b89a65;border-radius:18px;background:#fbf4e6;color:#443323;font:14px/1.5 sans-serif;box-shadow:0 20px 80px #0008}
.temple-share-dialog::backdrop{background:#100c09b8}.temple-share-dialog h2{margin:0 25px 14px 0;font:600 20px/1.5 sans-serif;color:#443323}.temple-share-dialog [data-temple-share-poster]{display:block;width:auto;max-width:100%;height:auto;max-height:44dvh;margin:0 auto;border-radius:5px}.temple-share-dialog [hidden]{display:none!important}
.temple-share-close{position:absolute;right:5px;top:5px;min-width:44px;min-height:44px;padding:0;border:0;background:transparent;color:#624a31;font-size:28px;cursor:pointer}.temple-share-dialog p{margin:12px 0;font-size:13px}.temple-share-dialog label{display:block;margin-top:10px;font-size:12px}.temple-share-dialog input{display:block;width:100%;min-width:0;box-sizing:border-box;min-height:44px;padding:8px 10px;border:1px solid #cbb791;border-radius:6px;background:#fffaf1;color:#443323;font-size:13px}
.temple-share-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.temple-share-actions button,.temple-share-actions a{display:flex;flex:1 1 100px;align-items:center;justify-content:center;box-sizing:border-box;min-height:44px;padding:8px;border:1px solid #a78449;border-radius:8px;background:#efe0c4;color:#443323;font:600 13px/1.4 sans-serif;text-align:center;text-decoration:none;cursor:pointer}.temple-share-actions [data-temple-share-send]{background:#a87534;color:#fff9ee}.temple-share-dialog :focus-visible{outline:2px solid #895617;outline-offset:2px}

.embedded-site-recovery{min-height:200px;padding:32px 20px;display:grid;align-content:center;gap:18px;color:#f7e9ca;background:#211b15;font:15px/1.7 sans-serif;text-align:center}

/* Loading failures stay in the entrance flow instead of covering room choices. */
.temple-entrance-content .temple-error{position:static;inset:auto;margin:0 0 14px;padding:14px;border:1px solid #b89a65;border-radius:10px;text-align:left;text-shadow:none;font:14px/1.6 sans-serif}
.temple-entrance-content .temple-error button{display:block;min-height:44px;margin-top:10px;padding:8px 16px;border:1px solid #a47b39;border-radius:8px;background:#ead4af;color:#443323;font-weight:600;cursor:pointer}
