/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

:root {
    --primary-color: #1e88e5;
    --secondary-color: #64b5f6;
    --accent-color: #00c8ff;
    --dark-bg: #0a192f;
    --panel-bg: rgba(22, 33, 62, 0.85);
    --success-color: #4caf50;
    --error-color: #e53935;
}

body {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background-color: var(--dark-bg);
    color: white;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 星空背景 */
#starBackground {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* 玻璃质感面板 */
.modal-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 15px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, transform 0.3s;
}

.modal-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.panel-header {
    position: relative;
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.panel-header h2 {
    font-size: 1.6rem;
    color: white;
}

.close-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.3s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.panel-content {
    padding: 10px;
}

/* 页面布局 */
.page {
    width: 90%;
    max-width: 1000px;
    height: 85vh;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.page.active {
    display: flex;
}

/* 游戏页面特殊样式 */
#gamePage {
    height: 85vh;
    overflow: hidden;
    justify-content: flex-start;
    padding-top: 0;
    position: relative;
}

/* 游戏界面整体布局调整 */
.game-page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    /* 恢复自然的内边距设置 */
    padding: 0;
    /* 火狐浏览器滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 200, 255, 0.5) rgba(10, 25, 47, 0.5);
    -webkit-overflow-scrolling: touch;
}

/* 自定义滚动条样式 - 更美观现代的设计 */
/* 滚动条整体 */
.game-page-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

/* 滚动条轨道 */
.game-page-content::-webkit-scrollbar-track {
    background: rgba(10, 25, 47, 0.5);
    border-radius: 10px;
    margin: 5px 0;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}

/* 滚动条滑块 */
.game-page-content::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #1e88e5, #00c8ff);
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(0, 200, 255, 0.5);
    border: 2px solid transparent;
    background-clip: content-box;
}

/* 鼠标悬停在滑块上 */
.game-page-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #00c8ff, #64b5f6);
    box-shadow: 0 0 12px rgba(0, 200, 255, 0.7);
}

/* 滚动条角落 */
.game-page-content::-webkit-scrollbar-corner {
    background: transparent;
}

/* 游戏头部固定样式 - 使用更自然的粘性定位 */
.game-header-container {
    position: sticky;
    top: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--dark-bg);
    padding: 10px 0;
    z-index: 30;
    /* 更微妙的阴影效果 */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    /* 增加上下文隔离以防止内容透过 */
    isolation: isolate;
}

/* 游戏信息面板 */
.game-header {
    display: flex;
    justify-content: space-between;
    width: 90%;
    max-width: 800px;
    padding: 6px 12px;
    margin-bottom: 6px;
    background-color: var(--dark-bg);
    /* 确保背景不透明 */
}

/* 增强进度条样式 */
.progress-bar {
    width: 90%;
    max-width: 800px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 0 12px 0;
    position: relative;
}

/* 游戏网格容器 - 确保与顶部有足够间距 */
.game-grid-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* 增加与顶部的间距 */
    padding: 15px 0;
    margin-top: 5px;
    flex-grow: 1;
}

/* 确保网格单元格之间有适当的间距 */
.game-grid {
    margin-top: 10px;
}

/* 错误列表容器固定在底部 */
.error-list-container {
    margin-top: 15px;
    margin-bottom: 15px;
}

/* 终止游戏按钮固定在底部 */
.stop-btn-container {
    margin-top: auto;
    padding: 15px 0;
}

/* 首页样式 */
.title-container {
    text-align: center;
    margin-bottom: 40px;
}

.main-title {
    font-size: 3.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 10px var(--accent-color), 0 0 20px var(--accent-color);
    margin-bottom: 5px;
    animation: glow 2s infinite alternate;
}

.sub-title {
    font-size: 1.5rem;
    color: var(--secondary-color);
    font-weight: normal;
}

.upload-container {
    margin-bottom: 30px;
    text-align: center;
}

#fileNameDisplay {
    margin-top: 10px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

/* 按钮样式 */
.primary-btn,
.secondary-btn {
    padding: 10px 25px;
    border-radius: 50px;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 10px;
    outline: none;
    position: relative;
    overflow: hidden;
}

.primary-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 200, 255, 0.3);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.primary-btn:hover,
.secondary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(0, 200, 255, 0.4);
}

