* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
    font-family: 'STKaiti', 'KaiTi', 'Microsoft YaHei', sans-serif;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: none;
    -moz-text-size-adjust: none;
    -ms-text-size-adjust: none;
    -webkit-overflow-scrolling: touch;
}


#app {
    width: 100%;
    max-width: 100%;
    height: 100%;
    position: relative;
    background: url('../images/bg_main.jpg') no-repeat center center fixed;
    background-size: cover;
    overflow: hidden;
}

#app.desktop-mode {
    max-width: 600px;
    margin: 0 auto;
    background-attachment: scroll;
}

.page {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow: hidden;
}

.page.active {
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    padding-left: 10px;
}

.back-btn {
    width: 45px;
    height: 45px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: transform 0.3s;
}

.back-btn img {
    width: 100%;
    height: 100%;
}

.back-btn:hover {
    transform: scale(1.1);
}

/* 封面页面 */
#coverPage {
    background: url('../images/bg_home.jpg') no-repeat center center;
    background-size: cover;
    background-attachment: scroll;
}

.cover-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100vh;
    position: relative;
    padding-top: 60px;
}

.cover-title {
    margin-bottom: 10px;
    opacity: 0;
    animation: zoomIn 1s ease-out forwards;
}

.cover-title img {
    max-width: 100%;
    height: auto;
}

.cover-play-btn {
    width: 200px;
    height: 60px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s;
    opacity: 0;
    animation: fadeInUp 1s ease-out 1s forwards;
    margin-top: auto;
    margin-bottom: 140px;
}

.cover-play-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cover-play-btn:hover {
    transform: scale(1.08);
}

.cover-logo {
    position: absolute;
    bottom: 35px;
}

.cover-logo img {
    max-width: 120px;
    height: auto;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 模式选择页面 */
.mode-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 80px;
    height: calc(100vh - 80px);
}
.mode-title{
    width: 80%;
}
.mode-title img {
    max-width: 100%;
    height: auto;
    margin-bottom: 40px;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.mode-btn {
    width: 55vw;
    max-width: 240px;
    height: 18vw;
    margin-top: 4vh;
    max-height: 80px;
    min-height: 60px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.mode-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mode-btn:hover {
    transform: scale(1.05);
}

.mode-btn.active {
    filter: brightness(1.1);
}

.mode-btn.locked {
    cursor: not-allowed;
    opacity: 0.6;
}

.mode-btn.locked:hover {
    transform: none;
}

/* 游戏页面 */
.game-header-info {
    display: flex;
    gap: 40px;
    align-items: center;
    justify-content: center;
    margin-top: 40px;
}

.difficulty-badge {
    display: flex;
    align-items: center;
    width: 38vw;
    max-width: 180px;
    height: 12vw;
    max-height: 55px;
}

.difficulty-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.timer-badge {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url('../images/countdown_bg.png') no-repeat center center;
    background-size: contain;
    width: 38vw;
    max-width: 180px;
    height: 12vw;
    max-height: 55px;
}

.timer-badge span {
    position: absolute;
    color: white;
    font-size: 1.4rem;
    font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;
    font-weight: bold;
    text-align: left;
    letter-spacing: 2px;
    left: 55%;
    transform: translateX(-50%);
}

.game-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 60px;
}

.game-board {
    display: grid;
    gap: clamp(2px, 1.2vw, 6px);
    padding: clamp(20px, 8vw, 34px);
    background: url('../images/bg_chessboard.png') no-repeat center center;
    background-size: cover;
    aspect-ratio: 1;
    max-width: 350px;
    width: 90%;
}

.tile {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(20px, 8vw, 36px);
    font-weight: bold;
    background: url('../images/bg_chess.png') no-repeat center center;
    background-size: cover;
    color: #5d4e37;
    border-radius: 4px;
    cursor: grab;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1;
}

.tile:active {
    cursor: grabbing;
}


.tile.empty {
    background: transparent;
    cursor: default;
    box-shadow: none;
}

.tile.empty:hover {
    transform: none;
}

.tile.dragging {
    z-index: 100;
    opacity: 0.9;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.tile.hint {
    animation: pulse 0.5s ease-in-out infinite;
    border: 3px solid #ffd700;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.game-controls {
    margin-top: 30px;
}

.control-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s;
    width: 30vw;
    max-width: 150px;
}

.control-btn img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.control-btn:hover {
    transform: scale(1.05);
}

/* 结果页面 */
.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 30px;
}

.answer-image {
    max-width: 100%;
    height: auto;
    margin-bottom: 30px;
}

.result-controls {
    margin-top: 10px;
}

.result-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s;
    width: 35vw;
    max-width: 180px;
}

.result-btn img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.result-btn:hover {
    transform: scale(1.05);
}

.end-title {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

.end-title img {
    max-width: 80%;
    height: auto;
    object-fit: contain;
}
.best-records {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 40px;
    border-radius: 15px;
    margin-bottom: 35px;
}

.best-records h3 {
    font-size: 1.2rem;
    color: #2c5f7c;
    margin-bottom: 15px;
}

.best-records p {
    font-size: 1rem;
    color: #555;
    margin-bottom: 8px;
}

.end-btn {
    padding: 15px 50px;
    background: linear-gradient(135deg, #c46868, #a54a4a);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 6px 20px rgba(196, 104, 104, 0.5);
}

.end-btn img {
    height: 35px;
    width: auto;
}

.end-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(196, 104, 104, 0.6);
}

/* 背景音乐控制按钮 */
#bgm {
    display: none;
    position: absolute;
    width: 40px;
    height: 40px;
    top: 3vh;
    right: 3vw;
    cursor: pointer;
    z-index: 9;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    animation: rotate 2s linear infinite;
    -webkit-animation: rotate 2s linear infinite;
}

#bgm .mob-icon {
    display: none;
}

#bgm img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@-webkit-keyframes rotate {
    0% {
        -webkit-transform: rotate(0);
        transform: rotate(0);
    }
    to {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

@keyframes rotate {
    0% {
        -webkit-transform: rotate(0);
        transform: rotate(0);
    }
    to {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

/* 响应式设计 */
@media (max-width: 480px) {
    
    .header {
        padding: 10px 5px;
    }
    
    .back-btn {
        width: 40px;
        height: 40px;
    }
    
    .mode-title img {
        margin-bottom: 30px;
    }
    
    .mode-btn {
        width: 200px;
        height: 70px;
    }
    
    .game-header-info {
        gap: 20px;
        margin-top: 35px;
    }
    
    .difficulty-badge {
        width: 140px;
        height: 45px;
    }
    
    .timer-badge {
        width: 140px;
        height: 45px;
    }
    
    .timer-badge span {
        font-size: clamp(14px, 3.5vw, 18px);
        font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;
        font-weight: bold;
        left: 55%;
    }
    
    .control-btn {
        width: 120px;
    }
    
    .game-content {
        margin-top: 50px;
    }
    
    .tile {
        font-size: clamp(16px, 6vw, 28px);
    }
    
    .result-btn {
        width: 150px;
    }
}

@media (max-width: 360px) {
    .tile {
        font-size: clamp(14px, 5vw, 24px);
    }
}
@media only screen and (max-width: 750px){
    .g_pub_header{
        display:none !important;
    }
    .g_pub_footer_box{
        min-width:0 !important;
    }
}
