* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0f1117;
  --bg2: #171a23;
  --bg3: #1e2230;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --text: #e2e8f0;
  --muted: #64748b;
  --border: #2a2f3d;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; color: #0f1117;
}
.brand h1 { font-size: 17px; font-weight: 700; }
.subtitle { font-size: 12px; color: var(--muted); }
.search-box { display: flex; gap: 10px; align-items: center; }
#batchSelect {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  max-width: 240px;
}
#search {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 14px;
  width: 300px;
  outline: none;
}
#search:focus, #batchSelect:focus { border-color: var(--accent); }

.layout { display: flex; min-height: calc(100vh - 72px); }
.sidebar {
  width: 270px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 0 20px 12px;
}
#subjectNav { display: flex; flex-direction: column; }
.subject-item {
  padding: 11px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.subject-item:hover { background: var(--bg3); }
.subject-item.active { background: var(--bg3); border-left-color: var(--accent); }
.subject-item .name { font-size: 13px; font-weight: 500; }
.subject-item .count {
  font-size: 11px; color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 8px;
}

.content { flex: 1; padding: 26px 34px; overflow-y: auto; }
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.section-desc { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.topic-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.topic-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.topic-card .t-name { font-size: 14px; font-weight: 600; margin-bottom: 9px; }
.topic-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.badge-video { background: rgba(56,189,248,0.15); color: var(--accent); }
.badge-note { background: rgba(129,140,248,0.15); color: var(--accent2); }

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.back-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.back-btn:hover { border-color: var(--accent); }
.tabs { display: flex; gap: 8px; }
.tab {
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg2);
}
.tab.active { background: var(--accent); color: #0f1117; border-color: var(--accent); }

.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 17px;
  transition: border-color 0.15s;
}
.item-row:hover { border-color: var(--accent); }
.item-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}
.item-icon.video { background: rgba(56,189,248,0.12); color: var(--accent); }
.item-icon.note { background: rgba(129,140,248,0.12); color: var(--accent2); }
.item-info { flex: 1; min-width: 0; }
.item-title { font-size: 14px; font-weight: 500; }
.item-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.play-btn {
  background: var(--accent);
  color: #0f1117;
  border: none;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.play-btn:hover { filter: brightness(1.1); }

.empty { color: var(--muted); padding: 40px; text-align: center; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.close-btn {
  background: none; border: none;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}
.close-btn:hover { color: var(--text); }
.player-wrap { position: relative; background: #000; }
#player { width: 100%; max-height: 60vh; background: #000; }
.player-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  background: rgba(0,0,0,0.7);
  padding: 20px;
  text-align: center;
}
.player-status.hidden { display: none; }
.player-meta {
  padding: 13px 20px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.hidden { display: none !important; }

@media (max-width: 768px) {
  .sidebar { width: 210px; }
  .content { padding: 16px; }
  #search { width: 170px; }
  #batchSelect { max-width: 180px; }
}
