/* 星火连连看 (link-htx-2.5.15): own styles. The shared pages (P01, P03, dialogs) come from htx-common/pages.css; this
   file lays out the round: top HUD, board (canvas), hint/shuffle, info bar, menu and help. Positions that depend on
   the board are CSS variables set by src/spark-layout.mjs (--board-top, --board-bottom, in stage pixels). */
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none}
body{background:#2a1250 var(--bg,none) center/cover no-repeat;font-family:system-ui,-apple-system,'PingFang SC',sans-serif;color:#fff}
[hidden]{display:none!important}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none;touch-action:manipulation;min-width:44px;min-height:44px}
button:focus-visible{outline:3px solid #ffde54;outline-offset:3px}
button:disabled{cursor:default}
/* The stage is the phone-shaped column: the frame's full height, at most 9:16 wide (centred on wider frames). */
#stage{position:relative;margin:0 auto;width:min(100vw,calc(100dvh * 9 / 16),460px);height:100dvh;overflow:hidden;container-type:inline-size}
#gameCanvas{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none}
#loadingStatus{position:absolute;inset:0;z-index:40;display:grid;place-items:center;padding:24px;text-align:center;background:#2a1250 var(--htx-start-bg,none) center/cover no-repeat;font-size:16px}
#loadingStatus.translucent{background:#2a1250d9}

/* ── top HUD: brand strip, task card, then 结束本局 · theme counts · gear ── */
#topHud{position:absolute;z-index:5;left:4%;right:4%;top:max(8px,env(safe-area-inset-top));display:flex;flex-direction:column;gap:max(3px,1cqw)}
#brandStrip{height:max(20px,5.4cqw)}
#taskCard{height:max(44px,12cqw)}
#hudRow{display:flex;align-items:center;gap:2cqw;min-height:48px}
#quit{flex:none;min-height:44px;height:max(44px,11cqw)}
.theme-counts{flex:1;min-width:0;display:flex;justify-content:space-around;align-items:center;gap:1cqw}
.theme-counts span{display:inline-flex;align-items:center;gap:.6cqw;font:800 max(12px,3.5cqw)/1 system-ui,sans-serif;font-variant-numeric:tabular-nums;color:#fff;text-shadow:0 1px 2px #1a0a36;white-space:nowrap}
.theme-counts img{width:max(22px,6.6cqw);height:max(22px,6.6cqw);flex:none}
/* Narrow frames: the four counts must fit between 结束本局 and the gear. */
@container (max-width:370px){.theme-counts{gap:0}.theme-counts span{flex-direction:column;gap:4px;font-size:12px}.theme-counts img{width:19px;height:19px}#quit{padding:0 .7em}}
.round-button{flex:none;margin-left:auto;width:max(44px,12cqw);height:max(44px,12cqw);border-radius:50%;display:grid;place-items:center;background:#3b1d72e6;border:2px solid #a57cf2;box-shadow:0 3px 0 #1a0a3699}
.round-button svg{width:62%;height:62%;color:#fff}

/* Transient notices sit above the lower info card, to the left of the full speech reservation. */
.notice{position:absolute;z-index:6;left:2.5%;right:160px;bottom:116px;margin:0;padding:6px 10px;border-radius:4px;background:#fff1c9;color:#35135c;border:1px solid #d5a74b;border-left:4px solid #bd7a15;text-align:center;font-size:max(13px,3.8cqw);line-height:1.35;font-weight:700;pointer-events:none}

/* ── hint / shuffle ── */
#gameActions{position:absolute;z-index:5;display:flex;gap:4cqw}
.tool{position:relative;width:max(46px,12.4cqw);height:max(46px,12.4cqw);border-radius:50%;display:grid;place-items:center;background:radial-gradient(circle at 50% 35%,#6a3fc0,#3b1d72);border:2.5px solid #ffcf4d;box-shadow:0 3px 0 #1a0a3699}
.tool svg{width:56%;height:56%;color:#ffe08a}
.tool b{position:absolute;right:-4px;bottom:-4px;display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:#ff9a2c;border:2px solid #fff3d6;color:#fff;font-size:13px;font-weight:800;pointer-events:none}
.tool:disabled{filter:grayscale(.85);opacity:.55}
.layout-side #gameActions{left:4%;top:calc(var(--board-bottom,62%) + max(6px,2cqw))}

/* ── info bar: score, time, tiles left, this round's fire ── */
.info-bar{position:absolute;z-index:5;display:flex;align-items:center;justify-content:space-around;gap:1cqw;padding:1cqw 2cqw;border:1px solid #a57cf2aa;border-radius:4cqw;background:#2a1250e6;box-shadow:0 6px 18px #10051b66}
.info-cell{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:.5cqw}
.info-cell small{font-size:max(11px,2.8cqw);color:#cbbbe9;white-space:nowrap}
.info-cell b{display:flex;align-items:center;gap:1cqw;font-size:max(15px,4.6cqw);font-variant-numeric:tabular-nums;white-space:nowrap}
.info-cell.fire b{color:#ffcf4d}
.info-cell .spark{width:1em;height:1em;flex:none}
/* Every frame (2.5.9; 9:16 frames only before): no button in the bottom quarter, so the host puts its box in the bottom-right corner; the bar
   leaves the stage's right 150 px free (the host uses the stage inset too). Two columns keep every label readable. */
.layout-side .info-bar{left:2.5%;right:150px;bottom:14px;height:94px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 2px;padding:1cqw 1.4cqw}
.layout-side .info-cell b{font-size:max(14px,4cqw)}
.layout-side .info-cell small{font-size:max(11px,2.4cqw)}

.pause-note{position:absolute;z-index:6;left:0;right:0;top:40%;margin:0;text-align:center;font-size:24px;font-weight:800;text-shadow:0 2px 0 #1a0a36;pointer-events:none}

/* ── gear menu and help: modal sheets (opening any pauses the round) ── */
.sheet{position:absolute;inset:0;z-index:25;display:flex;align-items:flex-start;justify-content:center;padding:max(16px,6%) 16px 16px;background:#12062bb3}
/* link-htx-2.1 (2.0 review I1, M2): the gear menu and the help are open only while the host hides its character (they
   hold pages.overlay, M06), so they may use the whole height; they start near the top. The help's text scrolls in its
   own body above the button, so the button never covers a line. */
.sheet-card{max-height:calc(100% - 2 * max(16px,6%));display:flex;flex-direction:column}
.sheet-card>*{flex:none}
.sheet-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;margin:0 -4px 6px;padding:0 4px 14px;
 -webkit-mask-image:linear-gradient(#000 calc(100% - 16px),transparent);mask-image:linear-gradient(#000 calc(100% - 16px),transparent)}   /* a soft edge says: it scrolls */
.sheet-card{width:84%;max-width:380px;overflow-y:auto;padding:22px 18px;border-radius:6cqw;border:2px solid #a57cf2;background:linear-gradient(180deg,#4a2690 0%,#3b1d72 100%);text-align:center;box-shadow:0 16px 60px #10051b99}
.sheet-card h2{margin:0 0 14px;font-size:clamp(20px,6cqw,28px);font-weight:900}
.sheet-card p{margin:0 0 12px;text-align:left;font-size:max(13px,3.8cqw);line-height:1.6;color:#e3d2ff}
.sheet-card button{display:flex;align-items:center;justify-content:center;width:100%;min-height:48px;margin:8px 0;border-radius:999px;font-weight:800;font-size:clamp(15px,4.4cqw,20px)}
.sheet-primary{background:linear-gradient(150deg,#b16bff,#7143da);border:1.5px solid #d9c4ff99!important;box-shadow:0 3px 0 #2c1460}
.sheet-item{background:#2a1250cc;border:1.5px solid #a57cf2aa!important}
.sheet-toggles{display:flex;gap:10px}
.sheet-toggle{flex:1;background:#2a1250cc;border:1.5px solid #a57cf2aa!important;gap:.5em}
.sheet-toggle[aria-pressed=false]{opacity:.7}
.sheet-toggle b{color:#ffe08a}

#landscapeNotice{display:none}
@media (orientation:landscape) and (hover:none),(orientation:landscape) and (pointer:coarse){
 #stage{display:none!important}
 #landscapeNotice{display:flex;position:fixed;inset:0;align-items:center;justify-content:center;flex-direction:column;background:#2a1250;font-size:24px;line-height:1.8;text-align:center}
 #landscapeNotice small{display:block;font-size:15px;color:#e3d2ff}
}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}
/* Short frames (320×568 …): the brand strip gives its line to the board (frontend-toc#285 lists no brand strip for the
   round; the task card still carries the campaign), so the board needs little or no shrinking beside the corner box. */
@media (max-height:600px){#brandStrip{display:none!important}}
/* The gear menu in two columns so it never scrolls above the avatar zone (320×568, English); a scrolled sheet keeps its
   closing button pinned to its bottom edge: the host measures every button where it is laid out, scrolled away or not. */
#settingsMenu .sheet-card{display:grid;grid-template-columns:1fr 1fr;column-gap:8px;align-items:center}
#settingsMenu .sheet-card h2,#settingsMenu #menuResume,#settingsMenu #menuRewards{grid-column:1/-1}
#settingsMenu .sheet-card button{margin:4px 0;padding:0 .6em;white-space:nowrap;font-size:clamp(13px,4.2cqw,20px)}
#settingsMenu .sheet-toggles{display:contents}
/* link-htx-2.1 (2.0 review M1): 结束本局 · four counts · gear in one row: English "End round" is wider, so the counts and the
   button tighten and the counts may shrink; nothing reaches under the gear. */
.theme-counts{gap:0;justify-content:space-between;padding-right:1cqw}
.theme-counts span{flex:0 1 auto;min-width:0}
:lang(en) #quit{padding:0 .7em}
:lang(en) .theme-counts span{column-gap:1px}
:lang(en) .theme-counts img{width:max(18px,5.6cqw);height:max(18px,5.6cqw)}
/* link-htx-2.5.1: the start page's one-line English name (2.5 had its own rule here) is htx-common-18's measured fit now, for
   both pages; the person's slot keeps clear of the whole block of words (htx-common-18 fitSlot). */

/* 2.5.15 reissue (#28): keep the complete speech bubble left of the host slot. */
#stage .htx-landing[data-room=on][data-campaign=on] .w-bubble{right:calc(var(--zb-h) * .75 + 4px);max-width:none;box-sizing:border-box;overflow-wrap:anywhere}
#stage .htx-landing[data-room=on][data-campaign=off][data-person=on] .w-bubble{right:calc(min(var(--zb-h),80cqw) * .75 + 4px);max-width:none;box-sizing:border-box;overflow-wrap:anywhere}
/* 无人物槽位时，欢迎气泡也为舞台右侧的完整浮动人物列留出空间。 */
#stage .htx-landing[data-room=off][data-campaign=on] .w-bubble{right:calc(160px - (min(100vw,calc(100dvh * 9 / 16),460px) - 100cqw) / 2);max-width:none;box-sizing:border-box;overflow-wrap:anywhere}
