/* 全螢幕 Canvas */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #000;
    font-family: 'Segoe UI', sans-serif;
    color: #fff;
    overflow: hidden;
}

#videoCanvas,
#drawCanvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#drawCanvas {
    pointer-events: none;
    /* 不阻擋滑鼠事件 */
}

/* song title */
#songTitle {
    display: none;
    /* 預設隱藏 */
    position: absolute;
    bottom: 0;
    /* 背景延伸到底部 */
    left: 0;
    width: 100%;
    /* 跟螢幕同寬 */
    text-align: center;
    font-size: 50px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.7);
    background-color: rgba(0, 0, 0, 0.5);
    /* 半透明黑色背景 */
    padding: 20px 0;
    /* 上下留白，背景高度較高 */
    pointer-events: none;
    z-index: 10;
}


/* 控制按鈕區 */
#controls {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
}

#controls button {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#playBtn {
    background: #28a745;
    color: #fff;
}

#stopBtn {
    background: #dc3545;
    color: #fff;
}

#showListBtn {
    background: #007bff;
    color: #fff;
}

/* list title */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

#closeList {
    cursor: pointer;
    font-size: 28px;
    color: #aaa;
}

#closeList:hover {
    color: #ff4d4d;
}

/* 搜尋框 */
#searchBox {
    padding: 10px 20px;
    border-bottom: 1px solid #eee;
}

#searchBox input {
    width: 100%;
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

/* MIDI list */
#midiListContainer {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    max-width: 600px;
    height: 75vh;
    background: #fff;
    color: #000;
    border-radius: 12px;
    border: 1px solid #ddd;
    overflow: hidden;
    flex-direction: column;
    z-index: 20;
}

#midiList {
    overflow-y: auto;
    flex: 1;
    padding: 10px;
}

.midi-item {
    padding: 12px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    color: #444;
}

.midi-item:hover {
    background: #e9ecef;
    color: #000;
}

.midi-title {
    font-weight: bold;
}

.midi-composer {
    font-size: 0.9em;
    color: #666;
}

/* 狀態提示 */
.status-box {
    padding: 20px;
    text-align: center;
    color: #555;
    background: #fffde7;
    margin-bottom: 10px;
    border-radius: 5px;
}

.success-box {
    padding: 10px;
    background: #d4edda;
    color: #155724;
    text-align: center;
    margin-bottom: 10px;
}

/* Instrument list 容器 */
#instrumentListContainer {
    display: none;
    position: fixed;
    right: 20px;
    top: 80px;
    width: 260px;
    max-height: 70vh; /* 限制高度，超過可滾動 */
    background: #fff;
    color: #000;
    border-radius: 12px;
    border: 1px solid #ddd;
    overflow: hidden;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    flex-direction: column;
    overflow-y: auto;
}

/* 類別按鈕 */
.category-item {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #eee;
    background: #f8f9fa;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    text-align: left;
    transition: background 0.2s ease, transform 0.2s ease;
    user-select: none;
}

/* 類別懸停 */
.category-item:hover {
    background: #FFC408;
    color: #000;
    transform: translateX(4px);
}

/* 樂器子列表 */
.instrument-sublist {
    max-height: 0;               /* 初始收起 */
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: 10px;
    padding: 0;                  /* 收起時無 padding */
}

/* 展開狀態 */
.instrument-sublist.show {
    max-height: 1000px;          /* 足夠高度，動畫自然展開 */
    padding: 6px 0;              /* 展開時增加上下間距 */
}

/* 樂器按鈕 */
.instrument-item {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #eee;
    background: #f0f0f0;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: all 0.2s ease;
}

.instrument-item:hover {
    background: #FFC408;
    color: #000;
    transform: translateX(4px);
}
