/* 全局变量 */
:root {
    /* 主色调 - 粉绿色系 */
    --color-primary: #98D8C1;        /* 主要粉绿色 */
    --color-primary-light: #B5E4D3;  /* 浅粉绿色 */
    --color-primary-dark: #7AC1A6;   /* 深粉绿色 */

    /* 背景色 */
    --color-bg-gradient-1: #E8F6F1;  /* 渐变背景色1 */
    --color-bg-gradient-2: #F5F9F7;  /* 渐变背景色2 */
    --gradient-bg: linear-gradient(135deg, var(--color-bg-gradient-1), var(--color-bg-gradient-2));

    /* 文字颜色 */
    --color-text: #4A6670;           /* 主要文字颜色 */
    --color-text-light: #7A8B93;     /* 浅色文字 */

    /* 其他颜色 */
    --color-white: #FFFFFF;          /* 纯白色 */
    --color-canvas-bg: #F5F9F7;      /* 游戏区域背景色 */
    --grid-border-color: #E0EBE6;    /* 网格线颜色 */

    /* 阴影 */
    --shadow-normal: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-large: 0 6px 6px rgba(0, 0, 0, 0.15);

    --color-secondary: #B5E4D3;
    --color-accent: #7AC1A6;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gradient-bg);
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 游戏容器 */
.game-container {
    max-width: 1200px;
    min-width: 400px;
    margin: 0 auto;
    padding: 2rem;
}

/* 游戏标题 */
.game-title {
    font-size: 2.5rem;
    color: var(--color-primary);
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.5s ease-out;
}

/* 按钮容器 */
.button-container {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    align-items: center;
    margin-top: 10rem;
}

/* 按钮样式 */
.game-button {
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-normal);
    text-align: center;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

/* PC端按钮样式 */
@media (min-width: 481px) {
    .button-container .game-button {
        width: auto;
        min-width: 212px;
        max-width: 220px;
    }
}

.game-button::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%;
}

.game-button.clicked::after {
    animation: ripple 0.6s ease-out;
}

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

.game-button:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-large);
}

.game-button.clicked {
    transform: scale(0.95);
    box-shadow: var(--shadow-normal);
}

/* 动画定义 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 480px) {
    /* 重置游戏容器最小宽度 */
    .game-container {
        min-width: auto;
        width: 100%;
        padding: 1rem;
    }

    /* 初始界面按钮样式 */
    .button-container .game-button {
        max-width: 280px;
        width: 100%;
        min-height: 56px;
        font-size: 1.2rem;
        margin: 0.8rem auto;
        border-radius: 25px;
        padding: 0.8rem 2rem;
    }

    /* 设置界面保存按钮 */
    #saveSettings {
        max-width: 280px;
        min-height: 56px;
        font-size: 1.2rem;
        margin: 1rem auto;
        border-radius: 25px;
        padding: 0.8rem 2rem;
    }

    /* Modal中的按钮样式 */
    .modal-content .game-over-buttons,
    .modal-content .quit-confirm-buttons {
        display: flex;
        flex-direction: column;
        gap: 1rem !important;
        padding: 0.5rem;
        margin-bottom: 1rem;
        justify-content: center;
    }

    .game-over-buttons .game-button,
    .modal-content .game-button {
        flex: none;
        width: 100%;
        max-width: 280px;
        min-width: 200px;
        min-height: 48px;
        font-size: 1.1rem;
        margin: 0 auto;
        border-radius: 25px;
        padding: 0.6rem 1rem;
        white-space: nowrap;
    }

    /* 退出确认按钮 */
    .modal-content .quit-confirm-buttons {
        display: flex;
        flex-direction: column;
        gap: 2.5rem !important;
        padding: 0.5rem;
        margin-bottom: 1rem;
        justify-content: center;
    }

    .game-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    .game-button {
        padding: 0.8rem 1.6rem;
        font-size: 1rem;
    }
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
}

/* 横屏提示modal的特殊背景 */
#landscapeModal.modal {
    background: var(--gradient-bg);
    backdrop-filter: none;
}

.modal-content {
    background: var(--color-white);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-large);
    max-width: 500px;
    width: 90%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

/* 自定义滚动条样式 */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--color-canvas-bg);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--color-primary-light);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.modal-header h2 {
    margin: 0;
    color: var(--color-text);
    font-size: 1.5rem;
    width: 100%;
    text-align: center;
}

.close-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-light);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
    position: absolute;
    right: 0;
}

.close-button:hover {
    color: var(--color-text);
}

