:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --border: #2b313a;
  --stage-bg: #000;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: baseline; gap: 8px; font-size: 15px; }
.brand-name { font-weight: 700; letter-spacing: .2px; }
.brand-sep { color: var(--muted); }
.brand-title { color: var(--muted); font-weight: 500; }
.controls { display: flex; align-items: center; gap: 12px; }
.counter { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; min-width: 56px; text-align: right; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--accent); }

/* Stage */
.stage-wrap {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 18px;
}
.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  width: min(100%, calc((100vh - 190px) * (16 / 9)));
  max-height: 100%;
  background: var(--stage-bg);
  box-shadow: 0 10px 40px rgba(0,0,0,.55);
  border-radius: 6px;
  overflow: hidden;
}
.slide-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  user-select: none; -webkit-user-drag: none;
}
.video-overlay {
  position: absolute;
  background: #000;
  overflow: hidden;
}
.video-overlay video {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

/* Nav arrows */
.nav-arrow {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  z-index: 5;
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  background: rgba(22,27,34,.78);
  color: var(--text);
  border: 1px solid var(--border); border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .15s, transform .15s, opacity .15s;
}
.nav-arrow:hover { background: var(--accent); transform: translateY(-50%) scale(1.06); }
.nav-arrow.prev { left: 20px; }
.nav-arrow.next { right: 20px; }
.nav-arrow:disabled { opacity: .3; pointer-events: none; }

/* Filmstrip */
.filmstrip {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.filmstrip::-webkit-scrollbar { height: 8px; }
.filmstrip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.thumb {
  position: relative;
  flex: 0 0 auto;
  width: 104px; height: 58.5px;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: #000;
  opacity: .65;
  transition: opacity .15s, border-color .15s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { opacity: 1; }
.thumb.active { opacity: 1; border-color: var(--accent); }
.thumb .num {
  position: absolute; bottom: 2px; left: 3px;
  font-size: 10px; line-height: 1; padding: 1px 4px;
  background: rgba(0,0,0,.6); border-radius: 3px; color: #fff;
}
.thumb .vbadge {
  position: absolute; top: 3px; right: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.thumb .vbadge svg { width: 8px; height: 8px; fill: #fff; }

/* Loading */
#app.loading .stage-wrap::after {
  content: "Loading…";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px;
}

@media (max-width: 700px) {
  .brand-title { display: none; }
  .nav-arrow { width: 40px; height: 40px; }
  .nav-arrow.prev { left: 8px; }
  .nav-arrow.next { right: 8px; }
  .thumb { width: 80px; height: 45px; }
  .stage { width: min(100%, calc((100vh - 170px) * (16 / 9))); }
}