.primary-btn:active,
.secondary-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(0, 200, 255, 0.2);
}

.primary-btn::after,
.secondary-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.primary-btn:focus:not(:active)::after,
.secondary-btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

/* 设置面板样式 */
.setting-group {
    margin-bottom: 20px;
}

.setting-group h3 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.radio-group label {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    margin-right: 10px;
}

.custom-input {
    margin-top: 8px;
    margin-left: 25px;
    display: flex;
    align-items: center;
}

.custom-input input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    margin-right: 10px;
    outline: none;
    transition: border 0.3s;
}

.custom-input input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 200, 255, 0.25);
}

.slider-container {
    width: 100%;
    padding: 0 10px;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 200, 255, 0.5);
}

.panel-buttons {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* 游戏界面样式 */
.game-header {
    display: flex;
    justify-content: space-between;
    width: 90%;
    max-width: 800px;
    padding: 6px 12px;
    margin-bottom: 6px;
}

.score-display,
.combo-display,
.timer-display {
    font-size: 1rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#scoreValue,
#comboValue,
#timerValue {
    color: var(--accent-color);
}

.progress-bar {
    width: 90%;
    max-width: 800px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
    z-index: 1000;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 75%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 5px;
    transition: width 0.3s linear;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 6px;
    width: 90%;
    max-width: 800px;
    margin-bottom: 15px;
}

.grid-cell {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
    transform-style: preserve-3d;
    position: relative;
    overflow: hidden;
    padding: 5px;
    max-height: 80px;
}

.grid-cell-content {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
    hyphens: auto;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
}

.grid-cell:hover {
    transform: translateY(-5px) rotate(2deg);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.grid-cell.selected {
    background: rgba(0, 200, 255, 0.3);
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0, 200, 255, 0.4);
}

.grid-cell.cleared {
    visibility: hidden;
    opacity: 0;
    transform: scale(0);
    transition: transform 0.5s, opacity 0.5s;
}

/* 匹配成功特效 */
.grid-cell.success {
    background: rgba(28, 128, 107, 0.6) !important;
    border: 1px solid rgba(76, 175, 80, 0.6);
    box-shadow: 0 0 25px rgba(76, 175, 80, 0.8) !important;
    animation: successPulse 0.5s forwards;
    color: white;
    font-weight: bold;
    z-index: 5;
}

.grid-cell.success::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(76, 175, 80, 0.8) 0%, rgba(76, 175, 80, 0) 70%);
    border-radius: 10px;
    opacity: 0;
    animation: glowFadeIn 0.5s forwards;
}

/* 匹配失败特效 */
.grid-cell.failure {
    background: rgba(128, 28, 28, 0.6) !important;
    border: 1px solid rgba(229, 57, 53, 0.6);
    box-shadow: 0 0 15px rgba(229, 57, 53, 0.5) !important;
    color: white;
    font-weight: bold;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.grid-cell.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes glowFadeIn {
    0% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.7;
    }
}

/* 粒子效果 */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    background-color: rgba(76, 175, 80, 0.8);
    border-radius: 50%;
    pointer-events: none;
    animation: particleAnim 1s ease-out forwards;
}