.modal-body {
    color: var(--color-text);
}

/* 游戏结束模态框特殊样式 */
.game-over-content {
    text-align: center;
    max-width: 400px;
}

.game-over-content .modal-header {
    margin-bottom: 1rem;
}

.game-over-content .modal-header h2 {
    width: 100%;
    text-align: center;
    color: var(--color-primary);
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* 玩家信息样式 */
.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

.player-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-normal);
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-name {
    font-size: 1.2rem;
    color: var(--color-text);
    font-weight: bold;
}

/* 退出确认消息样式 */
.quit-message {
    font-size: 1.2rem;
    color: var(--color-text);
    margin: 2rem 0;
    line-height: 1.5;
}

.final-score {
    background-color: var(--color-background);
    padding: 0.5rem 0;
}

.final-score .score-label {
    font-size: 1.2rem;
    color: var(--color-text);
    margin-bottom: 0;
}

.final-score .score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-primary);
    padding: 0 0.5rem;
}

.game-over-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 1rem;
}

/* 设置模态框特殊样式 */
.settings-section {
    margin-bottom: 1rem;
}

/* 个人信息内容区域 */
.personal-info-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.avatar-section {
    flex-shrink: 0;
}

.username-section {
    flex-grow: 1;
    margin-top: 0;
}

/* 游戏难度设置区域 */
.difficulty-options {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 0.8rem;
}

.radio-container {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0.6rem;
    transition: all 0.3s ease;
    flex: 1;
    text-align: center;
}

.radio-container:hover {
    background-color: var(--color-background);
    border-radius: 8px;
}

.radio-container input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    margin-left: 8px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 8px;
    height: 8px;
    background-color: var(--color-primary);
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.radio-container input[type="radio"]:checked + .radio-label + .radio-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.radio-label {
    color: var(--color-text);
    font-size: 1rem;
    order: -1;
}

/* 按键设置区域 */
.settings-section h3 {
    color: var(--color-text);
    margin-bottom: 0.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#restoreDefaultKeys {
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}

#restoreDefaultKeys:hover {
    color: var(--color-text);
}

.key-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.key-settings-buttons {
    display: none;
}

.key-settings-help {
    margin-top: 0.8rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* 保存按钮容器 */
.settings-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--color-canvas-bg);
}

#saveSettings {
    width: auto;
    min-width: 120px;
    margin: 0;
    padding: 0.6rem 2rem;
}

/* 响应式设计补充 */
@media (max-width: 480px) {
    .modal-content {
        padding: 1.5rem;
    }

    .modal-header h2 {
        font-size: 1.5rem;
    }

    .settings-section h3 {
        font-size: 1.1rem;
    }

    .radio-label {
        font-size: 1rem;
    }

    /* 隐藏按键设置相关内容 */
    .key-settings-section {
        display: none;
    }

    /* 调整个人信息设置为垂直布局 */
    .personal-info-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }

    .avatar-section {
        margin-bottom: 0.5rem;
    }

    .username-section {
        width: 100%;
        margin-top: 0;
    }

    .input-group {
        align-items: center;
    }

    .input-group input {
        width: 100%;
        max-width: 300px;
    }

    /* 玩家信息显示 */
    .player-avatar {
        width: 60px;
        height: 60px;
    }

    .player-name {
        font-size: 1rem;
    }
}

/* 添加移动端特定的样式 */
@media (max-width: 480px) {
    .player-avatar {
        width: 60px;
        height: 60px;
    }

    .player-name {
        font-size: 1rem;
    }
}

/* 游戏界面 */
.game-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    min-height: 100vh;
    background-color: var(--color-bg);
}

/* 顶部区域 */
.game-header {
    width: 630px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-logo-small {
    width: 40px;
    height: 40px;
}

.game-title-small {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--color-text);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
}

.user-info-small {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.user-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#gameUsername {
    font-size: 1rem;
    color: var(--color-text);
}

/* 分数区域 */
.score-container {
    display: flex;
    justify-content: space-between;
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow-normal);
    max-width: 630px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0.2rem;
    margin-bottom: 1rem;
}

.score-item {
    text-align: center;
    padding: 0 1rem;
    min-width: 100px;
}

.score-label {
    display: block;
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.score-value {
    color: var(--color-text);
    font-size: 1.2rem;
    font-weight: bold;
}

/* 游戏主区域 */
.game-area {
    display: flex;
    gap: 1.1rem;
    justify-content: center;
    align-items: flex-start;
    margin: 0 auto;
    max-width: 630px;
    min-width: 630px;
}

/* 主游戏区 */
.main-area {
    flex: 1;
    max-width: 600px;
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-normal);
    display: flex;
    justify-content: center;
}

