/* 基础设置 */
:root {
    /* 主色调 */
    --primary-color: #2563eb;
    --primary-light: #60a5fa;
    --primary-dark: #1d4ed8;
    --on-primary: #ffffff;
    --primary-container: #dbeafe;
    --on-primary-container: #1e3a8a;
    
    /* 次要色调 */
    --secondary-color: #059669;
    --secondary-light: #34d399;
    --secondary-dark: #047857;
    --on-secondary: #ffffff;
    --secondary-container: #dcfce7;
    --on-secondary-container: #064e3b;
    
    /* 表面颜色 */
    --surface: #ffffff;
    --surface-variant: #f1f5f9;
    --surface-dark: #f8fafc;
    --on-surface: #0f172a;
    --on-surface-variant: #475569;
    
    /* 背景色 */
    --background-color: #f8fafc;
    --background-variant: #f1f5f9;
    
    /* 文本颜色 */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-disabled: #94a3b8;
    
    /* 边框颜色 */
    --border-light: rgba(226, 232, 240, 0.8);
    --border-medium: rgba(203, 213, 225, 0.8);
    --border-strong: rgba(148, 163, 184, 0.8);
    
    /* 阴影系统 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 
                 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 
                 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 
                 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    
    /* 其他变量保持不变 */
    --border-radius: 12px;
    --spacing-unit: 16px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
    overflow-x: hidden;
}

/* 容器样式 */
.metronome-container {
    max-width: 600px;
    margin: 0 auto;
    padding: calc(var(--spacing-unit) * 2);
}

h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: var(--spacing-unit);
}

/* 主区域样式 */
.main-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

/* 速度轮样式 */
.tempo-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-unit);
}

.tempo-controls-card {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-unit);
}

.tempo-wheel {
    position: relative;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tempo-wheel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        var(--primary-color) calc(var(--progress, 120) * 1.8deg),
        transparent calc(var(--progress, 120) * 1.8deg)
    );
    opacity: 0.4;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tempo-wheel-inner {
    position: relative;
    width: 80%;
    height: 80%;
    border-radius: var(--radius-full);
    background: var(--surface);
    border: 1px solid var(--border-light);
    box-shadow: inset var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.tempo-term {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-style: italic;
}

.bpm-display {
    font-size: 3.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.bpm-label {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* 控制按钮样式 */
.control-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.05),
        0 4px 8px rgba(0, 0, 0, 0.1);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.1),
        0 8px 16px rgba(0, 0, 0, 0.1);
    background: var(--primary-color);
    color: white;
}

.control-btn:active {
    transform: scale(0.95);
    background: var(--strong-accent-color);
    color: white;
}