@keyframes particleAnim {
    0% {
        transform: scale(0) translate(0, 0);
        opacity: 1;
    }

    100% {
        transform: scale(1) translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

/* 对勾动画 */
.checkmark {
    position: absolute;
    width: 30px;
    height: 30px;
    transform: scale(0);
    animation: checkmarkAnim 0.5s 0.2s forwards;
}

.checkmark::before,
.checkmark::after {
    content: '';
    position: absolute;
    background-color: #4caf50;
}

.checkmark::before {
    width: 3px;
    height: 15px;
    left: 15px;
    top: 5px;
    transform: rotate(45deg);
}

.checkmark::after {
    width: 20px;
    height: 3px;
    left: 5px;
    top: 14px;
    transform: rotate(45deg);
}

@keyframes checkmarkAnim {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

/* 红叉动画 */
.crossmark {
    position: absolute;
    width: 30px;
    height: 30px;
    transform: scale(0);
    animation: crossmarkAnim 0.5s 0.2s forwards;
}

.crossmark::before,
.crossmark::after {
    content: '';
    position: absolute;
    background-color: #e53935;
    width: 3px;
    height: 30px;
    left: 13.5px;
    top: 0;
}

.crossmark::before {
    transform: rotate(45deg);
}

.crossmark::after {
    transform: rotate(-45deg);
}

@keyframes crossmarkAnim {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.error-list-container {
    width: 90%;
    max-width: 800px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 8px;
    margin-top: 10px;
}

.error-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 80px;
    overflow-y: auto;
    padding: 10px 0;
}

.error-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 0.9rem;
}

/* 连击特效 */
.combo-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

.combo-effect.active {
    animation: comboShow 1.5s ease-out forwards;
}

.combo-text {
    font-size: 8rem;
    font-weight: bold;
    color: #00eaff;
    text-shadow: 0 0 20px #00eaff, 0 0 40px #00eaff;
    animation: comboGlow 1.5s ease-out infinite;
}

.combo-subtext {
    font-size: 2rem;
    color: white;
    margin-top: -20px;
}

/* 匹配效果示例 */
.match-effect-demo {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
}

.match-card {
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    border-radius: 10px;
}

.match-card.success {
    background: rgba(28, 128, 107, 0.6);
    border: 1px solid rgba(76, 175, 80, 0.6);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
    animation: successPulse 2s infinite;
}

.match-card.failure {
    background: rgba(128, 28, 28, 0.6);
    border: 1px solid rgba(229, 57, 53, 0.6);
    box-shadow: 0 0 15px rgba(229, 57, 53, 0.5);
}

.effect-label {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* 游戏结果样式 */
.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.result-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.result-item h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.result-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-color);
}

.review-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 15px;
}

.error-review-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
}

