/* 音阶选择器样式 */
.scale-selector {
    display: flex;
    gap: 15px;
    align-items: end;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.selector-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 150px;
}

.selector-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--dark-color);
    font-size: 0.9rem;
}

.selector {
    padding: 12px 15px;
    border: 2px solid #b0b0b0; /* 加深边框颜色 */
    border-radius: var(--border-radius);
    font-size: 14px;
    background: white;
    transition: var(--transition);
}

.selector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

/* 音符输入区域 */
.notes-input-container {
    margin-bottom: 15px;
}

.notes-input-box {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.quick-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.notes-label {
    font-size: 0.85rem;
    color: var(--gray-dark);
    margin-right: 5px;
}

.note-btn {
    padding: 5px 10px;
    background: var(--gray-light);
    border: 1px solid var(--gray-medium);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.note-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* 新增音符显示样式 */
.note-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 10px !important;
    border-radius: var(--border-radius) !important;
    background: #e9ecef !important;
    border: 1px solid var(--gray-light) !important;
    min-width: 60px !important;
    color: var(--dark-color) !important; /* 确保文字颜色不被覆盖 */
}

.note-name {
    font-size: 1.5rem !important;
    font-weight: bold !important;
    color: var(--dark-color) !important;
}

.note-degree {
    font-size: 0.9rem !important;
    color: var(--gray-dark) !important;
    margin-top: 5px !important;
}

/* 偏音特殊样式 */
.note-item.bianyin {
    background: #fff3cd !important;
    border-color: #ffeeba !important;
}

.note-item.bianyin .note-name {
    color: #856404 !important;
}

.note-item.bianyin .note-degree {
    color: #856404 !important;
    font-weight: bold !important;
}

/* 居中显示音符 */
.scale-notes {
    justify-content: center;
}

/* 音阶分析结果样式 */
.analysis-results {
    margin-top: 15px;
}

.analysis-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark-color);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .scale-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    .selector-group {
        flex: 0 1 auto; /* Allow shrinking, basis auto */
        width: 100%; /* Explicitly set width to 100% */
        max-width: 100%; /* Ensure it doesn't exceed 100% */
        min-width: auto; /* Reset min-width to avoid potential conflicts */
        box-sizing: border-box; /* Include padding and border in the element's total width */
    }
    
    .notes-input-box {
        flex-direction: column;
    }
    
    .quick-notes {
        justify-content: center;
    }

    .note-item {
        min-width: 50px !important;
        padding: 8px !important;
    }

    .note-name {
        font-size: 1.2rem !important;
    }

    .note-degree {
        font-size: 0.8rem !important;
    }
}


/* 五度圈容器 */
.circle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.circle-of-fifths-diagram {
    position: relative;
    width: 350px; /* 整体图表大小 */
    height: 350px;
    border-radius: 50%;
    background-color: #f8f9fa; /* 背景色 */
    border: 2px solid var(--gray-medium);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 中心点 */
.circle-center-point {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 调性音符样式 */
.key-note {
    position: absolute;
    width: 60px; /* 音符大小 */
    height: 60px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    transform: translate(-50%, -50%); /* 居中定位 */
    background-color: var(--gray-light);
    border: 1px solid var(--gray-medium);
    font-size: 0.9rem;
    color: var(--dark-color);
    text-align: center;
    line-height: 1.2;
    z-index: 5;
}

.key-note .note-main {
    font-size: 1.1rem;
    font-weight: bold;
}

.key-note .note-minor {
    font-size: 0.7rem;
    color: var(--gray-dark);
}

.key-note:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.3);
}

.key-note:hover .note-minor {
    color: white;
}

.key-note.active {
    background-color: var(--primary-color);
    color: white; /* 确保文字颜色为白色 */
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.5);
    transform: translate(-50%, -50%) scale(1.15);
}

.key-note.active .note-main,
.key-note.active .note-minor {
    color: white; /* 确保激活时内部文字也为白色 */
}

.key-note.active .note-minor {
    color: white;
}

/* 连接线 */
.circle-line {
    position: absolute;
    background-color: var(--gray-medium); /* 线的颜色 */
    height: 1px; /* 线的粗细 */
    transform-origin: 0 0; /* 旋转原点 */
    z-index: 1;
    opacity: 0.6; /* 稍微透明 */
}

/* 信息面板 */
.circle-info-panel {
    background: var(--gray-light);
    padding: 20px;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.circle-info-panel h4 {
    margin-bottom: 10px;
    color: var(--dark-color);
    font-size: 1.2rem;
}

.circle-info-panel p {
    margin: 5px 0;
    font-size: 0.95rem;
    color: var(--gray-dark);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .circle-of-fifths-diagram {
        width: 300px;
        height: 300px;
    }

    .key-note {
        width: 55px;
        height: 55px;
        font-size: 0.85rem;
    }

    .key-note .note-main {
        font-size: 1rem;
    }

    .key-note .note-minor {
        font-size: 0.65rem;
    }

    .circle-center-point {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .circle-of-fifths-diagram {
        width: 260px;
        height: 260px;
    }

    .key-note {
        width: 50px;
        height: 50px;
        font-size: 0.8rem;
    }

    .key-note .note-main {
        font-size: 0.9rem;
    }

    .key-note .note-minor {
        font-size: 0.6rem;
    }

    .circle-center-point {
        width: 45px;
        height: 45px;
        font-size: 0.9rem;
    }

    .circle-info-panel {
        padding: 15px;
    }

    .circle-info-panel h4 {
        font-size: 1.1rem;
    }

    .circle-info-panel p {
        font-size: 0.9rem;
    }
}


/* 音阶分析结果改进样式 */
.analysis-subtitle {
    font-size: 0.9rem;
    color: var(--gray-dark);
    margin-top: 5px;
}

.analysis-info {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
}

.primary-result {
    border: 2px solid var(--primary-color);
    background: #f0f7ff;
}

.match-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.complete-badge {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
}

.folk-badge {
    background: #ffc107;
    color: #212529;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
}

/* 音符高亮样式 */
.note-item-small.first-note {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
}

.note-item-small.matched-note {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.note-item-small.unmatched-note {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    opacity: 0.7;
}

.bianyin-info {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #856404;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .match-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .chord-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .chord-header h4 {
        margin-bottom: 5px;
    }
}

/* 切换式选择器组样式 */
.scale-selector-group {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

.scale-selector-group.active {
    display: flex;
}

.scale-category-selector {
    margin-bottom: 15px;
    width: 100%;
}

.scale-category-selector .selector-group {
    min-width: 200px;
}

.folk-scale-selector {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
    width: 100%;
}

.folk-scale-selector .selector-group {
    flex: 1;
    min-width: 120px;
}

.western-scale-selector {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
    width: 100%;
}

.western-scale-selector .selector-group {
    flex: 1;
    min-width: 150px;
}

/* 切换动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .scale-category-selector .selector-group {
        min-width: 100%;
    }
    
    .folk-scale-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    .folk-scale-selector .selector-group {
        flex: 0 1 auto;
        width: 100%;
        max-width: 100%;
        min-width: auto;
        box-sizing: border-box;
    }
    
    .western-scale-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    .western-scale-selector .selector-group {
        flex: 0 1 auto;
        width: 100%;
        max-width: 100%;
        min-width: auto;
        box-sizing: border-box;
    }
}
