/* 页面基础：占满视口并关闭滚动，保证触摸操作交给游戏画布。 */
html,
body {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    overflow: hidden;
    background: #fff8dc;
}
body {
    font-family: Helvetica, "Microsoft YaHei", sans-serif;
    text-align: center;
    color: #333;
}
body,
canvas,
div {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
#canvasDiv {
    width: 100%;
    height: 100%;
    touch-action: none;
}
#Cocos2dGameContainer {
    position: absolute;
    margin: 0;
    left: 0;
    top: 0;
}
canvas {
    display: block;
    outline: none;
    background: transparent;
}
[hidden] {
    display: none !important;
}
/* 加载/开始页：由 MyGameCtrl.begin 隐藏，由 fail 恢复并显示错误信息。 */
#splash {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff8dc;
}
#splash h1 {
    font-size: 28px;
    color: #d84315;
}
#loadingText {
    max-width: 85%;
    line-height: 1.6;
}
/* 按钮共用样式，包括开始、静音、继续、结束及重开。 */
button {
    border: 0;
    border-radius: 8px;
    padding: 12px 20px;
    background: #ff9800;
    color: white;
    font: 600 17px sans-serif;
    cursor: pointer;
    touch-action: manipulation;
}
button:disabled {
    opacity: 0.5;
    cursor: wait;
}
button:focus-visible {
    outline: 3px solid #704400;
    outline-offset: 3px;
}
/* 静音按钮位于加载页之上，并避开手机顶部安全区域。 */
#soundButton {
    position: fixed;
    z-index: 12;
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    padding: 8px 10px;
    font-size: 13px;
    background: rgba(96, 64, 28, 0.8);
}
/* 音频错误提示不接收指针事件，避免遮挡游戏操作。 */
#audioStatus {
    position: fixed;
    z-index: 12;
    bottom: 8px;
    left: 10%;
    width: 80%;
    margin: 0;
    font-size: 12px;
    pointer-events: none;
    color: #9b3517;
}
/* 胜利/结算弹窗：遮罩阻止点击穿透，内容由 game-controller.js 创建。 */
.dialog-mask {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
}
.dialog-box {
    box-sizing: border-box;
    width: 85%;
    max-width: 360px;
    padding: 25px 20px;
    background: #fff8dc;
    border: 4px solid #ff9800;
    border-radius: 16px;
    box-shadow: 0 8px 25px #0008;
}
.dialog-box h2 {
    margin: 0 0 12px;
    color: #d84315;
    font-size: 24px;
}
.dialog-box p {
    white-space: pre-line;
    font-size: 18px;
    line-height: 1.8;
    margin: 12px 0 22px;
}
.dialog-actions {
    display: flex;
    gap: 10px;
}
.dialog-actions button {
    flex: 1;
}
.dialog-actions button:first-child:not(:last-child) {
    background: #4caf50;
}
