body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f0f2f5;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    margin: 0;
    user-select: none;
    width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
}

h1 {
    color: #222;
    margin-bottom: 5px;
    font-size: 24px;
}

.controls {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.player-bar {
    width: 100%;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-sizing: border-box;
}

.progress-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="range"] {
    flex-grow: 1;
    cursor: pointer;
}

.time-display {
    font-family: monospace;
    font-size: 13px;
    color: #555;
    min-width: 80px;
    text-align: center;
}

button, select, label {
    padding: 8px 14px;
    font-size: 13px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover:not(:disabled), label:hover {
    border-color: #40a9ff;
    color: #40a9ff;
}

button:disabled {
    background-color: #f5f5f5;
    color: #bfbfbf;
    border-color: #d9d9d9;
    cursor: not-allowed;
}

button.recording {
    background-color: #ff4d4f;
    color: white;
    border-color: #ff4d4f;
}

.piano-scroll-container {
    width: 100%; 
    max-width: 100%; 
    overflow-x: auto;
    background: #1a1a1a;
    padding: 20px 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 15px;
    box-sizing: border-box;
}

.piano {
    display: flex;
    position: relative;
    width: 100%;
    min-width: 900px; 
    height: 220px;
}

.key {
    position: relative;
    box-sizing: border-box;
    cursor: pointer;
}

.key.white {
    flex: 1; 
    height: 200px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 0 0 5px 5px;
    z-index: 1;
    position: relative; /* 保证黑键相对于各自白键定位 */
}

/* 白键激活：纯色填充 + 内阴影条（取代 border-bottom，完全避免抖动和闪烁） */
.key.white.active {
    background-color: #e6f7ff;
    border-color: #1890ff;
    box-shadow: inset 0 -5px 0 #1890ff; 
}

.key.black {
    position: absolute;
    top: 0;
    right: -30%; 
    width: 60%;  
    height: 125px;
    background-color: #222;
    z-index: 2;
    border-radius: 0 0 4px 4px;
    border: 1px solid #111;
}

/* 黑键激活：高亮电光蓝纯色 + 硬件加速发光（无闪烁，无位移） */
.key.black.active {
    background-color: #1890ff;
    border-color: #1890ff;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.6);
}

.key-label {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 10px;
    color: #888;
    pointer-events: none;
}

.status {
    width: 100%;
    max-width: 100%; /* 100% 动态自适应宽 */
    font-size: 14px;
    color: #333;
    font-weight: 500;
    background: #e6f7ff;
    padding: 8px 15px;
    border-radius: 4px;
    border: 1px solid #91d5ff;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.info-panel {
    width: 100%;
    font-size: 12px;
    color: #777;
    line-height: 1.6;
    background: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    box-sizing: border-box;
}

.info-panel a {
    color: #1890ff;
    text-decoration: none;
}

.info-panel a:hover {
    text-decoration: underline;
}

/* ==================== 📄 已载入文件状态徽章 ==================== */
.file-badge {
    font-size: 0.8rem;
    background: #f6ffed; /* 成功绿浅背景 */
    border: 1px solid #b7eb8f; /* 浅绿边框 */
    color: #52c41a; /* 墨绿/成功绿文字 */
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}

/* ==================== 🤖 AI 智能助手的常驻并排排版 ==================== */
.ai-helper-card {
    width: 100%;
    max-width: 100%; /* 与钢琴一致的 100% 动态自适应宽 */
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    box-sizing: border-box;
}

.ai-helper-header {
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
    padding: 12px 20px;
    font-weight: bold;
    font-size: 0.95rem;
}

.ai-helper-body {
    padding: 15px;
    box-sizing: border-box;
}

.helper-desc {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

/* 红色警告免责声明样式 */
.helper-disclaimer {
    margin: 0 0 15px 0;
    font-size: 0.8rem;
    color: #d32f2f; /* 警戒深红 */
    background: #ffebee; /* 浅红背景提示框 */
    border-left: 3px solid #f44336;
    padding: 8px 12px;
    border-radius: 4px;
    line-height: 1.4;
}

/* 双栏弹性网格，实现并排排列 */
.helper-grid {
    display: flex;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
}

.helper-section {
    flex: 1;
    background: #f9f9f9;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 12px;
    box-sizing: border-box;
    min-width: 0; /* 防止 flex 容器子元素溢出 */
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: bold;
    color: #444;
    margin-bottom: 8px;
}

.btn-copy {
    background: #1890ff;
    border: 1px solid #1890ff;
    color: white;
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: #40a9ff;
    border-color: #40a9ff;
}

/* 扩大提示词输入框高度 */
.prompt-text {
    width: 100%;
    height: 250px; /* 大幅增加至 250px */
    padding: 10px;
    font-size: 0.8rem;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    box-sizing: border-box;
    resize: none;
    background: #fff;
    color: #555;
    line-height: 1.5;
    font-family: inherit;
}

/* 数据预览框高度对称 */
.json-preview {
    margin: 0;
    padding: 10px;
    font-family: monospace;
    font-size: 0.8rem;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    height: 250px; /* 与提示词输入框等高，实现视觉轴对称 */
    overflow-y: auto;
    color: #555;
    box-sizing: border-box;
    line-height: 1.5;
}

/* 移动端响应式，窄屏自动回退到上下排列 */
@media (max-width: 768px) {
    .helper-grid {
        flex-direction: column;
    }
    .prompt-text, .json-preview {
        height: 200px;
    }
}