/* Reference composition and animation are in reference/assets/app.css.
   This layer supplies Emoji images, safe-area sizing and the existing ad boundary. */
:root{--viewport-height:100dvh;--game-viewport-height:var(--viewport-height);--app-top:0px;--app-bottom:0px}
html,body{height:100%;margin:0}
.game-shell{height:var(--game-viewport-height)!important;min-height:0;overflow:hidden}
#app{height:100%;max-height:100%;min-height:0}
#game{min-height:0}
.emoji-content{position:relative;display:inline-block;width:1em;height:1em;line-height:1;vertical-align:middle;color:transparent!important;text-shadow:none!important;-webkit-text-stroke:0!important;font-family:system-ui!important}
.emoji-content>img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none}
.mini.emoji-content{display:flex;width:auto;height:auto;min-height:1em;color:inherit!important}
.mini.emoji-content>img{width:70%;height:70%;inset:15%;object-fit:contain}
.mini.emoji-content>.n{z-index:1}
.how-ex.emoji-content{display:table-cell;width:1.5em;height:1.5em}
.how-ex.emoji-content>img{width:1.5em;height:1.5em;position:relative}
.sc-mark .emoji-content,.sc-ink.emoji-content{display:inline-block}
.bg-mandala text{font-family:'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif}
.eg-theatre-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:16px}
.eg-theatre-grid button{min-height:44px;overflow-wrap:anywhere;font-size:13px}
.eg-game-theatre{font-size:12px;align-self:center;flex-shrink:0;margin-top:5px}
#title-screen{overflow-y:auto;overscroll-behavior:contain}
#title-screen .logo{flex-shrink:0}
#site-information{padding:0;border:2px solid #9f92b4;border-radius:16px;max-width:min(900px,calc(100% - 24px));max-height:calc(var(--viewport-height) - 24px);overflow:auto;color:#fff}
#site-information::backdrop{background:#17102099}
#site-information .dialog-header{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;padding:15px;background:#25202e;z-index:1;color:#fff}
#site-information .close-dialog{color:#fff;background:none;border:0;font-size:26px}
.game-information{width:calc(100% - 32px)}
@media(max-width:700px),(max-width:1100px) and (max-height:500px){
 #app{padding-top:max(8px,env(safe-area-inset-top));padding-bottom:max(8px,env(safe-area-inset-bottom))}
 #title-screen{padding-block:20px;justify-content:safe center}
 .screen{min-height:0}
 #bg,#fx-back,#fx-front{max-height:var(--game-viewport-height)}
 .panel,.modal,.reward,.judge,#cut,.cut-cast,.chara,.bx-veil{max-height:var(--game-viewport-height)}
 .modal-card{max-height:calc(var(--game-viewport-height) - 24px)}
 .eg-theatre-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
/* Explicit face selection supplements WebKit's software backface compositor.
   The original 420ms Y-turn remains; its front passes 90deg at about 60ms. */
.slot.flipped .back{visibility:hidden;transition:visibility 0s 60ms}
html.reduce .slot.flipped .back{transition:none}
.back:after{content:'🎲';font-family:'Apple Color Emoji','Segoe UI Emoji',sans-serif}
/* Scale the intact reference scene only when browser chrome/ad space makes the
   game box shorter. Individual scale composes with the native scene transform. */
.gacha-stage{scale:var(--eg-machine-scale,1)}
#cut .cut-body{scale:var(--eg-rare-scale,1)}
/* Give the intact cut-in a bounded grid track before fitting its full body. */
#cut,#overlay{grid-template-rows:minmax(0,1fr);grid-template-columns:minmax(0,1fr)}

.eg-preview-loading{position:absolute;inset:0;display:grid;place-items:center;background:#19171fe6;color:#fff;font-size:22px;z-index:200}

/* Theatre copy wraps inside its own scrollable modal on phones. */
#eg-theatre .modal-card{width:min(760px,100%);padding:0}
#eg-theatre .modal-head{justify-content:space-between;align-items:center;gap:12px;margin:0;padding:16px 16px 12px}
#eg-theatre .modal-head h2{font-size:clamp(18px,4vw,24px);margin:0}
#eg-theatre .modal-head button{min-height:44px;flex-shrink:0;padding:8px 12px}
#eg-theatre .eg-theatre-body{padding:0 16px 16px}
#eg-theatre .note{margin:0;font-size:13px}
.eg-theatre-heading{font-size:15px;margin:20px 0 8px}
.eg-theatre-grid{margin-top:0}
.eg-theatre-grid button{white-space:normal;text-align:left;line-height:1.35;padding:10px 12px}
.eg-theatre-stage,.eg-theatre-name{display:block}
.eg-theatre-stage{font-size:12px;opacity:.7;margin-bottom:3px}
.eg-theatre-name{font-size:14px}
.unit-announce{max-width:90%;text-align:center}
.unit-announce .uk{max-width:100%;font-family:var(--ui)!important}
.bx-read{max-width:90vw;white-space:normal;text-align:center}
.sc-seal{min-width:1.3em;width:auto;max-width:5em;white-space:nowrap}

/* Color Emoji retain their own colors through the reference's gold-text scenes. */
html[data-edition="emoji"] .bx-veil .bx-unit,html[data-edition="emoji"] .cut-title{font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;background:none;background-clip:initial;-webkit-background-clip:initial;color:#fff;-webkit-text-fill-color:initial;-webkit-text-stroke:0;text-shadow:none}
html[data-edition="number"] .bx-unit,html[data-edition="number"] .cut-title{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
