:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  color: #111827;
  background: #f3f5f8;
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; }
body { margin: 0; overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
.brand { color: #2563eb; font-weight: 800; letter-spacing: 0; }
.mobile-only { display: none; }

.center-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.empty-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}
.empty-card h1 { margin: 10px 0 12px; font-size: 26px; }
.empty-card p { color: #667085; line-height: 1.6; }
.text-link { color: #2563eb; font-weight: 700; }

.learn-shell {
  height: 100dvh;
  width: 100vw;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  overflow: hidden;
  background: #eef2f7;
}
.learn-sidebar {
  min-width: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #dbe2ea;
}
.sidebar-head {
  min-height: 88px;
  padding: 18px 18px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #eef1f5;
}
.sidebar-head h1 { margin: 6px 0 0; font-size: 22px; }
.link-meta { padding: 12px 18px; border-bottom: 1px solid #eef1f5; display: grid; gap: 4px; }
.link-meta span { font-weight: 700; }
.link-meta small { color: #667085; }
.course-tree { flex: 1; overflow: auto; padding: 10px; }
.folder { margin-bottom: 8px; }
.folder-title {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: #eef4ff;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-weight: 800;
}
.folder.collapsed .folder-videos { display: none; }
.folder.collapsed .folder-title b { transform: rotate(-90deg); }
.folder-videos { display: grid; gap: 4px; padding: 6px 0 0 10px; }
.course-item {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  padding: 7px 10px;
  color: #344054;
}
.course-item span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.course-item:hover { background: #f2f4f7; }
.course-item.active { background: #2563eb; color: #fff; }
.learn-main { min-width: 0; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.learn-topbar {
  min-height: 64px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-bottom: 1px solid #dbe2ea;
}
.learn-topbar strong { display: block; font-size: 18px; }
.learn-topbar span { display: block; color: #667085; font-size: 13px; margin-top: 3px; }
.icon-btn { border: 1px solid #d0d5dd; background: #fff; border-radius: 6px; width: 38px; height: 38px; font-size: 22px; line-height: 1; }
.player-wrap {
  min-height: 0;
  padding: 14px;
  display: grid;
  place-items: center;
  position: relative;
}
.player-wrap .video-js,
.player-wrap .tcplayer,
.player-wrap .player {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  max-height: calc(100dvh - 92px);
  background: #050814;
}
.player-empty {
  position: absolute;
  inset: 14px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #050814;
  color: #fff;
  font-size: 18px;
}

.admin-shell { height: 100dvh; display: grid; grid-template-columns: 240px minmax(0, 1fr); background: #f3f5f8; }
.admin-sidebar { background: #0f172a; color: #fff; padding: 22px 14px; display: grid; align-content: start; gap: 12px; }
.admin-sidebar .brand { color: #93c5fd; }
.admin-sidebar h1 { margin: 4px 0 16px; font-size: 22px; }
.nav-btn { min-height: 40px; border: 0; border-radius: 6px; background: rgba(255,255,255,.08); color: #fff; text-align: left; padding: 0 12px; }
.nav-btn.active { background: #2563eb; }
.admin-main { min-width: 0; overflow: auto; padding: 22px; }
.admin-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.admin-top h2 { margin: 0 0 4px; font-size: 26px; }
.admin-top p { margin: 0; color: #667085; }
.admin-top button, .admin-form button, .link-actions button, .empty-card button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-weight: 800;
  padding: 0 14px;
}
.admin-card { background: #fff; border: 1px solid #dbe2ea; border-radius: 8px; padding: 18px; margin-bottom: 16px; }
.admin-card h3 { margin: 0 0 14px; }
.admin-form { display: grid; gap: 14px; }
.admin-form label, .admin-login label { display: grid; gap: 7px; font-weight: 700; color: #344054; }
.admin-form input, .admin-login input, .link-item input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}
.scope-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.small-btn, .ghost-btn { background: #e5e7eb !important; color: #111827 !important; }
.scope-list { max-height: 360px; overflow: auto; border: 1px solid #dbe2ea; border-radius: 8px; padding: 10px; }
.scope-folder { border-bottom: 1px solid #eef1f5; padding: 8px 0; }
.scope-folder:last-child { border-bottom: 0; }
.check-row { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 8px; font-weight: 600 !important; }
.check-row input { width: 16px; min-height: 16px; }
.folder-check small { margin-left: auto; color: #667085; font-weight: 500; }
.folder-video-list { display: grid; gap: 4px; padding-top: 6px; }
.video-check { padding-left: 24px; font-weight: 400 !important; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.message { min-height: 20px; color: #b42318; }
.link-list { display: grid; gap: 10px; }
.link-item { border: 1px solid #dbe2ea; border-radius: 8px; padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.link-item strong, .link-item span, .link-item small { display: block; }
.link-item span, .link-item small, .muted { color: #667085; }
.link-item input { margin-top: 8px; font-size: 13px; color: #475467; }
.link-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.danger-btn { background: #dc2626 !important; }

@media (max-width: 760px) {
  .mobile-only { display: inline-grid; place-items: center; }
  .learn-shell { grid-template-columns: 1fr; }
  .learn-sidebar {
    position: fixed;
    z-index: 20;
    inset: 0 auto 0 0;
    width: min(86vw, 330px);
    transform: translateX(-105%);
    transition: transform .18s ease;
    box-shadow: 18px 0 40px rgba(15, 23, 42, .16);
  }
  .learn-sidebar.open { transform: translateX(0); }
  .learn-topbar { min-height: 58px; padding: 10px 12px; }
  .learn-topbar strong { font-size: 15px; }
  .player-wrap { padding: 0; background: #050814; }
  .player-wrap .video-js,
  .player-wrap .tcplayer,
  .player-wrap .player {
    max-height: calc(100dvh - 58px);
    border-radius: 0;
  }
  .player-empty { inset: 0; border-radius: 0; }
  .admin-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .admin-sidebar { display: flex; align-items: center; gap: 10px; padding: 12px; overflow: auto; }
  .admin-sidebar h1 { margin: 0; font-size: 18px; white-space: nowrap; }
  .nav-btn { white-space: nowrap; }
  .admin-main { padding: 12px; }
  .admin-top { display: grid; }
  .link-item { grid-template-columns: 1fr; }
}
