.container { max-width: 1400px !important; width: 100%; padding: 2rem 1.5rem; }
html { scrollbar-gutter: stable; }
:root { --toc-w: 300px; }
.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--toc-w); grid-template-areas: "main toc" "footer toc"; gap: 2.5rem; align-items: start; }
.course-main-outer { grid-area: main; width: 100%; min-width: 0; min-height: 60vh; }
.course-footer { grid-area: footer; }
.course-toc { grid-area: toc; position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; overflow-x: hidden; }

.toc-card { background: var(--bg-white); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); padding: 0; }
.toc-header { padding: 1.25rem 1.25rem; border-bottom: 1px solid var(--border-color); margin-bottom: 0.5rem; }
.toc-title { font-weight: 800; color: var(--text-main); font-size: 1.1rem; margin-bottom: 0.25rem; }
.toc-hint { color: var(--text-muted); font-size: 0.8rem; }
.toc-progress-wrap { margin-top: 1rem; }
.toc-progress-track { width: 100%; height: 6px; background: var(--border-color); border-radius: 999px; overflow: hidden; }
.toc-progress-bar { height: 100%; background: var(--success); border-radius: 999px; transition: width 0.5s ease; }
.toc-progress-text { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); margin-top: 6px; text-align: right; }

.toc-cap { position: relative; }
.toc-cap:last-of-type { margin-bottom: 1rem; }
.toc-cap-btn { width: 100%; text-align: left; border: 0; background: transparent; padding: 0.8rem 1.25rem; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; transition: background 0.2s; font-weight: 700; color: var(--text-main); font-size: 0.95rem; }
.toc-cap-btn:hover { background: var(--bg-body); }
.toc-cap-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.toc-cap-dot { width: 24px; height: 24px; border-radius: 6px; display:flex; align-items:center; justify-content:center; background: var(--bg-body); color: var(--primary); font-weight: 800; font-size: 0.8rem; flex-shrink: 0; border: 1px solid var(--border-color); }
.toc-cap-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc-cap-chevron { color: var(--text-muted); font-size: 1.2rem; flex-shrink: 0; transition: transform 0.3s ease; line-height: 1; }
.toc-cap.open .toc-cap-chevron { transform: rotate(90deg); }

.toc-lesson-list { position: relative; max-height: 0; overflow: hidden; transition: max-height 0.3s ease-in-out; margin-left: 1.5rem; padding-left: 1.5rem; margin-top: -2px; margin-bottom: 0.5rem; }
.toc-lesson-list::before { content: ''; position: absolute; left: 1.5rem; top: 0; bottom: 0; width: 2px; background: var(--border-color); }
.toc-cap.open .toc-lesson-list { max-height: 1000px; }

.toc-lesson-item { width: 100%; border: 0; background: transparent; cursor: pointer; padding: 0.7rem 1rem 0.7rem 3rem; text-align: left; border-radius: 0; color: var(--text-muted); font-size: 0.88rem; display: flex; align-items: center; gap: 0.6rem; position: relative; transition: all 0.2s ease; border-bottom: 1px solid transparent; }
.toc-lesson-item:hover { background: var(--bg-body); color: var(--text-main); }
.toc-lesson-item.active { background: linear-gradient(to right, rgba(79, 70, 229, 0.08), transparent); color: var(--primary); font-weight: 600; }

.toc-circle { position: absolute; left: 1.5rem; top: 50%; transform: translate(-50%, -50%); width: 12px; height: 12px; background: var(--bg-white); border: 2px solid var(--border-color); border-radius: 50%; z-index: 2; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toc-circle:hover { border-color: var(--primary); transform: translate(-50%, -50%) scale(1.2); }
.toc-circle svg { display: none; width: 8px; height: 8px; color: white; }
.toc-circle.completed { border-color: var(--success); background: var(--success); }
.toc-circle.completed svg { display: block; }

.toc-moving-dot { position: absolute; left: 1.5rem; top: 0; transform: translate(-50%, -50%); width: 14px; height: 14px; background: var(--primary); border: 3px solid var(--bg-white); border-radius: 50%; box-shadow: 0 0 0 2px var(--primary); transition: top 0.3s cubic-bezier(0.4, 0.0, 0.2, 1); z-index: 3; pointer-events: none; }
.toc-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; opacity: 0.7; }
.toc-lesson-item.active .toc-icon { opacity: 1; }
.toc-nav { margin: 1rem 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 0.75rem; }
.toc-nav-status { text-align: center; font-size: 0.8rem; color: var(--text-muted); }
.toc-nav-btns { display: flex; gap: 0.5rem; }
.toc-nav-btns .btn { flex: 1; }

