body {
    overflow: hidden;
    margin: 0;
    padding: 0;
    background-color: #1e2227;
}

#chordCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    cursor: grab;
}

#chordCanvas:active {
    cursor: grabbing;
}

.toolbox {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 400px;
    max-width: 90vw;
    max-height: 85vh;
    background: #282c34;
    border: 1px solid #3d4451;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.toolbox.mini-mode {
    top: 20px !important;
    right: 20px !important;
    left: auto !important;
    bottom: auto !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    background: #61afef !important;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}

.toolbox.mini-mode .toolbox-header,
.toolbox.mini-mode .toolbox-content {
    display: none !important;
}

.toolbox.mini-mode::after {
    content: '\f002';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    display: block;
}

.toolbox-header {
    padding: 12px;
    background: #21252b;
    border-bottom: 1px solid #3d4451;
    border-radius: 12px 12px 0 0;
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: default;
    user-select: none;
}

.toggle-btn {
    background: #3d4451;
    border: none;
    color: #abb2bf;
    cursor: pointer;
    font-size: 14px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.toggle-btn:hover { background: #4a5262; color: #fff; }

.toolbox-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.toolbox-menu-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #21252b;
    border-bottom: 1px solid #3d4451;
}

.menu-left, .menu-right { display: flex; align-items: center; gap: 15px; }

.menu-icon-btn {
    color: #abb2bf;
    font-size: 18px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: color 0.2s, transform 0.2s, text-shadow 0.2s;
}

.menu-icon-btn:hover { color: #61afef; transform: scale(1.1); }
/* --- อัปเดตสีตรงนี้เป็นสีเหลือง --- */
.menu-icon-btn.active-mode { color: #ffd700; text-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }
.login-compact:hover { color: #e06c75; }
.logout-compact:hover { color: #e06c75; }

.user-compact { display: flex; align-items: center; gap: 10px; }

.user-name-text {
    font-size: 13px;
    color: #98c379;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

main { padding: 16px 20px; overflow-x: hidden; }

#fileList { display: flex; flex-direction: column; min-width: 0; }
#fileList:empty::before { content: "กำลังโหลดข้อมูล..."; text-align: center; color: #6d757b; padding: 20px; }

#appFooter {
    position: fixed;
    bottom: 20px;
    right: 20px;
    text-align: right;
    color: rgba(255, 255, 255, 0.2);
    font-size: 12px;
    z-index: 5;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    line-height: 1.4;
}

#appFooter a { color: rgba(255, 255, 255, 0.3); text-decoration: none; }
#appFooter a:hover { color: #61afef; }

/* Context Menu */
.custom-context-menu {
    position: fixed;
    background: #282c34;
    border: 1px solid #3d4451;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 2000;
    padding: 5px 0;
    min-width: 180px;
    display: none;
}
.context-menu-item {
    padding: 10px 15px; color: #e8e6e3; cursor: pointer;
    display: flex; align-items: center; gap: 12px;
    font-size: 14px; transition: background 0.2s;
}
.context-menu-item:hover { background: #3d4451; color: #61afef; }
.context-menu-item i { width: 16px; text-align: center; }
.context-menu-item.fav-item i { color: #ffd700; }

/* --- Text Overlay (No background, dynamic position) --- */
.song-info-overlay {
    position: fixed;
    z-index: 50;
    display: none;
    flex-direction: row; 
    align-items: center;
    gap: 8px; 
    pointer-events: auto;
    color: #ffffff;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8), 0 0 10px rgba(0,0,0,0.5); 
    white-space: nowrap;
}

.song-info-overlay.active { display: flex; }

.overlay-fav-btn {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    filter: drop-shadow(1px 1px 3px rgba(0,0,0,0.8));
}

.overlay-fav-btn:active { transform: scale(1.2); }
.overlay-fav-btn .filled { color: #ffd700; }
.overlay-fav-btn .outline { color: rgba(255, 255, 255, 0.4); }

.overlay-song-title {
    font-size: 0.95rem; 
    font-weight: 500;
    margin: 0;
}

.overlay-artist-name {
    font-size: 0.95rem;
    color: #98c379;
    margin: 0;
    cursor: pointer;
    transition: color 0.2s;
}

.overlay-artist-name:hover {
    color: #61afef;
    text-decoration: underline;
}

/* ปุ่มสุ่มเพลง (ขวาบน) */
.canvas-random-btn {
    position: fixed;
    top: 85px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #98c379;
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 100;
    transition: transform 0.2s;
}

.canvas-random-btn.active { display: flex; }
.canvas-random-btn:active { transform: scale(0.9); }

/* Tooltip Alert */
.custom-toast-style {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(40, 44, 52, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    text-align: center;
    white-space: nowrap;
}

/* --- Artist View Styles (Filter & Row) --- */
.artist-filter-bar {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 0 5px 15px 5px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    scrollbar-width: none;
}
.artist-filter-bar::-webkit-scrollbar { display: none; }

.filter-letter-btn {
    background: #282c34;
    border: 1px solid #3d4451;
    color: #abb2bf;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}
.filter-letter-btn.active, .filter-letter-btn:hover {
    background: #61afef;
    color: #1e2227;
    border-color: #61afef;
    font-weight: 600;
}

.artist-item-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px 15px !important;
    cursor: pointer;
}
.artist-item-row .song-title {
    margin: 0;
    font-size: 15px;
}
.artist-item-row .artist-song-count {
    font-size: 12px;
    color: #98c379;
    background: rgba(152, 195, 121, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

/* Responsive Mobile */
@media (max-width: 768px), (max-width: 1024px) and (orientation: portrait) {
    .toolbox.mini-mode, .canvas-random-btn {
        width: 44px !important;
        height: 44px !important;
        right: 15px !important;
    }
    .toolbox.mini-mode { top: 15px !important; }
    .toolbox.mini-mode::after { font-size: 18px; }
    .canvas-random-btn { top: 70px; font-size: 18px; }
}