#gameCanvas {
    display: block;
    background-color: var(--color-canvas-bg);
    border-radius: 8px;
}

/* 信息区 */
.info-area {
    width: 250px;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 648px;
    background: white;
    padding: 1.2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-normal);
}

/* 个人信息 */
.user-info {
    display: none;
}

.user-avatar {
    display: none;
}

.user-details {
    display: none;
}

/* 下一个方块预览 */
.next-piece {
    text-align: center;
    flex-shrink: 0;
}

.next-piece h3 {
    color: var(--color-text);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

#nextCanvas {
    display: block;
    margin: 0 auto;
    width: 135px;
    height: 135px;
    background-color: var(--color-canvas-bg);
    border-radius: 8px;
}

/* 控制说明 */
.controls-info {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.controls-info h3 {
    color: var(--color-text);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.controls-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.controls-info li {
    color: var(--color-text);
    padding: 0.2rem 0;
    text-align: center;
    font-size: 0.8rem;
}

/* 游戏控制 */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-height: 160px;
    flex-shrink: 0;
}

.game-controls .game-button {
    font-size: 1rem;
    padding: 0.8rem;
    outline: none;
}

/* 响应式设计补充 */
@media (max-width: 768px) {
    body {
        overflow-x: auto;
    }

    .game-screen {
        margin: 1rem;
    }

    .game-area {
        flex-direction: row;
    }

    .info-area {
        flex-direction: column;
    }

    .next-piece,
    .controls-info {
        width: 100%;
    }

    .game-controls {
        width: 100%;
        flex-direction: column;
    }

    .game-controls .game-button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .score-container {
        flex-direction: row;
    }

    .next-piece,
    .controls-info {
        width: 100%;
    }
}

/* 分数动画 */
.score-increase {
    position: absolute;
    color: var(--color-accent);
    font-size: 1.2rem;
    font-weight: bold;
    animation: scoreFloat 1s ease-out forwards;
    pointer-events: none;
}

@keyframes scoreFloat {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-20px);
        opacity: 0;
    }
}

/* 高分突出显示 */
#highScore {
    color: var(--color-accent);
    text-shadow: 0 0 5px rgba(255, 182, 193, 0.3);
}

/* 游戏结束弹窗样式 */
.game-over-content {
    text-align: center;
    max-width: 400px;
}

.game-over-content .modal-header {
    margin-bottom: 1rem;
}

.game-over-content .modal-header h2 {
    width: 100%;
    text-align: center;
    color: var(--color-primary);
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    background: var(--color-canvas-bg);
    border-radius: 8px;
    margin: 0.5rem 0;
}

.score-row:last-child {
    margin-top: 1rem;
}

.final-score .score-label {
    font-size: 1.2rem;
    color: var(--color-text);
    margin-bottom: 0;
}

.final-score .score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-primary);
    padding: 0 0.5rem;
}

#finalHighScore {
    color: var(--color-accent);
    text-shadow: 0 0 5px rgba(255, 182, 193, 0.3);
}

.game-over-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.game-over-buttons .game-button {
    flex: 1;
    max-width: 150px;
}

