/* static/css/style.css */

/* === 全局基础 === */
body {
    user-select: none;
    -webkit-user-select: none;
    background-color: #0f172a; 
    overscroll-behavior: none;
}

/* === 琴键滚动区域 === */
#keyboard-scroll-area {
    touch-action: pan-x; 
    cursor: grab;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 15px; /* 给滚动条留点空隙 */
    
    /* Firefox 默认行为 */
    scrollbar-width: auto; 
    scrollbar-color: #475569 #1e293b; 
}
#keyboard-scroll-area:active {
    cursor: grabbing;
}

/* === 核心：滚动条逻辑分流 === */

/* 1. 移动端 (小于 1024px): 隐藏原生条，使用自定义条 */
@media (max-width: 1023px) {
    #keyboard-scroll-area::-webkit-scrollbar {
        display: none;
    }
}

/* 2. PC端 (大于 1024px): 显示美化的原生条 */
@media (min-width: 1024px) {
    #keyboard-scroll-area::-webkit-scrollbar {
        display: block;
        height: 12px;
    }
    #keyboard-scroll-area::-webkit-scrollbar-track {
        background: #0f172a; 
        border-radius: 6px;
    }
    #keyboard-scroll-area::-webkit-scrollbar-thumb {
        background: #334155; 
        border-radius: 6px;
        border: 2px solid #0f172a;
    }
    #keyboard-scroll-area::-webkit-scrollbar-thumb:hover {
        background: #475569;
    }
}

/* === 自定义物理滚动条 (仅移动端生效) === */
.custom-scroll-container {
    width: 90%;
    max-width: 800px;
    height: 40px; /* 加大触控热区 */
    margin: 5px auto 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.scroll-track {
    width: 100%;
    height: 8px; /* 轨道高度 */
    background-color: #1e293b;
    border-radius: 4px;
    position: relative;
    border: 1px solid #334155;
    cursor: pointer; /* 提示可点击 */
}

.scroll-thumb {
    width: 100px; /* 初始宽度 */
    height: 20px; /* 滑块高度 */
    background-color: #64748b;
    border: 2px solid #94a3b8;
    border-radius: 10px;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    cursor: grab;
    touch-action: none; /* 防止拖动触发页面滚动 */
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}

.scroll-thumb:active {
    background-color: #38bdf8;
    border-color: #fff;
    cursor: grabbing;
}

/* === 琴键结构 === */
.key-unit {
    position: relative;
    height: 100%;
    flex-shrink: 0;
    user-select: none;
}

.key-white-visual {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #ffffff 0%, #e2e8f0 100%);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    border-radius: 0 0 4px 4px;
    border-right: 1px solid #cbd5e1;
    transform-origin: top;
    transition: background 0.05s, transform 0.05s;
    z-index: 1;
}

.key-white-visual.active {
    background: linear-gradient(to bottom, #38bdf8 0%, #0ea5e9 100%) !important;
    box-shadow: 0 0 10px #0ea5e9, inset 0 0 10px rgba(255,255,255,0.5);
    transform: scaleY(0.98); 
    border-bottom: 5px solid #0284c7;
}

.key-black {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 60%;
    background: linear-gradient(to bottom, #334155 0%, #0f172a 100%);
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.1);
    border-radius: 0 0 4px 4px;
    z-index: 20;
    transform-origin: top;
    transition: background 0.05s, transform 0.05s;
    pointer-events: auto;
}

.key-black.active {
    background: linear-gradient(to bottom, #f472b6 0%, #db2777 100%) !important;
    box-shadow: 0 0 15px #db2777;
    transform: translateX(-50%) scaleY(0.98);
}

.lcd-screen {
    background-color: #0f172a;
    box-shadow: inset 0 0 10px #000000;
    border: 1px solid #334155;
    font-family: 'Courier New', Courier, monospace;
    text-shadow: 0 0 5px rgba(56, 189, 248, 0.5);
}

.recording-dot {
    animation: pulse-red 1s infinite;
}
@keyframes pulse-red {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.hide-labels .note-label { display: none !important; }

#mobile-menu { transition: transform 0.3s ease-in-out; }