* { box-sizing: border-box; }
body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #021526; 
    color: white;
    overflow: hidden;
}

.header { position: fixed; top: 20px; left: 30px; z-index: 20; pointer-events: none; }
.header h1 { margin: 0; font-size: 2.5em; color: #FFD700; text-shadow: 2px 2px 4px rgba(0,0,0,0.8); }
.header p { margin: 5px 0 0 0; font-size: 1.2em; color: #87CEEB; text-shadow: 1px 1px 3px rgba(0,0,0,0.8); }

/* CỤM NÚT ĐIỀU KHIỂN Ở CHÍNH GIỮA TRÊN CÙNG */
.top-center-controls {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 10001; display: flex; align-items: center; gap: 15px;
}

#student-tag {
    background: #32CD32; padding: 10px 25px; border-radius: 30px; 
    font-size: 1.1em; font-weight: bold; border: 2px solid #fff; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); white-space: nowrap;
}

.action-btn {
    padding: 10px 25px; color: white; border: 3px solid #fff; border-radius: 30px;
    font-size: 1.1em; font-weight: bold; cursor: pointer; text-decoration: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); transition: all 0.3s ease;
    display: flex; align-items: center; gap: 8px; white-space: nowrap;
}

#capture-btn { background: #FF1744; }
#capture-btn:hover { transform: scale(1.05); background: #D50000; }
#kq-link { background: #00E676; }
#kq-link:hover { transform: scale(1.05); background: #00c853; }

.settings-panel {
    position: fixed; top: 20px; right: 30px; z-index: 20;
    background: rgba(10, 30, 60, 0.9); border: 2px solid #4682B4;
    padding: 15px; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}
.settings-panel h3 { margin: 0 0 10px 0; color: #00E5FF; font-size: 1em; text-align: center; }
.setting-group { margin-bottom: 10px; display: flex; flex-direction: column; gap: 5px; }
.setting-group label { font-size: 0.8em; color: #ccc; }
.setting-group input, .setting-group select { padding: 5px; border-radius: 5px; font-size: 0.9em; }

.control-panel {
    position: fixed; bottom: 20px; left: 30px; z-index: 20;
    display: flex; gap: 15px;
}

.main-btn {
    padding: 12px 25px; color: white; border: 2px solid #fff; border-radius: 30px;
    font-size: 1.1em; font-weight: bold; cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); transition: all 0.3s ease;
}
#music-btn { background: #D500F9; }
#music-btn.playing { background: #00E5FF; color: #000; animation: pulse 2s infinite; }
#slide-btn { background: #FF9100; }
#practice-btn { background: #32CD32; }
#submit-btn { background: #0088FF; }

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(0, 229, 255, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); }
}

#side-panel {
    position: fixed; top: 0; right: -100vw; width: 100vw; height: 100vh;
    background: #fff; z-index: 9990; box-shadow: -10px 0 30px rgba(0,0,0,0.8);
    transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex; flex-direction: column;
}
#side-panel.open { right: 0; }
.panel-header { background: #4C97FF; color: white; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; font-weight: bold; }
.panel-header.slide-mode { background: #F4B400; }
.close-panel-btn { background: #FF3D00; border: 2px solid #fff; color: #fff; border-radius: 10px; padding: 5px 15px; cursor: pointer; }
.panel-iframe { width: 100%; flex-grow: 1; border: none; display: none; }

#container { width: 100vw; height: 100vh; overflow: auto; cursor: grab; position: relative; padding: 150px; }
#container:active { cursor: grabbing; }
#svg-canvas { position: absolute; top: 0; left: 0; width: 4000px; height: 4000px; pointer-events: none; z-index: 1; }
.branch-line { fill: none; transition: all 0.3s ease; }

.tree-container { position: relative; z-index: 5; display: inline-block; }
ul { list-style: none; padding-left: 100px; position: relative; margin: 0; display: flex; flex-direction: column; gap: 20px; }
ul.root-ul { padding-left: 0; }
li { position: relative; display: flex; align-items: center; }

.node {
    position: relative; display: inline-flex; align-items: center;
    padding: 12px 25px; background: #112A46; border: 2px solid #fff;
    border-radius: 30px; font-size: 1.2em; font-weight: bold;
    color: #fff; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: 0.2s; user-select: none;
}
.node:hover { transform: scale(1.05); border-color: #00E5FF; }
.node.root-node { background: #fff; color: #000; border: 4px solid #FFD700; font-size: 1.5em; }

.collapsed > .children-list { display: none !important; }
.collapsed > .node { background: #4682B4; border-style: dashed; opacity: 0.8; }

.btn-video { margin-left: 15px; padding: 6px 12px; background: #FF3D00; border: 2px solid #fff; border-radius: 20px; color: white; font-weight: bold; font-size: 0.8em; cursor: pointer; }

.modal { display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); justify-content: center; align-items: center; transition: 0.3s; }
.modal.show { display: flex; }
.modal-content { max-width: 80%; max-height: 80vh; border: 3px solid #00e676; border-radius: 15px; }
.close-btn { position: absolute; top: 20px; right: 40px; color: #fff; font-size: 50px; cursor: pointer; }

#karaoke-container {
    position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
    z-index: 100; background: rgba(2, 21, 38, 0.95); padding: 30px 45px; 
    border-radius: 50px; border: 6px solid #00E5FF; box-shadow: 0 0 60px rgba(0, 229, 255, 0.8);
    text-align: center; opacity: 0; visibility: hidden; transition: all 0.5s ease;
    pointer-events: none; width: 95vw; 
}
#karaoke-container.show { opacity: 1; visibility: visible; bottom: 130px; }
#karaoke-text {
    font-size: 10.2vw; font-weight: 900; color: #FFD700;
    text-shadow: 6px 6px 15px #000, 0 0 35px #FFD700; 
    margin: 0; line-height: 1.35; transition: color 0.2s ease; 
}

/* THÊM MỚI: Modal Đăng Nhập Xịn Xò */
.login-modal {
    display: none; position: fixed; z-index: 20000; left: 0; top: 0; 
    width: 100%; height: 100%; background: rgba(2, 21, 38, 0.98); 
    justify-content: center; align-items: center; backdrop-filter: blur(8px);
}
.login-modal.show { display: flex; }
.login-box {
    background: #112A46; padding: 40px; border-radius: 20px; 
    border: 4px solid #00E5FF; text-align: center; color: white; 
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.3); width: 450px; max-width: 90%;
}
.login-box h2 { margin-top: 0; color: #FFD700; font-size: 1.8em; }
.login-box p { font-size: 1.1em; color: #87CEEB; margin-bottom: 20px; }
.login-box input {
    width: 100%; padding: 15px; margin-bottom: 20px; border-radius: 10px; 
    border: 2px solid #4682B4; font-size: 1.2em; text-align: center; 
    outline: none; background: #021526; color: white;
}
.login-box input:focus { border-color: #00E5FF; box-shadow: 0 0 10px rgba(0, 229, 255, 0.5); }
.login-box button {
    padding: 15px; background: #32CD32; border: none; color: white; 
    font-weight: bold; font-size: 1.2em; border-radius: 10px; 
    cursor: pointer; transition: 0.3s; width: 100%; margin-bottom: 10px;
}
.login-box button:hover { background: #28a745; transform: scale(1.05); }