/* 山海英雄传 · 页面：画布居中、整数倍放大；触屏按键；声音、暂停、全屏三个小按钮。 */
:root { --sh-h: 0px; }
html, body { margin: 0; height: 100%; background: #07080d; color: #f4ead8; overflow: hidden; }
body { font-family: 'HW Work', 'Noto Serif SC', serif; -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
.sh { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.sh-stage { display: flex; align-items: center; justify-content: center; width: 100%; flex: 1 1 auto; min-height: 0; }
#cv { display: block; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; outline: none; background: #0c0f1a; }
html.sh-portrait .sh { justify-content: flex-start; }
html.sh-portrait .sh-stage { flex: 0 0 auto; margin-top: env(safe-area-inset-top); }

/* 声音、暂停、全屏 */
.sh-bar { position: absolute; top: max(6px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 6; }
.sh-ib { width: 30px; height: 30px; padding: 0; border-radius: 7px; border: 1px solid rgba(240, 200, 112, .38); background: rgba(14, 12, 20, .72); color: #f0c870; display: grid; place-items: center; cursor: pointer; }
.sh-ib[hidden] { display: none; }
.sh-ib:hover { background: rgba(40, 32, 22, .85); }
.sh-ib:focus-visible { outline: 2px solid #f0c870; outline-offset: 2px; }
.sh-ib svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sh-ib svg .f { fill: currentColor; stroke: none; }
#bSnd .off { display: none; }
#bSnd.off .on { display: none; }
#bSnd.off .off { display: block; }
.sh-pause { display: none; }
html.sh-infight .sh-pause { display: grid; }

/* 触屏按键：横屏时只在战斗里出现，叠在画面两下角；竖屏时放在画面下面 */
.sh-pad { display: none; position: absolute; left: 0; right: 0; bottom: 0; top: 0; pointer-events: none; z-index: 5; }
html.sh-touch.sh-infight .sh-pad, html.sh-touch.sh-portrait .sh-pad { display: block; }
.sh-pad button { pointer-events: auto; touch-action: none; -webkit-user-select: none; user-select: none; padding: 0; margin: 0; border: 2px solid rgba(240, 200, 112, .55); background: rgba(14, 12, 22, .42); color: #fff2d0; display: grid; place-items: center; font-family: 'SH Pixel', 'HW Work', sans-serif; font-size: 24px; line-height: 1; -webkit-font-smoothing: none; }
html[lang="en"] .sh-pad button { font-size: 12px; }
.sh-pad button.on { background: rgba(240, 200, 112, .45); border-color: #ffe8a0; }
.sh-pad b { font-weight: 400; pointer-events: none; }
.sh-dpad { position: absolute; left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom)); display: flex; gap: 6px; }
.sh-dpad button { width: 58px; height: 58px; border-radius: 12px; }
.sh-acts { position: absolute; right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: 60px 60px; grid-template-rows: 60px 60px; gap: 8px; }
.sh-acts button { border-radius: 50%; }
.sh-acts .b-atk { border-color: rgba(255, 150, 110, .75); }
.sh-acts .b-ult { opacity: .55; }
.sh-acts .b-ult.ready { opacity: 1; border-color: #ffe060; background: rgba(240, 190, 60, .35); box-shadow: 0 0 12px rgba(255, 220, 90, .6); }
.tri { width: 0; height: 0; border: 11px solid transparent; pointer-events: none; }
.tri.l { border-right-color: #fff2d0; border-left-width: 0; }
.tri.r { border-left-color: #fff2d0; border-right-width: 0; }
.tri.d { border-top-color: #fff2d0; border-bottom-width: 0; }
html.sh-portrait .sh-pad { top: auto; height: calc(100% - var(--sh-h) - env(safe-area-inset-top)); }
html.sh-portrait .sh-dpad { bottom: max(30px, env(safe-area-inset-bottom)); left: max(12px, env(safe-area-inset-left)); }
html.sh-portrait .sh-dpad button { width: 56px; height: 64px; }
html.sh-portrait .sh-acts { bottom: max(30px, env(safe-area-inset-bottom)); right: max(12px, env(safe-area-inset-right)); grid-template-columns: 62px 62px; grid-template-rows: 62px 62px; gap: 10px; }
html.sh-portrait .sh-pad button { background: rgba(28, 24, 38, .9); }
/* 竖屏：小按钮和「一步步看」都放到画面下面的空处，不压画面 */
html.sh-portrait .sh-bar { top: calc(var(--sh-h) + env(safe-area-inset-top) + 82px); left: auto; right: 12px; transform: none; }
html.sh-portrait .sh-bar .sh-ib { width: 40px; height: 40px; }
html.sh-portrait .hwt:not(.hwt-list) { top: calc(var(--sh-h) + env(safe-area-inset-top) + 82px) !important; bottom: auto !important; left: 12px !important; transform: none !important; }

/* 竖屏提示 */
.sh-rot { position: absolute; left: 12px; right: 12px; top: calc(var(--sh-h) + env(safe-area-inset-top) + 12px); z-index: 6; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(30, 24, 18, .92); border: 1px solid rgba(240, 200, 112, .4); font-size: 15px; line-height: 1.5; }
.sh-rot[hidden] { display: none; }
.sh-rot p { margin: 0; flex: 1; }
.sh-rot button { font: inherit; color: #1b1610; background: #f0c870; border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer; }

/* 一步步看：演示那一步卡片放到上面 */
html.sh-tour-top .hwt:not(.hwt-list) { top: max(8px, env(safe-area-inset-top)) !important; bottom: auto !important; }
html.sh-tour-top .sh-bar { visibility: hidden; }
/* 一步步看：战斗时把启动按钮收起来，免得挡住血条 */
html.sh-infight .hwt > .hwt-launch { display: none; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nojs { position: fixed; inset: auto 0 40% 0; text-align: center; font-size: 16px; }

/* 出海报、缩略图用（?bare）：只留画面 */
html.bare .sh-bar, html.bare .sh-pad, html.bare .sh-rot, html.bare .wk-pill, html.bare .hwt { display: none !important; }