@media (max-width: 900px) { .container { padding: 1rem 0.5rem; } .course-layout { grid-template-columns: 1fr; grid-template-areas: "main" "toc" "footer"; gap: 1.5rem; } .course-main-outer { min-height: auto; } .course-toc { position: relative; top: auto; max-height: none; overflow: visible; padding-left: 0; } }

.custom-video-player { position: relative; width: 100%; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; outline: none; }
.custom-video-player:focus { outline: none; }
.video-thumbnail-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; z-index: 2; filter: blur(4px); transform: scale(1.1); }
.play-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; z-index: 3; cursor: pointer; background: rgba(0,0,0,0.3); transition: background 0.2s; }
.play-overlay:hover { background: rgba(0,0,0,0.45); }
.play-overlay button { background: rgba(255,255,255,0.9); border: none; border-radius: 50%; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; color: var(--primary); cursor: pointer; transition: transform 0.2s; }
.play-overlay:hover button { transform: scale(1.1); }
.custom-video-player video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; background: #000; object-fit: contain; display: block; cursor: pointer; }
.exit-fs-btn { display: none; position: absolute; top: 12px; right: 12px; z-index: 25; background: rgba(0,0,0,0.5); color: white; border: none; border-radius: 8px; width: 36px; height: 36px; align-items: center; justify-content: center; cursor: pointer; }
.custom-video-player.fake-fullscreen .exit-fs-btn { display: flex; }
.custom-controls { position: absolute; bottom: 0; left: 0; right: 0; z-index: 20; background: linear-gradient(transparent, rgba(0,0,0,0.85)); padding: 2rem 0.75rem 0.5rem; opacity: 1; transition: opacity 0.3s; }
.progress-bar-container { position: relative; height: 6px; background: rgba(255,255,255,0.25); border-radius: 3px; cursor: pointer; margin-bottom: 0.5rem; }
.progress-bar-buffered { position: absolute; top: 0; left: 0; height: 100%; background: rgba(255,255,255,0.35); border-radius: 3px; width: 0%; }
.progress-bar-played { position: absolute; top: 0; left: 0; height: 100%; background: var(--primary, #4F46E5); border-radius: 3px; width: 0%; pointer-events: none; }
.chapter-markers { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; }
.chapter-marker { position: absolute; top: -3px; bottom: -3px; width: 3px; background: rgba(255,255,255,0.85); cursor: pointer; pointer-events: auto; transform: translateX(-50%); z-index: 3; transition: background 0.2s, width 0.2s; border-radius: 1px; }
.chapter-marker:hover { background: #FBBF24; width: 5px; }
.chapter-tooltip { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); background: #111827; color: white; padding: 6px 12px; border-radius: 8px; font-size: 0.78rem; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; display: none; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,0.4); z-index: 100; line-height: 1.4; }
.chapter-tooltip strong { color: #FBBF24; margin-right: 4px; }
.chapter-marker:hover .chapter-tooltip { display: block; }
.controls-bottom-row { display: flex; align-items: center; gap: 0.5rem; color: white; }
.ctrl-btn { background: none; border: none; color: white; cursor: pointer; padding: 4px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.ctrl-btn:hover { background: rgba(255,255,255,0.15); }
.volume-slider { width: 70px; height: 4px; -webkit-appearance: none; appearance: none; background: rgba(255,255,255,0.3); border-radius: 2px; cursor: pointer; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; background: white; border-radius: 50%; cursor: pointer; }
.volume-slider::-moz-range-thumb { width: 12px; height: 12px; background: white; border-radius: 50%; cursor: pointer; border: none; }
.time-display { font-size: 0.8rem; color: rgba(255,255,255,0.9); flex: 0 0 auto; margin-left: 8px; margin-right: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.toolbar-group { display: flex; align-items: center; gap: 0.25rem; }
.speed-wrapper { position: relative; }
.speed-toggle { font-size: 0.85rem; font-weight: 600; min-width: 50px; }
.speed-menu { display: none; position: absolute; bottom: 100%; right: 0; background: var(--bg-white, #fff); border: 1px solid var(--border-color, #e5e7eb); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); margin-bottom: 6px; overflow: hidden; z-index: 50; min-width: 80px; }
.speed-menu.open { display: block; }
.speed-option { padding: 0.5rem 1rem; cursor: pointer; font-size: 0.85rem; color: var(--text-main, #111); transition: background 0.15s; text-align: center; }
.speed-option:hover { background: var(--bg-body, #f3f4f6); }
.speed-option.active { background: var(--primary, #4F46E5); color: white; font-weight: 600; }
.skip-feedback { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.75); color: white; padding: 8px 22px; border-radius: 10px; font-size: 1.1rem; font-weight: 700; opacity: 0; transition: opacity 0.2s ease; pointer-events: none; z-index: 15; backdrop-filter: blur(4px); }
.skip-feedback.left { left: 24px; } .skip-feedback.right { right: 24px; } .skip-feedback.show { opacity: 1; }
.custom-video-player.fake-fullscreen { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 99999; border-radius: 0; aspect-ratio: auto; }
.auto-next-card { position: absolute; bottom: 70px; right: 16px; z-index: 21; background: rgba(17, 24, 39, 0.9); color: white; padding: 1rem 1.25rem; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; gap: 0.5rem; max-width: 280px; backdrop-filter: blur(8px); box-shadow: 0 10px 20px rgba(0,0,0,0.3); opacity: 0; transform: translateY(20px); transition: all 0.3s ease; }
.auto-next-card.show { opacity: 1; transform: translateY(0); }
.auto-next-title { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auto-next-sub { font-size: 0.75rem; color: #9CA3AF; display: flex; align-items: center; gap: 0.5rem; }
.auto-next-progress { width: 100%; height: 3px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden; }
.auto-next-progress-bar { height: 100%; background: var(--primary); width: 0%; }
.auto-next-cancel { font-size: 0.7rem; color: #9CA3AF; text-decoration: underline; cursor: pointer; background: none; border: none; padding: 0; text-align: left; margin-left: auto; }
.video-sticky-note { display: none; position: absolute; top: 60px; right: 16px; width: 320px; min-width: 250px; min-height: 200px; max-height: 70%; background: var(--bg-white); border: 1px solid var(--border-color); border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,0.25); z-index: 30; flex-direction: column; overflow: hidden; resize: both; }
.video-sticky-note.open { display: flex; animation: popIn 0.2s ease; }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.note-header { padding: 0.65rem 0.9rem; background: var(--bg-body); color: var(--text-main); border-bottom: 1px solid var(--border-color); font-weight: 600; font-size: 0.85rem; display: flex; justify-content: space-between; align-items: center; cursor: move; user-select: none; flex-shrink: 0; }
.note-close { background: none; border: none; color: var(--text-muted); font-size: 1.4rem; cursor: pointer; line-height: 1; padding: 0; } .note-close:hover { color: var(--text-main); }
.note-body { flex: 1; overflow-y: auto; padding: 0.5rem; }
.note-item { background: var(--bg-body); border: 1px solid var(--border-color); border-radius: 8px; padding: 0.5rem 0.75rem; margin-bottom: 0.4rem; position: relative; font-size: 0.82rem; color: var(--text-main); }
.note-item-time { display: inline-block; color: var(--primary); cursor: pointer; font-weight: 700; font-size: 0.72rem; margin-bottom: 0.2rem; background: var(--bg-white); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border-color); } .note-item-time:hover { background: var(--primary); color: white; }
.note-item-text { word-wrap: break-word; line-height: 1.35; }
.note-item-delete { position: absolute; top: 4px; right: 4px; background: transparent; border: 1px solid var(--border-color); border-radius: 50%; width: 18px; height: 18px; cursor: pointer; font-size: 0.7rem; display: flex; align-items: center; justify-content: center; color: var(--text-muted); } .note-item-delete:hover { background: #EF4444; color: white; border-color: #EF4444; }
.note-input-area { padding: 0.5rem; border-top: 1px solid var(--border-color); background: var(--bg-body); flex-shrink: 0; }
.note-textarea { width: 100%; border: 1px solid var(--border-color); border-radius: 8px; padding: 0.5rem; font-size: 0.82rem; resize: none; min-height: 50px; max-height: 100px; margin-bottom: 0.4rem; box-sizing: border-box; background: var(--bg-white); color: var(--text-main); } .note-textarea:focus { outline: none; border-color: var(--primary); }
.note-btn { flex: 1; padding: 0.4rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-white); cursor: pointer; font-size: 0.78rem; font-weight: 600; color: var(--text-main); } .note-btn:disabled { opacity: 0.4; cursor: not-allowed; } .note-btn:hover:not(:disabled) { background: var(--bg-body); }
.note-ts-btn { background: var(--primary) !important; color: white !important; border-color: var(--primary) !important; } .note-ts-btn:hover:not(:disabled) { opacity: 0.9; background: var(--primary) !important; }
.chapter-link { background: var(--bg-body); border: 1px solid var(--border-color); color: var(--primary); padding: 2px 8px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; margin-right: 4px; transition: all 0.2s; display: inline-block; } .chapter-link:hover { background: var(--primary); color: white; border-color: var(--primary); }
.custom-video-player.touch-device .custom-controls { opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.custom-video-player.touch-device.show-controls .custom-controls { opacity: 1; pointer-events: auto; }
.custom-video-player.touch-device .volume-control { display: none !important; }
@media (max-width: 768px) { .video-sticky-note { position: fixed; top: auto; bottom: 0; right: 0; left: 0; width: 100%; height: 50vh; max-height: 50vh; border-radius: 16px 16px 0 0; resize: none; } .time-display { font-size: 0.7rem; } .auto-next-card { right: 8px; max-width: calc(100% - 16px); } }
.icon-pause, .icon-vol-mute, .icon-fs-exit { display: none; }
.icon-play, .icon-vol-high, .icon-fs-enter { display: block; }
.card-text-content ul, .card-text-content ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.card-text-content li { margin-bottom: 0.25rem; }
.card-text-content h2 { font-size: 1.3rem; font-weight: 700; margin: 1rem 0 0.4rem; }
.card-text-content h3 { font-size: 1.1rem; font-weight: 600; margin: 0.8rem 0 0.3rem; }
.card-text-content a { color: var(--primary); }
.user-highlight { background: #FEF08A; border-radius: 4px; padding: 0 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.05); position: relative; }
.user-highlight:hover { background: #FDE047; }
.hl-delete-btn { position: absolute; top: -10px; right: -10px; width: 18px; height: 18px; background: #EF4444; color: white; border: 1px solid white; border-radius: 50%; cursor: pointer; display: none; align-items: center; justify-content: center; font-size: 12px; line-height: 1; font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.user-highlight:hover .hl-delete-btn { display: flex; }
.highlight-tooltip { position: absolute; background: #111827; color: white; padding: 6px 12px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; display: none; z-index: 100; box-shadow: 0 4px 6px rgba(0,0,0,0.2); transition: background 0.2s; }
.highlight-tooltip:hover { background: #4F46E5; }
.highlights-fab { position: fixed; bottom: 2rem; right: 2rem; width: 48px; height: 48px; background: var(--primary); color: white; border: none; border-radius: 50%; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2); cursor: pointer; z-index: 50; display: flex; align-items: center; justify-content: center; transition: transform 0.2s; }
.highlights-fab:hover { transform: scale(1.1); }
.highlights-panel { position: fixed; bottom: 5.5rem; right: 2rem; width: 320px; max-height: 400px; background: white; border-radius: 16px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); z-index: 50; display: none; flex-direction: column; overflow: hidden; }
.highlights-panel.open { display: flex; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.highlight-item { padding: 1rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; gap: 1rem; }
.highlight-item:last-child { border-bottom: none; }
.highlight-item-text { font-size: 0.9rem; color: var(--text-main); line-height: 1.4; flex: 1; }