:root {
  --accent: #ff6b00;
  --accent-hover: #ff7f1f;
  --bg: #0c0c0c;
  --bg-2: #111111;
  --card: #191919;
  --surface: #222;
  --surface-2: #343434;
  --border: #292929;
  --text: #efefef;
  --muted: #9a9a9a;
  --muted-2: #737373;
  --max: 1340px;
  --gap: 12px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #000;
  border-bottom: 1px solid var(--border);
}

.header-main { background: #000; }
.header-inner {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -.7px;
  flex: 0 0 auto;
}
.brand-mark { color: #fff; }
.brand::first-letter { color: var(--accent); }

.search { flex: 1; max-width: 540px; margin: 0 auto; display: flex; }
.search input {
  width: 100%;
  height: 34px;
  border: 1px solid #242424;
  border-right: 0;
  outline: 0;
  border-radius: 20px 0 0 20px;
  background: #191919;
  color: var(--text);
  padding: 0 14px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}
.search button {
  height: 34px;
  width: 45px;
  border: 1px solid #242424;
  border-left: 0;
  border-radius: 0 20px 20px 0;
  background: #191919;
  color: #9c9c9c;
  cursor: pointer;
}
.search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

.mobile-menu { display: none; width: 38px; height: 34px; border: 1px solid #333; background: #141414; border-radius: 6px; }
.mobile-menu span { display: block; height: 1px; width: 17px; background: #ddd; margin: 4px auto; }

.category-bar { background: #111; border-top: 1px solid #171717; border-bottom: 1px solid var(--border); }
.category-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.category-inner::-webkit-scrollbar { display: none; }
.category-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 40px;
  white-space: nowrap;
  color: #bababa;
  border-radius: 20px;
  font-size: 13px;
}
.category-link:hover { color: #fff; background: #1a1a1a; }
.category-link.active { color: #fff; background: var(--accent); }
.category-count { font-size: 11px; opacity: .65; }

.main { min-height: 68vh; padding-top: 18px; padding-bottom: 50px; }
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 11px;
  margin-bottom: 16px;
}
.toolbar h1, .toolbar h2 { margin: 0; font-size: 20px; line-height: 1.15; font-weight: 700; }
.sort { display: inline-flex; gap: 8px; }
.sort button {
  border: 0;
  border-radius: 18px;
  padding: 8px 12px;
  cursor: pointer;
  background: #171717;
  color: #9e9e9e;
  font-size: 12px;
}
.sort button.active { background: var(--accent); color: #fff; }

.video-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap); }
.video-card { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid #1f1f1f; }
.video-card:hover { border-color: #363636; }
.card-thumb {
  display: block;
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #121212;
}
.thumb-art {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 14px;
  text-align: center;
  color: rgba(255,255,255,.88);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -.5px;
  transition: transform .25s ease;
}
.video-card:hover .thumb-art { transform: scale(1.03); }
.thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.42));
}
.play-icon {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 45px; height: 45px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.2);
  display: grid; place-items: center;
  opacity: .88;
}
.play-icon::after {
  content: '';
  margin-left: 3px;
  width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid #fff;
}
.duration { position: absolute; right: 6px; bottom: 6px; padding: 2px 6px; background: rgba(0,0,0,.78); border-radius: 3px; font: 600 10px/1 Arial, sans-serif; }

.card-info { padding: 9px 10px 10px; }
.card-title { font-size: 14px; font-weight: 700; line-height: 1.25; margin: 0 0 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; color: #8b8b8b; font: 11px Arial, sans-serif; }
.card-meta .cat { color: #a9a9a9; }

.empty { text-align: center; border: 1px solid var(--border); background: #101010; padding: 50px 20px; border-radius: 8px; color: var(--muted); }

.breadcrumb { color: #a2a2a2; font-size: 14px; margin-bottom: 16px; }
.breadcrumb a:hover { color: #fff; }
.player-shell { background: #111; border: 1px solid var(--border); }
.player-frame { aspect-ratio: 16/9; width: 100%; border: 0; display: block; background: #090909; }
.player-placeholder { aspect-ratio: 16/9; display: grid; place-items: center; padding: 30px; text-align: center; color: #aaa; background: radial-gradient(circle at center, #222, #0c0c0c 60%); }
.player-placeholder strong { display: block; color: #fff; margin-bottom: 8px; font-size: 18px; }
.player-placeholder code { word-break: break-all; background: #181818; border: 1px solid #2d2d2d; border-radius: 5px; padding: 6px 9px; display: inline-block; margin-top: 8px; color: #ffae77; font-size: 12px; }
.video-head { padding: 10px 6px 16px; border-bottom: 1px solid var(--border); }
.video-head h1 { margin: 0 0 7px; font-size: 27px; line-height: 1.2; }
.video-stats { display: flex; flex-wrap: wrap; gap: 12px; color: #9d9d9d; font: 12px Arial, sans-serif; }
.detail-section { padding-top: 16px; }
.detail-label { color: #9f9f9f; font: 12px Arial, sans-serif; margin-bottom: 7px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 7px; }
.pill { padding: 6px 10px; border-radius: 5px; background: #2d2d2d; border: 1px solid #3a3a3a; color: #ccc; font-size: 12px; }

.related { margin-top: 27px; }
.related h2 { margin: 0 0 12px; font-size: 19px; }
.related .video-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.site-footer { background: #090909; border-top: 1px solid var(--border); }
.footer-inner { min-height: 110px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #858585; font: 12px Arial, sans-serif; }
.footer-inner p { margin: 3px 0 0; max-width: 520px; }
.footer-brand { color: #eee; font: 800 17px Arial, sans-serif; }
.footer-note { text-align: right; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); background: #1e1e1e; border: 1px solid #383838; color: #fff; padding: 9px 13px; border-radius: 7px; opacity: 0; pointer-events: none; transition: .2s; font: 12px Arial, sans-serif; z-index: 200; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1200px) {
  .video-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .related .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .header-inner { min-height: 50px; }
  .brand { font-size: 20px; }
  .mobile-menu { display: block; }
  .search { max-width: none; }
  .video-grid, .related .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .video-head h1 { font-size: 22px; }
}
@media (max-width: 460px) {
  .container { padding: 0 10px; }
  .video-grid, .related .video-grid { gap: 8px; }
  .card-info { padding: 8px; }
  .card-title { font-size: 13px; }
  .footer-inner { flex-direction: column; align-items: flex-start; justify-content: center; padding: 20px 10px; }
  .footer-note { text-align: left; }
}

/* Thumbnail themes */
.thumb-geography { background: linear-gradient(135deg, #1d2733 0%, #324f66 48%, #182126 100%); }
.thumb-math { background: linear-gradient(135deg, #35221a 0%, #7a4d2e 45%, #211713 100%); }
.thumb-english { background: linear-gradient(135deg, #24203b 0%, #5d4c89 45%, #19152a 100%); }
.thumb-physics { background: linear-gradient(135deg, #2f2415 0%, #8b6c32 45%, #1c160e 100%); }
.thumb-biology { background: linear-gradient(135deg, #182d1e 0%, #3d7650 45%, #101c13 100%); }

.loading { padding: 72px 24px; text-align: center; color: #777; }
.small-note { color: #888; font-size: .9rem; margin-top: 4px; }
.setup-help { margin-top: 20px; background: #fff6ee; border: 1px solid #ffd8bb; padding: 16px; border-radius: 12px; line-height: 1.7; text-align: left; }
.error-box { max-width: 760px; margin: 50px auto; }
.description { line-height: 1.8; color: #555; white-space: pre-line; }
.thumb-image { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 0; }
