/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

body {
    background: linear-gradient(135deg, #FFE5EC 0%, #FFF0F5 25%, #E8F4FF 50%, #FFF9E6 75%, #F0FFF4 100%);
    color: #1d1d1f;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    overscroll-behavior: none; /* 防止过度滚动 */
}

/* 拖动时禁止页面滚动 */
body.dragging-active {
    overflow: hidden;
    touch-action: none;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* 苹果风格卡片 - iOS毛玻璃效果 */
.card {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 20px;
    border: 0.5px solid rgba(255, 255, 255, 0.5);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.04),
        0 8px 24px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    padding: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.06),
        0 12px 32px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* 头部样式 - iOS风格毛玻璃效果 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 18px 28px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 20px;
    border: 0.5px solid rgba(255, 255, 255, 0.5);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.04),
        0 8px 24px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.2rem;
    color: #FF6B9D;
    background: linear-gradient(135deg, #FF6B9D, #C44DFF, #00D4FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: transform 0.3s ease;
}

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

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FF6B9D, #C44DFF, #00D4FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Logo区域iOS风格动态效果 */
.logo {
    position: relative;
    overflow: hidden;
    padding: 8px 16px;
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.5),
        transparent
    );
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
}

.logo:hover::before {
    left: 100%;
}

.logo:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.logo:hover h1 {
    background: linear-gradient(135deg, #FF8FB1, #D16BFF, #5AC8FA);
    -webkit-background-clip: text;
    background-clip: text;
    transform: scale(1.02);
}

.logo i {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo:hover i {
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 4px 8px rgba(255, 107, 157, 0.4));
}

/* Logo点击反馈 */
.logo:active {
    transform: scale(0.98) translateY(0);
    transition: all 0.1s ease;
}

.logo:active i {
    transform: scale(0.95) rotate(0deg);
}

.header-info {
    display: flex;
    gap: 30px;
}

.score, .level, .timer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 0.5px solid rgba(255, 255, 255, 0.6);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    animation: cardFloat 3s ease-in-out infinite;
}

/* 每个卡片错开动画时间 */
.score { animation-delay: 0s; }
.level { animation-delay: 0.5s; }
.timer { animation-delay: 1s; }

/* 关卡基础样式增强 */
.level {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.1), rgba(255, 255, 255, 0.65));
    border: 1px solid rgba(52, 199, 89, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.level:hover {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.15), rgba(255, 255, 255, 0.85));
    border-color: rgba(52, 199, 89, 0.5);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 6px 16px rgba(52, 199, 89, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.level::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(52, 199, 89, 0.3),
        transparent
    );
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.level:hover::before {
    left: 100%;
}

/* 等级提升动画 - 更明显的效果 */
.level.upgraded {
    animation: levelUpgradedEnhanced 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes levelUpgradedEnhanced {
    0% {
        transform: scale(1) rotate(0deg);
        background: linear-gradient(135deg, rgba(52, 199, 89, 0.1), rgba(255, 255, 255, 0.65));
        box-shadow: 
            0 2px 8px rgba(0, 0, 0, 0.04),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    30% {
        transform: scale(1.15) rotate(3deg);
        background: linear-gradient(135deg, rgba(52, 199, 89, 0.35), rgba(82, 196, 26, 0.2));
        box-shadow: 
            0 8px 28px rgba(52, 199, 89, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.95);
    }
    60% {
        transform: scale(1.08) rotate(-1deg);
        background: linear-gradient(135deg, rgba(52, 199, 89, 0.25), rgba(255, 255, 255, 0.8));
    }
    100% {
        transform: scale(1) rotate(0deg);
        background: linear-gradient(135deg, rgba(52, 199, 89, 0.1), rgba(255, 255, 255, 0.65));
        box-shadow: 
            0 2px 8px rgba(0, 0, 0, 0.04),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
}

/* 等级数字变化效果 */
.level.changed #level {
    animation: levelNumberBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #34C759;
    font-weight: 800;
}

@keyframes levelNumberBounce {
    0% { 
        transform: scale(1) translateY(0); 
        opacity: 1;
    }
    25% { 
        transform: scale(0.8) translateY(-5px); 
        opacity: 0.6;
    }
    50% { 
        transform: scale(1.3) translateY(2px); 
        opacity: 1;
    }
    70% { 
        transform: scale(1.1) translateY(-1px); 
    }
    100% { 
        transform: scale(1) translateY(0); 
    }
}

/* 等级图标脉动 */
.level i {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.level.upgraded i {
    animation: levelIconSpin 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #30D158;
}

@keyframes levelIconSpin {
    0% { 
        transform: rotate(0deg) scale(1); 
    }
    40% { 
        transform: rotate(180deg) scale(1.3); 
    }
    60% { 
        transform: rotate(270deg) scale(1.2); 
    }
    100% { 
        transform: rotate(360deg) scale(1); 
    }
}

/* 浮动呼吸动画 */
@keyframes cardFloat {
    0%, 100% {
        transform: translateY(0px);
        box-shadow: 
            0 2px 8px rgba(0, 0, 0, 0.04),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    50% {
        transform: translateY(-2px);
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.9);
    }
}

.score:hover, .level:hover, .timer:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* 动态状态栏 - 电脑端iOS风格柔和过渡 */
.score, .level, .timer {
    position: relative;
    overflow: hidden;
}

.score::before, .level::before, .timer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.score:hover::before, .level:hover::before, .timer:hover::before {
    left: 100%;
}

/* 数值变化时的iOS风格柔和动画 */
.score.updating, .level.updating, .timer.updating {
    animation: statusUpdate 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes statusUpdate {
    0% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.65);
    }
    30% {
        transform: scale(1.05);
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 4px 16px rgba(0, 122, 255, 0.2);
    }
    100% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.65);
    }
}