.control-btn:focus {
    outline: none;
    border-color: var(--primary-color, #007AFF);
    box-shadow: var(--shadow-sm), 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.control-btn:disabled {
    opacity: 0.6;
    box-shadow: var(--shadow-sm);
    cursor: not-allowed;
}

/* 节拍指示器样式 */
.beat-indicator {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 
        inset 1px 1px 2px rgba(0, 0, 0, 0.05),
        0 4px 6px rgba(0, 0, 0, 0.05);
}

.beat {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    background: #e0e0e0;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.beat.active {
    animation: beatPulse 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.beat.active[data-accent="2"] {
    background: #1B5E20;
    box-shadow: 0 0 16px rgba(27, 94, 32, 0.5);
}

.beat.active[data-accent="1"] {
    background: #4CAF50;
    box-shadow: 0 0 14px rgba(76, 175, 80, 0.5);
}

.beat.active[data-accent="0"] {
    background: #2196F3;
    box-shadow: 0 0 12px rgba(33, 150, 243, 0.5);
}

@keyframes beatPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

/* 设置区域样式 */
.settings-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-unit);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.setting-select {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: none;
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    color: var(--text-color);
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.setting-select:focus {
    outline: none;
    border-color: var(--primary-color, #007AFF);
    box-shadow: var(--shadow-sm), 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.setting-select:disabled {
    opacity: 0.6;
    box-shadow: var(--shadow-sm);
    cursor: not-allowed;
}

/* 主控制按钮样式 */
.primary-btn {
    width: 100%;
    padding: 16px 32px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--primary-color);
    color: var(--on-primary);
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.primary-btn:active {
    background-color: darken(var(--primary-color), 10%);
}

.primary-btn:focus {
    outline: none;
    border-color: var(--primary-color, #007AFF);
    box-shadow: var(--shadow-sm), 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.primary-btn:disabled {
    opacity: 0.6;
    box-shadow: var(--shadow-sm);
    cursor: not-allowed;
}

/* 响应式 */
@media (max-width: 480px) {
    :root {
        --spacing-unit: 12px;
    }

    .tempo-wheel {
        width: min(80vw, 300px);
        height: min(80vw, 300px);
    }

    .tempo-term {
        font-size: min(4vw, 1.1rem);
        margin-bottom: 8px;
    }

    .bpm-display {
        font-size: min(12vw, 3.5rem);
        line-height: 1;
    }

    .bpm-label {
        font-size: min(3.5vw, 1rem);
        margin-top: 8px;
    }

    .control-btn {
        width: min(12vw, 48px);
        height: min(12vw, 48px);
        font-size: min(4vw, 1rem);
    }

    .beat {
        width: min(8vw, 32px);
        height: min(8vw, 32px);
    }

    .beat-indicator {
        gap: min(2vw, 10px);
        padding: min(3vw, 16px);
    }

    h1 {
        font-size: min(5vw, 1.5rem);
    }

    .segment-btn {
        font-size: min(3.5vw, 0.95rem);
        padding: min(2vw, 12px) min(3vw, 16px);
    }

    .setting-select {
        font-size: min(3.5vw, 0.95rem);
        padding: min(2vw, 12px) min(3vw, 16px);
    }

    .primary-btn {
        font-size: min(4vw, 1.1rem);
        padding: min(3vw, 16px) min(4vw, 32px);
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        /* 主色调 */
        --primary-color: #60a5fa;
        --primary-light: #93c5fd;
        --primary-dark: #3b82f6;
        --on-primary: #1e3a8a;
        --primary-container: #1e3a8a;
        --on-primary-container: #dbeafe;
        
        /* 次要色调 */
        --secondary-color: #34d399;
        --secondary-light: #6ee7b7;
        --secondary-dark: #10b981;
        --on-secondary: #064e3b;
        --secondary-container: #064e3b;
        --on-secondary-container: #dcfce7;
        
        /* 表面颜色 */
        --surface: #1e293b;
        --surface-variant: #334155;
        --surface-dark: #0f172a;
        --on-surface: #f8fafc;
        --on-surface-variant: #cbd5e1;
        
        /* 背景色 */
        --background-color: #0f172a;
        --background-variant: #1e293b;
        
        /* 文本颜色 */
        --text-primary: #f8fafc;
        --text-secondary: #e2e8f0;
        --text-tertiary: #cbd5e1;
        --text-disabled: #64748b;
        
        /* 边框颜色 */
        --border-light: rgba(51, 65, 85, 0.8);
        --border-medium: rgba(71, 85, 105, 0.8);
        --border-strong: rgba(100, 116, 139, 0.8);
        
        /* 阴影系统 */
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 
                     0 2px 4px -2px rgba(0, 0, 0, 0.2);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 
                     0 4px 6px -4px rgba(0, 0, 0, 0.2);
        --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 
                     0 8px 10px -6px rgba(0, 0, 0, 0.2);
    }

    .tempo-wheel {
        background: var(--surface);
        box-shadow: var(--shadow-lg);
    }

    .setting-select {
        background: #1a1a1a;
        border-color: #333;
        color: white;
    }

    .tempo-term {
        color: #aaa;
    }

    .card {
        background: var(--surface-variant);
        border-color: rgba(255, 255, 255, 0.05);
    }

    .control-btn {
        background: rgba(40, 40, 40, 0.9);
        color: var(--primary-color);
    }

    .setting-select {
        background: rgba(40, 40, 40, 0.9);
        border-color: rgba(255, 255, 255, 0.1);
        color: rgba(255, 255, 255, 0.9);
    }

    .primary-btn {
        background: linear-gradient(135deg, var(--primary-color), #1565C0);
    }

    .beat-indicator {
        background: rgba(30, 41, 59, 0.95);
        backdrop-filter: blur(8px);
        box-shadow: 
            inset 1px 1px 2px rgba(0, 0, 0, 0.3),
            0 4px 6px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .beat {
        background: #334155;
        border-color: rgba(255, 255, 255, 0.1);
    }

    .beat.active[data-accent="2"] {
        background: #22c55e;
        box-shadow: 0 0 16px rgba(34, 197, 94, 0.5);
    }

    .beat.active[data-accent="1"] {
        background: #4ade80;
        box-shadow: 0 0 14px rgba(74, 222, 128, 0.5);
    }

    .beat.active[data-accent="0"] {
        background: #60a5fa;
        box-shadow: 0 0 12px rgba(96, 165, 250, 0.5);
    }

    .beat.count-in.active {
        background: #fbbf24;
        box-shadow: 0 0 14px rgba(251, 191, 36, 0.5);
    }
}

/* 新增和修改的样式 */
.setting-group {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    margin: 8px 0;
}

.segmented-control {
    display: flex;
    flex-wrap: wrap;
    background: var(--surface-variant);
    border-radius: var(--radius-lg);
    padding: 4px;
    gap: 4px;
    width: 100%;
    margin: 8px 0;
}

/* 节奏类型按钮 */
.rhythm-type {
    display: flex;
    gap: 4px;
}

.rhythm-type .segment-btn {
    flex: 1;
    min-width: 100px;
    padding: 12px 16px;
    white-space: nowrap;
}

/* 拍号选择按钮 */
.time-signature {
    display: flex;
    gap: 4px;
}

.time-signature .segment-btn {
    flex: 1;
    min-width: 60px;
    padding: 12px 16px;
    font-size: 0.95rem;
}

/* 预备拍控制样式优化 */
.count-in-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.count-in-bars-group {
    display: flex;
    gap: 4px;
    flex: 1;
}

.count-in-controls .segment-btn {
    padding: 12px 16px;
    min-width: 80px;
    white-space: nowrap;
}

.count-in-controls .segment-btn i {
    margin-right: 8px;
}

/* 移动端适 */
@media (max-width: 480px) {
    .count-in-controls {
        flex-wrap: wrap;
    }
    
    .count-in-bars-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .count-in-controls .segment-btn {
        min-width: calc(33.33% - 4px);
        padding: 10px 8px;
    }
}

/* 通用按钮样式 */
.segment-btn {
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.segment-btn.active {
    background: var(--primary-color);
    color: var(--on-primary);
    box-shadow: var(--shadow-sm);
}

/* 自定义复选框样式 */
.count-in-label input[type="checkbox"] {
    display: none;
}

.count-in-label .checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-primary);
    transition: all 0.2s ease;
    background-color: transparent;
}

.count-in-label input[type="checkbox"]:checked + .checkbox-custom {
    background-color: var(--primary-color);
}

.count-in-label .checkbox-custom i {
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.count-in-label input[type="checkbox"]:checked + .checkbox-custom i {
    opacity: 1;
    transform: scale(1);
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .count-in-label {
        color: var(--text-primary);
    }

    .count-in-label .checkbox-custom {
        border-color: var(--primary-color);
        background-color: transparent;
    }

    .count-in-label input[type="checkbox"]:checked + .checkbox-custom {
        background-color: var(--primary-color);
        border-color: var(--primary-color);
    }

    .count-in-label input[type="checkbox"]:checked + .checkbox-custom i {
        color: var(--on-primary);
    }

    .count-in-label:hover .checkbox-custom {
        border-color: var(--primary-light);
    }

    .count-in-label input[type="checkbox"]:checked:hover + .checkbox-custom {
        background-color: var(--primary-light);
        border-color: var(--primary-light);
    }
}

/* 添加卡片基础样式 */
.card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.05),
        0 10px 15px rgba(0, 0, 0, 0.1);
    padding: calc(var(--spacing-unit) * 1.5);
}

/* 设置域卡片样式 */
.settings-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-unit);
}

/* 速度控制按钮样式 */
.tempo-controls {
    display: flex;
    justify-content: space-between;
}

/* 分隔线样式 */
.divider {
    width: 100%;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 17px 0;
}

/* 设置组样式 */
.setting-group {
    display: flex;
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .divider {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* 移动端适配 */
@media (max-width: 480px) {
    .setting-group {
        flex-direction: column;
    }
}

.tempo-term {
    color: #666666;
}

.bpm-display {
    color: #1a1a1a;
}

.bpm-label {
    color: #999999;
}

/* 设置卡片样式 */
.card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.02),
        0 4px 8px rgba(0, 0, 0, 0.02);
}

/* 控制按钮样式 */
.control-btn {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #4361ee;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.control-btn:hover {
    background: #4361ee;
    color: #ffffff;
    box-shadow: 0 4px 8px rgba(67, 97, 238, 0.15);
}

/* 下拉选择框样式 */
.setting-select {
    background: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
}

/* 主按钮样式 */
.primary-btn {
    background: #4361ee;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.2);
}

.primary-btn:hover {
    background: #3651d4;
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.25);
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    .tempo-wheel {
        background: #1a1a1a;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }

    .tempo-wheel-inner {
        background: #1a1a1a;
        border-color: rgba(255, 255, 255, 0.1);
    }

    .tempo-term {
        color: #999999;
    }

    .bpm-display {
        color: #ffffff;
    }

    .card {
        background: #1a1a1a;
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: 
            0 2px 4px rgba(0, 0, 0, 0.2),
            0 4px 8px rgba(0, 0, 0, 0.2);
    }

    .control-btn {
        background: #2a2a2a;
        border-color: rgba(255, 255, 255, 0.1);
        color: #6b89ff;
    }

    .control-btn:hover {
        background: #6b89ff;
        color: #ffffff;
    }

    .setting-select {
        background: #2a2a2a;
        border-color: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }
}

.beat.count-in.active {
    background: #FFC107;
    box-shadow: 0 0 14px rgba(255, 193, 7, 0.5);
}

/* 添加新的分段控制器样式 */
.segmented-control {
    display: flex;
    background: var(--surface-variant);
    border-radius: var(--radius-lg);
    padding: 4px;
    gap: 4px;
    width: 100%;
    margin: 8px 0;
}

/* 节奏类型和拍号选择按钮 */
.segment-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.segment-btn.active {
    background: var(--primary-color);
    color: var(--on-primary);
    box-shadow: var(--shadow-sm);
}

/* 预备控制样式优化 */
.count-in-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 16px;
}

.count-in-bars-group {
    display: flex;
    gap: 4px;
    flex: 1;
}

.count-in-controls .segment-btn {
    padding: 12px 16px;
    min-width: 80px;
    white-space: nowrap;
}

.count-in-controls .segment-btn i {
    margin-right: 8px;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .count-in-controls {
        flex-wrap: wrap;
    }
    
    .count-in-bars-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .count-in-controls .segment-btn {
        min-width: calc(33.33% - 4px);
        padding: 10px 8px;
    }
}

/* 控制按钮样式优化 */
.control-btn {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--surface-variant);
    color: var(--primary-color);
    font-size: 1.25rem;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 开始按钮样式 */
.primary-btn {
    width: 100%;
    padding: 16px 32px;
    border-radius: var(--radius-lg);
    background: var(--primary-color);
    color: var(--on-primary);
    font-size: 1.1rem;
    font-weight: 500;
    border: none;
    margin-top: 24px;
}

/* 活跃状态样式 */
.active {
    background: var(--primary-color);
    color: var(--on-primary);
}

/* 悬停效果 */
@media (hover: hover) {
    .segment-btn:hover:not(.active) {
        background: rgba(var(--primary-color-rgb), 0.1);
    }
    
    .control-btn:hover {
        transform: translateY(-2px);
        background: var(--primary-color);
        color: var(--on-primary);
    }
    
    .count-in-btn:hover:not(.active),
    .count-in-bar-btn:hover:not(.active) {
        background: rgba(var(--primary-color-rgb), 0.1);
    }
}

/* 移动端适配优化 */
@media (max-width: 480px) {
    .segmented-control {
        flex-wrap: wrap;
    }
    
    .segment-btn {
        min-width: calc(50% - 4px);
        padding: 10px 14px;
    }
    
    .control-btn {
        width: 48px;
        height: 48px;
    }
    
    .count-in-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

/* 添加动画效果 */
.transition {
    transition-property: all;
}

.duration-150 {
    transition-duration: 150ms;
}

.duration-200 {
    transition-duration: 200ms;
}

.ease-in {
    transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}

.ease-out {
    transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
}

.transform {
    transform-origin: center;
}

.scale-95 {
    transform: scale(0.95);
}

.scale-100 {
    transform: scale(1);
}

.opacity-0 {
    opacity: 0;
}

.opacity-100 {
    opacity: 1;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .count-in-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .count-in-bars-control {
        justify-content: space-between;
    }
    
    .count-in-btn,
    .count-in-bar-btn {
        justify-content: center;
    }
}

/* 基础控制卡片样式 */
.basic-controls {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    padding: calc(var(--spacing-unit) * 1.5);
    width: calc(100vw - 2rem);
    max-width: 400px;
    border-radius: calc(var(--radius-lg) + 4px) calc(var(--radius-lg) + 4px);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

/* 高级设置面板动画样 */
.advanced-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    will-change: transform, opacity, max-height;
    transform-origin: center top;
    overflow: hidden;
    /* 进入动画时间 */
    transition: 
        max-height 0.8s cubic-bezier(.6,1.06,.58,.97),
        opacity 1s cubic-bezier(0.23, 1, 0.32, 1) 0.1s,
        transform 1s cubic-bezier(0.23, 1, 0.32, 1);
    backface-visibility: hidden;
    perspective: 1200px;
}

/* 进入动画 */
.advanced-controls-enter-active {
    transition: 
        max-height 0.8s cubic-bezier(.6,1.06,.58,.97),
        opacity 1s cubic-bezier(0.23, 1, 0.32, 1) 0.1s,
        transform 1s cubic-bezier(0.23, 1, 0.32, 1);
}

.advanced-controls-enter-from {
    opacity: 0;
    transform: scale3d(0.92, 0.92, 1) translateZ(-120px);
    max-height: 0;
    pointer-events: none;
}

.advanced-controls-enter-to {
    opacity: 1;
    transform: scale3d(1, 1, 1) translateZ(0);
    max-height: 800px;
    pointer-events: auto;
}

/* 离开动画 */
.advanced-controls-leave-active {
    transition: 
        max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.advanced-controls-leave-from {
    opacity: 1;
    transform: scale3d(1, 1, 1) translateZ(0);
    max-height: 800px;
    pointer-events: auto;
}

.advanced-controls-leave-to {
    opacity: 0;
    transform: scale3d(0.92, 0.92, 1) translateZ(-120px);
    max-height: 0;
    pointer-events: none;
}

/* 3D效果容器 */
.advanced-controls-wrapper {
    perspective: 1200px;
    perspective-origin: center top;
    transform-style: preserve-3d;
}

/* 控制按钮行样式 */
.controls-row {
    position: relative;
    width: 100%;
    margin-top: var(--spacing-unit);
}

/* 速度控制按钮组 */
.tempo-controls {
    display: flex;
    justify-content: space-between;
    width: calc(100% - 52px); /* 为展开按钮留出空间 */
}

/* 控制按钮统一样式 */
.control-btn {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--surface-variant);
    color: var(--primary-color);
    font-size: 1.25rem;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* 展开按钮样式 */
.expand-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.3s ease, color 0.2s ease;
}

.expand-btn:hover {
    color: var(--primary-color);
}

.expand-btn.expanded {
    transform: translateY(-50%) rotate(180deg);
    color: var(--primary-color);
}

/* 移动端适配 */
@media (max-width: 480px) {
    .control-btn {
        width: 50px;
        height: 50px;
    }
    
    .tempo-controls {
        width: calc(100% - 44px); /* 移动端稍微调整间距 */
    }

    .control-btn{
        margin: 0 8px;
    }
}

/* 添加 Alpine.js 的 x-cloak 指令样式 */
[x-cloak] {
    display: none !important;
}

.segmented-control.rhythm-type{
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.segmented-control.time-signature{
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
@media (max-width: 480px) {
    .segmented-control{
        border-radius: var(--radius-lg) !important;
    }
}

.setting-group{
    margin: 0;
}

.controls-row,
.primary-btn{
    margin-top: 0;
}

/* 速度轮样式 */
.tempo-wheel {
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-light);
}

.tempo-wheel-inner {
    background: var(--surface);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
    .tempo-wheel-inner {
        border-color: var(--border-light);
        box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.02);
    }
}


@media (max-width: 480px) {
    .beat-indicator{
        margin-top: 14px;
    }
}