html {
    -ms-touch-action: none;
}

body,
canvas,
div {
    display: block;
    outline: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -khtml-user-select: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* Remove spin of input type number */

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    /* display: none; <- Crashes Chrome on hover */
    -webkit-appearance: none;
    margin: 0;
    /* <-- Apparently some margin are still there even though it's hidden */
}

body {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    margin: 0;
    cursor: default;
    color: #888;
    background-color: #333;
    text-align: center;
    font-family: Helvetica, Verdana, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    /* fix bug: https://github.com/cocos-creator/2d-tasks/issues/791 */
    /* overflow cannot be applied in Cocos2dGameContainer, 
  otherwise child elements will be hidden when Cocos2dGameContainer rotated 90 deg */
    overflow: hidden;
}

#Cocos2dGameContainer {
    position: absolute;
    margin: 0;
    left: 0px;
    top: 0px;
    display: -webkit-box;
    -webkit-box-orient: horizontal;
    -webkit-box-align: center;
    -webkit-box-pack: center;
}

canvas {
    background-color: rgba(0, 0, 0, 0);
}

a:link,
a:visited {
    color: #666;
}

a:active,
a:hover {
    color: #666;
}

p.header {
    font-size: small;
}

p.footer {
    font-size: x-small;
}

#splash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff url(./singleColor.png) no-repeat center;
    background-size: 100%;
}

.progress-bar {
    background-color: #1a1a1a;
    position: absolute;
    left: 25%;
    top: 80%;
    height: 15px;
    padding: 5px;
    width: 50%;
    /*margin: 0 -175px;         */
    border-radius: 5px;
    box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: 3px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
    transition: width .4s ease-in-out;
    background-color: #34c2e3;
}

.stripes span {
    background-size: 30px 30px;
    background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
    animation: animate-stripes 1s linear infinite;
}

@keyframes animate-stripes {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 60px 0;
    }
}


/* 响应式外壳 v2：电脑端显示为居中的手机比例框，避免 Cocos 场景在宽屏下错位；手机端自动占满可用宽高 */
html {
    width: 100%;
    height: 100%;
    background: #fff5fa;
    overflow: hidden;
}

body {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: var(--app-height, 100vh);
    min-height: var(--app-height, 100vh);
    overflow: hidden;
    background: radial-gradient(circle at top, #fffafd 0%, #ffeaf3 45%, #fff5fa 100%);
    overscroll-behavior: none;
}

#canvasDiv {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    width: var(--game-width, min(100vw, 56.25vh)) !important;
    height: var(--game-height, min(100vh, 177.7778vw)) !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    overflow: hidden !important;
    background: #000;
    box-shadow: 0 18px 42px rgba(214, 51, 132, 0.16);
}

#Cocos2dGameContainer {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
}

#GameCanvas {
    width: 100% !important;
    height: 100% !important;
    outline: none;
    touch-action: none;
}

#loadingText,
#loadingImg,
#adContainer {
    position: fixed !important;
}

#splash,
#block-Box {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

#loadingImg img {
    width: min(56px, 12vw) !important;
    height: auto !important;
}

/* v3：广告遮罩已不使用，强制不拦截鼠标/触摸，避免电脑端看得到但点不了 */
#block-Box { display: none !important; pointer-events: none !important; }
#contentElement { pointer-events: none !important; }