/* 分数增加特殊效果 */
.score.increased {
    animation: scoreIncreased 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scoreIncreased {
    0% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.65);
    }
    40% {
        transform: scale(1.08);
        background: linear-gradient(135deg, rgba(255, 149, 0, 0.2), rgba(255, 255, 255, 0.9));
        box-shadow: 0 4px 20px rgba(255, 149, 0, 0.3);
    }
    100% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.65);
    }
}

/* 等级提升特殊效果 */
.level.upgraded {
    animation: levelUpgraded 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes levelUpgraded {
    0% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.65);
    }
    30% {
        transform: scale(1.1);
        background: linear-gradient(135deg, rgba(52, 199, 89, 0.25), rgba(255, 255, 255, 0.9));
        box-shadow: 0 4px 24px rgba(52, 199, 89, 0.35);
    }
    60% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.65);
    }
}

/* 时间减少特殊效果 */
.timer.decreased {
    animation: timerDecreased 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes timerDecreased {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
        background: rgba(0, 122, 255, 0.15);
    }
    100% {
        transform: scale(1);
    }
}

/* 数字变化时的弹跳效果 */
#score, #level, #timer {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s ease;
}

.score.changed #score {
    animation: numberBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #FF9500;
}

.level.changed #level {
    animation: numberBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #34C759;
}

.timer.changed #timer {
    animation: numberPulse 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes numberBounce {
    0% { transform: scale(1) translateY(0); }
    40% { transform: scale(1.2) translateY(-3px); }
    70% { transform: scale(0.95) translateY(1px); }
    100% { transform: scale(1) translateY(0); }
}

@keyframes numberPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.score i, .level i, .timer i {
    font-size: 1.1rem;
    animation: iconPulse 2s ease-in-out infinite;
}

.score i { 
    color: #FF9500;
    animation-delay: 0s;
}
.level i { 
    color: #34C759;
    animation-delay: 0.3s;
}
.timer i { 
    color: #007AFF;
    animation-delay: 0.6s;
}

/* 图标脉动动画 */
@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.85;
    }
}

/* 时间警告动画 - 少于10秒时 */
.timer.warning {
    background: rgba(255, 59, 48, 0.15);
    border-color: rgba(255, 59, 48, 0.3);
    animation: timerWarning 0.8s ease-in-out infinite;
}

.timer.warning i {
    color: #FF3B30;
}

@keyframes timerWarning {
    0%, 100% {
        transform: scale(1);
        background: rgba(255, 59, 48, 0.15);
    }
    50% {
        transform: scale(1.05);
        background: rgba(255, 59, 48, 0.25);
    }
}

/* 分数变化动画 */
.score.changed {
    animation: scoreChange 0.4s ease-out;
}

@keyframes scoreChange {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        background: rgba(255, 149, 0, 0.2);
    }
    100% {
        transform: scale(1);
    }
}

/* 等级提升动画 */
.level.upgraded {
    animation: levelUp 0.6s ease-out;
}

