* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 20px;
    max-width: 900px;
    width: 100%;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 500px;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 50%, #98D8C8 100%);
    border: 3px solid #333;
    border-radius: 8px;
    cursor: pointer;
}

/* NPC 对话气泡（图中狐狸头顶对话框） */
.npc-dialog {
    position: absolute; /* 相对于canvas-wrapper定位 */
    top: 0;
    left: 0;
    z-index: 20;
    pointer-events: none; /* 不阻挡游戏点击/按键 */
    transform: translateZ(0); /* 启用硬件加速 */
}

.npc-dialog__bubble {
    position: relative;
    min-width: 160px;
    max-width: 280px;
    padding: 14px 16px;
    background: #DDE4FF;
    border: 2px solid #111;
    border-radius: 10px;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15);
}

.npc-dialog__bubble::after {
    content: "";
    position: absolute;
    right: 18px;
    bottom: -14px;
    width: 0;
    height: 0;
    border-width: 14px 12px 0 12px;
    border-style: solid;
    border-color: #DDE4FF transparent transparent transparent;
    filter: drop-shadow(0 -2px 0 #111);
}

.npc-dialog__text {
    color: #0D1127;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.5px;
    white-space: pre-line; /* 支持换行显示 */
    white-space: pre-line; /* 支持 \n 换行 */
}

/* 左上角得分显示框 */
.score-box {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #000;
    border: 3px solid yellow;
    border-radius: 1em;
    padding: 0.8em 1.2em;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    font-size: 1rem;
    color: #fff;
    font-weight: bolder;
    line-height: 1.4;
    z-index: 10;
    transition: cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.4s;
    box-shadow: -5px 5px 0px 0px yellow;
}

.score-box:hover {
    transform: translate(5px, -5px);
}

.score-line {
    white-space: nowrap;
}

/* 顶部中央倒计时显示框 */
.timer-box {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border: none;
    font-size: 17px;
    color: #fff;
    border-radius: 7px;
    letter-spacing: 4px;
    font-weight: 700;
    text-transform: uppercase;
    transition: 0.5s;
    transition-property: box-shadow;
    background: rgb(0,140,255);
    box-shadow: 0 0 25px rgb(0,140,255);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    white-space: nowrap;
    cursor: default;
}

.timer-box:hover {
    box-shadow: 0 0 5px rgb(0,140,255),
                0 0 25px rgb(0,140,255),
                0 0 50px rgb(0,140,255),
                0 0 100px rgb(0,140,255);
}

.timer-icon {
    font-size: 20px;
    display: inline-block;
}

.timer-box span:not(.timer-icon) {
    letter-spacing: 2px;
}

/* 右上角控制按钮 */
.control-buttons {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

/* 暂停按钮 */
.pause-btn {
    position: relative;
    background: #0D1127;
    border: 3px solid #5978F3;
    border-radius: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.3s;
}

.pause-btn:hover {
    background: #0F1C53;
}

.pause-bar {
    width: 4px;
    height: 16px;
    background: white;
    display: block;
    border-radius: 2px;
}

/* 退出按钮 */
.exit-btn {
    position: relative;
    background: #0D1127;
    border: 3px solid #5978F3;
    border-radius: 0.5rem;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.3s;
}

.exit-btn:hover {
    background: #0F1C53;
}

.exit-arrow {
    color: white;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

/* 暂停弹窗 */
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    z-index: 50;
    cursor: pointer;
}

.pause-overlay.show {
    display: flex;
}

.pause-content {
    position: relative;
    width: 280px;
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.5rem;
    gap: 12px;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    text-align: center;
    pointer-events: none;
}

.pause-content::before {
    content: '';
    position: absolute;
    inset: 0;
    left: -5px;
    margin: auto;
    width: 290px;
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(-45deg, #e81cff 0%, #40c9ff 100%);
    z-index: -10;
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pause-content::after {
    content: "";
    z-index: -1;
    position: absolute;
    inset: 0;
    background: linear-gradient(-45deg, #fc00ff 0%, #00dbde 100%);
    transform: translate3d(0, 0, 0) scale(0.95);
    filter: blur(20px);
    border-radius: 8px;
}

.pause-content h2 {
    font-size: 1.25rem;
    text-transform: capitalize;
    font-weight: 700;
    margin: 0;
    color: white;
}

.pause-content .pause-hint {
    font-size: 0.875rem;
    margin: 0;
    color: #e81cff;
    font-weight: 600;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    z-index: 100;
}

.game-overlay.show {
    display: flex;
}

.overlay-content {
    position: relative;
    width: 320px;
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.5rem;
    gap: 12px;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    text-align: center;
}

.overlay-content::before {
    content: '';
    position: absolute;
    inset: 0;
    left: -5px;
    margin: auto;
    width: 330px;
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(-45deg, #e81cff 0%, #40c9ff 100%);
    z-index: -10;
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay-content::after {
    content: "";
    z-index: -1;
    position: absolute;
    inset: 0;
    background: linear-gradient(-45deg, #fc00ff 0%, #00dbde 100%);
    transform: translate3d(0, 0, 0) scale(0.95);
    filter: blur(20px);
    border-radius: 8px;
}

.overlay-content:hover::after {
    filter: blur(30px);
}

.overlay-content:hover::before {
    transform: rotate(-90deg) scaleX(1.34) scaleY(0.77);
}

.overlay-content h2 {
    font-size: 1.25rem;
    text-transform: capitalize;
    font-weight: 700;
    margin: 0;
    color: white;
}

.overlay-content p:not(h2) {
    font-size: 0.875rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
}

#restart-btn {
    display: block;
    width: 100%;
    background: linear-gradient(-45deg, #e81cff 0%, #40c9ff 100%);
    padding: 0.75rem;
    text-align: center;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
}

#restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 28, 255, 0.4);
}

/* 游戏开始界面 */
.start-screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    z-index: 200;
}

.start-screen-overlay.hidden {
    display: none;
}

.start-screen-content {
    position: relative;
    width: 400px;
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    gap: 2rem;
    border-radius: 12px;
    color: white;
    text-align: center;
}

.start-screen-content::before {
    content: '';
    position: absolute;
    inset: 0;
    left: -5px;
    margin: auto;
    width: 410px;
    height: 100%;
    border-radius: 14px;
    background: linear-gradient(-45deg, #e81cff 0%, #40c9ff 100%);
    z-index: -10;
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.start-screen-content::after {
    content: "";
    z-index: -1;
    position: absolute;
    inset: 0;
    background: linear-gradient(-45deg, #fc00ff 0%, #00dbde 100%);
    transform: translate3d(0, 0, 0) scale(0.95);
    filter: blur(20px);
    border-radius: 12px;
}

.game-title {
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
    color: white;
    text-shadow: 0 0 20px rgba(232, 28, 255, 0.8);
    letter-spacing: 4px;
}

#start-game-btn {
    display: block;
    width: 200px;
    background: linear-gradient(-45deg, #e81cff 0%, #40c9ff 100%);
    padding: 1rem 2rem;
    text-align: center;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 2px;
}

#start-game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(232, 28, 255, 0.6);
}