/* 游戏结束动画 */
@keyframes gameOverSlideIn {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.game-over-content {
    animation: gameOverSlideIn 0.5s ease-out;
}

/* Logo样式 */
.logo-container {
    text-align: center;
    margin-top: 4rem;
    margin-bottom: 2rem;
}

.game-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.game-logo:hover {
    transform: scale(1.05);
}

.logo-container h1 {
    color: var(--color-text);
    font-size: 2rem;
    font-weight: 300;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 开始界面 */
.start-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

/* 头像设置 */
.avatar-section {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.avatar-preview {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-normal);
    transition: transform 0.3s ease;
    margin-bottom: 0;
}

.avatar-preview:hover {
    transform: scale(1.05);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.avatar-preview:hover .avatar-overlay {
    opacity: 1;
}

.avatar-overlay span {
    color: white;
    font-size: 0.8rem;
    text-align: center;
    padding: 0.5rem;
}

/* 用户名设置 */
.username-section {
    margin-top: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0;
}

.input-group label {
    color: var(--color-text);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.input-group input {
    padding: 0.6rem;
    border: 2px solid var(--color-primary-light);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-white);
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.input-group input::placeholder {
    color: var(--color-text-light);
}

.input-hint {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.input-error {
    border-color: #ff6b6b !important;
}

.error-message {
    color: #ff6b6b;
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

/* 响应式设计补充 */
@media (max-width: 480px) {
    .player-avatar {
        width: 60px;
        height: 60px;
    }

    .player-name {
        font-size: 1rem;
    }
}

/* 按键设置样式 */
.key-settings {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.key-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.key-label {
    font-size: 0.9rem;
    color: var(--color-text);
    min-width: 60px;
}

.key-buttons {
    display: flex;
    gap: 0.5rem;
}

.key-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-white);
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 60px;
}

.key-button:hover {
    background: var(--color-bg-gradient-1);
}

.key-button.listening {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}

.key-text {
    font-size: 0.9rem;
    color: var(--color-text);
}

.key-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.key-buttons {
    display: flex;
    gap: 0.5rem;
}

.key-settings-help {
    margin-top: 0.8rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* 移动端布局控制 */
@media screen and (min-width: 481px) {
    .mobile-layout {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    .pc-layout {
        display: none;
    }

    /* 移动端布局 */
    .mobile-layout {
        display: flex;
        flex-direction: column;
        height: 100vh;
        width: 100%;
        overflow: hidden;
    }

    /* 游戏主区域 */
    .mobile-game-area {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        /* background-color: var(--color-canvas-bg); */
        border-radius: 8px;
        /* box-shadow: var(--shadow-normal); */
        overflow: hidden;
    }

    .mobile-game-area canvas {
        display: block;
    }

    /* 左侧游戏区 */
    .mobile-main-area {
        display: flex;
        width: 100%;
        padding: 10px 10px 10px 12px;
        gap: 8px;
        align-items: center;
    }

    /* 右侧信息区 */
    .mobile-info-area {
        width: 80px;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;
        gap: 2vmin;
    }

    /* 移动端游戏按钮样式 */
    .mobile-game-controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
        gap: 1rem;
    }

    .mobile-game-controls .game-button {
        background: #cccccc;
        color: var(--color-white);
        transition: all 0.3s ease;
        min-width: 12vmin;
        width: 100%;
        height: 1.5rem;
        border-radius: 0.75rem;
        font-size: 0.85rem;
        padding: 0 3vmin;
        margin: 0;
        box-shadow: none !important;
        transform: none !important;
    }

    .mobile-game-controls .game-button:hover {
        background: #b8b8b8;
        box-shadow: none !important;
        transform: none !important;
    }

    .mobile-game-controls .game-button:active,
    .mobile-game-controls .game-button.clicked {
        background: #a3a3a3;
        box-shadow: none !important;
        transform: none !important;
    }

    /* 撤销按钮样式 */
    .mobile-game-controls .undo-button {
        background: #F4B8C3 !important;
        opacity: 1;
        box-shadow: none !important;
        transform: none !important;
    }

    .mobile-game-controls .undo-button:disabled {
        background: #FFE4E8 !important;
        cursor: not-allowed;
        opacity: 0.8;
        box-shadow: none !important;
        transform: none !important;
    }

    .mobile-game-controls .undo-button:not(:disabled):hover {
        background: #F29DAB !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .mobile-game-controls .undo-button:not(:disabled):active,
    .mobile-game-controls .undo-button:not(:disabled).clicked {
        background: #EF8293 !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .mobile-game-controls .game-button:hover {
        background: #b8b8b8;
        box-shadow: none !important;
    }

    .mobile-game-controls .game-button:active,
    .mobile-game-controls .game-button.clicked {
        background: #a3a3a3;
        box-shadow: none !important;
    }

    /* 移动端用户头像 */
    .mobile-user-avatar {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        overflow: hidden;
        flex-shrink: 0;
    }

    .mobile-user-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    /* 移动端分数项 */
    .mobile-score-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
        text-align: center;
    }

    .mobile-score-item .score-label {
        font-size: 0.8rem;
        color: var(--color-text-light);
    }

    .mobile-score-item .score-value {
        font-size: 1.2rem;
        color: var(--color-text);
        font-weight: bold;
    }

    .mobile-score-item .current-score {
        font-size: 1.5rem;
        color: var(--color-primary);
    }

    /* 移动端下一个方块预览 */
    .mobile-next-piece {
        width: 60px;
        height: 60px;
        /* background-color: var(--color-canvas-bg); */
        border-radius: 8px;
        /* box-shadow: var(--shadow-normal); */
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .mobile-next-piece canvas {
        width: 100%;
        height: 100%;
    }

    /* 顶部信息区域 */
    .mobile-header {
        width: 100%;
        padding: 1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    .mobile-next-piece {
        flex-shrink: 0;
        width: 60px;
        height: 60px;
    }

    #mobileNextCanvas {
        width: 60px !important;
        height: 60px !important;
    }

    .mobile-score-info {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
    }

    .mobile-level-info {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .mobile-score-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.1rem;
    }

    .mobile-score-item .score-label {
        font-size: 0.85rem;
        font-weight: normal;
        margin-bottom: 0;
        color: var(--color-text-light);
    }

    .mobile-score-item .score-value {
        font-size: 0.85rem;
        font-weight: normal;
        color: var(--color-text);
    }

    .mobile-score-item .score-value.current-score {
        font-size: 24px;
        font-weight: bold;
        color: var(--color-primary-dark);
    }

    .mobile-user-avatar {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        overflow: hidden;
        flex-shrink: 0;
    }

    .mobile-user-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    /* 游戏屏幕容器 */
    .game-screen {
        min-height: 100vh;
        padding: 0;
        gap: 0;
        display: flex;
        flex-direction: column;
        margin: 0;
        background: linear-gradient(135deg, var(--color-bg-gradient-1), var(--color-bg-gradient-2));
    }

    /* 顶部区域 */
    .mobile-header {
        height: 80px; /* 固定高度 */
        flex-shrink: 0;
        display: flex;
        align-items: center;
        padding: 10px 1rem;
        gap: 1rem;
        background-color: rgba(255, 255, 255, 0.1);
    }

    /* 底部控制区域 */
    .touch-controls {
        padding: 1rem 2vmin 6vmin 2vmin !important;
        backdrop-filter: blur(5px);
        display: flex;
        flex-direction: column;
        gap: 2vmin;
        align-items: center;
        justify-content: flex-start;
    }

    /* 控制按钮行 */
    .touch-controls-row {
        display: flex;
        justify-content: space-around;
        align-items: flex-start;
        gap: 2vmin;
        width: 100%;
        height: auto;
    }

    .touch-controls-row:nth-child(2) {
        display: flex;
        justify-content: flex-start;
        padding-left: var(--second-row-padding-left, 17vmin);
        /* 使用相对单位来保持按钮之间的间距比例 */
    }

    .touch-btn {
        display: flex;
        justify-content: center;
        align-items: center;
        width: var(--touch-btn-size, 15vmin);
        height: var(--touch-btn-size, 15vmin);
        border-radius: 50%;
        background: rgb(152 216 193 / 80%);
        border: 2px solid rgba(255, 255, 255, 0.2);
        transition: all 0.2s ease;
    }

    .touch-btn:active {
        background: rgb(152 216 193 / 90%);
        transform: scale(0.95);
    }

    .touch-btn svg {
        width: 50%;
        height: 50%;
        fill: rgba(255, 255, 255, 0.8);
    }

    .touch-btn:active svg {
        fill: rgba(255, 255, 255, 1);
    }

    /* 模态框调整 */
    .modal .modal-content {
        width: 95%;
    }

    .modal-header h2 {
        font-size: 1.3rem;
    }

    .game-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}
/* 横屏模式优化 */
@media (max-width: 480px) and (orientation: landscape) {
    .game-screen {
        --header-height: 20vh;
        --controls-height: 15vh;
    }

    .mobile-header {
        flex-direction: row;
        align-items: center;
    }

    .mobile-game-area {
        padding: var(--game-margin) 15vw;
    }
}

/* 横屏提示modal样式 */
.landscape-modal {
    max-width: 300px !important;
    padding: 2rem !important;
    text-align: center;
    background: var(--color-white) !important;
}

.landscape-warning {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.rotate-phone-icon {
    width: 80px;
    height: 80px;
    color: var(--color-primary);
    animation: rotatePhone 1.5s ease-in-out infinite;
}

.landscape-warning p {
    font-size: 1.1rem;
    line-height: 1.5;
    color: var(--color-text);
    margin: 0;
}

@keyframes rotatePhone {
    0% {
        transform: rotate(-90deg);
    }
    20% {
        transform: rotate(0deg);
    }
    80% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(-90deg);
    }
}

/* PC端游戏结束按钮样式 */
@media (min-width: 481px) {
    .game-over-buttons .game-button {
        flex: 1;
        max-width: 150px;
    }
}

.key-hint {
    color: #999;
    font-size: 0.8rem;
}

.mobile-game-controls .game-button::after {
    display: none;
}