@keyframes levelUp {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.15);
        background: rgba(52, 199, 89, 0.3);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.user-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    border: 2px solid rgba(196, 77, 255, 0.3);
    color: #1d1d1f;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(196, 77, 255, 0.1);
}

.user-status i {
    color: #C44DFF;
    animation: bounce 1s ease-in-out infinite;
}

.logout-btn {
    margin-left: 10px;
    padding: 6px 12px;
    font-size: 0.85rem;
    border: none;
    background: linear-gradient(135deg, #FF6B9D, #FF8FB1);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* 游戏区域布局 */
.game-area {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.left-panel, .center-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* 左侧面板 */
.sound-player, .instructions {
    composes: card;
}

.player-controls {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: nowrap;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #FF6B9D, #FF8FB1);
    color: white;
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #C44DFF, #D16BFF);
    color: white;
    border: none;
    box-shadow: 0 6px 20px rgba(196, 77, 255, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #00D4FF, #5AC8FA);
    color: white;
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
}

.btn:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 30px rgba(255, 107, 157, 0.4);
}

.btn:active {
    transform: scale(0.95);
}

.visualizer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 120px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.visualizer-bar {
    width: 16%;
    background: linear-gradient(to top, #007AFF, #5856D6);
    border-radius: 8px 8px 4px 4px;
    animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
    0% { height: 20%; }
    100% { height: 100%; }
}

.visualizer-bar:nth-child(2) { animation-delay: 0.2s; }
.visualizer-bar:nth-child(3) { animation-delay: 0.4s; }
.visualizer-bar:nth-child(4) { animation-delay: 0.6s; }
.visualizer-bar:nth-child(5) { animation-delay: 0.8s; }

/* 中间面板 */
.blocks-container, .drop-zone {
    composes: card;
}

.blocks-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 20px;
    grid-template-rows: auto;
}

.block {
    aspect-ratio: 1;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none; /* 防止触摸时的默认行为 */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 3px solid transparent;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.block img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 13px;
    pointer-events: none;
}

.block:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.block.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    filter: brightness(0.8);
}

/* 触摸拖动代理样式 */
.block-touch-proxy {
    position: fixed !important;
    pointer-events: none !important;
    z-index: 10000 !important;
    transition: none !important;
}

/* 移动端触摸反馈 */
@media (hover: none) and (pointer: coarse) {
    .block:active {
        transform: scale(0.95);
        filter: brightness(0.9);
        transition: transform 0.1s ease;
    }
    
    .frame.hovered {
        border-color: #007AFF;
        background: rgba(0, 122, 255, 0.15);
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(0, 122, 255, 0.3);
    }
}

/* 方块颜色 - 更可爱的配色 */
.block-red { 
    background: linear-gradient(135deg, #FF6B9D, #FF8FB1);
    box-shadow: 0 8px 20px rgba(255, 107, 157, 0.3);
}
.block-blue { 
    background: linear-gradient(135deg, #00D4FF, #5AC8FA);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.3);
}
.block-green { 
    background: linear-gradient(135deg, #7FE5A0, #4CD964);
    box-shadow: 0 8px 20px rgba(79, 229, 160, 0.3);
}
.block-yellow { 
    background: linear-gradient(135deg, #FFD700, #FFE66D);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.3);
}
.block-purple { 
    background: linear-gradient(135deg, #C44DFF, #D16BFF);
    box-shadow: 0 8px 20px rgba(196, 77, 255, 0.3);
}
.block-cyan { 
    background: linear-gradient(135deg, #5AC8FA, #64D2FF);
    box-shadow: 0 8px 20px rgba(90, 200, 250, 0.3);
}

.frames-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 25px 0;
    min-height: 120px;
    grid-template-rows: auto;
}

.frame {
    aspect-ratio: 1;
    border-radius: 20px;
    border: 3px dashed rgba(255, 107, 157, 0.4);
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    overflow: hidden;
}

.frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 17px;
}

.frame.hovered {
    border-color: #FF6B9D;
    background: rgba(255, 107, 157, 0.15);
    transform: scale(1.08);
    box-shadow: 0 8px 24px rgba(255, 107, 157, 0.25);
}

.frame.filled {
    border-style: solid;
    border-color: transparent;
}

.submit-area {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

/* 右侧面板 */
.game-stats, .level-progression, .settings {
    composes: card;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 14px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.correct { 
    background: linear-gradient(135deg, #7FE5A0, #4CD964);
    animation: bounce 1s ease-in-out infinite;
}
.stat-icon.incorrect { 
    background: linear-gradient(135deg, #FF6B9D, #FF8FB1);
}
.stat-icon.streak { 
    background: linear-gradient(135deg, #FFD700, #FFE66D);
    animation: spin 2s linear infinite;
}
.stat-icon.accuracy { 
    background: linear-gradient(135deg, #C44DFF, #D16BFF);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.stat-info h4 {
    font-size: 0.9rem;
    color: #8E8E93;
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1d1d1f;
}

.level-progression {
    text-align: center;
}

.progress-bar {
    height: 12px;
    background: rgba(0, 122, 255, 0.1);
    border-radius: 6px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF6B9D, #C44DFF, #00D4FF);
    border-radius: 6px;
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(255, 107, 157, 0.3);
}

.progress-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1d1d1f;
}

.settings {
    padding: 24px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.setting-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.setting-item label {
    font-weight: 600;
    color: #1d1d1f;
}

.setting-item input[type="range"] {
    width: 60%;
    height: 6px;
    -webkit-appearance: none;
    background: rgba(0, 122, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #007AFF;
    cursor: pointer;
}

.setting-item select {
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid rgba(0, 122, 255, 0.2);
    background: white;
    font-size: 0.95rem;
    color: #1d1d1f;
    outline: none;
    cursor: pointer;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(135deg, #34C759, #30D158);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 25px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    margin-top: 30px;
    color: #8E8E93;
    font-size: 0.95rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
}

.footer-links a {
    color: #FF6B9D;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.footer-links a:hover {
    color: #C44DFF;
    transform: translateY(-2px);
}

/* 模态框 - iOS风格 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    width: 100%;
    max-width: 320px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(100px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes modalFadeOut {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateY(100px) scale(0.9);
        opacity: 0;
    }
}

.modal-header {
    display: none; /* iOS风格不需要header */
}

.close-modal {
    display: none; /* iOS风格不需要右上角关闭按钮 */
}

.modal-body {
    padding: 30px 20px 20px;
    text-align: center;
}

.modal-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #FF6B9D, #C44DFF);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(255, 107, 157, 0.3);
}

.modal-icon i {
    font-size: 2rem;
    color: white;
}

.modal-body h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #000;
    margin: 0 0 8px;
    line-height: 1.4;
}

.modal-body p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #666;
    margin: 0;
}

.modal-footer {
    display: flex;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-footer .btn {
    flex: 1;
    margin: 0;
    padding: 16px 8px;
    border-radius: 0;
    background: transparent;
    color: #007AFF;
    font-size: 1rem;
    font-weight: 400;
    box-shadow: none;
    border: none;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    min-height: 50px;
    justify-content: center;
}

.modal-footer .btn:last-child {
    border-right: none;
}

.modal-footer .btn:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: none;
    box-shadow: none;
}

.modal-footer .btn:active {
    background: rgba(0, 0, 0, 0.1);
}

.modal-footer .btn-primary {
    color: #FF6B9D;
    font-weight: 600;
}

.modal-footer .btn-secondary {
    color: #C44DFF;
    font-weight: 400;
}

.modal-footer .btn-success {
    color: #FF6B9D;
    font-weight: 600;
}

/* 倒计时遮罩层 */
.countdown-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.countdown-content {
    text-align: center;
}

.countdown-number {
    font-size: 12rem;
    font-weight: 700;
    color: white;
    line-height: 1;
    margin-bottom: 20px;
    animation: countdownPulse 0.75s ease-in-out;
    text-shadow: 0 0 60px rgba(255, 107, 157, 0.5);
}

@keyframes countdownPulse {
    0% {
        transform: scale(1.5);
        opacity: 0;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.9);
        opacity: 1;
    }
}

.countdown-text {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    letter-spacing: 2px;
}

/* 倒计时数字颜色 */
.countdown-number.count-4 {
    background: linear-gradient(135deg, #FF6B9D, #C44DFF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.countdown-number.count-3 {
    background: linear-gradient(135deg, #FF9500, #FFD700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.countdown-number.count-2 {
    background: linear-gradient(135deg, #00D4FF, #5AC8FA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.countdown-number.count-1 {
    background: linear-gradient(135deg, #34C759, #30D158);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.countdown-number.count-go {
    font-size: 10rem;
    background: linear-gradient(135deg, #FF6B9D, #FFD700, #00D4FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: countdownGo 0.75s ease-in-out;
}

@keyframes countdownGo {
    0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(5deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .game-area {
        grid-template-columns: 1fr;
    }
    
    .blocks-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .frames-container {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        border-radius: 16px;
    }
    
    .logo {
        gap: 10px;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .header-info {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }
    
    .score, .level, .timer {
        padding: 8px 12px;
        border-radius: 12px;
        font-size: 0.85rem;
        flex: 1;
        min-width: 0;
    }
    
    .score i, .level i, .timer i {
        font-size: 0.9rem;
    }
    
    .game-area {
        gap: 15px;
        margin-bottom: 15px;
    }
    
    .left-panel, .center-panel, .right-panel {
        gap: 15px;
    }
    
    .card, .sound-player, .instructions, .blocks-container, .drop-zone, .game-stats, .level-progression, .settings {
        padding: 15px;
        border-radius: 16px;
    }
    
    .card h2, .sound-player h2, .blocks-container h2, .drop-zone h2, .game-stats h2, .level-progression h2, .settings h2 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .instructions h3 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .instructions p {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 5px;
    }
    
    .blocks-grid,
    .frames-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
        margin-top: 12px;
    }
    
    .block {
        border-radius: 14px;
        font-size: 1.6rem;
    }
    
    .frame {
        border-radius: 14px;
        border-width: 2px;
    }
    
    .submit-area {
        flex-direction: column;
        gap: 12px;
        margin-top: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-top: 12px;
    }
    
    .stat-item {
        padding: 12px;
        border-radius: 12px;
        gap: 10px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        border-radius: 10px;
    }
    
    .stat-info h4 {
        font-size: 0.75rem;
    }
    
    .stat-info p {
        font-size: 1.3rem;
    }
    
    .player-controls {
        gap: 10px;
        margin: 15px 0;
        flex-wrap: nowrap;
    }
    
    .btn {
        justify-content: center;
        padding: 10px 14px;
        font-size: 0.85rem;
        flex: 1;
    }
    
    .visualizer {
        height: 80px;
        padding: 15px;
        margin: 15px 0;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .setting-item input[type="range"] {
        width: 100%;
    }
    
    .setting-item select {
        width: 100%;
    }
    
    .switch {
        align-self: flex-end;
    }
    
    .progress-bar {
        height: 10px;
        margin: 15px 0;
    }
    
    .progress-text {
        font-size: 0.95rem;
    }
    
    .footer {
        padding: 15px;
        margin-top: 15px;
        border-radius: 16px;
    }
    
    .footer p {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 12px;
    }
    
    .logo i {
        font-size: 1.8rem;
    }
    
    .logo h1 {
        font-size: 1.3rem;
    }
    
    .header-info {
        gap: 6px;
    }
    
    .score, .level, .timer {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    
    .blocks-grid,
    .frames-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .visualizer {
        height: 60px;
        padding: 10px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .stat-info p {
        font-size: 1.1rem;
    }
}

/* 工具类 */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.p-20 { padding: 20px; }

/* ================================
   移动端平台特定优化
   ================================ */

/* 基础触摸目标优化 */
    .block, .frame, .btn, .stat-item {
        min-height: 44px; /* iOS 最小触摸目标 */
        min-width: 44px;
    }
    
    /* 移动端悬停状态优化 */
    @media (hover: none) and (pointer: coarse) {
        .block:hover, .btn:hover, .card:hover {
            transform: none !important;
            box-shadow: none !important;
        }
    
    .block:active, .btn:active {
        transform: scale(0.98) !important;
        opacity: 0.9 !important;
    }
    
    /* 移动端拖放视觉反馈 */
    .block.dragging {
        opacity: 0.7;
        transform: scale(1.05);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    }
}

/* iOS 特定优化 */
@supports (-webkit-touch-callout: none) {
    body.ios-platform {
        /* iOS 字体渲染优化 */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .btn, .block, .frame {
        /* iOS 点击反馈优化 */
        -webkit-tap-highlight-color: rgba(0, 122, 255, 0.1);
    }
    
    /* 弹性滚动优化 */
    .game-area, .blocks-grid, .frames-container {
        -webkit-overflow-scrolling: touch;
    }
    
    /* iOS 毛玻璃效果优化 */
    .card, .header {
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
    }
}

/* Android 特定优化 */
@media (-android) or (-moz-android) {
    body.android-platform .btn {
        /* Material Design 涟漪效果模拟 */
        position: relative;
        overflow: hidden;
    }
    
    body.android-platform .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%;
    }
    
    body.android-platform .btn:active:after {
        animation: ripple 0.6s ease-out;
    }
    
    @keyframes ripple {
        0% {
            transform: scale(0, 0);
            opacity: 0.5;
        }
        20% {
            transform: scale(25, 25);
            opacity: 0.3;
        }
        100% {
            transform: scale(40, 40);
            opacity: 0;
        }
    }
}

/* 安全区域适配 (iPhone X+ 刘海屏) */
@supports (padding: max(0px)) {
    .header, .footer, .modal-content {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    
    .header {
        padding-top: max(20px, env(safe-area-inset-top));
    }
    
    .footer {
        padding-bottom: max(25px, env(safe-area-inset-bottom));
    }
    
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* 超小屏幕优化 (iPhone SE 等) */
@media (max-width: 350px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    .header-info {
        gap: 10px;
    }
    
    .score, .level, .timer {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .blocks-grid,
    .frames-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .visualizer {
        height: 80px;
        padding: 15px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .stat-info p {
        font-size: 1.5rem;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .game-area {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .header {
        padding: 15px 20px;
        margin-bottom: 15px;
    }
    
    .left-panel, .center-panel, .right-panel {
        gap: 15px;
    }
    
    .visualizer {
        height: 80px;
    }
    
    .blocks-grid,
    .frames-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
    
    .block, .frame {
        min-height: 50px;
    }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .block, .btn {
        border-width: 1.5px;
    }
    
    .frame {
        border-width: 2px;
    }
    
    .progress-bar {
        height: 10px;
    }
}

/* 移动端字体优化 */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    .btn {
        font-size: 0.95rem;
        padding: 12px 20px;
    }
    
    .stat-info h4 {
        font-size: 0.85rem;
    }
    
    .stat-info p {
        font-size: 1.5rem;
    }
}

/* 减少移动端动画性能开销 */
@media (max-width: 768px) {
    .visualizer-bar {
        animation: pulse 2s infinite alternate;
    }
    
    .card {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
}

/* 触摸设备优化 */
.touch-device .block {
    cursor: pointer;
}

.touch-device .block:hover {
    transform: none;
}

/* 加载性能优化 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .card {
        padding: 18px;
    }
}

/* ================================
   性能和动画优化
   ================================ */

/* 动画性能优化 */
.visualizer-bar {
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* 低性能设备优化 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .visualizer-bar {
        animation: none !important;
    }
}

/* 内存和GPU优化 */
@media (max-width: 768px) {
    .card, .header, .footer {
        /* 减少毛玻璃效果强度以提高性能 */
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    
    .visualizer {
        /* 简化可视化器以减少重绘 */
        height: 100px;
    }
}

/* 电池优化 */
@media (prefers-reduced-data: reduce) {
    .visualizer-bar {
        animation: none;
    }
    
    .card:hover {
        transform: none;
        box-shadow: none;
    }
}

/* 触摸滚动优化 */
.game-area, .blocks-grid, .frames-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* 防止文本选择干扰拖放 */
.block, .btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 移动端点击延迟优化 */
@media (max-width: 768px) {
    .btn, .block {
        touch-action: manipulation;
    }
}

/* 视网膜屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), 
       (min-resolution: 192dpi) {
    .btn, .block {
        /* 确保边框在高DPI屏幕上清晰 */
        border-width: 0.5px;
    }
}
/* 移动端布局优化：将登出按钮移到页面底部 */
@media (max-width: 768px) {
    /* 隐藏顶部 header 中的用户信息（包括登出按钮） */
    .header .user-status {
        display: none !important;
    }
    
    /* 显示底部 footer 中的登出按钮 */
    .footer .mobile-logout {
        display: block !important;
        margin-top: 20px;
        padding-top: 15px;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    /* 调整 footer 内边距 */
    .footer {
        padding: 20px 15px;
    }
    
    .footer .footer-links {
        margin-bottom: 10px;
    }
    
    /* 底部登出按钮样式优化 */
    .footer .mobile-logout .btn-danger {
        background: linear-gradient(135deg, #FF3B30, #FF6B9D);
        border: none;
        border-radius: 12px;
        font-weight: 600;
        transition: all 0.3s ease;
        box-shadow: 0 4px 15px rgba(255, 59, 48, 0.3);
    }
    
    .footer .mobile-logout .btn-danger:active {
        transform: translateY(1px);
        box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
    }
}