.error-review-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.error-word-pair {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wrong-pair,
.correct-pair {
    padding: 3px 0;
}

.wrong-pair {
    color: rgba(255, 255, 255, 0.8);
}

.wrong-label {
    color: #e53935;
    font-weight: bold;
}

.correct-pair {
    color: rgba(255, 255, 255, 0.9);
}

.correct-label {
    color: #4caf50;
    font-weight: bold;
}

.error-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.action-btn {
    padding: 5px 10px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
}

.retry-btn {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.mastered-btn {
    background: rgba(33, 150, 243, 0.2);
    color: #2196f3;
    border: 1px solid rgba(33, 150, 243, 0.4);
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 通知提示 */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: transform 0.3s;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
}

/* 动画 */
@keyframes glow {
    0% {
        text-shadow: 0 0 10px var(--accent-color), 0 0 20px var(--accent-color);
    }

    100% {
        text-shadow: 0 0 15px var(--accent-color), 0 0 30px var(--accent-color), 0 0 45px var(--accent-color);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 1;
    }

    20% {
        transform: scale(25, 25);
        opacity: 1;
    }

    100% {
        transform: scale(50, 50);
        opacity: 0;
    }
}

@keyframes comboShow {
    0% {
        opacity: 0;
        visibility: visible;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes comboGlow {
    0% {
        text-shadow: 0 0 20px #00eaff, 0 0 40px #00eaff;
    }

    50% {
        text-shadow: 0 0 40px #00eaff, 0 0 80px #00eaff, 0 0 120px #00eaff;
    }

    100% {
        text-shadow: 0 0 20px #00eaff, 0 0 40px #00eaff;
    }
}

/* 响应式适配 */
@media screen and (max-width: 768px) {
    .main-title {
        font-size: 2.8rem;
    }

    .sub-title {
        font-size: 1.2rem;
    }

    .game-grid {
        gap: 4px;
        width: 95%;
    }

    .grid-cell {
        font-size: 0.8rem;
        padding: 8px 4px;
        max-height: 70px;
        line-height: 1.2;
        -webkit-line-clamp: 3;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .modal-panel {
        width: 90%;
        padding: 12px;
        max-height: 85vh;
    }

    .game-header {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .score-display,
    .combo-display,
    .timer-display {
        font-size: 1rem;
        padding: 6px 12px;
    }

    .game-grid.medium .grid-cell {
        font-size: 0.75rem;
        max-height: 65px;
        -webkit-line-clamp: 3;
    }

    .game-grid.hard .grid-cell {
        font-size: 0.7rem;
        max-height: 60px;
        -webkit-line-clamp: 2;
    }
}

@media screen and (max-width: 480px) {
    .main-title {
        font-size: 2.2rem;
    }

    .sub-title {
        font-size: 1rem;
    }

    .game-header {
        flex-direction: column;
        gap: 6px;
    }

    .panel-buttons {
        flex-direction: column;
    }

    .grid-cell {
        font-size: 0.7rem;
        padding: 6px 3px;
        max-height: 60px;
        line-height: 1.1;
        -webkit-line-clamp: 3;
    }

    .game-grid {
        gap: 3px;
        width: 98%;
    }

    .page {
        height: 90vh;
        width: 95%;
    }

    .combo-text {
        font-size: 5rem;
    }

    .combo-subtext {
        font-size: 1.5rem;
    }

    .error-review-item {
        flex-direction: column;
        gap: 8px;
    }

    .error-actions {
        flex-direction: row;
        width: 100%;
        justify-content: flex-end;
    }

    .wrong-label,
    .correct-label {
        display: inline-block;
        min-width: 70px;
    }

    .game-grid.medium .grid-cell {
        font-size: 0.65rem;
        max-height: 55px;
        -webkit-line-clamp: 2;
    }

    .game-grid.hard .grid-cell {
        font-size: 0.6rem;
        max-height: 50px;
        -webkit-line-clamp: 2;
    }
}

/* 设备高度较小时的适配 */
@media screen and (max-height: 650px) {
    .page {
        height: auto;
        padding: 20px 0;
    }

    .title-container {
        margin-bottom: 20px;
    }

    .main-title {
        font-size: 2.5rem;
    }

    .modal-panel {
        max-height: 90vh;
    }
}

/* 设置面板布局 */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.settings-grid>.setting-group:last-child {
    grid-column: span 2;
}

.radio-group.compact {
    display: flex;
    gap: 20px;
}

.radio-group.compact label {
    margin-bottom: 0;
}

/* 媒体查询中添加设置面板的响应式布局 */
@media screen and (max-width: 600px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid>.setting-group:last-child {
        grid-column: span 1;
    }
}

/* 游戏界面整体布局调整 */
.game-page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 10px 0;
}

/* 难度适配 */
.game-grid.easy {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.game-grid.medium {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
}

.game-grid.hard {
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
}

/* 难度越大，格子越小 */
.game-grid.medium .grid-cell {
    font-size: 0.85rem;
    padding: 8px 4px;
    max-height: 80px;
    -webkit-line-clamp: 4;
    line-height: 1.25;
}

.game-grid.hard .grid-cell {
    font-size: 0.75rem;
    padding: 6px 3px;
    max-height: 70px;
    -webkit-line-clamp: 3;
    line-height: 1.2;
}

@media screen and (max-width: 768px) {
    .game-grid.medium .grid-cell {
        font-size: 0.75rem;
        max-height: 65px;
        -webkit-line-clamp: 3;
    }

    .game-grid.hard .grid-cell {
        font-size: 0.7rem;
        max-height: 60px;
        -webkit-line-clamp: 2;
    }
}

@media screen and (max-width: 480px) {
    .game-grid.medium .grid-cell {
        font-size: 0.65rem;
        max-height: 55px;
        -webkit-line-clamp: 2;
    }

    .game-grid.hard .grid-cell {
        font-size: 0.6rem;
        max-height: 50px;
        -webkit-line-clamp: 2;
    }
}

/* 终止游戏按钮 */
.stop-btn {
    margin-top: 15px;
    background: rgba(229, 57, 53, 0.15);
    border: 1px solid rgba(229, 57, 53, 0.3);
    padding: 8px 20px;
    color: #ffccbc;
    transition: all 0.3s ease;
}

.stop-btn:hover {
    background: rgba(229, 57, 53, 0.3);
    border-color: rgba(229, 57, 53, 0.5);
    box-shadow: 0 5px 15px rgba(229, 57, 53, 0.25);
}

.stop-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(229, 57, 53, 0.2);
}

/* 难度越大，格子越小 */
.game-grid.medium .grid-cell-content {
    font-size: 0.85rem;
    -webkit-line-clamp: 4;
    line-height: 1.25;
}

.game-grid.hard .grid-cell-content {
    font-size: 0.75rem;
    -webkit-line-clamp: 3;
    line-height: 1.2;
}