/* v4：右上角游戏菜单。菜单层默认不挡游戏点击，只有按钮/弹窗本身接收点击 */
#wm-menu-layer { position: fixed; inset: 0; z-index: 1000; pointer-events: none; font-family: Helvetica, Verdana, Arial, sans-serif; }
#wm-menu-toggle { position: fixed; left: calc(50% + var(--game-half-width, 28.125vh) - 14px); top: calc(50% - var(--game-half-height, 50vh) + max(28px, calc(env(safe-area-inset-top) + 4px))); transform: translateX(-100%); width: 42px; height: 42px; border: 0; border-radius: 999px; background: rgba(255, 245, 250, 0.92); color: #d63384; box-shadow: 0 6px 18px rgba(214, 51, 132, 0.2); font-size: 23px; font-weight: 800; line-height: 42px; text-align: center; pointer-events: auto; cursor: pointer; touch-action: manipulation; z-index: 1002; }
#wm-menu-toggle:active { transform: translateX(-100%) scale(0.96); }
#wm-menu-mask { position: fixed; inset: 0; background: rgba(55, 16, 35, 0.2); opacity: 0; pointer-events: none; transition: opacity 0.18s ease; }
#wm-menu-panel { position: fixed; visibility: hidden; left: calc(50% + var(--game-half-width, 28.125vh) - 16px); top: calc(50% - var(--game-half-height, 50vh) + max(70px, calc(env(safe-area-inset-top) + 70px))); width: min(240px, calc(var(--game-width, min(100vw, 56.25vh)) - 32px)); max-height: calc(var(--game-height, min(100vh, 177.7778vw)) - 100px); overflow: auto; box-sizing: border-box; padding: 14px; border: 1px solid rgba(255, 184, 214, 0.78); border-radius: 20px; background: rgba(255, 250, 253, 0.96); box-shadow: 0 18px 42px rgba(92, 34, 61, 0.22); transform: translateX(-100%) translateY(-8px) scale(0.98); opacity: 0; pointer-events: none; transition: opacity 0.18s ease, transform 0.18s ease; z-index: 1001; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.wm-menu-open #wm-menu-mask { opacity: 1; pointer-events: auto; }
.wm-menu-open #wm-menu-panel { visibility: visible; opacity: 1; transform: translateX(-100%) translateY(0) scale(1); pointer-events: auto; }
body:not(.wm-menu-open) #wm-menu-panel, body:not(.wm-menu-open) #wm-menu-panel * { pointer-events: none !important; cursor: default !important; }
.wm-menu-open #wm-menu-panel .wm-menu-item, .wm-menu-open #wm-menu-close { pointer-events: auto; cursor: pointer; }
.wm-menu-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; text-align: left; }
#wm-menu-title { color: #d63384; font-size: 18px; font-weight: 800; line-height: 1.2; }
.wm-menu-subtitle { margin-top: 3px; color: #a96b87; font-size: 12px; }
#wm-menu-close { width: 30px; height: 30px; border: 0; border-radius: 999px; background: #ffeaf3; color: #d63384; font-size: 22px; line-height: 28px; text-align: center; pointer-events: auto; cursor: pointer; }
.wm-menu-item { display: block; width: 100%; min-height: 42px; margin: 8px 0; border: 0; border-radius: 14px; background: linear-gradient(180deg, #ffeaf3, #ffd8e8); color: #7a3152; font-size: 15px; font-weight: 700; text-align: center; box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 5px 14px rgba(214, 51, 132, 0.12); pointer-events: auto; cursor: pointer; touch-action: manipulation; }
.wm-menu-item:active { transform: scale(0.98); }
.wm-menu-note { margin-top: 10px; color: #b47a94; font-size: 11px; line-height: 1.45; text-align: left; }
#wm-toast { position: fixed; left: 50%; bottom: calc(50% - var(--game-half-height, 50vh) + 26px); transform: translateX(-50%) translateY(8px); max-width: calc(var(--game-width, min(100vw, 56.25vh)) - 42px); padding: 9px 14px; border-radius: 999px; background: rgba(95, 37, 65, 0.88); color: #fff; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity 0.18s ease, transform 0.18s ease; z-index: 1003; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#wm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 420px) { #wm-menu-toggle { width: 38px; height: 38px; line-height: 38px; font-size: 21px; } #wm-menu-panel { width: min(226px, calc(var(--game-width, 100vw) - 28px)); } }

/* v6：菜单按钮微调 + 排行榜/登录弹窗 */
#wm-menu-toggle { top: calc(50% - var(--game-half-height, 50vh) + max(28px, calc(env(safe-area-inset-top) + 4px))) !important; }
.wm-upload-hidden { display: none !important; }
#wm-modal { position: fixed; inset: 0; z-index: 1100; pointer-events: none; opacity: 0; transition: opacity 0.18s ease; font-family: Helvetica, Verdana, Arial, sans-serif; }
#wm-modal.show { pointer-events: auto; opacity: 1; }
.wm-modal-mask { position: absolute; inset: 0; background: rgba(55, 16, 35, 0.28); }
.wm-modal-card { position: absolute; left: 50%; top: 50%; width: min(320px, calc(var(--game-width, min(100vw, 56.25vh)) - 36px)); max-height: min(560px, calc(var(--game-height, min(100vh, 177.7778vw)) - 70px)); overflow: auto; transform: translate(-50%, -50%); box-sizing: border-box; padding: 16px; border: 1px solid rgba(255, 184, 214, 0.88); border-radius: 22px; background: rgba(255, 250, 253, 0.98); box-shadow: 0 22px 48px rgba(92, 34, 61, 0.26); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.wm-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
#wm-modal-title { color: #d63384; font-size: 20px; font-weight: 800; }
#wm-modal-close { width: 32px; height: 32px; border: 0; border-radius: 999px; background: #ffeaf3; color: #d63384; font-size: 24px; line-height: 30px; text-align: center; cursor: pointer; }
.wm-rank-loading, .wm-rank-empty { padding: 22px 8px; color: #9a6079; font-size: 14px; text-align: center; }
.wm-rank-list { display: grid; gap: 8px; }
.wm-rank-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border-radius: 14px; background: linear-gradient(180deg, #fff5fa, #ffeaf3); color: #7a3152; font-size: 14px; }
.wm-rank-no { color: #d63384; font-weight: 900; text-align: center; }
.wm-rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.wm-rank-score { color: #9a4c6f; font-weight: 900; }

/* v7：登录不跳转，新增手动结束确认按钮 */
.wm-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.wm-modal-btn { min-height: 40px; border: 0; border-radius: 14px; background: linear-gradient(180deg, #ffeaf3, #ffd8e8); color: #7a3152; font-size: 14px; font-weight: 800; box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 5px 14px rgba(214, 51, 132, 0.12); cursor: pointer; }
.wm-modal-btn-ghost { background: #fff5fa; color: #a96b87; }
.wm-modal-btn:active { transform: scale(0.98); }
#wm-click-guard { position: fixed; inset: 0; z-index: 999; pointer-events: none; background: transparent; }
.wm-touch-guard #wm-click-guard { pointer-events: auto; }

/* v15：补回登录弹窗样式，避免输入框/按钮变成浏览器默认样式 */
.wm-auth-current { margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; background: #fff2f7; color: #7a3152; font-size: 13px; line-height: 1.5; text-align: left; }
.wm-auth-muted { color: #a96b87; }
.wm-auth-box { display: flex; flex-direction: column; gap: 10px; }
.wm-auth-title { color: #d63384; font-size: 16px; font-weight: 800; text-align: left; }
.wm-auth-input { width: 100%; height: 42px; box-sizing: border-box; border: 1px solid rgba(255, 184, 214, 0.95); border-radius: 14px; background: rgba(255,255,255,0.96); color: #7a3152; font-size: 15px; padding: 0 12px; outline: none; appearance: none; -webkit-appearance: none; }
.wm-auth-input:focus { border-color: #d63384; box-shadow: 0 0 0 3px rgba(214, 51, 132, 0.12); }
.wm-auth-submit { width: 100%; }
.wm-auth-link { border: 0; background: transparent; color: #d63384; font-size: 13px; font-weight: 700; text-decoration: underline; cursor: pointer; pointer-events: auto; }
.wm-auth-tip { color: #b47a94; font-size: 12px; line-height: 1.45; text-align: left; }
.wm-auth-actions { margin-top: 14px; }
.wm-auth-actions .wm-modal-btn { flex: 1; min-width: 0; }
